chainlesschain 0.145.0 → 0.152.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.
- package/package.json +1 -1
- package/src/commands/activitypub.js +207 -0
- package/src/commands/agent-network.js +217 -0
- package/src/commands/automation.js +201 -0
- package/src/commands/bi.js +203 -0
- package/src/commands/browse.js +213 -0
- package/src/commands/codegen.js +207 -0
- package/src/commands/collab.js +211 -0
- package/src/commands/compliance.js +410 -0
- package/src/commands/cowork.js +203 -0
- package/src/commands/dbevo.js +227 -0
- package/src/commands/dev.js +207 -0
- package/src/commands/did-v2.js +217 -0
- package/src/commands/did.js +221 -0
- package/src/commands/dlp.js +213 -0
- package/src/commands/evomap.js +205 -0
- package/src/commands/export.js +213 -0
- package/src/commands/federation.js +209 -0
- package/src/commands/fusion.js +205 -0
- package/src/commands/governance.js +209 -0
- package/src/commands/hook.js +209 -0
- package/src/commands/import.js +209 -0
- package/src/commands/infra.js +203 -0
- package/src/commands/instinct.js +209 -0
- package/src/commands/ipfs.js +207 -0
- package/src/commands/llm.js +217 -0
- package/src/commands/matrix.js +207 -0
- package/src/commands/mcp.js +217 -0
- package/src/commands/memory.js +209 -0
- package/src/commands/multimodal.js +203 -0
- package/src/commands/nlprog.js +225 -0
- package/src/commands/nostr.js +209 -0
- package/src/commands/note.js +205 -0
- package/src/commands/ops.js +219 -0
- package/src/commands/org.js +209 -0
- package/src/commands/p2p.js +209 -0
- package/src/commands/perception.js +209 -0
- package/src/commands/permmem.js +203 -0
- package/src/commands/plugin-ecosystem.js +209 -0
- package/src/commands/pqc.js +213 -0
- package/src/commands/quantization.js +207 -0
- package/src/commands/rcache.js +205 -0
- package/src/commands/recommend.js +233 -0
- package/src/commands/runtime.js +205 -0
- package/src/commands/scim.js +209 -0
- package/src/commands/session.js +209 -0
- package/src/commands/skill.js +207 -0
- package/src/commands/social.js +201 -0
- package/src/commands/sso.js +209 -0
- package/src/commands/sync.js +209 -0
- package/src/commands/tech.js +209 -0
- package/src/commands/tenant.js +217 -0
- package/src/commands/tokens.js +209 -0
- package/src/commands/trust.js +217 -0
- package/src/commands/wallet.js +209 -0
- package/src/commands/workflow.js +203 -0
- package/src/index.js +140 -0
- package/src/lib/activitypub-bridge.js +334 -0
- package/src/lib/agent-network.js +341 -0
- package/src/lib/aiops.js +346 -0
- package/src/lib/automation-engine.js +335 -0
- package/src/lib/autonomous-developer.js +332 -0
- package/src/lib/bi-engine.js +333 -0
- package/src/lib/browser-automation.js +334 -0
- package/src/lib/code-agent.js +339 -0
- package/src/lib/collaboration-governance.js +334 -0
- package/src/lib/community-governance.js +346 -0
- package/src/lib/content-recommendation.js +351 -0
- package/src/lib/cowork-share.js +338 -0
- package/src/lib/dbevo.js +351 -0
- package/src/lib/decentral-infra.js +330 -0
- package/src/lib/did-manager.js +341 -0
- package/src/lib/did-v2-manager.js +341 -0
- package/src/lib/dlp-engine.js +339 -0
- package/src/lib/evomap-governance.js +334 -0
- package/src/lib/federation-hardening.js +340 -0
- package/src/lib/hook-manager.js +341 -0
- package/src/lib/instinct-manager.js +346 -0
- package/src/lib/ipfs-storage.js +334 -0
- package/src/lib/knowledge-exporter.js +341 -0
- package/src/lib/knowledge-importer.js +341 -0
- package/src/lib/llm-providers.js +346 -0
- package/src/lib/matrix-bridge.js +339 -0
- package/src/lib/mcp-registry.js +346 -0
- package/src/lib/memory-manager.js +336 -0
- package/src/lib/multimodal.js +330 -0
- package/src/lib/nl-programming.js +341 -0
- package/src/lib/nostr-bridge.js +336 -0
- package/src/lib/note-versioning.js +339 -0
- package/src/lib/org-manager.js +336 -0
- package/src/lib/p2p-manager.js +341 -0
- package/src/lib/perception.js +346 -0
- package/src/lib/permanent-memory.js +327 -0
- package/src/lib/plugin-ecosystem.js +346 -0
- package/src/lib/pqc-manager.js +346 -0
- package/src/lib/protocol-fusion.js +338 -0
- package/src/lib/quantization.js +337 -0
- package/src/lib/response-cache.js +333 -0
- package/src/lib/scim-manager.js +346 -0
- package/src/lib/session-manager.js +334 -0
- package/src/lib/skill-loader.js +334 -0
- package/src/lib/social-manager.js +330 -0
- package/src/lib/sso-manager.js +340 -0
- package/src/lib/sync-manager.js +336 -0
- package/src/lib/tech-learning-engine.js +341 -0
- package/src/lib/tenant-saas.js +341 -0
- package/src/lib/threat-intel.js +330 -0
- package/src/lib/token-tracker.js +336 -0
- package/src/lib/trust-security.js +343 -0
- package/src/lib/ueba.js +340 -0
- package/src/lib/universal-runtime.js +330 -0
- package/src/lib/wallet-manager.js +336 -0
- package/src/lib/workflow-engine.js +330 -0
package/src/lib/sync-manager.js
CHANGED
|
@@ -671,3 +671,339 @@ export function _resetStateSyncManagerV2() {
|
|
|
671
671
|
_resourceIdleMsV2 = SYNC_DEFAULT_RESOURCE_IDLE_MS;
|
|
672
672
|
_runStuckMsV2 = SYNC_DEFAULT_RUN_STUCK_MS;
|
|
673
673
|
}
|
|
674
|
+
|
|
675
|
+
// =====================================================================
|
|
676
|
+
// sync-manager V2 governance overlay (iter19)
|
|
677
|
+
// =====================================================================
|
|
678
|
+
export const SYNCGOV_PROFILE_MATURITY_V2 = Object.freeze({
|
|
679
|
+
PENDING: "pending",
|
|
680
|
+
ACTIVE: "active",
|
|
681
|
+
STALE: "stale",
|
|
682
|
+
ARCHIVED: "archived",
|
|
683
|
+
});
|
|
684
|
+
export const SYNCGOV_BATCH_LIFECYCLE_V2 = Object.freeze({
|
|
685
|
+
QUEUED: "queued",
|
|
686
|
+
REPLICATING: "replicating",
|
|
687
|
+
REPLICATED: "replicated",
|
|
688
|
+
FAILED: "failed",
|
|
689
|
+
CANCELLED: "cancelled",
|
|
690
|
+
});
|
|
691
|
+
const _syncgovPTrans = new Map([
|
|
692
|
+
[
|
|
693
|
+
SYNCGOV_PROFILE_MATURITY_V2.PENDING,
|
|
694
|
+
new Set([
|
|
695
|
+
SYNCGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
696
|
+
SYNCGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
697
|
+
]),
|
|
698
|
+
],
|
|
699
|
+
[
|
|
700
|
+
SYNCGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
701
|
+
new Set([
|
|
702
|
+
SYNCGOV_PROFILE_MATURITY_V2.STALE,
|
|
703
|
+
SYNCGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
704
|
+
]),
|
|
705
|
+
],
|
|
706
|
+
[
|
|
707
|
+
SYNCGOV_PROFILE_MATURITY_V2.STALE,
|
|
708
|
+
new Set([
|
|
709
|
+
SYNCGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
710
|
+
SYNCGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
711
|
+
]),
|
|
712
|
+
],
|
|
713
|
+
[SYNCGOV_PROFILE_MATURITY_V2.ARCHIVED, new Set()],
|
|
714
|
+
]);
|
|
715
|
+
const _syncgovPTerminal = new Set([SYNCGOV_PROFILE_MATURITY_V2.ARCHIVED]);
|
|
716
|
+
const _syncgovJTrans = new Map([
|
|
717
|
+
[
|
|
718
|
+
SYNCGOV_BATCH_LIFECYCLE_V2.QUEUED,
|
|
719
|
+
new Set([
|
|
720
|
+
SYNCGOV_BATCH_LIFECYCLE_V2.REPLICATING,
|
|
721
|
+
SYNCGOV_BATCH_LIFECYCLE_V2.CANCELLED,
|
|
722
|
+
]),
|
|
723
|
+
],
|
|
724
|
+
[
|
|
725
|
+
SYNCGOV_BATCH_LIFECYCLE_V2.REPLICATING,
|
|
726
|
+
new Set([
|
|
727
|
+
SYNCGOV_BATCH_LIFECYCLE_V2.REPLICATED,
|
|
728
|
+
SYNCGOV_BATCH_LIFECYCLE_V2.FAILED,
|
|
729
|
+
SYNCGOV_BATCH_LIFECYCLE_V2.CANCELLED,
|
|
730
|
+
]),
|
|
731
|
+
],
|
|
732
|
+
[SYNCGOV_BATCH_LIFECYCLE_V2.REPLICATED, new Set()],
|
|
733
|
+
[SYNCGOV_BATCH_LIFECYCLE_V2.FAILED, new Set()],
|
|
734
|
+
[SYNCGOV_BATCH_LIFECYCLE_V2.CANCELLED, new Set()],
|
|
735
|
+
]);
|
|
736
|
+
const _syncgovPsV2 = new Map();
|
|
737
|
+
const _syncgovJsV2 = new Map();
|
|
738
|
+
let _syncgovMaxActive = 8,
|
|
739
|
+
_syncgovMaxPending = 20,
|
|
740
|
+
_syncgovIdleMs = 30 * 24 * 60 * 60 * 1000,
|
|
741
|
+
_syncgovStuckMs = 60 * 1000;
|
|
742
|
+
function _syncgovPos(n, label) {
|
|
743
|
+
const v = Math.floor(Number(n));
|
|
744
|
+
if (!Number.isFinite(v) || v <= 0)
|
|
745
|
+
throw new Error(`${label} must be positive integer`);
|
|
746
|
+
return v;
|
|
747
|
+
}
|
|
748
|
+
function _syncgovCheckP(from, to) {
|
|
749
|
+
const a = _syncgovPTrans.get(from);
|
|
750
|
+
if (!a || !a.has(to))
|
|
751
|
+
throw new Error(`invalid syncgov profile transition ${from} → ${to}`);
|
|
752
|
+
}
|
|
753
|
+
function _syncgovCheckJ(from, to) {
|
|
754
|
+
const a = _syncgovJTrans.get(from);
|
|
755
|
+
if (!a || !a.has(to))
|
|
756
|
+
throw new Error(`invalid syncgov batch transition ${from} → ${to}`);
|
|
757
|
+
}
|
|
758
|
+
function _syncgovCountActive(owner) {
|
|
759
|
+
let c = 0;
|
|
760
|
+
for (const p of _syncgovPsV2.values())
|
|
761
|
+
if (p.owner === owner && p.status === SYNCGOV_PROFILE_MATURITY_V2.ACTIVE)
|
|
762
|
+
c++;
|
|
763
|
+
return c;
|
|
764
|
+
}
|
|
765
|
+
function _syncgovCountPending(profileId) {
|
|
766
|
+
let c = 0;
|
|
767
|
+
for (const j of _syncgovJsV2.values())
|
|
768
|
+
if (
|
|
769
|
+
j.profileId === profileId &&
|
|
770
|
+
(j.status === SYNCGOV_BATCH_LIFECYCLE_V2.QUEUED ||
|
|
771
|
+
j.status === SYNCGOV_BATCH_LIFECYCLE_V2.REPLICATING)
|
|
772
|
+
)
|
|
773
|
+
c++;
|
|
774
|
+
return c;
|
|
775
|
+
}
|
|
776
|
+
export function setMaxActiveSyncgovProfilesPerOwnerV2(n) {
|
|
777
|
+
_syncgovMaxActive = _syncgovPos(n, "maxActiveSyncgovProfilesPerOwner");
|
|
778
|
+
}
|
|
779
|
+
export function getMaxActiveSyncgovProfilesPerOwnerV2() {
|
|
780
|
+
return _syncgovMaxActive;
|
|
781
|
+
}
|
|
782
|
+
export function setMaxPendingSyncgovBatchsPerProfileV2(n) {
|
|
783
|
+
_syncgovMaxPending = _syncgovPos(n, "maxPendingSyncgovBatchsPerProfile");
|
|
784
|
+
}
|
|
785
|
+
export function getMaxPendingSyncgovBatchsPerProfileV2() {
|
|
786
|
+
return _syncgovMaxPending;
|
|
787
|
+
}
|
|
788
|
+
export function setSyncgovProfileIdleMsV2(n) {
|
|
789
|
+
_syncgovIdleMs = _syncgovPos(n, "syncgovProfileIdleMs");
|
|
790
|
+
}
|
|
791
|
+
export function getSyncgovProfileIdleMsV2() {
|
|
792
|
+
return _syncgovIdleMs;
|
|
793
|
+
}
|
|
794
|
+
export function setSyncgovBatchStuckMsV2(n) {
|
|
795
|
+
_syncgovStuckMs = _syncgovPos(n, "syncgovBatchStuckMs");
|
|
796
|
+
}
|
|
797
|
+
export function getSyncgovBatchStuckMsV2() {
|
|
798
|
+
return _syncgovStuckMs;
|
|
799
|
+
}
|
|
800
|
+
export function _resetStateSyncManagerGovV2() {
|
|
801
|
+
_syncgovPsV2.clear();
|
|
802
|
+
_syncgovJsV2.clear();
|
|
803
|
+
_syncgovMaxActive = 8;
|
|
804
|
+
_syncgovMaxPending = 20;
|
|
805
|
+
_syncgovIdleMs = 30 * 24 * 60 * 60 * 1000;
|
|
806
|
+
_syncgovStuckMs = 60 * 1000;
|
|
807
|
+
}
|
|
808
|
+
export function registerSyncgovProfileV2({ id, owner, target, metadata } = {}) {
|
|
809
|
+
if (!id || !owner) throw new Error("id and owner required");
|
|
810
|
+
if (_syncgovPsV2.has(id))
|
|
811
|
+
throw new Error(`syncgov profile ${id} already exists`);
|
|
812
|
+
const now = Date.now();
|
|
813
|
+
const p = {
|
|
814
|
+
id,
|
|
815
|
+
owner,
|
|
816
|
+
target: target || "primary",
|
|
817
|
+
status: SYNCGOV_PROFILE_MATURITY_V2.PENDING,
|
|
818
|
+
createdAt: now,
|
|
819
|
+
updatedAt: now,
|
|
820
|
+
lastTouchedAt: now,
|
|
821
|
+
activatedAt: null,
|
|
822
|
+
archivedAt: null,
|
|
823
|
+
metadata: { ...(metadata || {}) },
|
|
824
|
+
};
|
|
825
|
+
_syncgovPsV2.set(id, p);
|
|
826
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
827
|
+
}
|
|
828
|
+
export function activateSyncgovProfileV2(id) {
|
|
829
|
+
const p = _syncgovPsV2.get(id);
|
|
830
|
+
if (!p) throw new Error(`syncgov profile ${id} not found`);
|
|
831
|
+
const isInitial = p.status === SYNCGOV_PROFILE_MATURITY_V2.PENDING;
|
|
832
|
+
_syncgovCheckP(p.status, SYNCGOV_PROFILE_MATURITY_V2.ACTIVE);
|
|
833
|
+
if (isInitial && _syncgovCountActive(p.owner) >= _syncgovMaxActive)
|
|
834
|
+
throw new Error(`max active syncgov profiles for owner ${p.owner} reached`);
|
|
835
|
+
const now = Date.now();
|
|
836
|
+
p.status = SYNCGOV_PROFILE_MATURITY_V2.ACTIVE;
|
|
837
|
+
p.updatedAt = now;
|
|
838
|
+
p.lastTouchedAt = now;
|
|
839
|
+
if (!p.activatedAt) p.activatedAt = now;
|
|
840
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
841
|
+
}
|
|
842
|
+
export function staleSyncgovProfileV2(id) {
|
|
843
|
+
const p = _syncgovPsV2.get(id);
|
|
844
|
+
if (!p) throw new Error(`syncgov profile ${id} not found`);
|
|
845
|
+
_syncgovCheckP(p.status, SYNCGOV_PROFILE_MATURITY_V2.STALE);
|
|
846
|
+
p.status = SYNCGOV_PROFILE_MATURITY_V2.STALE;
|
|
847
|
+
p.updatedAt = Date.now();
|
|
848
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
849
|
+
}
|
|
850
|
+
export function archiveSyncgovProfileV2(id) {
|
|
851
|
+
const p = _syncgovPsV2.get(id);
|
|
852
|
+
if (!p) throw new Error(`syncgov profile ${id} not found`);
|
|
853
|
+
_syncgovCheckP(p.status, SYNCGOV_PROFILE_MATURITY_V2.ARCHIVED);
|
|
854
|
+
const now = Date.now();
|
|
855
|
+
p.status = SYNCGOV_PROFILE_MATURITY_V2.ARCHIVED;
|
|
856
|
+
p.updatedAt = now;
|
|
857
|
+
if (!p.archivedAt) p.archivedAt = now;
|
|
858
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
859
|
+
}
|
|
860
|
+
export function touchSyncgovProfileV2(id) {
|
|
861
|
+
const p = _syncgovPsV2.get(id);
|
|
862
|
+
if (!p) throw new Error(`syncgov profile ${id} not found`);
|
|
863
|
+
if (_syncgovPTerminal.has(p.status))
|
|
864
|
+
throw new Error(`cannot touch terminal syncgov profile ${id}`);
|
|
865
|
+
const now = Date.now();
|
|
866
|
+
p.lastTouchedAt = now;
|
|
867
|
+
p.updatedAt = now;
|
|
868
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
869
|
+
}
|
|
870
|
+
export function getSyncgovProfileV2(id) {
|
|
871
|
+
const p = _syncgovPsV2.get(id);
|
|
872
|
+
if (!p) return null;
|
|
873
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
874
|
+
}
|
|
875
|
+
export function listSyncgovProfilesV2() {
|
|
876
|
+
return [..._syncgovPsV2.values()].map((p) => ({
|
|
877
|
+
...p,
|
|
878
|
+
metadata: { ...p.metadata },
|
|
879
|
+
}));
|
|
880
|
+
}
|
|
881
|
+
export function createSyncgovBatchV2({ id, profileId, scope, metadata } = {}) {
|
|
882
|
+
if (!id || !profileId) throw new Error("id and profileId required");
|
|
883
|
+
if (_syncgovJsV2.has(id))
|
|
884
|
+
throw new Error(`syncgov batch ${id} already exists`);
|
|
885
|
+
if (!_syncgovPsV2.has(profileId))
|
|
886
|
+
throw new Error(`syncgov profile ${profileId} not found`);
|
|
887
|
+
if (_syncgovCountPending(profileId) >= _syncgovMaxPending)
|
|
888
|
+
throw new Error(
|
|
889
|
+
`max pending syncgov batchs for profile ${profileId} reached`,
|
|
890
|
+
);
|
|
891
|
+
const now = Date.now();
|
|
892
|
+
const j = {
|
|
893
|
+
id,
|
|
894
|
+
profileId,
|
|
895
|
+
scope: scope || "",
|
|
896
|
+
status: SYNCGOV_BATCH_LIFECYCLE_V2.QUEUED,
|
|
897
|
+
createdAt: now,
|
|
898
|
+
updatedAt: now,
|
|
899
|
+
startedAt: null,
|
|
900
|
+
settledAt: null,
|
|
901
|
+
metadata: { ...(metadata || {}) },
|
|
902
|
+
};
|
|
903
|
+
_syncgovJsV2.set(id, j);
|
|
904
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
905
|
+
}
|
|
906
|
+
export function replicatingSyncgovBatchV2(id) {
|
|
907
|
+
const j = _syncgovJsV2.get(id);
|
|
908
|
+
if (!j) throw new Error(`syncgov batch ${id} not found`);
|
|
909
|
+
_syncgovCheckJ(j.status, SYNCGOV_BATCH_LIFECYCLE_V2.REPLICATING);
|
|
910
|
+
const now = Date.now();
|
|
911
|
+
j.status = SYNCGOV_BATCH_LIFECYCLE_V2.REPLICATING;
|
|
912
|
+
j.updatedAt = now;
|
|
913
|
+
if (!j.startedAt) j.startedAt = now;
|
|
914
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
915
|
+
}
|
|
916
|
+
export function completeBatchSyncgovV2(id) {
|
|
917
|
+
const j = _syncgovJsV2.get(id);
|
|
918
|
+
if (!j) throw new Error(`syncgov batch ${id} not found`);
|
|
919
|
+
_syncgovCheckJ(j.status, SYNCGOV_BATCH_LIFECYCLE_V2.REPLICATED);
|
|
920
|
+
const now = Date.now();
|
|
921
|
+
j.status = SYNCGOV_BATCH_LIFECYCLE_V2.REPLICATED;
|
|
922
|
+
j.updatedAt = now;
|
|
923
|
+
if (!j.settledAt) j.settledAt = now;
|
|
924
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
925
|
+
}
|
|
926
|
+
export function failSyncgovBatchV2(id, reason) {
|
|
927
|
+
const j = _syncgovJsV2.get(id);
|
|
928
|
+
if (!j) throw new Error(`syncgov batch ${id} not found`);
|
|
929
|
+
_syncgovCheckJ(j.status, SYNCGOV_BATCH_LIFECYCLE_V2.FAILED);
|
|
930
|
+
const now = Date.now();
|
|
931
|
+
j.status = SYNCGOV_BATCH_LIFECYCLE_V2.FAILED;
|
|
932
|
+
j.updatedAt = now;
|
|
933
|
+
if (!j.settledAt) j.settledAt = now;
|
|
934
|
+
if (reason) j.metadata.failReason = String(reason);
|
|
935
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
936
|
+
}
|
|
937
|
+
export function cancelSyncgovBatchV2(id, reason) {
|
|
938
|
+
const j = _syncgovJsV2.get(id);
|
|
939
|
+
if (!j) throw new Error(`syncgov batch ${id} not found`);
|
|
940
|
+
_syncgovCheckJ(j.status, SYNCGOV_BATCH_LIFECYCLE_V2.CANCELLED);
|
|
941
|
+
const now = Date.now();
|
|
942
|
+
j.status = SYNCGOV_BATCH_LIFECYCLE_V2.CANCELLED;
|
|
943
|
+
j.updatedAt = now;
|
|
944
|
+
if (!j.settledAt) j.settledAt = now;
|
|
945
|
+
if (reason) j.metadata.cancelReason = String(reason);
|
|
946
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
947
|
+
}
|
|
948
|
+
export function getSyncgovBatchV2(id) {
|
|
949
|
+
const j = _syncgovJsV2.get(id);
|
|
950
|
+
if (!j) return null;
|
|
951
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
952
|
+
}
|
|
953
|
+
export function listSyncgovBatchsV2() {
|
|
954
|
+
return [..._syncgovJsV2.values()].map((j) => ({
|
|
955
|
+
...j,
|
|
956
|
+
metadata: { ...j.metadata },
|
|
957
|
+
}));
|
|
958
|
+
}
|
|
959
|
+
export function autoStaleIdleSyncgovProfilesV2({ now } = {}) {
|
|
960
|
+
const t = now ?? Date.now();
|
|
961
|
+
const flipped = [];
|
|
962
|
+
for (const p of _syncgovPsV2.values())
|
|
963
|
+
if (
|
|
964
|
+
p.status === SYNCGOV_PROFILE_MATURITY_V2.ACTIVE &&
|
|
965
|
+
t - p.lastTouchedAt >= _syncgovIdleMs
|
|
966
|
+
) {
|
|
967
|
+
p.status = SYNCGOV_PROFILE_MATURITY_V2.STALE;
|
|
968
|
+
p.updatedAt = t;
|
|
969
|
+
flipped.push(p.id);
|
|
970
|
+
}
|
|
971
|
+
return { flipped, count: flipped.length };
|
|
972
|
+
}
|
|
973
|
+
export function autoFailStuckSyncgovBatchsV2({ now } = {}) {
|
|
974
|
+
const t = now ?? Date.now();
|
|
975
|
+
const flipped = [];
|
|
976
|
+
for (const j of _syncgovJsV2.values())
|
|
977
|
+
if (
|
|
978
|
+
j.status === SYNCGOV_BATCH_LIFECYCLE_V2.REPLICATING &&
|
|
979
|
+
j.startedAt != null &&
|
|
980
|
+
t - j.startedAt >= _syncgovStuckMs
|
|
981
|
+
) {
|
|
982
|
+
j.status = SYNCGOV_BATCH_LIFECYCLE_V2.FAILED;
|
|
983
|
+
j.updatedAt = t;
|
|
984
|
+
if (!j.settledAt) j.settledAt = t;
|
|
985
|
+
j.metadata.failReason = "auto-fail-stuck";
|
|
986
|
+
flipped.push(j.id);
|
|
987
|
+
}
|
|
988
|
+
return { flipped, count: flipped.length };
|
|
989
|
+
}
|
|
990
|
+
export function getSyncManagerGovStatsV2() {
|
|
991
|
+
const profilesByStatus = {};
|
|
992
|
+
for (const v of Object.values(SYNCGOV_PROFILE_MATURITY_V2))
|
|
993
|
+
profilesByStatus[v] = 0;
|
|
994
|
+
for (const p of _syncgovPsV2.values()) profilesByStatus[p.status]++;
|
|
995
|
+
const batchsByStatus = {};
|
|
996
|
+
for (const v of Object.values(SYNCGOV_BATCH_LIFECYCLE_V2))
|
|
997
|
+
batchsByStatus[v] = 0;
|
|
998
|
+
for (const j of _syncgovJsV2.values()) batchsByStatus[j.status]++;
|
|
999
|
+
return {
|
|
1000
|
+
totalSyncgovProfilesV2: _syncgovPsV2.size,
|
|
1001
|
+
totalSyncgovBatchsV2: _syncgovJsV2.size,
|
|
1002
|
+
maxActiveSyncgovProfilesPerOwner: _syncgovMaxActive,
|
|
1003
|
+
maxPendingSyncgovBatchsPerProfile: _syncgovMaxPending,
|
|
1004
|
+
syncgovProfileIdleMs: _syncgovIdleMs,
|
|
1005
|
+
syncgovBatchStuckMs: _syncgovStuckMs,
|
|
1006
|
+
profilesByStatus,
|
|
1007
|
+
batchsByStatus,
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
@@ -1018,3 +1018,344 @@ export function _resetStateV2() {
|
|
|
1018
1018
|
_tleProfileStaleMs = TLE_DEFAULT_PROFILE_STALE_MS;
|
|
1019
1019
|
_tleRunStuckMs = TLE_DEFAULT_RUN_STUCK_MS;
|
|
1020
1020
|
}
|
|
1021
|
+
|
|
1022
|
+
// =====================================================================
|
|
1023
|
+
// tech-learning-engine V2 governance overlay (iter23)
|
|
1024
|
+
// =====================================================================
|
|
1025
|
+
export const TECHGOV_PROFILE_MATURITY_V2 = Object.freeze({
|
|
1026
|
+
PENDING: "pending",
|
|
1027
|
+
ACTIVE: "active",
|
|
1028
|
+
STALE: "stale",
|
|
1029
|
+
ARCHIVED: "archived",
|
|
1030
|
+
});
|
|
1031
|
+
export const TECHGOV_LESSON_LIFECYCLE_V2 = Object.freeze({
|
|
1032
|
+
QUEUED: "queued",
|
|
1033
|
+
STUDYING: "studying",
|
|
1034
|
+
STUDIED: "studied",
|
|
1035
|
+
FAILED: "failed",
|
|
1036
|
+
CANCELLED: "cancelled",
|
|
1037
|
+
});
|
|
1038
|
+
const _techgovPTrans = new Map([
|
|
1039
|
+
[
|
|
1040
|
+
TECHGOV_PROFILE_MATURITY_V2.PENDING,
|
|
1041
|
+
new Set([
|
|
1042
|
+
TECHGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
1043
|
+
TECHGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
1044
|
+
]),
|
|
1045
|
+
],
|
|
1046
|
+
[
|
|
1047
|
+
TECHGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
1048
|
+
new Set([
|
|
1049
|
+
TECHGOV_PROFILE_MATURITY_V2.STALE,
|
|
1050
|
+
TECHGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
1051
|
+
]),
|
|
1052
|
+
],
|
|
1053
|
+
[
|
|
1054
|
+
TECHGOV_PROFILE_MATURITY_V2.STALE,
|
|
1055
|
+
new Set([
|
|
1056
|
+
TECHGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
1057
|
+
TECHGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
1058
|
+
]),
|
|
1059
|
+
],
|
|
1060
|
+
[TECHGOV_PROFILE_MATURITY_V2.ARCHIVED, new Set()],
|
|
1061
|
+
]);
|
|
1062
|
+
const _techgovPTerminal = new Set([TECHGOV_PROFILE_MATURITY_V2.ARCHIVED]);
|
|
1063
|
+
const _techgovJTrans = new Map([
|
|
1064
|
+
[
|
|
1065
|
+
TECHGOV_LESSON_LIFECYCLE_V2.QUEUED,
|
|
1066
|
+
new Set([
|
|
1067
|
+
TECHGOV_LESSON_LIFECYCLE_V2.STUDYING,
|
|
1068
|
+
TECHGOV_LESSON_LIFECYCLE_V2.CANCELLED,
|
|
1069
|
+
]),
|
|
1070
|
+
],
|
|
1071
|
+
[
|
|
1072
|
+
TECHGOV_LESSON_LIFECYCLE_V2.STUDYING,
|
|
1073
|
+
new Set([
|
|
1074
|
+
TECHGOV_LESSON_LIFECYCLE_V2.STUDIED,
|
|
1075
|
+
TECHGOV_LESSON_LIFECYCLE_V2.FAILED,
|
|
1076
|
+
TECHGOV_LESSON_LIFECYCLE_V2.CANCELLED,
|
|
1077
|
+
]),
|
|
1078
|
+
],
|
|
1079
|
+
[TECHGOV_LESSON_LIFECYCLE_V2.STUDIED, new Set()],
|
|
1080
|
+
[TECHGOV_LESSON_LIFECYCLE_V2.FAILED, new Set()],
|
|
1081
|
+
[TECHGOV_LESSON_LIFECYCLE_V2.CANCELLED, new Set()],
|
|
1082
|
+
]);
|
|
1083
|
+
const _techgovPsV2 = new Map();
|
|
1084
|
+
const _techgovJsV2 = new Map();
|
|
1085
|
+
let _techgovMaxActive = 6,
|
|
1086
|
+
_techgovMaxPending = 12,
|
|
1087
|
+
_techgovIdleMs = 30 * 24 * 60 * 60 * 1000,
|
|
1088
|
+
_techgovStuckMs = 60 * 1000;
|
|
1089
|
+
function _techgovPos(n, label) {
|
|
1090
|
+
const v = Math.floor(Number(n));
|
|
1091
|
+
if (!Number.isFinite(v) || v <= 0)
|
|
1092
|
+
throw new Error(`${label} must be positive integer`);
|
|
1093
|
+
return v;
|
|
1094
|
+
}
|
|
1095
|
+
function _techgovCheckP(from, to) {
|
|
1096
|
+
const a = _techgovPTrans.get(from);
|
|
1097
|
+
if (!a || !a.has(to))
|
|
1098
|
+
throw new Error(`invalid techgov profile transition ${from} → ${to}`);
|
|
1099
|
+
}
|
|
1100
|
+
function _techgovCheckJ(from, to) {
|
|
1101
|
+
const a = _techgovJTrans.get(from);
|
|
1102
|
+
if (!a || !a.has(to))
|
|
1103
|
+
throw new Error(`invalid techgov lesson transition ${from} → ${to}`);
|
|
1104
|
+
}
|
|
1105
|
+
function _techgovCountActive(owner) {
|
|
1106
|
+
let c = 0;
|
|
1107
|
+
for (const p of _techgovPsV2.values())
|
|
1108
|
+
if (p.owner === owner && p.status === TECHGOV_PROFILE_MATURITY_V2.ACTIVE)
|
|
1109
|
+
c++;
|
|
1110
|
+
return c;
|
|
1111
|
+
}
|
|
1112
|
+
function _techgovCountPending(profileId) {
|
|
1113
|
+
let c = 0;
|
|
1114
|
+
for (const j of _techgovJsV2.values())
|
|
1115
|
+
if (
|
|
1116
|
+
j.profileId === profileId &&
|
|
1117
|
+
(j.status === TECHGOV_LESSON_LIFECYCLE_V2.QUEUED ||
|
|
1118
|
+
j.status === TECHGOV_LESSON_LIFECYCLE_V2.STUDYING)
|
|
1119
|
+
)
|
|
1120
|
+
c++;
|
|
1121
|
+
return c;
|
|
1122
|
+
}
|
|
1123
|
+
export function setMaxActiveTechgovProfilesPerOwnerV2(n) {
|
|
1124
|
+
_techgovMaxActive = _techgovPos(n, "maxActiveTechgovProfilesPerOwner");
|
|
1125
|
+
}
|
|
1126
|
+
export function getMaxActiveTechgovProfilesPerOwnerV2() {
|
|
1127
|
+
return _techgovMaxActive;
|
|
1128
|
+
}
|
|
1129
|
+
export function setMaxPendingTechgovLessonsPerProfileV2(n) {
|
|
1130
|
+
_techgovMaxPending = _techgovPos(n, "maxPendingTechgovLessonsPerProfile");
|
|
1131
|
+
}
|
|
1132
|
+
export function getMaxPendingTechgovLessonsPerProfileV2() {
|
|
1133
|
+
return _techgovMaxPending;
|
|
1134
|
+
}
|
|
1135
|
+
export function setTechgovProfileIdleMsV2(n) {
|
|
1136
|
+
_techgovIdleMs = _techgovPos(n, "techgovProfileIdleMs");
|
|
1137
|
+
}
|
|
1138
|
+
export function getTechgovProfileIdleMsV2() {
|
|
1139
|
+
return _techgovIdleMs;
|
|
1140
|
+
}
|
|
1141
|
+
export function setTechgovLessonStuckMsV2(n) {
|
|
1142
|
+
_techgovStuckMs = _techgovPos(n, "techgovLessonStuckMs");
|
|
1143
|
+
}
|
|
1144
|
+
export function getTechgovLessonStuckMsV2() {
|
|
1145
|
+
return _techgovStuckMs;
|
|
1146
|
+
}
|
|
1147
|
+
export function _resetStateTechLearningEngineGovV2() {
|
|
1148
|
+
_techgovPsV2.clear();
|
|
1149
|
+
_techgovJsV2.clear();
|
|
1150
|
+
_techgovMaxActive = 6;
|
|
1151
|
+
_techgovMaxPending = 12;
|
|
1152
|
+
_techgovIdleMs = 30 * 24 * 60 * 60 * 1000;
|
|
1153
|
+
_techgovStuckMs = 60 * 1000;
|
|
1154
|
+
}
|
|
1155
|
+
export function registerTechgovProfileV2({ id, owner, topic, metadata } = {}) {
|
|
1156
|
+
if (!id || !owner) throw new Error("id and owner required");
|
|
1157
|
+
if (_techgovPsV2.has(id))
|
|
1158
|
+
throw new Error(`techgov profile ${id} already exists`);
|
|
1159
|
+
const now = Date.now();
|
|
1160
|
+
const p = {
|
|
1161
|
+
id,
|
|
1162
|
+
owner,
|
|
1163
|
+
topic: topic || "general",
|
|
1164
|
+
status: TECHGOV_PROFILE_MATURITY_V2.PENDING,
|
|
1165
|
+
createdAt: now,
|
|
1166
|
+
updatedAt: now,
|
|
1167
|
+
lastTouchedAt: now,
|
|
1168
|
+
activatedAt: null,
|
|
1169
|
+
archivedAt: null,
|
|
1170
|
+
metadata: { ...(metadata || {}) },
|
|
1171
|
+
};
|
|
1172
|
+
_techgovPsV2.set(id, p);
|
|
1173
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1174
|
+
}
|
|
1175
|
+
export function activateTechgovProfileV2(id) {
|
|
1176
|
+
const p = _techgovPsV2.get(id);
|
|
1177
|
+
if (!p) throw new Error(`techgov profile ${id} not found`);
|
|
1178
|
+
const isInitial = p.status === TECHGOV_PROFILE_MATURITY_V2.PENDING;
|
|
1179
|
+
_techgovCheckP(p.status, TECHGOV_PROFILE_MATURITY_V2.ACTIVE);
|
|
1180
|
+
if (isInitial && _techgovCountActive(p.owner) >= _techgovMaxActive)
|
|
1181
|
+
throw new Error(`max active techgov profiles for owner ${p.owner} reached`);
|
|
1182
|
+
const now = Date.now();
|
|
1183
|
+
p.status = TECHGOV_PROFILE_MATURITY_V2.ACTIVE;
|
|
1184
|
+
p.updatedAt = now;
|
|
1185
|
+
p.lastTouchedAt = now;
|
|
1186
|
+
if (!p.activatedAt) p.activatedAt = now;
|
|
1187
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1188
|
+
}
|
|
1189
|
+
export function staleTechgovProfileV2(id) {
|
|
1190
|
+
const p = _techgovPsV2.get(id);
|
|
1191
|
+
if (!p) throw new Error(`techgov profile ${id} not found`);
|
|
1192
|
+
_techgovCheckP(p.status, TECHGOV_PROFILE_MATURITY_V2.STALE);
|
|
1193
|
+
p.status = TECHGOV_PROFILE_MATURITY_V2.STALE;
|
|
1194
|
+
p.updatedAt = Date.now();
|
|
1195
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1196
|
+
}
|
|
1197
|
+
export function archiveTechgovProfileV2(id) {
|
|
1198
|
+
const p = _techgovPsV2.get(id);
|
|
1199
|
+
if (!p) throw new Error(`techgov profile ${id} not found`);
|
|
1200
|
+
_techgovCheckP(p.status, TECHGOV_PROFILE_MATURITY_V2.ARCHIVED);
|
|
1201
|
+
const now = Date.now();
|
|
1202
|
+
p.status = TECHGOV_PROFILE_MATURITY_V2.ARCHIVED;
|
|
1203
|
+
p.updatedAt = now;
|
|
1204
|
+
if (!p.archivedAt) p.archivedAt = now;
|
|
1205
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1206
|
+
}
|
|
1207
|
+
export function touchTechgovProfileV2(id) {
|
|
1208
|
+
const p = _techgovPsV2.get(id);
|
|
1209
|
+
if (!p) throw new Error(`techgov profile ${id} not found`);
|
|
1210
|
+
if (_techgovPTerminal.has(p.status))
|
|
1211
|
+
throw new Error(`cannot touch terminal techgov profile ${id}`);
|
|
1212
|
+
const now = Date.now();
|
|
1213
|
+
p.lastTouchedAt = now;
|
|
1214
|
+
p.updatedAt = now;
|
|
1215
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1216
|
+
}
|
|
1217
|
+
export function getTechgovProfileV2(id) {
|
|
1218
|
+
const p = _techgovPsV2.get(id);
|
|
1219
|
+
if (!p) return null;
|
|
1220
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1221
|
+
}
|
|
1222
|
+
export function listTechgovProfilesV2() {
|
|
1223
|
+
return [..._techgovPsV2.values()].map((p) => ({
|
|
1224
|
+
...p,
|
|
1225
|
+
metadata: { ...p.metadata },
|
|
1226
|
+
}));
|
|
1227
|
+
}
|
|
1228
|
+
export function createTechgovLessonV2({
|
|
1229
|
+
id,
|
|
1230
|
+
profileId,
|
|
1231
|
+
source,
|
|
1232
|
+
metadata,
|
|
1233
|
+
} = {}) {
|
|
1234
|
+
if (!id || !profileId) throw new Error("id and profileId required");
|
|
1235
|
+
if (_techgovJsV2.has(id))
|
|
1236
|
+
throw new Error(`techgov lesson ${id} already exists`);
|
|
1237
|
+
if (!_techgovPsV2.has(profileId))
|
|
1238
|
+
throw new Error(`techgov profile ${profileId} not found`);
|
|
1239
|
+
if (_techgovCountPending(profileId) >= _techgovMaxPending)
|
|
1240
|
+
throw new Error(
|
|
1241
|
+
`max pending techgov lessons for profile ${profileId} reached`,
|
|
1242
|
+
);
|
|
1243
|
+
const now = Date.now();
|
|
1244
|
+
const j = {
|
|
1245
|
+
id,
|
|
1246
|
+
profileId,
|
|
1247
|
+
source: source || "",
|
|
1248
|
+
status: TECHGOV_LESSON_LIFECYCLE_V2.QUEUED,
|
|
1249
|
+
createdAt: now,
|
|
1250
|
+
updatedAt: now,
|
|
1251
|
+
startedAt: null,
|
|
1252
|
+
settledAt: null,
|
|
1253
|
+
metadata: { ...(metadata || {}) },
|
|
1254
|
+
};
|
|
1255
|
+
_techgovJsV2.set(id, j);
|
|
1256
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1257
|
+
}
|
|
1258
|
+
export function studyingTechgovLessonV2(id) {
|
|
1259
|
+
const j = _techgovJsV2.get(id);
|
|
1260
|
+
if (!j) throw new Error(`techgov lesson ${id} not found`);
|
|
1261
|
+
_techgovCheckJ(j.status, TECHGOV_LESSON_LIFECYCLE_V2.STUDYING);
|
|
1262
|
+
const now = Date.now();
|
|
1263
|
+
j.status = TECHGOV_LESSON_LIFECYCLE_V2.STUDYING;
|
|
1264
|
+
j.updatedAt = now;
|
|
1265
|
+
if (!j.startedAt) j.startedAt = now;
|
|
1266
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1267
|
+
}
|
|
1268
|
+
export function completeLessonTechgovV2(id) {
|
|
1269
|
+
const j = _techgovJsV2.get(id);
|
|
1270
|
+
if (!j) throw new Error(`techgov lesson ${id} not found`);
|
|
1271
|
+
_techgovCheckJ(j.status, TECHGOV_LESSON_LIFECYCLE_V2.STUDIED);
|
|
1272
|
+
const now = Date.now();
|
|
1273
|
+
j.status = TECHGOV_LESSON_LIFECYCLE_V2.STUDIED;
|
|
1274
|
+
j.updatedAt = now;
|
|
1275
|
+
if (!j.settledAt) j.settledAt = now;
|
|
1276
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1277
|
+
}
|
|
1278
|
+
export function failTechgovLessonV2(id, reason) {
|
|
1279
|
+
const j = _techgovJsV2.get(id);
|
|
1280
|
+
if (!j) throw new Error(`techgov lesson ${id} not found`);
|
|
1281
|
+
_techgovCheckJ(j.status, TECHGOV_LESSON_LIFECYCLE_V2.FAILED);
|
|
1282
|
+
const now = Date.now();
|
|
1283
|
+
j.status = TECHGOV_LESSON_LIFECYCLE_V2.FAILED;
|
|
1284
|
+
j.updatedAt = now;
|
|
1285
|
+
if (!j.settledAt) j.settledAt = now;
|
|
1286
|
+
if (reason) j.metadata.failReason = String(reason);
|
|
1287
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1288
|
+
}
|
|
1289
|
+
export function cancelTechgovLessonV2(id, reason) {
|
|
1290
|
+
const j = _techgovJsV2.get(id);
|
|
1291
|
+
if (!j) throw new Error(`techgov lesson ${id} not found`);
|
|
1292
|
+
_techgovCheckJ(j.status, TECHGOV_LESSON_LIFECYCLE_V2.CANCELLED);
|
|
1293
|
+
const now = Date.now();
|
|
1294
|
+
j.status = TECHGOV_LESSON_LIFECYCLE_V2.CANCELLED;
|
|
1295
|
+
j.updatedAt = now;
|
|
1296
|
+
if (!j.settledAt) j.settledAt = now;
|
|
1297
|
+
if (reason) j.metadata.cancelReason = String(reason);
|
|
1298
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1299
|
+
}
|
|
1300
|
+
export function getTechgovLessonV2(id) {
|
|
1301
|
+
const j = _techgovJsV2.get(id);
|
|
1302
|
+
if (!j) return null;
|
|
1303
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1304
|
+
}
|
|
1305
|
+
export function listTechgovLessonsV2() {
|
|
1306
|
+
return [..._techgovJsV2.values()].map((j) => ({
|
|
1307
|
+
...j,
|
|
1308
|
+
metadata: { ...j.metadata },
|
|
1309
|
+
}));
|
|
1310
|
+
}
|
|
1311
|
+
export function autoStaleIdleTechgovProfilesV2({ now } = {}) {
|
|
1312
|
+
const t = now ?? Date.now();
|
|
1313
|
+
const flipped = [];
|
|
1314
|
+
for (const p of _techgovPsV2.values())
|
|
1315
|
+
if (
|
|
1316
|
+
p.status === TECHGOV_PROFILE_MATURITY_V2.ACTIVE &&
|
|
1317
|
+
t - p.lastTouchedAt >= _techgovIdleMs
|
|
1318
|
+
) {
|
|
1319
|
+
p.status = TECHGOV_PROFILE_MATURITY_V2.STALE;
|
|
1320
|
+
p.updatedAt = t;
|
|
1321
|
+
flipped.push(p.id);
|
|
1322
|
+
}
|
|
1323
|
+
return { flipped, count: flipped.length };
|
|
1324
|
+
}
|
|
1325
|
+
export function autoFailStuckTechgovLessonsV2({ now } = {}) {
|
|
1326
|
+
const t = now ?? Date.now();
|
|
1327
|
+
const flipped = [];
|
|
1328
|
+
for (const j of _techgovJsV2.values())
|
|
1329
|
+
if (
|
|
1330
|
+
j.status === TECHGOV_LESSON_LIFECYCLE_V2.STUDYING &&
|
|
1331
|
+
j.startedAt != null &&
|
|
1332
|
+
t - j.startedAt >= _techgovStuckMs
|
|
1333
|
+
) {
|
|
1334
|
+
j.status = TECHGOV_LESSON_LIFECYCLE_V2.FAILED;
|
|
1335
|
+
j.updatedAt = t;
|
|
1336
|
+
if (!j.settledAt) j.settledAt = t;
|
|
1337
|
+
j.metadata.failReason = "auto-fail-stuck";
|
|
1338
|
+
flipped.push(j.id);
|
|
1339
|
+
}
|
|
1340
|
+
return { flipped, count: flipped.length };
|
|
1341
|
+
}
|
|
1342
|
+
export function getTechLearningEngineGovStatsV2() {
|
|
1343
|
+
const profilesByStatus = {};
|
|
1344
|
+
for (const v of Object.values(TECHGOV_PROFILE_MATURITY_V2))
|
|
1345
|
+
profilesByStatus[v] = 0;
|
|
1346
|
+
for (const p of _techgovPsV2.values()) profilesByStatus[p.status]++;
|
|
1347
|
+
const lessonsByStatus = {};
|
|
1348
|
+
for (const v of Object.values(TECHGOV_LESSON_LIFECYCLE_V2))
|
|
1349
|
+
lessonsByStatus[v] = 0;
|
|
1350
|
+
for (const j of _techgovJsV2.values()) lessonsByStatus[j.status]++;
|
|
1351
|
+
return {
|
|
1352
|
+
totalTechgovProfilesV2: _techgovPsV2.size,
|
|
1353
|
+
totalTechgovLessonsV2: _techgovJsV2.size,
|
|
1354
|
+
maxActiveTechgovProfilesPerOwner: _techgovMaxActive,
|
|
1355
|
+
maxPendingTechgovLessonsPerProfile: _techgovMaxPending,
|
|
1356
|
+
techgovProfileIdleMs: _techgovIdleMs,
|
|
1357
|
+
techgovLessonStuckMs: _techgovStuckMs,
|
|
1358
|
+
profilesByStatus,
|
|
1359
|
+
lessonsByStatus,
|
|
1360
|
+
};
|
|
1361
|
+
}
|