chainlesschain 0.132.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 (135) hide show
  1. package/package.json +1 -1
  2. package/src/commands/a2a.js +230 -0
  3. package/src/commands/activitypub.js +191 -0
  4. package/src/commands/agent.js +601 -0
  5. package/src/commands/audit.js +206 -0
  6. package/src/commands/bi.js +186 -0
  7. package/src/commands/bm25.js +162 -0
  8. package/src/commands/browse.js +225 -0
  9. package/src/commands/ccron.js +178 -0
  10. package/src/commands/chat.js +207 -0
  11. package/src/commands/compliance.js +420 -0
  12. package/src/commands/compt.js +176 -0
  13. package/src/commands/consol.js +237 -0
  14. package/src/commands/cowork.js +588 -0
  15. package/src/commands/crosschain.js +216 -0
  16. package/src/commands/dao.js +216 -0
  17. package/src/commands/dlp.js +206 -0
  18. package/src/commands/economy.js +211 -0
  19. package/src/commands/evolution.js +209 -0
  20. package/src/commands/evomap.js +216 -0
  21. package/src/commands/fflag.js +230 -0
  22. package/src/commands/git.js +185 -0
  23. package/src/commands/hardening.js +209 -0
  24. package/src/commands/hmemory.js +210 -0
  25. package/src/commands/incentive.js +209 -0
  26. package/src/commands/inference.js +178 -0
  27. package/src/commands/itbudget.js +161 -0
  28. package/src/commands/kg.js +206 -0
  29. package/src/commands/lowcode.js +201 -0
  30. package/src/commands/marketplace.js +206 -0
  31. package/src/commands/matrix.js +214 -0
  32. package/src/commands/mcpscaf.js +153 -0
  33. package/src/commands/meminj.js +153 -0
  34. package/src/commands/nostr.js +213 -0
  35. package/src/commands/orchestrate.js +217 -0
  36. package/src/commands/orchgov.js +156 -0
  37. package/src/commands/pdfp.js +160 -0
  38. package/src/commands/perf.js +176 -0
  39. package/src/commands/perm.js +156 -0
  40. package/src/commands/pipeline.js +211 -0
  41. package/src/commands/planmode.js +154 -0
  42. package/src/commands/privacy.js +203 -0
  43. package/src/commands/promcomp.js +166 -0
  44. package/src/commands/recommend.js +185 -0
  45. package/src/commands/reputation.js +208 -0
  46. package/src/commands/sandbox.js +206 -0
  47. package/src/commands/seshhook.js +153 -0
  48. package/src/commands/seshsearch.js +149 -0
  49. package/src/commands/seshtail.js +152 -0
  50. package/src/commands/seshu.js +160 -0
  51. package/src/commands/sganal.js +172 -0
  52. package/src/commands/siem.js +207 -0
  53. package/src/commands/sla.js +212 -0
  54. package/src/commands/slotfill.js +154 -0
  55. package/src/commands/social.js +159 -0
  56. package/src/commands/stress.js +206 -0
  57. package/src/commands/svccont.js +157 -0
  58. package/src/commands/terraform.js +206 -0
  59. package/src/commands/tms.js +183 -0
  60. package/src/commands/topiccls.js +158 -0
  61. package/src/commands/uprof.js +154 -0
  62. package/src/commands/vcheck.js +172 -0
  63. package/src/commands/webfetch.js +150 -0
  64. package/src/commands/zkp.js +218 -0
  65. package/src/harness/prompt-compressor.js +331 -0
  66. package/src/index.js +101 -1
  67. package/src/lib/a2a-protocol.js +373 -0
  68. package/src/lib/activitypub-bridge.js +343 -0
  69. package/src/lib/agent-economy.js +358 -0
  70. package/src/lib/app-builder.js +338 -0
  71. package/src/lib/audit-logger.js +321 -0
  72. package/src/lib/autonomous-agent.js +341 -0
  73. package/src/lib/bi-engine.js +339 -0
  74. package/src/lib/bm25-search.js +333 -0
  75. package/src/lib/browser-automation.js +352 -0
  76. package/src/lib/chat-core.js +336 -0
  77. package/src/lib/claude-code-bridge.js +341 -0
  78. package/src/lib/compliance-framework-reporter.js +359 -0
  79. package/src/lib/compliance-manager.js +330 -0
  80. package/src/lib/compression-telemetry.js +333 -0
  81. package/src/lib/content-recommender.js +370 -0
  82. package/src/lib/cowork-cron.js +330 -0
  83. package/src/lib/cowork-learning.js +333 -0
  84. package/src/lib/cowork-task-runner.js +362 -0
  85. package/src/lib/cowork-workflow.js +327 -0
  86. package/src/lib/cross-chain.js +365 -0
  87. package/src/lib/dao-governance.js +339 -0
  88. package/src/lib/dlp-engine.js +343 -0
  89. package/src/lib/evolution-system.js +336 -0
  90. package/src/lib/evomap-manager.js +339 -0
  91. package/src/lib/execution-backend.js +351 -0
  92. package/src/lib/feature-flags.js +330 -0
  93. package/src/lib/git-integration.js +343 -0
  94. package/src/lib/hardening-manager.js +341 -0
  95. package/src/lib/hierarchical-memory.js +341 -0
  96. package/src/lib/inference-network.js +362 -0
  97. package/src/lib/iteration-budget.js +357 -0
  98. package/src/lib/knowledge-graph.js +333 -0
  99. package/src/lib/matrix-bridge.js +339 -0
  100. package/src/lib/mcp-scaffold.js +345 -0
  101. package/src/lib/memory-injection.js +320 -0
  102. package/src/lib/nostr-bridge.js +342 -0
  103. package/src/lib/orchestrator.js +350 -0
  104. package/src/lib/pdf-parser.js +330 -0
  105. package/src/lib/perf-tuning.js +364 -0
  106. package/src/lib/permission-engine.js +319 -0
  107. package/src/lib/pipeline-orchestrator.js +345 -0
  108. package/src/lib/plan-mode.js +328 -0
  109. package/src/lib/privacy-computing.js +335 -0
  110. package/src/lib/prompt-compressor.js +1 -10
  111. package/src/lib/reputation-optimizer.js +340 -0
  112. package/src/lib/sandbox-v2.js +327 -0
  113. package/src/lib/service-container.js +342 -0
  114. package/src/lib/session-consolidator.js +352 -0
  115. package/src/lib/session-hooks.js +340 -0
  116. package/src/lib/session-search.js +334 -0
  117. package/src/lib/session-tail.js +320 -0
  118. package/src/lib/session-usage.js +329 -0
  119. package/src/lib/siem-exporter.js +352 -0
  120. package/src/lib/skill-marketplace.js +345 -0
  121. package/src/lib/sla-manager.js +341 -0
  122. package/src/lib/slot-filler.js +333 -0
  123. package/src/lib/social-graph-analytics.js +327 -0
  124. package/src/lib/social-graph.js +304 -0
  125. package/src/lib/stress-tester.js +342 -0
  126. package/src/lib/sub-agent-registry.js +359 -0
  127. package/src/lib/task-model-selector.js +333 -0
  128. package/src/lib/terraform-manager.js +333 -0
  129. package/src/lib/todo-manager.js +339 -0
  130. package/src/lib/token-incentive.js +341 -0
  131. package/src/lib/topic-classifier.js +353 -0
  132. package/src/lib/user-profile.js +325 -0
  133. package/src/lib/version-checker.js +335 -0
  134. package/src/lib/web-fetch.js +322 -0
  135. package/src/lib/zkp-engine.js +342 -0
