chainlesschain 0.143.0 → 0.145.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/package.json +1 -1
  2. package/src/commands/a2a.js +196 -28
  3. package/src/commands/activitypub.js +157 -27
  4. package/src/commands/agent.js +587 -103
  5. package/src/commands/audit.js +206 -0
  6. package/src/commands/bi.js +152 -27
  7. package/src/commands/bm25.js +111 -27
  8. package/src/commands/browse.js +190 -29
  9. package/src/commands/ccron.js +128 -28
  10. package/src/commands/chat.js +207 -0
  11. package/src/commands/compliance.js +414 -34
  12. package/src/commands/compt.js +127 -29
  13. package/src/commands/consol.js +8 -2
  14. package/src/commands/cowork.js +580 -34
  15. package/src/commands/crosschain.js +182 -28
  16. package/src/commands/dao.js +182 -28
  17. package/src/commands/dlp.js +172 -27
  18. package/src/commands/economy.js +205 -50
  19. package/src/commands/evolution.js +203 -50
  20. package/src/commands/evomap.js +182 -27
  21. package/src/commands/fflag.js +74 -22
  22. package/src/commands/git.js +177 -37
  23. package/src/commands/hardening.js +209 -0
  24. package/src/commands/hmemory.js +204 -50
  25. package/src/commands/incentive.js +209 -0
  26. package/src/commands/inference.js +170 -34
  27. package/src/commands/itbudget.js +149 -33
  28. package/src/commands/kg.js +206 -0
  29. package/src/commands/lowcode.js +195 -38
  30. package/src/commands/marketplace.js +206 -0
  31. package/src/commands/matrix.js +179 -27
  32. package/src/commands/mcpscaf.js +145 -33
  33. package/src/commands/meminj.js +145 -33
  34. package/src/commands/nostr.js +178 -27
  35. package/src/commands/orchestrate.js +217 -0
  36. package/src/commands/orchgov.js +144 -33
  37. package/src/commands/pdfp.js +109 -27
  38. package/src/commands/perf.js +169 -32
  39. package/src/commands/perm.js +144 -33
  40. package/src/commands/pipeline.js +207 -52
  41. package/src/commands/planmode.js +141 -32
  42. package/src/commands/privacy.js +203 -0
  43. package/src/commands/promcomp.js +111 -27
  44. package/src/commands/recommend.js +177 -34
  45. package/src/commands/reputation.js +208 -0
  46. package/src/commands/sandbox.js +206 -0
  47. package/src/commands/seshhook.js +145 -33
  48. package/src/commands/seshsearch.js +141 -33
  49. package/src/commands/seshtail.js +144 -33
  50. package/src/commands/seshu.js +152 -33
  51. package/src/commands/sganal.js +123 -29
  52. package/src/commands/siem.js +201 -34
  53. package/src/commands/sla.js +212 -0
  54. package/src/commands/slotfill.js +146 -33
  55. package/src/commands/social.js +157 -32
  56. package/src/commands/stress.js +206 -0
  57. package/src/commands/svccont.js +145 -33
  58. package/src/commands/terraform.js +206 -0
  59. package/src/commands/tms.js +171 -33
  60. package/src/commands/topiccls.js +146 -33
  61. package/src/commands/uprof.js +141 -32
  62. package/src/commands/vcheck.js +122 -28
  63. package/src/commands/webfetch.js +141 -32
  64. package/src/commands/zkp.js +184 -28
  65. package/src/index.js +40 -0
  66. package/src/lib/a2a-protocol.js +319 -51
  67. package/src/lib/activitypub-bridge.js +288 -50
  68. package/src/lib/agent-economy.js +304 -51
  69. package/src/lib/app-builder.js +279 -46
  70. package/src/lib/audit-logger.js +321 -0
  71. package/src/lib/autonomous-agent.js +284 -48
  72. package/src/lib/bi-engine.js +283 -49
  73. package/src/lib/bm25-search.js +301 -49
  74. package/src/lib/browser-automation.js +296 -49
  75. package/src/lib/chat-core.js +336 -0
  76. package/src/lib/claude-code-bridge.js +341 -0
  77. package/src/lib/compliance-framework-reporter.js +305 -51
  78. package/src/lib/compliance-manager.js +330 -0
  79. package/src/lib/compression-telemetry.js +301 -49
  80. package/src/lib/content-recommender.js +317 -52
  81. package/src/lib/cowork-cron.js +298 -49
  82. package/src/lib/cowork-learning.js +333 -0
  83. package/src/lib/cowork-task-runner.js +308 -51
  84. package/src/lib/cowork-workflow.js +327 -0
  85. package/src/lib/cross-chain.js +311 -51
  86. package/src/lib/dao-governance.js +280 -46
  87. package/src/lib/dlp-engine.js +287 -49
  88. package/src/lib/evolution-system.js +278 -47
  89. package/src/lib/evomap-manager.js +280 -46
  90. package/src/lib/execution-backend.js +294 -48
  91. package/src/lib/feature-flags.js +294 -49
  92. package/src/lib/git-integration.js +285 -47
  93. package/src/lib/hardening-manager.js +341 -0
  94. package/src/lib/hierarchical-memory.js +284 -48
  95. package/src/lib/inference-network.js +308 -51
  96. package/src/lib/iteration-budget.js +302 -50
  97. package/src/lib/knowledge-graph.js +333 -0
  98. package/src/lib/matrix-bridge.js +281 -47
  99. package/src/lib/mcp-scaffold.js +318 -54
  100. package/src/lib/memory-injection.js +288 -49
  101. package/src/lib/nostr-bridge.js +286 -49
  102. package/src/lib/orchestrator.js +293 -48
  103. package/src/lib/pdf-parser.js +298 -49
  104. package/src/lib/perf-tuning.js +309 -50
  105. package/src/lib/permission-engine.js +287 -49
  106. package/src/lib/pipeline-orchestrator.js +289 -49
  107. package/src/lib/plan-mode.js +298 -51
  108. package/src/lib/privacy-computing.js +335 -0
  109. package/src/lib/reputation-optimizer.js +340 -0
  110. package/src/lib/sandbox-v2.js +327 -0
  111. package/src/lib/service-container.js +313 -52
  112. package/src/lib/session-consolidator.js +296 -49
  113. package/src/lib/session-hooks.js +312 -53
  114. package/src/lib/session-search.js +304 -51
  115. package/src/lib/session-tail.js +288 -49
  116. package/src/lib/session-usage.js +298 -52
  117. package/src/lib/siem-exporter.js +298 -51
  118. package/src/lib/skill-marketplace.js +345 -0
  119. package/src/lib/sla-manager.js +341 -0
  120. package/src/lib/slot-filler.js +303 -51
  121. package/src/lib/social-graph-analytics.js +295 -49
  122. package/src/lib/social-graph.js +272 -49
  123. package/src/lib/stress-tester.js +342 -0
  124. package/src/lib/sub-agent-registry.js +302 -53
  125. package/src/lib/task-model-selector.js +302 -50
  126. package/src/lib/terraform-manager.js +333 -0
  127. package/src/lib/todo-manager.js +281 -47
  128. package/src/lib/token-incentive.js +341 -0
  129. package/src/lib/topic-classifier.js +297 -49
  130. package/src/lib/user-profile.js +294 -50
  131. package/src/lib/version-checker.js +304 -50
  132. package/src/lib/web-fetch.js +292 -51
  133. package/src/lib/zkp-engine.js +286 -49
