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/ueba.js
CHANGED
|
@@ -790,3 +790,343 @@ export function _resetStateUebaV2() {
|
|
|
790
790
|
_uebaBaselineStaleMs = UEBA_DEFAULT_BASELINE_STALE_MS;
|
|
791
791
|
_uebaInvestigationStuckMs = UEBA_DEFAULT_INVESTIGATION_STUCK_MS;
|
|
792
792
|
}
|
|
793
|
+
|
|
794
|
+
// =====================================================================
|
|
795
|
+
// ueba V2 governance overlay (iter24)
|
|
796
|
+
// =====================================================================
|
|
797
|
+
export const UEBGOV_PROFILE_MATURITY_V2 = Object.freeze({
|
|
798
|
+
PENDING: "pending",
|
|
799
|
+
ACTIVE: "active",
|
|
800
|
+
SUPPRESSED: "suppressed",
|
|
801
|
+
ARCHIVED: "archived",
|
|
802
|
+
});
|
|
803
|
+
export const UEBGOV_ALERT_LIFECYCLE_V2 = Object.freeze({
|
|
804
|
+
QUEUED: "queued",
|
|
805
|
+
ANALYZING: "analyzing",
|
|
806
|
+
TRIAGED: "triaged",
|
|
807
|
+
FAILED: "failed",
|
|
808
|
+
CANCELLED: "cancelled",
|
|
809
|
+
});
|
|
810
|
+
const _uebgovPTrans = new Map([
|
|
811
|
+
[
|
|
812
|
+
UEBGOV_PROFILE_MATURITY_V2.PENDING,
|
|
813
|
+
new Set([
|
|
814
|
+
UEBGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
815
|
+
UEBGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
816
|
+
]),
|
|
817
|
+
],
|
|
818
|
+
[
|
|
819
|
+
UEBGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
820
|
+
new Set([
|
|
821
|
+
UEBGOV_PROFILE_MATURITY_V2.SUPPRESSED,
|
|
822
|
+
UEBGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
823
|
+
]),
|
|
824
|
+
],
|
|
825
|
+
[
|
|
826
|
+
UEBGOV_PROFILE_MATURITY_V2.SUPPRESSED,
|
|
827
|
+
new Set([
|
|
828
|
+
UEBGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
829
|
+
UEBGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
830
|
+
]),
|
|
831
|
+
],
|
|
832
|
+
[UEBGOV_PROFILE_MATURITY_V2.ARCHIVED, new Set()],
|
|
833
|
+
]);
|
|
834
|
+
const _uebgovPTerminal = new Set([UEBGOV_PROFILE_MATURITY_V2.ARCHIVED]);
|
|
835
|
+
const _uebgovJTrans = new Map([
|
|
836
|
+
[
|
|
837
|
+
UEBGOV_ALERT_LIFECYCLE_V2.QUEUED,
|
|
838
|
+
new Set([
|
|
839
|
+
UEBGOV_ALERT_LIFECYCLE_V2.ANALYZING,
|
|
840
|
+
UEBGOV_ALERT_LIFECYCLE_V2.CANCELLED,
|
|
841
|
+
]),
|
|
842
|
+
],
|
|
843
|
+
[
|
|
844
|
+
UEBGOV_ALERT_LIFECYCLE_V2.ANALYZING,
|
|
845
|
+
new Set([
|
|
846
|
+
UEBGOV_ALERT_LIFECYCLE_V2.TRIAGED,
|
|
847
|
+
UEBGOV_ALERT_LIFECYCLE_V2.FAILED,
|
|
848
|
+
UEBGOV_ALERT_LIFECYCLE_V2.CANCELLED,
|
|
849
|
+
]),
|
|
850
|
+
],
|
|
851
|
+
[UEBGOV_ALERT_LIFECYCLE_V2.TRIAGED, new Set()],
|
|
852
|
+
[UEBGOV_ALERT_LIFECYCLE_V2.FAILED, new Set()],
|
|
853
|
+
[UEBGOV_ALERT_LIFECYCLE_V2.CANCELLED, new Set()],
|
|
854
|
+
]);
|
|
855
|
+
const _uebgovPsV2 = new Map();
|
|
856
|
+
const _uebgovJsV2 = new Map();
|
|
857
|
+
let _uebgovMaxActive = 8,
|
|
858
|
+
_uebgovMaxPending = 20,
|
|
859
|
+
_uebgovIdleMs = 30 * 24 * 60 * 60 * 1000,
|
|
860
|
+
_uebgovStuckMs = 60 * 1000;
|
|
861
|
+
function _uebgovPos(n, label) {
|
|
862
|
+
const v = Math.floor(Number(n));
|
|
863
|
+
if (!Number.isFinite(v) || v <= 0)
|
|
864
|
+
throw new Error(`${label} must be positive integer`);
|
|
865
|
+
return v;
|
|
866
|
+
}
|
|
867
|
+
function _uebgovCheckP(from, to) {
|
|
868
|
+
const a = _uebgovPTrans.get(from);
|
|
869
|
+
if (!a || !a.has(to))
|
|
870
|
+
throw new Error(`invalid uebgov profile transition ${from} → ${to}`);
|
|
871
|
+
}
|
|
872
|
+
function _uebgovCheckJ(from, to) {
|
|
873
|
+
const a = _uebgovJTrans.get(from);
|
|
874
|
+
if (!a || !a.has(to))
|
|
875
|
+
throw new Error(`invalid uebgov alert transition ${from} → ${to}`);
|
|
876
|
+
}
|
|
877
|
+
function _uebgovCountActive(owner) {
|
|
878
|
+
let c = 0;
|
|
879
|
+
for (const p of _uebgovPsV2.values())
|
|
880
|
+
if (p.owner === owner && p.status === UEBGOV_PROFILE_MATURITY_V2.ACTIVE)
|
|
881
|
+
c++;
|
|
882
|
+
return c;
|
|
883
|
+
}
|
|
884
|
+
function _uebgovCountPending(profileId) {
|
|
885
|
+
let c = 0;
|
|
886
|
+
for (const j of _uebgovJsV2.values())
|
|
887
|
+
if (
|
|
888
|
+
j.profileId === profileId &&
|
|
889
|
+
(j.status === UEBGOV_ALERT_LIFECYCLE_V2.QUEUED ||
|
|
890
|
+
j.status === UEBGOV_ALERT_LIFECYCLE_V2.ANALYZING)
|
|
891
|
+
)
|
|
892
|
+
c++;
|
|
893
|
+
return c;
|
|
894
|
+
}
|
|
895
|
+
export function setMaxActiveUebgovProfilesPerOwnerV2(n) {
|
|
896
|
+
_uebgovMaxActive = _uebgovPos(n, "maxActiveUebgovProfilesPerOwner");
|
|
897
|
+
}
|
|
898
|
+
export function getMaxActiveUebgovProfilesPerOwnerV2() {
|
|
899
|
+
return _uebgovMaxActive;
|
|
900
|
+
}
|
|
901
|
+
export function setMaxPendingUebgovAlertsPerProfileV2(n) {
|
|
902
|
+
_uebgovMaxPending = _uebgovPos(n, "maxPendingUebgovAlertsPerProfile");
|
|
903
|
+
}
|
|
904
|
+
export function getMaxPendingUebgovAlertsPerProfileV2() {
|
|
905
|
+
return _uebgovMaxPending;
|
|
906
|
+
}
|
|
907
|
+
export function setUebgovProfileIdleMsV2(n) {
|
|
908
|
+
_uebgovIdleMs = _uebgovPos(n, "uebgovProfileIdleMs");
|
|
909
|
+
}
|
|
910
|
+
export function getUebgovProfileIdleMsV2() {
|
|
911
|
+
return _uebgovIdleMs;
|
|
912
|
+
}
|
|
913
|
+
export function setUebgovAlertStuckMsV2(n) {
|
|
914
|
+
_uebgovStuckMs = _uebgovPos(n, "uebgovAlertStuckMs");
|
|
915
|
+
}
|
|
916
|
+
export function getUebgovAlertStuckMsV2() {
|
|
917
|
+
return _uebgovStuckMs;
|
|
918
|
+
}
|
|
919
|
+
export function _resetStateUebaGovV2() {
|
|
920
|
+
_uebgovPsV2.clear();
|
|
921
|
+
_uebgovJsV2.clear();
|
|
922
|
+
_uebgovMaxActive = 8;
|
|
923
|
+
_uebgovMaxPending = 20;
|
|
924
|
+
_uebgovIdleMs = 30 * 24 * 60 * 60 * 1000;
|
|
925
|
+
_uebgovStuckMs = 60 * 1000;
|
|
926
|
+
}
|
|
927
|
+
export function registerUebgovProfileV2({ id, owner, entity, metadata } = {}) {
|
|
928
|
+
if (!id || !owner) throw new Error("id and owner required");
|
|
929
|
+
if (_uebgovPsV2.has(id))
|
|
930
|
+
throw new Error(`uebgov profile ${id} already exists`);
|
|
931
|
+
const now = Date.now();
|
|
932
|
+
const p = {
|
|
933
|
+
id,
|
|
934
|
+
owner,
|
|
935
|
+
entity: entity || "user",
|
|
936
|
+
status: UEBGOV_PROFILE_MATURITY_V2.PENDING,
|
|
937
|
+
createdAt: now,
|
|
938
|
+
updatedAt: now,
|
|
939
|
+
lastTouchedAt: now,
|
|
940
|
+
activatedAt: null,
|
|
941
|
+
archivedAt: null,
|
|
942
|
+
metadata: { ...(metadata || {}) },
|
|
943
|
+
};
|
|
944
|
+
_uebgovPsV2.set(id, p);
|
|
945
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
946
|
+
}
|
|
947
|
+
export function activateUebgovProfileV2(id) {
|
|
948
|
+
const p = _uebgovPsV2.get(id);
|
|
949
|
+
if (!p) throw new Error(`uebgov profile ${id} not found`);
|
|
950
|
+
const isInitial = p.status === UEBGOV_PROFILE_MATURITY_V2.PENDING;
|
|
951
|
+
_uebgovCheckP(p.status, UEBGOV_PROFILE_MATURITY_V2.ACTIVE);
|
|
952
|
+
if (isInitial && _uebgovCountActive(p.owner) >= _uebgovMaxActive)
|
|
953
|
+
throw new Error(`max active uebgov profiles for owner ${p.owner} reached`);
|
|
954
|
+
const now = Date.now();
|
|
955
|
+
p.status = UEBGOV_PROFILE_MATURITY_V2.ACTIVE;
|
|
956
|
+
p.updatedAt = now;
|
|
957
|
+
p.lastTouchedAt = now;
|
|
958
|
+
if (!p.activatedAt) p.activatedAt = now;
|
|
959
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
960
|
+
}
|
|
961
|
+
export function suppressUebgovProfileV2(id) {
|
|
962
|
+
const p = _uebgovPsV2.get(id);
|
|
963
|
+
if (!p) throw new Error(`uebgov profile ${id} not found`);
|
|
964
|
+
_uebgovCheckP(p.status, UEBGOV_PROFILE_MATURITY_V2.SUPPRESSED);
|
|
965
|
+
p.status = UEBGOV_PROFILE_MATURITY_V2.SUPPRESSED;
|
|
966
|
+
p.updatedAt = Date.now();
|
|
967
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
968
|
+
}
|
|
969
|
+
export function archiveUebgovProfileV2(id) {
|
|
970
|
+
const p = _uebgovPsV2.get(id);
|
|
971
|
+
if (!p) throw new Error(`uebgov profile ${id} not found`);
|
|
972
|
+
_uebgovCheckP(p.status, UEBGOV_PROFILE_MATURITY_V2.ARCHIVED);
|
|
973
|
+
const now = Date.now();
|
|
974
|
+
p.status = UEBGOV_PROFILE_MATURITY_V2.ARCHIVED;
|
|
975
|
+
p.updatedAt = now;
|
|
976
|
+
if (!p.archivedAt) p.archivedAt = now;
|
|
977
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
978
|
+
}
|
|
979
|
+
export function touchUebgovProfileV2(id) {
|
|
980
|
+
const p = _uebgovPsV2.get(id);
|
|
981
|
+
if (!p) throw new Error(`uebgov profile ${id} not found`);
|
|
982
|
+
if (_uebgovPTerminal.has(p.status))
|
|
983
|
+
throw new Error(`cannot touch terminal uebgov profile ${id}`);
|
|
984
|
+
const now = Date.now();
|
|
985
|
+
p.lastTouchedAt = now;
|
|
986
|
+
p.updatedAt = now;
|
|
987
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
988
|
+
}
|
|
989
|
+
export function getUebgovProfileV2(id) {
|
|
990
|
+
const p = _uebgovPsV2.get(id);
|
|
991
|
+
if (!p) return null;
|
|
992
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
993
|
+
}
|
|
994
|
+
export function listUebgovProfilesV2() {
|
|
995
|
+
return [..._uebgovPsV2.values()].map((p) => ({
|
|
996
|
+
...p,
|
|
997
|
+
metadata: { ...p.metadata },
|
|
998
|
+
}));
|
|
999
|
+
}
|
|
1000
|
+
export function createUebgovAlertV2({
|
|
1001
|
+
id,
|
|
1002
|
+
profileId,
|
|
1003
|
+
behavior,
|
|
1004
|
+
metadata,
|
|
1005
|
+
} = {}) {
|
|
1006
|
+
if (!id || !profileId) throw new Error("id and profileId required");
|
|
1007
|
+
if (_uebgovJsV2.has(id)) throw new Error(`uebgov alert ${id} already exists`);
|
|
1008
|
+
if (!_uebgovPsV2.has(profileId))
|
|
1009
|
+
throw new Error(`uebgov profile ${profileId} not found`);
|
|
1010
|
+
if (_uebgovCountPending(profileId) >= _uebgovMaxPending)
|
|
1011
|
+
throw new Error(
|
|
1012
|
+
`max pending uebgov alerts for profile ${profileId} reached`,
|
|
1013
|
+
);
|
|
1014
|
+
const now = Date.now();
|
|
1015
|
+
const j = {
|
|
1016
|
+
id,
|
|
1017
|
+
profileId,
|
|
1018
|
+
behavior: behavior || "",
|
|
1019
|
+
status: UEBGOV_ALERT_LIFECYCLE_V2.QUEUED,
|
|
1020
|
+
createdAt: now,
|
|
1021
|
+
updatedAt: now,
|
|
1022
|
+
startedAt: null,
|
|
1023
|
+
settledAt: null,
|
|
1024
|
+
metadata: { ...(metadata || {}) },
|
|
1025
|
+
};
|
|
1026
|
+
_uebgovJsV2.set(id, j);
|
|
1027
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1028
|
+
}
|
|
1029
|
+
export function analyzingUebgovAlertV2(id) {
|
|
1030
|
+
const j = _uebgovJsV2.get(id);
|
|
1031
|
+
if (!j) throw new Error(`uebgov alert ${id} not found`);
|
|
1032
|
+
_uebgovCheckJ(j.status, UEBGOV_ALERT_LIFECYCLE_V2.ANALYZING);
|
|
1033
|
+
const now = Date.now();
|
|
1034
|
+
j.status = UEBGOV_ALERT_LIFECYCLE_V2.ANALYZING;
|
|
1035
|
+
j.updatedAt = now;
|
|
1036
|
+
if (!j.startedAt) j.startedAt = now;
|
|
1037
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1038
|
+
}
|
|
1039
|
+
export function completeAlertUebgovV2(id) {
|
|
1040
|
+
const j = _uebgovJsV2.get(id);
|
|
1041
|
+
if (!j) throw new Error(`uebgov alert ${id} not found`);
|
|
1042
|
+
_uebgovCheckJ(j.status, UEBGOV_ALERT_LIFECYCLE_V2.TRIAGED);
|
|
1043
|
+
const now = Date.now();
|
|
1044
|
+
j.status = UEBGOV_ALERT_LIFECYCLE_V2.TRIAGED;
|
|
1045
|
+
j.updatedAt = now;
|
|
1046
|
+
if (!j.settledAt) j.settledAt = now;
|
|
1047
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1048
|
+
}
|
|
1049
|
+
export function failUebgovAlertV2(id, reason) {
|
|
1050
|
+
const j = _uebgovJsV2.get(id);
|
|
1051
|
+
if (!j) throw new Error(`uebgov alert ${id} not found`);
|
|
1052
|
+
_uebgovCheckJ(j.status, UEBGOV_ALERT_LIFECYCLE_V2.FAILED);
|
|
1053
|
+
const now = Date.now();
|
|
1054
|
+
j.status = UEBGOV_ALERT_LIFECYCLE_V2.FAILED;
|
|
1055
|
+
j.updatedAt = now;
|
|
1056
|
+
if (!j.settledAt) j.settledAt = now;
|
|
1057
|
+
if (reason) j.metadata.failReason = String(reason);
|
|
1058
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1059
|
+
}
|
|
1060
|
+
export function cancelUebgovAlertV2(id, reason) {
|
|
1061
|
+
const j = _uebgovJsV2.get(id);
|
|
1062
|
+
if (!j) throw new Error(`uebgov alert ${id} not found`);
|
|
1063
|
+
_uebgovCheckJ(j.status, UEBGOV_ALERT_LIFECYCLE_V2.CANCELLED);
|
|
1064
|
+
const now = Date.now();
|
|
1065
|
+
j.status = UEBGOV_ALERT_LIFECYCLE_V2.CANCELLED;
|
|
1066
|
+
j.updatedAt = now;
|
|
1067
|
+
if (!j.settledAt) j.settledAt = now;
|
|
1068
|
+
if (reason) j.metadata.cancelReason = String(reason);
|
|
1069
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1070
|
+
}
|
|
1071
|
+
export function getUebgovAlertV2(id) {
|
|
1072
|
+
const j = _uebgovJsV2.get(id);
|
|
1073
|
+
if (!j) return null;
|
|
1074
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1075
|
+
}
|
|
1076
|
+
export function listUebgovAlertsV2() {
|
|
1077
|
+
return [..._uebgovJsV2.values()].map((j) => ({
|
|
1078
|
+
...j,
|
|
1079
|
+
metadata: { ...j.metadata },
|
|
1080
|
+
}));
|
|
1081
|
+
}
|
|
1082
|
+
export function autoSuppressIdleUebgovProfilesV2({ now } = {}) {
|
|
1083
|
+
const t = now ?? Date.now();
|
|
1084
|
+
const flipped = [];
|
|
1085
|
+
for (const p of _uebgovPsV2.values())
|
|
1086
|
+
if (
|
|
1087
|
+
p.status === UEBGOV_PROFILE_MATURITY_V2.ACTIVE &&
|
|
1088
|
+
t - p.lastTouchedAt >= _uebgovIdleMs
|
|
1089
|
+
) {
|
|
1090
|
+
p.status = UEBGOV_PROFILE_MATURITY_V2.SUPPRESSED;
|
|
1091
|
+
p.updatedAt = t;
|
|
1092
|
+
flipped.push(p.id);
|
|
1093
|
+
}
|
|
1094
|
+
return { flipped, count: flipped.length };
|
|
1095
|
+
}
|
|
1096
|
+
export function autoFailStuckUebgovAlertsV2({ now } = {}) {
|
|
1097
|
+
const t = now ?? Date.now();
|
|
1098
|
+
const flipped = [];
|
|
1099
|
+
for (const j of _uebgovJsV2.values())
|
|
1100
|
+
if (
|
|
1101
|
+
j.status === UEBGOV_ALERT_LIFECYCLE_V2.ANALYZING &&
|
|
1102
|
+
j.startedAt != null &&
|
|
1103
|
+
t - j.startedAt >= _uebgovStuckMs
|
|
1104
|
+
) {
|
|
1105
|
+
j.status = UEBGOV_ALERT_LIFECYCLE_V2.FAILED;
|
|
1106
|
+
j.updatedAt = t;
|
|
1107
|
+
if (!j.settledAt) j.settledAt = t;
|
|
1108
|
+
j.metadata.failReason = "auto-fail-stuck";
|
|
1109
|
+
flipped.push(j.id);
|
|
1110
|
+
}
|
|
1111
|
+
return { flipped, count: flipped.length };
|
|
1112
|
+
}
|
|
1113
|
+
export function getUebaGovStatsV2() {
|
|
1114
|
+
const profilesByStatus = {};
|
|
1115
|
+
for (const v of Object.values(UEBGOV_PROFILE_MATURITY_V2))
|
|
1116
|
+
profilesByStatus[v] = 0;
|
|
1117
|
+
for (const p of _uebgovPsV2.values()) profilesByStatus[p.status]++;
|
|
1118
|
+
const alertsByStatus = {};
|
|
1119
|
+
for (const v of Object.values(UEBGOV_ALERT_LIFECYCLE_V2))
|
|
1120
|
+
alertsByStatus[v] = 0;
|
|
1121
|
+
for (const j of _uebgovJsV2.values()) alertsByStatus[j.status]++;
|
|
1122
|
+
return {
|
|
1123
|
+
totalUebgovProfilesV2: _uebgovPsV2.size,
|
|
1124
|
+
totalUebgovAlertsV2: _uebgovJsV2.size,
|
|
1125
|
+
maxActiveUebgovProfilesPerOwner: _uebgovMaxActive,
|
|
1126
|
+
maxPendingUebgovAlertsPerProfile: _uebgovMaxPending,
|
|
1127
|
+
uebgovProfileIdleMs: _uebgovIdleMs,
|
|
1128
|
+
uebgovAlertStuckMs: _uebgovStuckMs,
|
|
1129
|
+
profilesByStatus,
|
|
1130
|
+
alertsByStatus,
|
|
1131
|
+
};
|
|
1132
|
+
}
|
|
@@ -1094,3 +1094,333 @@ export function _resetStateV2() {
|
|
|
1094
1094
|
_pluginsV2.clear();
|
|
1095
1095
|
_runtimeTasksV2.clear();
|
|
1096
1096
|
}
|
|
1097
|
+
|
|
1098
|
+
// =====================================================================
|
|
1099
|
+
// universal-runtime V2 governance overlay (iter23)
|
|
1100
|
+
// =====================================================================
|
|
1101
|
+
export const RTGOV_PROFILE_MATURITY_V2 = Object.freeze({
|
|
1102
|
+
PENDING: "pending",
|
|
1103
|
+
ACTIVE: "active",
|
|
1104
|
+
DEGRADED: "degraded",
|
|
1105
|
+
ARCHIVED: "archived",
|
|
1106
|
+
});
|
|
1107
|
+
export const RTGOV_TASK_LIFECYCLE_V2 = Object.freeze({
|
|
1108
|
+
QUEUED: "queued",
|
|
1109
|
+
EXECUTING: "executing",
|
|
1110
|
+
EXECUTED: "executed",
|
|
1111
|
+
FAILED: "failed",
|
|
1112
|
+
CANCELLED: "cancelled",
|
|
1113
|
+
});
|
|
1114
|
+
const _rtgovPTrans = new Map([
|
|
1115
|
+
[
|
|
1116
|
+
RTGOV_PROFILE_MATURITY_V2.PENDING,
|
|
1117
|
+
new Set([
|
|
1118
|
+
RTGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
1119
|
+
RTGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
1120
|
+
]),
|
|
1121
|
+
],
|
|
1122
|
+
[
|
|
1123
|
+
RTGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
1124
|
+
new Set([
|
|
1125
|
+
RTGOV_PROFILE_MATURITY_V2.DEGRADED,
|
|
1126
|
+
RTGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
1127
|
+
]),
|
|
1128
|
+
],
|
|
1129
|
+
[
|
|
1130
|
+
RTGOV_PROFILE_MATURITY_V2.DEGRADED,
|
|
1131
|
+
new Set([
|
|
1132
|
+
RTGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
1133
|
+
RTGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
1134
|
+
]),
|
|
1135
|
+
],
|
|
1136
|
+
[RTGOV_PROFILE_MATURITY_V2.ARCHIVED, new Set()],
|
|
1137
|
+
]);
|
|
1138
|
+
const _rtgovPTerminal = new Set([RTGOV_PROFILE_MATURITY_V2.ARCHIVED]);
|
|
1139
|
+
const _rtgovJTrans = new Map([
|
|
1140
|
+
[
|
|
1141
|
+
RTGOV_TASK_LIFECYCLE_V2.QUEUED,
|
|
1142
|
+
new Set([
|
|
1143
|
+
RTGOV_TASK_LIFECYCLE_V2.EXECUTING,
|
|
1144
|
+
RTGOV_TASK_LIFECYCLE_V2.CANCELLED,
|
|
1145
|
+
]),
|
|
1146
|
+
],
|
|
1147
|
+
[
|
|
1148
|
+
RTGOV_TASK_LIFECYCLE_V2.EXECUTING,
|
|
1149
|
+
new Set([
|
|
1150
|
+
RTGOV_TASK_LIFECYCLE_V2.EXECUTED,
|
|
1151
|
+
RTGOV_TASK_LIFECYCLE_V2.FAILED,
|
|
1152
|
+
RTGOV_TASK_LIFECYCLE_V2.CANCELLED,
|
|
1153
|
+
]),
|
|
1154
|
+
],
|
|
1155
|
+
[RTGOV_TASK_LIFECYCLE_V2.EXECUTED, new Set()],
|
|
1156
|
+
[RTGOV_TASK_LIFECYCLE_V2.FAILED, new Set()],
|
|
1157
|
+
[RTGOV_TASK_LIFECYCLE_V2.CANCELLED, new Set()],
|
|
1158
|
+
]);
|
|
1159
|
+
const _rtgovPsV2 = new Map();
|
|
1160
|
+
const _rtgovJsV2 = new Map();
|
|
1161
|
+
let _rtgovMaxActive = 8,
|
|
1162
|
+
_rtgovMaxPending = 20,
|
|
1163
|
+
_rtgovIdleMs = 30 * 24 * 60 * 60 * 1000,
|
|
1164
|
+
_rtgovStuckMs = 60 * 1000;
|
|
1165
|
+
function _rtgovPos(n, label) {
|
|
1166
|
+
const v = Math.floor(Number(n));
|
|
1167
|
+
if (!Number.isFinite(v) || v <= 0)
|
|
1168
|
+
throw new Error(`${label} must be positive integer`);
|
|
1169
|
+
return v;
|
|
1170
|
+
}
|
|
1171
|
+
function _rtgovCheckP(from, to) {
|
|
1172
|
+
const a = _rtgovPTrans.get(from);
|
|
1173
|
+
if (!a || !a.has(to))
|
|
1174
|
+
throw new Error(`invalid rtgov profile transition ${from} → ${to}`);
|
|
1175
|
+
}
|
|
1176
|
+
function _rtgovCheckJ(from, to) {
|
|
1177
|
+
const a = _rtgovJTrans.get(from);
|
|
1178
|
+
if (!a || !a.has(to))
|
|
1179
|
+
throw new Error(`invalid rtgov task transition ${from} → ${to}`);
|
|
1180
|
+
}
|
|
1181
|
+
function _rtgovCountActive(owner) {
|
|
1182
|
+
let c = 0;
|
|
1183
|
+
for (const p of _rtgovPsV2.values())
|
|
1184
|
+
if (p.owner === owner && p.status === RTGOV_PROFILE_MATURITY_V2.ACTIVE) c++;
|
|
1185
|
+
return c;
|
|
1186
|
+
}
|
|
1187
|
+
function _rtgovCountPending(profileId) {
|
|
1188
|
+
let c = 0;
|
|
1189
|
+
for (const j of _rtgovJsV2.values())
|
|
1190
|
+
if (
|
|
1191
|
+
j.profileId === profileId &&
|
|
1192
|
+
(j.status === RTGOV_TASK_LIFECYCLE_V2.QUEUED ||
|
|
1193
|
+
j.status === RTGOV_TASK_LIFECYCLE_V2.EXECUTING)
|
|
1194
|
+
)
|
|
1195
|
+
c++;
|
|
1196
|
+
return c;
|
|
1197
|
+
}
|
|
1198
|
+
export function setMaxActiveRtgovProfilesPerOwnerV2(n) {
|
|
1199
|
+
_rtgovMaxActive = _rtgovPos(n, "maxActiveRtgovProfilesPerOwner");
|
|
1200
|
+
}
|
|
1201
|
+
export function getMaxActiveRtgovProfilesPerOwnerV2() {
|
|
1202
|
+
return _rtgovMaxActive;
|
|
1203
|
+
}
|
|
1204
|
+
export function setMaxPendingRtgovTasksPerProfileV2(n) {
|
|
1205
|
+
_rtgovMaxPending = _rtgovPos(n, "maxPendingRtgovTasksPerProfile");
|
|
1206
|
+
}
|
|
1207
|
+
export function getMaxPendingRtgovTasksPerProfileV2() {
|
|
1208
|
+
return _rtgovMaxPending;
|
|
1209
|
+
}
|
|
1210
|
+
export function setRtgovProfileIdleMsV2(n) {
|
|
1211
|
+
_rtgovIdleMs = _rtgovPos(n, "rtgovProfileIdleMs");
|
|
1212
|
+
}
|
|
1213
|
+
export function getRtgovProfileIdleMsV2() {
|
|
1214
|
+
return _rtgovIdleMs;
|
|
1215
|
+
}
|
|
1216
|
+
export function setRtgovTaskStuckMsV2(n) {
|
|
1217
|
+
_rtgovStuckMs = _rtgovPos(n, "rtgovTaskStuckMs");
|
|
1218
|
+
}
|
|
1219
|
+
export function getRtgovTaskStuckMsV2() {
|
|
1220
|
+
return _rtgovStuckMs;
|
|
1221
|
+
}
|
|
1222
|
+
export function _resetStateUniversalRuntimeGovV2() {
|
|
1223
|
+
_rtgovPsV2.clear();
|
|
1224
|
+
_rtgovJsV2.clear();
|
|
1225
|
+
_rtgovMaxActive = 8;
|
|
1226
|
+
_rtgovMaxPending = 20;
|
|
1227
|
+
_rtgovIdleMs = 30 * 24 * 60 * 60 * 1000;
|
|
1228
|
+
_rtgovStuckMs = 60 * 1000;
|
|
1229
|
+
}
|
|
1230
|
+
export function registerRtgovProfileV2({ id, owner, runtime, metadata } = {}) {
|
|
1231
|
+
if (!id || !owner) throw new Error("id and owner required");
|
|
1232
|
+
if (_rtgovPsV2.has(id)) throw new Error(`rtgov profile ${id} already exists`);
|
|
1233
|
+
const now = Date.now();
|
|
1234
|
+
const p = {
|
|
1235
|
+
id,
|
|
1236
|
+
owner,
|
|
1237
|
+
runtime: runtime || "node",
|
|
1238
|
+
status: RTGOV_PROFILE_MATURITY_V2.PENDING,
|
|
1239
|
+
createdAt: now,
|
|
1240
|
+
updatedAt: now,
|
|
1241
|
+
lastTouchedAt: now,
|
|
1242
|
+
activatedAt: null,
|
|
1243
|
+
archivedAt: null,
|
|
1244
|
+
metadata: { ...(metadata || {}) },
|
|
1245
|
+
};
|
|
1246
|
+
_rtgovPsV2.set(id, p);
|
|
1247
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1248
|
+
}
|
|
1249
|
+
export function activateRtgovProfileV2(id) {
|
|
1250
|
+
const p = _rtgovPsV2.get(id);
|
|
1251
|
+
if (!p) throw new Error(`rtgov profile ${id} not found`);
|
|
1252
|
+
const isInitial = p.status === RTGOV_PROFILE_MATURITY_V2.PENDING;
|
|
1253
|
+
_rtgovCheckP(p.status, RTGOV_PROFILE_MATURITY_V2.ACTIVE);
|
|
1254
|
+
if (isInitial && _rtgovCountActive(p.owner) >= _rtgovMaxActive)
|
|
1255
|
+
throw new Error(`max active rtgov profiles for owner ${p.owner} reached`);
|
|
1256
|
+
const now = Date.now();
|
|
1257
|
+
p.status = RTGOV_PROFILE_MATURITY_V2.ACTIVE;
|
|
1258
|
+
p.updatedAt = now;
|
|
1259
|
+
p.lastTouchedAt = now;
|
|
1260
|
+
if (!p.activatedAt) p.activatedAt = now;
|
|
1261
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1262
|
+
}
|
|
1263
|
+
export function degradeRtgovProfileV2(id) {
|
|
1264
|
+
const p = _rtgovPsV2.get(id);
|
|
1265
|
+
if (!p) throw new Error(`rtgov profile ${id} not found`);
|
|
1266
|
+
_rtgovCheckP(p.status, RTGOV_PROFILE_MATURITY_V2.DEGRADED);
|
|
1267
|
+
p.status = RTGOV_PROFILE_MATURITY_V2.DEGRADED;
|
|
1268
|
+
p.updatedAt = Date.now();
|
|
1269
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1270
|
+
}
|
|
1271
|
+
export function archiveRtgovProfileV2(id) {
|
|
1272
|
+
const p = _rtgovPsV2.get(id);
|
|
1273
|
+
if (!p) throw new Error(`rtgov profile ${id} not found`);
|
|
1274
|
+
_rtgovCheckP(p.status, RTGOV_PROFILE_MATURITY_V2.ARCHIVED);
|
|
1275
|
+
const now = Date.now();
|
|
1276
|
+
p.status = RTGOV_PROFILE_MATURITY_V2.ARCHIVED;
|
|
1277
|
+
p.updatedAt = now;
|
|
1278
|
+
if (!p.archivedAt) p.archivedAt = now;
|
|
1279
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1280
|
+
}
|
|
1281
|
+
export function touchRtgovProfileV2(id) {
|
|
1282
|
+
const p = _rtgovPsV2.get(id);
|
|
1283
|
+
if (!p) throw new Error(`rtgov profile ${id} not found`);
|
|
1284
|
+
if (_rtgovPTerminal.has(p.status))
|
|
1285
|
+
throw new Error(`cannot touch terminal rtgov profile ${id}`);
|
|
1286
|
+
const now = Date.now();
|
|
1287
|
+
p.lastTouchedAt = now;
|
|
1288
|
+
p.updatedAt = now;
|
|
1289
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1290
|
+
}
|
|
1291
|
+
export function getRtgovProfileV2(id) {
|
|
1292
|
+
const p = _rtgovPsV2.get(id);
|
|
1293
|
+
if (!p) return null;
|
|
1294
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1295
|
+
}
|
|
1296
|
+
export function listRtgovProfilesV2() {
|
|
1297
|
+
return [..._rtgovPsV2.values()].map((p) => ({
|
|
1298
|
+
...p,
|
|
1299
|
+
metadata: { ...p.metadata },
|
|
1300
|
+
}));
|
|
1301
|
+
}
|
|
1302
|
+
export function createRtgovTaskV2({ id, profileId, kind, metadata } = {}) {
|
|
1303
|
+
if (!id || !profileId) throw new Error("id and profileId required");
|
|
1304
|
+
if (_rtgovJsV2.has(id)) throw new Error(`rtgov task ${id} already exists`);
|
|
1305
|
+
if (!_rtgovPsV2.has(profileId))
|
|
1306
|
+
throw new Error(`rtgov profile ${profileId} not found`);
|
|
1307
|
+
if (_rtgovCountPending(profileId) >= _rtgovMaxPending)
|
|
1308
|
+
throw new Error(`max pending rtgov tasks for profile ${profileId} reached`);
|
|
1309
|
+
const now = Date.now();
|
|
1310
|
+
const j = {
|
|
1311
|
+
id,
|
|
1312
|
+
profileId,
|
|
1313
|
+
kind: kind || "",
|
|
1314
|
+
status: RTGOV_TASK_LIFECYCLE_V2.QUEUED,
|
|
1315
|
+
createdAt: now,
|
|
1316
|
+
updatedAt: now,
|
|
1317
|
+
startedAt: null,
|
|
1318
|
+
settledAt: null,
|
|
1319
|
+
metadata: { ...(metadata || {}) },
|
|
1320
|
+
};
|
|
1321
|
+
_rtgovJsV2.set(id, j);
|
|
1322
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1323
|
+
}
|
|
1324
|
+
export function executingRtgovTaskV2(id) {
|
|
1325
|
+
const j = _rtgovJsV2.get(id);
|
|
1326
|
+
if (!j) throw new Error(`rtgov task ${id} not found`);
|
|
1327
|
+
_rtgovCheckJ(j.status, RTGOV_TASK_LIFECYCLE_V2.EXECUTING);
|
|
1328
|
+
const now = Date.now();
|
|
1329
|
+
j.status = RTGOV_TASK_LIFECYCLE_V2.EXECUTING;
|
|
1330
|
+
j.updatedAt = now;
|
|
1331
|
+
if (!j.startedAt) j.startedAt = now;
|
|
1332
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1333
|
+
}
|
|
1334
|
+
export function completeTaskRtgovV2(id) {
|
|
1335
|
+
const j = _rtgovJsV2.get(id);
|
|
1336
|
+
if (!j) throw new Error(`rtgov task ${id} not found`);
|
|
1337
|
+
_rtgovCheckJ(j.status, RTGOV_TASK_LIFECYCLE_V2.EXECUTED);
|
|
1338
|
+
const now = Date.now();
|
|
1339
|
+
j.status = RTGOV_TASK_LIFECYCLE_V2.EXECUTED;
|
|
1340
|
+
j.updatedAt = now;
|
|
1341
|
+
if (!j.settledAt) j.settledAt = now;
|
|
1342
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1343
|
+
}
|
|
1344
|
+
export function failRtgovTaskV2(id, reason) {
|
|
1345
|
+
const j = _rtgovJsV2.get(id);
|
|
1346
|
+
if (!j) throw new Error(`rtgov task ${id} not found`);
|
|
1347
|
+
_rtgovCheckJ(j.status, RTGOV_TASK_LIFECYCLE_V2.FAILED);
|
|
1348
|
+
const now = Date.now();
|
|
1349
|
+
j.status = RTGOV_TASK_LIFECYCLE_V2.FAILED;
|
|
1350
|
+
j.updatedAt = now;
|
|
1351
|
+
if (!j.settledAt) j.settledAt = now;
|
|
1352
|
+
if (reason) j.metadata.failReason = String(reason);
|
|
1353
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1354
|
+
}
|
|
1355
|
+
export function cancelRtgovTaskV2(id, reason) {
|
|
1356
|
+
const j = _rtgovJsV2.get(id);
|
|
1357
|
+
if (!j) throw new Error(`rtgov task ${id} not found`);
|
|
1358
|
+
_rtgovCheckJ(j.status, RTGOV_TASK_LIFECYCLE_V2.CANCELLED);
|
|
1359
|
+
const now = Date.now();
|
|
1360
|
+
j.status = RTGOV_TASK_LIFECYCLE_V2.CANCELLED;
|
|
1361
|
+
j.updatedAt = now;
|
|
1362
|
+
if (!j.settledAt) j.settledAt = now;
|
|
1363
|
+
if (reason) j.metadata.cancelReason = String(reason);
|
|
1364
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1365
|
+
}
|
|
1366
|
+
export function getRtgovTaskV2(id) {
|
|
1367
|
+
const j = _rtgovJsV2.get(id);
|
|
1368
|
+
if (!j) return null;
|
|
1369
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1370
|
+
}
|
|
1371
|
+
export function listRtgovTasksV2() {
|
|
1372
|
+
return [..._rtgovJsV2.values()].map((j) => ({
|
|
1373
|
+
...j,
|
|
1374
|
+
metadata: { ...j.metadata },
|
|
1375
|
+
}));
|
|
1376
|
+
}
|
|
1377
|
+
export function autoDegradeIdleRtgovProfilesV2({ now } = {}) {
|
|
1378
|
+
const t = now ?? Date.now();
|
|
1379
|
+
const flipped = [];
|
|
1380
|
+
for (const p of _rtgovPsV2.values())
|
|
1381
|
+
if (
|
|
1382
|
+
p.status === RTGOV_PROFILE_MATURITY_V2.ACTIVE &&
|
|
1383
|
+
t - p.lastTouchedAt >= _rtgovIdleMs
|
|
1384
|
+
) {
|
|
1385
|
+
p.status = RTGOV_PROFILE_MATURITY_V2.DEGRADED;
|
|
1386
|
+
p.updatedAt = t;
|
|
1387
|
+
flipped.push(p.id);
|
|
1388
|
+
}
|
|
1389
|
+
return { flipped, count: flipped.length };
|
|
1390
|
+
}
|
|
1391
|
+
export function autoFailStuckRtgovTasksV2({ now } = {}) {
|
|
1392
|
+
const t = now ?? Date.now();
|
|
1393
|
+
const flipped = [];
|
|
1394
|
+
for (const j of _rtgovJsV2.values())
|
|
1395
|
+
if (
|
|
1396
|
+
j.status === RTGOV_TASK_LIFECYCLE_V2.EXECUTING &&
|
|
1397
|
+
j.startedAt != null &&
|
|
1398
|
+
t - j.startedAt >= _rtgovStuckMs
|
|
1399
|
+
) {
|
|
1400
|
+
j.status = RTGOV_TASK_LIFECYCLE_V2.FAILED;
|
|
1401
|
+
j.updatedAt = t;
|
|
1402
|
+
if (!j.settledAt) j.settledAt = t;
|
|
1403
|
+
j.metadata.failReason = "auto-fail-stuck";
|
|
1404
|
+
flipped.push(j.id);
|
|
1405
|
+
}
|
|
1406
|
+
return { flipped, count: flipped.length };
|
|
1407
|
+
}
|
|
1408
|
+
export function getUniversalRuntimeGovStatsV2() {
|
|
1409
|
+
const profilesByStatus = {};
|
|
1410
|
+
for (const v of Object.values(RTGOV_PROFILE_MATURITY_V2))
|
|
1411
|
+
profilesByStatus[v] = 0;
|
|
1412
|
+
for (const p of _rtgovPsV2.values()) profilesByStatus[p.status]++;
|
|
1413
|
+
const tasksByStatus = {};
|
|
1414
|
+
for (const v of Object.values(RTGOV_TASK_LIFECYCLE_V2)) tasksByStatus[v] = 0;
|
|
1415
|
+
for (const j of _rtgovJsV2.values()) tasksByStatus[j.status]++;
|
|
1416
|
+
return {
|
|
1417
|
+
totalRtgovProfilesV2: _rtgovPsV2.size,
|
|
1418
|
+
totalRtgovTasksV2: _rtgovJsV2.size,
|
|
1419
|
+
maxActiveRtgovProfilesPerOwner: _rtgovMaxActive,
|
|
1420
|
+
maxPendingRtgovTasksPerProfile: _rtgovMaxPending,
|
|
1421
|
+
rtgovProfileIdleMs: _rtgovIdleMs,
|
|
1422
|
+
rtgovTaskStuckMs: _rtgovStuckMs,
|
|
1423
|
+
profilesByStatus,
|
|
1424
|
+
tasksByStatus,
|
|
1425
|
+
};
|
|
1426
|
+
}
|