chainlesschain 0.143.0 → 0.145.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 (133) hide show
  1. package/package.json +1 -1
  2. package/src/commands/a2a.js +196 -28
  3. package/src/commands/activitypub.js +157 -27
  4. package/src/commands/agent.js +587 -103
  5. package/src/commands/audit.js +206 -0
  6. package/src/commands/bi.js +152 -27
  7. package/src/commands/bm25.js +111 -27
  8. package/src/commands/browse.js +190 -29
  9. package/src/commands/ccron.js +128 -28
  10. package/src/commands/chat.js +207 -0
  11. package/src/commands/compliance.js +414 -34
  12. package/src/commands/compt.js +127 -29
  13. package/src/commands/consol.js +8 -2
  14. package/src/commands/cowork.js +580 -34
  15. package/src/commands/crosschain.js +182 -28
  16. package/src/commands/dao.js +182 -28
  17. package/src/commands/dlp.js +172 -27
  18. package/src/commands/economy.js +205 -50
  19. package/src/commands/evolution.js +203 -50
  20. package/src/commands/evomap.js +182 -27
  21. package/src/commands/fflag.js +74 -22
  22. package/src/commands/git.js +177 -37
  23. package/src/commands/hardening.js +209 -0
  24. package/src/commands/hmemory.js +204 -50
  25. package/src/commands/incentive.js +209 -0
  26. package/src/commands/inference.js +170 -34
  27. package/src/commands/itbudget.js +149 -33
  28. package/src/commands/kg.js +206 -0
  29. package/src/commands/lowcode.js +195 -38
  30. package/src/commands/marketplace.js +206 -0
  31. package/src/commands/matrix.js +179 -27
  32. package/src/commands/mcpscaf.js +145 -33
  33. package/src/commands/meminj.js +145 -33
  34. package/src/commands/nostr.js +178 -27
  35. package/src/commands/orchestrate.js +217 -0
  36. package/src/commands/orchgov.js +144 -33
  37. package/src/commands/pdfp.js +109 -27
  38. package/src/commands/perf.js +169 -32
  39. package/src/commands/perm.js +144 -33
  40. package/src/commands/pipeline.js +207 -52
  41. package/src/commands/planmode.js +141 -32
  42. package/src/commands/privacy.js +203 -0
  43. package/src/commands/promcomp.js +111 -27
  44. package/src/commands/recommend.js +177 -34
  45. package/src/commands/reputation.js +208 -0
  46. package/src/commands/sandbox.js +206 -0
  47. package/src/commands/seshhook.js +145 -33
  48. package/src/commands/seshsearch.js +141 -33
  49. package/src/commands/seshtail.js +144 -33
  50. package/src/commands/seshu.js +152 -33
  51. package/src/commands/sganal.js +123 -29
  52. package/src/commands/siem.js +201 -34
  53. package/src/commands/sla.js +212 -0
  54. package/src/commands/slotfill.js +146 -33
  55. package/src/commands/social.js +157 -32
  56. package/src/commands/stress.js +206 -0
  57. package/src/commands/svccont.js +145 -33
  58. package/src/commands/terraform.js +206 -0
  59. package/src/commands/tms.js +171 -33
  60. package/src/commands/topiccls.js +146 -33
  61. package/src/commands/uprof.js +141 -32
  62. package/src/commands/vcheck.js +122 -28
  63. package/src/commands/webfetch.js +141 -32
  64. package/src/commands/zkp.js +184 -28
  65. package/src/index.js +40 -0
  66. package/src/lib/a2a-protocol.js +319 -51
  67. package/src/lib/activitypub-bridge.js +288 -50
  68. package/src/lib/agent-economy.js +304 -51
  69. package/src/lib/app-builder.js +279 -46
  70. package/src/lib/audit-logger.js +321 -0
  71. package/src/lib/autonomous-agent.js +284 -48
  72. package/src/lib/bi-engine.js +283 -49
  73. package/src/lib/bm25-search.js +301 -49
  74. package/src/lib/browser-automation.js +296 -49
  75. package/src/lib/chat-core.js +336 -0
  76. package/src/lib/claude-code-bridge.js +341 -0
  77. package/src/lib/compliance-framework-reporter.js +305 -51
  78. package/src/lib/compliance-manager.js +330 -0
  79. package/src/lib/compression-telemetry.js +301 -49
  80. package/src/lib/content-recommender.js +317 -52
  81. package/src/lib/cowork-cron.js +298 -49
  82. package/src/lib/cowork-learning.js +333 -0
  83. package/src/lib/cowork-task-runner.js +308 -51
  84. package/src/lib/cowork-workflow.js +327 -0
  85. package/src/lib/cross-chain.js +311 -51
  86. package/src/lib/dao-governance.js +280 -46
  87. package/src/lib/dlp-engine.js +287 -49
  88. package/src/lib/evolution-system.js +278 -47
  89. package/src/lib/evomap-manager.js +280 -46
  90. package/src/lib/execution-backend.js +294 -48
  91. package/src/lib/feature-flags.js +294 -49
  92. package/src/lib/git-integration.js +285 -47
  93. package/src/lib/hardening-manager.js +341 -0
  94. package/src/lib/hierarchical-memory.js +284 -48
  95. package/src/lib/inference-network.js +308 -51
  96. package/src/lib/iteration-budget.js +302 -50
  97. package/src/lib/knowledge-graph.js +333 -0
  98. package/src/lib/matrix-bridge.js +281 -47
  99. package/src/lib/mcp-scaffold.js +318 -54
  100. package/src/lib/memory-injection.js +288 -49
  101. package/src/lib/nostr-bridge.js +286 -49
  102. package/src/lib/orchestrator.js +293 -48
  103. package/src/lib/pdf-parser.js +298 -49
  104. package/src/lib/perf-tuning.js +309 -50
  105. package/src/lib/permission-engine.js +287 -49
  106. package/src/lib/pipeline-orchestrator.js +289 -49
  107. package/src/lib/plan-mode.js +298 -51
  108. package/src/lib/privacy-computing.js +335 -0
  109. package/src/lib/reputation-optimizer.js +340 -0
  110. package/src/lib/sandbox-v2.js +327 -0
  111. package/src/lib/service-container.js +313 -52
  112. package/src/lib/session-consolidator.js +296 -49
  113. package/src/lib/session-hooks.js +312 -53
  114. package/src/lib/session-search.js +304 -51
  115. package/src/lib/session-tail.js +288 -49
  116. package/src/lib/session-usage.js +298 -52
  117. package/src/lib/siem-exporter.js +298 -51
  118. package/src/lib/skill-marketplace.js +345 -0
  119. package/src/lib/sla-manager.js +341 -0
  120. package/src/lib/slot-filler.js +303 -51
  121. package/src/lib/social-graph-analytics.js +295 -49
  122. package/src/lib/social-graph.js +272 -49
  123. package/src/lib/stress-tester.js +342 -0
  124. package/src/lib/sub-agent-registry.js +302 -53
  125. package/src/lib/task-model-selector.js +302 -50
  126. package/src/lib/terraform-manager.js +333 -0
  127. package/src/lib/todo-manager.js +281 -47
  128. package/src/lib/token-incentive.js +341 -0
  129. package/src/lib/topic-classifier.js +297 -49
  130. package/src/lib/user-profile.js +294 -50
  131. package/src/lib/version-checker.js +304 -50
  132. package/src/lib/web-fetch.js +292 -51
  133. package/src/lib/zkp-engine.js +286 -49