@@ -2,40 +2,151 @@
2
2
  * `cc seshtail` — Session Tail V2 governance overlay (in-memory, atop lib/session-tail.js).
3
3
  */
4
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,
5
+ STAIL_SUB_MATURITY_V2,
6
+ STAIL_EVENT_LIFECYCLE_V2,
7
+ setMaxActiveStailSubsPerOwnerV2,
8
+ getMaxActiveStailSubsPerOwnerV2,
9
+ setMaxPendingStailEventsPerSubV2,
10
+ getMaxPendingStailEventsPerSubV2,
11
+ setStailSubIdleMsV2,
12
+ getStailSubIdleMsV2,
13
+ setStailEventStuckMsV2,
14
+ getStailEventStuckMsV2,
15
+ registerStailSubV2,
16
+ activateStailSubV2,
17
+ pauseStailSubV2,
18
+ closeStailSubV2,
19
+ touchStailSubV2,
20
+ getStailSubV2,
21
+ listStailSubsV2,
22
+ createStailEventV2,
23
+ tailingStailEventV2,
24
+ completeStailEventV2,
25
+ failStailEventV2,
26
+ cancelStailEventV2,
27
+ getStailEventV2,
28
+ listStailEventsV2,
29
+ autoPauseIdleStailSubsV2,
30
+ autoFailStuckStailEventsV2,
31
+ getSessionTailGovStatsV2,
32
+ _resetStateSessionTailV2,
13
33
  } from "../lib/session-tail.js";
