chainlesschain 0.132.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.
Files changed (106) hide show
  1. package/package.json +1 -1
  2. package/src/commands/a2a.js +62 -0
  3. package/src/commands/activitypub.js +61 -0
  4. package/src/commands/agent.js +117 -0
  5. package/src/commands/bi.js +61 -0
  6. package/src/commands/bm25.js +78 -0
  7. package/src/commands/browse.js +64 -0
  8. package/src/commands/ccron.js +78 -0
  9. package/src/commands/compliance.js +40 -0
  10. package/src/commands/compt.js +78 -0
  11. package/src/commands/consol.js +231 -0
  12. package/src/commands/cowork.js +42 -0
  13. package/src/commands/crosschain.js +62 -0
  14. package/src/commands/dao.js +62 -0
  15. package/src/commands/dlp.js +61 -0
  16. package/src/commands/economy.js +56 -0
  17. package/src/commands/evolution.js +56 -0
  18. package/src/commands/evomap.js +61 -0
  19. package/src/commands/fflag.js +178 -0
  20. package/src/commands/git.js +45 -0
  21. package/src/commands/hmemory.js +56 -0
  22. package/src/commands/inference.js +42 -0
  23. package/src/commands/itbudget.js +45 -0
  24. package/src/commands/lowcode.js +44 -0
  25. package/src/commands/matrix.js +62 -0
  26. package/src/commands/mcpscaf.js +41 -0
  27. package/src/commands/meminj.js +41 -0
  28. package/src/commands/nostr.js +62 -0
  29. package/src/commands/orchgov.js +45 -0
  30. package/src/commands/pdfp.js +78 -0
  31. package/src/commands/perf.js +39 -0
  32. package/src/commands/perm.js +45 -0
  33. package/src/commands/pipeline.js +57 -1
  34. package/src/commands/planmode.js +45 -0
  35. package/src/commands/promcomp.js +82 -0
  36. package/src/commands/recommend.js +42 -0
  37. package/src/commands/seshhook.js +41 -0
  38. package/src/commands/seshsearch.js +41 -0
  39. package/src/commands/seshtail.js +41 -0
  40. package/src/commands/seshu.js +41 -0
  41. package/src/commands/sganal.js +78 -0
  42. package/src/commands/siem.js +40 -0
  43. package/src/commands/slotfill.js +41 -0
  44. package/src/commands/social.js +34 -0
  45. package/src/commands/svccont.js +45 -0
  46. package/src/commands/tms.js +45 -0
  47. package/src/commands/topiccls.js +45 -0
  48. package/src/commands/uprof.js +45 -0
  49. package/src/commands/vcheck.js +78 -0
  50. package/src/commands/webfetch.js +41 -0
  51. package/src/commands/zkp.js +62 -0
  52. package/src/harness/prompt-compressor.js +331 -0
  53. package/src/index.js +61 -1
  54. package/src/lib/a2a-protocol.js +105 -0
  55. package/src/lib/activitypub-bridge.js +105 -0
  56. package/src/lib/agent-economy.js +105 -0
  57. package/src/lib/app-builder.js +105 -0
  58. package/src/lib/autonomous-agent.js +105 -0
  59. package/src/lib/bi-engine.js +105 -0
  60. package/src/lib/bm25-search.js +81 -0
  61. package/src/lib/browser-automation.js +105 -0
  62. package/src/lib/compliance-framework-reporter.js +105 -0
  63. package/src/lib/compression-telemetry.js +81 -0
  64. package/src/lib/content-recommender.js +105 -0
  65. package/src/lib/cowork-cron.js +81 -0
  66. package/src/lib/cowork-task-runner.js +105 -0
  67. package/src/lib/cross-chain.js +105 -0
  68. package/src/lib/dao-governance.js +105 -0
  69. package/src/lib/dlp-engine.js +105 -0
  70. package/src/lib/evolution-system.js +105 -0
  71. package/src/lib/evomap-manager.js +105 -0
  72. package/src/lib/execution-backend.js +105 -0
  73. package/src/lib/feature-flags.js +85 -0
  74. package/src/lib/git-integration.js +105 -0
  75. package/src/lib/hierarchical-memory.js +105 -0
  76. package/src/lib/inference-network.js +105 -0
  77. package/src/lib/iteration-budget.js +105 -0
  78. package/src/lib/matrix-bridge.js +105 -0
  79. package/src/lib/mcp-scaffold.js +81 -0
  80. package/src/lib/memory-injection.js +81 -0
  81. package/src/lib/nostr-bridge.js +105 -0
  82. package/src/lib/orchestrator.js +105 -0
  83. package/src/lib/pdf-parser.js +81 -0
  84. package/src/lib/perf-tuning.js +105 -0
  85. package/src/lib/permission-engine.js +81 -0
  86. package/src/lib/pipeline-orchestrator.js +105 -0
  87. package/src/lib/plan-mode.js +81 -0
  88. package/src/lib/prompt-compressor.js +1 -10
  89. package/src/lib/service-container.js +81 -0
  90. package/src/lib/session-consolidator.js +105 -0
  91. package/src/lib/session-hooks.js +81 -0
  92. package/src/lib/session-search.js +81 -0
  93. package/src/lib/session-tail.js +81 -0
  94. package/src/lib/session-usage.js +83 -0
  95. package/src/lib/siem-exporter.js +105 -0
  96. package/src/lib/slot-filler.js +81 -0
  97. package/src/lib/social-graph-analytics.js +81 -0
  98. package/src/lib/social-graph.js +81 -0
  99. package/src/lib/sub-agent-registry.js +110 -0
  100. package/src/lib/task-model-selector.js +81 -0
  101. package/src/lib/todo-manager.js +105 -0
  102. package/src/lib/topic-classifier.js +105 -0
  103. package/src/lib/user-profile.js +81 -0
  104. package/src/lib/version-checker.js +81 -0
  105. package/src/lib/web-fetch.js +81 -0
  106. package/src/lib/zkp-engine.js +105 -0
@@ -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
+ }
@@ -673,4 +673,46 @@ export function registerRecommendCommand(program) {
673
673
  });
674
674
 
675
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); });
676
718
  }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * `cc seshhook` — Session Hooks V2 governance overlay (in-memory, atop lib/session-hooks.js).