@@ -63,14 +63,34 @@ import {
63
63
  loadFromDb as graphLoadFromDb,
64
64
  subscribe as graphSubscribe,
65
65
  EDGE_TYPES,
66
- SG_NODE_MATURITY_V2, SG_EDGE_LIFECYCLE_V2,
67
- setMaxActiveSgNodesPerOwnerV2, getMaxActiveSgNodesPerOwnerV2,
68
- setMaxPendingSgEdgesPerNodeV2, getMaxPendingSgEdgesPerNodeV2,
69
- setSgNodeIdleMsV2, getSgNodeIdleMsV2,
70
- setSgEdgeStuckMsV2, getSgEdgeStuckMsV2,
71
- registerSgNodeV2, activateSgNodeV2, deactivateSgNodeV2, removeSgNodeV2, touchSgNodeV2, getSgNodeV2, listSgNodesV2,
72
- createSgEdgeV2, establishSgEdgeV2, severSgEdgeV2, expireSgEdgeV2, cancelSgEdgeV2, getSgEdgeV2, listSgEdgesV2,
73
- autoDeactivateIdleSgNodesV2, autoExpireStaleSgEdgesV2, getSocialGraphGovStatsV2, _resetStateSocialGraphV2,
66
+ SG_NODE_MATURITY_V2,
67
+ SG_EDGE_LIFECYCLE_V2,
68
+ setMaxActiveSgNodesPerOwnerV2,
69
+ getMaxActiveSgNodesPerOwnerV2,
70
+ setMaxPendingSgEdgesPerNodeV2,
71
+ getMaxPendingSgEdgesPerNodeV2,
72
+ setSgNodeIdleMsV2,
73
+ getSgNodeIdleMsV2,
74
+ setSgEdgeStuckMsV2,
75
+ getSgEdgeStuckMsV2,
76
+ registerSgNodeV2,
77
+ activateSgNodeV2,
78
+ deactivateSgNodeV2,
79
+ removeSgNodeV2,
80
+ touchSgNodeV2,
81
+ getSgNodeV2,
82
+ listSgNodesV2,
83
+ createSgEdgeV2,
84
+ establishSgEdgeV2,
85
+ severSgEdgeV2,
86
+ expireSgEdgeV2,
87
+ cancelSgEdgeV2,
88
+ getSgEdgeV2,
89
+ listSgEdgesV2,
90
+ autoDeactivateIdleSgNodesV2,
91
+ autoExpireStaleSgEdgesV2,
92
+ getSocialGraphGovStatsV2,
93
+ _resetStateSocialGraphV2,
74
94
  } from "../lib/social-graph.js";
75
95
  import {
76
96
  METRICS as ANALYTICS_METRICS,
@@ -1319,28 +1339,133 @@ export function registerSocialCommand(program) {
1319
1339
  });
