chainlesschain 0.81.0 → 0.132.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/bin/chainlesschain.js +0 -0
- package/package.json +1 -1
- package/src/commands/agent-network.js +254 -1
- package/src/commands/audit.js +302 -0
- package/src/commands/automation.js +271 -1
- package/src/commands/codegen.js +224 -0
- package/src/commands/collab.js +341 -0
- package/src/commands/compliance.js +1035 -0
- package/src/commands/cowork.js +221 -0
- package/src/commands/dbevo.js +284 -0
- package/src/commands/dev.js +252 -0
- package/src/commands/did.js +358 -0
- package/src/commands/encrypt.js +341 -0
- package/src/commands/export.js +256 -1
- package/src/commands/fusion.js +258 -0
- package/src/commands/governance.js +325 -0
- package/src/commands/hardening.js +411 -0
- package/src/commands/hook.js +148 -0
- package/src/commands/import.js +252 -0
- package/src/commands/incentive.js +322 -0
- package/src/commands/infra.js +244 -0
- package/src/commands/instinct.js +260 -0
- package/src/commands/ipfs.js +318 -0
- package/src/commands/kg.js +387 -0
- package/src/commands/llm.js +263 -0
- package/src/commands/mcp.js +221 -0
- package/src/commands/memory.js +248 -0
- package/src/commands/multimodal.js +296 -0
- package/src/commands/nlprog.js +356 -0
- package/src/commands/note.js +244 -0
- package/src/commands/ops.js +354 -0
- package/src/commands/orchestrate.js +166 -0
- package/src/commands/org.js +277 -0
- package/src/commands/p2p.js +390 -0
- package/src/commands/perception.js +290 -0
- package/src/commands/permmem.js +251 -0
- package/src/commands/plugin-ecosystem.js +273 -0
- package/src/commands/pqc.js +393 -0
- package/src/commands/quantization.js +351 -0
- package/src/commands/rcache.js +271 -0
- package/src/commands/recommend.js +340 -0
- package/src/commands/runtime.js +307 -0
- package/src/commands/scim.js +262 -0
- package/src/commands/session.js +258 -0
- package/src/commands/skill.js +267 -1
- package/src/commands/social.js +256 -0
- package/src/commands/sso.js +186 -1
- package/src/commands/sync.js +256 -0
- package/src/commands/tech.js +338 -0
- package/src/commands/tenant.js +351 -0
- package/src/commands/tokens.js +269 -0
- package/src/commands/trust.js +249 -0
- package/src/commands/wallet.js +277 -0
- package/src/commands/workflow.js +171 -0
- package/src/index.js +4 -0
- package/src/lib/agent-coordinator.js +325 -0
- package/src/lib/agent-network.js +387 -0
- package/src/lib/agent-router.js +395 -0
- package/src/lib/aiops.js +478 -0
- package/src/lib/audit-logger.js +379 -0
- package/src/lib/automation-engine.js +330 -0
- package/src/lib/autonomous-developer.js +350 -0
- package/src/lib/code-agent.js +323 -0
- package/src/lib/collaboration-governance.js +364 -0
- package/src/lib/community-governance.js +436 -0
- package/src/lib/compliance-manager.js +434 -0
- package/src/lib/content-recommendation.js +469 -0
- package/src/lib/crypto-manager.js +350 -0
- package/src/lib/dbevo.js +338 -0
- package/src/lib/decentral-infra.js +340 -0
- package/src/lib/did-manager.js +367 -0
- package/src/lib/hardening-manager.js +348 -0
- package/src/lib/hook-manager.js +380 -0
- package/src/lib/instinct-manager.js +332 -0
- package/src/lib/ipfs-storage.js +334 -0
- package/src/lib/knowledge-exporter.js +381 -0
- package/src/lib/knowledge-graph.js +432 -0
- package/src/lib/knowledge-importer.js +379 -0
- package/src/lib/llm-providers.js +391 -0
- package/src/lib/mcp-registry.js +333 -0
- package/src/lib/memory-manager.js +330 -0
- package/src/lib/multimodal.js +346 -0
- package/src/lib/nl-programming.js +343 -0
- package/src/lib/note-versioning.js +327 -0
- package/src/lib/org-manager.js +323 -0
- package/src/lib/p2p-manager.js +387 -0
- package/src/lib/perception.js +346 -0
- package/src/lib/perf-tuning.js +4 -1
- package/src/lib/permanent-memory.js +320 -0
- package/src/lib/plugin-ecosystem.js +377 -0
- package/src/lib/pqc-manager.js +368 -0
- package/src/lib/protocol-fusion.js +417 -0
- package/src/lib/quantization.js +325 -0
- package/src/lib/response-cache.js +327 -0
- package/src/lib/scim-manager.js +329 -0
- package/src/lib/session-manager.js +329 -0
- package/src/lib/skill-loader.js +377 -0
- package/src/lib/social-manager.js +326 -0
- package/src/lib/sso-manager.js +332 -0
- package/src/lib/sync-manager.js +326 -0
- package/src/lib/tech-learning-engine.js +369 -0
- package/src/lib/tenant-saas.js +460 -0
- package/src/lib/threat-intel.js +335 -0
- package/src/lib/token-incentive.js +293 -0
- package/src/lib/token-tracker.js +329 -0
- package/src/lib/trust-security.js +390 -0
- package/src/lib/ueba.js +389 -0
- package/src/lib/universal-runtime.js +325 -0
- package/src/lib/wallet-manager.js +326 -0
- package/src/lib/workflow-engine.js +322 -0
package/src/commands/scim.js
CHANGED
|
@@ -16,6 +16,39 @@ import {
|
|
|
16
16
|
addConnector,
|
|
17
17
|
syncProvision,
|
|
18
18
|
getStatus,
|
|
19
|
+
IDENTITY_LIFECYCLE_V2,
|
|
20
|
+
SYNC_JOB_V2,
|
|
21
|
+
SCIM_DEFAULT_MAX_PROVISIONED_PER_CONNECTOR,
|
|
22
|
+
SCIM_DEFAULT_MAX_RUNNING_SYNC_PER_CONNECTOR,
|
|
23
|
+
SCIM_DEFAULT_IDENTITY_IDLE_MS,
|
|
24
|
+
SCIM_DEFAULT_SYNC_STUCK_MS,
|
|
25
|
+
getMaxProvisionedPerConnectorV2,
|
|
26
|
+
setMaxProvisionedPerConnectorV2,
|
|
27
|
+
getMaxRunningSyncPerConnectorV2,
|
|
28
|
+
setMaxRunningSyncPerConnectorV2,
|
|
29
|
+
getIdentityIdleMsV2,
|
|
30
|
+
setIdentityIdleMsV2,
|
|
31
|
+
getSyncStuckMsV2,
|
|
32
|
+
setSyncStuckMsV2,
|
|
33
|
+
getProvisionedCountV2,
|
|
34
|
+
getRunningSyncCountV2,
|
|
35
|
+
registerIdentityV2,
|
|
36
|
+
getIdentityV2,
|
|
37
|
+
listIdentitiesV2,
|
|
38
|
+
provisionIdentityV2,
|
|
39
|
+
suspendIdentityV2,
|
|
40
|
+
deprovisionIdentityV2,
|
|
41
|
+
touchIdentityV2,
|
|
42
|
+
createSyncJobV2,
|
|
43
|
+
getSyncJobV2,
|
|
44
|
+
listSyncJobsV2,
|
|
45
|
+
startSyncJobV2,
|
|
46
|
+
succeedSyncJobV2,
|
|
47
|
+
failSyncJobV2,
|
|
48
|
+
cancelSyncJobV2,
|
|
49
|
+
autoDeprovisionIdleIdentitiesV2,
|
|
50
|
+
autoFailStuckSyncJobsV2,
|
|
51
|
+
getScimManagerStatsV2,
|
|
19
52
|
} from "../lib/scim-manager.js";
|
|
20
53
|
|
|
21
54
|
export function registerScimCommand(program) {
|
|
@@ -215,4 +248,233 @@ export function registerScimCommand(program) {
|
|
|
215
248
|
process.exit(1);
|
|
216
249
|
}
|
|
217
250
|
});
|
|
251
|
+
|
|
252
|
+
// ─────────────────────────────────────────────────────────────
|
|
253
|
+
// V2 Surface — identity + sync-job lifecycle (in-memory, throwing API)
|
|
254
|
+
// ─────────────────────────────────────────────────────────────
|
|
255
|
+
|
|
256
|
+
scim
|
|
257
|
+
.command("identity-lifecycles-v2")
|
|
258
|
+
.description("List V2 identity lifecycle states")
|
|
259
|
+
.option("--json", "Output as JSON")
|
|
260
|
+
.action((options) => {
|
|
261
|
+
const v = Object.values(IDENTITY_LIFECYCLE_V2);
|
|
262
|
+
if (options.json) console.log(JSON.stringify(v));
|
|
263
|
+
else logger.log(v.join(", "));
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
scim
|
|
267
|
+
.command("sync-lifecycles-v2")
|
|
268
|
+
.description("List V2 sync-job lifecycle states")
|
|
269
|
+
.option("--json", "Output as JSON")
|
|
270
|
+
.action((options) => {
|
|
271
|
+
const v = Object.values(SYNC_JOB_V2);
|
|
272
|
+
if (options.json) console.log(JSON.stringify(v));
|
|
273
|
+
else logger.log(v.join(", "));
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
scim
|
|
277
|
+
.command("stats-v2")
|
|
278
|
+
.description("Show V2 SCIM stats")
|
|
279
|
+
.option("--json", "Output as JSON")
|
|
280
|
+
.action((options) => {
|
|
281
|
+
const stats = getScimManagerStatsV2();
|
|
282
|
+
if (options.json) console.log(JSON.stringify(stats, null, 2));
|
|
283
|
+
else logger.log(JSON.stringify(stats, null, 2));
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
scim
|
|
287
|
+
.command("get-max-provisioned-v2")
|
|
288
|
+
.description("Get max provisioned identities per connector")
|
|
289
|
+
.action(() => logger.log(String(getMaxProvisionedPerConnectorV2())));
|
|
290
|
+
scim
|
|
291
|
+
.command("set-max-provisioned-v2 <n>")
|
|
292
|
+
.description("Set max provisioned identities per connector")
|
|
293
|
+
.action((n) => {
|
|
294
|
+
setMaxProvisionedPerConnectorV2(Number(n));
|
|
295
|
+
logger.log(String(getMaxProvisionedPerConnectorV2()));
|
|
296
|
+
});
|
|
297
|
+
scim
|
|
298
|
+
.command("get-max-running-sync-v2")
|
|
299
|
+
.description("Get max running sync jobs per connector")
|
|
300
|
+
.action(() => logger.log(String(getMaxRunningSyncPerConnectorV2())));
|
|
301
|
+
scim
|
|
302
|
+
.command("set-max-running-sync-v2 <n>")
|
|
303
|
+
.description("Set max running sync jobs per connector")
|
|
304
|
+
.action((n) => {
|
|
305
|
+
setMaxRunningSyncPerConnectorV2(Number(n));
|
|
306
|
+
logger.log(String(getMaxRunningSyncPerConnectorV2()));
|
|
307
|
+
});
|
|
308
|
+
scim
|
|
309
|
+
.command("get-identity-idle-ms-v2")
|
|
310
|
+
.description("Get identity idle ms")
|
|
311
|
+
.action(() => logger.log(String(getIdentityIdleMsV2())));
|
|
312
|
+
scim
|
|
313
|
+
.command("set-identity-idle-ms-v2 <ms>")
|
|
314
|
+
.description("Set identity idle ms")
|
|
315
|
+
.action((ms) => {
|
|
316
|
+
setIdentityIdleMsV2(Number(ms));
|
|
317
|
+
logger.log(String(getIdentityIdleMsV2()));
|
|
318
|
+
});
|
|
319
|
+
scim
|
|
320
|
+
.command("get-sync-stuck-ms-v2")
|
|
321
|
+
.description("Get sync-job stuck ms")
|
|
322
|
+
.action(() => logger.log(String(getSyncStuckMsV2())));
|
|
323
|
+
scim
|
|
324
|
+
.command("set-sync-stuck-ms-v2 <ms>")
|
|
325
|
+
.description("Set sync-job stuck ms")
|
|
326
|
+
.action((ms) => {
|
|
327
|
+
setSyncStuckMsV2(Number(ms));
|
|
328
|
+
logger.log(String(getSyncStuckMsV2()));
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
scim
|
|
332
|
+
.command("provisioned-count-v2 <connectorId>")
|
|
333
|
+
.description("Count provisioned identities for connector")
|
|
334
|
+
.action((connectorId) =>
|
|
335
|
+
logger.log(String(getProvisionedCountV2(connectorId))),
|
|
336
|
+
);
|
|
337
|
+
scim
|
|
338
|
+
.command("running-sync-count-v2 <connectorId>")
|
|
339
|
+
.description("Count running sync jobs for connector")
|
|
340
|
+
.action((connectorId) =>
|
|
341
|
+
logger.log(String(getRunningSyncCountV2(connectorId))),
|
|
342
|
+
);
|
|
343
|
+
|
|
344
|
+
scim
|
|
345
|
+
.command("register-identity-v2 <id>")
|
|
346
|
+
.description("Register V2 identity (initial=pending)")
|
|
347
|
+
.requiredOption("-c, --connector <id>", "connector id")
|
|
348
|
+
.requiredOption("-e, --external <id>", "external id")
|
|
349
|
+
.option("-m, --metadata <json>", "metadata JSON", "{}")
|
|
350
|
+
.action((id, opts) => {
|
|
351
|
+
const meta = JSON.parse(opts.metadata);
|
|
352
|
+
const i = registerIdentityV2(id, {
|
|
353
|
+
connectorId: opts.connector,
|
|
354
|
+
externalId: opts.external,
|
|
355
|
+
metadata: meta,
|
|
356
|
+
});
|
|
357
|
+
console.log(JSON.stringify(i, null, 2));
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
scim
|
|
361
|
+
.command("get-identity-v2 <id>")
|
|
362
|
+
.description("Get V2 identity by id")
|
|
363
|
+
.action((id) => {
|
|
364
|
+
const i = getIdentityV2(id);
|
|
365
|
+
if (!i) {
|
|
366
|
+
logger.error(`identity ${id} not found`);
|
|
367
|
+
process.exit(1);
|
|
368
|
+
}
|
|
369
|
+
console.log(JSON.stringify(i, null, 2));
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
scim
|
|
373
|
+
.command("list-identities-v2")
|
|
374
|
+
.description("List V2 identities")
|
|
375
|
+
.option("-c, --connector <id>", "filter by connector")
|
|
376
|
+
.option("-s, --status <state>", "filter by status")
|
|
377
|
+
.action((opts) => {
|
|
378
|
+
const out = listIdentitiesV2({
|
|
379
|
+
connectorId: opts.connector,
|
|
380
|
+
status: opts.status,
|
|
381
|
+
});
|
|
382
|
+
console.log(JSON.stringify(out, null, 2));
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
scim
|
|
386
|
+
.command("provision-identity-v2 <id>")
|
|
387
|
+
.description("Transition identity → provisioned")
|
|
388
|
+
.action((id) =>
|
|
389
|
+
console.log(JSON.stringify(provisionIdentityV2(id), null, 2)),
|
|
390
|
+
);
|
|
391
|
+
scim
|
|
392
|
+
.command("suspend-identity-v2 <id>")
|
|
393
|
+
.description("Transition identity → suspended")
|
|
394
|
+
.action((id) =>
|
|
395
|
+
console.log(JSON.stringify(suspendIdentityV2(id), null, 2)),
|
|
396
|
+
);
|
|
397
|
+
scim
|
|
398
|
+
.command("deprovision-identity-v2 <id>")
|
|
399
|
+
.description("Transition identity → deprovisioned (terminal)")
|
|
400
|
+
.action((id) =>
|
|
401
|
+
console.log(JSON.stringify(deprovisionIdentityV2(id), null, 2)),
|
|
402
|
+
);
|
|
403
|
+
scim
|
|
404
|
+
.command("touch-identity-v2 <id>")
|
|
405
|
+
.description("Update identity lastSeenAt")
|
|
406
|
+
.action((id) => console.log(JSON.stringify(touchIdentityV2(id), null, 2)));
|
|
407
|
+
|
|
408
|
+
scim
|
|
409
|
+
.command("create-sync-job-v2 <id>")
|
|
410
|
+
.description("Create V2 sync job (initial=queued)")
|
|
411
|
+
.requiredOption("-c, --connector <id>", "connector id")
|
|
412
|
+
.option("-k, --kind <kind>", "job kind", "full")
|
|
413
|
+
.option("-m, --metadata <json>", "metadata JSON", "{}")
|
|
414
|
+
.action((id, opts) => {
|
|
415
|
+
const meta = JSON.parse(opts.metadata);
|
|
416
|
+
const j = createSyncJobV2(id, {
|
|
417
|
+
connectorId: opts.connector,
|
|
418
|
+
kind: opts.kind,
|
|
419
|
+
metadata: meta,
|
|
420
|
+
});
|
|
421
|
+
console.log(JSON.stringify(j, null, 2));
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
scim
|
|
425
|
+
.command("get-sync-job-v2 <id>")
|
|
426
|
+
.description("Get V2 sync job by id")
|
|
427
|
+
.action((id) => {
|
|
428
|
+
const j = getSyncJobV2(id);
|
|
429
|
+
if (!j) {
|
|
430
|
+
logger.error(`syncJob ${id} not found`);
|
|
431
|
+
process.exit(1);
|
|
432
|
+
}
|
|
433
|
+
console.log(JSON.stringify(j, null, 2));
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
scim
|
|
437
|
+
.command("list-sync-jobs-v2")
|
|
438
|
+
.description("List V2 sync jobs")
|
|
439
|
+
.option("-c, --connector <id>", "filter by connector")
|
|
440
|
+
.option("-s, --status <state>", "filter by status")
|
|
441
|
+
.action((opts) => {
|
|
442
|
+
const out = listSyncJobsV2({
|
|
443
|
+
connectorId: opts.connector,
|
|
444
|
+
status: opts.status,
|
|
445
|
+
});
|
|
446
|
+
console.log(JSON.stringify(out, null, 2));
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
scim
|
|
450
|
+
.command("start-sync-job-v2 <id>")
|
|
451
|
+
.description("Transition sync job → running")
|
|
452
|
+
.action((id) => console.log(JSON.stringify(startSyncJobV2(id), null, 2)));
|
|
453
|
+
scim
|
|
454
|
+
.command("succeed-sync-job-v2 <id>")
|
|
455
|
+
.description("Transition sync job → succeeded (terminal)")
|
|
456
|
+
.action((id) => console.log(JSON.stringify(succeedSyncJobV2(id), null, 2)));
|
|
457
|
+
scim
|
|
458
|
+
.command("fail-sync-job-v2 <id>")
|
|
459
|
+
.description("Transition sync job → failed (terminal)")
|
|
460
|
+
.action((id) => console.log(JSON.stringify(failSyncJobV2(id), null, 2)));
|
|
461
|
+
scim
|
|
462
|
+
.command("cancel-sync-job-v2 <id>")
|
|
463
|
+
.description("Transition sync job → cancelled (terminal)")
|
|
464
|
+
.action((id) => console.log(JSON.stringify(cancelSyncJobV2(id), null, 2)));
|
|
465
|
+
|
|
466
|
+
scim
|
|
467
|
+
.command("auto-deprovision-idle-v2")
|
|
468
|
+
.description("Auto-deprovision idle identities; output flipped")
|
|
469
|
+
.action(() => {
|
|
470
|
+
const flipped = autoDeprovisionIdleIdentitiesV2();
|
|
471
|
+
console.log(JSON.stringify(flipped, null, 2));
|
|
472
|
+
});
|
|
473
|
+
scim
|
|
474
|
+
.command("auto-fail-stuck-sync-v2")
|
|
475
|
+
.description("Auto-fail stuck running syncs; output flipped")
|
|
476
|
+
.action(() => {
|
|
477
|
+
const flipped = autoFailStuckSyncJobsV2();
|
|
478
|
+
console.log(JSON.stringify(flipped, null, 2));
|
|
479
|
+
});
|
|
218
480
|
}
|
package/src/commands/session.js
CHANGED
|
@@ -13,6 +13,35 @@ import {
|
|
|
13
13
|
getSession,
|
|
14
14
|
deleteSession,
|
|
15
15
|
exportSessionMarkdown,
|
|
16
|
+
CONVERSATION_MATURITY_V2,
|
|
17
|
+
TURN_LIFECYCLE_V2,
|
|
18
|
+
getMaxActiveConvPerUserV2,
|
|
19
|
+
setMaxActiveConvPerUserV2,
|
|
20
|
+
getMaxPendingTurnsPerConvV2,
|
|
21
|
+
setMaxPendingTurnsPerConvV2,
|
|
22
|
+
getConvIdleMsV2,
|
|
23
|
+
setConvIdleMsV2,
|
|
24
|
+
getTurnStuckMsV2,
|
|
25
|
+
setTurnStuckMsV2,
|
|
26
|
+
getActiveConvCountV2,
|
|
27
|
+
getPendingTurnCountV2,
|
|
28
|
+
registerConversationV2,
|
|
29
|
+
getConversationV2,
|
|
30
|
+
listConversationsV2,
|
|
31
|
+
activateConversationV2,
|
|
32
|
+
pauseConversationV2,
|
|
33
|
+
archiveConversationV2,
|
|
34
|
+
touchConversationV2,
|
|
35
|
+
createTurnV2,
|
|
36
|
+
getTurnV2,
|
|
37
|
+
listTurnsV2,
|
|
38
|
+
streamTurnV2,
|
|
39
|
+
completeTurnV2,
|
|
40
|
+
failTurnV2,
|
|
41
|
+
cancelTurnV2,
|
|
42
|
+
autoArchiveIdleConversationsV2,
|
|
43
|
+
autoFailStuckTurnsV2,
|
|
44
|
+
getSessionManagerStatsV2,
|
|
16
45
|
} from "../lib/session-manager.js";
|
|
17
46
|
import {
|
|
18
47
|
listJsonlSessions,
|
|
@@ -785,4 +814,233 @@ export function registerSessionCommand(program) {
|
|
|
785
814
|
process.exit(1);
|
|
786
815
|
}
|
|
787
816
|
});
|
|
817
|
+
|
|
818
|
+
// ─────────────────────────────────────────────────────────────
|
|
819
|
+
// V2 Surface — conversation + turn lifecycle (in-memory, throwing API)
|
|
820
|
+
// ─────────────────────────────────────────────────────────────
|
|
821
|
+
|
|
822
|
+
session
|
|
823
|
+
.command("conversation-maturities-v2")
|
|
824
|
+
.description("List V2 conversation maturity states")
|
|
825
|
+
.option("--json", "Output as JSON")
|
|
826
|
+
.action((options) => {
|
|
827
|
+
const v = Object.values(CONVERSATION_MATURITY_V2);
|
|
828
|
+
if (options.json) console.log(JSON.stringify(v));
|
|
829
|
+
else logger.log(v.join(", "));
|
|
830
|
+
});
|
|
831
|
+
|
|
832
|
+
session
|
|
833
|
+
.command("turn-lifecycles-v2")
|
|
834
|
+
.description("List V2 turn lifecycle states")
|
|
835
|
+
.option("--json", "Output as JSON")
|
|
836
|
+
.action((options) => {
|
|
837
|
+
const v = Object.values(TURN_LIFECYCLE_V2);
|
|
838
|
+
if (options.json) console.log(JSON.stringify(v));
|
|
839
|
+
else logger.log(v.join(", "));
|
|
840
|
+
});
|
|
841
|
+
|
|
842
|
+
session
|
|
843
|
+
.command("stats-v2")
|
|
844
|
+
.description("Show V2 session stats")
|
|
845
|
+
.option("--json", "Output as JSON")
|
|
846
|
+
.action((options) => {
|
|
847
|
+
const stats = getSessionManagerStatsV2();
|
|
848
|
+
if (options.json) console.log(JSON.stringify(stats, null, 2));
|
|
849
|
+
else logger.log(JSON.stringify(stats, null, 2));
|
|
850
|
+
});
|
|
851
|
+
|
|
852
|
+
session
|
|
853
|
+
.command("get-max-active-conv-v2")
|
|
854
|
+
.description("Get max active conversations per user")
|
|
855
|
+
.action(() => logger.log(String(getMaxActiveConvPerUserV2())));
|
|
856
|
+
session
|
|
857
|
+
.command("set-max-active-conv-v2 <n>")
|
|
858
|
+
.description("Set max active conversations per user")
|
|
859
|
+
.action((n) => {
|
|
860
|
+
setMaxActiveConvPerUserV2(Number(n));
|
|
861
|
+
logger.log(String(getMaxActiveConvPerUserV2()));
|
|
862
|
+
});
|
|
863
|
+
session
|
|
864
|
+
.command("get-max-pending-turns-v2")
|
|
865
|
+
.description("Get max pending turns per conversation")
|
|
866
|
+
.action(() => logger.log(String(getMaxPendingTurnsPerConvV2())));
|
|
867
|
+
session
|
|
868
|
+
.command("set-max-pending-turns-v2 <n>")
|
|
869
|
+
.description("Set max pending turns per conversation")
|
|
870
|
+
.action((n) => {
|
|
871
|
+
setMaxPendingTurnsPerConvV2(Number(n));
|
|
872
|
+
logger.log(String(getMaxPendingTurnsPerConvV2()));
|
|
873
|
+
});
|
|
874
|
+
session
|
|
875
|
+
.command("get-conv-idle-ms-v2")
|
|
876
|
+
.description("Get conversation idle ms")
|
|
877
|
+
.action(() => logger.log(String(getConvIdleMsV2())));
|
|
878
|
+
session
|
|
879
|
+
.command("set-conv-idle-ms-v2 <ms>")
|
|
880
|
+
.description("Set conversation idle ms")
|
|
881
|
+
.action((ms) => {
|
|
882
|
+
setConvIdleMsV2(Number(ms));
|
|
883
|
+
logger.log(String(getConvIdleMsV2()));
|
|
884
|
+
});
|
|
885
|
+
session
|
|
886
|
+
.command("get-turn-stuck-ms-v2")
|
|
887
|
+
.description("Get turn stuck ms")
|
|
888
|
+
.action(() => logger.log(String(getTurnStuckMsV2())));
|
|
889
|
+
session
|
|
890
|
+
.command("set-turn-stuck-ms-v2 <ms>")
|
|
891
|
+
.description("Set turn stuck ms")
|
|
892
|
+
.action((ms) => {
|
|
893
|
+
setTurnStuckMsV2(Number(ms));
|
|
894
|
+
logger.log(String(getTurnStuckMsV2()));
|
|
895
|
+
});
|
|
896
|
+
|
|
897
|
+
session
|
|
898
|
+
.command("active-conv-count-v2 <userId>")
|
|
899
|
+
.description("Count active conversations for user")
|
|
900
|
+
.action((userId) => logger.log(String(getActiveConvCountV2(userId))));
|
|
901
|
+
session
|
|
902
|
+
.command("pending-turn-count-v2 <conversationId>")
|
|
903
|
+
.description("Count pending+streaming turns for conversation")
|
|
904
|
+
.action((conversationId) =>
|
|
905
|
+
logger.log(String(getPendingTurnCountV2(conversationId))),
|
|
906
|
+
);
|
|
907
|
+
|
|
908
|
+
session
|
|
909
|
+
.command("register-conversation-v2 <id>")
|
|
910
|
+
.description("Register V2 conversation (initial=draft)")
|
|
911
|
+
.requiredOption("-u, --user <userId>", "user id")
|
|
912
|
+
.requiredOption("-m, --model <model>", "model")
|
|
913
|
+
.option("--metadata <json>", "metadata JSON", "{}")
|
|
914
|
+
.action((id, opts) => {
|
|
915
|
+
const meta = JSON.parse(opts.metadata);
|
|
916
|
+
const c = registerConversationV2(id, {
|
|
917
|
+
userId: opts.user,
|
|
918
|
+
model: opts.model,
|
|
919
|
+
metadata: meta,
|
|
920
|
+
});
|
|
921
|
+
console.log(JSON.stringify(c, null, 2));
|
|
922
|
+
});
|
|
923
|
+
|
|
924
|
+
session
|
|
925
|
+
.command("get-conversation-v2 <id>")
|
|
926
|
+
.description("Get V2 conversation by id")
|
|
927
|
+
.action((id) => {
|
|
928
|
+
const c = getConversationV2(id);
|
|
929
|
+
if (!c) {
|
|
930
|
+
logger.error(`conversation ${id} not found`);
|
|
931
|
+
process.exit(1);
|
|
932
|
+
}
|
|
933
|
+
console.log(JSON.stringify(c, null, 2));
|
|
934
|
+
});
|
|
935
|
+
|
|
936
|
+
session
|
|
937
|
+
.command("list-conversations-v2")
|
|
938
|
+
.description("List V2 conversations")
|
|
939
|
+
.option("-u, --user <userId>", "filter by user")
|
|
940
|
+
.option("-s, --status <state>", "filter by status")
|
|
941
|
+
.action((opts) => {
|
|
942
|
+
const out = listConversationsV2({
|
|
943
|
+
userId: opts.user,
|
|
944
|
+
status: opts.status,
|
|
945
|
+
});
|
|
946
|
+
console.log(JSON.stringify(out, null, 2));
|
|
947
|
+
});
|
|
948
|
+
|
|
949
|
+
session
|
|
950
|
+
.command("activate-conversation-v2 <id>")
|
|
951
|
+
.description("Transition conversation → active")
|
|
952
|
+
.action((id) =>
|
|
953
|
+
console.log(JSON.stringify(activateConversationV2(id), null, 2)),
|
|
954
|
+
);
|
|
955
|
+
session
|
|
956
|
+
.command("pause-conversation-v2 <id>")
|
|
957
|
+
.description("Transition conversation → paused")
|
|
958
|
+
.action((id) =>
|
|
959
|
+
console.log(JSON.stringify(pauseConversationV2(id), null, 2)),
|
|
960
|
+
);
|
|
961
|
+
session
|
|
962
|
+
.command("archive-conversation-v2 <id>")
|
|
963
|
+
.description("Transition conversation → archived (terminal)")
|
|
964
|
+
.action((id) =>
|
|
965
|
+
console.log(JSON.stringify(archiveConversationV2(id), null, 2)),
|
|
966
|
+
);
|
|
967
|
+
session
|
|
968
|
+
.command("touch-conversation-v2 <id>")
|
|
969
|
+
.description("Update conversation lastSeenAt")
|
|
970
|
+
.action((id) =>
|
|
971
|
+
console.log(JSON.stringify(touchConversationV2(id), null, 2)),
|
|
972
|
+
);
|
|
973
|
+
|
|
974
|
+
session
|
|
975
|
+
.command("create-turn-v2 <id>")
|
|
976
|
+
.description("Create V2 turn (initial=pending)")
|
|
977
|
+
.requiredOption("-c, --conversation <id>", "conversation id")
|
|
978
|
+
.option("-r, --role <role>", "role (user/assistant)", "user")
|
|
979
|
+
.option("-m, --metadata <json>", "metadata JSON", "{}")
|
|
980
|
+
.action((id, opts) => {
|
|
981
|
+
const meta = JSON.parse(opts.metadata);
|
|
982
|
+
const t = createTurnV2(id, {
|
|
983
|
+
conversationId: opts.conversation,
|
|
984
|
+
role: opts.role,
|
|
985
|
+
metadata: meta,
|
|
986
|
+
});
|
|
987
|
+
console.log(JSON.stringify(t, null, 2));
|
|
988
|
+
});
|
|
989
|
+
|
|
990
|
+
session
|
|
991
|
+
.command("get-turn-v2 <id>")
|
|
992
|
+
.description("Get V2 turn by id")
|
|
993
|
+
.action((id) => {
|
|
994
|
+
const t = getTurnV2(id);
|
|
995
|
+
if (!t) {
|
|
996
|
+
logger.error(`turn ${id} not found`);
|
|
997
|
+
process.exit(1);
|
|
998
|
+
}
|
|
999
|
+
console.log(JSON.stringify(t, null, 2));
|
|
1000
|
+
});
|
|
1001
|
+
|
|
1002
|
+
session
|
|
1003
|
+
.command("list-turns-v2")
|
|
1004
|
+
.description("List V2 turns")
|
|
1005
|
+
.option("-c, --conversation <id>", "filter by conversation")
|
|
1006
|
+
.option("-s, --status <state>", "filter by status")
|
|
1007
|
+
.action((opts) => {
|
|
1008
|
+
const out = listTurnsV2({
|
|
1009
|
+
conversationId: opts.conversation,
|
|
1010
|
+
status: opts.status,
|
|
1011
|
+
});
|
|
1012
|
+
console.log(JSON.stringify(out, null, 2));
|
|
1013
|
+
});
|
|
1014
|
+
|
|
1015
|
+
session
|
|
1016
|
+
.command("stream-turn-v2 <id>")
|
|
1017
|
+
.description("Transition turn → streaming")
|
|
1018
|
+
.action((id) => console.log(JSON.stringify(streamTurnV2(id), null, 2)));
|
|
1019
|
+
session
|
|
1020
|
+
.command("complete-turn-v2 <id>")
|
|
1021
|
+
.description("Transition turn → completed (terminal)")
|
|
1022
|
+
.action((id) => console.log(JSON.stringify(completeTurnV2(id), null, 2)));
|
|
1023
|
+
session
|
|
1024
|
+
.command("fail-turn-v2 <id>")
|
|
1025
|
+
.description("Transition turn → failed (terminal)")
|
|
1026
|
+
.action((id) => console.log(JSON.stringify(failTurnV2(id), null, 2)));
|
|
1027
|
+
session
|
|
1028
|
+
.command("cancel-turn-v2 <id>")
|
|
1029
|
+
.description("Transition turn → cancelled (terminal)")
|
|
1030
|
+
.action((id) => console.log(JSON.stringify(cancelTurnV2(id), null, 2)));
|
|
1031
|
+
|
|
1032
|
+
session
|
|
1033
|
+
.command("auto-archive-idle-conv-v2")
|
|
1034
|
+
.description("Auto-archive idle conversations; output flipped")
|
|
1035
|
+
.action(() => {
|
|
1036
|
+
const flipped = autoArchiveIdleConversationsV2();
|
|
1037
|
+
console.log(JSON.stringify(flipped, null, 2));
|
|
1038
|
+
});
|
|
1039
|
+
session
|
|
1040
|
+
.command("auto-fail-stuck-turns-v2")
|
|
1041
|
+
.description("Auto-fail stuck streaming turns; output flipped")
|
|
1042
|
+
.action(() => {
|
|
1043
|
+
const flipped = autoFailStuckTurnsV2();
|
|
1044
|
+
console.log(JSON.stringify(flipped, null, 2));
|
|
1045
|
+
});
|
|
788
1046
|
}
|