14
34
 
15
35
  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)); });
36
+ const st = program
37
+ .command("seshtail")
38
+ .description("Session Tail V2 governance");
39
+ st.command("enums-v2").action(() =>
40
+ console.log(
41
+ JSON.stringify(
42
+ {
43
+ subMaturity: STAIL_SUB_MATURITY_V2,
44
+ eventLifecycle: STAIL_EVENT_LIFECYCLE_V2,
45
+ },
46
+ null,
47
+ 2,
48
+ ),
49
+ ),
50
+ );
51
+ st.command("config-v2").action(() =>
52
+ console.log(
53
+ JSON.stringify(
54
+ {
55
+ maxActiveStailSubsPerOwner: getMaxActiveStailSubsPerOwnerV2(),
56
+ maxPendingStailEventsPerSub: getMaxPendingStailEventsPerSubV2(),
57
+ stailSubIdleMs: getStailSubIdleMsV2(),
58
+ stailEventStuckMs: getStailEventStuckMsV2(),
59
+ },
60
+ null,
61
+ 2,
62
+ ),
63
+ ),
64
+ );
65
+ st.command("set-max-active-v2 <n>").action((n) => {
66
+ setMaxActiveStailSubsPerOwnerV2(Number(n));
67
+ console.log("ok");
68
+ });
69
+ st.command("set-max-pending-v2 <n>").action((n) => {
70
+ setMaxPendingStailEventsPerSubV2(Number(n));
71
+ console.log("ok");
72
+ });
73
+ st.command("set-idle-ms-v2 <n>").action((n) => {
74
+ setStailSubIdleMsV2(Number(n));
75
+ console.log("ok");
76
+ });
77
+ st.command("set-stuck-ms-v2 <n>").action((n) => {
78
+ setStailEventStuckMsV2(Number(n));
79
+ console.log("ok");
80
+ });
81
+ st.command("register-sub-v2 <id> <owner>")
82
+ .option("--sessionId <s>", "sessionId")
83
+ .action((id, owner, o) =>
84
+ console.log(
85
+ JSON.stringify(
86
+ registerStailSubV2({ id, owner, sessionId: o.sessionId }),
87
+ null,
88
+ 2,
89
+ ),
90
+ ),
91
+ );
92
+ st.command("activate-sub-v2 <id>").action((id) =>
93
+ console.log(JSON.stringify(activateStailSubV2(id), null, 2)),
94
+ );
95
+ st.command("pause-sub-v2 <id>").action((id) =>
96
+ console.log(JSON.stringify(pauseStailSubV2(id), null, 2)),
97
+ );
98
+ st.command("close-sub-v2 <id>").action((id) =>
99
+ console.log(JSON.stringify(closeStailSubV2(id), null, 2)),
100
+ );
101
+ st.command("touch-sub-v2 <id>").action((id) =>
102
+ console.log(JSON.stringify(touchStailSubV2(id), null, 2)),
103
+ );
104
+ st.command("get-sub-v2 <id>").action((id) =>
105
+ console.log(JSON.stringify(getStailSubV2(id), null, 2)),
106
+ );
107
+ st.command("list-subs-v2").action(() =>
108
+ console.log(JSON.stringify(listStailSubsV2(), null, 2)),
109
+ );
110
+ st.command("create-event-v2 <id> <subId>")
111
+ .option("--cursor <c>", "cursor")
112
+ .action((id, subId, o) =>
113
+ console.log(
114
+ JSON.stringify(
115
+ createStailEventV2({ id, subId, cursor: o.cursor }),
116
+ null,
117
+ 2,
118
+ ),
119
+ ),
120
+ );
121
+ st.command("tailing-event-v2 <id>").action((id) =>
122
+ console.log(JSON.stringify(tailingStailEventV2(id), null, 2)),
123
+ );
124
+ st.command("complete-event-v2 <id>").action((id) =>
125
+ console.log(JSON.stringify(completeStailEventV2(id), null, 2)),
126
+ );
127
+ st.command("fail-event-v2 <id> [reason]").action((id, reason) =>
128
+ console.log(JSON.stringify(failStailEventV2(id, reason), null, 2)),
129
+ );
130
+ st.command("cancel-event-v2 <id> [reason]").action((id, reason) =>
131
+ console.log(JSON.stringify(cancelStailEventV2(id, reason), null, 2)),
132
+ );
133
+ st.command("get-event-v2 <id>").action((id) =>
134
+ console.log(JSON.stringify(getStailEventV2(id), null, 2)),
135
+ );
136
+ st.command("list-events-v2").action(() =>
137
+ console.log(JSON.stringify(listStailEventsV2(), null, 2)),
138
+ );
139
+ st.command("auto-pause-idle-v2").action(() =>
140
+ console.log(JSON.stringify(autoPauseIdleStailSubsV2(), null, 2)),
141
+ );
142
+ st.command("auto-fail-stuck-v2").action(() =>
143
+ console.log(JSON.stringify(autoFailStuckStailEventsV2(), null, 2)),
144
+ );
145
+ st.command("gov-stats-v2").action(() =>
146
+ console.log(JSON.stringify(getSessionTailGovStatsV2(), null, 2)),
147
+ );
148
+ st.command("reset-state-v2").action(() => {
149
+ _resetStateSessionTailV2();
150
+ console.log(JSON.stringify({ ok: true }, null, 2));
151
+ });
41
152
  }
