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
|
@@ -918,3 +918,337 @@ export function _resetStateCgV2() {
|
|
|
918
918
|
_cgAgentIdleMs = CG_DEFAULT_AGENT_IDLE_MS;
|
|
919
919
|
_cgProposalStuckMs = CG_DEFAULT_PROPOSAL_STUCK_MS;
|
|
920
920
|
}
|
|
921
|
+
|
|
922
|
+
// =====================================================================
|
|
923
|
+
// collaboration-governance V2 governance overlay (iter19)
|
|
924
|
+
// =====================================================================
|
|
925
|
+
export const COGOV_PROFILE_MATURITY_V2 = Object.freeze({
|
|
926
|
+
PENDING: "pending",
|
|
927
|
+
ACTIVE: "active",
|
|
928
|
+
SUSPENDED: "suspended",
|
|
929
|
+
ARCHIVED: "archived",
|
|
930
|
+
});
|
|
931
|
+
export const COGOV_DECISION_LIFECYCLE_V2 = Object.freeze({
|
|
932
|
+
QUEUED: "queued",
|
|
933
|
+
DELIBERATING: "deliberating",
|
|
934
|
+
DECIDED: "decided",
|
|
935
|
+
FAILED: "failed",
|
|
936
|
+
CANCELLED: "cancelled",
|
|
937
|
+
});
|
|
938
|
+
const _cogovPTrans = new Map([
|
|
939
|
+
[
|
|
940
|
+
COGOV_PROFILE_MATURITY_V2.PENDING,
|
|
941
|
+
new Set([
|
|
942
|
+
COGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
943
|
+
COGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
944
|
+
]),
|
|
945
|
+
],
|
|
946
|
+
[
|
|
947
|
+
COGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
948
|
+
new Set([
|
|
949
|
+
COGOV_PROFILE_MATURITY_V2.SUSPENDED,
|
|
950
|
+
COGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
951
|
+
]),
|
|
952
|
+
],
|
|
953
|
+
[
|
|
954
|
+
COGOV_PROFILE_MATURITY_V2.SUSPENDED,
|
|
955
|
+
new Set([
|
|
956
|
+
COGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
957
|
+
COGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
958
|
+
]),
|
|
959
|
+
],
|
|
960
|
+
[COGOV_PROFILE_MATURITY_V2.ARCHIVED, new Set()],
|
|
961
|
+
]);
|
|
962
|
+
const _cogovPTerminal = new Set([COGOV_PROFILE_MATURITY_V2.ARCHIVED]);
|
|
963
|
+
const _cogovJTrans = new Map([
|
|
964
|
+
[
|
|
965
|
+
COGOV_DECISION_LIFECYCLE_V2.QUEUED,
|
|
966
|
+
new Set([
|
|
967
|
+
COGOV_DECISION_LIFECYCLE_V2.DELIBERATING,
|
|
968
|
+
COGOV_DECISION_LIFECYCLE_V2.CANCELLED,
|
|
969
|
+
]),
|
|
970
|
+
],
|
|
971
|
+
[
|
|
972
|
+
COGOV_DECISION_LIFECYCLE_V2.DELIBERATING,
|
|
973
|
+
new Set([
|
|
974
|
+
COGOV_DECISION_LIFECYCLE_V2.DECIDED,
|
|
975
|
+
COGOV_DECISION_LIFECYCLE_V2.FAILED,
|
|
976
|
+
COGOV_DECISION_LIFECYCLE_V2.CANCELLED,
|
|
977
|
+
]),
|
|
978
|
+
],
|
|
979
|
+
[COGOV_DECISION_LIFECYCLE_V2.DECIDED, new Set()],
|
|
980
|
+
[COGOV_DECISION_LIFECYCLE_V2.FAILED, new Set()],
|
|
981
|
+
[COGOV_DECISION_LIFECYCLE_V2.CANCELLED, new Set()],
|
|
982
|
+
]);
|
|
983
|
+
const _cogovPsV2 = new Map();
|
|
984
|
+
const _cogovJsV2 = new Map();
|
|
985
|
+
let _cogovMaxActive = 8,
|
|
986
|
+
_cogovMaxPending = 20,
|
|
987
|
+
_cogovIdleMs = 30 * 24 * 60 * 60 * 1000,
|
|
988
|
+
_cogovStuckMs = 60 * 1000;
|
|
989
|
+
function _cogovPos(n, label) {
|
|
990
|
+
const v = Math.floor(Number(n));
|
|
991
|
+
if (!Number.isFinite(v) || v <= 0)
|
|
992
|
+
throw new Error(`${label} must be positive integer`);
|
|
993
|
+
return v;
|
|
994
|
+
}
|
|
995
|
+
function _cogovCheckP(from, to) {
|
|
996
|
+
const a = _cogovPTrans.get(from);
|
|
997
|
+
if (!a || !a.has(to))
|
|
998
|
+
throw new Error(`invalid cogov profile transition ${from} → ${to}`);
|
|
999
|
+
}
|
|
1000
|
+
function _cogovCheckJ(from, to) {
|
|
1001
|
+
const a = _cogovJTrans.get(from);
|
|
1002
|
+
if (!a || !a.has(to))
|
|
1003
|
+
throw new Error(`invalid cogov decision transition ${from} → ${to}`);
|
|
1004
|
+
}
|
|
1005
|
+
function _cogovCountActive(owner) {
|
|
1006
|
+
let c = 0;
|
|
1007
|
+
for (const p of _cogovPsV2.values())
|
|
1008
|
+
if (p.owner === owner && p.status === COGOV_PROFILE_MATURITY_V2.ACTIVE) c++;
|
|
1009
|
+
return c;
|
|
1010
|
+
}
|
|
1011
|
+
function _cogovCountPending(profileId) {
|
|
1012
|
+
let c = 0;
|
|
1013
|
+
for (const j of _cogovJsV2.values())
|
|
1014
|
+
if (
|
|
1015
|
+
j.profileId === profileId &&
|
|
1016
|
+
(j.status === COGOV_DECISION_LIFECYCLE_V2.QUEUED ||
|
|
1017
|
+
j.status === COGOV_DECISION_LIFECYCLE_V2.DELIBERATING)
|
|
1018
|
+
)
|
|
1019
|
+
c++;
|
|
1020
|
+
return c;
|
|
1021
|
+
}
|
|
1022
|
+
export function setMaxActiveCogovProfilesPerOwnerV2(n) {
|
|
1023
|
+
_cogovMaxActive = _cogovPos(n, "maxActiveCogovProfilesPerOwner");
|
|
1024
|
+
}
|
|
1025
|
+
export function getMaxActiveCogovProfilesPerOwnerV2() {
|
|
1026
|
+
return _cogovMaxActive;
|
|
1027
|
+
}
|
|
1028
|
+
export function setMaxPendingCogovDecisionsPerProfileV2(n) {
|
|
1029
|
+
_cogovMaxPending = _cogovPos(n, "maxPendingCogovDecisionsPerProfile");
|
|
1030
|
+
}
|
|
1031
|
+
export function getMaxPendingCogovDecisionsPerProfileV2() {
|
|
1032
|
+
return _cogovMaxPending;
|
|
1033
|
+
}
|
|
1034
|
+
export function setCogovProfileIdleMsV2(n) {
|
|
1035
|
+
_cogovIdleMs = _cogovPos(n, "cogovProfileIdleMs");
|
|
1036
|
+
}
|
|
1037
|
+
export function getCogovProfileIdleMsV2() {
|
|
1038
|
+
return _cogovIdleMs;
|
|
1039
|
+
}
|
|
1040
|
+
export function setCogovDecisionStuckMsV2(n) {
|
|
1041
|
+
_cogovStuckMs = _cogovPos(n, "cogovDecisionStuckMs");
|
|
1042
|
+
}
|
|
1043
|
+
export function getCogovDecisionStuckMsV2() {
|
|
1044
|
+
return _cogovStuckMs;
|
|
1045
|
+
}
|
|
1046
|
+
export function _resetStateCollaborationGovernanceGovV2() {
|
|
1047
|
+
_cogovPsV2.clear();
|
|
1048
|
+
_cogovJsV2.clear();
|
|
1049
|
+
_cogovMaxActive = 8;
|
|
1050
|
+
_cogovMaxPending = 20;
|
|
1051
|
+
_cogovIdleMs = 30 * 24 * 60 * 60 * 1000;
|
|
1052
|
+
_cogovStuckMs = 60 * 1000;
|
|
1053
|
+
}
|
|
1054
|
+
export function registerCogovProfileV2({ id, owner, scope, metadata } = {}) {
|
|
1055
|
+
if (!id || !owner) throw new Error("id and owner required");
|
|
1056
|
+
if (_cogovPsV2.has(id)) throw new Error(`cogov profile ${id} already exists`);
|
|
1057
|
+
const now = Date.now();
|
|
1058
|
+
const p = {
|
|
1059
|
+
id,
|
|
1060
|
+
owner,
|
|
1061
|
+
scope: scope || "team",
|
|
1062
|
+
status: COGOV_PROFILE_MATURITY_V2.PENDING,
|
|
1063
|
+
createdAt: now,
|
|
1064
|
+
updatedAt: now,
|
|
1065
|
+
lastTouchedAt: now,
|
|
1066
|
+
activatedAt: null,
|
|
1067
|
+
archivedAt: null,
|
|
1068
|
+
metadata: { ...(metadata || {}) },
|
|
1069
|
+
};
|
|
1070
|
+
_cogovPsV2.set(id, p);
|
|
1071
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1072
|
+
}
|
|
1073
|
+
export function activateCogovProfileV2(id) {
|
|
1074
|
+
const p = _cogovPsV2.get(id);
|
|
1075
|
+
if (!p) throw new Error(`cogov profile ${id} not found`);
|
|
1076
|
+
const isInitial = p.status === COGOV_PROFILE_MATURITY_V2.PENDING;
|
|
1077
|
+
_cogovCheckP(p.status, COGOV_PROFILE_MATURITY_V2.ACTIVE);
|
|
1078
|
+
if (isInitial && _cogovCountActive(p.owner) >= _cogovMaxActive)
|
|
1079
|
+
throw new Error(`max active cogov profiles for owner ${p.owner} reached`);
|
|
1080
|
+
const now = Date.now();
|
|
1081
|
+
p.status = COGOV_PROFILE_MATURITY_V2.ACTIVE;
|
|
1082
|
+
p.updatedAt = now;
|
|
1083
|
+
p.lastTouchedAt = now;
|
|
1084
|
+
if (!p.activatedAt) p.activatedAt = now;
|
|
1085
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1086
|
+
}
|
|
1087
|
+
export function suspendCogovProfileV2(id) {
|
|
1088
|
+
const p = _cogovPsV2.get(id);
|
|
1089
|
+
if (!p) throw new Error(`cogov profile ${id} not found`);
|
|
1090
|
+
_cogovCheckP(p.status, COGOV_PROFILE_MATURITY_V2.SUSPENDED);
|
|
1091
|
+
p.status = COGOV_PROFILE_MATURITY_V2.SUSPENDED;
|
|
1092
|
+
p.updatedAt = Date.now();
|
|
1093
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1094
|
+
}
|
|
1095
|
+
export function archiveCogovProfileV2(id) {
|
|
1096
|
+
const p = _cogovPsV2.get(id);
|
|
1097
|
+
if (!p) throw new Error(`cogov profile ${id} not found`);
|
|
1098
|
+
_cogovCheckP(p.status, COGOV_PROFILE_MATURITY_V2.ARCHIVED);
|
|
1099
|
+
const now = Date.now();
|
|
1100
|
+
p.status = COGOV_PROFILE_MATURITY_V2.ARCHIVED;
|
|
1101
|
+
p.updatedAt = now;
|
|
1102
|
+
if (!p.archivedAt) p.archivedAt = now;
|
|
1103
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1104
|
+
}
|
|
1105
|
+
export function touchCogovProfileV2(id) {
|
|
1106
|
+
const p = _cogovPsV2.get(id);
|
|
1107
|
+
if (!p) throw new Error(`cogov profile ${id} not found`);
|
|
1108
|
+
if (_cogovPTerminal.has(p.status))
|
|
1109
|
+
throw new Error(`cannot touch terminal cogov profile ${id}`);
|
|
1110
|
+
const now = Date.now();
|
|
1111
|
+
p.lastTouchedAt = now;
|
|
1112
|
+
p.updatedAt = now;
|
|
1113
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1114
|
+
}
|
|
1115
|
+
export function getCogovProfileV2(id) {
|
|
1116
|
+
const p = _cogovPsV2.get(id);
|
|
1117
|
+
if (!p) return null;
|
|
1118
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1119
|
+
}
|
|
1120
|
+
export function listCogovProfilesV2() {
|
|
1121
|
+
return [..._cogovPsV2.values()].map((p) => ({
|
|
1122
|
+
...p,
|
|
1123
|
+
metadata: { ...p.metadata },
|
|
1124
|
+
}));
|
|
1125
|
+
}
|
|
1126
|
+
export function createCogovDecisionV2({ id, profileId, topic, metadata } = {}) {
|
|
1127
|
+
if (!id || !profileId) throw new Error("id and profileId required");
|
|
1128
|
+
if (_cogovJsV2.has(id))
|
|
1129
|
+
throw new Error(`cogov decision ${id} already exists`);
|
|
1130
|
+
if (!_cogovPsV2.has(profileId))
|
|
1131
|
+
throw new Error(`cogov profile ${profileId} not found`);
|
|
1132
|
+
if (_cogovCountPending(profileId) >= _cogovMaxPending)
|
|
1133
|
+
throw new Error(
|
|
1134
|
+
`max pending cogov decisions for profile ${profileId} reached`,
|
|
1135
|
+
);
|
|
1136
|
+
const now = Date.now();
|
|
1137
|
+
const j = {
|
|
1138
|
+
id,
|
|
1139
|
+
profileId,
|
|
1140
|
+
topic: topic || "",
|
|
1141
|
+
status: COGOV_DECISION_LIFECYCLE_V2.QUEUED,
|
|
1142
|
+
createdAt: now,
|
|
1143
|
+
updatedAt: now,
|
|
1144
|
+
startedAt: null,
|
|
1145
|
+
settledAt: null,
|
|
1146
|
+
metadata: { ...(metadata || {}) },
|
|
1147
|
+
};
|
|
1148
|
+
_cogovJsV2.set(id, j);
|
|
1149
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1150
|
+
}
|
|
1151
|
+
export function deliberatingCogovDecisionV2(id) {
|
|
1152
|
+
const j = _cogovJsV2.get(id);
|
|
1153
|
+
if (!j) throw new Error(`cogov decision ${id} not found`);
|
|
1154
|
+
_cogovCheckJ(j.status, COGOV_DECISION_LIFECYCLE_V2.DELIBERATING);
|
|
1155
|
+
const now = Date.now();
|
|
1156
|
+
j.status = COGOV_DECISION_LIFECYCLE_V2.DELIBERATING;
|
|
1157
|
+
j.updatedAt = now;
|
|
1158
|
+
if (!j.startedAt) j.startedAt = now;
|
|
1159
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1160
|
+
}
|
|
1161
|
+
export function completeDecisionCogovV2(id) {
|
|
1162
|
+
const j = _cogovJsV2.get(id);
|
|
1163
|
+
if (!j) throw new Error(`cogov decision ${id} not found`);
|
|
1164
|
+
_cogovCheckJ(j.status, COGOV_DECISION_LIFECYCLE_V2.DECIDED);
|
|
1165
|
+
const now = Date.now();
|
|
1166
|
+
j.status = COGOV_DECISION_LIFECYCLE_V2.DECIDED;
|
|
1167
|
+
j.updatedAt = now;
|
|
1168
|
+
if (!j.settledAt) j.settledAt = now;
|
|
1169
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1170
|
+
}
|
|
1171
|
+
export function failCogovDecisionV2(id, reason) {
|
|
1172
|
+
const j = _cogovJsV2.get(id);
|
|
1173
|
+
if (!j) throw new Error(`cogov decision ${id} not found`);
|
|
1174
|
+
_cogovCheckJ(j.status, COGOV_DECISION_LIFECYCLE_V2.FAILED);
|
|
1175
|
+
const now = Date.now();
|
|
1176
|
+
j.status = COGOV_DECISION_LIFECYCLE_V2.FAILED;
|
|
1177
|
+
j.updatedAt = now;
|
|
1178
|
+
if (!j.settledAt) j.settledAt = now;
|
|
1179
|
+
if (reason) j.metadata.failReason = String(reason);
|
|
1180
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1181
|
+
}
|
|
1182
|
+
export function cancelCogovDecisionV2(id, reason) {
|
|
1183
|
+
const j = _cogovJsV2.get(id);
|
|
1184
|
+
if (!j) throw new Error(`cogov decision ${id} not found`);
|
|
1185
|
+
_cogovCheckJ(j.status, COGOV_DECISION_LIFECYCLE_V2.CANCELLED);
|
|
1186
|
+
const now = Date.now();
|
|
1187
|
+
j.status = COGOV_DECISION_LIFECYCLE_V2.CANCELLED;
|
|
1188
|
+
j.updatedAt = now;
|
|
1189
|
+
if (!j.settledAt) j.settledAt = now;
|
|
1190
|
+
if (reason) j.metadata.cancelReason = String(reason);
|
|
1191
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1192
|
+
}
|
|
1193
|
+
export function getCogovDecisionV2(id) {
|
|
1194
|
+
const j = _cogovJsV2.get(id);
|
|
1195
|
+
if (!j) return null;
|
|
1196
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1197
|
+
}
|
|
1198
|
+
export function listCogovDecisionsV2() {
|
|
1199
|
+
return [..._cogovJsV2.values()].map((j) => ({
|
|
1200
|
+
...j,
|
|
1201
|
+
metadata: { ...j.metadata },
|
|
1202
|
+
}));
|
|
1203
|
+
}
|
|
1204
|
+
export function autoSuspendIdleCogovProfilesV2({ now } = {}) {
|
|
1205
|
+
const t = now ?? Date.now();
|
|
1206
|
+
const flipped = [];
|
|
1207
|
+
for (const p of _cogovPsV2.values())
|
|
1208
|
+
if (
|
|
1209
|
+
p.status === COGOV_PROFILE_MATURITY_V2.ACTIVE &&
|
|
1210
|
+
t - p.lastTouchedAt >= _cogovIdleMs
|
|
1211
|
+
) {
|
|
1212
|
+
p.status = COGOV_PROFILE_MATURITY_V2.SUSPENDED;
|
|
1213
|
+
p.updatedAt = t;
|
|
1214
|
+
flipped.push(p.id);
|
|
1215
|
+
}
|
|
1216
|
+
return { flipped, count: flipped.length };
|
|
1217
|
+
}
|
|
1218
|
+
export function autoFailStuckCogovDecisionsV2({ now } = {}) {
|
|
1219
|
+
const t = now ?? Date.now();
|
|
1220
|
+
const flipped = [];
|
|
1221
|
+
for (const j of _cogovJsV2.values())
|
|
1222
|
+
if (
|
|
1223
|
+
j.status === COGOV_DECISION_LIFECYCLE_V2.DELIBERATING &&
|
|
1224
|
+
j.startedAt != null &&
|
|
1225
|
+
t - j.startedAt >= _cogovStuckMs
|
|
1226
|
+
) {
|
|
1227
|
+
j.status = COGOV_DECISION_LIFECYCLE_V2.FAILED;
|
|
1228
|
+
j.updatedAt = t;
|
|
1229
|
+
if (!j.settledAt) j.settledAt = t;
|
|
1230
|
+
j.metadata.failReason = "auto-fail-stuck";
|
|
1231
|
+
flipped.push(j.id);
|
|
1232
|
+
}
|
|
1233
|
+
return { flipped, count: flipped.length };
|
|
1234
|
+
}
|
|
1235
|
+
export function getCollaborationGovernanceGovStatsV2() {
|
|
1236
|
+
const profilesByStatus = {};
|
|
1237
|
+
for (const v of Object.values(COGOV_PROFILE_MATURITY_V2))
|
|
1238
|
+
profilesByStatus[v] = 0;
|
|
1239
|
+
for (const p of _cogovPsV2.values()) profilesByStatus[p.status]++;
|
|
1240
|
+
const decisionsByStatus = {};
|
|
1241
|
+
for (const v of Object.values(COGOV_DECISION_LIFECYCLE_V2))
|
|
1242
|
+
decisionsByStatus[v] = 0;
|
|
1243
|
+
for (const j of _cogovJsV2.values()) decisionsByStatus[j.status]++;
|
|
1244
|
+
return {
|
|
1245
|
+
totalCogovProfilesV2: _cogovPsV2.size,
|
|
1246
|
+
totalCogovDecisionsV2: _cogovJsV2.size,
|
|
1247
|
+
maxActiveCogovProfilesPerOwner: _cogovMaxActive,
|
|
1248
|
+
maxPendingCogovDecisionsPerProfile: _cogovMaxPending,
|
|
1249
|
+
cogovProfileIdleMs: _cogovIdleMs,
|
|
1250
|
+
cogovDecisionStuckMs: _cogovStuckMs,
|
|
1251
|
+
profilesByStatus,
|
|
1252
|
+
decisionsByStatus,
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
@@ -1083,3 +1083,349 @@ export function _resetStateV2() {
|
|
|
1083
1083
|
_proposerIdleMsV2 = GOV_DEFAULT_PROPOSER_IDLE_MS;
|
|
1084
1084
|
_pendingDelegationMsV2 = GOV_DEFAULT_PENDING_DELEGATION_MS;
|
|
1085
1085
|
}
|
|
1086
|
+
|
|
1087
|
+
// =====================================================================
|
|
1088
|
+
// community-governance V2 governance overlay (iter19)
|
|
1089
|
+
// =====================================================================
|
|
1090
|
+
export const COMMGOV_PROFILE_MATURITY_V2 = Object.freeze({
|
|
1091
|
+
PENDING: "pending",
|
|
1092
|
+
ACTIVE: "active",
|
|
1093
|
+
PAUSED: "paused",
|
|
1094
|
+
ARCHIVED: "archived",
|
|
1095
|
+
});
|
|
1096
|
+
export const COMMGOV_MOTION_LIFECYCLE_V2 = Object.freeze({
|
|
1097
|
+
QUEUED: "queued",
|
|
1098
|
+
VOTING: "voting",
|
|
1099
|
+
VOTED: "voted",
|
|
1100
|
+
FAILED: "failed",
|
|
1101
|
+
CANCELLED: "cancelled",
|
|
1102
|
+
});
|
|
1103
|
+
const _commgovPTrans = new Map([
|
|
1104
|
+
[
|
|
1105
|
+
COMMGOV_PROFILE_MATURITY_V2.PENDING,
|
|
1106
|
+
new Set([
|
|
1107
|
+
COMMGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
1108
|
+
COMMGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
1109
|
+
]),
|
|
1110
|
+
],
|
|
1111
|
+
[
|
|
1112
|
+
COMMGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
1113
|
+
new Set([
|
|
1114
|
+
COMMGOV_PROFILE_MATURITY_V2.PAUSED,
|
|
1115
|
+
COMMGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
1116
|
+
]),
|
|
1117
|
+
],
|
|
1118
|
+
[
|
|
1119
|
+
COMMGOV_PROFILE_MATURITY_V2.PAUSED,
|
|
1120
|
+
new Set([
|
|
1121
|
+
COMMGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
1122
|
+
COMMGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
1123
|
+
]),
|
|
1124
|
+
],
|
|
1125
|
+
[COMMGOV_PROFILE_MATURITY_V2.ARCHIVED, new Set()],
|
|
1126
|
+
]);
|
|
1127
|
+
const _commgovPTerminal = new Set([COMMGOV_PROFILE_MATURITY_V2.ARCHIVED]);
|
|
1128
|
+
const _commgovJTrans = new Map([
|
|
1129
|
+
[
|
|
1130
|
+
COMMGOV_MOTION_LIFECYCLE_V2.QUEUED,
|
|
1131
|
+
new Set([
|
|
1132
|
+
COMMGOV_MOTION_LIFECYCLE_V2.VOTING,
|
|
1133
|
+
COMMGOV_MOTION_LIFECYCLE_V2.CANCELLED,
|
|
1134
|
+
]),
|
|
1135
|
+
],
|
|
1136
|
+
[
|
|
1137
|
+
COMMGOV_MOTION_LIFECYCLE_V2.VOTING,
|
|
1138
|
+
new Set([
|
|
1139
|
+
COMMGOV_MOTION_LIFECYCLE_V2.VOTED,
|
|
1140
|
+
COMMGOV_MOTION_LIFECYCLE_V2.FAILED,
|
|
1141
|
+
COMMGOV_MOTION_LIFECYCLE_V2.CANCELLED,
|
|
1142
|
+
]),
|
|
1143
|
+
],
|
|
1144
|
+
[COMMGOV_MOTION_LIFECYCLE_V2.VOTED, new Set()],
|
|
1145
|
+
[COMMGOV_MOTION_LIFECYCLE_V2.FAILED, new Set()],
|
|
1146
|
+
[COMMGOV_MOTION_LIFECYCLE_V2.CANCELLED, new Set()],
|
|
1147
|
+
]);
|
|
1148
|
+
const _commgovPsV2 = new Map();
|
|
1149
|
+
const _commgovJsV2 = new Map();
|
|
1150
|
+
let _commgovMaxActive = 8,
|
|
1151
|
+
_commgovMaxPending = 25,
|
|
1152
|
+
_commgovIdleMs = 30 * 24 * 60 * 60 * 1000,
|
|
1153
|
+
_commgovStuckMs = 60 * 1000;
|
|
1154
|
+
function _commgovPos(n, label) {
|
|
1155
|
+
const v = Math.floor(Number(n));
|
|
1156
|
+
if (!Number.isFinite(v) || v <= 0)
|
|
1157
|
+
throw new Error(`${label} must be positive integer`);
|
|
1158
|
+
return v;
|
|
1159
|
+
}
|
|
1160
|
+
function _commgovCheckP(from, to) {
|
|
1161
|
+
const a = _commgovPTrans.get(from);
|
|
1162
|
+
if (!a || !a.has(to))
|
|
1163
|
+
throw new Error(`invalid commgov profile transition ${from} → ${to}`);
|
|
1164
|
+
}
|
|
1165
|
+
function _commgovCheckJ(from, to) {
|
|
1166
|
+
const a = _commgovJTrans.get(from);
|
|
1167
|
+
if (!a || !a.has(to))
|
|
1168
|
+
throw new Error(`invalid commgov motion transition ${from} → ${to}`);
|
|
1169
|
+
}
|
|
1170
|
+
function _commgovCountActive(owner) {
|
|
1171
|
+
let c = 0;
|
|
1172
|
+
for (const p of _commgovPsV2.values())
|
|
1173
|
+
if (p.owner === owner && p.status === COMMGOV_PROFILE_MATURITY_V2.ACTIVE)
|
|
1174
|
+
c++;
|
|
1175
|
+
return c;
|
|
1176
|
+
}
|
|
1177
|
+
function _commgovCountPending(profileId) {
|
|
1178
|
+
let c = 0;
|
|
1179
|
+
for (const j of _commgovJsV2.values())
|
|
1180
|
+
if (
|
|
1181
|
+
j.profileId === profileId &&
|
|
1182
|
+
(j.status === COMMGOV_MOTION_LIFECYCLE_V2.QUEUED ||
|
|
1183
|
+
j.status === COMMGOV_MOTION_LIFECYCLE_V2.VOTING)
|
|
1184
|
+
)
|
|
1185
|
+
c++;
|
|
1186
|
+
return c;
|
|
1187
|
+
}
|
|
1188
|
+
export function setMaxActiveCommgovProfilesPerOwnerV2(n) {
|
|
1189
|
+
_commgovMaxActive = _commgovPos(n, "maxActiveCommgovProfilesPerOwner");
|
|
1190
|
+
}
|
|
1191
|
+
export function getMaxActiveCommgovProfilesPerOwnerV2() {
|
|
1192
|
+
return _commgovMaxActive;
|
|
1193
|
+
}
|
|
1194
|
+
export function setMaxPendingCommgovMotionsPerProfileV2(n) {
|
|
1195
|
+
_commgovMaxPending = _commgovPos(n, "maxPendingCommgovMotionsPerProfile");
|
|
1196
|
+
}
|
|
1197
|
+
export function getMaxPendingCommgovMotionsPerProfileV2() {
|
|
1198
|
+
return _commgovMaxPending;
|
|
1199
|
+
}
|
|
1200
|
+
export function setCommgovProfileIdleMsV2(n) {
|
|
1201
|
+
_commgovIdleMs = _commgovPos(n, "commgovProfileIdleMs");
|
|
1202
|
+
}
|
|
1203
|
+
export function getCommgovProfileIdleMsV2() {
|
|
1204
|
+
return _commgovIdleMs;
|
|
1205
|
+
}
|
|
1206
|
+
export function setCommgovMotionStuckMsV2(n) {
|
|
1207
|
+
_commgovStuckMs = _commgovPos(n, "commgovMotionStuckMs");
|
|
1208
|
+
}
|
|
1209
|
+
export function getCommgovMotionStuckMsV2() {
|
|
1210
|
+
return _commgovStuckMs;
|
|
1211
|
+
}
|
|
1212
|
+
export function _resetStateCommunityGovernanceGovV2() {
|
|
1213
|
+
_commgovPsV2.clear();
|
|
1214
|
+
_commgovJsV2.clear();
|
|
1215
|
+
_commgovMaxActive = 8;
|
|
1216
|
+
_commgovMaxPending = 25;
|
|
1217
|
+
_commgovIdleMs = 30 * 24 * 60 * 60 * 1000;
|
|
1218
|
+
_commgovStuckMs = 60 * 1000;
|
|
1219
|
+
}
|
|
1220
|
+
export function registerCommgovProfileV2({
|
|
1221
|
+
id,
|
|
1222
|
+
owner,
|
|
1223
|
+
chamber,
|
|
1224
|
+
metadata,
|
|
1225
|
+
} = {}) {
|
|
1226
|
+
if (!id || !owner) throw new Error("id and owner required");
|
|
1227
|
+
if (_commgovPsV2.has(id))
|
|
1228
|
+
throw new Error(`commgov profile ${id} already exists`);
|
|
1229
|
+
const now = Date.now();
|
|
1230
|
+
const p = {
|
|
1231
|
+
id,
|
|
1232
|
+
owner,
|
|
1233
|
+
chamber: chamber || "general",
|
|
1234
|
+
status: COMMGOV_PROFILE_MATURITY_V2.PENDING,
|
|
1235
|
+
createdAt: now,
|
|
1236
|
+
updatedAt: now,
|
|
1237
|
+
lastTouchedAt: now,
|
|
1238
|
+
activatedAt: null,
|
|
1239
|
+
archivedAt: null,
|
|
1240
|
+
metadata: { ...(metadata || {}) },
|
|
1241
|
+
};
|
|
1242
|
+
_commgovPsV2.set(id, p);
|
|
1243
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1244
|
+
}
|
|
1245
|
+
export function activateCommgovProfileV2(id) {
|
|
1246
|
+
const p = _commgovPsV2.get(id);
|
|
1247
|
+
if (!p) throw new Error(`commgov profile ${id} not found`);
|
|
1248
|
+
const isInitial = p.status === COMMGOV_PROFILE_MATURITY_V2.PENDING;
|
|
1249
|
+
_commgovCheckP(p.status, COMMGOV_PROFILE_MATURITY_V2.ACTIVE);
|
|
1250
|
+
if (isInitial && _commgovCountActive(p.owner) >= _commgovMaxActive)
|
|
1251
|
+
throw new Error(`max active commgov profiles for owner ${p.owner} reached`);
|
|
1252
|
+
const now = Date.now();
|
|
1253
|
+
p.status = COMMGOV_PROFILE_MATURITY_V2.ACTIVE;
|
|
1254
|
+
p.updatedAt = now;
|
|
1255
|
+
p.lastTouchedAt = now;
|
|
1256
|
+
if (!p.activatedAt) p.activatedAt = now;
|
|
1257
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1258
|
+
}
|
|
1259
|
+
export function pauseCommgovProfileV2(id) {
|
|
1260
|
+
const p = _commgovPsV2.get(id);
|
|
1261
|
+
if (!p) throw new Error(`commgov profile ${id} not found`);
|
|
1262
|
+
_commgovCheckP(p.status, COMMGOV_PROFILE_MATURITY_V2.PAUSED);
|
|
1263
|
+
p.status = COMMGOV_PROFILE_MATURITY_V2.PAUSED;
|
|
1264
|
+
p.updatedAt = Date.now();
|
|
1265
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1266
|
+
}
|
|
1267
|
+
export function archiveCommgovProfileV2(id) {
|
|
1268
|
+
const p = _commgovPsV2.get(id);
|
|
1269
|
+
if (!p) throw new Error(`commgov profile ${id} not found`);
|
|
1270
|
+
_commgovCheckP(p.status, COMMGOV_PROFILE_MATURITY_V2.ARCHIVED);
|
|
1271
|
+
const now = Date.now();
|
|
1272
|
+
p.status = COMMGOV_PROFILE_MATURITY_V2.ARCHIVED;
|
|
1273
|
+
p.updatedAt = now;
|
|
1274
|
+
if (!p.archivedAt) p.archivedAt = now;
|
|
1275
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1276
|
+
}
|
|
1277
|
+
export function touchCommgovProfileV2(id) {
|
|
1278
|
+
const p = _commgovPsV2.get(id);
|
|
1279
|
+
if (!p) throw new Error(`commgov profile ${id} not found`);
|
|
1280
|
+
if (_commgovPTerminal.has(p.status))
|
|
1281
|
+
throw new Error(`cannot touch terminal commgov profile ${id}`);
|
|
1282
|
+
const now = Date.now();
|
|
1283
|
+
p.lastTouchedAt = now;
|
|
1284
|
+
p.updatedAt = now;
|
|
1285
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1286
|
+
}
|
|
1287
|
+
export function getCommgovProfileV2(id) {
|
|
1288
|
+
const p = _commgovPsV2.get(id);
|
|
1289
|
+
if (!p) return null;
|
|
1290
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1291
|
+
}
|
|
1292
|
+
export function listCommgovProfilesV2() {
|
|
1293
|
+
return [..._commgovPsV2.values()].map((p) => ({
|
|
1294
|
+
...p,
|
|
1295
|
+
metadata: { ...p.metadata },
|
|
1296
|
+
}));
|
|
1297
|
+
}
|
|
1298
|
+
export function createCommgovMotionV2({
|
|
1299
|
+
id,
|
|
1300
|
+
profileId,
|
|
1301
|
+
subject,
|
|
1302
|
+
metadata,
|
|
1303
|
+
} = {}) {
|
|
1304
|
+
if (!id || !profileId) throw new Error("id and profileId required");
|
|
1305
|
+
if (_commgovJsV2.has(id))
|
|
1306
|
+
throw new Error(`commgov motion ${id} already exists`);
|
|
1307
|
+
if (!_commgovPsV2.has(profileId))
|
|
1308
|
+
throw new Error(`commgov profile ${profileId} not found`);
|
|
1309
|
+
if (_commgovCountPending(profileId) >= _commgovMaxPending)
|
|
1310
|
+
throw new Error(
|
|
1311
|
+
`max pending commgov motions for profile ${profileId} reached`,
|
|
1312
|
+
);
|
|
1313
|
+
const now = Date.now();
|
|
1314
|
+
const j = {
|
|
1315
|
+
id,
|
|
1316
|
+
profileId,
|
|
1317
|
+
subject: subject || "",
|
|
1318
|
+
status: COMMGOV_MOTION_LIFECYCLE_V2.QUEUED,
|
|
1319
|
+
createdAt: now,
|
|
1320
|
+
updatedAt: now,
|
|
1321
|
+
startedAt: null,
|
|
1322
|
+
settledAt: null,
|
|
1323
|
+
metadata: { ...(metadata || {}) },
|
|
1324
|
+
};
|
|
1325
|
+
_commgovJsV2.set(id, j);
|
|
1326
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1327
|
+
}
|
|
1328
|
+
export function votingCommgovMotionV2(id) {
|
|
1329
|
+
const j = _commgovJsV2.get(id);
|
|
1330
|
+
if (!j) throw new Error(`commgov motion ${id} not found`);
|
|
1331
|
+
_commgovCheckJ(j.status, COMMGOV_MOTION_LIFECYCLE_V2.VOTING);
|
|
1332
|
+
const now = Date.now();
|
|
1333
|
+
j.status = COMMGOV_MOTION_LIFECYCLE_V2.VOTING;
|
|
1334
|
+
j.updatedAt = now;
|
|
1335
|
+
if (!j.startedAt) j.startedAt = now;
|
|
1336
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1337
|
+
}
|
|
1338
|
+
export function completeMotionCommgovV2(id) {
|
|
1339
|
+
const j = _commgovJsV2.get(id);
|
|
1340
|
+
if (!j) throw new Error(`commgov motion ${id} not found`);
|
|
1341
|
+
_commgovCheckJ(j.status, COMMGOV_MOTION_LIFECYCLE_V2.VOTED);
|
|
1342
|
+
const now = Date.now();
|
|
1343
|
+
j.status = COMMGOV_MOTION_LIFECYCLE_V2.VOTED;
|
|
1344
|
+
j.updatedAt = now;
|
|
1345
|
+
if (!j.settledAt) j.settledAt = now;
|
|
1346
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1347
|
+
}
|
|
1348
|
+
export function failCommgovMotionV2(id, reason) {
|
|
1349
|
+
const j = _commgovJsV2.get(id);
|
|
1350
|
+
if (!j) throw new Error(`commgov motion ${id} not found`);
|
|
1351
|
+
_commgovCheckJ(j.status, COMMGOV_MOTION_LIFECYCLE_V2.FAILED);
|
|
1352
|
+
const now = Date.now();
|
|
1353
|
+
j.status = COMMGOV_MOTION_LIFECYCLE_V2.FAILED;
|
|
1354
|
+
j.updatedAt = now;
|
|
1355
|
+
if (!j.settledAt) j.settledAt = now;
|
|
1356
|
+
if (reason) j.metadata.failReason = String(reason);
|
|
1357
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1358
|
+
}
|
|
1359
|
+
export function cancelCommgovMotionV2(id, reason) {
|
|
1360
|
+
const j = _commgovJsV2.get(id);
|
|
1361
|
+
if (!j) throw new Error(`commgov motion ${id} not found`);
|
|
1362
|
+
_commgovCheckJ(j.status, COMMGOV_MOTION_LIFECYCLE_V2.CANCELLED);
|
|
1363
|
+
const now = Date.now();
|
|
1364
|
+
j.status = COMMGOV_MOTION_LIFECYCLE_V2.CANCELLED;
|
|
1365
|
+
j.updatedAt = now;
|
|
1366
|
+
if (!j.settledAt) j.settledAt = now;
|
|
1367
|
+
if (reason) j.metadata.cancelReason = String(reason);
|
|
1368
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1369
|
+
}
|
|
1370
|
+
export function getCommgovMotionV2(id) {
|
|
1371
|
+
const j = _commgovJsV2.get(id);
|
|
1372
|
+
if (!j) return null;
|
|
1373
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1374
|
+
}
|
|
1375
|
+
export function listCommgovMotionsV2() {
|
|
1376
|
+
return [..._commgovJsV2.values()].map((j) => ({
|
|
1377
|
+
...j,
|
|
1378
|
+
metadata: { ...j.metadata },
|
|
1379
|
+
}));
|
|
1380
|
+
}
|
|
1381
|
+
export function autoPauseIdleCommgovProfilesV2({ now } = {}) {
|
|
1382
|
+
const t = now ?? Date.now();
|
|
1383
|
+
const flipped = [];
|
|
1384
|
+
for (const p of _commgovPsV2.values())
|
|
1385
|
+
if (
|
|
1386
|
+
p.status === COMMGOV_PROFILE_MATURITY_V2.ACTIVE &&
|
|
1387
|
+
t - p.lastTouchedAt >= _commgovIdleMs
|
|
1388
|
+
) {
|
|
1389
|
+
p.status = COMMGOV_PROFILE_MATURITY_V2.PAUSED;
|
|
1390
|
+
p.updatedAt = t;
|
|
1391
|
+
flipped.push(p.id);
|
|
1392
|
+
}
|
|
1393
|
+
return { flipped, count: flipped.length };
|
|
1394
|
+
}
|
|
1395
|
+
export function autoFailStuckCommgovMotionsV2({ now } = {}) {
|
|
1396
|
+
const t = now ?? Date.now();
|
|
1397
|
+
const flipped = [];
|
|
1398
|
+
for (const j of _commgovJsV2.values())
|
|
1399
|
+
if (
|
|
1400
|
+
j.status === COMMGOV_MOTION_LIFECYCLE_V2.VOTING &&
|
|
1401
|
+
j.startedAt != null &&
|
|
1402
|
+
t - j.startedAt >= _commgovStuckMs
|
|
1403
|
+
) {
|
|
1404
|
+
j.status = COMMGOV_MOTION_LIFECYCLE_V2.FAILED;
|
|
1405
|
+
j.updatedAt = t;
|
|
1406
|
+
if (!j.settledAt) j.settledAt = t;
|
|
1407
|
+
j.metadata.failReason = "auto-fail-stuck";
|
|
1408
|
+
flipped.push(j.id);
|
|
1409
|
+
}
|
|
1410
|
+
return { flipped, count: flipped.length };
|
|
1411
|
+
}
|
|
1412
|
+
export function getCommunityGovernanceGovStatsV2() {
|
|
1413
|
+
const profilesByStatus = {};
|
|
1414
|
+
for (const v of Object.values(COMMGOV_PROFILE_MATURITY_V2))
|
|
1415
|
+
profilesByStatus[v] = 0;
|
|
1416
|
+
for (const p of _commgovPsV2.values()) profilesByStatus[p.status]++;
|
|
1417
|
+
const motionsByStatus = {};
|
|
1418
|
+
for (const v of Object.values(COMMGOV_MOTION_LIFECYCLE_V2))
|
|
1419
|
+
motionsByStatus[v] = 0;
|
|
1420
|
+
for (const j of _commgovJsV2.values()) motionsByStatus[j.status]++;
|
|
1421
|
+
return {
|
|
1422
|
+
totalCommgovProfilesV2: _commgovPsV2.size,
|
|
1423
|
+
totalCommgovMotionsV2: _commgovJsV2.size,
|
|
1424
|
+
maxActiveCommgovProfilesPerOwner: _commgovMaxActive,
|
|
1425
|
+
maxPendingCommgovMotionsPerProfile: _commgovMaxPending,
|
|
1426
|
+
commgovProfileIdleMs: _commgovIdleMs,
|
|
1427
|
+
commgovMotionStuckMs: _commgovStuckMs,
|
|
1428
|
+
profilesByStatus,
|
|
1429
|
+
motionsByStatus,
|
|
1430
|
+
};
|
|
1431
|
+
}
|