@@ -839,3 +839,209 @@ export function registerSandboxCommand(program) {
839
839
  }
840
840
  });
841
841
  }
842
+
843
+ // === Iter16 V2 governance overlay ===
844
+ export function registerSboxGovV2Commands(program) {
845
+ const parent = program.commands.find((c) => c.name() === "sandbox");
846
+ if (!parent) return;
847
+ const L = async () => await import("../lib/sandbox-v2.js");
848
+ parent
849
+ .command("sbox-gov-enums-v2")
850
+ .description("Show V2 enums (sbox maturity + exec lifecycle)")
851
+ .action(async () => {
852
+ const m = await L();
853
+ console.log(
854
+ JSON.stringify(
855
+ {
856
+ profileMaturity: m.SBOX_PROFILE_MATURITY_V2,
857
+ execLifecycle: m.SBOX_EXEC_LIFECYCLE_V2,
858
+ },
859
+ null,
860
+ 2,
861
+ ),
862
+ );
863
+ });
864
+ parent
865
+ .command("sbox-gov-config-v2")
866
+ .description("Show V2 config thresholds")
867
+ .action(async () => {
868
+ const m = await L();
869
+ console.log(
870
+ JSON.stringify(
871
+ {
872
+ maxActive: m.getMaxActiveSboxProfilesPerOwnerV2(),
873
+ maxPending: m.getMaxPendingSboxExecsPerProfileV2(),
874
+ idleMs: m.getSboxProfileIdleMsV2(),
875
+ stuckMs: m.getSboxExecStuckMsV2(),
876
+ },
877
+ null,
878
+ 2,
879
+ ),
880
+ );
881
+ });
882
+ parent
883
+ .command("sbox-gov-set-max-active-v2 <n>")
884
+ .description("Set max active profiles per owner")
885
+ .action(async (n) => {
886
+ const m = await L();
887
+ m.setMaxActiveSboxProfilesPerOwnerV2(Number(n));
888
+ console.log("ok");
889
+ });
890
+ parent
891
+ .command("sbox-gov-set-max-pending-v2 <n>")
892
+ .description("Set max pending execs per profile")
893
+ .action(async (n) => {
894
+ const m = await L();
895
+ m.setMaxPendingSboxExecsPerProfileV2(Number(n));
896
+ console.log("ok");
897
+ });
898
+ parent
899
+ .command("sbox-gov-set-idle-ms-v2 <n>")
900
+ .description("Set profile idle threshold (ms)")
901
+ .action(async (n) => {
902
+ const m = await L();
903
+ m.setSboxProfileIdleMsV2(Number(n));
904
+ console.log("ok");
905
+ });
906
+ parent
907
+ .command("sbox-gov-set-stuck-ms-v2 <n>")
908
+ .description("Set exec stuck threshold (ms)")
909
+ .action(async (n) => {
910
+ const m = await L();
911
+ m.setSboxExecStuckMsV2(Number(n));
912
+ console.log("ok");
913
+ });
914
+ parent
915
+ .command("sbox-gov-register-v2 <id> <owner>")
916
+ .description("Register V2 sbox profile")
917
+ .option("--template <v>", "template")
918
+ .action(async (id, owner, o) => {
919
+ const m = await L();
920
+ console.log(
921
+ JSON.stringify(
922
+ m.registerSboxProfileV2({ id, owner, template: o.template }),
923
+ null,
924
+ 2,
925
+ ),
926
+ );
927
+ });
928
+ parent
929
+ .command("sbox-gov-activate-v2 <id>")
930
+ .description("Activate profile")
931
+ .action(async (id) => {
932
+ const m = await L();
933
+ console.log(JSON.stringify(m.activateSboxProfileV2(id), null, 2));
934
+ });
935
+ parent
936
+ .command("sbox-gov-pause-v2 <id>")
937
+ .description("Pause profile")
938
+ .action(async (id) => {
939
+ const m = await L();
940
+ console.log(JSON.stringify(m.pauseSboxProfileV2(id), null, 2));
941
+ });
942
+ parent
943
+ .command("sbox-gov-archive-v2 <id>")
944
+ .description("Archive profile (terminal)")
945
+ .action(async (id) => {
946
+ const m = await L();
947
+ console.log(JSON.stringify(m.archiveSboxProfileV2(id), null, 2));
948
+ });
949
+ parent
950
+ .command("sbox-gov-touch-v2 <id>")
951
+ .description("Touch profile")
952
+ .action(async (id) => {
953
+ const m = await L();
954
+ console.log(JSON.stringify(m.touchSboxProfileV2(id), null, 2));
955
+ });
956
+ parent
957
+ .command("sbox-gov-get-v2 <id>")
958
+ .description("Get profile")
959
+ .action(async (id) => {
960
+ const m = await L();
961
+ console.log(JSON.stringify(m.getSboxProfileV2(id), null, 2));
962
+ });
963
+ parent
964
+ .command("sbox-gov-list-v2")
965
+ .description("List profiles")
966
+ .action(async () => {
967
+ const m = await L();
968
+ console.log(JSON.stringify(m.listSboxProfilesV2(), null, 2));
969
+ });
970
+ parent
971
+ .command("sbox-gov-create-exec-v2 <id> <profileId>")
972
+ .description("Create exec (queued)")
973
+ .option("--command <v>", "command")
974
+ .action(async (id, profileId, o) => {
975
+ const m = await L();
976
+ console.log(
977
+ JSON.stringify(
978
+ m.createSboxExecV2({ id, profileId, command: o.command }),
979
+ null,
980
+ 2,
981
+ ),
982
+ );
983
+ });
984
+ parent
985
+ .command("sbox-gov-running-exec-v2 <id>")
986
+ .description("Mark exec as running")
987
+ .action(async (id) => {
988
+ const m = await L();
989
+ console.log(JSON.stringify(m.runningSboxExecV2(id), null, 2));
990
+ });
991
+ parent
992
+ .command("sbox-gov-complete-exec-v2 <id>")
993
+ .description("Complete exec")
994
+ .action(async (id) => {
995
+ const m = await L();
996
+ console.log(JSON.stringify(m.completeExecSboxV2(id), null, 2));
997
+ });
998
+ parent
999
+ .command("sbox-gov-fail-exec-v2 <id> [reason]")
1000
+ .description("Fail exec")
1001
+ .action(async (id, reason) => {
1002
+ const m = await L();
1003
+ console.log(JSON.stringify(m.failSboxExecV2(id, reason), null, 2));
1004
+ });
1005
+ parent
1006
+ .command("sbox-gov-cancel-exec-v2 <id> [reason]")
1007
+ .description("Cancel exec")
1008
+ .action(async (id, reason) => {
1009
+ const m = await L();
1010
+ console.log(JSON.stringify(m.cancelSboxExecV2(id, reason), null, 2));
1011
+ });
1012
+ parent
1013
+ .command("sbox-gov-get-exec-v2 <id>")
1014
+ .description("Get exec")
1015
+ .action(async (id) => {
1016
+ const m = await L();
1017
+ console.log(JSON.stringify(m.getSboxExecV2(id), null, 2));
1018
+ });
1019
+ parent
1020
+ .command("sbox-gov-list-execs-v2")
1021
+ .description("List execs")
1022
+ .action(async () => {
1023
+ const m = await L();
1024
+ console.log(JSON.stringify(m.listSboxExecsV2(), null, 2));
1025
+ });
1026
+ parent
1027
+ .command("sbox-gov-auto-pause-idle-v2")
1028
+ .description("Auto-pause idle profiles")
1029
+ .action(async () => {
1030
+ const m = await L();
1031
+ console.log(JSON.stringify(m.autoPauseIdleSboxProfilesV2(), null, 2));
1032
+ });
1033
+ parent
1034
+ .command("sbox-gov-auto-fail-stuck-v2")
1035
+ .description("Auto-fail stuck execs")
1036
+ .action(async () => {
1037
+ const m = await L();
1038
+ console.log(JSON.stringify(m.autoFailStuckSboxExecsV2(), null, 2));
1039
+ });
1040
+ parent
1041
+ .command("sbox-gov-gov-stats-v2")
1042
+ .description("V2 gov aggregate stats")
1043
+ .action(async () => {
1044
+ const m = await L();
1045
+ console.log(JSON.stringify(m.getSandboxGovStatsV2(), null, 2));
1046
+ });
1047
+ }
@@ -0,0 +1,153 @@
1
+ /**
2
+ * `cc seshhook` — Session Hooks V2 governance overlay (in-memory, atop lib/session-hooks.js).
3
+ */
4
+ import {
5
+ SHOK_PROFILE_MATURITY_V2,
6
+ SHOK_INVOCATION_LIFECYCLE_V2,
7
+ setMaxActiveShokProfilesPerOwnerV2,
8
+ getMaxActiveShokProfilesPerOwnerV2,
9
+ setMaxPendingShokInvocationsPerProfileV2,
10
+ getMaxPendingShokInvocationsPerProfileV2,
11
+ setShokProfileIdleMsV2,
12
+ getShokProfileIdleMsV2,
13
+ setShokInvocationStuckMsV2,
14
+ getShokInvocationStuckMsV2,
15
+ registerShokProfileV2,
16
+ activateShokProfileV2,
17
+ disableShokProfileV2,
18
+ retireShokProfileV2,
19
+ touchShokProfileV2,
20
+ getShokProfileV2,
21
+ listShokProfilesV2,
22
+ createShokInvocationV2,
23
+ runningShokInvocationV2,
24
+ completeShokInvocationV2,
25
+ failShokInvocationV2,
26
+ cancelShokInvocationV2,
27
+ getShokInvocationV2,
28
+ listShokInvocationsV2,
29
+ autoDisableIdleShokProfilesV2,
30
+ autoFailStuckShokInvocationsV2,
31
+ getSessionHooksGovStatsV2,
32
+ _resetStateSessionHooksV2,
33
+ } from "../lib/session-hooks.js";
34
+
35
+ export function registerSeshhookCommand(program) {
36
+ const sh = program
37
+ .command("seshhook")
38
+ .description("Session Hooks V2 governance");
39
+ sh.command("enums-v2").action(() =>
40
+ console.log(
41
+ JSON.stringify(
42
+ {
43
+ profileMaturity: SHOK_PROFILE_MATURITY_V2,
44
+ invocationLifecycle: SHOK_INVOCATION_LIFECYCLE_V2,
45
+ },
46
+ null,
47
+ 2,
48
+ ),
49
+ ),
50
+ );
51
+ sh.command("config-v2").action(() =>
52
+ console.log(
53
+ JSON.stringify(
54
+ {
55
+ maxActiveShokProfilesPerOwner: getMaxActiveShokProfilesPerOwnerV2(),
56
+ maxPendingShokInvocationsPerProfile:
57
+ getMaxPendingShokInvocationsPerProfileV2(),
58
+ shokProfileIdleMs: getShokProfileIdleMsV2(),
59
+ shokInvocationStuckMs: getShokInvocationStuckMsV2(),
60
+ },
61
+ null,
62
+ 2,
63
+ ),
64
+ ),
65
+ );
66
+ sh.command("set-max-active-v2 <n>").action((n) => {
67
+ setMaxActiveShokProfilesPerOwnerV2(Number(n));
68
+ console.log("ok");
69
+ });
70
+ sh.command("set-max-pending-v2 <n>").action((n) => {
71
+ setMaxPendingShokInvocationsPerProfileV2(Number(n));
72
+ console.log("ok");
73
+ });
74
+ sh.command("set-idle-ms-v2 <n>").action((n) => {
75
+ setShokProfileIdleMsV2(Number(n));
76
+ console.log("ok");
77
+ });
78
+ sh.command("set-stuck-ms-v2 <n>").action((n) => {
79
+ setShokInvocationStuckMsV2(Number(n));
80
+ console.log("ok");
81
+ });
82
+ sh.command("register-profile-v2 <id> <owner>")
83
+ .option("--event <e>", "event")
84
+ .action((id, owner, o) =>
85
+ console.log(
86
+ JSON.stringify(
87
+ registerShokProfileV2({ id, owner, event: o.event }),
88
+ null,
89
+ 2,
90
+ ),
91
+ ),
92
+ );
93
+ sh.command("activate-profile-v2 <id>").action((id) =>
94
+ console.log(JSON.stringify(activateShokProfileV2(id), null, 2)),
95
+ );
96
+ sh.command("disable-profile-v2 <id>").action((id) =>
97
+ console.log(JSON.stringify(disableShokProfileV2(id), null, 2)),
98
+ );
99
+ sh.command("retire-profile-v2 <id>").action((id) =>
100
+ console.log(JSON.stringify(retireShokProfileV2(id), null, 2)),
101
+ );
102
+ sh.command("touch-profile-v2 <id>").action((id) =>
103
+ console.log(JSON.stringify(touchShokProfileV2(id), null, 2)),
104
+ );
105
+ sh.command("get-profile-v2 <id>").action((id) =>
106
+ console.log(JSON.stringify(getShokProfileV2(id), null, 2)),
107
+ );
108
+ sh.command("list-profiles-v2").action(() =>
109
+ console.log(JSON.stringify(listShokProfilesV2(), null, 2)),
110
+ );
111
+ sh.command("create-invocation-v2 <id> <profileId>")
112
+ .option("--payload <p>", "payload")
113
+ .action((id, profileId, o) =>
114
+ console.log(
115
+ JSON.stringify(
116
+ createShokInvocationV2({ id, profileId, payload: o.payload }),
117
+ null,
118
+ 2,
119
+ ),
120
+ ),
121
+ );
122
+ sh.command("running-invocation-v2 <id>").action((id) =>
123
+ console.log(JSON.stringify(runningShokInvocationV2(id), null, 2)),
124
+ );
125
+ sh.command("complete-invocation-v2 <id>").action((id) =>
126
+ console.log(JSON.stringify(completeShokInvocationV2(id), null, 2)),
127
+ );
128
+ sh.command("fail-invocation-v2 <id> [reason]").action((id, reason) =>
129
+ console.log(JSON.stringify(failShokInvocationV2(id, reason), null, 2)),
130
+ );
131
+ sh.command("cancel-invocation-v2 <id> [reason]").action((id, reason) =>
132
+ console.log(JSON.stringify(cancelShokInvocationV2(id, reason), null, 2)),
133
+ );
134
+ sh.command("get-invocation-v2 <id>").action((id) =>
135
+ console.log(JSON.stringify(getShokInvocationV2(id), null, 2)),
136
+ );
137
+ sh.command("list-invocations-v2").action(() =>
138
+ console.log(JSON.stringify(listShokInvocationsV2(), null, 2)),
139
+ );
140
+ sh.command("auto-disable-idle-v2").action(() =>
141
+ console.log(JSON.stringify(autoDisableIdleShokProfilesV2(), null, 2)),
142
+ );
143
+ sh.command("auto-fail-stuck-v2").action(() =>
144
+ console.log(JSON.stringify(autoFailStuckShokInvocationsV2(), null, 2)),
145
+ );
146
+ sh.command("gov-stats-v2").action(() =>
147
+ console.log(JSON.stringify(getSessionHooksGovStatsV2(), null, 2)),
148
+ );
149
+ sh.command("reset-state-v2").action(() => {
150
+ _resetStateSessionHooksV2();
151
+ console.log(JSON.stringify({ ok: true }, null, 2));
152
+ });
153
+ }
@@ -0,0 +1,149 @@
1
+ /**
2
+ * `cc seshsearch` — Session Search V2 governance overlay (in-memory, atop lib/session-search.js).
3
+ */
4
+ import {
5
+ SSCH_PROFILE_MATURITY_V2,
6
+ SSCH_QUERY_LIFECYCLE_V2,
7
+ setMaxActiveSschProfilesPerOwnerV2,
8
+ getMaxActiveSschProfilesPerOwnerV2,
9
+ setMaxPendingSschQueriesPerProfileV2,
10
+ getMaxPendingSschQueriesPerProfileV2,
11
+ setSschProfileIdleMsV2,
12
+ getSschProfileIdleMsV2,
13
+ setSschQueryStuckMsV2,
14
+ getSschQueryStuckMsV2,
15
+ registerSschProfileV2,
16
+ activateSschProfileV2,
17
+ staleSschProfileV2,
18
+ archiveSschProfileV2,
19
+ touchSschProfileV2,
20
+ getSschProfileV2,
21
+ listSschProfilesV2,
22
+ createSschQueryV2,
23
+ searchingSschQueryV2,
24
+ completeSschQueryV2,
25
+ failSschQueryV2,
26
+ cancelSschQueryV2,
27
+ getSschQueryV2,
28
+ listSschQueriesV2,
29
+ autoStaleIdleSschProfilesV2,
30
+ autoFailStuckSschQueriesV2,
31
+ getSessionSearchGovStatsV2,
32
+ _resetStateSessionSearchV2,
33
+ } from "../lib/session-search.js";
34
+
35
+ export function registerSeshsearchCommand(program) {
36
+ const ss = program
37
+ .command("seshsearch")
38
+ .description("Session Search V2 governance");
39
+ ss.command("enums-v2").action(() =>
40
+ console.log(
41
+ JSON.stringify(
42
+ {
43
+ profileMaturity: SSCH_PROFILE_MATURITY_V2,
44
+ queryLifecycle: SSCH_QUERY_LIFECYCLE_V2,
45
+ },
46
+ null,
47
+ 2,
48
+ ),
49
+ ),
50
+ );
51
+ ss.command("config-v2").action(() =>
52
+ console.log(
53
+ JSON.stringify(
54
+ {
55
+ maxActiveSschProfilesPerOwner: getMaxActiveSschProfilesPerOwnerV2(),
56
+ maxPendingSschQueriesPerProfile:
57
+ getMaxPendingSschQueriesPerProfileV2(),
58
+ sschProfileIdleMs: getSschProfileIdleMsV2(),
59
+ sschQueryStuckMs: getSschQueryStuckMsV2(),
60
+ },
61
+ null,
62
+ 2,
63
+ ),
64
+ ),
65
+ );
66
+ ss.command("set-max-active-v2 <n>").action((n) => {
67
+ setMaxActiveSschProfilesPerOwnerV2(Number(n));
68
+ console.log("ok");
69
+ });
70
+ ss.command("set-max-pending-v2 <n>").action((n) => {
71
+ setMaxPendingSschQueriesPerProfileV2(Number(n));
72
+ console.log("ok");
73
+ });
74
+ ss.command("set-idle-ms-v2 <n>").action((n) => {
75
+ setSschProfileIdleMsV2(Number(n));
76
+ console.log("ok");
77
+ });
78
+ ss.command("set-stuck-ms-v2 <n>").action((n) => {
79
+ setSschQueryStuckMsV2(Number(n));
80
+ console.log("ok");
81
+ });
82
+ ss.command("register-profile-v2 <id> <owner>")
83
+ .option("--scope <s>", "scope")
84
+ .action((id, owner, o) =>
85
+ console.log(
86
+ JSON.stringify(
87
+ registerSschProfileV2({ id, owner, scope: o.scope }),
88
+ null,
89
+ 2,
90
+ ),
91
+ ),
92
+ );
93
+ ss.command("activate-profile-v2 <id>").action((id) =>
94
+ console.log(JSON.stringify(activateSschProfileV2(id), null, 2)),
95
+ );
96
+ ss.command("stale-profile-v2 <id>").action((id) =>
97
+ console.log(JSON.stringify(staleSschProfileV2(id), null, 2)),
98
+ );
99
+ ss.command("archive-profile-v2 <id>").action((id) =>
100
+ console.log(JSON.stringify(archiveSschProfileV2(id), null, 2)),
101
+ );
102
+ ss.command("touch-profile-v2 <id>").action((id) =>
103
+ console.log(JSON.stringify(touchSschProfileV2(id), null, 2)),
104
+ );
105
+ ss.command("get-profile-v2 <id>").action((id) =>
106
+ console.log(JSON.stringify(getSschProfileV2(id), null, 2)),
107
+ );
108
+ ss.command("list-profiles-v2").action(() =>
109
+ console.log(JSON.stringify(listSschProfilesV2(), null, 2)),
110
+ );
111
+ ss.command("create-query-v2 <id> <profileId>")
112
+ .option("--q <q>", "query string")
113
+ .action((id, profileId, o) =>
114
+ console.log(
115
+ JSON.stringify(createSschQueryV2({ id, profileId, q: o.q }), null, 2),
116
+ ),
117
+ );
118
+ ss.command("searching-query-v2 <id>").action((id) =>
119
+ console.log(JSON.stringify(searchingSschQueryV2(id), null, 2)),
120
+ );
121
+ ss.command("complete-query-v2 <id>").action((id) =>
122
+ console.log(JSON.stringify(completeSschQueryV2(id), null, 2)),
123
+ );
124
+ ss.command("fail-query-v2 <id> [reason]").action((id, reason) =>
125
+ console.log(JSON.stringify(failSschQueryV2(id, reason), null, 2)),
126
+ );
127
+ ss.command("cancel-query-v2 <id> [reason]").action((id, reason) =>
128
+ console.log(JSON.stringify(cancelSschQueryV2(id, reason), null, 2)),
129
+ );
130
+ ss.command("get-query-v2 <id>").action((id) =>
131
+ console.log(JSON.stringify(getSschQueryV2(id), null, 2)),
132
+ );
133
+ ss.command("list-queries-v2").action(() =>
134
+ console.log(JSON.stringify(listSschQueriesV2(), null, 2)),
135
+ );
136
+ ss.command("auto-stale-idle-v2").action(() =>
137
+ console.log(JSON.stringify(autoStaleIdleSschProfilesV2(), null, 2)),
138
+ );
139
+ ss.command("auto-fail-stuck-v2").action(() =>
140
+ console.log(JSON.stringify(autoFailStuckSschQueriesV2(), null, 2)),
141
+ );
142
+ ss.command("gov-stats-v2").action(() =>
143
+ console.log(JSON.stringify(getSessionSearchGovStatsV2(), null, 2)),
144
+ );
145
+ ss.command("reset-state-v2").action(() => {
146
+ _resetStateSessionSearchV2();
147
+ console.log(JSON.stringify({ ok: true }, null, 2));
148
+ });
149
+ }
@@ -0,0 +1,152 @@
1
+ /**
2
+ * `cc seshtail` — Session Tail V2 governance overlay (in-memory, atop lib/session-tail.js).
3
+ */
4
+ import {
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,
33
+ } from "../lib/session-tail.js";
34
+
35
+ export function registerSeshtailCommand(program) {
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
+ });
152
+ }