@@ -2,40 +2,159 @@
2
2
  * `cc seshu` — Session Usage V2 governance overlay (in-memory, atop lib/session-usage.js).
3
3
  */
4
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,
5
+ SUSE_BUDGET_MATURITY_V2,
6
+ SUSE_RECORD_LIFECYCLE_V2,
7
+ setMaxActiveSuseBudgetsPerOwnerV2,
8
+ getMaxActiveSuseBudgetsPerOwnerV2,
9
+ setMaxPendingSuseRecordsPerBudgetV2,
10
+ getMaxPendingSuseRecordsPerBudgetV2,
11
+ setSuseBudgetIdleMsV2,
12
+ getSuseBudgetIdleMsV2,
13
+ setSuseRecordStuckMsV2,
14
+ getSuseRecordStuckMsV2,
15
+ registerSuseBudgetV2,
16
+ activateSuseBudgetV2,
17
+ exhaustSuseBudgetV2,
18
+ archiveSuseBudgetV2,
19
+ touchSuseBudgetV2,
20
+ getSuseBudgetV2,
21
+ listSuseBudgetsV2,
22
+ createSuseRecordV2,
23
+ recordingSuseRecordV2,
24
+ recordSuseRecordV2,
25
+ rejectSuseRecordV2,
26
+ cancelSuseRecordV2,
27
+ getSuseRecordV2,
28
+ listSuseRecordsV2,
29
+ autoExhaustIdleSuseBudgetsV2,
30
+ autoRejectStuckSuseRecordsV2,
31
+ getSessionUsageGovStatsV2,
32
+ _resetStateSessionUsageV2,
13
33
  } from "../lib/session-usage.js";
14
34
 
15
35
  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)); });