3
+ */
4
+ import {
5
+ SHOK_PROFILE_MATURITY_V2, SHOK_INVOCATION_LIFECYCLE_V2,
6
+ setMaxActiveShokProfilesPerOwnerV2, getMaxActiveShokProfilesPerOwnerV2,
7
+ setMaxPendingShokInvocationsPerProfileV2, getMaxPendingShokInvocationsPerProfileV2,
8
+ setShokProfileIdleMsV2, getShokProfileIdleMsV2,
9
+ setShokInvocationStuckMsV2, getShokInvocationStuckMsV2,
10
+ registerShokProfileV2, activateShokProfileV2, disableShokProfileV2, retireShokProfileV2, touchShokProfileV2, getShokProfileV2, listShokProfilesV2,
11
+ createShokInvocationV2, runningShokInvocationV2, completeShokInvocationV2, failShokInvocationV2, cancelShokInvocationV2, getShokInvocationV2, listShokInvocationsV2,
12
+ autoDisableIdleShokProfilesV2, autoFailStuckShokInvocationsV2, getSessionHooksGovStatsV2, _resetStateSessionHooksV2,
13
+ } from "../lib/session-hooks.js";
14
+
15
+ export function registerSeshhookCommand(program) {
16
+ const sh = program.command("seshhook").description("Session Hooks V2 governance");
17
+ sh.command("enums-v2").action(() => console.log(JSON.stringify({ profileMaturity: SHOK_PROFILE_MATURITY_V2, invocationLifecycle: SHOK_INVOCATION_LIFECYCLE_V2 }, null, 2)));
18
+ sh.command("config-v2").action(() => console.log(JSON.stringify({ maxActiveShokProfilesPerOwner: getMaxActiveShokProfilesPerOwnerV2(), maxPendingShokInvocationsPerProfile: getMaxPendingShokInvocationsPerProfileV2(), shokProfileIdleMs: getShokProfileIdleMsV2(), shokInvocationStuckMs: getShokInvocationStuckMsV2() }, null, 2)));
19
+ sh.command("set-max-active-v2 <n>").action((n) => { setMaxActiveShokProfilesPerOwnerV2(Number(n)); console.log("ok"); });
20
+ sh.command("set-max-pending-v2 <n>").action((n) => { setMaxPendingShokInvocationsPerProfileV2(Number(n)); console.log("ok"); });
21
+ sh.command("set-idle-ms-v2 <n>").action((n) => { setShokProfileIdleMsV2(Number(n)); console.log("ok"); });
22
+ sh.command("set-stuck-ms-v2 <n>").action((n) => { setShokInvocationStuckMsV2(Number(n)); console.log("ok"); });
23
+ sh.command("register-profile-v2 <id> <owner>").option("--event <e>", "event").action((id, owner, o) => console.log(JSON.stringify(registerShokProfileV2({ id, owner, event: o.event }), null, 2)));
24
+ sh.command("activate-profile-v2 <id>").action((id) => console.log(JSON.stringify(activateShokProfileV2(id), null, 2)));
25
+ sh.command("disable-profile-v2 <id>").action((id) => console.log(JSON.stringify(disableShokProfileV2(id), null, 2)));
26
+ sh.command("retire-profile-v2 <id>").action((id) => console.log(JSON.stringify(retireShokProfileV2(id), null, 2)));
27
+ sh.command("touch-profile-v2 <id>").action((id) => console.log(JSON.stringify(touchShokProfileV2(id), null, 2)));
28
+ sh.command("get-profile-v2 <id>").action((id) => console.log(JSON.stringify(getShokProfileV2(id), null, 2)));
29
+ sh.command("list-profiles-v2").action(() => console.log(JSON.stringify(listShokProfilesV2(), null, 2)));
30
+ sh.command("create-invocation-v2 <id> <profileId>").option("--payload <p>", "payload").action((id, profileId, o) => console.log(JSON.stringify(createShokInvocationV2({ id, profileId, payload: o.payload }), null, 2)));
31
+ sh.command("running-invocation-v2 <id>").action((id) => console.log(JSON.stringify(runningShokInvocationV2(id), null, 2)));
32
+ sh.command("complete-invocation-v2 <id>").action((id) => console.log(JSON.stringify(completeShokInvocationV2(id), null, 2)));
33
+ sh.command("fail-invocation-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(failShokInvocationV2(id, reason), null, 2)));
34
+ sh.command("cancel-invocation-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(cancelShokInvocationV2(id, reason), null, 2)));
35
+ sh.command("get-invocation-v2 <id>").action((id) => console.log(JSON.stringify(getShokInvocationV2(id), null, 2)));
36
+ sh.command("list-invocations-v2").action(() => console.log(JSON.stringify(listShokInvocationsV2(), null, 2)));
37
+ sh.command("auto-disable-idle-v2").action(() => console.log(JSON.stringify(autoDisableIdleShokProfilesV2(), null, 2)));
38
+ sh.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckShokInvocationsV2(), null, 2)));
39
+ sh.command("gov-stats-v2").action(() => console.log(JSON.stringify(getSessionHooksGovStatsV2(), null, 2)));
40
+ sh.command("reset-state-v2").action(() => { _resetStateSessionHooksV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
41
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * `cc seshsearch` — Session Search V2 governance overlay (in-memory, atop lib/session-search.js).
3
+ */
4
+ import {
5
+ SSCH_PROFILE_MATURITY_V2, SSCH_QUERY_LIFECYCLE_V2,
6
+ setMaxActiveSschProfilesPerOwnerV2, getMaxActiveSschProfilesPerOwnerV2,
7
+ setMaxPendingSschQueriesPerProfileV2, getMaxPendingSschQueriesPerProfileV2,
8
+ setSschProfileIdleMsV2, getSschProfileIdleMsV2,
9
+ setSschQueryStuckMsV2, getSschQueryStuckMsV2,
10
+ registerSschProfileV2, activateSschProfileV2, staleSschProfileV2, archiveSschProfileV2, touchSschProfileV2, getSschProfileV2, listSschProfilesV2,
11
+ createSschQueryV2, searchingSschQueryV2, completeSschQueryV2, failSschQueryV2, cancelSschQueryV2, getSschQueryV2, listSschQueriesV2,
12
+ autoStaleIdleSschProfilesV2, autoFailStuckSschQueriesV2, getSessionSearchGovStatsV2, _resetStateSessionSearchV2,
13
+ } from "../lib/session-search.js";
14
+
15
+ export function registerSeshsearchCommand(program) {
16
+ const ss = program.command("seshsearch").description("Session Search V2 governance");
17
+ ss.command("enums-v2").action(() => console.log(JSON.stringify({ profileMaturity: SSCH_PROFILE_MATURITY_V2, queryLifecycle: SSCH_QUERY_LIFECYCLE_V2 }, null, 2)));
18
+ ss.command("config-v2").action(() => console.log(JSON.stringify({ maxActiveSschProfilesPerOwner: getMaxActiveSschProfilesPerOwnerV2(), maxPendingSschQueriesPerProfile: getMaxPendingSschQueriesPerProfileV2(), sschProfileIdleMs: getSschProfileIdleMsV2(), sschQueryStuckMs: getSschQueryStuckMsV2() }, null, 2)));
19
+ ss.command("set-max-active-v2 <n>").action((n) => { setMaxActiveSschProfilesPerOwnerV2(Number(n)); console.log("ok"); });
20
+ ss.command("set-max-pending-v2 <n>").action((n) => { setMaxPendingSschQueriesPerProfileV2(Number(n)); console.log("ok"); });
21
+ ss.command("set-idle-ms-v2 <n>").action((n) => { setSschProfileIdleMsV2(Number(n)); console.log("ok"); });
22
+ ss.command("set-stuck-ms-v2 <n>").action((n) => { setSschQueryStuckMsV2(Number(n)); console.log("ok"); });
23
+ ss.command("register-profile-v2 <id> <owner>").option("--scope <s>", "scope").action((id, owner, o) => console.log(JSON.stringify(registerSschProfileV2({ id, owner, scope: o.scope }), null, 2)));
24
+ ss.command("activate-profile-v2 <id>").action((id) => console.log(JSON.stringify(activateSschProfileV2(id), null, 2)));
25
+ ss.command("stale-profile-v2 <id>").action((id) => console.log(JSON.stringify(staleSschProfileV2(id), null, 2)));
26
+ ss.command("archive-profile-v2 <id>").action((id) => console.log(JSON.stringify(archiveSschProfileV2(id), null, 2)));
27
+ ss.command("touch-profile-v2 <id>").action((id) => console.log(JSON.stringify(touchSschProfileV2(id), null, 2)));
28
+ ss.command("get-profile-v2 <id>").action((id) => console.log(JSON.stringify(getSschProfileV2(id), null, 2)));
29
+ ss.command("list-profiles-v2").action(() => console.log(JSON.stringify(listSschProfilesV2(), null, 2)));
30
+ ss.command("create-query-v2 <id> <profileId>").option("--q <q>", "query string").action((id, profileId, o) => console.log(JSON.stringify(createSschQueryV2({ id, profileId, q: o.q }), null, 2)));
31
+ ss.command("searching-query-v2 <id>").action((id) => console.log(JSON.stringify(searchingSschQueryV2(id), null, 2)));
32
+ ss.command("complete-query-v2 <id>").action((id) => console.log(JSON.stringify(completeSschQueryV2(id), null, 2)));
33
+ ss.command("fail-query-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(failSschQueryV2(id, reason), null, 2)));
34
+ ss.command("cancel-query-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(cancelSschQueryV2(id, reason), null, 2)));
35
+ ss.command("get-query-v2 <id>").action((id) => console.log(JSON.stringify(getSschQueryV2(id), null, 2)));
36
+ ss.command("list-queries-v2").action(() => console.log(JSON.stringify(listSschQueriesV2(), null, 2)));
37
+ ss.command("auto-stale-idle-v2").action(() => console.log(JSON.stringify(autoStaleIdleSschProfilesV2(), null, 2)));
38
+ ss.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckSschQueriesV2(), null, 2)));
39
+ ss.command("gov-stats-v2").action(() => console.log(JSON.stringify(getSessionSearchGovStatsV2(), null, 2)));
40
+ ss.command("reset-state-v2").action(() => { _resetStateSessionSearchV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
41
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * `cc seshtail` — Session Tail V2 governance overlay (in-memory, atop lib/session-tail.js).
3
+ */
4
+ import {
5
+ STAIL_SUB_MATURITY_V2, STAIL_EVENT_LIFECYCLE_V2,
6
+ setMaxActiveStailSubsPerOwnerV2, getMaxActiveStailSubsPerOwnerV2,
7
+ setMaxPendingStailEventsPerSubV2, getMaxPendingStailEventsPerSubV2,
8
+ setStailSubIdleMsV2, getStailSubIdleMsV2,
9
+ setStailEventStuckMsV2, getStailEventStuckMsV2,
10
+ registerStailSubV2, activateStailSubV2, pauseStailSubV2, closeStailSubV2, touchStailSubV2, getStailSubV2, listStailSubsV2,
11
+ createStailEventV2, tailingStailEventV2, completeStailEventV2, failStailEventV2, cancelStailEventV2, getStailEventV2, listStailEventsV2,
12
+ autoPauseIdleStailSubsV2, autoFailStuckStailEventsV2, getSessionTailGovStatsV2, _resetStateSessionTailV2,
13
+ } from "../lib/session-tail.js";
14
+
15
+ export function registerSeshtailCommand(program) {
16
+ const st = program.command("seshtail").description("Session Tail V2 governance");
17
+ st.command("enums-v2").action(() => console.log(JSON.stringify({ subMaturity: STAIL_SUB_MATURITY_V2, eventLifecycle: STAIL_EVENT_LIFECYCLE_V2 }, null, 2)));
18
+ st.command("config-v2").action(() => console.log(JSON.stringify({ maxActiveStailSubsPerOwner: getMaxActiveStailSubsPerOwnerV2(), maxPendingStailEventsPerSub: getMaxPendingStailEventsPerSubV2(), stailSubIdleMs: getStailSubIdleMsV2(), stailEventStuckMs: getStailEventStuckMsV2() }, null, 2)));
19
+ st.command("set-max-active-v2 <n>").action((n) => { setMaxActiveStailSubsPerOwnerV2(Number(n)); console.log("ok"); });
20
+ st.command("set-max-pending-v2 <n>").action((n) => { setMaxPendingStailEventsPerSubV2(Number(n)); console.log("ok"); });
21
+ st.command("set-idle-ms-v2 <n>").action((n) => { setStailSubIdleMsV2(Number(n)); console.log("ok"); });
22
+ st.command("set-stuck-ms-v2 <n>").action((n) => { setStailEventStuckMsV2(Number(n)); console.log("ok"); });
23
+ st.command("register-sub-v2 <id> <owner>").option("--sessionId <s>", "sessionId").action((id, owner, o) => console.log(JSON.stringify(registerStailSubV2({ id, owner, sessionId: o.sessionId }), null, 2)));
24
+ st.command("activate-sub-v2 <id>").action((id) => console.log(JSON.stringify(activateStailSubV2(id), null, 2)));
25
+ st.command("pause-sub-v2 <id>").action((id) => console.log(JSON.stringify(pauseStailSubV2(id), null, 2)));
26
+ st.command("close-sub-v2 <id>").action((id) => console.log(JSON.stringify(closeStailSubV2(id), null, 2)));
27
+ st.command("touch-sub-v2 <id>").action((id) => console.log(JSON.stringify(touchStailSubV2(id), null, 2)));
28
+ st.command("get-sub-v2 <id>").action((id) => console.log(JSON.stringify(getStailSubV2(id), null, 2)));
29
+ st.command("list-subs-v2").action(() => console.log(JSON.stringify(listStailSubsV2(), null, 2)));
30
+ st.command("create-event-v2 <id> <subId>").option("--cursor <c>", "cursor").action((id, subId, o) => console.log(JSON.stringify(createStailEventV2({ id, subId, cursor: o.cursor }), null, 2)));
31
+ st.command("tailing-event-v2 <id>").action((id) => console.log(JSON.stringify(tailingStailEventV2(id), null, 2)));
32
+ st.command("complete-event-v2 <id>").action((id) => console.log(JSON.stringify(completeStailEventV2(id), null, 2)));
33
+ st.command("fail-event-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(failStailEventV2(id, reason), null, 2)));
34
+ st.command("cancel-event-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(cancelStailEventV2(id, reason), null, 2)));
35
+ st.command("get-event-v2 <id>").action((id) => console.log(JSON.stringify(getStailEventV2(id), null, 2)));
36
+ st.command("list-events-v2").action(() => console.log(JSON.stringify(listStailEventsV2(), null, 2)));
37
+ st.command("auto-pause-idle-v2").action(() => console.log(JSON.stringify(autoPauseIdleStailSubsV2(), null, 2)));
38
+ st.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckStailEventsV2(), null, 2)));
39
+ st.command("gov-stats-v2").action(() => console.log(JSON.stringify(getSessionTailGovStatsV2(), null, 2)));
40
+ st.command("reset-state-v2").action(() => { _resetStateSessionTailV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
41
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * `cc seshu` — Session Usage V2 governance overlay (in-memory, atop lib/session-usage.js).
3
+ */
4
+ import {
5
+ SUSE_BUDGET_MATURITY_V2, SUSE_RECORD_LIFECYCLE_V2,
6
+ setMaxActiveSuseBudgetsPerOwnerV2, getMaxActiveSuseBudgetsPerOwnerV2,
7
+ setMaxPendingSuseRecordsPerBudgetV2, getMaxPendingSuseRecordsPerBudgetV2,
8
+ setSuseBudgetIdleMsV2, getSuseBudgetIdleMsV2,
9
+ setSuseRecordStuckMsV2, getSuseRecordStuckMsV2,
10
+ registerSuseBudgetV2, activateSuseBudgetV2, exhaustSuseBudgetV2, archiveSuseBudgetV2, touchSuseBudgetV2, getSuseBudgetV2, listSuseBudgetsV2,
11
+ createSuseRecordV2, recordingSuseRecordV2, recordSuseRecordV2, rejectSuseRecordV2, cancelSuseRecordV2, getSuseRecordV2, listSuseRecordsV2,
12
+ autoExhaustIdleSuseBudgetsV2, autoRejectStuckSuseRecordsV2, getSessionUsageGovStatsV2, _resetStateSessionUsageV2,
13
+ } from "../lib/session-usage.js";
14
+
15
+ export function registerSeshuCommand(program) {
16
+ const su = program.command("seshu").description("Session Usage V2 governance");
17
+ su.command("enums-v2").action(() => console.log(JSON.stringify({ budgetMaturity: SUSE_BUDGET_MATURITY_V2, recordLifecycle: SUSE_RECORD_LIFECYCLE_V2 }, null, 2)));
18
+ su.command("config-v2").action(() => console.log(JSON.stringify({ maxActiveSuseBudgetsPerOwner: getMaxActiveSuseBudgetsPerOwnerV2(), maxPendingSuseRecordsPerBudget: getMaxPendingSuseRecordsPerBudgetV2(), suseBudgetIdleMs: getSuseBudgetIdleMsV2(), suseRecordStuckMs: getSuseRecordStuckMsV2() }, null, 2)));
19
+ su.command("set-max-active-v2 <n>").action((n) => { setMaxActiveSuseBudgetsPerOwnerV2(Number(n)); console.log("ok"); });
20
+ su.command("set-max-pending-v2 <n>").action((n) => { setMaxPendingSuseRecordsPerBudgetV2(Number(n)); console.log("ok"); });
21
+ su.command("set-idle-ms-v2 <n>").action((n) => { setSuseBudgetIdleMsV2(Number(n)); console.log("ok"); });
22
+ su.command("set-stuck-ms-v2 <n>").action((n) => { setSuseRecordStuckMsV2(Number(n)); console.log("ok"); });
23
+ su.command("register-budget-v2 <id> <owner>").option("--limit <n>", "limit").action((id, owner, o) => console.log(JSON.stringify(registerSuseBudgetV2({ id, owner, limit: o.limit ? Number(o.limit) : undefined }), null, 2)));
24
+ su.command("activate-budget-v2 <id>").action((id) => console.log(JSON.stringify(activateSuseBudgetV2(id), null, 2)));
25
+ su.command("exhaust-budget-v2 <id>").action((id) => console.log(JSON.stringify(exhaustSuseBudgetV2(id), null, 2)));
26
+ su.command("archive-budget-v2 <id>").action((id) => console.log(JSON.stringify(archiveSuseBudgetV2(id), null, 2)));
27
+ su.command("touch-budget-v2 <id>").action((id) => console.log(JSON.stringify(touchSuseBudgetV2(id), null, 2)));
28
+ su.command("get-budget-v2 <id>").action((id) => console.log(JSON.stringify(getSuseBudgetV2(id), null, 2)));
29
+ su.command("list-budgets-v2").action(() => console.log(JSON.stringify(listSuseBudgetsV2(), null, 2)));
30
+ su.command("create-record-v2 <id> <budgetId>").option("--amount <n>", "amount").action((id, budgetId, o) => console.log(JSON.stringify(createSuseRecordV2({ id, budgetId, amount: o.amount ? Number(o.amount) : undefined }), null, 2)));
31
+ su.command("recording-record-v2 <id>").action((id) => console.log(JSON.stringify(recordingSuseRecordV2(id), null, 2)));
32
+ su.command("record-record-v2 <id>").action((id) => console.log(JSON.stringify(recordSuseRecordV2(id), null, 2)));
33
+ su.command("reject-record-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(rejectSuseRecordV2(id, reason), null, 2)));
34
+ su.command("cancel-record-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(cancelSuseRecordV2(id, reason), null, 2)));
35
+ su.command("get-record-v2 <id>").action((id) => console.log(JSON.stringify(getSuseRecordV2(id), null, 2)));
36
+ su.command("list-records-v2").action(() => console.log(JSON.stringify(listSuseRecordsV2(), null, 2)));
37
+ su.command("auto-exhaust-idle-v2").action(() => console.log(JSON.stringify(autoExhaustIdleSuseBudgetsV2(), null, 2)));
38
+ su.command("auto-reject-stuck-v2").action(() => console.log(JSON.stringify(autoRejectStuckSuseRecordsV2(), null, 2)));
39
+ su.command("gov-stats-v2").action(() => console.log(JSON.stringify(getSessionUsageGovStatsV2(), null, 2)));
40
+ su.command("reset-state-v2").action(() => { _resetStateSessionUsageV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
41
+ }
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Social Graph Analytics V2 governance commands — `cc sganal ...`
3
+ * 在内存中治理 SGAN profile (pending/active/stale/archived) + run 生命周期。
4
+ */
5
+ import {
6
+ SGAN_PROFILE_MATURITY_V2,
7
+ SGAN_RUN_LIFECYCLE_V2,
8
+ registerSganProfileV2,
9
+ activateSganProfileV2,
10
+ staleSganProfileV2,
11
+ archiveSganProfileV2,
12
+ touchSganProfileV2,
13
+ getSganProfileV2,
14
+ listSganProfilesV2,
15
+ createSganRunV2,
16
+ runningSganRunV2,
17
+ completeSganRunV2,
18
+ failSganRunV2,
19
+ cancelSganRunV2,
20
+ getSganRunV2,
21
+ listSganRunsV2,
22
+ setMaxActiveSganProfilesPerOwnerV2,
23
+ getMaxActiveSganProfilesPerOwnerV2,
24
+ setMaxPendingSganRunsPerProfileV2,
25
+ getMaxPendingSganRunsPerProfileV2,
26
+ setSganProfileIdleMsV2,
27
+ getSganProfileIdleMsV2,
28
+ setSganRunStuckMsV2,
29
+ getSganRunStuckMsV2,
30
+ autoStaleIdleSganProfilesV2,
31
+ autoFailStuckSganRunsV2,
32
+ getSocialGraphAnalyticsGovStatsV2,
33
+ } from "../lib/social-graph-analytics.js";
34
+
35
+ export function registerSganalCommand(program) {
36
+ const s = program
37
+ .command("sganal")
38
+ .description("Social Graph Analytics V2 governance (in-memory, CLI v0.143.0)");
39
+
40
+ s.command("enums-v2").action(() => console.log(JSON.stringify({ SGAN_PROFILE_MATURITY_V2, SGAN_RUN_LIFECYCLE_V2 }, null, 2)));
41
+ s.command("register-profile-v2")
42
+ .requiredOption("--id <id>")
43
+ .requiredOption("--owner <owner>")
44
+ .option("--algorithm <algorithm>", "graph algorithm", "centrality")
45
+ .action((o) => console.log(JSON.stringify(registerSganProfileV2(o), null, 2)));
46
+ s.command("activate-profile-v2 <id>").action((id) => console.log(JSON.stringify(activateSganProfileV2(id), null, 2)));
47
+ s.command("stale-profile-v2 <id>").action((id) => console.log(JSON.stringify(staleSganProfileV2(id), null, 2)));
48
+ s.command("archive-profile-v2 <id>").action((id) => console.log(JSON.stringify(archiveSganProfileV2(id), null, 2)));
49
+ s.command("touch-profile-v2 <id>").action((id) => console.log(JSON.stringify(touchSganProfileV2(id), null, 2)));
50
+ s.command("get-profile-v2 <id>").action((id) => console.log(JSON.stringify(getSganProfileV2(id), null, 2)));
51
+ s.command("list-profiles-v2").action(() => console.log(JSON.stringify(listSganProfilesV2(), null, 2)));
52
+
53
+ s.command("create-run-v2")
54
+ .requiredOption("--id <id>")
55
+ .requiredOption("--profile-id <profileId>")
56
+ .option("--snapshot-id <sid>", "graph snapshot id", "")
57
+ .action((o) => console.log(JSON.stringify(createSganRunV2({ id: o.id, profileId: o.profileId, snapshotId: o.snapshotId }), null, 2)));
58
+ s.command("running-run-v2 <id>").action((id) => console.log(JSON.stringify(runningSganRunV2(id), null, 2)));
59
+ s.command("complete-run-v2 <id>").action((id) => console.log(JSON.stringify(completeSganRunV2(id), null, 2)));
60
+ s.command("fail-run-v2 <id>").option("--reason <r>").action((id, o) => console.log(JSON.stringify(failSganRunV2(id, o.reason), null, 2)));
61
+ s.command("cancel-run-v2 <id>").option("--reason <r>").action((id, o) => console.log(JSON.stringify(cancelSganRunV2(id, o.reason), null, 2)));
62
+ s.command("get-run-v2 <id>").action((id) => console.log(JSON.stringify(getSganRunV2(id), null, 2)));
63
+ s.command("list-runs-v2").action(() => console.log(JSON.stringify(listSganRunsV2(), null, 2)));
64
+
65
+ s.command("config-v2").action(() => console.log(JSON.stringify({
66
+ maxActiveSganProfilesPerOwner: getMaxActiveSganProfilesPerOwnerV2(),
67
+ maxPendingSganRunsPerProfile: getMaxPendingSganRunsPerProfileV2(),
68
+ sganProfileIdleMs: getSganProfileIdleMsV2(),
69
+ sganRunStuckMs: getSganRunStuckMsV2(),
70
+ }, null, 2)));
71
+ s.command("set-max-active-profiles-v2 <n>").action((n) => { setMaxActiveSganProfilesPerOwnerV2(Number(n)); console.log(JSON.stringify({ maxActiveSganProfilesPerOwner: getMaxActiveSganProfilesPerOwnerV2() }, null, 2)); });
72
+ s.command("set-max-pending-runs-v2 <n>").action((n) => { setMaxPendingSganRunsPerProfileV2(Number(n)); console.log(JSON.stringify({ maxPendingSganRunsPerProfile: getMaxPendingSganRunsPerProfileV2() }, null, 2)); });
73
+ s.command("set-profile-idle-ms-v2 <ms>").action((ms) => { setSganProfileIdleMsV2(Number(ms)); console.log(JSON.stringify({ sganProfileIdleMs: getSganProfileIdleMsV2() }, null, 2)); });
74
+ s.command("set-run-stuck-ms-v2 <ms>").action((ms) => { setSganRunStuckMsV2(Number(ms)); console.log(JSON.stringify({ sganRunStuckMs: getSganRunStuckMsV2() }, null, 2)); });
75
+ s.command("auto-stale-idle-v2").action(() => console.log(JSON.stringify(autoStaleIdleSganProfilesV2(), null, 2)));
76
+ s.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckSganRunsV2(), null, 2)));
77
+ s.command("gov-stats-v2").action(() => console.log(JSON.stringify(getSocialGraphAnalyticsGovStatsV2(), null, 2)));
78
+ }
@@ -399,4 +399,44 @@ export function registerSiemCommand(program) {
399
399
  process.exit(1);
400
400
  }
401
401
  });
402
+
403
+ _registerSiemExporterV2Commands(siem);
404
+ }
405
+
406
+ function _registerSiemExporterV2Commands(parent) {
407
+ const L = async () => await import("../lib/siem-exporter.js");
408
+ parent.command("enums-v2").description("Show V2 enums (target maturity + export lifecycle)")
409
+ .action(async () => { const m = await L(); console.log(JSON.stringify({ targetMaturity: m.SIEM_TARGET_MATURITY_V2, exportLifecycle: m.SIEM_EXPORT_LIFECYCLE_V2 }, null, 2)); });
410
+ parent.command("config-v2").description("Show V2 config thresholds")
411
+ .action(async () => { const m = await L(); console.log(JSON.stringify({ maxActiveSiemTargetsPerOperator: m.getMaxActiveSiemTargetsPerOperatorV2(), maxPendingSiemExportsPerTarget: m.getMaxPendingSiemExportsPerTargetV2(), siemTargetIdleMs: m.getSiemTargetIdleMsV2(), siemExportStuckMs: m.getSiemExportStuckMsV2() }, null, 2)); });
412
+ parent.command("set-max-active-targets-v2 <n>").description("Set max active targets per operator")
413
+ .action(async (n) => { const m = await L(); m.setMaxActiveSiemTargetsPerOperatorV2(Number(n)); console.log("ok"); });
414
+ parent.command("set-max-pending-exports-v2 <n>").description("Set max pending exports per target")
415
+ .action(async (n) => { const m = await L(); m.setMaxPendingSiemExportsPerTargetV2(Number(n)); console.log("ok"); });
416
+ parent.command("set-target-idle-ms-v2 <n>").description("Set target idle threshold (ms)")
417
+ .action(async (n) => { const m = await L(); m.setSiemTargetIdleMsV2(Number(n)); console.log("ok"); });
418
+ parent.command("set-export-stuck-ms-v2 <n>").description("Set export stuck threshold (ms)")
419
+ .action(async (n) => { const m = await L(); m.setSiemExportStuckMsV2(Number(n)); console.log("ok"); });
420
+ parent.command("register-target-v2 <id> <operator>").description("Register V2 SIEM target")
421
+ .option("--kind <k>", "Target kind").action(async (id, operator, o) => { const m = await L(); console.log(JSON.stringify(m.registerSiemTargetV2({ id, operator, kind: o.kind }), null, 2)); });
422
+ parent.command("activate-target-v2 <id>").description("Activate target").action(async (id) => { const m = await L(); console.log(JSON.stringify(m.activateSiemTargetV2(id), null, 2)); });
423
+ parent.command("degrade-target-v2 <id>").description("Degrade target").action(async (id) => { const m = await L(); console.log(JSON.stringify(m.degradeSiemTargetV2(id), null, 2)); });
424
+ parent.command("retire-target-v2 <id>").description("Retire target (terminal)").action(async (id) => { const m = await L(); console.log(JSON.stringify(m.retireSiemTargetV2(id), null, 2)); });
425
+ parent.command("touch-target-v2 <id>").description("Touch target lastTouchedAt").action(async (id) => { const m = await L(); console.log(JSON.stringify(m.touchSiemTargetV2(id), null, 2)); });
426
+ parent.command("get-target-v2 <id>").description("Get V2 target").action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getSiemTargetV2(id), null, 2)); });
427
+ parent.command("list-targets-v2").description("List V2 targets").action(async () => { const m = await L(); console.log(JSON.stringify(m.listSiemTargetsV2(), null, 2)); });
428
+ parent.command("create-export-v2 <id> <targetId>").description("Create V2 export (queued)")
429
+ .option("--format <f>", "Format", "json").action(async (id, targetId, o) => { const m = await L(); console.log(JSON.stringify(m.createSiemExportV2({ id, targetId, format: o.format }), null, 2)); });
430
+ parent.command("start-export-v2 <id>").description("Start export").action(async (id) => { const m = await L(); console.log(JSON.stringify(m.startSiemExportV2(id), null, 2)); });
431
+ parent.command("deliver-export-v2 <id>").description("Deliver export").action(async (id) => { const m = await L(); console.log(JSON.stringify(m.deliverSiemExportV2(id), null, 2)); });
432
+ parent.command("fail-export-v2 <id> [reason]").description("Fail export").action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.failSiemExportV2(id, reason), null, 2)); });
433
+ parent.command("cancel-export-v2 <id> [reason]").description("Cancel export").action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.cancelSiemExportV2(id, reason), null, 2)); });
434
+ parent.command("get-export-v2 <id>").description("Get V2 export").action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getSiemExportV2(id), null, 2)); });
435
+ parent.command("list-exports-v2").description("List V2 exports").action(async () => { const m = await L(); console.log(JSON.stringify(m.listSiemExportsV2(), null, 2)); });
436
+ parent.command("auto-degrade-idle-v2").description("Auto-degrade idle targets")
437
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.autoDegradeIdleSiemTargetsV2(), null, 2)); });
438
+ parent.command("auto-fail-stuck-v2").description("Auto-fail stuck sending exports")
439
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.autoFailStuckSiemExportsV2(), null, 2)); });
440
+ parent.command("gov-stats-v2").description("V2 governance aggregate stats")
441
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.getSiemExporterGovStatsV2(), null, 2)); });
402
442
  }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * `cc slotfill` — Slot Filler V2 governance overlay (in-memory, atop lib/slot-filler.js).
