chainlesschain 0.152.0 → 0.156.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/README.md +52 -3
- package/package.json +1 -1
- package/src/commands/a2a.js +201 -0
- package/src/commands/agent.js +1250 -0
- package/src/commands/chat.js +605 -0
- package/src/commands/cli-anything.js +426 -0
- package/src/commands/compliance.js +412 -0
- package/src/commands/config.js +213 -0
- package/src/commands/cowork.js +1463 -0
- package/src/commands/crosschain.js +203 -0
- package/src/commands/dao.js +203 -0
- package/src/commands/economy.js +199 -0
- package/src/commands/encrypt.js +201 -0
- package/src/commands/evolution.js +199 -0
- package/src/commands/evomap.js +625 -0
- package/src/commands/hmemory.js +203 -0
- package/src/commands/inference.js +207 -0
- package/src/commands/kg.js +195 -0
- package/src/commands/llm.js +209 -0
- package/src/commands/memory.js +203 -0
- package/src/commands/orchestrate.js +406 -0
- package/src/commands/pipeline.js +199 -0
- package/src/commands/planmode.js +426 -0
- package/src/commands/plugin.js +209 -0
- package/src/commands/services.js +207 -0
- package/src/commands/setup.js +205 -0
- package/src/commands/skill.js +207 -0
- package/src/commands/start.js +209 -0
- package/src/commands/stream.js +213 -0
- package/src/commands/ui.js +225 -0
- package/src/commands/workflow.js +209 -0
- package/src/index.js +112 -0
- package/src/lib/a2a-protocol.js +332 -0
- package/src/lib/agent-coordinator.js +334 -0
- package/src/lib/agent-economy.js +334 -0
- package/src/lib/agent-router.js +333 -0
- package/src/lib/autonomous-agent.js +332 -0
- package/src/lib/chat-core.js +335 -0
- package/src/lib/cli-anything-bridge.js +341 -0
- package/src/lib/cli-context-engineering.js +351 -0
- package/src/lib/compliance-manager.js +334 -0
- package/src/lib/cowork-adapter.js +336 -0
- package/src/lib/cowork-evomap-adapter.js +341 -0
- package/src/lib/cowork-mcp-tools.js +341 -0
- package/src/lib/cowork-observe-html.js +341 -0
- package/src/lib/cowork-observe.js +341 -0
- package/src/lib/cowork-task-templates.js +342 -1
- package/src/lib/cowork-template-marketplace.js +340 -0
- package/src/lib/cross-chain.js +339 -0
- package/src/lib/crypto-manager.js +334 -0
- package/src/lib/dao-governance.js +339 -0
- package/src/lib/downloader.js +334 -0
- package/src/lib/evolution-system.js +334 -0
- package/src/lib/evomap-client.js +342 -0
- package/src/lib/evomap-federation.js +338 -0
- package/src/lib/evomap-manager.js +330 -0
- package/src/lib/execution-backend.js +330 -0
- package/src/lib/hashline.js +338 -0
- package/src/lib/hierarchical-memory.js +334 -0
- package/src/lib/inference-network.js +341 -0
- package/src/lib/interaction-adapter.js +330 -0
- package/src/lib/interactive-planner.js +354 -0
- package/src/lib/knowledge-graph.js +331 -0
- package/src/lib/pipeline-orchestrator.js +332 -0
- package/src/lib/plan-mode.js +336 -0
- package/src/lib/plugin-autodiscovery.js +334 -0
- package/src/lib/process-manager.js +336 -0
- package/src/lib/provider-options.js +346 -0
- package/src/lib/provider-stream.js +348 -0
- package/src/lib/service-manager.js +337 -0
- package/src/lib/session-core-singletons.js +341 -0
- package/src/lib/skill-mcp.js +336 -0
- package/src/lib/stix-parser.js +346 -0
- package/src/lib/sub-agent-context.js +343 -0
- package/src/lib/sub-agent-profiles.js +335 -0
- package/src/lib/sub-agent-registry.js +336 -0
- package/src/lib/todo-manager.js +336 -0
- package/src/lib/web-ui-server.js +348 -0
- package/src/lib/workflow-expr.js +346 -0
- package/src/lib/ws-chat-handler.js +337 -0
package/src/lib/web-ui-server.js
CHANGED
|
@@ -1296,3 +1296,351 @@ export function createWebUIServer(opts) {
|
|
|
1296
1296
|
res.end(html, "utf-8");
|
|
1297
1297
|
});
|
|
1298
1298
|
}
|
|
1299
|
+
|
|
1300
|
+
// =====================================================================
|
|
1301
|
+
// web-ui-server V2 governance overlay (iter26)
|
|
1302
|
+
// =====================================================================
|
|
1303
|
+
export const WEBUIGOV_PROFILE_MATURITY_V2 = Object.freeze({
|
|
1304
|
+
PENDING: "pending",
|
|
1305
|
+
ACTIVE: "active",
|
|
1306
|
+
DEGRADED: "degraded",
|
|
1307
|
+
ARCHIVED: "archived",
|
|
1308
|
+
});
|
|
1309
|
+
export const WEBUIGOV_REQUEST_LIFECYCLE_V2 = Object.freeze({
|
|
1310
|
+
QUEUED: "queued",
|
|
1311
|
+
SERVING: "serving",
|
|
1312
|
+
SERVED: "served",
|
|
1313
|
+
FAILED: "failed",
|
|
1314
|
+
CANCELLED: "cancelled",
|
|
1315
|
+
});
|
|
1316
|
+
const _webuigovPTrans = new Map([
|
|
1317
|
+
[
|
|
1318
|
+
WEBUIGOV_PROFILE_MATURITY_V2.PENDING,
|
|
1319
|
+
new Set([
|
|
1320
|
+
WEBUIGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
1321
|
+
WEBUIGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
1322
|
+
]),
|
|
1323
|
+
],
|
|
1324
|
+
[
|
|
1325
|
+
WEBUIGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
1326
|
+
new Set([
|
|
1327
|
+
WEBUIGOV_PROFILE_MATURITY_V2.DEGRADED,
|
|
1328
|
+
WEBUIGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
1329
|
+
]),
|
|
1330
|
+
],
|
|
1331
|
+
[
|
|
1332
|
+
WEBUIGOV_PROFILE_MATURITY_V2.DEGRADED,
|
|
1333
|
+
new Set([
|
|
1334
|
+
WEBUIGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
1335
|
+
WEBUIGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
1336
|
+
]),
|
|
1337
|
+
],
|
|
1338
|
+
[WEBUIGOV_PROFILE_MATURITY_V2.ARCHIVED, new Set()],
|
|
1339
|
+
]);
|
|
1340
|
+
const _webuigovPTerminal = new Set([WEBUIGOV_PROFILE_MATURITY_V2.ARCHIVED]);
|
|
1341
|
+
const _webuigovJTrans = new Map([
|
|
1342
|
+
[
|
|
1343
|
+
WEBUIGOV_REQUEST_LIFECYCLE_V2.QUEUED,
|
|
1344
|
+
new Set([
|
|
1345
|
+
WEBUIGOV_REQUEST_LIFECYCLE_V2.SERVING,
|
|
1346
|
+
WEBUIGOV_REQUEST_LIFECYCLE_V2.CANCELLED,
|
|
1347
|
+
]),
|
|
1348
|
+
],
|
|
1349
|
+
[
|
|
1350
|
+
WEBUIGOV_REQUEST_LIFECYCLE_V2.SERVING,
|
|
1351
|
+
new Set([
|
|
1352
|
+
WEBUIGOV_REQUEST_LIFECYCLE_V2.SERVED,
|
|
1353
|
+
WEBUIGOV_REQUEST_LIFECYCLE_V2.FAILED,
|
|
1354
|
+
WEBUIGOV_REQUEST_LIFECYCLE_V2.CANCELLED,
|
|
1355
|
+
]),
|
|
1356
|
+
],
|
|
1357
|
+
[WEBUIGOV_REQUEST_LIFECYCLE_V2.SERVED, new Set()],
|
|
1358
|
+
[WEBUIGOV_REQUEST_LIFECYCLE_V2.FAILED, new Set()],
|
|
1359
|
+
[WEBUIGOV_REQUEST_LIFECYCLE_V2.CANCELLED, new Set()],
|
|
1360
|
+
]);
|
|
1361
|
+
const _webuigovPsV2 = new Map();
|
|
1362
|
+
const _webuigovJsV2 = new Map();
|
|
1363
|
+
let _webuigovMaxActive = 10,
|
|
1364
|
+
_webuigovMaxPending = 25,
|
|
1365
|
+
_webuigovIdleMs = 30 * 24 * 60 * 60 * 1000,
|
|
1366
|
+
_webuigovStuckMs = 60 * 1000;
|
|
1367
|
+
function _webuigovPos(n, label) {
|
|
1368
|
+
const v = Math.floor(Number(n));
|
|
1369
|
+
if (!Number.isFinite(v) || v <= 0)
|
|
1370
|
+
throw new Error(`${label} must be positive integer`);
|
|
1371
|
+
return v;
|
|
1372
|
+
}
|
|
1373
|
+
function _webuigovCheckP(from, to) {
|
|
1374
|
+
const a = _webuigovPTrans.get(from);
|
|
1375
|
+
if (!a || !a.has(to))
|
|
1376
|
+
throw new Error(`invalid webuigov profile transition ${from} → ${to}`);
|
|
1377
|
+
}
|
|
1378
|
+
function _webuigovCheckJ(from, to) {
|
|
1379
|
+
const a = _webuigovJTrans.get(from);
|
|
1380
|
+
if (!a || !a.has(to))
|
|
1381
|
+
throw new Error(`invalid webuigov request transition ${from} → ${to}`);
|
|
1382
|
+
}
|
|
1383
|
+
function _webuigovCountActive(owner) {
|
|
1384
|
+
let c = 0;
|
|
1385
|
+
for (const p of _webuigovPsV2.values())
|
|
1386
|
+
if (p.owner === owner && p.status === WEBUIGOV_PROFILE_MATURITY_V2.ACTIVE)
|
|
1387
|
+
c++;
|
|
1388
|
+
return c;
|
|
1389
|
+
}
|
|
1390
|
+
function _webuigovCountPending(profileId) {
|
|
1391
|
+
let c = 0;
|
|
1392
|
+
for (const j of _webuigovJsV2.values())
|
|
1393
|
+
if (
|
|
1394
|
+
j.profileId === profileId &&
|
|
1395
|
+
(j.status === WEBUIGOV_REQUEST_LIFECYCLE_V2.QUEUED ||
|
|
1396
|
+
j.status === WEBUIGOV_REQUEST_LIFECYCLE_V2.SERVING)
|
|
1397
|
+
)
|
|
1398
|
+
c++;
|
|
1399
|
+
return c;
|
|
1400
|
+
}
|
|
1401
|
+
export function setMaxActiveWebuigovProfilesPerOwnerV2(n) {
|
|
1402
|
+
_webuigovMaxActive = _webuigovPos(n, "maxActiveWebuigovProfilesPerOwner");
|
|
1403
|
+
}
|
|
1404
|
+
export function getMaxActiveWebuigovProfilesPerOwnerV2() {
|
|
1405
|
+
return _webuigovMaxActive;
|
|
1406
|
+
}
|
|
1407
|
+
export function setMaxPendingWebuigovRequestsPerProfileV2(n) {
|
|
1408
|
+
_webuigovMaxPending = _webuigovPos(n, "maxPendingWebuigovRequestsPerProfile");
|
|
1409
|
+
}
|
|
1410
|
+
export function getMaxPendingWebuigovRequestsPerProfileV2() {
|
|
1411
|
+
return _webuigovMaxPending;
|
|
1412
|
+
}
|
|
1413
|
+
export function setWebuigovProfileIdleMsV2(n) {
|
|
1414
|
+
_webuigovIdleMs = _webuigovPos(n, "webuigovProfileIdleMs");
|
|
1415
|
+
}
|
|
1416
|
+
export function getWebuigovProfileIdleMsV2() {
|
|
1417
|
+
return _webuigovIdleMs;
|
|
1418
|
+
}
|
|
1419
|
+
export function setWebuigovRequestStuckMsV2(n) {
|
|
1420
|
+
_webuigovStuckMs = _webuigovPos(n, "webuigovRequestStuckMs");
|
|
1421
|
+
}
|
|
1422
|
+
export function getWebuigovRequestStuckMsV2() {
|
|
1423
|
+
return _webuigovStuckMs;
|
|
1424
|
+
}
|
|
1425
|
+
export function _resetStateWebUiServerGovV2() {
|
|
1426
|
+
_webuigovPsV2.clear();
|
|
1427
|
+
_webuigovJsV2.clear();
|
|
1428
|
+
_webuigovMaxActive = 10;
|
|
1429
|
+
_webuigovMaxPending = 25;
|
|
1430
|
+
_webuigovIdleMs = 30 * 24 * 60 * 60 * 1000;
|
|
1431
|
+
_webuigovStuckMs = 60 * 1000;
|
|
1432
|
+
}
|
|
1433
|
+
export function registerWebuigovProfileV2({
|
|
1434
|
+
id,
|
|
1435
|
+
owner,
|
|
1436
|
+
endpoint,
|
|
1437
|
+
metadata,
|
|
1438
|
+
} = {}) {
|
|
1439
|
+
if (!id || !owner) throw new Error("id and owner required");
|
|
1440
|
+
if (_webuigovPsV2.has(id))
|
|
1441
|
+
throw new Error(`webuigov profile ${id} already exists`);
|
|
1442
|
+
const now = Date.now();
|
|
1443
|
+
const p = {
|
|
1444
|
+
id,
|
|
1445
|
+
owner,
|
|
1446
|
+
endpoint: endpoint || "/",
|
|
1447
|
+
status: WEBUIGOV_PROFILE_MATURITY_V2.PENDING,
|
|
1448
|
+
createdAt: now,
|
|
1449
|
+
updatedAt: now,
|
|
1450
|
+
lastTouchedAt: now,
|
|
1451
|
+
activatedAt: null,
|
|
1452
|
+
archivedAt: null,
|
|
1453
|
+
metadata: { ...(metadata || {}) },
|
|
1454
|
+
};
|
|
1455
|
+
_webuigovPsV2.set(id, p);
|
|
1456
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1457
|
+
}
|
|
1458
|
+
export function activateWebuigovProfileV2(id) {
|
|
1459
|
+
const p = _webuigovPsV2.get(id);
|
|
1460
|
+
if (!p) throw new Error(`webuigov profile ${id} not found`);
|
|
1461
|
+
const isInitial = p.status === WEBUIGOV_PROFILE_MATURITY_V2.PENDING;
|
|
1462
|
+
_webuigovCheckP(p.status, WEBUIGOV_PROFILE_MATURITY_V2.ACTIVE);
|
|
1463
|
+
if (isInitial && _webuigovCountActive(p.owner) >= _webuigovMaxActive)
|
|
1464
|
+
throw new Error(
|
|
1465
|
+
`max active webuigov profiles for owner ${p.owner} reached`,
|
|
1466
|
+
);
|
|
1467
|
+
const now = Date.now();
|
|
1468
|
+
p.status = WEBUIGOV_PROFILE_MATURITY_V2.ACTIVE;
|
|
1469
|
+
p.updatedAt = now;
|
|
1470
|
+
p.lastTouchedAt = now;
|
|
1471
|
+
if (!p.activatedAt) p.activatedAt = now;
|
|
1472
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1473
|
+
}
|
|
1474
|
+
export function degradeWebuigovProfileV2(id) {
|
|
1475
|
+
const p = _webuigovPsV2.get(id);
|
|
1476
|
+
if (!p) throw new Error(`webuigov profile ${id} not found`);
|
|
1477
|
+
_webuigovCheckP(p.status, WEBUIGOV_PROFILE_MATURITY_V2.DEGRADED);
|
|
1478
|
+
p.status = WEBUIGOV_PROFILE_MATURITY_V2.DEGRADED;
|
|
1479
|
+
p.updatedAt = Date.now();
|
|
1480
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1481
|
+
}
|
|
1482
|
+
export function archiveWebuigovProfileV2(id) {
|
|
1483
|
+
const p = _webuigovPsV2.get(id);
|
|
1484
|
+
if (!p) throw new Error(`webuigov profile ${id} not found`);
|
|
1485
|
+
_webuigovCheckP(p.status, WEBUIGOV_PROFILE_MATURITY_V2.ARCHIVED);
|
|
1486
|
+
const now = Date.now();
|
|
1487
|
+
p.status = WEBUIGOV_PROFILE_MATURITY_V2.ARCHIVED;
|
|
1488
|
+
p.updatedAt = now;
|
|
1489
|
+
if (!p.archivedAt) p.archivedAt = now;
|
|
1490
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1491
|
+
}
|
|
1492
|
+
export function touchWebuigovProfileV2(id) {
|
|
1493
|
+
const p = _webuigovPsV2.get(id);
|
|
1494
|
+
if (!p) throw new Error(`webuigov profile ${id} not found`);
|
|
1495
|
+
if (_webuigovPTerminal.has(p.status))
|
|
1496
|
+
throw new Error(`cannot touch terminal webuigov profile ${id}`);
|
|
1497
|
+
const now = Date.now();
|
|
1498
|
+
p.lastTouchedAt = now;
|
|
1499
|
+
p.updatedAt = now;
|
|
1500
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1501
|
+
}
|
|
1502
|
+
export function getWebuigovProfileV2(id) {
|
|
1503
|
+
const p = _webuigovPsV2.get(id);
|
|
1504
|
+
if (!p) return null;
|
|
1505
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
1506
|
+
}
|
|
1507
|
+
export function listWebuigovProfilesV2() {
|
|
1508
|
+
return [..._webuigovPsV2.values()].map((p) => ({
|
|
1509
|
+
...p,
|
|
1510
|
+
metadata: { ...p.metadata },
|
|
1511
|
+
}));
|
|
1512
|
+
}
|
|
1513
|
+
export function createWebuigovRequestV2({
|
|
1514
|
+
id,
|
|
1515
|
+
profileId,
|
|
1516
|
+
method,
|
|
1517
|
+
metadata,
|
|
1518
|
+
} = {}) {
|
|
1519
|
+
if (!id || !profileId) throw new Error("id and profileId required");
|
|
1520
|
+
if (_webuigovJsV2.has(id))
|
|
1521
|
+
throw new Error(`webuigov request ${id} already exists`);
|
|
1522
|
+
if (!_webuigovPsV2.has(profileId))
|
|
1523
|
+
throw new Error(`webuigov profile ${profileId} not found`);
|
|
1524
|
+
if (_webuigovCountPending(profileId) >= _webuigovMaxPending)
|
|
1525
|
+
throw new Error(
|
|
1526
|
+
`max pending webuigov requests for profile ${profileId} reached`,
|
|
1527
|
+
);
|
|
1528
|
+
const now = Date.now();
|
|
1529
|
+
const j = {
|
|
1530
|
+
id,
|
|
1531
|
+
profileId,
|
|
1532
|
+
method: method || "",
|
|
1533
|
+
status: WEBUIGOV_REQUEST_LIFECYCLE_V2.QUEUED,
|
|
1534
|
+
createdAt: now,
|
|
1535
|
+
updatedAt: now,
|
|
1536
|
+
startedAt: null,
|
|
1537
|
+
settledAt: null,
|
|
1538
|
+
metadata: { ...(metadata || {}) },
|
|
1539
|
+
};
|
|
1540
|
+
_webuigovJsV2.set(id, j);
|
|
1541
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1542
|
+
}
|
|
1543
|
+
export function servingWebuigovRequestV2(id) {
|
|
1544
|
+
const j = _webuigovJsV2.get(id);
|
|
1545
|
+
if (!j) throw new Error(`webuigov request ${id} not found`);
|
|
1546
|
+
_webuigovCheckJ(j.status, WEBUIGOV_REQUEST_LIFECYCLE_V2.SERVING);
|
|
1547
|
+
const now = Date.now();
|
|
1548
|
+
j.status = WEBUIGOV_REQUEST_LIFECYCLE_V2.SERVING;
|
|
1549
|
+
j.updatedAt = now;
|
|
1550
|
+
if (!j.startedAt) j.startedAt = now;
|
|
1551
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1552
|
+
}
|
|
1553
|
+
export function completeRequestWebuigovV2(id) {
|
|
1554
|
+
const j = _webuigovJsV2.get(id);
|
|
1555
|
+
if (!j) throw new Error(`webuigov request ${id} not found`);
|
|
1556
|
+
_webuigovCheckJ(j.status, WEBUIGOV_REQUEST_LIFECYCLE_V2.SERVED);
|
|
1557
|
+
const now = Date.now();
|
|
1558
|
+
j.status = WEBUIGOV_REQUEST_LIFECYCLE_V2.SERVED;
|
|
1559
|
+
j.updatedAt = now;
|
|
1560
|
+
if (!j.settledAt) j.settledAt = now;
|
|
1561
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1562
|
+
}
|
|
1563
|
+
export function failWebuigovRequestV2(id, reason) {
|
|
1564
|
+
const j = _webuigovJsV2.get(id);
|
|
1565
|
+
if (!j) throw new Error(`webuigov request ${id} not found`);
|
|
1566
|
+
_webuigovCheckJ(j.status, WEBUIGOV_REQUEST_LIFECYCLE_V2.FAILED);
|
|
1567
|
+
const now = Date.now();
|
|
1568
|
+
j.status = WEBUIGOV_REQUEST_LIFECYCLE_V2.FAILED;
|
|
1569
|
+
j.updatedAt = now;
|
|
1570
|
+
if (!j.settledAt) j.settledAt = now;
|
|
1571
|
+
if (reason) j.metadata.failReason = String(reason);
|
|
1572
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1573
|
+
}
|
|
1574
|
+
export function cancelWebuigovRequestV2(id, reason) {
|
|
1575
|
+
const j = _webuigovJsV2.get(id);
|
|
1576
|
+
if (!j) throw new Error(`webuigov request ${id} not found`);
|
|
1577
|
+
_webuigovCheckJ(j.status, WEBUIGOV_REQUEST_LIFECYCLE_V2.CANCELLED);
|
|
1578
|
+
const now = Date.now();
|
|
1579
|
+
j.status = WEBUIGOV_REQUEST_LIFECYCLE_V2.CANCELLED;
|
|
1580
|
+
j.updatedAt = now;
|
|
1581
|
+
if (!j.settledAt) j.settledAt = now;
|
|
1582
|
+
if (reason) j.metadata.cancelReason = String(reason);
|
|
1583
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1584
|
+
}
|
|
1585
|
+
export function getWebuigovRequestV2(id) {
|
|
1586
|
+
const j = _webuigovJsV2.get(id);
|
|
1587
|
+
if (!j) return null;
|
|
1588
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
1589
|
+
}
|
|
1590
|
+
export function listWebuigovRequestsV2() {
|
|
1591
|
+
return [..._webuigovJsV2.values()].map((j) => ({
|
|
1592
|
+
...j,
|
|
1593
|
+
metadata: { ...j.metadata },
|
|
1594
|
+
}));
|
|
1595
|
+
}
|
|
1596
|
+
export function autoDegradeIdleWebuigovProfilesV2({ now } = {}) {
|
|
1597
|
+
const t = now ?? Date.now();
|
|
1598
|
+
const flipped = [];
|
|
1599
|
+
for (const p of _webuigovPsV2.values())
|
|
1600
|
+
if (
|
|
1601
|
+
p.status === WEBUIGOV_PROFILE_MATURITY_V2.ACTIVE &&
|
|
1602
|
+
t - p.lastTouchedAt >= _webuigovIdleMs
|
|
1603
|
+
) {
|
|
1604
|
+
p.status = WEBUIGOV_PROFILE_MATURITY_V2.DEGRADED;
|
|
1605
|
+
p.updatedAt = t;
|
|
1606
|
+
flipped.push(p.id);
|
|
1607
|
+
}
|
|
1608
|
+
return { flipped, count: flipped.length };
|
|
1609
|
+
}
|
|
1610
|
+
export function autoFailStuckWebuigovRequestsV2({ now } = {}) {
|
|
1611
|
+
const t = now ?? Date.now();
|
|
1612
|
+
const flipped = [];
|
|
1613
|
+
for (const j of _webuigovJsV2.values())
|
|
1614
|
+
if (
|
|
1615
|
+
j.status === WEBUIGOV_REQUEST_LIFECYCLE_V2.SERVING &&
|
|
1616
|
+
j.startedAt != null &&
|
|
1617
|
+
t - j.startedAt >= _webuigovStuckMs
|
|
1618
|
+
) {
|
|
1619
|
+
j.status = WEBUIGOV_REQUEST_LIFECYCLE_V2.FAILED;
|
|
1620
|
+
j.updatedAt = t;
|
|
1621
|
+
if (!j.settledAt) j.settledAt = t;
|
|
1622
|
+
j.metadata.failReason = "auto-fail-stuck";
|
|
1623
|
+
flipped.push(j.id);
|
|
1624
|
+
}
|
|
1625
|
+
return { flipped, count: flipped.length };
|
|
1626
|
+
}
|
|
1627
|
+
export function getWebUiServerGovStatsV2() {
|
|
1628
|
+
const profilesByStatus = {};
|
|
1629
|
+
for (const v of Object.values(WEBUIGOV_PROFILE_MATURITY_V2))
|
|
1630
|
+
profilesByStatus[v] = 0;
|
|
1631
|
+
for (const p of _webuigovPsV2.values()) profilesByStatus[p.status]++;
|
|
1632
|
+
const requestsByStatus = {};
|
|
1633
|
+
for (const v of Object.values(WEBUIGOV_REQUEST_LIFECYCLE_V2))
|
|
1634
|
+
requestsByStatus[v] = 0;
|
|
1635
|
+
for (const j of _webuigovJsV2.values()) requestsByStatus[j.status]++;
|
|
1636
|
+
return {
|
|
1637
|
+
totalWebuigovProfilesV2: _webuigovPsV2.size,
|
|
1638
|
+
totalWebuigovRequestsV2: _webuigovJsV2.size,
|
|
1639
|
+
maxActiveWebuigovProfilesPerOwner: _webuigovMaxActive,
|
|
1640
|
+
maxPendingWebuigovRequestsPerProfile: _webuigovMaxPending,
|
|
1641
|
+
webuigovProfileIdleMs: _webuigovIdleMs,
|
|
1642
|
+
webuigovRequestStuckMs: _webuigovStuckMs,
|
|
1643
|
+
profilesByStatus,
|
|
1644
|
+
requestsByStatus,
|
|
1645
|
+
};
|
|
1646
|
+
}
|
package/src/lib/workflow-expr.js
CHANGED
|
@@ -316,3 +316,349 @@ export function evaluateRaw(src, ctx) {
|
|
|
316
316
|
if (ast.kind === "truthy") ast = ast.expr;
|
|
317
317
|
return evalAst(ast, ctx);
|
|
318
318
|
}
|
|
319
|
+
|
|
320
|
+
// =====================================================================
|
|
321
|
+
// workflow-expr V2 governance overlay (iter26)
|
|
322
|
+
// =====================================================================
|
|
323
|
+
export const WFEXGOV_PROFILE_MATURITY_V2 = Object.freeze({
|
|
324
|
+
PENDING: "pending",
|
|
325
|
+
ACTIVE: "active",
|
|
326
|
+
PAUSED: "paused",
|
|
327
|
+
ARCHIVED: "archived",
|
|
328
|
+
});
|
|
329
|
+
export const WFEXGOV_EVAL_LIFECYCLE_V2 = Object.freeze({
|
|
330
|
+
QUEUED: "queued",
|
|
331
|
+
EVALUATING: "evaluating",
|
|
332
|
+
EVALUATED: "evaluated",
|
|
333
|
+
FAILED: "failed",
|
|
334
|
+
CANCELLED: "cancelled",
|
|
335
|
+
});
|
|
336
|
+
const _wfexgovPTrans = new Map([
|
|
337
|
+
[
|
|
338
|
+
WFEXGOV_PROFILE_MATURITY_V2.PENDING,
|
|
339
|
+
new Set([
|
|
340
|
+
WFEXGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
341
|
+
WFEXGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
342
|
+
]),
|
|
343
|
+
],
|
|
344
|
+
[
|
|
345
|
+
WFEXGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
346
|
+
new Set([
|
|
347
|
+
WFEXGOV_PROFILE_MATURITY_V2.PAUSED,
|
|
348
|
+
WFEXGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
349
|
+
]),
|
|
350
|
+
],
|
|
351
|
+
[
|
|
352
|
+
WFEXGOV_PROFILE_MATURITY_V2.PAUSED,
|
|
353
|
+
new Set([
|
|
354
|
+
WFEXGOV_PROFILE_MATURITY_V2.ACTIVE,
|
|
355
|
+
WFEXGOV_PROFILE_MATURITY_V2.ARCHIVED,
|
|
356
|
+
]),
|
|
357
|
+
],
|
|
358
|
+
[WFEXGOV_PROFILE_MATURITY_V2.ARCHIVED, new Set()],
|
|
359
|
+
]);
|
|
360
|
+
const _wfexgovPTerminal = new Set([WFEXGOV_PROFILE_MATURITY_V2.ARCHIVED]);
|
|
361
|
+
const _wfexgovJTrans = new Map([
|
|
362
|
+
[
|
|
363
|
+
WFEXGOV_EVAL_LIFECYCLE_V2.QUEUED,
|
|
364
|
+
new Set([
|
|
365
|
+
WFEXGOV_EVAL_LIFECYCLE_V2.EVALUATING,
|
|
366
|
+
WFEXGOV_EVAL_LIFECYCLE_V2.CANCELLED,
|
|
367
|
+
]),
|
|
368
|
+
],
|
|
369
|
+
[
|
|
370
|
+
WFEXGOV_EVAL_LIFECYCLE_V2.EVALUATING,
|
|
371
|
+
new Set([
|
|
372
|
+
WFEXGOV_EVAL_LIFECYCLE_V2.EVALUATED,
|
|
373
|
+
WFEXGOV_EVAL_LIFECYCLE_V2.FAILED,
|
|
374
|
+
WFEXGOV_EVAL_LIFECYCLE_V2.CANCELLED,
|
|
375
|
+
]),
|
|
376
|
+
],
|
|
377
|
+
[WFEXGOV_EVAL_LIFECYCLE_V2.EVALUATED, new Set()],
|
|
378
|
+
[WFEXGOV_EVAL_LIFECYCLE_V2.FAILED, new Set()],
|
|
379
|
+
[WFEXGOV_EVAL_LIFECYCLE_V2.CANCELLED, new Set()],
|
|
380
|
+
]);
|
|
381
|
+
const _wfexgovPsV2 = new Map();
|
|
382
|
+
const _wfexgovJsV2 = new Map();
|
|
383
|
+
let _wfexgovMaxActive = 8,
|
|
384
|
+
_wfexgovMaxPending = 20,
|
|
385
|
+
_wfexgovIdleMs = 30 * 24 * 60 * 60 * 1000,
|
|
386
|
+
_wfexgovStuckMs = 60 * 1000;
|
|
387
|
+
function _wfexgovPos(n, label) {
|
|
388
|
+
const v = Math.floor(Number(n));
|
|
389
|
+
if (!Number.isFinite(v) || v <= 0)
|
|
390
|
+
throw new Error(`${label} must be positive integer`);
|
|
391
|
+
return v;
|
|
392
|
+
}
|
|
393
|
+
function _wfexgovCheckP(from, to) {
|
|
394
|
+
const a = _wfexgovPTrans.get(from);
|
|
395
|
+
if (!a || !a.has(to))
|
|
396
|
+
throw new Error(`invalid wfexgov profile transition ${from} → ${to}`);
|
|
397
|
+
}
|
|
398
|
+
function _wfexgovCheckJ(from, to) {
|
|
399
|
+
const a = _wfexgovJTrans.get(from);
|
|
400
|
+
if (!a || !a.has(to))
|
|
401
|
+
throw new Error(`invalid wfexgov eval transition ${from} → ${to}`);
|
|
402
|
+
}
|
|
403
|
+
function _wfexgovCountActive(owner) {
|
|
404
|
+
let c = 0;
|
|
405
|
+
for (const p of _wfexgovPsV2.values())
|
|
406
|
+
if (p.owner === owner && p.status === WFEXGOV_PROFILE_MATURITY_V2.ACTIVE)
|
|
407
|
+
c++;
|
|
408
|
+
return c;
|
|
409
|
+
}
|
|
410
|
+
function _wfexgovCountPending(profileId) {
|
|
411
|
+
let c = 0;
|
|
412
|
+
for (const j of _wfexgovJsV2.values())
|
|
413
|
+
if (
|
|
414
|
+
j.profileId === profileId &&
|
|
415
|
+
(j.status === WFEXGOV_EVAL_LIFECYCLE_V2.QUEUED ||
|
|
416
|
+
j.status === WFEXGOV_EVAL_LIFECYCLE_V2.EVALUATING)
|
|
417
|
+
)
|
|
418
|
+
c++;
|
|
419
|
+
return c;
|
|
420
|
+
}
|
|
421
|
+
export function setMaxActiveWfexgovProfilesPerOwnerV2(n) {
|
|
422
|
+
_wfexgovMaxActive = _wfexgovPos(n, "maxActiveWfexgovProfilesPerOwner");
|
|
423
|
+
}
|
|
424
|
+
export function getMaxActiveWfexgovProfilesPerOwnerV2() {
|
|
425
|
+
return _wfexgovMaxActive;
|
|
426
|
+
}
|
|
427
|
+
export function setMaxPendingWfexgovEvalsPerProfileV2(n) {
|
|
428
|
+
_wfexgovMaxPending = _wfexgovPos(n, "maxPendingWfexgovEvalsPerProfile");
|
|
429
|
+
}
|
|
430
|
+
export function getMaxPendingWfexgovEvalsPerProfileV2() {
|
|
431
|
+
return _wfexgovMaxPending;
|
|
432
|
+
}
|
|
433
|
+
export function setWfexgovProfileIdleMsV2(n) {
|
|
434
|
+
_wfexgovIdleMs = _wfexgovPos(n, "wfexgovProfileIdleMs");
|
|
435
|
+
}
|
|
436
|
+
export function getWfexgovProfileIdleMsV2() {
|
|
437
|
+
return _wfexgovIdleMs;
|
|
438
|
+
}
|
|
439
|
+
export function setWfexgovEvalStuckMsV2(n) {
|
|
440
|
+
_wfexgovStuckMs = _wfexgovPos(n, "wfexgovEvalStuckMs");
|
|
441
|
+
}
|
|
442
|
+
export function getWfexgovEvalStuckMsV2() {
|
|
443
|
+
return _wfexgovStuckMs;
|
|
444
|
+
}
|
|
445
|
+
export function _resetStateWorkflowExprGovV2() {
|
|
446
|
+
_wfexgovPsV2.clear();
|
|
447
|
+
_wfexgovJsV2.clear();
|
|
448
|
+
_wfexgovMaxActive = 8;
|
|
449
|
+
_wfexgovMaxPending = 20;
|
|
450
|
+
_wfexgovIdleMs = 30 * 24 * 60 * 60 * 1000;
|
|
451
|
+
_wfexgovStuckMs = 60 * 1000;
|
|
452
|
+
}
|
|
453
|
+
export function registerWfexgovProfileV2({
|
|
454
|
+
id,
|
|
455
|
+
owner,
|
|
456
|
+
language,
|
|
457
|
+
metadata,
|
|
458
|
+
} = {}) {
|
|
459
|
+
if (!id || !owner) throw new Error("id and owner required");
|
|
460
|
+
if (_wfexgovPsV2.has(id))
|
|
461
|
+
throw new Error(`wfexgov profile ${id} already exists`);
|
|
462
|
+
const now = Date.now();
|
|
463
|
+
const p = {
|
|
464
|
+
id,
|
|
465
|
+
owner,
|
|
466
|
+
language: language || "cel",
|
|
467
|
+
status: WFEXGOV_PROFILE_MATURITY_V2.PENDING,
|
|
468
|
+
createdAt: now,
|
|
469
|
+
updatedAt: now,
|
|
470
|
+
lastTouchedAt: now,
|
|
471
|
+
activatedAt: null,
|
|
472
|
+
archivedAt: null,
|
|
473
|
+
metadata: { ...(metadata || {}) },
|
|
474
|
+
};
|
|
475
|
+
_wfexgovPsV2.set(id, p);
|
|
476
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
477
|
+
}
|
|
478
|
+
export function activateWfexgovProfileV2(id) {
|
|
479
|
+
const p = _wfexgovPsV2.get(id);
|
|
480
|
+
if (!p) throw new Error(`wfexgov profile ${id} not found`);
|
|
481
|
+
const isInitial = p.status === WFEXGOV_PROFILE_MATURITY_V2.PENDING;
|
|
482
|
+
_wfexgovCheckP(p.status, WFEXGOV_PROFILE_MATURITY_V2.ACTIVE);
|
|
483
|
+
if (isInitial && _wfexgovCountActive(p.owner) >= _wfexgovMaxActive)
|
|
484
|
+
throw new Error(`max active wfexgov profiles for owner ${p.owner} reached`);
|
|
485
|
+
const now = Date.now();
|
|
486
|
+
p.status = WFEXGOV_PROFILE_MATURITY_V2.ACTIVE;
|
|
487
|
+
p.updatedAt = now;
|
|
488
|
+
p.lastTouchedAt = now;
|
|
489
|
+
if (!p.activatedAt) p.activatedAt = now;
|
|
490
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
491
|
+
}
|
|
492
|
+
export function pauseWfexgovProfileV2(id) {
|
|
493
|
+
const p = _wfexgovPsV2.get(id);
|
|
494
|
+
if (!p) throw new Error(`wfexgov profile ${id} not found`);
|
|
495
|
+
_wfexgovCheckP(p.status, WFEXGOV_PROFILE_MATURITY_V2.PAUSED);
|
|
496
|
+
p.status = WFEXGOV_PROFILE_MATURITY_V2.PAUSED;
|
|
497
|
+
p.updatedAt = Date.now();
|
|
498
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
499
|
+
}
|
|
500
|
+
export function archiveWfexgovProfileV2(id) {
|
|
501
|
+
const p = _wfexgovPsV2.get(id);
|
|
502
|
+
if (!p) throw new Error(`wfexgov profile ${id} not found`);
|
|
503
|
+
_wfexgovCheckP(p.status, WFEXGOV_PROFILE_MATURITY_V2.ARCHIVED);
|
|
504
|
+
const now = Date.now();
|
|
505
|
+
p.status = WFEXGOV_PROFILE_MATURITY_V2.ARCHIVED;
|
|
506
|
+
p.updatedAt = now;
|
|
507
|
+
if (!p.archivedAt) p.archivedAt = now;
|
|
508
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
509
|
+
}
|
|
510
|
+
export function touchWfexgovProfileV2(id) {
|
|
511
|
+
const p = _wfexgovPsV2.get(id);
|
|
512
|
+
if (!p) throw new Error(`wfexgov profile ${id} not found`);
|
|
513
|
+
if (_wfexgovPTerminal.has(p.status))
|
|
514
|
+
throw new Error(`cannot touch terminal wfexgov profile ${id}`);
|
|
515
|
+
const now = Date.now();
|
|
516
|
+
p.lastTouchedAt = now;
|
|
517
|
+
p.updatedAt = now;
|
|
518
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
519
|
+
}
|
|
520
|
+
export function getWfexgovProfileV2(id) {
|
|
521
|
+
const p = _wfexgovPsV2.get(id);
|
|
522
|
+
if (!p) return null;
|
|
523
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
524
|
+
}
|
|
525
|
+
export function listWfexgovProfilesV2() {
|
|
526
|
+
return [..._wfexgovPsV2.values()].map((p) => ({
|
|
527
|
+
...p,
|
|
528
|
+
metadata: { ...p.metadata },
|
|
529
|
+
}));
|
|
530
|
+
}
|
|
531
|
+
export function createWfexgovEvalV2({
|
|
532
|
+
id,
|
|
533
|
+
profileId,
|
|
534
|
+
expression,
|
|
535
|
+
metadata,
|
|
536
|
+
} = {}) {
|
|
537
|
+
if (!id || !profileId) throw new Error("id and profileId required");
|
|
538
|
+
if (_wfexgovJsV2.has(id))
|
|
539
|
+
throw new Error(`wfexgov eval ${id} already exists`);
|
|
540
|
+
if (!_wfexgovPsV2.has(profileId))
|
|
541
|
+
throw new Error(`wfexgov profile ${profileId} not found`);
|
|
542
|
+
if (_wfexgovCountPending(profileId) >= _wfexgovMaxPending)
|
|
543
|
+
throw new Error(
|
|
544
|
+
`max pending wfexgov evals for profile ${profileId} reached`,
|
|
545
|
+
);
|
|
546
|
+
const now = Date.now();
|
|
547
|
+
const j = {
|
|
548
|
+
id,
|
|
549
|
+
profileId,
|
|
550
|
+
expression: expression || "",
|
|
551
|
+
status: WFEXGOV_EVAL_LIFECYCLE_V2.QUEUED,
|
|
552
|
+
createdAt: now,
|
|
553
|
+
updatedAt: now,
|
|
554
|
+
startedAt: null,
|
|
555
|
+
settledAt: null,
|
|
556
|
+
metadata: { ...(metadata || {}) },
|
|
557
|
+
};
|
|
558
|
+
_wfexgovJsV2.set(id, j);
|
|
559
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
560
|
+
}
|
|
561
|
+
export function evaluatingWfexgovEvalV2(id) {
|
|
562
|
+
const j = _wfexgovJsV2.get(id);
|
|
563
|
+
if (!j) throw new Error(`wfexgov eval ${id} not found`);
|
|
564
|
+
_wfexgovCheckJ(j.status, WFEXGOV_EVAL_LIFECYCLE_V2.EVALUATING);
|
|
565
|
+
const now = Date.now();
|
|
566
|
+
j.status = WFEXGOV_EVAL_LIFECYCLE_V2.EVALUATING;
|
|
567
|
+
j.updatedAt = now;
|
|
568
|
+
if (!j.startedAt) j.startedAt = now;
|
|
569
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
570
|
+
}
|
|
571
|
+
export function completeEvalWfexgovV2(id) {
|
|
572
|
+
const j = _wfexgovJsV2.get(id);
|
|
573
|
+
if (!j) throw new Error(`wfexgov eval ${id} not found`);
|
|
574
|
+
_wfexgovCheckJ(j.status, WFEXGOV_EVAL_LIFECYCLE_V2.EVALUATED);
|
|
575
|
+
const now = Date.now();
|
|
576
|
+
j.status = WFEXGOV_EVAL_LIFECYCLE_V2.EVALUATED;
|
|
577
|
+
j.updatedAt = now;
|
|
578
|
+
if (!j.settledAt) j.settledAt = now;
|
|
579
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
580
|
+
}
|
|
581
|
+
export function failWfexgovEvalV2(id, reason) {
|
|
582
|
+
const j = _wfexgovJsV2.get(id);
|
|
583
|
+
if (!j) throw new Error(`wfexgov eval ${id} not found`);
|
|
584
|
+
_wfexgovCheckJ(j.status, WFEXGOV_EVAL_LIFECYCLE_V2.FAILED);
|
|
585
|
+
const now = Date.now();
|
|
586
|
+
j.status = WFEXGOV_EVAL_LIFECYCLE_V2.FAILED;
|
|
587
|
+
j.updatedAt = now;
|
|
588
|
+
if (!j.settledAt) j.settledAt = now;
|
|
589
|
+
if (reason) j.metadata.failReason = String(reason);
|
|
590
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
591
|
+
}
|
|
592
|
+
export function cancelWfexgovEvalV2(id, reason) {
|
|
593
|
+
const j = _wfexgovJsV2.get(id);
|
|
594
|
+
if (!j) throw new Error(`wfexgov eval ${id} not found`);
|
|
595
|
+
_wfexgovCheckJ(j.status, WFEXGOV_EVAL_LIFECYCLE_V2.CANCELLED);
|
|
596
|
+
const now = Date.now();
|
|
597
|
+
j.status = WFEXGOV_EVAL_LIFECYCLE_V2.CANCELLED;
|
|
598
|
+
j.updatedAt = now;
|
|
599
|
+
if (!j.settledAt) j.settledAt = now;
|
|
600
|
+
if (reason) j.metadata.cancelReason = String(reason);
|
|
601
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
602
|
+
}
|
|
603
|
+
export function getWfexgovEvalV2(id) {
|
|
604
|
+
const j = _wfexgovJsV2.get(id);
|
|
605
|
+
if (!j) return null;
|
|
606
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
607
|
+
}
|
|
608
|
+
export function listWfexgovEvalsV2() {
|
|
609
|
+
return [..._wfexgovJsV2.values()].map((j) => ({
|
|
610
|
+
...j,
|
|
611
|
+
metadata: { ...j.metadata },
|
|
612
|
+
}));
|
|
613
|
+
}
|
|
614
|
+
export function autoPauseIdleWfexgovProfilesV2({ now } = {}) {
|
|
615
|
+
const t = now ?? Date.now();
|
|
616
|
+
const flipped = [];
|
|
617
|
+
for (const p of _wfexgovPsV2.values())
|
|
618
|
+
if (
|
|
619
|
+
p.status === WFEXGOV_PROFILE_MATURITY_V2.ACTIVE &&
|
|
620
|
+
t - p.lastTouchedAt >= _wfexgovIdleMs
|
|
621
|
+
) {
|
|
622
|
+
p.status = WFEXGOV_PROFILE_MATURITY_V2.PAUSED;
|
|
623
|
+
p.updatedAt = t;
|
|
624
|
+
flipped.push(p.id);
|
|
625
|
+
}
|
|
626
|
+
return { flipped, count: flipped.length };
|
|
627
|
+
}
|
|
628
|
+
export function autoFailStuckWfexgovEvalsV2({ now } = {}) {
|
|
629
|
+
const t = now ?? Date.now();
|
|
630
|
+
const flipped = [];
|
|
631
|
+
for (const j of _wfexgovJsV2.values())
|
|
632
|
+
if (
|
|
633
|
+
j.status === WFEXGOV_EVAL_LIFECYCLE_V2.EVALUATING &&
|
|
634
|
+
j.startedAt != null &&
|
|
635
|
+
t - j.startedAt >= _wfexgovStuckMs
|
|
636
|
+
) {
|
|
637
|
+
j.status = WFEXGOV_EVAL_LIFECYCLE_V2.FAILED;
|
|
638
|
+
j.updatedAt = t;
|
|
639
|
+
if (!j.settledAt) j.settledAt = t;
|
|
640
|
+
j.metadata.failReason = "auto-fail-stuck";
|
|
641
|
+
flipped.push(j.id);
|
|
642
|
+
}
|
|
643
|
+
return { flipped, count: flipped.length };
|
|
644
|
+
}
|
|
645
|
+
export function getWorkflowExprGovStatsV2() {
|
|
646
|
+
const profilesByStatus = {};
|
|
647
|
+
for (const v of Object.values(WFEXGOV_PROFILE_MATURITY_V2))
|
|
648
|
+
profilesByStatus[v] = 0;
|
|
649
|
+
for (const p of _wfexgovPsV2.values()) profilesByStatus[p.status]++;
|
|
650
|
+
const evalsByStatus = {};
|
|
651
|
+
for (const v of Object.values(WFEXGOV_EVAL_LIFECYCLE_V2))
|
|
652
|
+
evalsByStatus[v] = 0;
|
|
653
|
+
for (const j of _wfexgovJsV2.values()) evalsByStatus[j.status]++;
|
|
654
|
+
return {
|
|
655
|
+
totalWfexgovProfilesV2: _wfexgovPsV2.size,
|
|
656
|
+
totalWfexgovEvalsV2: _wfexgovJsV2.size,
|
|
657
|
+
maxActiveWfexgovProfilesPerOwner: _wfexgovMaxActive,
|
|
658
|
+
maxPendingWfexgovEvalsPerProfile: _wfexgovMaxPending,
|
|
659
|
+
wfexgovProfileIdleMs: _wfexgovIdleMs,
|
|
660
|
+
wfexgovEvalStuckMs: _wfexgovStuckMs,
|
|
661
|
+
profilesByStatus,
|
|
662
|
+
evalsByStatus,
|
|
663
|
+
};
|
|
664
|
+
}
|