36
+ const su = program
37
+ .command("seshu")
38
+ .description("Session Usage V2 governance");
39
+ su.command("enums-v2").action(() =>
40
+ console.log(
41
+ JSON.stringify(
42
+ {
43
+ budgetMaturity: SUSE_BUDGET_MATURITY_V2,
44
+ recordLifecycle: SUSE_RECORD_LIFECYCLE_V2,
45
+ },
46
+ null,
47
+ 2,
48
+ ),
49
+ ),
50
+ );
51
+ su.command("config-v2").action(() =>
52
+ console.log(
53
+ JSON.stringify(
54
+ {
55
+ maxActiveSuseBudgetsPerOwner: getMaxActiveSuseBudgetsPerOwnerV2(),
56
+ maxPendingSuseRecordsPerBudget: getMaxPendingSuseRecordsPerBudgetV2(),
57
+ suseBudgetIdleMs: getSuseBudgetIdleMsV2(),
58
+ suseRecordStuckMs: getSuseRecordStuckMsV2(),
59
+ },
60
+ null,
61
+ 2,
62
+ ),
63
+ ),
64
+ );
65
+ su.command("set-max-active-v2 <n>").action((n) => {
66
+ setMaxActiveSuseBudgetsPerOwnerV2(Number(n));
67
+ console.log("ok");
68
+ });
69
+ su.command("set-max-pending-v2 <n>").action((n) => {
70
+ setMaxPendingSuseRecordsPerBudgetV2(Number(n));
71
+ console.log("ok");
72
+ });
73
+ su.command("set-idle-ms-v2 <n>").action((n) => {
74
+ setSuseBudgetIdleMsV2(Number(n));
75
+ console.log("ok");
76
+ });
77
+ su.command("set-stuck-ms-v2 <n>").action((n) => {
78
+ setSuseRecordStuckMsV2(Number(n));
79
+ console.log("ok");
80
+ });
81
+ su.command("register-budget-v2 <id> <owner>")
82
+ .option("--limit <n>", "limit")
83
+ .action((id, owner, o) =>
84
+ console.log(
85
+ JSON.stringify(
86
+ registerSuseBudgetV2({
87
+ id,
88
+ owner,
89
+ limit: o.limit ? Number(o.limit) : undefined,
90
+ }),
91
+ null,
92
+ 2,
93
+ ),
94
+ ),
95
+ );
96
+ su.command("activate-budget-v2 <id>").action((id) =>
97
+ console.log(JSON.stringify(activateSuseBudgetV2(id), null, 2)),
98
+ );
99
+ su.command("exhaust-budget-v2 <id>").action((id) =>
100
+ console.log(JSON.stringify(exhaustSuseBudgetV2(id), null, 2)),
101
+ );
102
+ su.command("archive-budget-v2 <id>").action((id) =>
103
+ console.log(JSON.stringify(archiveSuseBudgetV2(id), null, 2)),
104
+ );
105
+ su.command("touch-budget-v2 <id>").action((id) =>
106
+ console.log(JSON.stringify(touchSuseBudgetV2(id), null, 2)),
107
+ );
108
+ su.command("get-budget-v2 <id>").action((id) =>
109
+ console.log(JSON.stringify(getSuseBudgetV2(id), null, 2)),
110
+ );
111
+ su.command("list-budgets-v2").action(() =>
112
+ console.log(JSON.stringify(listSuseBudgetsV2(), null, 2)),
113
+ );
114
+ su.command("create-record-v2 <id> <budgetId>")
115
+ .option("--amount <n>", "amount")
116
+ .action((id, budgetId, o) =>
117
+ console.log(
118
+ JSON.stringify(
119
+ createSuseRecordV2({
120
+ id,
121
+ budgetId,
122
+ amount: o.amount ? Number(o.amount) : undefined,
123
+ }),
124
+ null,
125
+ 2,
126
+ ),
127
+ ),
128
+ );
129
+ su.command("recording-record-v2 <id>").action((id) =>
130
+ console.log(JSON.stringify(recordingSuseRecordV2(id), null, 2)),
131
+ );
132
+ su.command("record-record-v2 <id>").action((id) =>
133
+ console.log(JSON.stringify(recordSuseRecordV2(id), null, 2)),
134
+ );
135
+ su.command("reject-record-v2 <id> [reason]").action((id, reason) =>
136
+ console.log(JSON.stringify(rejectSuseRecordV2(id, reason), null, 2)),
137
+ );
138
+ su.command("cancel-record-v2 <id> [reason]").action((id, reason) =>
139
+ console.log(JSON.stringify(cancelSuseRecordV2(id, reason), null, 2)),
140
+ );
141
+ su.command("get-record-v2 <id>").action((id) =>
142
+ console.log(JSON.stringify(getSuseRecordV2(id), null, 2)),
143
+ );
144
+ su.command("list-records-v2").action(() =>
145
+ console.log(JSON.stringify(listSuseRecordsV2(), null, 2)),
146
+ );
147
+ su.command("auto-exhaust-idle-v2").action(() =>
148
+ console.log(JSON.stringify(autoExhaustIdleSuseBudgetsV2(), null, 2)),
149
+ );
150
+ su.command("auto-reject-stuck-v2").action(() =>
151
+ console.log(JSON.stringify(autoRejectStuckSuseRecordsV2(), null, 2)),
152
+ );
153
+ su.command("gov-stats-v2").action(() =>
154
+ console.log(JSON.stringify(getSessionUsageGovStatsV2(), null, 2)),
155
+ );
156
+ su.command("reset-state-v2").action(() => {
157
+ _resetStateSessionUsageV2();
158
+ console.log(JSON.stringify({ ok: true }, null, 2));
159
+ });
41
160
  }
