chainlesschain 0.66.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 (143) hide show
  1. package/bin/chainlesschain.js +0 -0
  2. package/package.json +1 -1
  3. package/src/commands/a2a.js +380 -0
  4. package/src/commands/agent-network.js +254 -1
  5. package/src/commands/audit.js +302 -0
  6. package/src/commands/automation.js +271 -1
  7. package/src/commands/bi.js +348 -0
  8. package/src/commands/codegen.js +224 -0
  9. package/src/commands/collab.js +341 -0
  10. package/src/commands/compliance.js +1035 -0
  11. package/src/commands/cowork.js +221 -0
  12. package/src/commands/crosschain.js +218 -0
  13. package/src/commands/dbevo.js +284 -0
  14. package/src/commands/dev.js +252 -0
  15. package/src/commands/did.js +358 -0
  16. package/src/commands/dlp.js +341 -0
  17. package/src/commands/encrypt.js +341 -0
  18. package/src/commands/evomap.js +394 -0
  19. package/src/commands/export.js +256 -1
  20. package/src/commands/federation.js +283 -0
  21. package/src/commands/fusion.js +258 -0
  22. package/src/commands/governance.js +325 -0
  23. package/src/commands/hardening.js +411 -0
  24. package/src/commands/hook.js +148 -0
  25. package/src/commands/import.js +252 -0
  26. package/src/commands/incentive.js +322 -0
  27. package/src/commands/inference.js +318 -0
  28. package/src/commands/infra.js +244 -0
  29. package/src/commands/instinct.js +260 -0
  30. package/src/commands/ipfs.js +318 -0
  31. package/src/commands/kg.js +387 -0
  32. package/src/commands/llm.js +263 -0
  33. package/src/commands/lowcode.js +356 -0
  34. package/src/commands/marketplace.js +256 -0
  35. package/src/commands/mcp.js +221 -0
  36. package/src/commands/memory.js +248 -0
  37. package/src/commands/multimodal.js +296 -0
  38. package/src/commands/nlprog.js +356 -0
  39. package/src/commands/note.js +244 -0
  40. package/src/commands/ops.js +354 -0
  41. package/src/commands/orchestrate.js +166 -0
  42. package/src/commands/org.js +277 -0
  43. package/src/commands/p2p.js +390 -0
  44. package/src/commands/perception.js +290 -0
  45. package/src/commands/permmem.js +251 -0
  46. package/src/commands/plugin-ecosystem.js +273 -0
  47. package/src/commands/pqc.js +393 -0
  48. package/src/commands/privacy.js +321 -0
  49. package/src/commands/quantization.js +351 -0
  50. package/src/commands/rcache.js +271 -0
  51. package/src/commands/recommend.js +340 -0
  52. package/src/commands/reputation.js +261 -0
  53. package/src/commands/runtime.js +307 -0
  54. package/src/commands/scim.js +262 -0
  55. package/src/commands/session.js +258 -0
  56. package/src/commands/siem.js +246 -0
  57. package/src/commands/skill.js +267 -1
  58. package/src/commands/sla.js +259 -0
  59. package/src/commands/social.js +256 -0
  60. package/src/commands/sso.js +186 -1
  61. package/src/commands/stress.js +230 -0
  62. package/src/commands/sync.js +256 -0
  63. package/src/commands/tech.js +338 -0
  64. package/src/commands/tenant.js +351 -0
  65. package/src/commands/terraform.js +245 -0
  66. package/src/commands/tokens.js +269 -0
  67. package/src/commands/trust.js +249 -0
  68. package/src/commands/wallet.js +277 -0
  69. package/src/commands/workflow.js +171 -0
  70. package/src/commands/zkp.js +335 -0
  71. package/src/index.js +4 -0
  72. package/src/lib/a2a-protocol.js +451 -0
  73. package/src/lib/agent-coordinator.js +325 -0
  74. package/src/lib/agent-network.js +387 -0
  75. package/src/lib/agent-router.js +395 -0
  76. package/src/lib/aiops.js +478 -0
  77. package/src/lib/app-builder.js +239 -0
  78. package/src/lib/audit-logger.js +379 -0
  79. package/src/lib/automation-engine.js +330 -0
  80. package/src/lib/autonomous-developer.js +350 -0
  81. package/src/lib/bi-engine.js +338 -0
  82. package/src/lib/code-agent.js +323 -0
  83. package/src/lib/collaboration-governance.js +364 -0
  84. package/src/lib/community-governance.js +436 -0
  85. package/src/lib/compliance-manager.js +434 -0
  86. package/src/lib/content-recommendation.js +469 -0
  87. package/src/lib/cross-chain.js +345 -0
  88. package/src/lib/crypto-manager.js +350 -0
  89. package/src/lib/dbevo.js +338 -0
  90. package/src/lib/decentral-infra.js +340 -0
  91. package/src/lib/did-manager.js +367 -0
  92. package/src/lib/dlp-engine.js +389 -0
  93. package/src/lib/evomap-federation.js +177 -0
  94. package/src/lib/evomap-governance.js +276 -0
  95. package/src/lib/federation-hardening.js +259 -0
  96. package/src/lib/hardening-manager.js +348 -0
  97. package/src/lib/hook-manager.js +380 -0
  98. package/src/lib/inference-network.js +330 -0
  99. package/src/lib/instinct-manager.js +332 -0
  100. package/src/lib/ipfs-storage.js +334 -0
  101. package/src/lib/knowledge-exporter.js +381 -0
  102. package/src/lib/knowledge-graph.js +432 -0
  103. package/src/lib/knowledge-importer.js +379 -0
  104. package/src/lib/llm-providers.js +391 -0
  105. package/src/lib/mcp-registry.js +333 -0
  106. package/src/lib/memory-manager.js +330 -0
  107. package/src/lib/multimodal.js +346 -0
  108. package/src/lib/nl-programming.js +343 -0
  109. package/src/lib/note-versioning.js +327 -0
  110. package/src/lib/org-manager.js +323 -0
  111. package/src/lib/p2p-manager.js +387 -0
  112. package/src/lib/perception.js +346 -0
  113. package/src/lib/perf-tuning.js +4 -1
  114. package/src/lib/permanent-memory.js +320 -0
  115. package/src/lib/plugin-ecosystem.js +377 -0
  116. package/src/lib/pqc-manager.js +368 -0
  117. package/src/lib/privacy-computing.js +427 -0
  118. package/src/lib/protocol-fusion.js +417 -0
  119. package/src/lib/quantization.js +325 -0
  120. package/src/lib/reputation-optimizer.js +299 -0
  121. package/src/lib/response-cache.js +327 -0
  122. package/src/lib/scim-manager.js +329 -0
  123. package/src/lib/session-manager.js +329 -0
  124. package/src/lib/siem-exporter.js +333 -0
  125. package/src/lib/skill-loader.js +377 -0
  126. package/src/lib/skill-marketplace.js +325 -0
  127. package/src/lib/sla-manager.js +275 -0
  128. package/src/lib/social-manager.js +326 -0
  129. package/src/lib/sso-manager.js +332 -0
  130. package/src/lib/stress-tester.js +330 -0
  131. package/src/lib/sync-manager.js +326 -0
  132. package/src/lib/tech-learning-engine.js +369 -0
  133. package/src/lib/tenant-saas.js +460 -0
  134. package/src/lib/terraform-manager.js +363 -0
  135. package/src/lib/threat-intel.js +335 -0
  136. package/src/lib/token-incentive.js +293 -0
  137. package/src/lib/token-tracker.js +329 -0
  138. package/src/lib/trust-security.js +390 -0
  139. package/src/lib/ueba.js +389 -0
  140. package/src/lib/universal-runtime.js +325 -0
  141. package/src/lib/wallet-manager.js +326 -0
  142. package/src/lib/workflow-engine.js +322 -0
  143. package/src/lib/zkp-engine.js +274 -0
