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
|
@@ -26,6 +26,44 @@ import {
|
|
|
26
26
|
getRecommendationStats,
|
|
27
27
|
getTopInterests,
|
|
28
28
|
suggestTopics,
|
|
29
|
+
// V2 (Phase 48 V2)
|
|
30
|
+
PROFILE_MATURITY_V2,
|
|
31
|
+
FEED_LIFECYCLE_V2,
|
|
32
|
+
REC_DEFAULT_MAX_ACTIVE_PROFILES_PER_SEGMENT,
|
|
33
|
+
REC_DEFAULT_MAX_ACTIVE_FEEDS_PER_CURATOR,
|
|
34
|
+
REC_DEFAULT_PROFILE_IDLE_MS,
|
|
35
|
+
REC_DEFAULT_FEED_STALE_MS,
|
|
36
|
+
getDefaultMaxActiveProfilesPerSegmentV2,
|
|
37
|
+
getMaxActiveProfilesPerSegmentV2,
|
|
38
|
+
setMaxActiveProfilesPerSegmentV2,
|
|
39
|
+
getDefaultMaxActiveFeedsPerCuratorV2,
|
|
40
|
+
getMaxActiveFeedsPerCuratorV2,
|
|
41
|
+
setMaxActiveFeedsPerCuratorV2,
|
|
42
|
+
getDefaultProfileIdleMsV2,
|
|
43
|
+
getProfileIdleMsV2,
|
|
44
|
+
setProfileIdleMsV2,
|
|
45
|
+
getDefaultFeedStaleMsV2,
|
|
46
|
+
getFeedStaleMsV2,
|
|
47
|
+
setFeedStaleMsV2,
|
|
48
|
+
registerProfileV2,
|
|
49
|
+
getProfileV2,
|
|
50
|
+
setProfileMaturityV2,
|
|
51
|
+
activateProfile,
|
|
52
|
+
dormantProfile,
|
|
53
|
+
retireProfile,
|
|
54
|
+
touchProfileActivity,
|
|
55
|
+
registerFeedV2,
|
|
56
|
+
getFeedV2,
|
|
57
|
+
setFeedStatusV2,
|
|
58
|
+
activateFeed,
|
|
59
|
+
pauseFeed,
|
|
60
|
+
archiveFeed,
|
|
61
|
+
touchFeedPublish,
|
|
62
|
+
getActiveProfileCount,
|
|
63
|
+
getActiveFeedCount,
|
|
64
|
+
autoDormantIdleProfiles,
|
|
65
|
+
autoArchiveStaleFeeds,
|
|
66
|
+
getRecommendationStatsV2,
|
|
29
67
|
} from "../lib/content-recommendation.js";
|
|
30
68
|
|
|
31
69
|
function _dbFromCtx(cmd) {
|
|
@@ -332,5 +370,349 @@ export function registerRecommendCommand(program) {
|
|
|
332
370
|
console.log(` ${s.action.padEnd(8)} ${s.topic} by ${s.amount}`);
|
|
333
371
|
});
|
|
334
372
|
|
|
373
|
+
/* ── V2 (Phase 48 V2) ────────────────────────────── */
|
|
374
|
+
|
|
375
|
+
function _parseJsonFlag(value, label) {
|
|
376
|
+
if (value === undefined) return undefined;
|
|
377
|
+
try {
|
|
378
|
+
return JSON.parse(value);
|
|
379
|
+
} catch {
|
|
380
|
+
throw new Error(`Invalid JSON for ${label}`);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
rec
|
|
385
|
+
.command("profile-maturities-v2")
|
|
386
|
+
.description("List V2 profile maturity states")
|
|
387
|
+
.option("--json", "JSON output")
|
|
388
|
+
.action((opts) => {
|
|
389
|
+
const out = Object.values(PROFILE_MATURITY_V2);
|
|
390
|
+
if (opts.json) return console.log(JSON.stringify(out, null, 2));
|
|
391
|
+
for (const s of out) console.log(` ${s}`);
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
rec
|
|
395
|
+
.command("feed-lifecycles-v2")
|
|
396
|
+
.description("List V2 feed lifecycle states")
|
|
397
|
+
.option("--json", "JSON output")
|
|
398
|
+
.action((opts) => {
|
|
399
|
+
const out = Object.values(FEED_LIFECYCLE_V2);
|
|
400
|
+
if (opts.json) return console.log(JSON.stringify(out, null, 2));
|
|
401
|
+
for (const s of out) console.log(` ${s}`);
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
rec
|
|
405
|
+
.command("default-max-active-profiles-per-segment")
|
|
406
|
+
.description("Show V2 default per-segment active-profile cap")
|
|
407
|
+
.action(() =>
|
|
408
|
+
console.log(String(getDefaultMaxActiveProfilesPerSegmentV2())),
|
|
409
|
+
);
|
|
410
|
+
|
|
411
|
+
rec
|
|
412
|
+
.command("max-active-profiles-per-segment")
|
|
413
|
+
.description("Show current V2 per-segment active-profile cap")
|
|
414
|
+
.action(() => console.log(String(getMaxActiveProfilesPerSegmentV2())));
|
|
415
|
+
|
|
416
|
+
rec
|
|
417
|
+
.command("set-max-active-profiles-per-segment <n>")
|
|
418
|
+
.description("Set V2 per-segment active-profile cap")
|
|
419
|
+
.action((n) =>
|
|
420
|
+
console.log(String(setMaxActiveProfilesPerSegmentV2(Number(n)))),
|
|
421
|
+
);
|
|
422
|
+
|
|
423
|
+
rec
|
|
424
|
+
.command("default-max-active-feeds-per-curator")
|
|
425
|
+
.description("Show V2 default per-curator active-feed cap")
|
|
426
|
+
.action(() => console.log(String(getDefaultMaxActiveFeedsPerCuratorV2())));
|
|
427
|
+
|
|
428
|
+
rec
|
|
429
|
+
.command("max-active-feeds-per-curator")
|
|
430
|
+
.description("Show current V2 per-curator active-feed cap")
|
|
431
|
+
.action(() => console.log(String(getMaxActiveFeedsPerCuratorV2())));
|
|
432
|
+
|
|
433
|
+
rec
|
|
434
|
+
.command("set-max-active-feeds-per-curator <n>")
|
|
435
|
+
.description("Set V2 per-curator active-feed cap")
|
|
436
|
+
.action((n) =>
|
|
437
|
+
console.log(String(setMaxActiveFeedsPerCuratorV2(Number(n)))),
|
|
438
|
+
);
|
|
439
|
+
|
|
440
|
+
rec
|
|
441
|
+
.command("default-profile-idle-ms")
|
|
442
|
+
.description("Show V2 default profile-idle window (ms)")
|
|
443
|
+
.action(() => console.log(String(getDefaultProfileIdleMsV2())));
|
|
444
|
+
|
|
445
|
+
rec
|
|
446
|
+
.command("profile-idle-ms")
|
|
447
|
+
.description("Show current V2 profile-idle window (ms)")
|
|
448
|
+
.action(() => console.log(String(getProfileIdleMsV2())));
|
|
449
|
+
|
|
450
|
+
rec
|
|
451
|
+
.command("set-profile-idle-ms <ms>")
|
|
452
|
+
.description("Set V2 profile-idle window (ms)")
|
|
453
|
+
.action((ms) => console.log(String(setProfileIdleMsV2(Number(ms)))));
|
|
454
|
+
|
|
455
|
+
rec
|
|
456
|
+
.command("default-feed-stale-ms")
|
|
457
|
+
.description("Show V2 default feed-stale window (ms)")
|
|
458
|
+
.action(() => console.log(String(getDefaultFeedStaleMsV2())));
|
|
459
|
+
|
|
460
|
+
rec
|
|
461
|
+
.command("feed-stale-ms")
|
|
462
|
+
.description("Show current V2 feed-stale window (ms)")
|
|
463
|
+
.action(() => console.log(String(getFeedStaleMsV2())));
|
|
464
|
+
|
|
465
|
+
rec
|
|
466
|
+
.command("set-feed-stale-ms <ms>")
|
|
467
|
+
.description("Set V2 feed-stale window (ms)")
|
|
468
|
+
.action((ms) => console.log(String(setFeedStaleMsV2(Number(ms)))));
|
|
469
|
+
|
|
470
|
+
rec
|
|
471
|
+
.command("active-profile-count")
|
|
472
|
+
.description("Count active V2 profiles (optionally scoped by segment)")
|
|
473
|
+
.option("-s, --segment <segment>", "Scope by segment")
|
|
474
|
+
.action((opts) => console.log(String(getActiveProfileCount(opts.segment))));
|
|
475
|
+
|
|
476
|
+
rec
|
|
477
|
+
.command("active-feed-count")
|
|
478
|
+
.description("Count active V2 feeds (optionally scoped by curator)")
|
|
479
|
+
.option("-c, --curator <curator>", "Scope by curator")
|
|
480
|
+
.action((opts) => console.log(String(getActiveFeedCount(opts.curator))));
|
|
481
|
+
|
|
482
|
+
rec
|
|
483
|
+
.command("register-profile-v2 <profile-id>")
|
|
484
|
+
.description("Register a V2 profile")
|
|
485
|
+
.requiredOption("-s, --segment <segment>", "Segment bucket")
|
|
486
|
+
.option("-u, --user-id <user-id>", "User id")
|
|
487
|
+
.option("-i, --initial-status <status>", "Initial maturity status")
|
|
488
|
+
.option("-m, --metadata <json>", "Metadata JSON")
|
|
489
|
+
.action((profileId, opts) => {
|
|
490
|
+
const db = _dbFromCtx(rec);
|
|
491
|
+
const metadata = _parseJsonFlag(opts.metadata, "--metadata");
|
|
492
|
+
const out = registerProfileV2(db, {
|
|
493
|
+
profileId,
|
|
494
|
+
segment: opts.segment,
|
|
495
|
+
userId: opts.userId,
|
|
496
|
+
initialStatus: opts.initialStatus,
|
|
497
|
+
metadata,
|
|
498
|
+
});
|
|
499
|
+
console.log(JSON.stringify(out, null, 2));
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
rec
|
|
503
|
+
.command("profile-v2 <profile-id>")
|
|
504
|
+
.description("Show a V2 profile")
|
|
505
|
+
.action((profileId) => {
|
|
506
|
+
const out = getProfileV2(profileId);
|
|
507
|
+
console.log(out ? JSON.stringify(out, null, 2) : "null");
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
rec
|
|
511
|
+
.command("set-profile-maturity-v2 <profile-id> <status>")
|
|
512
|
+
.description("Set V2 profile maturity status")
|
|
513
|
+
.option("-r, --reason <reason>", "Reason")
|
|
514
|
+
.option("-m, --metadata <json>", "Metadata JSON (merged)")
|
|
515
|
+
.action((profileId, status, opts) => {
|
|
516
|
+
const db = _dbFromCtx(rec);
|
|
517
|
+
const metadata = _parseJsonFlag(opts.metadata, "--metadata");
|
|
518
|
+
const out = setProfileMaturityV2(db, profileId, status, {
|
|
519
|
+
reason: opts.reason,
|
|
520
|
+
metadata,
|
|
521
|
+
});
|
|
522
|
+
console.log(JSON.stringify(out, null, 2));
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
rec
|
|
526
|
+
.command("activate-profile <profile-id>")
|
|
527
|
+
.description("Activate a V2 profile")
|
|
528
|
+
.option("-r, --reason <reason>", "Reason")
|
|
529
|
+
.action((profileId, opts) => {
|
|
530
|
+
const db = _dbFromCtx(rec);
|
|
531
|
+
console.log(
|
|
532
|
+
JSON.stringify(activateProfile(db, profileId, opts.reason), null, 2),
|
|
533
|
+
);
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
rec
|
|
537
|
+
.command("dormant-profile <profile-id>")
|
|
538
|
+
.description("Mark a V2 profile dormant")
|
|
539
|
+
.option("-r, --reason <reason>", "Reason")
|
|
540
|
+
.action((profileId, opts) => {
|
|
541
|
+
const db = _dbFromCtx(rec);
|
|
542
|
+
console.log(
|
|
543
|
+
JSON.stringify(dormantProfile(db, profileId, opts.reason), null, 2),
|
|
544
|
+
);
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
rec
|
|
548
|
+
.command("retire-profile <profile-id>")
|
|
549
|
+
.description("Retire a V2 profile")
|
|
550
|
+
.option("-r, --reason <reason>", "Reason")
|
|
551
|
+
.action((profileId, opts) => {
|
|
552
|
+
const db = _dbFromCtx(rec);
|
|
553
|
+
console.log(
|
|
554
|
+
JSON.stringify(retireProfile(db, profileId, opts.reason), null, 2),
|
|
555
|
+
);
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
rec
|
|
559
|
+
.command("touch-profile-activity <profile-id>")
|
|
560
|
+
.description("Bump lastActivityAt on a V2 profile")
|
|
561
|
+
.action((profileId) => {
|
|
562
|
+
console.log(JSON.stringify(touchProfileActivity(profileId), null, 2));
|
|
563
|
+
});
|
|
564
|
+
|
|
565
|
+
rec
|
|
566
|
+
.command("register-feed-v2 <feed-id>")
|
|
567
|
+
.description("Register a V2 feed")
|
|
568
|
+
.requiredOption("-c, --curator-id <curator>", "Curator id")
|
|
569
|
+
.option("-t, --topics <csv>", "Comma-separated topics")
|
|
570
|
+
.option("-i, --initial-status <status>", "Initial lifecycle status")
|
|
571
|
+
.option("-m, --metadata <json>", "Metadata JSON")
|
|
572
|
+
.action((feedId, opts) => {
|
|
573
|
+
const db = _dbFromCtx(rec);
|
|
574
|
+
const metadata = _parseJsonFlag(opts.metadata, "--metadata");
|
|
575
|
+
const topics = opts.topics
|
|
576
|
+
? opts.topics
|
|
577
|
+
.split(",")
|
|
578
|
+
.map((s) => s.trim())
|
|
579
|
+
.filter(Boolean)
|
|
580
|
+
: [];
|
|
581
|
+
const out = registerFeedV2(db, {
|
|
582
|
+
feedId,
|
|
583
|
+
curatorId: opts.curatorId,
|
|
584
|
+
topics,
|
|
585
|
+
initialStatus: opts.initialStatus,
|
|
586
|
+
metadata,
|
|
587
|
+
});
|
|
588
|
+
console.log(JSON.stringify(out, null, 2));
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
rec
|
|
592
|
+
.command("feed-v2 <feed-id>")
|
|
593
|
+
.description("Show a V2 feed")
|
|
594
|
+
.action((feedId) => {
|
|
595
|
+
const out = getFeedV2(feedId);
|
|
596
|
+
console.log(out ? JSON.stringify(out, null, 2) : "null");
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
rec
|
|
600
|
+
.command("set-feed-status-v2 <feed-id> <status>")
|
|
601
|
+
.description("Set V2 feed lifecycle status")
|
|
602
|
+
.option("-r, --reason <reason>", "Reason")
|
|
603
|
+
.option("-m, --metadata <json>", "Metadata JSON (merged)")
|
|
604
|
+
.action((feedId, status, opts) => {
|
|
605
|
+
const db = _dbFromCtx(rec);
|
|
606
|
+
const metadata = _parseJsonFlag(opts.metadata, "--metadata");
|
|
607
|
+
const out = setFeedStatusV2(db, feedId, status, {
|
|
608
|
+
reason: opts.reason,
|
|
609
|
+
metadata,
|
|
610
|
+
});
|
|
611
|
+
console.log(JSON.stringify(out, null, 2));
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
rec
|
|
615
|
+
.command("activate-feed <feed-id>")
|
|
616
|
+
.description("Activate a V2 feed")
|
|
617
|
+
.option("-r, --reason <reason>", "Reason")
|
|
618
|
+
.action((feedId, opts) => {
|
|
619
|
+
const db = _dbFromCtx(rec);
|
|
620
|
+
console.log(
|
|
621
|
+
JSON.stringify(activateFeed(db, feedId, opts.reason), null, 2),
|
|
622
|
+
);
|
|
623
|
+
});
|
|
624
|
+
|
|
625
|
+
rec
|
|
626
|
+
.command("pause-feed <feed-id>")
|
|
627
|
+
.description("Pause a V2 feed")
|
|
628
|
+
.option("-r, --reason <reason>", "Reason")
|
|
629
|
+
.action((feedId, opts) => {
|
|
630
|
+
const db = _dbFromCtx(rec);
|
|
631
|
+
console.log(JSON.stringify(pauseFeed(db, feedId, opts.reason), null, 2));
|
|
632
|
+
});
|
|
633
|
+
|
|
634
|
+
rec
|
|
635
|
+
.command("archive-feed <feed-id>")
|
|
636
|
+
.description("Archive a V2 feed")
|
|
637
|
+
.option("-r, --reason <reason>", "Reason")
|
|
638
|
+
.action((feedId, opts) => {
|
|
639
|
+
const db = _dbFromCtx(rec);
|
|
640
|
+
console.log(
|
|
641
|
+
JSON.stringify(archiveFeed(db, feedId, opts.reason), null, 2),
|
|
642
|
+
);
|
|
643
|
+
});
|
|
644
|
+
|
|
645
|
+
rec
|
|
646
|
+
.command("touch-feed-publish <feed-id>")
|
|
647
|
+
.description("Bump lastPublishAt on a V2 feed")
|
|
648
|
+
.action((feedId) => {
|
|
649
|
+
console.log(JSON.stringify(touchFeedPublish(feedId), null, 2));
|
|
650
|
+
});
|
|
651
|
+
|
|
652
|
+
rec
|
|
653
|
+
.command("auto-dormant-idle-profiles")
|
|
654
|
+
.description("Auto-flip idle ACTIVE V2 profiles to DORMANT")
|
|
655
|
+
.action(() => {
|
|
656
|
+
const db = _dbFromCtx(rec);
|
|
657
|
+
console.log(JSON.stringify(autoDormantIdleProfiles(db), null, 2));
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
rec
|
|
661
|
+
.command("auto-archive-stale-feeds")
|
|
662
|
+
.description("Auto-flip stale ACTIVE/PAUSED V2 feeds to ARCHIVED")
|
|
663
|
+
.action(() => {
|
|
664
|
+
const db = _dbFromCtx(rec);
|
|
665
|
+
console.log(JSON.stringify(autoArchiveStaleFeeds(db), null, 2));
|
|
666
|
+
});
|
|
667
|
+
|
|
668
|
+
rec
|
|
669
|
+
.command("stats-v2")
|
|
670
|
+
.description("V2 recommendation stats (counts by state + config)")
|
|
671
|
+
.action(() => {
|
|
672
|
+
console.log(JSON.stringify(getRecommendationStatsV2(), null, 2));
|
|
673
|
+
});
|
|
674
|
+
|
|
335
675
|
program.addCommand(rec);
|
|
676
|
+
|
|
677
|
+
_registerRecommendCrV2(rec);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
import {
|
|
682
|
+
RECOMMENDER_PROFILE_MATURITY_V2, RECOMMENDATION_JOB_LIFECYCLE_V2,
|
|
683
|
+
setMaxActiveRecommenderProfilesPerOwnerV2, setMaxPendingRecommendationJobsPerProfileV2, setRecommenderProfileIdleMsV2, setRecommendationJobStuckMsV2,
|
|
684
|
+
registerRecommenderProfileV2, activateRecommenderProfileV2, staleRecommenderProfileV2, archiveRecommenderProfileV2, touchRecommenderProfileV2, getRecommenderProfileV2, listRecommenderProfilesV2,
|
|
685
|
+
createRecommendationJobV2, startRecommendationJobV2, completeRecommendationJobV2, failRecommendationJobV2, cancelRecommendationJobV2, getRecommendationJobV2, listRecommendationJobsV2,
|
|
686
|
+
autoStaleIdleRecommenderProfilesV2, autoFailStuckRecommendationJobsV2, getContentRecommenderGovStatsV2,
|
|
687
|
+
} from "../lib/content-recommender.js";
|
|
688
|
+
|
|
689
|
+
function _registerRecommendCrV2(parent) {
|
|
690
|
+
parent.command("cr-enums-v2").description("List Content Recommender V2 enums").option("--json", "JSON").action((opts) => {
|
|
691
|
+
const out = { profileMaturity: RECOMMENDER_PROFILE_MATURITY_V2, jobLifecycle: RECOMMENDATION_JOB_LIFECYCLE_V2 };
|
|
692
|
+
if (opts.json) console.log(JSON.stringify(out, null, 2)); else console.log(out);
|
|
693
|
+
});
|
|
694
|
+
parent.command("cr-config-set-v2").description("Set Content Recommender V2 caps/thresholds").option("--max-active <n>", "max active per owner").option("--max-pending <n>", "max pending per profile").option("--idle-ms <n>", "profile idle ms").option("--stuck-ms <n>", "job stuck ms").action((opts) => {
|
|
695
|
+
if (opts.maxActive) setMaxActiveRecommenderProfilesPerOwnerV2(parseInt(opts.maxActive, 10));
|
|
696
|
+
if (opts.maxPending) setMaxPendingRecommendationJobsPerProfileV2(parseInt(opts.maxPending, 10));
|
|
697
|
+
if (opts.idleMs) setRecommenderProfileIdleMsV2(parseInt(opts.idleMs, 10));
|
|
698
|
+
if (opts.stuckMs) setRecommendationJobStuckMsV2(parseInt(opts.stuckMs, 10));
|
|
699
|
+
console.log("ok");
|
|
700
|
+
});
|
|
701
|
+
parent.command("cr-register-profile-v2 <id>").description("Register Recommender V2 profile").requiredOption("--owner <owner>", "owner").option("--strategy <s>", "strategy").action((id, opts) => { console.log(registerRecommenderProfileV2({ id, owner: opts.owner, strategy: opts.strategy })); });
|
|
702
|
+
parent.command("cr-activate-profile-v2 <id>").description("Activate Recommender V2 profile").action((id) => { console.log(activateRecommenderProfileV2(id)); });
|
|
703
|
+
parent.command("cr-stale-profile-v2 <id>").description("Mark Recommender V2 profile stale").action((id) => { console.log(staleRecommenderProfileV2(id)); });
|
|
704
|
+
parent.command("cr-archive-profile-v2 <id>").description("Archive Recommender V2 profile").action((id) => { console.log(archiveRecommenderProfileV2(id)); });
|
|
705
|
+
parent.command("cr-touch-profile-v2 <id>").description("Touch Recommender V2 profile").action((id) => { console.log(touchRecommenderProfileV2(id)); });
|
|
706
|
+
parent.command("cr-get-profile-v2 <id>").description("Get Recommender V2 profile").action((id) => { console.log(getRecommenderProfileV2(id)); });
|
|
707
|
+
parent.command("cr-list-profiles-v2").description("List Recommender V2 profiles").action(() => { console.log(listRecommenderProfilesV2()); });
|
|
708
|
+
parent.command("cr-create-job-v2 <id>").description("Create Recommendation V2 job").requiredOption("--profile-id <pid>", "profile id").option("--query <q>", "query").action((id, opts) => { console.log(createRecommendationJobV2({ id, profileId: opts.profileId, query: opts.query })); });
|
|
709
|
+
parent.command("cr-start-job-v2 <id>").description("Start Recommendation V2 job").action((id) => { console.log(startRecommendationJobV2(id)); });
|
|
710
|
+
parent.command("cr-complete-job-v2 <id>").description("Complete Recommendation V2 job").action((id) => { console.log(completeRecommendationJobV2(id)); });
|
|
711
|
+
parent.command("cr-fail-job-v2 <id>").description("Fail Recommendation V2 job").option("--reason <r>", "reason").action((id, opts) => { console.log(failRecommendationJobV2(id, opts.reason)); });
|
|
712
|
+
parent.command("cr-cancel-job-v2 <id>").description("Cancel Recommendation V2 job").option("--reason <r>", "reason").action((id, opts) => { console.log(cancelRecommendationJobV2(id, opts.reason)); });
|
|
713
|
+
parent.command("cr-get-job-v2 <id>").description("Get Recommendation V2 job").action((id) => { console.log(getRecommendationJobV2(id)); });
|
|
714
|
+
parent.command("cr-list-jobs-v2").description("List Recommendation V2 jobs").action(() => { console.log(listRecommendationJobsV2()); });
|
|
715
|
+
parent.command("cr-auto-stale-profiles-v2").description("Auto-stale idle Recommender V2 profiles").action(() => { console.log(autoStaleIdleRecommenderProfilesV2()); });
|
|
716
|
+
parent.command("cr-auto-fail-jobs-v2").description("Auto-fail stuck Recommendation V2 jobs").action(() => { console.log(autoFailStuckRecommendationJobsV2()); });
|
|
717
|
+
parent.command("cr-gov-stats-v2").description("Content Recommender V2 governance stats").option("--json", "JSON").action((opts) => { const s = getContentRecommenderGovStatsV2(); if (opts.json) console.log(JSON.stringify(s, null, 2)); else console.log(s); });
|
|
336
718
|
}
|