@@ -35,44 +35,138 @@ import {
35
35
  export function registerSganalCommand(program) {
36
36
  const s = program
37
37
  .command("sganal")
38
- .description("Social Graph Analytics V2 governance (in-memory, CLI v0.143.0)");
38
+ .description(
39
+ "Social Graph Analytics V2 governance (in-memory, CLI v0.143.0)",
40
+ );
39
41
 
40
- s.command("enums-v2").action(() => console.log(JSON.stringify({ SGAN_PROFILE_MATURITY_V2, SGAN_RUN_LIFECYCLE_V2 }, null, 2)));
42
+ s.command("enums-v2").action(() =>
43
+ console.log(
44
+ JSON.stringify(
45
+ { SGAN_PROFILE_MATURITY_V2, SGAN_RUN_LIFECYCLE_V2 },
46
+ null,
47
+ 2,
48
+ ),
49
+ ),
50
+ );
41
51
  s.command("register-profile-v2")
42
52
  .requiredOption("--id <id>")
43
53
  .requiredOption("--owner <owner>")
44
54
  .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)));
55
+ .action((o) =>
56
+ console.log(JSON.stringify(registerSganProfileV2(o), null, 2)),
57
+ );
58
+ s.command("activate-profile-v2 <id>").action((id) =>
59
+ console.log(JSON.stringify(activateSganProfileV2(id), null, 2)),
60
+ );
61
+ s.command("stale-profile-v2 <id>").action((id) =>
62
+ console.log(JSON.stringify(staleSganProfileV2(id), null, 2)),
63
+ );
64
+ s.command("archive-profile-v2 <id>").action((id) =>
65
+ console.log(JSON.stringify(archiveSganProfileV2(id), null, 2)),
66
+ );
67
+ s.command("touch-profile-v2 <id>").action((id) =>
68
+ console.log(JSON.stringify(touchSganProfileV2(id), null, 2)),
69
+ );
70
+ s.command("get-profile-v2 <id>").action((id) =>
71
+ console.log(JSON.stringify(getSganProfileV2(id), null, 2)),
72
+ );
73
+ s.command("list-profiles-v2").action(() =>
74
+ console.log(JSON.stringify(listSganProfilesV2(), null, 2)),
75
+ );
52
76
 
53
77
  s.command("create-run-v2")
54
78
  .requiredOption("--id <id>")
55
79
  .requiredOption("--profile-id <profileId>")
56
80
  .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)));