@@ -365,3 +365,394 @@ export class LLMProviderRegistry {
365
365
  return { ok: true, elapsed: Date.now() - start, response: text.trim() };
366
366
  }
367
367
  }
368
+
369
+ /* ─────────────────────────────────────────────────────────────────
370
+ * V2 Governance Layer (in-memory, independent of SQLite llm_providers)
371
+ *
372
+ * Provider profile maturity: pending → active → suspended → retired
373
+ * - retired terminal
374
+ * - suspended → active recovery (cap-exempt)
375
+ *
376
+ * Request lifecycle: queued → running → completed | failed | cancelled
377
+ * - 3 terminals
378
+ * - per-profile pending-request cap counts queued+running
379
+ *
380
+ * Per-owner active-profile cap on pending→active only (recovery exempt).
381
+ * Per-profile pending-request cap enforced at createRequestV2.
382
+ *
383
+ * Auto-flip:
384
+ * - autoSuspendIdleProfilesV2 active w/ lastSeenAt past idle threshold → suspended
385
+ * - autoFailStuckRequestsV2 running w/ startedAt past stuck threshold → failed
386
+ * ───────────────────────────────────────────────────────────────── */
387
+
388
+ export const PROVIDER_MATURITY_V2 = Object.freeze({
389
+ PENDING: "pending",
390
+ ACTIVE: "active",
391
+ SUSPENDED: "suspended",
392
+ RETIRED: "retired",
393
+ });
394
+
395
+ export const REQUEST_LIFECYCLE_V2 = Object.freeze({
396
+ QUEUED: "queued",
397
+ RUNNING: "running",
398
+ COMPLETED: "completed",
399
+ FAILED: "failed",
400
+ CANCELLED: "cancelled",
401
+ });
402
+
403
+ const _PROVIDER_TRANSITIONS_V2 = new Map([
404
+ [
405
+ PROVIDER_MATURITY_V2.PENDING,
406
+ new Set([PROVIDER_MATURITY_V2.ACTIVE, PROVIDER_MATURITY_V2.RETIRED]),
407
+ ],
408
+ [
409
+ PROVIDER_MATURITY_V2.ACTIVE,
410
+ new Set([PROVIDER_MATURITY_V2.SUSPENDED, PROVIDER_MATURITY_V2.RETIRED]),
411
+ ],
412
+ [
413
+ PROVIDER_MATURITY_V2.SUSPENDED,
414
+ new Set([PROVIDER_MATURITY_V2.ACTIVE, PROVIDER_MATURITY_V2.RETIRED]),
415
+ ],
416
+ [PROVIDER_MATURITY_V2.RETIRED, new Set()],
417
+ ]);
418
+ const _PROVIDER_TERMINALS_V2 = new Set([PROVIDER_MATURITY_V2.RETIRED]);
419
+
420
+ const _REQUEST_TRANSITIONS_V2 = new Map([
421
+ [
422
+ REQUEST_LIFECYCLE_V2.QUEUED,
423
+ new Set([REQUEST_LIFECYCLE_V2.RUNNING, REQUEST_LIFECYCLE_V2.CANCELLED]),
424
+ ],
425
+ [
426
+ REQUEST_LIFECYCLE_V2.RUNNING,
427
+ new Set([
428
+ REQUEST_LIFECYCLE_V2.COMPLETED,
429
+ REQUEST_LIFECYCLE_V2.FAILED,
430
+ REQUEST_LIFECYCLE_V2.CANCELLED,
431
+ ]),
432
+ ],
433
+ [REQUEST_LIFECYCLE_V2.COMPLETED, new Set()],
434
+ [REQUEST_LIFECYCLE_V2.FAILED, new Set()],
435
+ [REQUEST_LIFECYCLE_V2.CANCELLED, new Set()],
436
+ ]);
437
+ const _REQUEST_TERMINALS_V2 = new Set([
438
+ REQUEST_LIFECYCLE_V2.COMPLETED,
439
+ REQUEST_LIFECYCLE_V2.FAILED,
440
+ REQUEST_LIFECYCLE_V2.CANCELLED,
441
+ ]);
442
+
443
+ export const PROVIDER_DEFAULT_MAX_ACTIVE_PER_OWNER = 8;
444
+ export const PROVIDER_DEFAULT_MAX_PENDING_REQUESTS_PER_PROFILE = 16;
445
+ export const PROVIDER_DEFAULT_PROFILE_IDLE_MS = 14 * 24 * 60 * 60 * 1000;
446
+ export const PROVIDER_DEFAULT_REQUEST_STUCK_MS = 5 * 60 * 1000;
447
+
448
+ const _stateLlmV2 = {
449
+ profiles: new Map(),
450
+ requests: new Map(),
451
+ maxActiveProfilesPerOwner: PROVIDER_DEFAULT_MAX_ACTIVE_PER_OWNER,
452
+ maxPendingRequestsPerProfile:
453
+ PROVIDER_DEFAULT_MAX_PENDING_REQUESTS_PER_PROFILE,
454
+ profileIdleMs: PROVIDER_DEFAULT_PROFILE_IDLE_MS,
455
+ requestStuckMs: PROVIDER_DEFAULT_REQUEST_STUCK_MS,
456
+ };
457
+
458
+ function _posIntLlmV2(n, label) {
459
+ const v = Math.floor(n);
460
+ if (!Number.isFinite(v) || v <= 0) {
461
+ throw new Error(`${label} must be a positive integer`);
462
+ }
463
+ return v;
464
+ }
465
+
466
+ function _copyProfileV2(p) {
467
+ return { ...p, metadata: { ...p.metadata } };
468
+ }
469
+
470
+ function _copyRequestV2(r) {
471
+ return { ...r, metadata: { ...r.metadata } };
472
+ }
473
+
474
+ export function getMaxActiveProfilesPerOwnerV2() {
475
+ return _stateLlmV2.maxActiveProfilesPerOwner;
476
+ }
477
+
478
+ export function setMaxActiveProfilesPerOwnerV2(n) {
479
+ _stateLlmV2.maxActiveProfilesPerOwner = _posIntLlmV2(
480
+ n,
481
+ "maxActiveProfilesPerOwner",
482
+ );
483
+ }
484
+
485
+ export function getMaxPendingRequestsPerProfileV2() {
486
+ return _stateLlmV2.maxPendingRequestsPerProfile;
487
+ }
488
+
489
+ export function setMaxPendingRequestsPerProfileV2(n) {
490
+ _stateLlmV2.maxPendingRequestsPerProfile = _posIntLlmV2(
491
+ n,
492
+ "maxPendingRequestsPerProfile",
493
+ );
494
+ }
495
+
496
+ export function getProfileIdleMsV2() {
497
+ return _stateLlmV2.profileIdleMs;
498
+ }
499
+
500
+ export function setProfileIdleMsV2(ms) {
501
+ _stateLlmV2.profileIdleMs = _posIntLlmV2(ms, "profileIdleMs");
502
+ }
503
+
504
+ export function getRequestStuckMsV2() {
505
+ return _stateLlmV2.requestStuckMs;
506
+ }
507
+
508
+ export function setRequestStuckMsV2(ms) {
509
+ _stateLlmV2.requestStuckMs = _posIntLlmV2(ms, "requestStuckMs");
510
+ }
511
+
512
+ export function getActiveProfileCountV2(ownerId) {
513
+ let count = 0;
514
+ for (const p of _stateLlmV2.profiles.values()) {
515
+ if (p.ownerId === ownerId && p.status === PROVIDER_MATURITY_V2.ACTIVE) {
516
+ count++;
517
+ }
518
+ }
519
+ return count;
520
+ }
521
+
522
+ export function getPendingRequestCountV2(profileId) {
523
+ let count = 0;
524
+ for (const r of _stateLlmV2.requests.values()) {
525
+ if (
526
+ r.profileId === profileId &&
527
+ (r.status === REQUEST_LIFECYCLE_V2.QUEUED ||
528
+ r.status === REQUEST_LIFECYCLE_V2.RUNNING)
529
+ ) {
530
+ count++;
531
+ }
532
+ }
533
+ return count;
534
+ }
535
+
536
+ export function registerProfileV2(
537
+ id,
538
+ { ownerId, provider, model, metadata } = {},
539
+ ) {
540
+ if (!id) throw new Error("profile id is required");
541
+ if (!ownerId) throw new Error("ownerId is required");
542
+ if (!provider) throw new Error("provider is required");
543
+ if (_stateLlmV2.profiles.has(id))
544
+ throw new Error(`profile ${id} already exists`);
545
+ const now = Date.now();
546
+ const profile = {
547
+ id,
548
+ ownerId,
549
+ provider,
550
+ model: model || "default",
551
+ status: PROVIDER_MATURITY_V2.PENDING,
552
+ createdAt: now,
553
+ lastSeenAt: now,
554
+ activatedAt: null,
555
+ retiredAt: null,
556
+ metadata: metadata ? { ...metadata } : {},
557
+ };
558
+ _stateLlmV2.profiles.set(id, profile);
559
+ return _copyProfileV2(profile);
560
+ }
561
+
562
+ export function getProfileV2(id) {
563
+ const p = _stateLlmV2.profiles.get(id);
564
+ return p ? _copyProfileV2(p) : null;
565
+ }
566
+
567
+ export function listProfilesV2({ ownerId, status, provider } = {}) {
568
+ const out = [];
569
+ for (const p of _stateLlmV2.profiles.values()) {
570
+ if (ownerId && p.ownerId !== ownerId) continue;
571
+ if (status && p.status !== status) continue;
572
+ if (provider && p.provider !== provider) continue;
573
+ out.push(_copyProfileV2(p));
574
+ }
575
+ return out;
576
+ }
577
+
578
+ export function setProfileStatusV2(id, next) {
579
+ const p = _stateLlmV2.profiles.get(id);
580
+ if (!p) throw new Error(`profile ${id} not found`);
581
+ const allowed = _PROVIDER_TRANSITIONS_V2.get(p.status);
582
+ if (!allowed || !allowed.has(next)) {
583
+ throw new Error(`invalid profile transition: ${p.status} → ${next}`);
584
+ }
585
+ if (
586
+ p.status === PROVIDER_MATURITY_V2.PENDING &&
587
+ next === PROVIDER_MATURITY_V2.ACTIVE
588
+ ) {
589
+ const count = getActiveProfileCountV2(p.ownerId);
590
+ if (count >= _stateLlmV2.maxActiveProfilesPerOwner) {
591
+ throw new Error(
592
+ `owner ${p.ownerId} active-profile cap reached (${count}/${_stateLlmV2.maxActiveProfilesPerOwner})`,
593
+ );
594
+ }
595
+ }
596
+ const now = Date.now();
597
+ p.status = next;
598
+ p.lastSeenAt = now;
599
+ if (next === PROVIDER_MATURITY_V2.ACTIVE && !p.activatedAt)
600
+ p.activatedAt = now;
601
+ if (_PROVIDER_TERMINALS_V2.has(next) && !p.retiredAt) p.retiredAt = now;
602
+ return _copyProfileV2(p);
603
+ }
604
+
605
+ export function activateProfileV2(id) {
606
+ return setProfileStatusV2(id, PROVIDER_MATURITY_V2.ACTIVE);
607
+ }
608
+
609
+ export function suspendProfileV2(id) {
610
+ return setProfileStatusV2(id, PROVIDER_MATURITY_V2.SUSPENDED);
611
+ }
612
+
613
+ export function retireProfileV2(id) {
614
+ return setProfileStatusV2(id, PROVIDER_MATURITY_V2.RETIRED);
615
+ }
616
+
617
+ export function touchProfileV2(id) {
618
+ const p = _stateLlmV2.profiles.get(id);
619
+ if (!p) throw new Error(`profile ${id} not found`);
620
+ p.lastSeenAt = Date.now();
621
+ return _copyProfileV2(p);
622
+ }
623
+
624
+ export function createRequestV2(id, { profileId, kind, metadata } = {}) {
625
+ if (!id) throw new Error("request id is required");
626
+ if (!profileId) throw new Error("profileId is required");
627
+ if (_stateLlmV2.requests.has(id))
628
+ throw new Error(`request ${id} already exists`);
629
+ const profile = _stateLlmV2.profiles.get(profileId);
630
+ if (!profile) throw new Error(`profile ${profileId} not found`);
631
+ const pending = getPendingRequestCountV2(profileId);
632
+ if (pending >= _stateLlmV2.maxPendingRequestsPerProfile) {
633
+ throw new Error(
634
+ `profile ${profileId} pending-request cap reached (${pending}/${_stateLlmV2.maxPendingRequestsPerProfile})`,
635
+ );
636
+ }
637
+ const now = Date.now();
638
+ const req = {
639
+ id,
640
+ profileId,
641
+ kind: kind || "completion",
642
+ status: REQUEST_LIFECYCLE_V2.QUEUED,
643
+ createdAt: now,
644
+ lastSeenAt: now,
645
+ startedAt: null,
646
+ settledAt: null,
647
+ metadata: metadata ? { ...metadata } : {},
648
+ };
649
+ _stateLlmV2.requests.set(id, req);
650
+ return _copyRequestV2(req);
651
+ }
652
+
653
+ export function getRequestV2(id) {
654
+ const r = _stateLlmV2.requests.get(id);
655
+ return r ? _copyRequestV2(r) : null;
656
+ }
657
+
658
+ export function listRequestsV2({ profileId, status } = {}) {
659
+ const out = [];
660
+ for (const r of _stateLlmV2.requests.values()) {
661
+ if (profileId && r.profileId !== profileId) continue;
662
+ if (status && r.status !== status) continue;
663
+ out.push(_copyRequestV2(r));
664
+ }
665
+ return out;
666
+ }
667
+
668
+ export function setRequestStatusV2(id, next) {
669
+ const r = _stateLlmV2.requests.get(id);
670
+ if (!r) throw new Error(`request ${id} not found`);
671
+ const allowed = _REQUEST_TRANSITIONS_V2.get(r.status);
672
+ if (!allowed || !allowed.has(next)) {
673
+ throw new Error(`invalid request transition: ${r.status} → ${next}`);
674
+ }
675
+ const now = Date.now();
676
+ r.status = next;
677
+ r.lastSeenAt = now;
678
+ if (next === REQUEST_LIFECYCLE_V2.RUNNING && !r.startedAt) r.startedAt = now;
679
+ if (_REQUEST_TERMINALS_V2.has(next) && !r.settledAt) r.settledAt = now;
680
+ return _copyRequestV2(r);
681
+ }
682
+
683
+ export function startRequestV2(id) {
684
+ return setRequestStatusV2(id, REQUEST_LIFECYCLE_V2.RUNNING);
685
+ }
686
+
687
+ export function completeRequestV2(id) {
688
+ return setRequestStatusV2(id, REQUEST_LIFECYCLE_V2.COMPLETED);
689
+ }
690
+
691
+ export function failRequestV2(id) {
692
+ return setRequestStatusV2(id, REQUEST_LIFECYCLE_V2.FAILED);
693
+ }
694
+
695
+ export function cancelRequestV2(id) {
696
+ return setRequestStatusV2(id, REQUEST_LIFECYCLE_V2.CANCELLED);
697
+ }
698
+
699
+ export function autoSuspendIdleProfilesV2({ now = Date.now() } = {}) {
700
+ const flipped = [];
701
+ for (const p of _stateLlmV2.profiles.values()) {
702
+ if (
703
+ p.status === PROVIDER_MATURITY_V2.ACTIVE &&
704
+ now - p.lastSeenAt >= _stateLlmV2.profileIdleMs
705
+ ) {
706
+ p.status = PROVIDER_MATURITY_V2.SUSPENDED;
707
+ p.lastSeenAt = now;
708
+ flipped.push(p.id);
709
+ }
710
+ }
711
+ return { flipped, count: flipped.length };
712
+ }
713
+
714
+ export function autoFailStuckRequestsV2({ now = Date.now() } = {}) {
715
+ const flipped = [];
716
+ for (const r of _stateLlmV2.requests.values()) {
717
+ if (
718
+ r.status === REQUEST_LIFECYCLE_V2.RUNNING &&
719
+ r.startedAt &&
720
+ now - r.startedAt >= _stateLlmV2.requestStuckMs
721
+ ) {
722
+ r.status = REQUEST_LIFECYCLE_V2.FAILED;
723
+ r.lastSeenAt = now;
724
+ if (!r.settledAt) r.settledAt = now;
725
+ flipped.push(r.id);
726
+ }
727
+ }
728
+ return { flipped, count: flipped.length };
729
+ }
730
+
731
+ export function getLlmProvidersStatsV2() {
732
+ const profilesByStatus = {};
733
+ for (const s of Object.values(PROVIDER_MATURITY_V2)) profilesByStatus[s] = 0;
734
+ for (const p of _stateLlmV2.profiles.values()) profilesByStatus[p.status]++;
735
+ const requestsByStatus = {};
736
+ for (const s of Object.values(REQUEST_LIFECYCLE_V2)) requestsByStatus[s] = 0;
737
+ for (const r of _stateLlmV2.requests.values()) requestsByStatus[r.status]++;
738
+ return {
739
+ totalProfilesV2: _stateLlmV2.profiles.size,
740
+ totalRequestsV2: _stateLlmV2.requests.size,
741
+ maxActiveProfilesPerOwner: _stateLlmV2.maxActiveProfilesPerOwner,
742
+ maxPendingRequestsPerProfile: _stateLlmV2.maxPendingRequestsPerProfile,
743
+ profileIdleMs: _stateLlmV2.profileIdleMs,
744
+ requestStuckMs: _stateLlmV2.requestStuckMs,
745
+ profilesByStatus,
746
+ requestsByStatus,
747
+ };
748
+ }
749
+
750
+ export function _resetStateLlmProvidersV2() {
751
+ _stateLlmV2.profiles.clear();
752
+ _stateLlmV2.requests.clear();
753
+ _stateLlmV2.maxActiveProfilesPerOwner = PROVIDER_DEFAULT_MAX_ACTIVE_PER_OWNER;
754
+ _stateLlmV2.maxPendingRequestsPerProfile =
755
+ PROVIDER_DEFAULT_MAX_PENDING_REQUESTS_PER_PROFILE;
756
+ _stateLlmV2.profileIdleMs = PROVIDER_DEFAULT_PROFILE_IDLE_MS;
757
+ _stateLlmV2.requestStuckMs = PROVIDER_DEFAULT_REQUEST_STUCK_MS;
758
+ }