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
@@ -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
+ }
@@ -2,40 +2,152 @@
2
2
  * `cc seshhook` — Session Hooks V2 governance overlay (in-memory, atop lib/session-hooks.js).
3
3
  */
4
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,
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,
13
33
  } from "../lib/session-hooks.js";
14
34
 
15
35
  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)); });
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
+ });
41
153
  }
@@ -2,40 +2,148 @@
2
2
  * `cc seshsearch` — Session Search V2 governance overlay (in-memory, atop lib/session-search.js).
3
3
  */
4
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,
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,
13
33
  } from "../lib/session-search.js";
14
34
 
15
35
  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)); });
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
+ });
41
149
  }