chainlesschain 0.81.0 → 0.143.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/a2a.js +62 -0
- package/src/commands/activitypub.js +61 -0
- package/src/commands/agent-network.js +254 -1
- package/src/commands/agent.js +117 -0
- package/src/commands/audit.js +302 -0
- package/src/commands/automation.js +271 -1
- package/src/commands/bi.js +61 -0
- package/src/commands/bm25.js +78 -0
- package/src/commands/browse.js +64 -0
- package/src/commands/ccron.js +78 -0
- package/src/commands/codegen.js +224 -0
- package/src/commands/collab.js +341 -0
- package/src/commands/compliance.js +1075 -0
- package/src/commands/compt.js +78 -0
- package/src/commands/consol.js +231 -0
- package/src/commands/cowork.js +263 -0
- package/src/commands/crosschain.js +62 -0
- package/src/commands/dao.js +62 -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/dlp.js +61 -0
- package/src/commands/economy.js +56 -0
- package/src/commands/encrypt.js +341 -0
- package/src/commands/evolution.js +56 -0
- package/src/commands/evomap.js +61 -0
- package/src/commands/export.js +256 -1
- package/src/commands/fflag.js +178 -0
- package/src/commands/fusion.js +258 -0
- package/src/commands/git.js +45 -0
- package/src/commands/governance.js +325 -0
- package/src/commands/hardening.js +411 -0
- package/src/commands/hmemory.js +56 -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/inference.js +42 -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/itbudget.js +45 -0
- package/src/commands/kg.js +387 -0
- package/src/commands/llm.js +263 -0
- package/src/commands/lowcode.js +44 -0
- package/src/commands/matrix.js +62 -0
- package/src/commands/mcp.js +221 -0
- package/src/commands/mcpscaf.js +41 -0
- package/src/commands/meminj.js +41 -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/nostr.js +62 -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/orchgov.js +45 -0
- package/src/commands/org.js +277 -0
- package/src/commands/p2p.js +390 -0
- package/src/commands/pdfp.js +78 -0
- package/src/commands/perception.js +290 -0
- package/src/commands/perf.js +39 -0
- package/src/commands/perm.js +45 -0
- package/src/commands/permmem.js +251 -0
- package/src/commands/pipeline.js +57 -1
- package/src/commands/planmode.js +45 -0
- package/src/commands/plugin-ecosystem.js +273 -0
- package/src/commands/pqc.js +393 -0
- package/src/commands/promcomp.js +82 -0
- package/src/commands/quantization.js +351 -0
- package/src/commands/rcache.js +271 -0
- package/src/commands/recommend.js +382 -0
- package/src/commands/runtime.js +307 -0
- package/src/commands/scim.js +262 -0
- package/src/commands/seshhook.js +41 -0
- package/src/commands/seshsearch.js +41 -0
- package/src/commands/seshtail.js +41 -0
- package/src/commands/seshu.js +41 -0
- package/src/commands/session.js +258 -0
- package/src/commands/sganal.js +78 -0
- package/src/commands/siem.js +40 -0
- package/src/commands/skill.js +267 -1
- package/src/commands/slotfill.js +41 -0
- package/src/commands/social.js +290 -0
- package/src/commands/sso.js +186 -1
- package/src/commands/svccont.js +45 -0
- package/src/commands/sync.js +256 -0
- package/src/commands/tech.js +338 -0
- package/src/commands/tenant.js +351 -0
- package/src/commands/tms.js +45 -0
- package/src/commands/tokens.js +269 -0
- package/src/commands/topiccls.js +45 -0
- package/src/commands/trust.js +249 -0
- package/src/commands/uprof.js +45 -0
- package/src/commands/vcheck.js +78 -0
- package/src/commands/wallet.js +277 -0
- package/src/commands/webfetch.js +41 -0
- package/src/commands/workflow.js +171 -0
- package/src/commands/zkp.js +62 -0
- package/src/harness/prompt-compressor.js +331 -0
- package/src/index.js +65 -1
- package/src/lib/a2a-protocol.js +105 -0
- package/src/lib/activitypub-bridge.js +105 -0
- package/src/lib/agent-coordinator.js +325 -0
- package/src/lib/agent-economy.js +105 -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/app-builder.js +105 -0
- package/src/lib/audit-logger.js +379 -0
- package/src/lib/automation-engine.js +330 -0
- package/src/lib/autonomous-agent.js +105 -0
- package/src/lib/autonomous-developer.js +350 -0
- package/src/lib/bi-engine.js +105 -0
- package/src/lib/bm25-search.js +81 -0
- package/src/lib/browser-automation.js +105 -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-framework-reporter.js +105 -0
- package/src/lib/compliance-manager.js +434 -0
- package/src/lib/compression-telemetry.js +81 -0
- package/src/lib/content-recommendation.js +469 -0
- package/src/lib/content-recommender.js +105 -0
- package/src/lib/cowork-cron.js +81 -0
- package/src/lib/cowork-task-runner.js +105 -0
- package/src/lib/cross-chain.js +105 -0
- package/src/lib/crypto-manager.js +350 -0
- package/src/lib/dao-governance.js +105 -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/dlp-engine.js +105 -0
- package/src/lib/evolution-system.js +105 -0
- package/src/lib/evomap-manager.js +105 -0
- package/src/lib/execution-backend.js +105 -0
- package/src/lib/feature-flags.js +85 -0
- package/src/lib/git-integration.js +105 -0
- package/src/lib/hardening-manager.js +348 -0
- package/src/lib/hierarchical-memory.js +105 -0
- package/src/lib/hook-manager.js +380 -0
- package/src/lib/inference-network.js +105 -0
- package/src/lib/instinct-manager.js +332 -0
- package/src/lib/ipfs-storage.js +334 -0
- package/src/lib/iteration-budget.js +105 -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/matrix-bridge.js +105 -0
- package/src/lib/mcp-registry.js +333 -0
- package/src/lib/mcp-scaffold.js +81 -0
- package/src/lib/memory-injection.js +81 -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/nostr-bridge.js +105 -0
- package/src/lib/note-versioning.js +327 -0
- package/src/lib/orchestrator.js +105 -0
- package/src/lib/org-manager.js +323 -0
- package/src/lib/p2p-manager.js +387 -0
- package/src/lib/pdf-parser.js +81 -0
- package/src/lib/perception.js +346 -0
- package/src/lib/perf-tuning.js +109 -1
- package/src/lib/permanent-memory.js +320 -0
- package/src/lib/permission-engine.js +81 -0
- package/src/lib/pipeline-orchestrator.js +105 -0
- package/src/lib/plan-mode.js +81 -0
- package/src/lib/plugin-ecosystem.js +377 -0
- package/src/lib/pqc-manager.js +368 -0
- package/src/lib/prompt-compressor.js +1 -10
- 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/service-container.js +81 -0
- package/src/lib/session-consolidator.js +105 -0
- package/src/lib/session-hooks.js +81 -0
- package/src/lib/session-manager.js +329 -0
- package/src/lib/session-search.js +81 -0
- package/src/lib/session-tail.js +81 -0
- package/src/lib/session-usage.js +83 -0
- package/src/lib/siem-exporter.js +105 -0
- package/src/lib/skill-loader.js +377 -0
- package/src/lib/slot-filler.js +81 -0
- package/src/lib/social-graph-analytics.js +81 -0
- package/src/lib/social-graph.js +81 -0
- package/src/lib/social-manager.js +326 -0
- package/src/lib/sso-manager.js +332 -0
- package/src/lib/sub-agent-registry.js +110 -0
- package/src/lib/sync-manager.js +326 -0
- package/src/lib/task-model-selector.js +81 -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/todo-manager.js +105 -0
- package/src/lib/token-incentive.js +293 -0
- package/src/lib/token-tracker.js +329 -0
- package/src/lib/topic-classifier.js +105 -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/user-profile.js +81 -0
- package/src/lib/version-checker.js +81 -0
- package/src/lib/wallet-manager.js +326 -0
- package/src/lib/web-fetch.js +81 -0
- package/src/lib/workflow-engine.js +322 -0
- package/src/lib/zkp-engine.js +105 -0
package/src/commands/pqc.js
CHANGED
|
@@ -13,6 +13,35 @@ import {
|
|
|
13
13
|
getMigrationStatus,
|
|
14
14
|
migrate,
|
|
15
15
|
listAlgorithms,
|
|
16
|
+
KEY_MATURITY_V2,
|
|
17
|
+
MIGRATION_LIFECYCLE_V2,
|
|
18
|
+
getMaxActiveKeysPerOwnerV2,
|
|
19
|
+
setMaxActiveKeysPerOwnerV2,
|
|
20
|
+
getMaxPendingMigrationsPerKeyV2,
|
|
21
|
+
setMaxPendingMigrationsPerKeyV2,
|
|
22
|
+
getKeyIdleMsV2,
|
|
23
|
+
setKeyIdleMsV2,
|
|
24
|
+
getMigrationStuckMsV2,
|
|
25
|
+
setMigrationStuckMsV2,
|
|
26
|
+
registerKeyV2,
|
|
27
|
+
getKeyV2,
|
|
28
|
+
listKeysV2,
|
|
29
|
+
activateKeyV2,
|
|
30
|
+
deprecateKeyV2,
|
|
31
|
+
archiveKeyV2,
|
|
32
|
+
touchKeyV2,
|
|
33
|
+
createMigrationV2,
|
|
34
|
+
getMigrationV2,
|
|
35
|
+
listMigrationsV2,
|
|
36
|
+
startMigrationV2,
|
|
37
|
+
completeMigrationV2,
|
|
38
|
+
failMigrationV2,
|
|
39
|
+
cancelMigrationV2,
|
|
40
|
+
getActiveKeyCountV2,
|
|
41
|
+
getPendingMigrationCountV2,
|
|
42
|
+
autoDeprecateIdleKeysV2,
|
|
43
|
+
autoFailStuckMigrationsV2,
|
|
44
|
+
getPqcManagerStatsV2,
|
|
16
45
|
} from "../lib/pqc-manager.js";
|
|
17
46
|
|
|
18
47
|
export function registerPqcCommand(program) {
|
|
@@ -193,4 +222,368 @@ export function registerPqcCommand(program) {
|
|
|
193
222
|
process.exit(1);
|
|
194
223
|
}
|
|
195
224
|
});
|
|
225
|
+
|
|
226
|
+
// ===== V2 in-memory governance surface (no DB, no bootstrap) =====
|
|
227
|
+
|
|
228
|
+
pqc
|
|
229
|
+
.command("key-maturities-v2")
|
|
230
|
+
.description("[V2] List key maturity states")
|
|
231
|
+
.option("--json", "Output as JSON")
|
|
232
|
+
.action((opts) => {
|
|
233
|
+
const states = Object.values(KEY_MATURITY_V2);
|
|
234
|
+
if (opts.json) console.log(JSON.stringify(states, null, 2));
|
|
235
|
+
else for (const s of states) logger.log(s);
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
pqc
|
|
239
|
+
.command("migration-lifecycles-v2")
|
|
240
|
+
.description("[V2] List migration lifecycle states")
|
|
241
|
+
.option("--json", "Output as JSON")
|
|
242
|
+
.action((opts) => {
|
|
243
|
+
const states = Object.values(MIGRATION_LIFECYCLE_V2);
|
|
244
|
+
if (opts.json) console.log(JSON.stringify(states, null, 2));
|
|
245
|
+
else for (const s of states) logger.log(s);
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
pqc
|
|
249
|
+
.command("config-v2")
|
|
250
|
+
.description("[V2] Show governance config")
|
|
251
|
+
.option("--json", "Output as JSON")
|
|
252
|
+
.action((opts) => {
|
|
253
|
+
const cfg = {
|
|
254
|
+
maxActiveKeysPerOwner: getMaxActiveKeysPerOwnerV2(),
|
|
255
|
+
maxPendingMigrationsPerKey: getMaxPendingMigrationsPerKeyV2(),
|
|
256
|
+
keyIdleMs: getKeyIdleMsV2(),
|
|
257
|
+
migrationStuckMs: getMigrationStuckMsV2(),
|
|
258
|
+
};
|
|
259
|
+
if (opts.json) console.log(JSON.stringify(cfg, null, 2));
|
|
260
|
+
else for (const [k, v] of Object.entries(cfg)) logger.log(`${k}: ${v}`);
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
pqc
|
|
264
|
+
.command("set-max-active-keys-per-owner-v2 <n>")
|
|
265
|
+
.description("[V2] Set per-owner active key cap")
|
|
266
|
+
.action((n) => {
|
|
267
|
+
try {
|
|
268
|
+
setMaxActiveKeysPerOwnerV2(Number(n));
|
|
269
|
+
logger.success(
|
|
270
|
+
`max active keys/owner = ${getMaxActiveKeysPerOwnerV2()}`,
|
|
271
|
+
);
|
|
272
|
+
} catch (err) {
|
|
273
|
+
logger.error(err.message);
|
|
274
|
+
process.exit(1);
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
pqc
|
|
279
|
+
.command("set-max-pending-migrations-per-key-v2 <n>")
|
|
280
|
+
.description("[V2] Set per-key pending migration cap")
|
|
281
|
+
.action((n) => {
|
|
282
|
+
try {
|
|
283
|
+
setMaxPendingMigrationsPerKeyV2(Number(n));
|
|
284
|
+
logger.success(
|
|
285
|
+
`max pending migrations/key = ${getMaxPendingMigrationsPerKeyV2()}`,
|
|
286
|
+
);
|
|
287
|
+
} catch (err) {
|
|
288
|
+
logger.error(err.message);
|
|
289
|
+
process.exit(1);
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
pqc
|
|
294
|
+
.command("set-key-idle-ms-v2 <ms>")
|
|
295
|
+
.description("[V2] Set key idle threshold (ms)")
|
|
296
|
+
.action((ms) => {
|
|
297
|
+
try {
|
|
298
|
+
setKeyIdleMsV2(Number(ms));
|
|
299
|
+
logger.success(`key idle ms = ${getKeyIdleMsV2()}`);
|
|
300
|
+
} catch (err) {
|
|
301
|
+
logger.error(err.message);
|
|
302
|
+
process.exit(1);
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
pqc
|
|
307
|
+
.command("set-migration-stuck-ms-v2 <ms>")
|
|
308
|
+
.description("[V2] Set migration stuck threshold (ms)")
|
|
309
|
+
.action((ms) => {
|
|
310
|
+
try {
|
|
311
|
+
setMigrationStuckMsV2(Number(ms));
|
|
312
|
+
logger.success(`migration stuck ms = ${getMigrationStuckMsV2()}`);
|
|
313
|
+
} catch (err) {
|
|
314
|
+
logger.error(err.message);
|
|
315
|
+
process.exit(1);
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
pqc
|
|
320
|
+
.command("register-key-v2 <id>")
|
|
321
|
+
.description("[V2] Register a key profile (PENDING)")
|
|
322
|
+
.requiredOption("-o, --owner <id>", "Owner ID")
|
|
323
|
+
.requiredOption("-a, --algorithm <algo>", "Algorithm")
|
|
324
|
+
.option("-p, --purpose <purpose>", "Purpose", "general")
|
|
325
|
+
.action((id, opts) => {
|
|
326
|
+
try {
|
|
327
|
+
const k = registerKeyV2(id, {
|
|
328
|
+
ownerId: opts.owner,
|
|
329
|
+
algorithm: opts.algorithm,
|
|
330
|
+
purpose: opts.purpose,
|
|
331
|
+
});
|
|
332
|
+
logger.success(`key ${k.id} registered (status=${k.status})`);
|
|
333
|
+
} catch (err) {
|
|
334
|
+
logger.error(err.message);
|
|
335
|
+
process.exit(1);
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
pqc
|
|
340
|
+
.command("activate-key-v2 <id>")
|
|
341
|
+
.description("[V2] Activate a key (pending|deprecated -> active)")
|
|
342
|
+
.action((id) => {
|
|
343
|
+
try {
|
|
344
|
+
const k = activateKeyV2(id);
|
|
345
|
+
logger.success(`key ${k.id} active`);
|
|
346
|
+
} catch (err) {
|
|
347
|
+
logger.error(err.message);
|
|
348
|
+
process.exit(1);
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
pqc
|
|
353
|
+
.command("deprecate-key-v2 <id>")
|
|
354
|
+
.description("[V2] Deprecate a key (active -> deprecated)")
|
|
355
|
+
.action((id) => {
|
|
356
|
+
try {
|
|
357
|
+
const k = deprecateKeyV2(id);
|
|
358
|
+
logger.success(`key ${k.id} deprecated`);
|
|
359
|
+
} catch (err) {
|
|
360
|
+
logger.error(err.message);
|
|
361
|
+
process.exit(1);
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
pqc
|
|
366
|
+
.command("archive-key-v2 <id>")
|
|
367
|
+
.description("[V2] Archive a key (terminal)")
|
|
368
|
+
.action((id) => {
|
|
369
|
+
try {
|
|
370
|
+
const k = archiveKeyV2(id);
|
|
371
|
+
logger.success(`key ${k.id} archived`);
|
|
372
|
+
} catch (err) {
|
|
373
|
+
logger.error(err.message);
|
|
374
|
+
process.exit(1);
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
pqc
|
|
379
|
+
.command("touch-key-v2 <id>")
|
|
380
|
+
.description("[V2] Bump key lastSeenAt")
|
|
381
|
+
.action((id) => {
|
|
382
|
+
try {
|
|
383
|
+
const k = touchKeyV2(id);
|
|
384
|
+
logger.success(`key ${k.id} touched`);
|
|
385
|
+
} catch (err) {
|
|
386
|
+
logger.error(err.message);
|
|
387
|
+
process.exit(1);
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
pqc
|
|
392
|
+
.command("get-key-v2 <id>")
|
|
393
|
+
.description("[V2] Show a key profile")
|
|
394
|
+
.option("--json", "Output as JSON")
|
|
395
|
+
.action((id, opts) => {
|
|
396
|
+
try {
|
|
397
|
+
const k = getKeyV2(id);
|
|
398
|
+
if (!k) {
|
|
399
|
+
logger.info("key not found");
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
if (opts.json) console.log(JSON.stringify(k, null, 2));
|
|
403
|
+
else logger.log(JSON.stringify(k, null, 2));
|
|
404
|
+
} catch (err) {
|
|
405
|
+
logger.error(err.message);
|
|
406
|
+
process.exit(1);
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
pqc
|
|
411
|
+
.command("list-keys-v2")
|
|
412
|
+
.description("[V2] List key profiles")
|
|
413
|
+
.option("-o, --owner <id>", "Filter by owner")
|
|
414
|
+
.option("-s, --status <s>", "Filter by status")
|
|
415
|
+
.option("-a, --algorithm <algo>", "Filter by algorithm")
|
|
416
|
+
.option("--json", "Output as JSON")
|
|
417
|
+
.action((opts) => {
|
|
418
|
+
const list = listKeysV2({
|
|
419
|
+
ownerId: opts.owner,
|
|
420
|
+
status: opts.status,
|
|
421
|
+
algorithm: opts.algorithm,
|
|
422
|
+
});
|
|
423
|
+
if (opts.json) console.log(JSON.stringify(list, null, 2));
|
|
424
|
+
else
|
|
425
|
+
for (const k of list)
|
|
426
|
+
logger.log(`${k.id}\t${k.ownerId}\t${k.status}\t${k.algorithm}`);
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
pqc
|
|
430
|
+
.command("create-migration-v2 <id>")
|
|
431
|
+
.description("[V2] Create a queued V2 migration")
|
|
432
|
+
.requiredOption("-k, --key <keyId>", "Key ID")
|
|
433
|
+
.requiredOption("-t, --target <algo>", "Target algorithm")
|
|
434
|
+
.action((id, opts) => {
|
|
435
|
+
try {
|
|
436
|
+
const m = createMigrationV2(id, {
|
|
437
|
+
keyId: opts.key,
|
|
438
|
+
targetAlgorithm: opts.target,
|
|
439
|
+
});
|
|
440
|
+
logger.success(
|
|
441
|
+
`migration ${m.id} queued (key=${m.keyId} ${m.sourceAlgorithm}->${m.targetAlgorithm})`,
|
|
442
|
+
);
|
|
443
|
+
} catch (err) {
|
|
444
|
+
logger.error(err.message);
|
|
445
|
+
process.exit(1);
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
pqc
|
|
450
|
+
.command("start-migration-v2 <id>")
|
|
451
|
+
.description("[V2] Start a migration (queued -> running)")
|
|
452
|
+
.action((id) => {
|
|
453
|
+
try {
|
|
454
|
+
const m = startMigrationV2(id);
|
|
455
|
+
logger.success(`migration ${m.id} running`);
|
|
456
|
+
} catch (err) {
|
|
457
|
+
logger.error(err.message);
|
|
458
|
+
process.exit(1);
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
pqc
|
|
463
|
+
.command("complete-migration-v2 <id>")
|
|
464
|
+
.description("[V2] Complete a migration (running -> completed)")
|
|
465
|
+
.action((id) => {
|
|
466
|
+
try {
|
|
467
|
+
const m = completeMigrationV2(id);
|
|
468
|
+
logger.success(`migration ${m.id} completed`);
|
|
469
|
+
} catch (err) {
|
|
470
|
+
logger.error(err.message);
|
|
471
|
+
process.exit(1);
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
pqc
|
|
476
|
+
.command("fail-migration-v2 <id>")
|
|
477
|
+
.description("[V2] Fail a migration (running -> failed)")
|
|
478
|
+
.action((id) => {
|
|
479
|
+
try {
|
|
480
|
+
const m = failMigrationV2(id);
|
|
481
|
+
logger.success(`migration ${m.id} failed`);
|
|
482
|
+
} catch (err) {
|
|
483
|
+
logger.error(err.message);
|
|
484
|
+
process.exit(1);
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
pqc
|
|
489
|
+
.command("cancel-migration-v2 <id>")
|
|
490
|
+
.description("[V2] Cancel a migration (queued|running -> cancelled)")
|
|
491
|
+
.action((id) => {
|
|
492
|
+
try {
|
|
493
|
+
const m = cancelMigrationV2(id);
|
|
494
|
+
logger.success(`migration ${m.id} cancelled`);
|
|
495
|
+
} catch (err) {
|
|
496
|
+
logger.error(err.message);
|
|
497
|
+
process.exit(1);
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
|
|
501
|
+
pqc
|
|
502
|
+
.command("get-migration-v2 <id>")
|
|
503
|
+
.description("[V2] Show migration job")
|
|
504
|
+
.option("--json", "Output as JSON")
|
|
505
|
+
.action((id, opts) => {
|
|
506
|
+
try {
|
|
507
|
+
const m = getMigrationV2(id);
|
|
508
|
+
if (!m) {
|
|
509
|
+
logger.info("migration not found");
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
if (opts.json) console.log(JSON.stringify(m, null, 2));
|
|
513
|
+
else logger.log(JSON.stringify(m, null, 2));
|
|
514
|
+
} catch (err) {
|
|
515
|
+
logger.error(err.message);
|
|
516
|
+
process.exit(1);
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
pqc
|
|
521
|
+
.command("list-migrations-v2")
|
|
522
|
+
.description("[V2] List V2 migrations")
|
|
523
|
+
.option("-k, --key <keyId>", "Filter by key")
|
|
524
|
+
.option("-s, --status <s>", "Filter by status")
|
|
525
|
+
.option("--json", "Output as JSON")
|
|
526
|
+
.action((opts) => {
|
|
527
|
+
const list = listMigrationsV2({ keyId: opts.key, status: opts.status });
|
|
528
|
+
if (opts.json) console.log(JSON.stringify(list, null, 2));
|
|
529
|
+
else
|
|
530
|
+
for (const m of list)
|
|
531
|
+
logger.log(
|
|
532
|
+
`${m.id}\t${m.keyId}\t${m.status}\t${m.sourceAlgorithm}->${m.targetAlgorithm}`,
|
|
533
|
+
);
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
pqc
|
|
537
|
+
.command("active-key-count-v2")
|
|
538
|
+
.description("[V2] Count active keys (optional --owner filter)")
|
|
539
|
+
.option("-o, --owner <id>", "Filter by owner")
|
|
540
|
+
.action((opts) => {
|
|
541
|
+
logger.log(String(getActiveKeyCountV2(opts.owner)));
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
pqc
|
|
545
|
+
.command("pending-migration-count-v2")
|
|
546
|
+
.description(
|
|
547
|
+
"[V2] Count pending migrations (queued+running) (optional --key filter)",
|
|
548
|
+
)
|
|
549
|
+
.option("-k, --key <keyId>", "Filter by key")
|
|
550
|
+
.action((opts) => {
|
|
551
|
+
logger.log(String(getPendingMigrationCountV2(opts.key)));
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
pqc
|
|
555
|
+
.command("auto-deprecate-idle-keys-v2")
|
|
556
|
+
.description("[V2] Deprecate idle active keys")
|
|
557
|
+
.option("--now <ms>", "Override current time (ms)")
|
|
558
|
+
.option("--json", "Output as JSON")
|
|
559
|
+
.action((opts) => {
|
|
560
|
+
const list = autoDeprecateIdleKeysV2(
|
|
561
|
+
opts.now ? { now: Number(opts.now) } : undefined,
|
|
562
|
+
);
|
|
563
|
+
if (opts.json) console.log(JSON.stringify(list, null, 2));
|
|
564
|
+
else logger.success(`deprecated ${list.length} key(s)`);
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
pqc
|
|
568
|
+
.command("auto-fail-stuck-migrations-v2")
|
|
569
|
+
.description("[V2] Fail stuck running migrations")
|
|
570
|
+
.option("--now <ms>", "Override current time (ms)")
|
|
571
|
+
.option("--json", "Output as JSON")
|
|
572
|
+
.action((opts) => {
|
|
573
|
+
const list = autoFailStuckMigrationsV2(
|
|
574
|
+
opts.now ? { now: Number(opts.now) } : undefined,
|
|
575
|
+
);
|
|
576
|
+
if (opts.json) console.log(JSON.stringify(list, null, 2));
|
|
577
|
+
else logger.success(`failed ${list.length} migration(s)`);
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
pqc
|
|
581
|
+
.command("stats-v2")
|
|
582
|
+
.description("[V2] Show governance stats")
|
|
583
|
+
.option("--json", "Output as JSON")
|
|
584
|
+
.action((opts) => {
|
|
585
|
+
const s = getPqcManagerStatsV2();
|
|
586
|
+
if (opts.json) console.log(JSON.stringify(s, null, 2));
|
|
587
|
+
else logger.log(JSON.stringify(s, null, 2));
|
|
588
|
+
});
|
|
196
589
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt Compressor V2 governance commands — `cc promcomp ...`
|
|
3
|
+
* 在内存中治理 PCOMP profile (pending/active/stale/archived) + run 生命周期。
|
|
4
|
+
*/
|
|
5
|
+
import {
|
|
6
|
+
PCOMP_PROFILE_MATURITY_V2,
|
|
7
|
+
PCOMP_RUN_LIFECYCLE_V2,
|
|
8
|
+
registerPcompProfileV2,
|
|
9
|
+
activatePcompProfileV2,
|
|
10
|
+
stalePcompProfileV2,
|
|
11
|
+
archivePcompProfileV2,
|
|
12
|
+
touchPcompProfileV2,
|
|
13
|
+
getPcompProfileV2,
|
|
14
|
+
listPcompProfilesV2,
|
|
15
|
+
createPcompRunV2,
|
|
16
|
+
compressingPcompRunV2,
|
|
17
|
+
compressPcompRunV2,
|
|
18
|
+
failPcompRunV2,
|
|
19
|
+
cancelPcompRunV2,
|
|
20
|
+
getPcompRunV2,
|
|
21
|
+
listPcompRunsV2,
|
|
22
|
+
setMaxActivePcompProfilesPerOwnerV2,
|
|
23
|
+
getMaxActivePcompProfilesPerOwnerV2,
|
|
24
|
+
setMaxPendingPcompRunsPerProfileV2,
|
|
25
|
+
getMaxPendingPcompRunsPerProfileV2,
|
|
26
|
+
setPcompProfileIdleMsV2,
|
|
27
|
+
getPcompProfileIdleMsV2,
|
|
28
|
+
setPcompRunStuckMsV2,
|
|
29
|
+
getPcompRunStuckMsV2,
|
|
30
|
+
autoStaleIdlePcompProfilesV2,
|
|
31
|
+
autoFailStuckPcompRunsV2,
|
|
32
|
+
getPromptCompressorGovStatsV2,
|
|
33
|
+
} from "../lib/prompt-compressor.js";
|
|
34
|
+
|
|
35
|
+
export function registerPromcompCommand(program) {
|
|
36
|
+
const pc = program
|
|
37
|
+
.command("promcomp")
|
|
38
|
+
.description("Prompt Compressor V2 governance (in-memory, CLI v0.143.0)");
|
|
39
|
+
|
|
40
|
+
pc.command("enums-v2")
|
|
41
|
+
.description("Show V2 enums")
|
|
42
|
+
.action(() => console.log(JSON.stringify({ PCOMP_PROFILE_MATURITY_V2, PCOMP_RUN_LIFECYCLE_V2 }, null, 2)));
|
|
43
|
+
pc.command("register-profile-v2")
|
|
44
|
+
.requiredOption("--id <id>")
|
|
45
|
+
.requiredOption("--owner <owner>")
|
|
46
|
+
.option("--variant <variant>", "compressor variant", "default")
|
|
47
|
+
.action((o) => console.log(JSON.stringify(registerPcompProfileV2(o), null, 2)));
|
|
48
|
+
pc.command("activate-profile-v2 <id>").action((id) => console.log(JSON.stringify(activatePcompProfileV2(id), null, 2)));
|
|
49
|
+
pc.command("stale-profile-v2 <id>").action((id) => console.log(JSON.stringify(stalePcompProfileV2(id), null, 2)));
|
|
50
|
+
pc.command("archive-profile-v2 <id>").action((id) => console.log(JSON.stringify(archivePcompProfileV2(id), null, 2)));
|
|
51
|
+
pc.command("touch-profile-v2 <id>").action((id) => console.log(JSON.stringify(touchPcompProfileV2(id), null, 2)));
|
|
52
|
+
pc.command("get-profile-v2 <id>").action((id) => console.log(JSON.stringify(getPcompProfileV2(id), null, 2)));
|
|
53
|
+
pc.command("list-profiles-v2").action(() => console.log(JSON.stringify(listPcompProfilesV2(), null, 2)));
|
|
54
|
+
|
|
55
|
+
pc.command("create-run-v2")
|
|
56
|
+
.requiredOption("--id <id>")
|
|
57
|
+
.requiredOption("--profile-id <profileId>")
|
|
58
|
+
.option("--input <input>", "input prompt", "")
|
|
59
|
+
.action((o) => console.log(JSON.stringify(createPcompRunV2(o), null, 2)));
|
|
60
|
+
pc.command("compressing-run-v2 <id>").action((id) => console.log(JSON.stringify(compressingPcompRunV2(id), null, 2)));
|
|
61
|
+
pc.command("compress-run-v2 <id>").action((id) => console.log(JSON.stringify(compressPcompRunV2(id), null, 2)));
|
|
62
|
+
pc.command("fail-run-v2 <id>").option("--reason <r>").action((id, o) => console.log(JSON.stringify(failPcompRunV2(id, o.reason), null, 2)));
|
|
63
|
+
pc.command("cancel-run-v2 <id>").option("--reason <r>").action((id, o) => console.log(JSON.stringify(cancelPcompRunV2(id, o.reason), null, 2)));
|
|
64
|
+
pc.command("get-run-v2 <id>").action((id) => console.log(JSON.stringify(getPcompRunV2(id), null, 2)));
|
|
65
|
+
pc.command("list-runs-v2").action(() => console.log(JSON.stringify(listPcompRunsV2(), null, 2)));
|
|
66
|
+
|
|
67
|
+
pc.command("config-v2").action(() =>
|
|
68
|
+
console.log(JSON.stringify({
|
|
69
|
+
maxActivePcompProfilesPerOwner: getMaxActivePcompProfilesPerOwnerV2(),
|
|
70
|
+
maxPendingPcompRunsPerProfile: getMaxPendingPcompRunsPerProfileV2(),
|
|
71
|
+
pcompProfileIdleMs: getPcompProfileIdleMsV2(),
|
|
72
|
+
pcompRunStuckMs: getPcompRunStuckMsV2(),
|
|
73
|
+
}, null, 2)),
|
|
74
|
+
);
|
|
75
|
+
pc.command("set-max-active-profiles-v2 <n>").action((n) => { setMaxActivePcompProfilesPerOwnerV2(Number(n)); console.log(JSON.stringify({ maxActivePcompProfilesPerOwner: getMaxActivePcompProfilesPerOwnerV2() }, null, 2)); });
|
|
76
|
+
pc.command("set-max-pending-runs-v2 <n>").action((n) => { setMaxPendingPcompRunsPerProfileV2(Number(n)); console.log(JSON.stringify({ maxPendingPcompRunsPerProfile: getMaxPendingPcompRunsPerProfileV2() }, null, 2)); });
|
|
77
|
+
pc.command("set-profile-idle-ms-v2 <ms>").action((ms) => { setPcompProfileIdleMsV2(Number(ms)); console.log(JSON.stringify({ pcompProfileIdleMs: getPcompProfileIdleMsV2() }, null, 2)); });
|
|
78
|
+
pc.command("set-run-stuck-ms-v2 <ms>").action((ms) => { setPcompRunStuckMsV2(Number(ms)); console.log(JSON.stringify({ pcompRunStuckMs: getPcompRunStuckMsV2() }, null, 2)); });
|
|
79
|
+
pc.command("auto-stale-idle-v2").action(() => console.log(JSON.stringify(autoStaleIdlePcompProfilesV2(), null, 2)));
|
|
80
|
+
pc.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckPcompRunsV2(), null, 2)));
|
|
81
|
+
pc.command("gov-stats-v2").action(() => console.log(JSON.stringify(getPromptCompressorGovStatsV2(), null, 2)));
|
|
82
|
+
}
|