chainlesschain 0.132.0 → 0.145.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/a2a.js +230 -0
- package/src/commands/activitypub.js +191 -0
- package/src/commands/agent.js +601 -0
- package/src/commands/audit.js +206 -0
- package/src/commands/bi.js +186 -0
- package/src/commands/bm25.js +162 -0
- package/src/commands/browse.js +225 -0
- package/src/commands/ccron.js +178 -0
- package/src/commands/chat.js +207 -0
- package/src/commands/compliance.js +420 -0
- package/src/commands/compt.js +176 -0
- package/src/commands/consol.js +237 -0
- package/src/commands/cowork.js +588 -0
- package/src/commands/crosschain.js +216 -0
- package/src/commands/dao.js +216 -0
- package/src/commands/dlp.js +206 -0
- package/src/commands/economy.js +211 -0
- package/src/commands/evolution.js +209 -0
- package/src/commands/evomap.js +216 -0
- package/src/commands/fflag.js +230 -0
- package/src/commands/git.js +185 -0
- package/src/commands/hardening.js +209 -0
- package/src/commands/hmemory.js +210 -0
- package/src/commands/incentive.js +209 -0
- package/src/commands/inference.js +178 -0
- package/src/commands/itbudget.js +161 -0
- package/src/commands/kg.js +206 -0
- package/src/commands/lowcode.js +201 -0
- package/src/commands/marketplace.js +206 -0
- package/src/commands/matrix.js +214 -0
- package/src/commands/mcpscaf.js +153 -0
- package/src/commands/meminj.js +153 -0
- package/src/commands/nostr.js +213 -0
- package/src/commands/orchestrate.js +217 -0
- package/src/commands/orchgov.js +156 -0
- package/src/commands/pdfp.js +160 -0
- package/src/commands/perf.js +176 -0
- package/src/commands/perm.js +156 -0
- package/src/commands/pipeline.js +211 -0
- package/src/commands/planmode.js +154 -0
- package/src/commands/privacy.js +203 -0
- package/src/commands/promcomp.js +166 -0
- package/src/commands/recommend.js +185 -0
- package/src/commands/reputation.js +208 -0
- package/src/commands/sandbox.js +206 -0
- package/src/commands/seshhook.js +153 -0
- package/src/commands/seshsearch.js +149 -0
- package/src/commands/seshtail.js +152 -0
- package/src/commands/seshu.js +160 -0
- package/src/commands/sganal.js +172 -0
- package/src/commands/siem.js +207 -0
- package/src/commands/sla.js +212 -0
- package/src/commands/slotfill.js +154 -0
- package/src/commands/social.js +159 -0
- package/src/commands/stress.js +206 -0
- package/src/commands/svccont.js +157 -0
- package/src/commands/terraform.js +206 -0
- package/src/commands/tms.js +183 -0
- package/src/commands/topiccls.js +158 -0
- package/src/commands/uprof.js +154 -0
- package/src/commands/vcheck.js +172 -0
- package/src/commands/webfetch.js +150 -0
- package/src/commands/zkp.js +218 -0
- package/src/harness/prompt-compressor.js +331 -0
- package/src/index.js +101 -1
- package/src/lib/a2a-protocol.js +373 -0
- package/src/lib/activitypub-bridge.js +343 -0
- package/src/lib/agent-economy.js +358 -0
- package/src/lib/app-builder.js +338 -0
- package/src/lib/audit-logger.js +321 -0
- package/src/lib/autonomous-agent.js +341 -0
- package/src/lib/bi-engine.js +339 -0
- package/src/lib/bm25-search.js +333 -0
- package/src/lib/browser-automation.js +352 -0
- package/src/lib/chat-core.js +336 -0
- package/src/lib/claude-code-bridge.js +341 -0
- package/src/lib/compliance-framework-reporter.js +359 -0
- package/src/lib/compliance-manager.js +330 -0
- package/src/lib/compression-telemetry.js +333 -0
- package/src/lib/content-recommender.js +370 -0
- package/src/lib/cowork-cron.js +330 -0
- package/src/lib/cowork-learning.js +333 -0
- package/src/lib/cowork-task-runner.js +362 -0
- package/src/lib/cowork-workflow.js +327 -0
- package/src/lib/cross-chain.js +365 -0
- package/src/lib/dao-governance.js +339 -0
- package/src/lib/dlp-engine.js +343 -0
- package/src/lib/evolution-system.js +336 -0
- package/src/lib/evomap-manager.js +339 -0
- package/src/lib/execution-backend.js +351 -0
- package/src/lib/feature-flags.js +330 -0
- package/src/lib/git-integration.js +343 -0
- package/src/lib/hardening-manager.js +341 -0
- package/src/lib/hierarchical-memory.js +341 -0
- package/src/lib/inference-network.js +362 -0
- package/src/lib/iteration-budget.js +357 -0
- package/src/lib/knowledge-graph.js +333 -0
- package/src/lib/matrix-bridge.js +339 -0
- package/src/lib/mcp-scaffold.js +345 -0
- package/src/lib/memory-injection.js +320 -0
- package/src/lib/nostr-bridge.js +342 -0
- package/src/lib/orchestrator.js +350 -0
- package/src/lib/pdf-parser.js +330 -0
- package/src/lib/perf-tuning.js +364 -0
- package/src/lib/permission-engine.js +319 -0
- package/src/lib/pipeline-orchestrator.js +345 -0
- package/src/lib/plan-mode.js +328 -0
- package/src/lib/privacy-computing.js +335 -0
- package/src/lib/prompt-compressor.js +1 -10
- package/src/lib/reputation-optimizer.js +340 -0
- package/src/lib/sandbox-v2.js +327 -0
- package/src/lib/service-container.js +342 -0
- package/src/lib/session-consolidator.js +352 -0
- package/src/lib/session-hooks.js +340 -0
- package/src/lib/session-search.js +334 -0
- package/src/lib/session-tail.js +320 -0
- package/src/lib/session-usage.js +329 -0
- package/src/lib/siem-exporter.js +352 -0
- package/src/lib/skill-marketplace.js +345 -0
- package/src/lib/sla-manager.js +341 -0
- package/src/lib/slot-filler.js +333 -0
- package/src/lib/social-graph-analytics.js +327 -0
- package/src/lib/social-graph.js +304 -0
- package/src/lib/stress-tester.js +342 -0
- package/src/lib/sub-agent-registry.js +359 -0
- package/src/lib/task-model-selector.js +333 -0
- package/src/lib/terraform-manager.js +333 -0
- package/src/lib/todo-manager.js +339 -0
- package/src/lib/token-incentive.js +341 -0
- package/src/lib/topic-classifier.js +353 -0
- package/src/lib/user-profile.js +325 -0
- package/src/lib/version-checker.js +335 -0
- package/src/lib/web-fetch.js +322 -0
- package/src/lib/zkp-engine.js +342 -0
|
@@ -123,3 +123,355 @@ export async function consolidateJsonlSession(sessionId, options = {}) {
|
|
|
123
123
|
},
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
|
+
|
|
127
|
+
// ===== V2 Surface: Session Consolidator governance overlay (CLI v0.134.0) =====
|
|
128
|
+
export const CONSOL_PROFILE_MATURITY_V2 = Object.freeze({
|
|
129
|
+
PENDING: "pending",
|
|
130
|
+
ACTIVE: "active",
|
|
131
|
+
PAUSED: "paused",
|
|
132
|
+
ARCHIVED: "archived",
|
|
133
|
+
});
|
|
134
|
+
export const CONSOL_JOB_LIFECYCLE_V2 = Object.freeze({
|
|
135
|
+
QUEUED: "queued",
|
|
136
|
+
RUNNING: "running",
|
|
137
|
+
COMPLETED: "completed",
|
|
138
|
+
FAILED: "failed",
|
|
139
|
+
CANCELLED: "cancelled",
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
const _scProfTrans = new Map([
|
|
143
|
+
[
|
|
144
|
+
CONSOL_PROFILE_MATURITY_V2.PENDING,
|
|
145
|
+
new Set([
|
|
146
|
+
CONSOL_PROFILE_MATURITY_V2.ACTIVE,
|
|
147
|
+
CONSOL_PROFILE_MATURITY_V2.ARCHIVED,
|
|
148
|
+
]),
|
|
149
|
+
],
|
|
150
|
+
[
|
|
151
|
+
CONSOL_PROFILE_MATURITY_V2.ACTIVE,
|
|
152
|
+
new Set([
|
|
153
|
+
CONSOL_PROFILE_MATURITY_V2.PAUSED,
|
|
154
|
+
CONSOL_PROFILE_MATURITY_V2.ARCHIVED,
|
|
155
|
+
]),
|
|
156
|
+
],
|
|
157
|
+
[
|
|
158
|
+
CONSOL_PROFILE_MATURITY_V2.PAUSED,
|
|
159
|
+
new Set([
|
|
160
|
+
CONSOL_PROFILE_MATURITY_V2.ACTIVE,
|
|
161
|
+
CONSOL_PROFILE_MATURITY_V2.ARCHIVED,
|
|
162
|
+
]),
|
|
163
|
+
],
|
|
164
|
+
[CONSOL_PROFILE_MATURITY_V2.ARCHIVED, new Set()],
|
|
165
|
+
]);
|
|
166
|
+
const _scProfTerminal = new Set([CONSOL_PROFILE_MATURITY_V2.ARCHIVED]);
|
|
167
|
+
const _scJobTrans = new Map([
|
|
168
|
+
[
|
|
169
|
+
CONSOL_JOB_LIFECYCLE_V2.QUEUED,
|
|
170
|
+
new Set([
|
|
171
|
+
CONSOL_JOB_LIFECYCLE_V2.RUNNING,
|
|
172
|
+
CONSOL_JOB_LIFECYCLE_V2.CANCELLED,
|
|
173
|
+
]),
|
|
174
|
+
],
|
|
175
|
+
[
|
|
176
|
+
CONSOL_JOB_LIFECYCLE_V2.RUNNING,
|
|
177
|
+
new Set([
|
|
178
|
+
CONSOL_JOB_LIFECYCLE_V2.COMPLETED,
|
|
179
|
+
CONSOL_JOB_LIFECYCLE_V2.FAILED,
|
|
180
|
+
CONSOL_JOB_LIFECYCLE_V2.CANCELLED,
|
|
181
|
+
]),
|
|
182
|
+
],
|
|
183
|
+
[CONSOL_JOB_LIFECYCLE_V2.COMPLETED, new Set()],
|
|
184
|
+
[CONSOL_JOB_LIFECYCLE_V2.FAILED, new Set()],
|
|
185
|
+
[CONSOL_JOB_LIFECYCLE_V2.CANCELLED, new Set()],
|
|
186
|
+
]);
|
|
187
|
+
|
|
188
|
+
const _scProfiles = new Map();
|
|
189
|
+
const _scJobs = new Map();
|
|
190
|
+
let _scMaxActivePerOwner = 8;
|
|
191
|
+
let _scMaxPendingPerProfile = 12;
|
|
192
|
+
let _scProfileIdleMs = 7 * 24 * 60 * 60 * 1000;
|
|
193
|
+
let _scJobStuckMs = 10 * 60 * 1000;
|
|
194
|
+
|
|
195
|
+
function _scPos(n, lbl) {
|
|
196
|
+
const v = Math.floor(Number(n));
|
|
197
|
+
if (!Number.isFinite(v) || v <= 0)
|
|
198
|
+
throw new Error(`${lbl} must be positive integer`);
|
|
199
|
+
return v;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export function setMaxActiveConsolProfilesPerOwnerV2(n) {
|
|
203
|
+
_scMaxActivePerOwner = _scPos(n, "maxActiveConsolProfilesPerOwner");
|
|
204
|
+
}
|
|
205
|
+
export function getMaxActiveConsolProfilesPerOwnerV2() {
|
|
206
|
+
return _scMaxActivePerOwner;
|
|
207
|
+
}
|
|
208
|
+
export function setMaxPendingConsolJobsPerProfileV2(n) {
|
|
209
|
+
_scMaxPendingPerProfile = _scPos(n, "maxPendingConsolJobsPerProfile");
|
|
210
|
+
}
|
|
211
|
+
export function getMaxPendingConsolJobsPerProfileV2() {
|
|
212
|
+
return _scMaxPendingPerProfile;
|
|
213
|
+
}
|
|
214
|
+
export function setConsolProfileIdleMsV2(n) {
|
|
215
|
+
_scProfileIdleMs = _scPos(n, "consolProfileIdleMs");
|
|
216
|
+
}
|
|
217
|
+
export function getConsolProfileIdleMsV2() {
|
|
218
|
+
return _scProfileIdleMs;
|
|
219
|
+
}
|
|
220
|
+
export function setConsolJobStuckMsV2(n) {
|
|
221
|
+
_scJobStuckMs = _scPos(n, "consolJobStuckMs");
|
|
222
|
+
}
|
|
223
|
+
export function getConsolJobStuckMsV2() {
|
|
224
|
+
return _scJobStuckMs;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export function _resetStateSessionConsolidatorV2() {
|
|
228
|
+
_scProfiles.clear();
|
|
229
|
+
_scJobs.clear();
|
|
230
|
+
_scMaxActivePerOwner = 8;
|
|
231
|
+
_scMaxPendingPerProfile = 12;
|
|
232
|
+
_scProfileIdleMs = 7 * 24 * 60 * 60 * 1000;
|
|
233
|
+
_scJobStuckMs = 10 * 60 * 1000;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export function registerConsolProfileV2({ id, owner, scope, metadata } = {}) {
|
|
237
|
+
if (!id || typeof id !== "string") throw new Error("id is required");
|
|
238
|
+
if (!owner || typeof owner !== "string") throw new Error("owner is required");
|
|
239
|
+
if (_scProfiles.has(id))
|
|
240
|
+
throw new Error(`consol profile ${id} already registered`);
|
|
241
|
+
const now = Date.now();
|
|
242
|
+
const p = {
|
|
243
|
+
id,
|
|
244
|
+
owner,
|
|
245
|
+
scope: scope || "agent",
|
|
246
|
+
status: CONSOL_PROFILE_MATURITY_V2.PENDING,
|
|
247
|
+
createdAt: now,
|
|
248
|
+
updatedAt: now,
|
|
249
|
+
activatedAt: null,
|
|
250
|
+
archivedAt: null,
|
|
251
|
+
lastTouchedAt: now,
|
|
252
|
+
metadata: { ...(metadata || {}) },
|
|
253
|
+
};
|
|
254
|
+
_scProfiles.set(id, p);
|
|
255
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
256
|
+
}
|
|
257
|
+
function _scCheckP(from, to) {
|
|
258
|
+
const a = _scProfTrans.get(from);
|
|
259
|
+
if (!a || !a.has(to))
|
|
260
|
+
throw new Error(`invalid consol profile transition ${from} → ${to}`);
|
|
261
|
+
}
|
|
262
|
+
function _scCountActive(owner) {
|
|
263
|
+
let n = 0;
|
|
264
|
+
for (const p of _scProfiles.values())
|
|
265
|
+
if (p.owner === owner && p.status === CONSOL_PROFILE_MATURITY_V2.ACTIVE)
|
|
266
|
+
n++;
|
|
267
|
+
return n;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export function activateConsolProfileV2(id) {
|
|
271
|
+
const p = _scProfiles.get(id);
|
|
272
|
+
if (!p) throw new Error(`consol profile ${id} not found`);
|
|
273
|
+
_scCheckP(p.status, CONSOL_PROFILE_MATURITY_V2.ACTIVE);
|
|
274
|
+
const recovery = p.status === CONSOL_PROFILE_MATURITY_V2.PAUSED;
|
|
275
|
+
if (!recovery) {
|
|
276
|
+
const a = _scCountActive(p.owner);
|
|
277
|
+
if (a >= _scMaxActivePerOwner)
|
|
278
|
+
throw new Error(
|
|
279
|
+
`max active consol profiles per owner (${_scMaxActivePerOwner}) reached for ${p.owner}`,
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
const now = Date.now();
|
|
283
|
+
p.status = CONSOL_PROFILE_MATURITY_V2.ACTIVE;
|
|
284
|
+
p.updatedAt = now;
|
|
285
|
+
p.lastTouchedAt = now;
|
|
286
|
+
if (!p.activatedAt) p.activatedAt = now;
|
|
287
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
288
|
+
}
|
|
289
|
+
export function pauseConsolProfileV2(id) {
|
|
290
|
+
const p = _scProfiles.get(id);
|
|
291
|
+
if (!p) throw new Error(`consol profile ${id} not found`);
|
|
292
|
+
_scCheckP(p.status, CONSOL_PROFILE_MATURITY_V2.PAUSED);
|
|
293
|
+
p.status = CONSOL_PROFILE_MATURITY_V2.PAUSED;
|
|
294
|
+
p.updatedAt = Date.now();
|
|
295
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
296
|
+
}
|
|
297
|
+
export function archiveConsolProfileV2(id) {
|
|
298
|
+
const p = _scProfiles.get(id);
|
|
299
|
+
if (!p) throw new Error(`consol profile ${id} not found`);
|
|
300
|
+
_scCheckP(p.status, CONSOL_PROFILE_MATURITY_V2.ARCHIVED);
|
|
301
|
+
const now = Date.now();
|
|
302
|
+
p.status = CONSOL_PROFILE_MATURITY_V2.ARCHIVED;
|
|
303
|
+
p.updatedAt = now;
|
|
304
|
+
if (!p.archivedAt) p.archivedAt = now;
|
|
305
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
306
|
+
}
|
|
307
|
+
export function touchConsolProfileV2(id) {
|
|
308
|
+
const p = _scProfiles.get(id);
|
|
309
|
+
if (!p) throw new Error(`consol profile ${id} not found`);
|
|
310
|
+
if (_scProfTerminal.has(p.status))
|
|
311
|
+
throw new Error(`cannot touch terminal consol profile ${id}`);
|
|
312
|
+
const now = Date.now();
|
|
313
|
+
p.lastTouchedAt = now;
|
|
314
|
+
p.updatedAt = now;
|
|
315
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
316
|
+
}
|
|
317
|
+
export function getConsolProfileV2(id) {
|
|
318
|
+
const p = _scProfiles.get(id);
|
|
319
|
+
if (!p) return null;
|
|
320
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
321
|
+
}
|
|
322
|
+
export function listConsolProfilesV2() {
|
|
323
|
+
return [..._scProfiles.values()].map((p) => ({
|
|
324
|
+
...p,
|
|
325
|
+
metadata: { ...p.metadata },
|
|
326
|
+
}));
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function _scCountPending(pid) {
|
|
330
|
+
let n = 0;
|
|
331
|
+
for (const j of _scJobs.values())
|
|
332
|
+
if (
|
|
333
|
+
j.profileId === pid &&
|
|
334
|
+
(j.status === CONSOL_JOB_LIFECYCLE_V2.QUEUED ||
|
|
335
|
+
j.status === CONSOL_JOB_LIFECYCLE_V2.RUNNING)
|
|
336
|
+
)
|
|
337
|
+
n++;
|
|
338
|
+
return n;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export function createConsolJobV2({ id, profileId, sessionId, metadata } = {}) {
|
|
342
|
+
if (!id || typeof id !== "string") throw new Error("id is required");
|
|
343
|
+
if (!profileId || typeof profileId !== "string")
|
|
344
|
+
throw new Error("profileId is required");
|
|
345
|
+
if (_scJobs.has(id)) throw new Error(`consol job ${id} already exists`);
|
|
346
|
+
if (!_scProfiles.has(profileId))
|
|
347
|
+
throw new Error(`consol profile ${profileId} not found`);
|
|
348
|
+
const pending = _scCountPending(profileId);
|
|
349
|
+
if (pending >= _scMaxPendingPerProfile)
|
|
350
|
+
throw new Error(
|
|
351
|
+
`max pending consol jobs per profile (${_scMaxPendingPerProfile}) reached for ${profileId}`,
|
|
352
|
+
);
|
|
353
|
+
const now = Date.now();
|
|
354
|
+
const j = {
|
|
355
|
+
id,
|
|
356
|
+
profileId,
|
|
357
|
+
sessionId: sessionId || null,
|
|
358
|
+
status: CONSOL_JOB_LIFECYCLE_V2.QUEUED,
|
|
359
|
+
createdAt: now,
|
|
360
|
+
updatedAt: now,
|
|
361
|
+
startedAt: null,
|
|
362
|
+
settledAt: null,
|
|
363
|
+
metadata: { ...(metadata || {}) },
|
|
364
|
+
};
|
|
365
|
+
_scJobs.set(id, j);
|
|
366
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
367
|
+
}
|
|
368
|
+
function _scCheckJ(from, to) {
|
|
369
|
+
const a = _scJobTrans.get(from);
|
|
370
|
+
if (!a || !a.has(to))
|
|
371
|
+
throw new Error(`invalid consol job transition ${from} → ${to}`);
|
|
372
|
+
}
|
|
373
|
+
export function startConsolJobV2(id) {
|
|
374
|
+
const j = _scJobs.get(id);
|
|
375
|
+
if (!j) throw new Error(`consol job ${id} not found`);
|
|
376
|
+
_scCheckJ(j.status, CONSOL_JOB_LIFECYCLE_V2.RUNNING);
|
|
377
|
+
const now = Date.now();
|
|
378
|
+
j.status = CONSOL_JOB_LIFECYCLE_V2.RUNNING;
|
|
379
|
+
j.updatedAt = now;
|
|
380
|
+
if (!j.startedAt) j.startedAt = now;
|
|
381
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
382
|
+
}
|
|
383
|
+
export function completeConsolJobV2(id) {
|
|
384
|
+
const j = _scJobs.get(id);
|
|
385
|
+
if (!j) throw new Error(`consol job ${id} not found`);
|
|
386
|
+
_scCheckJ(j.status, CONSOL_JOB_LIFECYCLE_V2.COMPLETED);
|
|
387
|
+
const now = Date.now();
|
|
388
|
+
j.status = CONSOL_JOB_LIFECYCLE_V2.COMPLETED;
|
|
389
|
+
j.updatedAt = now;
|
|
390
|
+
if (!j.settledAt) j.settledAt = now;
|
|
391
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
392
|
+
}
|
|
393
|
+
export function failConsolJobV2(id, reason) {
|
|
394
|
+
const j = _scJobs.get(id);
|
|
395
|
+
if (!j) throw new Error(`consol job ${id} not found`);
|
|
396
|
+
_scCheckJ(j.status, CONSOL_JOB_LIFECYCLE_V2.FAILED);
|
|
397
|
+
const now = Date.now();
|
|
398
|
+
j.status = CONSOL_JOB_LIFECYCLE_V2.FAILED;
|
|
399
|
+
j.updatedAt = now;
|
|
400
|
+
if (!j.settledAt) j.settledAt = now;
|
|
401
|
+
if (reason) j.metadata.failReason = String(reason);
|
|
402
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
403
|
+
}
|
|
404
|
+
export function cancelConsolJobV2(id, reason) {
|
|
405
|
+
const j = _scJobs.get(id);
|
|
406
|
+
if (!j) throw new Error(`consol job ${id} not found`);
|
|
407
|
+
_scCheckJ(j.status, CONSOL_JOB_LIFECYCLE_V2.CANCELLED);
|
|
408
|
+
const now = Date.now();
|
|
409
|
+
j.status = CONSOL_JOB_LIFECYCLE_V2.CANCELLED;
|
|
410
|
+
j.updatedAt = now;
|
|
411
|
+
if (!j.settledAt) j.settledAt = now;
|
|
412
|
+
if (reason) j.metadata.cancelReason = String(reason);
|
|
413
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
414
|
+
}
|
|
415
|
+
export function getConsolJobV2(id) {
|
|
416
|
+
const j = _scJobs.get(id);
|
|
417
|
+
if (!j) return null;
|
|
418
|
+
return { ...j, metadata: { ...j.metadata } };
|
|
419
|
+
}
|
|
420
|
+
export function listConsolJobsV2() {
|
|
421
|
+
return [..._scJobs.values()].map((j) => ({
|
|
422
|
+
...j,
|
|
423
|
+
metadata: { ...j.metadata },
|
|
424
|
+
}));
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
export function autoPauseIdleConsolProfilesV2({ now } = {}) {
|
|
428
|
+
const t = now ?? Date.now();
|
|
429
|
+
const flipped = [];
|
|
430
|
+
for (const p of _scProfiles.values())
|
|
431
|
+
if (
|
|
432
|
+
p.status === CONSOL_PROFILE_MATURITY_V2.ACTIVE &&
|
|
433
|
+
t - p.lastTouchedAt >= _scProfileIdleMs
|
|
434
|
+
) {
|
|
435
|
+
p.status = CONSOL_PROFILE_MATURITY_V2.PAUSED;
|
|
436
|
+
p.updatedAt = t;
|
|
437
|
+
flipped.push(p.id);
|
|
438
|
+
}
|
|
439
|
+
return { flipped, count: flipped.length };
|
|
440
|
+
}
|
|
441
|
+
export function autoFailStuckConsolJobsV2({ now } = {}) {
|
|
442
|
+
const t = now ?? Date.now();
|
|
443
|
+
const flipped = [];
|
|
444
|
+
for (const j of _scJobs.values())
|
|
445
|
+
if (
|
|
446
|
+
j.status === CONSOL_JOB_LIFECYCLE_V2.RUNNING &&
|
|
447
|
+
j.startedAt != null &&
|
|
448
|
+
t - j.startedAt >= _scJobStuckMs
|
|
449
|
+
) {
|
|
450
|
+
j.status = CONSOL_JOB_LIFECYCLE_V2.FAILED;
|
|
451
|
+
j.updatedAt = t;
|
|
452
|
+
if (!j.settledAt) j.settledAt = t;
|
|
453
|
+
j.metadata.failReason = "auto-fail-stuck";
|
|
454
|
+
flipped.push(j.id);
|
|
455
|
+
}
|
|
456
|
+
return { flipped, count: flipped.length };
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
export function getSessionConsolidatorStatsV2() {
|
|
460
|
+
const profilesByStatus = {};
|
|
461
|
+
for (const s of Object.values(CONSOL_PROFILE_MATURITY_V2))
|
|
462
|
+
profilesByStatus[s] = 0;
|
|
463
|
+
for (const p of _scProfiles.values()) profilesByStatus[p.status]++;
|
|
464
|
+
const jobsByStatus = {};
|
|
465
|
+
for (const s of Object.values(CONSOL_JOB_LIFECYCLE_V2)) jobsByStatus[s] = 0;
|
|
466
|
+
for (const j of _scJobs.values()) jobsByStatus[j.status]++;
|
|
467
|
+
return {
|
|
468
|
+
totalProfilesV2: _scProfiles.size,
|
|
469
|
+
totalJobsV2: _scJobs.size,
|
|
470
|
+
maxActiveConsolProfilesPerOwner: _scMaxActivePerOwner,
|
|
471
|
+
maxPendingConsolJobsPerProfile: _scMaxPendingPerProfile,
|
|
472
|
+
consolProfileIdleMs: _scProfileIdleMs,
|
|
473
|
+
consolJobStuckMs: _scJobStuckMs,
|
|
474
|
+
profilesByStatus,
|
|
475
|
+
jobsByStatus,
|
|
476
|
+
};
|
|
477
|
+
}
|
package/src/lib/session-hooks.js
CHANGED
|
@@ -229,3 +229,343 @@ function withTimeout(promise, ms, label) {
|
|
|
229
229
|
});
|
|
230
230
|
return Promise.race([promise, timeout]).finally(() => clearTimeout(t));
|
|
231
231
|
}
|
|
232
|
+
|
|
233
|
+
// ===== V2 Surface: Session Hooks governance overlay (CLI v0.142.0) =====
|
|
234
|
+
export const SHOK_PROFILE_MATURITY_V2 = Object.freeze({
|
|
235
|
+
PENDING: "pending",
|
|
236
|
+
ACTIVE: "active",
|
|
237
|
+
DISABLED: "disabled",
|
|
238
|
+
RETIRED: "retired",
|
|
239
|
+
});
|
|
240
|
+
export const SHOK_INVOCATION_LIFECYCLE_V2 = Object.freeze({
|
|
241
|
+
QUEUED: "queued",
|
|
242
|
+
RUNNING: "running",
|
|
243
|
+
COMPLETED: "completed",
|
|
244
|
+
FAILED: "failed",
|
|
245
|
+
CANCELLED: "cancelled",
|
|
246
|
+
});
|
|
247
|
+
const _shokPTrans = new Map([
|
|
248
|
+
[
|
|
249
|
+
SHOK_PROFILE_MATURITY_V2.PENDING,
|
|
250
|
+
new Set([
|
|
251
|
+
SHOK_PROFILE_MATURITY_V2.ACTIVE,
|
|
252
|
+
SHOK_PROFILE_MATURITY_V2.RETIRED,
|
|
253
|
+
]),
|
|
254
|
+
],
|
|
255
|
+
[
|
|
256
|
+
SHOK_PROFILE_MATURITY_V2.ACTIVE,
|
|
257
|
+
new Set([
|
|
258
|
+
SHOK_PROFILE_MATURITY_V2.DISABLED,
|
|
259
|
+
SHOK_PROFILE_MATURITY_V2.RETIRED,
|
|
260
|
+
]),
|
|
261
|
+
],
|
|
262
|
+
[
|
|
263
|
+
SHOK_PROFILE_MATURITY_V2.DISABLED,
|
|
264
|
+
new Set([
|
|
265
|
+
SHOK_PROFILE_MATURITY_V2.ACTIVE,
|
|
266
|
+
SHOK_PROFILE_MATURITY_V2.RETIRED,
|
|
267
|
+
]),
|
|
268
|
+
],
|
|
269
|
+
[SHOK_PROFILE_MATURITY_V2.RETIRED, new Set()],
|
|
270
|
+
]);
|
|
271
|
+
const _shokPTerminal = new Set([SHOK_PROFILE_MATURITY_V2.RETIRED]);
|
|
272
|
+
const _shokITrans = new Map([
|
|
273
|
+
[
|
|
274
|
+
SHOK_INVOCATION_LIFECYCLE_V2.QUEUED,
|
|
275
|
+
new Set([
|
|
276
|
+
SHOK_INVOCATION_LIFECYCLE_V2.RUNNING,
|
|
277
|
+
SHOK_INVOCATION_LIFECYCLE_V2.CANCELLED,
|
|
278
|
+
]),
|
|
279
|
+
],
|
|
280
|
+
[
|
|
281
|
+
SHOK_INVOCATION_LIFECYCLE_V2.RUNNING,
|
|
282
|
+
new Set([
|
|
283
|
+
SHOK_INVOCATION_LIFECYCLE_V2.COMPLETED,
|
|
284
|
+
SHOK_INVOCATION_LIFECYCLE_V2.FAILED,
|
|
285
|
+
SHOK_INVOCATION_LIFECYCLE_V2.CANCELLED,
|
|
286
|
+
]),
|
|
287
|
+
],
|
|
288
|
+
[SHOK_INVOCATION_LIFECYCLE_V2.COMPLETED, new Set()],
|
|
289
|
+
[SHOK_INVOCATION_LIFECYCLE_V2.FAILED, new Set()],
|
|
290
|
+
[SHOK_INVOCATION_LIFECYCLE_V2.CANCELLED, new Set()],
|
|
291
|
+
]);
|
|
292
|
+
const _shokPsV2 = new Map();
|
|
293
|
+
const _shokIsV2 = new Map();
|
|
294
|
+
let _shokMaxActive = 12,
|
|
295
|
+
_shokMaxPending = 25,
|
|
296
|
+
_shokIdleMs = 30 * 24 * 60 * 60 * 1000,
|
|
297
|
+
_shokStuckMs = 30 * 1000;
|
|
298
|
+
function _shokPos(n, label) {
|
|
299
|
+
const v = Math.floor(Number(n));
|
|
300
|
+
if (!Number.isFinite(v) || v <= 0)
|
|
301
|
+
throw new Error(`${label} must be positive integer`);
|
|
302
|
+
return v;
|
|
303
|
+
}
|
|
304
|
+
function _shokCheckP(from, to) {
|
|
305
|
+
const a = _shokPTrans.get(from);
|
|
306
|
+
if (!a || !a.has(to))
|
|
307
|
+
throw new Error(`invalid shok profile transition ${from} → ${to}`);
|
|
308
|
+
}
|
|
309
|
+
function _shokCheckI(from, to) {
|
|
310
|
+
const a = _shokITrans.get(from);
|
|
311
|
+
if (!a || !a.has(to))
|
|
312
|
+
throw new Error(`invalid shok invocation transition ${from} → ${to}`);
|
|
313
|
+
}
|
|
314
|
+
export function setMaxActiveShokProfilesPerOwnerV2(n) {
|
|
315
|
+
_shokMaxActive = _shokPos(n, "maxActiveShokProfilesPerOwner");
|
|
316
|
+
}
|
|
317
|
+
export function getMaxActiveShokProfilesPerOwnerV2() {
|
|
318
|
+
return _shokMaxActive;
|
|
319
|
+
}
|
|
320
|
+
export function setMaxPendingShokInvocationsPerProfileV2(n) {
|
|
321
|
+
_shokMaxPending = _shokPos(n, "maxPendingShokInvocationsPerProfile");
|
|
322
|
+
}
|
|
323
|
+
export function getMaxPendingShokInvocationsPerProfileV2() {
|
|
324
|
+
return _shokMaxPending;
|
|
325
|
+
}
|
|
326
|
+
export function setShokProfileIdleMsV2(n) {
|
|
327
|
+
_shokIdleMs = _shokPos(n, "shokProfileIdleMs");
|
|
328
|
+
}
|
|
329
|
+
export function getShokProfileIdleMsV2() {
|
|
330
|
+
return _shokIdleMs;
|
|
331
|
+
}
|
|
332
|
+
export function setShokInvocationStuckMsV2(n) {
|
|
333
|
+
_shokStuckMs = _shokPos(n, "shokInvocationStuckMs");
|
|
334
|
+
}
|
|
335
|
+
export function getShokInvocationStuckMsV2() {
|
|
336
|
+
return _shokStuckMs;
|
|
337
|
+
}
|
|
338
|
+
export function _resetStateSessionHooksV2() {
|
|
339
|
+
_shokPsV2.clear();
|
|
340
|
+
_shokIsV2.clear();
|
|
341
|
+
_shokMaxActive = 12;
|
|
342
|
+
_shokMaxPending = 25;
|
|
343
|
+
_shokIdleMs = 30 * 24 * 60 * 60 * 1000;
|
|
344
|
+
_shokStuckMs = 30 * 1000;
|
|
345
|
+
}
|
|
346
|
+
export function registerShokProfileV2({ id, owner, event, metadata } = {}) {
|
|
347
|
+
if (!id) throw new Error("shok profile id required");
|
|
348
|
+
if (!owner) throw new Error("shok profile owner required");
|
|
349
|
+
if (_shokPsV2.has(id))
|
|
350
|
+
throw new Error(`shok profile ${id} already registered`);
|
|
351
|
+
const now = Date.now();
|
|
352
|
+
const p = {
|
|
353
|
+
id,
|
|
354
|
+
owner,
|
|
355
|
+
event: event || "preTurn",
|
|
356
|
+
status: SHOK_PROFILE_MATURITY_V2.PENDING,
|
|
357
|
+
createdAt: now,
|
|
358
|
+
updatedAt: now,
|
|
359
|
+
activatedAt: null,
|
|
360
|
+
retiredAt: null,
|
|
361
|
+
lastTouchedAt: now,
|
|
362
|
+
metadata: { ...(metadata || {}) },
|
|
363
|
+
};
|
|
364
|
+
_shokPsV2.set(id, p);
|
|
365
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
366
|
+
}
|
|
367
|
+
function _shokCountActive(owner) {
|
|
368
|
+
let n = 0;
|
|
369
|
+
for (const p of _shokPsV2.values())
|
|
370
|
+
if (p.owner === owner && p.status === SHOK_PROFILE_MATURITY_V2.ACTIVE) n++;
|
|
371
|
+
return n;
|
|
372
|
+
}
|
|
373
|
+
export function activateShokProfileV2(id) {
|
|
374
|
+
const p = _shokPsV2.get(id);
|
|
375
|
+
if (!p) throw new Error(`shok profile ${id} not found`);
|
|
376
|
+
_shokCheckP(p.status, SHOK_PROFILE_MATURITY_V2.ACTIVE);
|
|
377
|
+
const recovery = p.status === SHOK_PROFILE_MATURITY_V2.DISABLED;
|
|
378
|
+
if (!recovery && _shokCountActive(p.owner) >= _shokMaxActive)
|
|
379
|
+
throw new Error(`max active shok profiles for owner ${p.owner} reached`);
|
|
380
|
+
const now = Date.now();
|
|
381
|
+
p.status = SHOK_PROFILE_MATURITY_V2.ACTIVE;
|
|
382
|
+
p.updatedAt = now;
|
|
383
|
+
p.lastTouchedAt = now;
|
|
384
|
+
if (!p.activatedAt) p.activatedAt = now;
|
|
385
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
386
|
+
}
|
|
387
|
+
export function disableShokProfileV2(id) {
|
|
388
|
+
const p = _shokPsV2.get(id);
|
|
389
|
+
if (!p) throw new Error(`shok profile ${id} not found`);
|
|
390
|
+
_shokCheckP(p.status, SHOK_PROFILE_MATURITY_V2.DISABLED);
|
|
391
|
+
p.status = SHOK_PROFILE_MATURITY_V2.DISABLED;
|
|
392
|
+
p.updatedAt = Date.now();
|
|
393
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
394
|
+
}
|
|
395
|
+
export function retireShokProfileV2(id) {
|
|
396
|
+
const p = _shokPsV2.get(id);
|
|
397
|
+
if (!p) throw new Error(`shok profile ${id} not found`);
|
|
398
|
+
_shokCheckP(p.status, SHOK_PROFILE_MATURITY_V2.RETIRED);
|
|
399
|
+
const now = Date.now();
|
|
400
|
+
p.status = SHOK_PROFILE_MATURITY_V2.RETIRED;
|
|
401
|
+
p.updatedAt = now;
|
|
402
|
+
if (!p.retiredAt) p.retiredAt = now;
|
|
403
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
404
|
+
}
|
|
405
|
+
export function touchShokProfileV2(id) {
|
|
406
|
+
const p = _shokPsV2.get(id);
|
|
407
|
+
if (!p) throw new Error(`shok profile ${id} not found`);
|
|
408
|
+
if (_shokPTerminal.has(p.status))
|
|
409
|
+
throw new Error(`cannot touch terminal shok profile ${id}`);
|
|
410
|
+
const now = Date.now();
|
|
411
|
+
p.lastTouchedAt = now;
|
|
412
|
+
p.updatedAt = now;
|
|
413
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
414
|
+
}
|
|
415
|
+
export function getShokProfileV2(id) {
|
|
416
|
+
const p = _shokPsV2.get(id);
|
|
417
|
+
if (!p) return null;
|
|
418
|
+
return { ...p, metadata: { ...p.metadata } };
|
|
419
|
+
}
|
|
420
|
+
export function listShokProfilesV2() {
|
|
421
|
+
return [..._shokPsV2.values()].map((p) => ({
|
|
422
|
+
...p,
|
|
423
|
+
metadata: { ...p.metadata },
|
|
424
|
+
}));
|
|
425
|
+
}
|
|
426
|
+
function _shokCountPending(profileId) {
|
|
427
|
+
let n = 0;
|
|
428
|
+
for (const i of _shokIsV2.values())
|
|
429
|
+
if (
|
|
430
|
+
i.profileId === profileId &&
|
|
431
|
+
(i.status === SHOK_INVOCATION_LIFECYCLE_V2.QUEUED ||
|
|
432
|
+
i.status === SHOK_INVOCATION_LIFECYCLE_V2.RUNNING)
|
|
433
|
+
)
|
|
434
|
+
n++;
|
|
435
|
+
return n;
|
|
436
|
+
}
|
|
437
|
+
export function createShokInvocationV2({
|
|
438
|
+
id,
|
|
439
|
+
profileId,
|
|
440
|
+
payload,
|
|
441
|
+
metadata,
|
|
442
|
+
} = {}) {
|
|
443
|
+
if (!id) throw new Error("shok invocation id required");
|
|
444
|
+
if (!profileId) throw new Error("shok invocation profileId required");
|
|
445
|
+
if (_shokIsV2.has(id))
|
|
446
|
+
throw new Error(`shok invocation ${id} already exists`);
|
|
447
|
+
if (!_shokPsV2.has(profileId))
|
|
448
|
+
throw new Error(`shok profile ${profileId} not found`);
|
|
449
|
+
if (_shokCountPending(profileId) >= _shokMaxPending)
|
|
450
|
+
throw new Error(
|
|
451
|
+
`max pending shok invocations for profile ${profileId} reached`,
|
|
452
|
+
);
|
|
453
|
+
const now = Date.now();
|
|
454
|
+
const i = {
|
|
455
|
+
id,
|
|
456
|
+
profileId,
|
|
457
|
+
payload: payload || "",
|
|
458
|
+
status: SHOK_INVOCATION_LIFECYCLE_V2.QUEUED,
|
|
459
|
+
createdAt: now,
|
|
460
|
+
updatedAt: now,
|
|
461
|
+
startedAt: null,
|
|
462
|
+
settledAt: null,
|
|
463
|
+
metadata: { ...(metadata || {}) },
|
|
464
|
+
};
|
|
465
|
+
_shokIsV2.set(id, i);
|
|
466
|
+
return { ...i, metadata: { ...i.metadata } };
|
|
467
|
+
}
|
|
468
|
+
export function runningShokInvocationV2(id) {
|
|
469
|
+
const i = _shokIsV2.get(id);
|
|
470
|
+
if (!i) throw new Error(`shok invocation ${id} not found`);
|
|
471
|
+
_shokCheckI(i.status, SHOK_INVOCATION_LIFECYCLE_V2.RUNNING);
|
|
472
|
+
const now = Date.now();
|
|
473
|
+
i.status = SHOK_INVOCATION_LIFECYCLE_V2.RUNNING;
|
|
474
|
+
i.updatedAt = now;
|
|
475
|
+
if (!i.startedAt) i.startedAt = now;
|
|
476
|
+
return { ...i, metadata: { ...i.metadata } };
|
|
477
|
+
}
|
|
478
|
+
export function completeShokInvocationV2(id) {
|
|
479
|
+
const i = _shokIsV2.get(id);
|
|
480
|
+
if (!i) throw new Error(`shok invocation ${id} not found`);
|
|
481
|
+
_shokCheckI(i.status, SHOK_INVOCATION_LIFECYCLE_V2.COMPLETED);
|
|
482
|
+
const now = Date.now();
|
|
483
|
+
i.status = SHOK_INVOCATION_LIFECYCLE_V2.COMPLETED;
|
|
484
|
+
i.updatedAt = now;
|
|
485
|
+
if (!i.settledAt) i.settledAt = now;
|
|
486
|
+
return { ...i, metadata: { ...i.metadata } };
|
|
487
|
+
}
|
|
488
|
+
export function failShokInvocationV2(id, reason) {
|
|
489
|
+
const i = _shokIsV2.get(id);
|
|
490
|
+
if (!i) throw new Error(`shok invocation ${id} not found`);
|
|
491
|
+
_shokCheckI(i.status, SHOK_INVOCATION_LIFECYCLE_V2.FAILED);
|
|
492
|
+
const now = Date.now();
|
|
493
|
+
i.status = SHOK_INVOCATION_LIFECYCLE_V2.FAILED;
|
|
494
|
+
i.updatedAt = now;
|
|
495
|
+
if (!i.settledAt) i.settledAt = now;
|
|
496
|
+
if (reason) i.metadata.failReason = String(reason);
|
|
497
|
+
return { ...i, metadata: { ...i.metadata } };
|
|
498
|
+
}
|
|
499
|
+
export function cancelShokInvocationV2(id, reason) {
|
|
500
|
+
const i = _shokIsV2.get(id);
|
|
501
|
+
if (!i) throw new Error(`shok invocation ${id} not found`);
|
|
502
|
+
_shokCheckI(i.status, SHOK_INVOCATION_LIFECYCLE_V2.CANCELLED);
|
|
503
|
+
const now = Date.now();
|
|
504
|
+
i.status = SHOK_INVOCATION_LIFECYCLE_V2.CANCELLED;
|
|
505
|
+
i.updatedAt = now;
|
|
506
|
+
if (!i.settledAt) i.settledAt = now;
|
|
507
|
+
if (reason) i.metadata.cancelReason = String(reason);
|
|
508
|
+
return { ...i, metadata: { ...i.metadata } };
|
|
509
|
+
}
|
|
510
|
+
export function getShokInvocationV2(id) {
|
|
511
|
+
const i = _shokIsV2.get(id);
|
|
512
|
+
if (!i) return null;
|
|
513
|
+
return { ...i, metadata: { ...i.metadata } };
|
|
514
|
+
}
|
|
515
|
+
export function listShokInvocationsV2() {
|
|
516
|
+
return [..._shokIsV2.values()].map((i) => ({
|
|
517
|
+
...i,
|
|
518
|
+
metadata: { ...i.metadata },
|
|
519
|
+
}));
|
|
520
|
+
}
|
|
521
|
+
export function autoDisableIdleShokProfilesV2({ now } = {}) {
|
|
522
|
+
const t = now ?? Date.now();
|
|
523
|
+
const flipped = [];
|
|
524
|
+
for (const p of _shokPsV2.values())
|
|
525
|
+
if (
|
|
526
|
+
p.status === SHOK_PROFILE_MATURITY_V2.ACTIVE &&
|
|
527
|
+
t - p.lastTouchedAt >= _shokIdleMs
|
|
528
|
+
) {
|
|
529
|
+
p.status = SHOK_PROFILE_MATURITY_V2.DISABLED;
|
|
530
|
+
p.updatedAt = t;
|
|
531
|
+
flipped.push(p.id);
|
|
532
|
+
}
|
|
533
|
+
return { flipped, count: flipped.length };
|
|
534
|
+
}
|
|
535
|
+
export function autoFailStuckShokInvocationsV2({ now } = {}) {
|
|
536
|
+
const t = now ?? Date.now();
|
|
537
|
+
const flipped = [];
|
|
538
|
+
for (const i of _shokIsV2.values())
|
|
539
|
+
if (
|
|
540
|
+
i.status === SHOK_INVOCATION_LIFECYCLE_V2.RUNNING &&
|
|
541
|
+
i.startedAt != null &&
|
|
542
|
+
t - i.startedAt >= _shokStuckMs
|
|
543
|
+
) {
|
|
544
|
+
i.status = SHOK_INVOCATION_LIFECYCLE_V2.FAILED;
|
|
545
|
+
i.updatedAt = t;
|
|
546
|
+
if (!i.settledAt) i.settledAt = t;
|
|
547
|
+
i.metadata.failReason = "auto-fail-stuck";
|
|
548
|
+
flipped.push(i.id);
|
|
549
|
+
}
|
|
550
|
+
return { flipped, count: flipped.length };
|
|
551
|
+
}
|
|
552
|
+
export function getSessionHooksGovStatsV2() {
|
|
553
|
+
const profilesByStatus = {};
|
|
554
|
+
for (const v of Object.values(SHOK_PROFILE_MATURITY_V2))
|
|
555
|
+
profilesByStatus[v] = 0;
|
|
556
|
+
for (const p of _shokPsV2.values()) profilesByStatus[p.status]++;
|
|
557
|
+
const invocationsByStatus = {};
|
|
558
|
+
for (const v of Object.values(SHOK_INVOCATION_LIFECYCLE_V2))
|
|
559
|
+
invocationsByStatus[v] = 0;
|
|
560
|
+
for (const i of _shokIsV2.values()) invocationsByStatus[i.status]++;
|
|
561
|
+
return {
|
|
562
|
+
totalShokProfilesV2: _shokPsV2.size,
|
|
563
|
+
totalShokInvocationsV2: _shokIsV2.size,
|
|
564
|
+
maxActiveShokProfilesPerOwner: _shokMaxActive,
|
|
565
|
+
maxPendingShokInvocationsPerProfile: _shokMaxPending,
|
|
566
|
+
shokProfileIdleMs: _shokIdleMs,
|
|
567
|
+
shokInvocationStuckMs: _shokStuckMs,
|
|
568
|
+
profilesByStatus,
|
|
569
|
+
invocationsByStatus,
|
|
570
|
+
};
|
|
571
|
+
}
|