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
|
@@ -950,3 +950,341 @@ export function _resetStateV2() {
|
|
|
950
950
|
_pfBridgeIdleMs = PF_DEFAULT_BRIDGE_IDLE_MS;
|
|
951
951
|
_pfTranslationStuckMs = PF_DEFAULT_TRANSLATION_STUCK_MS;
|
|
952
952
|
}
|
|
953
|
+
|
|
954
|
+
// =====================================================================
|
|
955
|
+
// protocol-fusion V2 governance overlay (iter23)
|
|
956
|
+
// =====================================================================
|
|
957
|
+
export const PFGOV_PROFILE_MATURITY_V2 = Object.freeze({
|
|
958
|
+
PENDING: "pending",
|
|
959
|
+
ACTIVE: "active",
|
|
960
|
+
DEGRADED: "degraded",
|
|
961
|
+
ARCHIVED: "archived",
|
|
962
|
+
});
|
|
963
|
+
export const PFGOV_ROUTE_LIFECYCLE_V2 = Object.freeze({
|
|
964
|
+
QUEUED: "queued",
|
|
965
|
+
ROUTING: "routing",
|
|
966
|
+
ROUTED: "routed",
|
|
967
|
+
FAILED: "failed",
|
|
968
|
+
CANCELLED: "cancelled",
|
|
969
|
+
});
|
|
970
|
+
const _pfgovPTrans = new Map([
|
|
971
|
+
[
|
|
972
|
+
PFGOV_PROFILE_MATURITY_V2.PENDING,
|
|
973
|
+
new Set([
|
|
974
|
+
PFGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
975
|
+
PFGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
976
|
+
]),
|
|
977
|
+
],
|
|
978
|
+
[
|
|
979
|
+
PFGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
980
|
+
new Set([
|
|
981
|
+
PFGOV_PROFILE_MATURITY_V2.DEGRADED,
|
|
982
|
+
PFGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
983
|
+
]),
|
|
984
|
+
],
|
|
985
|
+
[
|
|
986
|
+
PFGOV_PROFILE_MATURITY_V2.DEGRADED,
|
|
987
|
+
new Set([
|
|
988
|
+
PFGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
989
|
+
PFGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
990
|
+
]),
|
|
991
|
+
],
|
|
992
|
+
[PFGOV_PROFILE_MATURITY_V2.ARCHIVED, new Set()],
|
|
993
|
+
]);
|
|
994
|
+
const _pfgovPTerminal = new Set([PFGOV_PROFILE_MATURITY_V2.ARCHIVED]);
|
|
995
|
+
const _pfgovJTrans = new Map([
|
|
996
|
+
[
|
|
997
|
+
PFGOV_ROUTE_LIFECYCLE_V2.QUEUED,
|
|
998
|
+
new Set([
|
|
999
|
+
PFGOV_ROUTE_LIFECYCLE_V2.ROUTING,
|
|
1000
|
+
PFGOV_ROUTE_LIFECYCLE_V2.CANCELLED,
|
|
1001
|
+
]),
|
|
1002
|
+
],
|
|
1003
|
+
[
|
|
1004
|
+
PFGOV_ROUTE_LIFECYCLE_V2.ROUTING,
|
|
1005
|
+
new Set([
|
|
1006
|
+
PFGOV_ROUTE_LIFECYCLE_V2.ROUTED,
|
|
1007
|
+
PFGOV_ROUTE_LIFECYCLE_V2.FAILED,
|
|
1008
|
+
PFGOV_ROUTE_LIFECYCLE_V2.CANCELLED,
|
|
1009
|
+
]),
|
|
1010
|
+
],
|
|
1011
|
+
[PFGOV_ROUTE_LIFECYCLE_V2.ROUTED, new Set()],
|
|
1012
|
+
[PFGOV_ROUTE_LIFECYCLE_V2.FAILED, new Set()],
|
|
1013
|
+
[PFGOV_ROUTE_LIFECYCLE_V2.CANCELLED, new Set()],
|
|
1014
|
+
]);
|
|
1015
|
+
const _pfgovPsV2 = new Map();
|
|
1016
|
+
const _pfgovJsV2 = new Map();
|
|
1017
|
+
let _pfgovMaxActive = 6,
|
|
1018
|
+
_pfgovMaxPending = 15,
|
|
1019
|
+
_pfgovIdleMs = 30 * 24 * 60 * 60 * 1000,
|
|
1020
|
+
_pfgovStuckMs = 60 * 1000;
|
|
1021
|
+
function _pfgovPos(n, label) {
|
|
1022
|
+
const v = Math.floor(Number(n));
|
|
1023
|
+
if (!Number.isFinite(v) || v <= 0)
|
|
1024
|
+
throw new Error(`${label} must be positive integer`);
|
|
1025
|
+
return v;
|
|
1026
|
+
}
|
|
1027
|
+
function _pfgovCheckP(from, to) {
|
|
1028
|
+
const a = _pfgovPTrans.get(from);
|
|
1029
|
+
if (!a || !a.has(to))
|
|
1030
|
+
throw new Error(`invalid pfgov profile transition ${from} → ${to}`);
|
|
1031
|
+
}
|
|
1032
|
+
function _pfgovCheckJ(from, to) {
|
|
1033
|
+
const a = _pfgovJTrans.get(from);
|
|
1034
|
+
if (!a || !a.has(to))
|
|
1035
|
+
throw new Error(`invalid pfgov route transition ${from} → ${to}`);
|
|
1036
|
+
}
|
|
1037
|
+
function _pfgovCountActive(owner) {
|
|
1038
|
+
let c = 0;
|
|
1039
|
+
for (const p of _pfgovPsV2.values())
|
|
1040
|
+
if (p.owner === owner && p.status === PFGOV_PROFILE_MATURITY_V2.ACTIVE) c++;
|
|
1041
|
+
return c;
|
|
1042
|
+
}
|
|
1043
|
+
function _pfgovCountPending(profileId) {
|
|
1044
|
+
let c = 0;
|
|
1045
|
+
for (const j of _pfgovJsV2.values())
|
|
1046
|
+
if (
|
|
1047
|
+
j.profileId === profileId &&
|
|
1048
|
+
(j.status === PFGOV_ROUTE_LIFECYCLE_V2.QUEUED ||
|
|
1049
|
+
j.status === PFGOV_ROUTE_LIFECYCLE_V2.ROUTING)
|
|
1050
|
+
)
|
|
1051
|
+
c++;
|
|
1052
|
+
return c;
|
|
1053
|
+
}
|
|
1054
|
+
export function setMaxActivePfgovProfilesPerOwnerV2(n) {
|
|
1055
|
+
_pfgovMaxActive = _pfgovPos(n, "maxActivePfgovProfilesPerOwner");
|
|
1056
|
+
}
|
|
1057
|
+
export function getMaxActivePfgovProfilesPerOwnerV2() {
|
|
1058
|
+
return _pfgovMaxActive;
|
|
1059
|
+
}
|
|
1060
|
+
export function setMaxPendingPfgovRoutesPerProfileV2(n) {
|
|
1061
|
+
_pfgovMaxPending = _pfgovPos(n, "maxPendingPfgovRoutesPerProfile");
|
|
1062
|
+
}
|
|
1063
|
+
export function getMaxPendingPfgovRoutesPerProfileV2() {
|
|
1064
|
+
return _pfgovMaxPending;
|
|
1065
|
+
}
|
|
1066
|
+
export function setPfgovProfileIdleMsV2(n) {
|
|
1067
|
+
_pfgovIdleMs = _pfgovPos(n, "pfgovProfileIdleMs");
|
|
1068
|
+
}
|
|
1069
|
+
export function getPfgovProfileIdleMsV2() {
|
|
1070
|
+
return _pfgovIdleMs;
|
|
1071
|
+
}
|
|
1072
|
+
export function setPfgovRouteStuckMsV2(n) {
|
|
1073
|
+
_pfgovStuckMs = _pfgovPos(n, "pfgovRouteStuckMs");
|
|
1074
|
+
}
|
|
1075
|
+
export function getPfgovRouteStuckMsV2() {
|
|
1076
|
+
return _pfgovStuckMs;
|
|
1077
|
+
}
|
|
1078
|
+
export function _resetStateProtocolFusionGovV2() {
|
|
1079
|
+
_pfgovPsV2.clear();
|
|
1080
|
+
_pfgovJsV2.clear();
|
|
1081
|
+
_pfgovMaxActive = 6;
|
|
1082
|
+
_pfgovMaxPending = 15;
|
|
1083
|
+
_pfgovIdleMs = 30 * 24 * 60 * 60 * 1000;
|
|
1084
|
+
_pfgovStuckMs = 60 * 1000;
|
|
1085
|
+
}
|
|
1086
|
+
export function registerPfgovProfileV2({ id, owner, protocol, metadata } = {}) {
|
|
1087
|
+
if (!id || !owner) throw new Error("id and owner required");
|
|
1088
|
+
if (_pfgovPsV2.has(id)) throw new Error(`pfgov profile ${id} already exists`);
|
|
1089
|
+
const now = Date.now();
|
|
1090
|
+
const p = {
|
|
1091
|
+
id,
|
|
1092
|
+
owner,
|
|
1093
|
+
protocol: protocol || "hybrid",
|
|
1094
|
+
status: PFGOV_PROFILE_MATURITY_V2.PENDING,
|
|
1095
|
+
createdAt: now,
|
|
1096
|
+
updatedAt: now,
|
|
1097
|
+
lastTouchedAt: now,
|
|
1098
|
+
activatedAt: null,
|
|
1099
|
+
archivedAt: null,
|
|
1100
|
+
metadata: { ...(metadata || {}) },
|
|
1101
|
+
};
|
|
1102
|
+
_pfgovPsV2.set(id, p);
|
|
1103
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1104
|
+
}
|
|
1105
|
+
export function activatePfgovProfileV2(id) {
|
|
1106
|
+
const p = _pfgovPsV2.get(id);
|
|
1107
|
+
if (!p) throw new Error(`pfgov profile ${id} not found`);
|
|
1108
|
+
const isInitial = p.status === PFGOV_PROFILE_MATURITY_V2.PENDING;
|
|
1109
|
+
_pfgovCheckP(p.status, PFGOV_PROFILE_MATURITY_V2.ACTIVE);
|
|
1110
|
+
if (isInitial && _pfgovCountActive(p.owner) >= _pfgovMaxActive)
|
|
1111
|
+
throw new Error(`max active pfgov profiles for owner ${p.owner} reached`);
|
|
1112
|
+
const now = Date.now();
|
|
1113
|
+
p.status = PFGOV_PROFILE_MATURITY_V2.ACTIVE;
|
|
1114
|
+
p.updatedAt = now;
|
|
1115
|
+
p.lastTouchedAt = now;
|
|
1116
|
+
if (!p.activatedAt) p.activatedAt = now;
|
|
1117
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1118
|
+
}
|
|
1119
|
+
export function degradePfgovProfileV2(id) {
|
|
1120
|
+
const p = _pfgovPsV2.get(id);
|
|
1121
|
+
if (!p) throw new Error(`pfgov profile ${id} not found`);
|
|
1122
|
+
_pfgovCheckP(p.status, PFGOV_PROFILE_MATURITY_V2.DEGRADED);
|
|
1123
|
+
p.status = PFGOV_PROFILE_MATURITY_V2.DEGRADED;
|
|
1124
|
+
p.updatedAt = Date.now();
|
|
1125
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1126
|
+
}
|
|
1127
|
+
export function archivePfgovProfileV2(id) {
|
|
1128
|
+
const p = _pfgovPsV2.get(id);
|
|
1129
|
+
if (!p) throw new Error(`pfgov profile ${id} not found`);
|
|
1130
|
+
_pfgovCheckP(p.status, PFGOV_PROFILE_MATURITY_V2.ARCHIVED);
|
|
1131
|
+
const now = Date.now();
|
|
1132
|
+
p.status = PFGOV_PROFILE_MATURITY_V2.ARCHIVED;
|
|
1133
|
+
p.updatedAt = now;
|
|
1134
|
+
if (!p.archivedAt) p.archivedAt = now;
|
|
1135
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1136
|
+
}
|
|
1137
|
+
export function touchPfgovProfileV2(id) {
|
|
1138
|
+
const p = _pfgovPsV2.get(id);
|
|
1139
|
+
if (!p) throw new Error(`pfgov profile ${id} not found`);
|
|
1140
|
+
if (_pfgovPTerminal.has(p.status))
|
|
1141
|
+
throw new Error(`cannot touch terminal pfgov profile ${id}`);
|
|
1142
|
+
const now = Date.now();
|
|
1143
|
+
p.lastTouchedAt = now;
|
|
1144
|
+
p.updatedAt = now;
|
|
1145
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1146
|
+
}
|
|
1147
|
+
export function getPfgovProfileV2(id) {
|
|
1148
|
+
const p = _pfgovPsV2.get(id);
|
|
1149
|
+
if (!p) return null;
|
|
1150
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1151
|
+
}
|
|
1152
|
+
export function listPfgovProfilesV2() {
|
|
1153
|
+
return [..._pfgovPsV2.values()].map((p) => ({
|
|
1154
|
+
...p,
|
|
1155
|
+
metadata: { ...p.metadata },
|
|
1156
|
+
}));
|
|
1157
|
+
}
|
|
1158
|
+
export function createPfgovRouteV2({
|
|
1159
|
+
id,
|
|
1160
|
+
profileId,
|
|
1161
|
+
destination,
|
|
1162
|
+
metadata,
|
|
1163
|
+
} = {}) {
|
|
1164
|
+
if (!id || !profileId) throw new Error("id and profileId required");
|
|
1165
|
+
if (_pfgovJsV2.has(id)) throw new Error(`pfgov route ${id} already exists`);
|
|
1166
|
+
if (!_pfgovPsV2.has(profileId))
|
|
1167
|
+
throw new Error(`pfgov profile ${profileId} not found`);
|
|
1168
|
+
if (_pfgovCountPending(profileId) >= _pfgovMaxPending)
|
|
1169
|
+
throw new Error(
|
|
1170
|
+
`max pending pfgov routes for profile ${profileId} reached`,
|
|
1171
|
+
);
|
|
1172
|
+
const now = Date.now();
|
|
1173
|
+
const j = {
|
|
1174
|
+
id,
|
|
1175
|
+
profileId,
|
|
1176
|
+
destination: destination || "",
|
|
1177
|
+
status: PFGOV_ROUTE_LIFECYCLE_V2.QUEUED,
|
|
1178
|
+
createdAt: now,
|
|
1179
|
+
updatedAt: now,
|
|
1180
|
+
startedAt: null,
|
|
1181
|
+
settledAt: null,
|
|
1182
|
+
metadata: { ...(metadata || {}) },
|
|
1183
|
+
};
|
|
1184
|
+
_pfgovJsV2.set(id, j);
|
|
1185
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1186
|
+
}
|
|
1187
|
+
export function routingPfgovRouteV2(id) {
|
|
1188
|
+
const j = _pfgovJsV2.get(id);
|
|
1189
|
+
if (!j) throw new Error(`pfgov route ${id} not found`);
|
|
1190
|
+
_pfgovCheckJ(j.status, PFGOV_ROUTE_LIFECYCLE_V2.ROUTING);
|
|
1191
|
+
const now = Date.now();
|
|
1192
|
+
j.status = PFGOV_ROUTE_LIFECYCLE_V2.ROUTING;
|
|
1193
|
+
j.updatedAt = now;
|
|
1194
|
+
if (!j.startedAt) j.startedAt = now;
|
|
1195
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1196
|
+
}
|
|
1197
|
+
export function completeRoutePfgovV2(id) {
|
|
1198
|
+
const j = _pfgovJsV2.get(id);
|
|
1199
|
+
if (!j) throw new Error(`pfgov route ${id} not found`);
|
|
1200
|
+
_pfgovCheckJ(j.status, PFGOV_ROUTE_LIFECYCLE_V2.ROUTED);
|
|
1201
|
+
const now = Date.now();
|
|
1202
|
+
j.status = PFGOV_ROUTE_LIFECYCLE_V2.ROUTED;
|
|
1203
|
+
j.updatedAt = now;
|
|
1204
|
+
if (!j.settledAt) j.settledAt = now;
|
|
1205
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1206
|
+
}
|
|
1207
|
+
export function failPfgovRouteV2(id, reason) {
|
|
1208
|
+
const j = _pfgovJsV2.get(id);
|
|
1209
|
+
if (!j) throw new Error(`pfgov route ${id} not found`);
|
|
1210
|
+
_pfgovCheckJ(j.status, PFGOV_ROUTE_LIFECYCLE_V2.FAILED);
|
|
1211
|
+
const now = Date.now();
|
|
1212
|
+
j.status = PFGOV_ROUTE_LIFECYCLE_V2.FAILED;
|
|
1213
|
+
j.updatedAt = now;
|
|
1214
|
+
if (!j.settledAt) j.settledAt = now;
|
|
1215
|
+
if (reason) j.metadata.failReason = String(reason);
|
|
1216
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1217
|
+
}
|
|
1218
|
+
export function cancelPfgovRouteV2(id, reason) {
|
|
1219
|
+
const j = _pfgovJsV2.get(id);
|
|
1220
|
+
if (!j) throw new Error(`pfgov route ${id} not found`);
|
|
1221
|
+
_pfgovCheckJ(j.status, PFGOV_ROUTE_LIFECYCLE_V2.CANCELLED);
|
|
1222
|
+
const now = Date.now();
|
|
1223
|
+
j.status = PFGOV_ROUTE_LIFECYCLE_V2.CANCELLED;
|
|
1224
|
+
j.updatedAt = now;
|
|
1225
|
+
if (!j.settledAt) j.settledAt = now;
|
|
1226
|
+
if (reason) j.metadata.cancelReason = String(reason);
|
|
1227
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1228
|
+
}
|
|
1229
|
+
export function getPfgovRouteV2(id) {
|
|
1230
|
+
const j = _pfgovJsV2.get(id);
|
|
1231
|
+
if (!j) return null;
|
|
1232
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1233
|
+
}
|
|
1234
|
+
export function listPfgovRoutesV2() {
|
|
1235
|
+
return [..._pfgovJsV2.values()].map((j) => ({
|
|
1236
|
+
...j,
|
|
1237
|
+
metadata: { ...j.metadata },
|
|
1238
|
+
}));
|
|
1239
|
+
}
|
|
1240
|
+
export function autoDegradeIdlePfgovProfilesV2({ now } = {}) {
|
|
1241
|
+
const t = now ?? Date.now();
|
|
1242
|
+
const flipped = [];
|
|
1243
|
+
for (const p of _pfgovPsV2.values())
|
|
1244
|
+
if (
|
|
1245
|
+
p.status === PFGOV_PROFILE_MATURITY_V2.ACTIVE &&
|
|
1246
|
+
t - p.lastTouchedAt >= _pfgovIdleMs
|
|
1247
|
+
) {
|
|
1248
|
+
p.status = PFGOV_PROFILE_MATURITY_V2.DEGRADED;
|
|
1249
|
+
p.updatedAt = t;
|
|
1250
|
+
flipped.push(p.id);
|
|
1251
|
+
}
|
|
1252
|
+
return { flipped, count: flipped.length };
|
|
1253
|
+
}
|
|
1254
|
+
export function autoFailStuckPfgovRoutesV2({ now } = {}) {
|
|
1255
|
+
const t = now ?? Date.now();
|
|
1256
|
+
const flipped = [];
|
|
1257
|
+
for (const j of _pfgovJsV2.values())
|
|
1258
|
+
if (
|
|
1259
|
+
j.status === PFGOV_ROUTE_LIFECYCLE_V2.ROUTING &&
|
|
1260
|
+
j.startedAt != null &&
|
|
1261
|
+
t - j.startedAt >= _pfgovStuckMs
|
|
1262
|
+
) {
|
|
1263
|
+
j.status = PFGOV_ROUTE_LIFECYCLE_V2.FAILED;
|
|
1264
|
+
j.updatedAt = t;
|
|
1265
|
+
if (!j.settledAt) j.settledAt = t;
|
|
1266
|
+
j.metadata.failReason = "auto-fail-stuck";
|
|
1267
|
+
flipped.push(j.id);
|
|
1268
|
+
}
|
|
1269
|
+
return { flipped, count: flipped.length };
|
|
1270
|
+
}
|
|
1271
|
+
export function getProtocolFusionGovStatsV2() {
|
|
1272
|
+
const profilesByStatus = {};
|
|
1273
|
+
for (const v of Object.values(PFGOV_PROFILE_MATURITY_V2))
|
|
1274
|
+
profilesByStatus[v] = 0;
|
|
1275
|
+
for (const p of _pfgovPsV2.values()) profilesByStatus[p.status]++;
|
|
1276
|
+
const routesByStatus = {};
|
|
1277
|
+
for (const v of Object.values(PFGOV_ROUTE_LIFECYCLE_V2))
|
|
1278
|
+
routesByStatus[v] = 0;
|
|
1279
|
+
for (const j of _pfgovJsV2.values()) routesByStatus[j.status]++;
|
|
1280
|
+
return {
|
|
1281
|
+
totalPfgovProfilesV2: _pfgovPsV2.size,
|
|
1282
|
+
totalPfgovRoutesV2: _pfgovJsV2.size,
|
|
1283
|
+
maxActivePfgovProfilesPerOwner: _pfgovMaxActive,
|
|
1284
|
+
maxPendingPfgovRoutesPerProfile: _pfgovMaxPending,
|
|
1285
|
+
pfgovProfileIdleMs: _pfgovIdleMs,
|
|
1286
|
+
pfgovRouteStuckMs: _pfgovStuckMs,
|
|
1287
|
+
profilesByStatus,
|
|
1288
|
+
routesByStatus,
|
|
1289
|
+
};
|
|
1290
|
+
}
|
package/src/lib/quantization.js
CHANGED
|
@@ -685,3 +685,340 @@ export function _resetStateV2() {
|
|
|
685
685
|
_modelsV2.clear();
|
|
686
686
|
_jobTicketsV2.clear();
|
|
687
687
|
}
|
|
688
|
+
|
|
689
|
+
// =====================================================================
|
|
690
|
+
// quantization V2 governance overlay (iter18)
|
|
691
|
+
// =====================================================================
|
|
692
|
+
export const QNTGOV_PROFILE_MATURITY_V2 = Object.freeze({
|
|
693
|
+
PENDING: "pending",
|
|
694
|
+
ACTIVE: "active",
|
|
695
|
+
STALE: "stale",
|
|
696
|
+
ARCHIVED: "archived",
|
|
697
|
+
});
|
|
698
|
+
export const QNTGOV_JOB_LIFECYCLE_V2 = Object.freeze({
|
|
699
|
+
QUEUED: "queued",
|
|
700
|
+
QUANTIZING: "quantizing",
|
|
701
|
+
QUANTIZED: "quantized",
|
|
702
|
+
FAILED: "failed",
|
|
703
|
+
CANCELLED: "cancelled",
|
|
704
|
+
});
|
|
705
|
+
const _qntgovPTrans = new Map([
|
|
706
|
+
[
|
|
707
|
+
QNTGOV_PROFILE_MATURITY_V2.PENDING,
|
|
708
|
+
new Set([
|
|
709
|
+
QNTGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
710
|
+
QNTGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
711
|
+
]),
|
|
712
|
+
],
|
|
713
|
+
[
|
|
714
|
+
QNTGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
715
|
+
new Set([
|
|
716
|
+
QNTGOV_PROFILE_MATURITY_V2.STALE,
|
|
717
|
+
QNTGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
718
|
+
]),
|
|
719
|
+
],
|
|
720
|
+
[
|
|
721
|
+
QNTGOV_PROFILE_MATURITY_V2.STALE,
|
|
722
|
+
new Set([
|
|
723
|
+
QNTGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
724
|
+
QNTGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
725
|
+
]),
|
|
726
|
+
],
|
|
727
|
+
[QNTGOV_PROFILE_MATURITY_V2.ARCHIVED, new Set()],
|
|
728
|
+
]);
|
|
729
|
+
const _qntgovPTerminal = new Set([QNTGOV_PROFILE_MATURITY_V2.ARCHIVED]);
|
|
730
|
+
const _qntgovJTrans = new Map([
|
|
731
|
+
[
|
|
732
|
+
QNTGOV_JOB_LIFECYCLE_V2.QUEUED,
|
|
733
|
+
new Set([
|
|
734
|
+
QNTGOV_JOB_LIFECYCLE_V2.QUANTIZING,
|
|
735
|
+
QNTGOV_JOB_LIFECYCLE_V2.CANCELLED,
|
|
736
|
+
]),
|
|
737
|
+
],
|
|
738
|
+
[
|
|
739
|
+
QNTGOV_JOB_LIFECYCLE_V2.QUANTIZING,
|
|
740
|
+
new Set([
|
|
741
|
+
QNTGOV_JOB_LIFECYCLE_V2.QUANTIZED,
|
|
742
|
+
QNTGOV_JOB_LIFECYCLE_V2.FAILED,
|
|
743
|
+
QNTGOV_JOB_LIFECYCLE_V2.CANCELLED,
|
|
744
|
+
]),
|
|
745
|
+
],
|
|
746
|
+
[QNTGOV_JOB_LIFECYCLE_V2.QUANTIZED, new Set()],
|
|
747
|
+
[QNTGOV_JOB_LIFECYCLE_V2.FAILED, new Set()],
|
|
748
|
+
[QNTGOV_JOB_LIFECYCLE_V2.CANCELLED, new Set()],
|
|
749
|
+
]);
|
|
750
|
+
const _qntgovPsV2 = new Map();
|
|
751
|
+
const _qntgovJsV2 = new Map();
|
|
752
|
+
let _qntgovMaxActive = 6,
|
|
753
|
+
_qntgovMaxPending = 12,
|
|
754
|
+
_qntgovIdleMs = 30 * 24 * 60 * 60 * 1000,
|
|
755
|
+
_qntgovStuckMs = 60 * 1000;
|
|
756
|
+
function _qntgovPos(n, label) {
|
|
757
|
+
const v = Math.floor(Number(n));
|
|
758
|
+
if (!Number.isFinite(v) || v <= 0)
|
|
759
|
+
throw new Error(`${label} must be positive integer`);
|
|
760
|
+
return v;
|
|
761
|
+
}
|
|
762
|
+
function _qntgovCheckP(from, to) {
|
|
763
|
+
const a = _qntgovPTrans.get(from);
|
|
764
|
+
if (!a || !a.has(to))
|
|
765
|
+
throw new Error(`invalid qntgov profile transition ${from} → ${to}`);
|
|
766
|
+
}
|
|
767
|
+
function _qntgovCheckJ(from, to) {
|
|
768
|
+
const a = _qntgovJTrans.get(from);
|
|
769
|
+
if (!a || !a.has(to))
|
|
770
|
+
throw new Error(`invalid qntgov job transition ${from} → ${to}`);
|
|
771
|
+
}
|
|
772
|
+
function _qntgovCountActive(owner) {
|
|
773
|
+
let c = 0;
|
|
774
|
+
for (const p of _qntgovPsV2.values())
|
|
775
|
+
if (p.owner === owner && p.status === QNTGOV_PROFILE_MATURITY_V2.ACTIVE)
|
|
776
|
+
c++;
|
|
777
|
+
return c;
|
|
778
|
+
}
|
|
779
|
+
function _qntgovCountPending(profileId) {
|
|
780
|
+
let c = 0;
|
|
781
|
+
for (const j of _qntgovJsV2.values())
|
|
782
|
+
if (
|
|
783
|
+
j.profileId === profileId &&
|
|
784
|
+
(j.status === QNTGOV_JOB_LIFECYCLE_V2.QUEUED ||
|
|
785
|
+
j.status === QNTGOV_JOB_LIFECYCLE_V2.QUANTIZING)
|
|
786
|
+
)
|
|
787
|
+
c++;
|
|
788
|
+
return c;
|
|
789
|
+
}
|
|
790
|
+
export function setMaxActiveQntgovProfilesPerOwnerV2(n) {
|
|
791
|
+
_qntgovMaxActive = _qntgovPos(n, "maxActiveQntgovProfilesPerOwner");
|
|
792
|
+
}
|
|
793
|
+
export function getMaxActiveQntgovProfilesPerOwnerV2() {
|
|
794
|
+
return _qntgovMaxActive;
|
|
795
|
+
}
|
|
796
|
+
export function setMaxPendingQntgovJobsPerProfileV2(n) {
|
|
797
|
+
_qntgovMaxPending = _qntgovPos(n, "maxPendingQntgovJobsPerProfile");
|
|
798
|
+
}
|
|
799
|
+
export function getMaxPendingQntgovJobsPerProfileV2() {
|
|
800
|
+
return _qntgovMaxPending;
|
|
801
|
+
}
|
|
802
|
+
export function setQntgovProfileIdleMsV2(n) {
|
|
803
|
+
_qntgovIdleMs = _qntgovPos(n, "qntgovProfileIdleMs");
|
|
804
|
+
}
|
|
805
|
+
export function getQntgovProfileIdleMsV2() {
|
|
806
|
+
return _qntgovIdleMs;
|
|
807
|
+
}
|
|
808
|
+
export function setQntgovJobStuckMsV2(n) {
|
|
809
|
+
_qntgovStuckMs = _qntgovPos(n, "qntgovJobStuckMs");
|
|
810
|
+
}
|
|
811
|
+
export function getQntgovJobStuckMsV2() {
|
|
812
|
+
return _qntgovStuckMs;
|
|
813
|
+
}
|
|
814
|
+
export function _resetStateQuantizationGovV2() {
|
|
815
|
+
_qntgovPsV2.clear();
|
|
816
|
+
_qntgovJsV2.clear();
|
|
817
|
+
_qntgovMaxActive = 6;
|
|
818
|
+
_qntgovMaxPending = 12;
|
|
819
|
+
_qntgovIdleMs = 30 * 24 * 60 * 60 * 1000;
|
|
820
|
+
_qntgovStuckMs = 60 * 1000;
|
|
821
|
+
}
|
|
822
|
+
export function registerQntgovProfileV2({
|
|
823
|
+
id,
|
|
824
|
+
owner,
|
|
825
|
+
precision,
|
|
826
|
+
metadata,
|
|
827
|
+
} = {}) {
|
|
828
|
+
if (!id || !owner) throw new Error("id and owner required");
|
|
829
|
+
if (_qntgovPsV2.has(id))
|
|
830
|
+
throw new Error(`qntgov profile ${id} already exists`);
|
|
831
|
+
const now = Date.now();
|
|
832
|
+
const p = {
|
|
833
|
+
id,
|
|
834
|
+
owner,
|
|
835
|
+
precision: precision || "int8",
|
|
836
|
+
status: QNTGOV_PROFILE_MATURITY_V2.PENDING,
|
|
837
|
+
createdAt: now,
|
|
838
|
+
updatedAt: now,
|
|
839
|
+
lastTouchedAt: now,
|
|
840
|
+
activatedAt: null,
|
|
841
|
+
archivedAt: null,
|
|
842
|
+
metadata: { ...(metadata || {}) },
|
|
843
|
+
};
|
|
844
|
+
_qntgovPsV2.set(id, p);
|
|
845
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
846
|
+
}
|
|
847
|
+
export function activateQntgovProfileV2(id) {
|
|
848
|
+
const p = _qntgovPsV2.get(id);
|
|
849
|
+
if (!p) throw new Error(`qntgov profile ${id} not found`);
|
|
850
|
+
const isInitial = p.status === QNTGOV_PROFILE_MATURITY_V2.PENDING;
|
|
851
|
+
_qntgovCheckP(p.status, QNTGOV_PROFILE_MATURITY_V2.ACTIVE);
|
|
852
|
+
if (isInitial && _qntgovCountActive(p.owner) >= _qntgovMaxActive)
|
|
853
|
+
throw new Error(`max active qntgov profiles for owner ${p.owner} reached`);
|
|
854
|
+
const now = Date.now();
|
|
855
|
+
p.status = QNTGOV_PROFILE_MATURITY_V2.ACTIVE;
|
|
856
|
+
p.updatedAt = now;
|
|
857
|
+
p.lastTouchedAt = now;
|
|
858
|
+
if (!p.activatedAt) p.activatedAt = now;
|
|
859
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
860
|
+
}
|
|
861
|
+
export function staleQntgovProfileV2(id) {
|
|
862
|
+
const p = _qntgovPsV2.get(id);
|
|
863
|
+
if (!p) throw new Error(`qntgov profile ${id} not found`);
|
|
864
|
+
_qntgovCheckP(p.status, QNTGOV_PROFILE_MATURITY_V2.STALE);
|
|
865
|
+
p.status = QNTGOV_PROFILE_MATURITY_V2.STALE;
|
|
866
|
+
p.updatedAt = Date.now();
|
|
867
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
868
|
+
}
|
|
869
|
+
export function archiveQntgovProfileV2(id) {
|
|
870
|
+
const p = _qntgovPsV2.get(id);
|
|
871
|
+
if (!p) throw new Error(`qntgov profile ${id} not found`);
|
|
872
|
+
_qntgovCheckP(p.status, QNTGOV_PROFILE_MATURITY_V2.ARCHIVED);
|
|
873
|
+
const now = Date.now();
|
|
874
|
+
p.status = QNTGOV_PROFILE_MATURITY_V2.ARCHIVED;
|
|
875
|
+
p.updatedAt = now;
|
|
876
|
+
if (!p.archivedAt) p.archivedAt = now;
|
|
877
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
878
|
+
}
|
|
879
|
+
export function touchQntgovProfileV2(id) {
|
|
880
|
+
const p = _qntgovPsV2.get(id);
|
|
881
|
+
if (!p) throw new Error(`qntgov profile ${id} not found`);
|
|
882
|
+
if (_qntgovPTerminal.has(p.status))
|
|
883
|
+
throw new Error(`cannot touch terminal qntgov profile ${id}`);
|
|
884
|
+
const now = Date.now();
|
|
885
|
+
p.lastTouchedAt = now;
|
|
886
|
+
p.updatedAt = now;
|
|
887
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
888
|
+
}
|
|
889
|
+
export function getQntgovProfileV2(id) {
|
|
890
|
+
const p = _qntgovPsV2.get(id);
|
|
891
|
+
if (!p) return null;
|
|
892
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
893
|
+
}
|
|
894
|
+
export function listQntgovProfilesV2() {
|
|
895
|
+
return [..._qntgovPsV2.values()].map((p) => ({
|
|
896
|
+
...p,
|
|
897
|
+
metadata: { ...p.metadata },
|
|
898
|
+
}));
|
|
899
|
+
}
|
|
900
|
+
export function createQntgovJobV2({ id, profileId, model, metadata } = {}) {
|
|
901
|
+
if (!id || !profileId) throw new Error("id and profileId required");
|
|
902
|
+
if (_qntgovJsV2.has(id)) throw new Error(`qntgov job ${id} already exists`);
|
|
903
|
+
if (!_qntgovPsV2.has(profileId))
|
|
904
|
+
throw new Error(`qntgov profile ${profileId} not found`);
|
|
905
|
+
if (_qntgovCountPending(profileId) >= _qntgovMaxPending)
|
|
906
|
+
throw new Error(`max pending qntgov jobs for profile ${profileId} reached`);
|
|
907
|
+
const now = Date.now();
|
|
908
|
+
const j = {
|
|
909
|
+
id,
|
|
910
|
+
profileId,
|
|
911
|
+
model: model || "",
|
|
912
|
+
status: QNTGOV_JOB_LIFECYCLE_V2.QUEUED,
|
|
913
|
+
createdAt: now,
|
|
914
|
+
updatedAt: now,
|
|
915
|
+
startedAt: null,
|
|
916
|
+
settledAt: null,
|
|
917
|
+
metadata: { ...(metadata || {}) },
|
|
918
|
+
};
|
|
919
|
+
_qntgovJsV2.set(id, j);
|
|
920
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
921
|
+
}
|
|
922
|
+
export function quantizingQntgovJobV2(id) {
|
|
923
|
+
const j = _qntgovJsV2.get(id);
|
|
924
|
+
if (!j) throw new Error(`qntgov job ${id} not found`);
|
|
925
|
+
_qntgovCheckJ(j.status, QNTGOV_JOB_LIFECYCLE_V2.QUANTIZING);
|
|
926
|
+
const now = Date.now();
|
|
927
|
+
j.status = QNTGOV_JOB_LIFECYCLE_V2.QUANTIZING;
|
|
928
|
+
j.updatedAt = now;
|
|
929
|
+
if (!j.startedAt) j.startedAt = now;
|
|
930
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
931
|
+
}
|
|
932
|
+
export function completeJobQntgovV2(id) {
|
|
933
|
+
const j = _qntgovJsV2.get(id);
|
|
934
|
+
if (!j) throw new Error(`qntgov job ${id} not found`);
|
|
935
|
+
_qntgovCheckJ(j.status, QNTGOV_JOB_LIFECYCLE_V2.QUANTIZED);
|
|
936
|
+
const now = Date.now();
|
|
937
|
+
j.status = QNTGOV_JOB_LIFECYCLE_V2.QUANTIZED;
|
|
938
|
+
j.updatedAt = now;
|
|
939
|
+
if (!j.settledAt) j.settledAt = now;
|
|
940
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
941
|
+
}
|
|
942
|
+
export function failQntgovJobV2(id, reason) {
|
|
943
|
+
const j = _qntgovJsV2.get(id);
|
|
944
|
+
if (!j) throw new Error(`qntgov job ${id} not found`);
|
|
945
|
+
_qntgovCheckJ(j.status, QNTGOV_JOB_LIFECYCLE_V2.FAILED);
|
|
946
|
+
const now = Date.now();
|
|
947
|
+
j.status = QNTGOV_JOB_LIFECYCLE_V2.FAILED;
|
|
948
|
+
j.updatedAt = now;
|
|
949
|
+
if (!j.settledAt) j.settledAt = now;
|
|
950
|
+
if (reason) j.metadata.failReason = String(reason);
|
|
951
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
952
|
+
}
|
|
953
|
+
export function cancelQntgovJobV2(id, reason) {
|
|
954
|
+
const j = _qntgovJsV2.get(id);
|
|
955
|
+
if (!j) throw new Error(`qntgov job ${id} not found`);
|
|
956
|
+
_qntgovCheckJ(j.status, QNTGOV_JOB_LIFECYCLE_V2.CANCELLED);
|
|
957
|
+
const now = Date.now();
|
|
958
|
+
j.status = QNTGOV_JOB_LIFECYCLE_V2.CANCELLED;
|
|
959
|
+
j.updatedAt = now;
|
|
960
|
+
if (!j.settledAt) j.settledAt = now;
|
|
961
|
+
if (reason) j.metadata.cancelReason = String(reason);
|
|
962
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
963
|
+
}
|
|
964
|
+
export function getQntgovJobV2(id) {
|
|
965
|
+
const j = _qntgovJsV2.get(id);
|
|
966
|
+
if (!j) return null;
|
|
967
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
968
|
+
}
|
|
969
|
+
export function listQntgovJobsV2() {
|
|
970
|
+
return [..._qntgovJsV2.values()].map((j) => ({
|
|
971
|
+
...j,
|
|
972
|
+
metadata: { ...j.metadata },
|
|
973
|
+
}));
|
|
974
|
+
}
|
|
975
|
+
export function autoStaleIdleQntgovProfilesV2({ now } = {}) {
|
|
976
|
+
const t = now ?? Date.now();
|
|
977
|
+
const flipped = [];
|
|
978
|
+
for (const p of _qntgovPsV2.values())
|
|
979
|
+
if (
|
|
980
|
+
p.status === QNTGOV_PROFILE_MATURITY_V2.ACTIVE &&
|
|
981
|
+
t - p.lastTouchedAt >= _qntgovIdleMs
|
|
982
|
+
) {
|
|
983
|
+
p.status = QNTGOV_PROFILE_MATURITY_V2.STALE;
|
|
984
|
+
p.updatedAt = t;
|
|
985
|
+
flipped.push(p.id);
|
|
986
|
+
}
|
|
987
|
+
return { flipped, count: flipped.length };
|
|
988
|
+
}
|
|
989
|
+
export function autoFailStuckQntgovJobsV2({ now } = {}) {
|
|
990
|
+
const t = now ?? Date.now();
|
|
991
|
+
const flipped = [];
|
|
992
|
+
for (const j of _qntgovJsV2.values())
|
|
993
|
+
if (
|
|
994
|
+
j.status === QNTGOV_JOB_LIFECYCLE_V2.QUANTIZING &&
|
|
995
|
+
j.startedAt != null &&
|
|
996
|
+
t - j.startedAt >= _qntgovStuckMs
|
|
997
|
+
) {
|
|
998
|
+
j.status = QNTGOV_JOB_LIFECYCLE_V2.FAILED;
|
|
999
|
+
j.updatedAt = t;
|
|
1000
|
+
if (!j.settledAt) j.settledAt = t;
|
|
1001
|
+
j.metadata.failReason = "auto-fail-stuck";
|
|
1002
|
+
flipped.push(j.id);
|
|
1003
|
+
}
|
|
1004
|
+
return { flipped, count: flipped.length };
|
|
1005
|
+
}
|
|
1006
|
+
export function getQuantizationGovStatsV2() {
|
|
1007
|
+
const profilesByStatus = {};
|
|
1008
|
+
for (const v of Object.values(QNTGOV_PROFILE_MATURITY_V2))
|
|
1009
|
+
profilesByStatus[v] = 0;
|
|
1010
|
+
for (const p of _qntgovPsV2.values()) profilesByStatus[p.status]++;
|
|
1011
|
+
const jobsByStatus = {};
|
|
1012
|
+
for (const v of Object.values(QNTGOV_JOB_LIFECYCLE_V2)) jobsByStatus[v] = 0;
|
|
1013
|
+
for (const j of _qntgovJsV2.values()) jobsByStatus[j.status]++;
|
|
1014
|
+
return {
|
|
1015
|
+
totalQntgovProfilesV2: _qntgovPsV2.size,
|
|
1016
|
+
totalQntgovJobsV2: _qntgovJsV2.size,
|
|
1017
|
+
maxActiveQntgovProfilesPerOwner: _qntgovMaxActive,
|
|
1018
|
+
maxPendingQntgovJobsPerProfile: _qntgovMaxPending,
|
|
1019
|
+
qntgovProfileIdleMs: _qntgovIdleMs,
|
|
1020
|
+
qntgovJobStuckMs: _qntgovStuckMs,
|
|
1021
|
+
profilesByStatus,
|
|
1022
|
+
jobsByStatus,
|
|
1023
|
+
};
|
|
1024
|
+
}
|