81
+ .action((o) =>
82
+ console.log(
83
+ JSON.stringify(
84
+ createSganRunV2({
85
+ id: o.id,
86
+ profileId: o.profileId,
87
+ snapshotId: o.snapshotId,
88
+ }),
89
+ null,
90
+ 2,
91
+ ),
92
+ ),
93
+ );
94
+ s.command("running-run-v2 <id>").action((id) =>
95
+ console.log(JSON.stringify(runningSganRunV2(id), null, 2)),
96
+ );
97
+ s.command("complete-run-v2 <id>").action((id) =>
98
+ console.log(JSON.stringify(completeSganRunV2(id), null, 2)),
99
+ );
100
+ s.command("fail-run-v2 <id>")
101
+ .option("--reason <r>")
102
+ .action((id, o) =>
103
+ console.log(JSON.stringify(failSganRunV2(id, o.reason), null, 2)),
104
+ );
105
+ s.command("cancel-run-v2 <id>")
106
+ .option("--reason <r>")
107
+ .action((id, o) =>
108
+ console.log(JSON.stringify(cancelSganRunV2(id, o.reason), null, 2)),
109
+ );
110
+ s.command("get-run-v2 <id>").action((id) =>
111
+ console.log(JSON.stringify(getSganRunV2(id), null, 2)),
112
+ );
113
+ s.command("list-runs-v2").action(() =>
114
+ console.log(JSON.stringify(listSganRunsV2(), null, 2)),
115
+ );
64
116
 
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)));
117
+ s.command("config-v2").action(() =>
118
+ console.log(
119
+ JSON.stringify(
120
+ {
121
+ maxActiveSganProfilesPerOwner: getMaxActiveSganProfilesPerOwnerV2(),
122
+ maxPendingSganRunsPerProfile: getMaxPendingSganRunsPerProfileV2(),
123
+ sganProfileIdleMs: getSganProfileIdleMsV2(),
124
+ sganRunStuckMs: getSganRunStuckMsV2(),
125
+ },
126
+ null,
127
+ 2,
128
+ ),
129
+ ),
130
+ );
131
+ s.command("set-max-active-profiles-v2 <n>").action((n) => {
132
+ setMaxActiveSganProfilesPerOwnerV2(Number(n));
133
+ console.log(
134
+ JSON.stringify(
135
+ { maxActiveSganProfilesPerOwner: getMaxActiveSganProfilesPerOwnerV2() },
136
+ null,
137
+ 2,
138
+ ),
139
+ );
140
+ });
141
+ s.command("set-max-pending-runs-v2 <n>").action((n) => {
142
+ setMaxPendingSganRunsPerProfileV2(Number(n));
143
+ console.log(
144
+ JSON.stringify(
145
+ { maxPendingSganRunsPerProfile: getMaxPendingSganRunsPerProfileV2() },
146
+ null,
147
+ 2,
148
+ ),
149
+ );
150
+ });
151
+ s.command("set-profile-idle-ms-v2 <ms>").action((ms) => {
152
+ setSganProfileIdleMsV2(Number(ms));
153
+ console.log(
154
+ JSON.stringify({ sganProfileIdleMs: getSganProfileIdleMsV2() }, null, 2),
155
+ );
156
+ });
157
+ s.command("set-run-stuck-ms-v2 <ms>").action((ms) => {
158
+ setSganRunStuckMsV2(Number(ms));
159
+ console.log(
160
+ JSON.stringify({ sganRunStuckMs: getSganRunStuckMsV2() }, null, 2),
161
+ );
162
+ });
163
+ s.command("auto-stale-idle-v2").action(() =>
164
+ console.log(JSON.stringify(autoStaleIdleSganProfilesV2(), null, 2)),
165
+ );
166
+ s.command("auto-fail-stuck-v2").action(() =>
167
+ console.log(JSON.stringify(autoFailStuckSganRunsV2(), null, 2)),
168
+ );
169
+ s.command("gov-stats-v2").action(() =>
170
+ console.log(JSON.stringify(getSocialGraphAnalyticsGovStatsV2(), null, 2)),
171
+ );
78
172
  }