3
+ */
4
+ import {
5
+ SLOTF_PROFILE_MATURITY_V2, SLOTF_FILL_LIFECYCLE_V2,
6
+ setMaxActiveSlotfTemplatesPerOwnerV2, getMaxActiveSlotfTemplatesPerOwnerV2,
7
+ setMaxPendingSlotfFillsPerTemplateV2, getMaxPendingSlotfFillsPerTemplateV2,
8
+ setSlotfTemplateIdleMsV2, getSlotfTemplateIdleMsV2,
9
+ setSlotfFillStuckMsV2, getSlotfFillStuckMsV2,
10
+ registerSlotfTemplateV2, activateSlotfTemplateV2, staleSlotfTemplateV2, archiveSlotfTemplateV2, touchSlotfTemplateV2, getSlotfTemplateV2, listSlotfTemplatesV2,
11
+ createSlotfFillV2, fillingSlotfFillV2, fillSlotfFillV2, failSlotfFillV2, cancelSlotfFillV2, getSlotfFillV2, listSlotfFillsV2,
12
+ autoStaleIdleSlotfTemplatesV2, autoFailStuckSlotfFillsV2, getSlotFillerGovStatsV2, _resetStateSlotFillerV2,
13
+ } from "../lib/slot-filler.js";
14
+
15
+ export function registerSlotfillCommand(program) {
16
+ const sf = program.command("slotfill").description("Slot Filler V2 governance");
17
+ sf.command("enums-v2").action(() => console.log(JSON.stringify({ profileMaturity: SLOTF_PROFILE_MATURITY_V2, fillLifecycle: SLOTF_FILL_LIFECYCLE_V2 }, null, 2)));
18
+ sf.command("config-v2").action(() => console.log(JSON.stringify({ maxActiveSlotfTemplatesPerOwner: getMaxActiveSlotfTemplatesPerOwnerV2(), maxPendingSlotfFillsPerTemplate: getMaxPendingSlotfFillsPerTemplateV2(), slotfTemplateIdleMs: getSlotfTemplateIdleMsV2(), slotfFillStuckMs: getSlotfFillStuckMsV2() }, null, 2)));
19
+ sf.command("set-max-active-v2 <n>").action((n) => { setMaxActiveSlotfTemplatesPerOwnerV2(Number(n)); console.log("ok"); });
20
+ sf.command("set-max-pending-v2 <n>").action((n) => { setMaxPendingSlotfFillsPerTemplateV2(Number(n)); console.log("ok"); });
21
+ sf.command("set-idle-ms-v2 <n>").action((n) => { setSlotfTemplateIdleMsV2(Number(n)); console.log("ok"); });
22
+ sf.command("set-stuck-ms-v2 <n>").action((n) => { setSlotfFillStuckMsV2(Number(n)); console.log("ok"); });
23
+ sf.command("register-template-v2 <id> <owner>").option("--schema <s>", "schema").action((id, owner, o) => console.log(JSON.stringify(registerSlotfTemplateV2({ id, owner, schema: o.schema }), null, 2)));
24
+ sf.command("activate-template-v2 <id>").action((id) => console.log(JSON.stringify(activateSlotfTemplateV2(id), null, 2)));
25
+ sf.command("stale-template-v2 <id>").action((id) => console.log(JSON.stringify(staleSlotfTemplateV2(id), null, 2)));
26
+ sf.command("archive-template-v2 <id>").action((id) => console.log(JSON.stringify(archiveSlotfTemplateV2(id), null, 2)));
27
+ sf.command("touch-template-v2 <id>").action((id) => console.log(JSON.stringify(touchSlotfTemplateV2(id), null, 2)));
28
+ sf.command("get-template-v2 <id>").action((id) => console.log(JSON.stringify(getSlotfTemplateV2(id), null, 2)));
29
+ sf.command("list-templates-v2").action(() => console.log(JSON.stringify(listSlotfTemplatesV2(), null, 2)));
30
+ sf.command("create-fill-v2 <id> <templateId>").option("--input <s>", "input").action((id, templateId, o) => console.log(JSON.stringify(createSlotfFillV2({ id, templateId, input: o.input }), null, 2)));
31
+ sf.command("filling-fill-v2 <id>").action((id) => console.log(JSON.stringify(fillingSlotfFillV2(id), null, 2)));
32
+ sf.command("fill-fill-v2 <id>").action((id) => console.log(JSON.stringify(fillSlotfFillV2(id), null, 2)));
33
+ sf.command("fail-fill-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(failSlotfFillV2(id, reason), null, 2)));
34
+ sf.command("cancel-fill-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(cancelSlotfFillV2(id, reason), null, 2)));
35
+ sf.command("get-fill-v2 <id>").action((id) => console.log(JSON.stringify(getSlotfFillV2(id), null, 2)));
36
+ sf.command("list-fills-v2").action(() => console.log(JSON.stringify(listSlotfFillsV2(), null, 2)));
37
+ sf.command("auto-stale-idle-v2").action(() => console.log(JSON.stringify(autoStaleIdleSlotfTemplatesV2(), null, 2)));
38
+ sf.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckSlotfFillsV2(), null, 2)));
39
+ sf.command("gov-stats-v2").action(() => console.log(JSON.stringify(getSlotFillerGovStatsV2(), null, 2)));
40
+ sf.command("reset-state-v2").action(() => { _resetStateSlotFillerV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
41
+ }
@@ -63,6 +63,14 @@ import {
63
63
  loadFromDb as graphLoadFromDb,
64
64
  subscribe as graphSubscribe,
65
65
  EDGE_TYPES,
66
+ SG_NODE_MATURITY_V2, SG_EDGE_LIFECYCLE_V2,
67
+ setMaxActiveSgNodesPerOwnerV2, getMaxActiveSgNodesPerOwnerV2,
68
+ setMaxPendingSgEdgesPerNodeV2, getMaxPendingSgEdgesPerNodeV2,
69
+ setSgNodeIdleMsV2, getSgNodeIdleMsV2,
70
+ setSgEdgeStuckMsV2, getSgEdgeStuckMsV2,
71
+ registerSgNodeV2, activateSgNodeV2, deactivateSgNodeV2, removeSgNodeV2, touchSgNodeV2, getSgNodeV2, listSgNodesV2,
72
+ createSgEdgeV2, establishSgEdgeV2, severSgEdgeV2, expireSgEdgeV2, cancelSgEdgeV2, getSgEdgeV2, listSgEdgesV2,
73
+ autoDeactivateIdleSgNodesV2, autoExpireStaleSgEdgesV2, getSocialGraphGovStatsV2, _resetStateSocialGraphV2,
66
74
  } from "../lib/social-graph.js";
67
75
  import {
68
76
  METRICS as ANALYTICS_METRICS,
@@ -1309,4 +1317,30 @@ export function registerSocialCommand(program) {
1309
1317
  const flipped = autoAbandonStuckThreadsV2();
1310
1318
  console.log(JSON.stringify(flipped, null, 2));
1311
1319
  });
1320
+
1321
+ // ===== Social Graph V2 governance overlay (sg-*-v2 prefix) =====
1322
+ social.command("sg-enums-v2").action(() => console.log(JSON.stringify({ nodeMaturity: SG_NODE_MATURITY_V2, edgeLifecycle: SG_EDGE_LIFECYCLE_V2 }, null, 2)));
1323
+ social.command("sg-config-v2").action(() => console.log(JSON.stringify({ maxActiveSgNodesPerOwner: getMaxActiveSgNodesPerOwnerV2(), maxPendingSgEdgesPerNode: getMaxPendingSgEdgesPerNodeV2(), sgNodeIdleMs: getSgNodeIdleMsV2(), sgEdgeStuckMs: getSgEdgeStuckMsV2() }, null, 2)));
1324
+ social.command("sg-set-max-active-v2 <n>").action((n) => { setMaxActiveSgNodesPerOwnerV2(Number(n)); console.log("ok"); });
1325
+ social.command("sg-set-max-pending-v2 <n>").action((n) => { setMaxPendingSgEdgesPerNodeV2(Number(n)); console.log("ok"); });
1326
+ social.command("sg-set-idle-ms-v2 <n>").action((n) => { setSgNodeIdleMsV2(Number(n)); console.log("ok"); });
1327
+ social.command("sg-set-stuck-ms-v2 <n>").action((n) => { setSgEdgeStuckMsV2(Number(n)); console.log("ok"); });
1328
+ social.command("sg-register-node-v2 <id> <owner>").option("--handle <h>", "handle").action((id, owner, o) => console.log(JSON.stringify(registerSgNodeV2({ id, owner, handle: o.handle }), null, 2)));
1329
+ social.command("sg-activate-node-v2 <id>").action((id) => console.log(JSON.stringify(activateSgNodeV2(id), null, 2)));
1330
+ social.command("sg-deactivate-node-v2 <id>").action((id) => console.log(JSON.stringify(deactivateSgNodeV2(id), null, 2)));
1331
+ social.command("sg-remove-node-v2 <id>").action((id) => console.log(JSON.stringify(removeSgNodeV2(id), null, 2)));
1332
+ social.command("sg-touch-node-v2 <id>").action((id) => console.log(JSON.stringify(touchSgNodeV2(id), null, 2)));
1333
+ social.command("sg-get-node-v2 <id>").action((id) => console.log(JSON.stringify(getSgNodeV2(id), null, 2)));
1334
+ social.command("sg-list-nodes-v2").action(() => console.log(JSON.stringify(listSgNodesV2(), null, 2)));
1335
+ social.command("sg-create-edge-v2 <id> <nodeId>").option("--target <t>", "targetId").action((id, nodeId, o) => console.log(JSON.stringify(createSgEdgeV2({ id, nodeId, targetId: o.target }), null, 2)));
1336
+ social.command("sg-establish-edge-v2 <id>").action((id) => console.log(JSON.stringify(establishSgEdgeV2(id), null, 2)));
1337
+ social.command("sg-sever-edge-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(severSgEdgeV2(id, reason), null, 2)));
1338
+ social.command("sg-expire-edge-v2 <id>").action((id) => console.log(JSON.stringify(expireSgEdgeV2(id), null, 2)));
1339
+ social.command("sg-cancel-edge-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(cancelSgEdgeV2(id, reason), null, 2)));
1340
+ social.command("sg-get-edge-v2 <id>").action((id) => console.log(JSON.stringify(getSgEdgeV2(id), null, 2)));
1341
+ social.command("sg-list-edges-v2").action(() => console.log(JSON.stringify(listSgEdgesV2(), null, 2)));
1342
+ social.command("sg-auto-deactivate-idle-v2").action(() => console.log(JSON.stringify(autoDeactivateIdleSgNodesV2(), null, 2)));
1343
+ social.command("sg-auto-expire-stale-v2").action(() => console.log(JSON.stringify(autoExpireStaleSgEdgesV2(), null, 2)));
1344
+ social.command("sg-gov-stats-v2").action(() => console.log(JSON.stringify(getSocialGraphGovStatsV2(), null, 2)));
1345
+ social.command("sg-reset-state-v2").action(() => { _resetStateSocialGraphV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
1312
1346
  }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * `cc svccont` — Service Container V2 governance overlay.
3
+ *
4
+ * In-memory governance for service containers + resolution lifecycle, layered
5
+ * atop `lib/service-container.js`. Independent of legacy DI/registry helpers.
6
+ */
7
+
8
+ import {
9
+ SVC_CONTAINER_MATURITY_V2, SVC_RESOLUTION_LIFECYCLE_V2,
10
+ setMaxActiveSvcContainersPerOwnerV2, getMaxActiveSvcContainersPerOwnerV2,
11
+ setMaxPendingSvcResolutionsPerContainerV2, getMaxPendingSvcResolutionsPerContainerV2,
12
+ setSvcContainerIdleMsV2, getSvcContainerIdleMsV2,
13
+ setSvcResolutionStuckMsV2, getSvcResolutionStuckMsV2,
14
+ registerSvcContainerV2, activateSvcContainerV2, degradeSvcContainerV2, decommissionSvcContainerV2, touchSvcContainerV2, getSvcContainerV2, listSvcContainersV2,
15
+ createSvcResolutionV2, resolvingSvcResolutionV2, resolveSvcResolutionV2, failSvcResolutionV2, cancelSvcResolutionV2, getSvcResolutionV2, listSvcResolutionsV2,
16
+ autoDegradeIdleSvcContainersV2, autoFailStuckSvcResolutionsV2, getServiceContainerGovStatsV2, _resetStateServiceContainerV2,
17
+ } from "../lib/service-container.js";
18
+
19
+ export function registerSvcContCommand(program) {
20
+ const sc = program.command("svccont").description("Service Container V2 governance");
21
+ sc.command("enums-v2").action(() => console.log(JSON.stringify({ containerMaturity: SVC_CONTAINER_MATURITY_V2, resolutionLifecycle: SVC_RESOLUTION_LIFECYCLE_V2 }, null, 2)));
22
+ sc.command("config-v2").action(() => console.log(JSON.stringify({ maxActiveSvcContainersPerOwner: getMaxActiveSvcContainersPerOwnerV2(), maxPendingSvcResolutionsPerContainer: getMaxPendingSvcResolutionsPerContainerV2(), svcContainerIdleMs: getSvcContainerIdleMsV2(), svcResolutionStuckMs: getSvcResolutionStuckMsV2() }, null, 2)));
23
+ sc.command("set-max-active-v2 <n>").action((n) => { setMaxActiveSvcContainersPerOwnerV2(Number(n)); console.log("ok"); });
24
+ sc.command("set-max-pending-v2 <n>").action((n) => { setMaxPendingSvcResolutionsPerContainerV2(Number(n)); console.log("ok"); });
25
+ sc.command("set-idle-ms-v2 <n>").action((n) => { setSvcContainerIdleMsV2(Number(n)); console.log("ok"); });
26
+ sc.command("set-stuck-ms-v2 <n>").action((n) => { setSvcResolutionStuckMsV2(Number(n)); console.log("ok"); });
27
+ sc.command("register-container-v2 <id> <owner>").option("--scope <s>", "scope").action((id, owner, o) => console.log(JSON.stringify(registerSvcContainerV2({ id, owner, scope: o.scope }), null, 2)));
28
+ sc.command("activate-container-v2 <id>").action((id) => console.log(JSON.stringify(activateSvcContainerV2(id), null, 2)));
29
+ sc.command("degrade-container-v2 <id>").action((id) => console.log(JSON.stringify(degradeSvcContainerV2(id), null, 2)));
30
+ sc.command("decommission-container-v2 <id>").action((id) => console.log(JSON.stringify(decommissionSvcContainerV2(id), null, 2)));
31
+ sc.command("touch-container-v2 <id>").action((id) => console.log(JSON.stringify(touchSvcContainerV2(id), null, 2)));
32
+ sc.command("get-container-v2 <id>").action((id) => console.log(JSON.stringify(getSvcContainerV2(id), null, 2)));
33
+ sc.command("list-containers-v2").action(() => console.log(JSON.stringify(listSvcContainersV2(), null, 2)));
34
+ sc.command("create-resolution-v2 <id> <containerId>").option("--token <t>", "token").action((id, containerId, o) => console.log(JSON.stringify(createSvcResolutionV2({ id, containerId, token: o.token }), null, 2)));
35
+ sc.command("resolving-resolution-v2 <id>").action((id) => console.log(JSON.stringify(resolvingSvcResolutionV2(id), null, 2)));
36
+ sc.command("resolve-resolution-v2 <id>").action((id) => console.log(JSON.stringify(resolveSvcResolutionV2(id), null, 2)));
37
+ sc.command("fail-resolution-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(failSvcResolutionV2(id, reason), null, 2)));
38
+ sc.command("cancel-resolution-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(cancelSvcResolutionV2(id, reason), null, 2)));
39
+ sc.command("get-resolution-v2 <id>").action((id) => console.log(JSON.stringify(getSvcResolutionV2(id), null, 2)));
40
+ sc.command("list-resolutions-v2").action(() => console.log(JSON.stringify(listSvcResolutionsV2(), null, 2)));
41
+ sc.command("auto-degrade-idle-v2").action(() => console.log(JSON.stringify(autoDegradeIdleSvcContainersV2(), null, 2)));
42
+ sc.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckSvcResolutionsV2(), null, 2)));
43
+ sc.command("gov-stats-v2").action(() => console.log(JSON.stringify(getServiceContainerGovStatsV2(), null, 2)));
44
+ sc.command("reset-state-v2").action(() => { _resetStateServiceContainerV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
45
+ }