1320
1340
 
1321
1341
  // ===== Social Graph V2 governance overlay (sg-*-v2 prefix) =====
1322
- social.command("sg-enums-v2").action(() => console.log(JSON.stringify({ nodeMaturity: SG_NODE_MATURITY_V2, edgeLifecycle: SG_EDGE_LIFECYCLE_V2 }, null, 2)));
1323
- social.command("sg-config-v2").action(() => console.log(JSON.stringify({ maxActiveSgNodesPerOwner: getMaxActiveSgNodesPerOwnerV2(), maxPendingSgEdgesPerNode: getMaxPendingSgEdgesPerNodeV2(), sgNodeIdleMs: getSgNodeIdleMsV2(), sgEdgeStuckMs: getSgEdgeStuckMsV2() }, null, 2)));
1324
- social.command("sg-set-max-active-v2 <n>").action((n) => { setMaxActiveSgNodesPerOwnerV2(Number(n)); console.log("ok"); });
1325
- social.command("sg-set-max-pending-v2 <n>").action((n) => { setMaxPendingSgEdgesPerNodeV2(Number(n)); console.log("ok"); });
1326
- social.command("sg-set-idle-ms-v2 <n>").action((n) => { setSgNodeIdleMsV2(Number(n)); console.log("ok"); });
1327
- social.command("sg-set-stuck-ms-v2 <n>").action((n) => { setSgEdgeStuckMsV2(Number(n)); console.log("ok"); });
1328
- social.command("sg-register-node-v2 <id> <owner>").option("--handle <h>", "handle").action((id, owner, o) => console.log(JSON.stringify(registerSgNodeV2({ id, owner, handle: o.handle }), null, 2)));
1329
- social.command("sg-activate-node-v2 <id>").action((id) => console.log(JSON.stringify(activateSgNodeV2(id), null, 2)));
1330
- social.command("sg-deactivate-node-v2 <id>").action((id) => console.log(JSON.stringify(deactivateSgNodeV2(id), null, 2)));
1331
- social.command("sg-remove-node-v2 <id>").action((id) => console.log(JSON.stringify(removeSgNodeV2(id), null, 2)));
1332
- social.command("sg-touch-node-v2 <id>").action((id) => console.log(JSON.stringify(touchSgNodeV2(id), null, 2)));
1333
- social.command("sg-get-node-v2 <id>").action((id) => console.log(JSON.stringify(getSgNodeV2(id), null, 2)));
1334
- social.command("sg-list-nodes-v2").action(() => console.log(JSON.stringify(listSgNodesV2(), null, 2)));
1335
- social.command("sg-create-edge-v2 <id> <nodeId>").option("--target <t>", "targetId").action((id, nodeId, o) => console.log(JSON.stringify(createSgEdgeV2({ id, nodeId, targetId: o.target }), null, 2)));
1336
- social.command("sg-establish-edge-v2 <id>").action((id) => console.log(JSON.stringify(establishSgEdgeV2(id), null, 2)));
1337
- social.command("sg-sever-edge-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(severSgEdgeV2(id, reason), null, 2)));
1338
- social.command("sg-expire-edge-v2 <id>").action((id) => console.log(JSON.stringify(expireSgEdgeV2(id), null, 2)));
1339
- social.command("sg-cancel-edge-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(cancelSgEdgeV2(id, reason), null, 2)));
1340
- social.command("sg-get-edge-v2 <id>").action((id) => console.log(JSON.stringify(getSgEdgeV2(id), null, 2)));
1341
- social.command("sg-list-edges-v2").action(() => console.log(JSON.stringify(listSgEdgesV2(), null, 2)));
1342
- social.command("sg-auto-deactivate-idle-v2").action(() => console.log(JSON.stringify(autoDeactivateIdleSgNodesV2(), null, 2)));
1343
- social.command("sg-auto-expire-stale-v2").action(() => console.log(JSON.stringify(autoExpireStaleSgEdgesV2(), null, 2)));
1344
- social.command("sg-gov-stats-v2").action(() => console.log(JSON.stringify(getSocialGraphGovStatsV2(), null, 2)));
1345
- social.command("sg-reset-state-v2").action(() => { _resetStateSocialGraphV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
1342
+ social.command("sg-enums-v2").action(() =>
1343
+ console.log(
1344
+ JSON.stringify(
1345
+ {
1346
+ nodeMaturity: SG_NODE_MATURITY_V2,
1347
+ edgeLifecycle: SG_EDGE_LIFECYCLE_V2,
1348
+ },
1349
+ null,
1350
+ 2,
1351
+ ),
1352
+ ),
1353
+ );
1354
+ social.command("sg-config-v2").action(() =>
1355
+ console.log(
1356
+ JSON.stringify(
1357
+ {
1358
+ maxActiveSgNodesPerOwner: getMaxActiveSgNodesPerOwnerV2(),
1359
+ maxPendingSgEdgesPerNode: getMaxPendingSgEdgesPerNodeV2(),
1360
+ sgNodeIdleMs: getSgNodeIdleMsV2(),
1361
+ sgEdgeStuckMs: getSgEdgeStuckMsV2(),
1362
+ },
1363
+ null,
1364
+ 2,
1365
+ ),
1366
+ ),
1367
+ );
1368
+ social.command("sg-set-max-active-v2 <n>").action((n) => {
1369
+ setMaxActiveSgNodesPerOwnerV2(Number(n));
1370
+ console.log("ok");
1371
+ });
1372
+ social.command("sg-set-max-pending-v2 <n>").action((n) => {
1373
+ setMaxPendingSgEdgesPerNodeV2(Number(n));
1374
+ console.log("ok");
1375
+ });
1376
+ social.command("sg-set-idle-ms-v2 <n>").action((n) => {
1377
+ setSgNodeIdleMsV2(Number(n));
1378
+ console.log("ok");
1379
+ });
1380
+ social.command("sg-set-stuck-ms-v2 <n>").action((n) => {
1381
+ setSgEdgeStuckMsV2(Number(n));
1382
+ console.log("ok");
1383
+ });
1384
+ social
1385
+ .command("sg-register-node-v2 <id> <owner>")
1386
+ .option("--handle <h>", "handle")
1387
+ .action((id, owner, o) =>
1388
+ console.log(
1389
+ JSON.stringify(
1390
+ registerSgNodeV2({ id, owner, handle: o.handle }),
1391
+ null,
1392
+ 2,
1393
+ ),
1394
+ ),
1395
+ );
1396
+ social
1397
+ .command("sg-activate-node-v2 <id>")
1398
+ .action((id) => console.log(JSON.stringify(activateSgNodeV2(id), null, 2)));
1399
+ social
1400
+ .command("sg-deactivate-node-v2 <id>")
1401
+ .action((id) =>
1402
+ console.log(JSON.stringify(deactivateSgNodeV2(id), null, 2)),
1403
+ );
1404
+ social
1405
+ .command("sg-remove-node-v2 <id>")
1406
+ .action((id) => console.log(JSON.stringify(removeSgNodeV2(id), null, 2)));
1407
+ social
1408
+ .command("sg-touch-node-v2 <id>")
1409
+ .action((id) => console.log(JSON.stringify(touchSgNodeV2(id), null, 2)));
1410
+ social
1411
+ .command("sg-get-node-v2 <id>")
1412
+ .action((id) => console.log(JSON.stringify(getSgNodeV2(id), null, 2)));
1413
+ social
1414
+ .command("sg-list-nodes-v2")
1415
+ .action(() => console.log(JSON.stringify(listSgNodesV2(), null, 2)));
1416
+ social
1417
+ .command("sg-create-edge-v2 <id> <nodeId>")
1418
+ .option("--target <t>", "targetId")
1419
+ .action((id, nodeId, o) =>
1420
+ console.log(
1421
+ JSON.stringify(
1422
+ createSgEdgeV2({ id, nodeId, targetId: o.target }),
1423
+ null,
1424
+ 2,
1425
+ ),
1426
+ ),
1427
+ );
1428
+ social
1429
+ .command("sg-establish-edge-v2 <id>")
1430
+ .action((id) =>
1431
+ console.log(JSON.stringify(establishSgEdgeV2(id), null, 2)),
1432
+ );
1433
+ social
1434
+ .command("sg-sever-edge-v2 <id> [reason]")
1435
+ .action((id, reason) =>
1436
+ console.log(JSON.stringify(severSgEdgeV2(id, reason), null, 2)),
1437
+ );
1438
+ social
1439
+ .command("sg-expire-edge-v2 <id>")
1440
+ .action((id) => console.log(JSON.stringify(expireSgEdgeV2(id), null, 2)));
1441
+ social
1442
+ .command("sg-cancel-edge-v2 <id> [reason]")
1443
+ .action((id, reason) =>
1444
+ console.log(JSON.stringify(cancelSgEdgeV2(id, reason), null, 2)),
1445
+ );
1446
+ social
1447
+ .command("sg-get-edge-v2 <id>")
1448
+ .action((id) => console.log(JSON.stringify(getSgEdgeV2(id), null, 2)));
1449
+ social
1450
+ .command("sg-list-edges-v2")
1451
+ .action(() => console.log(JSON.stringify(listSgEdgesV2(), null, 2)));
1452
+ social
1453
+ .command("sg-auto-deactivate-idle-v2")
1454
+ .action(() =>
1455
+ console.log(JSON.stringify(autoDeactivateIdleSgNodesV2(), null, 2)),
1456
+ );
1457
+ social
1458
+ .command("sg-auto-expire-stale-v2")
1459
+ .action(() =>
1460
+ console.log(JSON.stringify(autoExpireStaleSgEdgesV2(), null, 2)),
1461
+ );
1462
+ social
1463
+ .command("sg-gov-stats-v2")
1464
+ .action(() =>
1465
+ console.log(JSON.stringify(getSocialGraphGovStatsV2(), null, 2)),
1466
+ );
1467
+ social.command("sg-reset-state-v2").action(() => {
1468
+ _resetStateSocialGraphV2();
1469
+ console.log(JSON.stringify({ ok: true }, null, 2));
1470
+ });
1346
1471
  }
@@ -480,3 +480,209 @@ export function registerStressCommand(program) {
480
480
  console.log(JSON.stringify(getStressStatsV2(), null, 2));
481
481
  });
482
482
  }
483
+
484
+ // === Iter16 V2 governance overlay ===
485
+ export function registerStrgovV2Commands(program) {
486
+ const parent = program.commands.find((c) => c.name() === "stress");
487
+ if (!parent) return;
488
+ const L = async () => await import("../lib/stress-tester.js");
489
+ parent
490
+ .command("strgov-enums-v2")
491
+ .description("Show V2 enums (strgov maturity + run lifecycle)")
492
+ .action(async () => {
493
+ const m = await L();
494
+ console.log(
495
+ JSON.stringify(
496
+ {
497
+ profileMaturity: m.STRGOV_PROFILE_MATURITY_V2,
498
+ runLifecycle: m.STRGOV_RUN_LIFECYCLE_V2,
499
+ },
500
+ null,
501
+ 2,
502
+ ),
503
+ );
504
+ });
505
+ parent
506
+ .command("strgov-config-v2")
507
+ .description("Show V2 config thresholds")
508
+ .action(async () => {
509
+ const m = await L();
510
+ console.log(
511
+ JSON.stringify(
512
+ {
513
+ maxActive: m.getMaxActiveStrgovProfilesPerOwnerV2(),
514
+ maxPending: m.getMaxPendingStrgovRunsPerProfileV2(),
515
+ idleMs: m.getStrgovProfileIdleMsV2(),
516
+ stuckMs: m.getStrgovRunStuckMsV2(),
517
+ },
518
+ null,
519
+ 2,
520
+ ),
521
+ );
522
+ });
523
+ parent
524
+ .command("strgov-set-max-active-v2 <n>")
525
+ .description("Set max active profiles per owner")
526
+ .action(async (n) => {
527
+ const m = await L();
528
+ m.setMaxActiveStrgovProfilesPerOwnerV2(Number(n));
529
+ console.log("ok");
530
+ });
531
+ parent
532
+ .command("strgov-set-max-pending-v2 <n>")
533
+ .description("Set max pending runs per profile")
534
+ .action(async (n) => {
535
+ const m = await L();
536
+ m.setMaxPendingStrgovRunsPerProfileV2(Number(n));
537
+ console.log("ok");
538
+ });
539
+ parent
540
+ .command("strgov-set-idle-ms-v2 <n>")
541
+ .description("Set profile idle threshold (ms)")
542
+ .action(async (n) => {
543
+ const m = await L();
544
+ m.setStrgovProfileIdleMsV2(Number(n));
545
+ console.log("ok");
546
+ });
547
+ parent
548
+ .command("strgov-set-stuck-ms-v2 <n>")
549
+ .description("Set run stuck threshold (ms)")
550
+ .action(async (n) => {
551
+ const m = await L();
552
+ m.setStrgovRunStuckMsV2(Number(n));
553
+ console.log("ok");
554
+ });
555
+ parent
556
+ .command("strgov-register-v2 <id> <owner>")
557
+ .description("Register V2 strgov profile")
558
+ .option("--scenario <v>", "scenario")
559
+ .action(async (id, owner, o) => {
560
+ const m = await L();
561
+ console.log(
562
+ JSON.stringify(
563
+ m.registerStrgovProfileV2({ id, owner, scenario: o.scenario }),
564
+ null,
565
+ 2,
566
+ ),
567
+ );
568
+ });
569
+ parent
570
+ .command("strgov-activate-v2 <id>")
571
+ .description("Activate profile")
572
+ .action(async (id) => {
573
+ const m = await L();
574
+ console.log(JSON.stringify(m.activateStrgovProfileV2(id), null, 2));
575
+ });
576
+ parent
577
+ .command("strgov-stale-v2 <id>")
578
+ .description("Stale profile")
579
+ .action(async (id) => {
580
+ const m = await L();
581
+ console.log(JSON.stringify(m.staleStrgovProfileV2(id), null, 2));
582
+ });
583
+ parent
584
+ .command("strgov-archive-v2 <id>")
585
+ .description("Archive profile (terminal)")
586
+ .action(async (id) => {
587
+ const m = await L();
588
+ console.log(JSON.stringify(m.archiveStrgovProfileV2(id), null, 2));
589
+ });
590
+ parent
591
+ .command("strgov-touch-v2 <id>")
592
+ .description("Touch profile")
593
+ .action(async (id) => {
594
+ const m = await L();
595
+ console.log(JSON.stringify(m.touchStrgovProfileV2(id), null, 2));
596
+ });
597
+ parent
598
+ .command("strgov-get-v2 <id>")
599
+ .description("Get profile")
600
+ .action(async (id) => {
601
+ const m = await L();
602
+ console.log(JSON.stringify(m.getStrgovProfileV2(id), null, 2));
603
+ });
604
+ parent
605
+ .command("strgov-list-v2")
606
+ .description("List profiles")
607
+ .action(async () => {
608
+ const m = await L();
609
+ console.log(JSON.stringify(m.listStrgovProfilesV2(), null, 2));
610
+ });
611
+ parent
612
+ .command("strgov-create-run-v2 <id> <profileId>")
613
+ .description("Create run (queued)")
614
+ .option("--profileRef <v>", "profileRef")
615
+ .action(async (id, profileId, o) => {
616
+ const m = await L();
617
+ console.log(
618
+ JSON.stringify(
619
+ m.createStrgovRunV2({ id, profileId, profileRef: o.profileRef }),
620
+ null,
621
+ 2,
622
+ ),
623
+ );
624
+ });
625
+ parent
626
+ .command("strgov-running-run-v2 <id>")
627
+ .description("Mark run as running")
628
+ .action(async (id) => {
629
+ const m = await L();
630
+ console.log(JSON.stringify(m.runningStrgovRunV2(id), null, 2));
631
+ });
632
+ parent
633
+ .command("strgov-complete-run-v2 <id>")
634
+ .description("Complete run")
635
+ .action(async (id) => {
636
+ const m = await L();
637
+ console.log(JSON.stringify(m.completeRunStrgovV2(id), null, 2));
638
+ });
639
+ parent
640
+ .command("strgov-fail-run-v2 <id> [reason]")
641
+ .description("Fail run")
642
+ .action(async (id, reason) => {
643
+ const m = await L();
644
+ console.log(JSON.stringify(m.failStrgovRunV2(id, reason), null, 2));
645
+ });
646
+ parent
647
+ .command("strgov-cancel-run-v2 <id> [reason]")
648
+ .description("Cancel run")
649
+ .action(async (id, reason) => {
650
+ const m = await L();
651
+ console.log(JSON.stringify(m.cancelStrgovRunV2(id, reason), null, 2));
652
+ });
653
+ parent
654
+ .command("strgov-get-run-v2 <id>")
655
+ .description("Get run")
656
+ .action(async (id) => {
657
+ const m = await L();
658
+ console.log(JSON.stringify(m.getStrgovRunV2(id), null, 2));
659
+ });
660
+ parent
661
+ .command("strgov-list-runs-v2")
662
+ .description("List runs")
663
+ .action(async () => {
664
+ const m = await L();
665
+ console.log(JSON.stringify(m.listStrgovRunsV2(), null, 2));
666
+ });
667
+ parent
668
+ .command("strgov-auto-stale-idle-v2")
669
+ .description("Auto-stale idle profiles")
670
+ .action(async () => {
671
+ const m = await L();
672
+ console.log(JSON.stringify(m.autoStaleIdleStrgovProfilesV2(), null, 2));
673
+ });
674
+ parent
675
+ .command("strgov-auto-fail-stuck-v2")
676
+ .description("Auto-fail stuck runs")
677
+ .action(async () => {
678
+ const m = await L();
679
+ console.log(JSON.stringify(m.autoFailStuckStrgovRunsV2(), null, 2));
680
+ });
681
+ parent
682
+ .command("strgov-gov-stats-v2")
683
+ .description("V2 gov aggregate stats")
684
+ .action(async () => {
685
+ const m = await L();
686
+ console.log(JSON.stringify(m.getStressTesterGovStatsV2(), null, 2));
687
+ });
688
+ }
@@ -6,40 +6,152 @@
6
6
  */
7
7
 
8
8
  import {
9
- SVC_CONTAINER_MATURITY_V2, SVC_RESOLUTION_LIFECYCLE_V2,
10
- setMaxActiveSvcContainersPerOwnerV2, getMaxActiveSvcContainersPerOwnerV2,
11
- setMaxPendingSvcResolutionsPerContainerV2, getMaxPendingSvcResolutionsPerContainerV2,
12
- setSvcContainerIdleMsV2, getSvcContainerIdleMsV2,
13
- setSvcResolutionStuckMsV2, getSvcResolutionStuckMsV2,
14
- registerSvcContainerV2, activateSvcContainerV2, degradeSvcContainerV2, decommissionSvcContainerV2, touchSvcContainerV2, getSvcContainerV2, listSvcContainersV2,
15
- createSvcResolutionV2, resolvingSvcResolutionV2, resolveSvcResolutionV2, failSvcResolutionV2, cancelSvcResolutionV2, getSvcResolutionV2, listSvcResolutionsV2,
16
- autoDegradeIdleSvcContainersV2, autoFailStuckSvcResolutionsV2, getServiceContainerGovStatsV2, _resetStateServiceContainerV2,
9
+ SVC_CONTAINER_MATURITY_V2,
10
+ SVC_RESOLUTION_LIFECYCLE_V2,
11
+ setMaxActiveSvcContainersPerOwnerV2,
12
+ getMaxActiveSvcContainersPerOwnerV2,
13
+ setMaxPendingSvcResolutionsPerContainerV2,
14
+ getMaxPendingSvcResolutionsPerContainerV2,
15
+ setSvcContainerIdleMsV2,
16
+ getSvcContainerIdleMsV2,
17
+ setSvcResolutionStuckMsV2,
18
+ getSvcResolutionStuckMsV2,
19
+ registerSvcContainerV2,
20
+ activateSvcContainerV2,
21
+ degradeSvcContainerV2,
22
+ decommissionSvcContainerV2,
23
+ touchSvcContainerV2,
24
+ getSvcContainerV2,
25
+ listSvcContainersV2,
26
+ createSvcResolutionV2,
27
+ resolvingSvcResolutionV2,
28
+ resolveSvcResolutionV2,
29
+ failSvcResolutionV2,
30
+ cancelSvcResolutionV2,
31
+ getSvcResolutionV2,
32
+ listSvcResolutionsV2,
33
+ autoDegradeIdleSvcContainersV2,
34
+ autoFailStuckSvcResolutionsV2,
35
+ getServiceContainerGovStatsV2,
36
+ _resetStateServiceContainerV2,
17
37
  } from "../lib/service-container.js";
18
38
 
19
39
  export function registerSvcContCommand(program) {
20
- const sc = program.command("svccont").description("Service Container V2 governance");
21
- sc.command("enums-v2").action(() => console.log(JSON.stringify({ containerMaturity: SVC_CONTAINER_MATURITY_V2, resolutionLifecycle: SVC_RESOLUTION_LIFECYCLE_V2 }, null, 2)));
22
- sc.command("config-v2").action(() => console.log(JSON.stringify({ maxActiveSvcContainersPerOwner: getMaxActiveSvcContainersPerOwnerV2(), maxPendingSvcResolutionsPerContainer: getMaxPendingSvcResolutionsPerContainerV2(), svcContainerIdleMs: getSvcContainerIdleMsV2(), svcResolutionStuckMs: getSvcResolutionStuckMsV2() }, null, 2)));
23
- sc.command("set-max-active-v2 <n>").action((n) => { setMaxActiveSvcContainersPerOwnerV2(Number(n)); console.log("ok"); });
24
- sc.command("set-max-pending-v2 <n>").action((n) => { setMaxPendingSvcResolutionsPerContainerV2(Number(n)); console.log("ok"); });
25
- sc.command("set-idle-ms-v2 <n>").action((n) => { setSvcContainerIdleMsV2(Number(n)); console.log("ok"); });
26
- sc.command("set-stuck-ms-v2 <n>").action((n) => { setSvcResolutionStuckMsV2(Number(n)); console.log("ok"); });
27
- sc.command("register-container-v2 <id> <owner>").option("--scope <s>", "scope").action((id, owner, o) => console.log(JSON.stringify(registerSvcContainerV2({ id, owner, scope: o.scope }), null, 2)));
28
- sc.command("activate-container-v2 <id>").action((id) => console.log(JSON.stringify(activateSvcContainerV2(id), null, 2)));
29
- sc.command("degrade-container-v2 <id>").action((id) => console.log(JSON.stringify(degradeSvcContainerV2(id), null, 2)));
30
- sc.command("decommission-container-v2 <id>").action((id) => console.log(JSON.stringify(decommissionSvcContainerV2(id), null, 2)));
31
- sc.command("touch-container-v2 <id>").action((id) => console.log(JSON.stringify(touchSvcContainerV2(id), null, 2)));
32
- sc.command("get-container-v2 <id>").action((id) => console.log(JSON.stringify(getSvcContainerV2(id), null, 2)));
33
- sc.command("list-containers-v2").action(() => console.log(JSON.stringify(listSvcContainersV2(), null, 2)));
34
- sc.command("create-resolution-v2 <id> <containerId>").option("--token <t>", "token").action((id, containerId, o) => console.log(JSON.stringify(createSvcResolutionV2({ id, containerId, token: o.token }), null, 2)));
35
- sc.command("resolving-resolution-v2 <id>").action((id) => console.log(JSON.stringify(resolvingSvcResolutionV2(id), null, 2)));
36
- sc.command("resolve-resolution-v2 <id>").action((id) => console.log(JSON.stringify(resolveSvcResolutionV2(id), null, 2)));
37
- sc.command("fail-resolution-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(failSvcResolutionV2(id, reason), null, 2)));
38
- sc.command("cancel-resolution-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(cancelSvcResolutionV2(id, reason), null, 2)));
39
- sc.command("get-resolution-v2 <id>").action((id) => console.log(JSON.stringify(getSvcResolutionV2(id), null, 2)));
40
- sc.command("list-resolutions-v2").action(() => console.log(JSON.stringify(listSvcResolutionsV2(), null, 2)));
41
- sc.command("auto-degrade-idle-v2").action(() => console.log(JSON.stringify(autoDegradeIdleSvcContainersV2(), null, 2)));
42
- sc.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckSvcResolutionsV2(), null, 2)));
43
- sc.command("gov-stats-v2").action(() => console.log(JSON.stringify(getServiceContainerGovStatsV2(), null, 2)));
44
- sc.command("reset-state-v2").action(() => { _resetStateServiceContainerV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
40
+ const sc = program
41
+ .command("svccont")
42
+ .description("Service Container V2 governance");
43
+ sc.command("enums-v2").action(() =>
44
+ console.log(
45
+ JSON.stringify(
46
+ {
47
+ containerMaturity: SVC_CONTAINER_MATURITY_V2,
48
+ resolutionLifecycle: SVC_RESOLUTION_LIFECYCLE_V2,
49
+ },
50
+ null,
51
+ 2,
52
+ ),
53
+ ),
54
+ );
55
+ sc.command("config-v2").action(() =>
56
+ console.log(
57
+ JSON.stringify(
58
+ {
59
+ maxActiveSvcContainersPerOwner: getMaxActiveSvcContainersPerOwnerV2(),
60
+ maxPendingSvcResolutionsPerContainer:
61
+ getMaxPendingSvcResolutionsPerContainerV2(),
62
+ svcContainerIdleMs: getSvcContainerIdleMsV2(),
63
+ svcResolutionStuckMs: getSvcResolutionStuckMsV2(),
64
+ },
65
+ null,
66
+ 2,
67
+ ),
68
+ ),
69
+ );
70
+ sc.command("set-max-active-v2 <n>").action((n) => {
71
+ setMaxActiveSvcContainersPerOwnerV2(Number(n));
72
+ console.log("ok");
73
+ });
74
+ sc.command("set-max-pending-v2 <n>").action((n) => {
75
+ setMaxPendingSvcResolutionsPerContainerV2(Number(n));
76
+ console.log("ok");
77
+ });
78
+ sc.command("set-idle-ms-v2 <n>").action((n) => {
79
+ setSvcContainerIdleMsV2(Number(n));
80
+ console.log("ok");
81
+ });
82
+ sc.command("set-stuck-ms-v2 <n>").action((n) => {
83
+ setSvcResolutionStuckMsV2(Number(n));
84
+ console.log("ok");
85
+ });
86
+ sc.command("register-container-v2 <id> <owner>")
87
+ .option("--scope <s>", "scope")
88
+ .action((id, owner, o) =>
89
+ console.log(
90
+ JSON.stringify(
91
+ registerSvcContainerV2({ id, owner, scope: o.scope }),
92
+ null,
93
+ 2,
94
+ ),
95
+ ),
96
+ );
97
+ sc.command("activate-container-v2 <id>").action((id) =>
98
+ console.log(JSON.stringify(activateSvcContainerV2(id), null, 2)),
99
+ );
100
+ sc.command("degrade-container-v2 <id>").action((id) =>
101
+ console.log(JSON.stringify(degradeSvcContainerV2(id), null, 2)),
102
+ );
103
+ sc.command("decommission-container-v2 <id>").action((id) =>
104
+ console.log(JSON.stringify(decommissionSvcContainerV2(id), null, 2)),
105
+ );
106
+ sc.command("touch-container-v2 <id>").action((id) =>
107
+ console.log(JSON.stringify(touchSvcContainerV2(id), null, 2)),
108
+ );
109
+ sc.command("get-container-v2 <id>").action((id) =>
110
+ console.log(JSON.stringify(getSvcContainerV2(id), null, 2)),
111
+ );
112
+ sc.command("list-containers-v2").action(() =>
113
+ console.log(JSON.stringify(listSvcContainersV2(), null, 2)),
114
+ );
115
+ sc.command("create-resolution-v2 <id> <containerId>")
116
+ .option("--token <t>", "token")
117
+ .action((id, containerId, o) =>
118
+ console.log(
119
+ JSON.stringify(
120
+ createSvcResolutionV2({ id, containerId, token: o.token }),
121
+ null,
122
+ 2,
123
+ ),
124
+ ),
125
+ );
126
+ sc.command("resolving-resolution-v2 <id>").action((id) =>
127
+ console.log(JSON.stringify(resolvingSvcResolutionV2(id), null, 2)),
128
+ );
129
+ sc.command("resolve-resolution-v2 <id>").action((id) =>
130
+ console.log(JSON.stringify(resolveSvcResolutionV2(id), null, 2)),
131
+ );
132
+ sc.command("fail-resolution-v2 <id> [reason]").action((id, reason) =>
133
+ console.log(JSON.stringify(failSvcResolutionV2(id, reason), null, 2)),
134
+ );
135
+ sc.command("cancel-resolution-v2 <id> [reason]").action((id, reason) =>
136
+ console.log(JSON.stringify(cancelSvcResolutionV2(id, reason), null, 2)),
137
+ );
138
+ sc.command("get-resolution-v2 <id>").action((id) =>
139
+ console.log(JSON.stringify(getSvcResolutionV2(id), null, 2)),
140
+ );
141
+ sc.command("list-resolutions-v2").action(() =>
142
+ console.log(JSON.stringify(listSvcResolutionsV2(), null, 2)),
143
+ );
144
+ sc.command("auto-degrade-idle-v2").action(() =>
145
+ console.log(JSON.stringify(autoDegradeIdleSvcContainersV2(), null, 2)),
146
+ );
147
+ sc.command("auto-fail-stuck-v2").action(() =>
148
+ console.log(JSON.stringify(autoFailStuckSvcResolutionsV2(), null, 2)),
149
+ );
150
+ sc.command("gov-stats-v2").action(() =>
151
+ console.log(JSON.stringify(getServiceContainerGovStatsV2(), null, 2)),
152
+ );
153
+ sc.command("reset-state-v2").action(() => {
154
+ _resetStateServiceContainerV2();
155
+ console.log(JSON.stringify({ ok: true }, null, 2));
156
+ });
45
157
  }