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
@@ -1839,4 +1839,424 @@ export function registerComplianceCommand(program) {
1839
1839
  .action(() => {
1840
1840
  console.log(JSON.stringify(autoEscalateStuckInvestigationsV2(), null, 2));
1841
1841
  });
1842
+
1843
+ _registerComplianceFwReporterV2Commands(compliance);
1844
+ }
1845
+
1846
+ function _registerComplianceFwReporterV2Commands(parent) {
1847
+ const L = async () => await import("../lib/compliance-framework-reporter.js");
1848
+ parent
1849
+ .command("fwrep-enums-v2")
1850
+ .description("Show V2 enums (fw maturity + report lifecycle)")
1851
+ .action(async () => {
1852
+ const m = await L();
1853
+ console.log(
1854
+ JSON.stringify(
1855
+ {
1856
+ fwMaturity: m.COMPLIANCE_FW_MATURITY_V2,
1857
+ reportLifecycle: m.COMPLIANCE_FW_REPORT_LIFECYCLE_V2,
1858
+ },
1859
+ null,
1860
+ 2,
1861
+ ),
1862
+ );
1863
+ });
1864
+ parent
1865
+ .command("fwrep-config-v2")
1866
+ .description("Show V2 config thresholds")
1867
+ .action(async () => {
1868
+ const m = await L();
1869
+ console.log(
1870
+ JSON.stringify(
1871
+ {
1872
+ maxActiveComplianceFwsPerOwner:
1873
+ m.getMaxActiveComplianceFwsPerOwnerV2(),
1874
+ maxPendingComplianceFwReportsPerFw:
1875
+ m.getMaxPendingComplianceFwReportsPerFwV2(),
1876
+ complianceFwIdleMs: m.getComplianceFwIdleMsV2(),
1877
+ complianceFwReportStuckMs: m.getComplianceFwReportStuckMsV2(),
1878
+ },
1879
+ null,
1880
+ 2,
1881
+ ),
1882
+ );
1883
+ });
1884
+ parent
1885
+ .command("fwrep-set-max-active-v2 <n>")
1886
+ .description("Set max active fws per owner")
1887
+ .action(async (n) => {
1888
+ const m = await L();
1889
+ m.setMaxActiveComplianceFwsPerOwnerV2(Number(n));
1890
+ console.log("ok");
1891
+ });
1892
+ parent
1893
+ .command("fwrep-set-max-pending-v2 <n>")
1894
+ .description("Set max pending reports per fw")
1895
+ .action(async (n) => {
1896
+ const m = await L();
1897
+ m.setMaxPendingComplianceFwReportsPerFwV2(Number(n));
1898
+ console.log("ok");
1899
+ });
1900
+ parent
1901
+ .command("fwrep-set-fw-idle-ms-v2 <n>")
1902
+ .description("Set fw idle threshold (ms)")
1903
+ .action(async (n) => {
1904
+ const m = await L();
1905
+ m.setComplianceFwIdleMsV2(Number(n));
1906
+ console.log("ok");
1907
+ });
1908
+ parent
1909
+ .command("fwrep-set-report-stuck-ms-v2 <n>")
1910
+ .description("Set report stuck threshold (ms)")
1911
+ .action(async (n) => {
1912
+ const m = await L();
1913
+ m.setComplianceFwReportStuckMsV2(Number(n));
1914
+ console.log("ok");
1915
+ });
1916
+ parent
1917
+ .command("fwrep-register-v2 <id> <owner>")
1918
+ .description("Register V2 compliance framework")
1919
+ .option("--name <n>", "Framework name")
1920
+ .action(async (id, owner, o) => {
1921
+ const m = await L();
1922
+ console.log(
1923
+ JSON.stringify(
1924
+ m.registerComplianceFwV2({ id, owner, name: o.name }),
1925
+ null,
1926
+ 2,
1927
+ ),
1928
+ );
1929
+ });
1930
+ parent
1931
+ .command("fwrep-activate-v2 <id>")
1932
+ .description("Activate framework")
1933
+ .action(async (id) => {
1934
+ const m = await L();
1935
+ console.log(JSON.stringify(m.activateComplianceFwV2(id), null, 2));
1936
+ });
1937
+ parent
1938
+ .command("fwrep-deprecate-v2 <id>")
1939
+ .description("Deprecate framework")
1940
+ .action(async (id) => {
1941
+ const m = await L();
1942
+ console.log(JSON.stringify(m.deprecateComplianceFwV2(id), null, 2));
1943
+ });
1944
+ parent
1945
+ .command("fwrep-archive-v2 <id>")
1946
+ .description("Archive framework (terminal)")
1947
+ .action(async (id) => {
1948
+ const m = await L();
1949
+ console.log(JSON.stringify(m.archiveComplianceFwV2(id), null, 2));
1950
+ });
1951
+ parent
1952
+ .command("fwrep-touch-v2 <id>")
1953
+ .description("Touch framework")
1954
+ .action(async (id) => {
1955
+ const m = await L();
1956
+ console.log(JSON.stringify(m.touchComplianceFwV2(id), null, 2));
1957
+ });
1958
+ parent
1959
+ .command("fwrep-get-v2 <id>")
1960
+ .description("Get V2 framework")
1961
+ .action(async (id) => {
1962
+ const m = await L();
1963
+ console.log(JSON.stringify(m.getComplianceFwV2(id), null, 2));
1964
+ });
1965
+ parent
1966
+ .command("fwrep-list-v2")
1967
+ .description("List V2 frameworks")
1968
+ .action(async () => {
1969
+ const m = await L();
1970
+ console.log(JSON.stringify(m.listComplianceFwsV2(), null, 2));
1971
+ });
1972
+ parent
1973
+ .command("fwrep-create-report-v2 <id> <frameworkId>")
1974
+ .description("Create V2 report (queued)")
1975
+ .option("--format <f>", "Format", "markdown")
1976
+ .action(async (id, frameworkId, o) => {
1977
+ const m = await L();
1978
+ console.log(
1979
+ JSON.stringify(
1980
+ m.createComplianceFwReportV2({ id, frameworkId, format: o.format }),
1981
+ null,
1982
+ 2,
1983
+ ),
1984
+ );
1985
+ });
1986
+ parent
1987
+ .command("fwrep-start-report-v2 <id>")
1988
+ .description("Start report")
1989
+ .action(async (id) => {
1990
+ const m = await L();
1991
+ console.log(JSON.stringify(m.startComplianceFwReportV2(id), null, 2));
1992
+ });
1993
+ parent
1994
+ .command("fwrep-complete-report-v2 <id>")
1995
+ .description("Complete report")
1996
+ .action(async (id) => {
1997
+ const m = await L();
1998
+ console.log(JSON.stringify(m.completeComplianceFwReportV2(id), null, 2));
1999
+ });
2000
+ parent
2001
+ .command("fwrep-fail-report-v2 <id> [reason]")
2002
+ .description("Fail report")
2003
+ .action(async (id, reason) => {
2004
+ const m = await L();
2005
+ console.log(
2006
+ JSON.stringify(m.failComplianceFwReportV2(id, reason), null, 2),
2007
+ );
2008
+ });
2009
+ parent
2010
+ .command("fwrep-cancel-report-v2 <id> [reason]")
2011
+ .description("Cancel report")
2012
+ .action(async (id, reason) => {
2013
+ const m = await L();
2014
+ console.log(
2015
+ JSON.stringify(m.cancelComplianceFwReportV2(id, reason), null, 2),
2016
+ );
2017
+ });
2018
+ parent
2019
+ .command("fwrep-get-report-v2 <id>")
2020
+ .description("Get V2 report")
2021
+ .action(async (id) => {
2022
+ const m = await L();
2023
+ console.log(JSON.stringify(m.getComplianceFwReportV2(id), null, 2));
2024
+ });
2025
+ parent
2026
+ .command("fwrep-list-reports-v2")
2027
+ .description("List V2 reports")
2028
+ .action(async () => {
2029
+ const m = await L();
2030
+ console.log(JSON.stringify(m.listComplianceFwReportsV2(), null, 2));
2031
+ });
2032
+ parent
2033
+ .command("fwrep-auto-deprecate-idle-v2")
2034
+ .description("Auto-deprecate idle fws")
2035
+ .action(async () => {
2036
+ const m = await L();
2037
+ console.log(
2038
+ JSON.stringify(m.autoDeprecateIdleComplianceFwsV2(), null, 2),
2039
+ );
2040
+ });
2041
+ parent
2042
+ .command("fwrep-auto-fail-stuck-v2")
2043
+ .description("Auto-fail stuck generating reports")
2044
+ .action(async () => {
2045
+ const m = await L();
2046
+ console.log(
2047
+ JSON.stringify(m.autoFailStuckComplianceFwReportsV2(), null, 2),
2048
+ );
2049
+ });
2050
+ parent
2051
+ .command("fwrep-gov-stats-v2")
2052
+ .description("V2 gov aggregate stats (fw reporter)")
2053
+ .action(async () => {
2054
+ const m = await L();
2055
+ console.log(
2056
+ JSON.stringify(m.getComplianceFwReporterGovStatsV2(), null, 2),
2057
+ );
2058
+ });
2059
+ }
2060
+
2061
+ // === Iter17 V2 governance overlay ===
2062
+ export function registerCmgrV2Commands(program) {
2063
+ const parent = program.commands.find((c) => c.name() === "compliance");
2064
+ if (!parent) return;
2065
+ const L = async () => await import("../lib/compliance-manager.js");
2066
+ parent
2067
+ .command("cmgr-enums-v2")
2068
+ .description("Show V2 enums")
2069
+ .action(async () => {
2070
+ const m = await L();
2071
+ console.log(
2072
+ JSON.stringify(
2073
+ {
2074
+ profileMaturity: m.CMGR_PROFILE_MATURITY_V2,
2075
+ auditLifecycle: m.CMGR_AUDIT_LIFECYCLE_V2,
2076
+ },
2077
+ null,
2078
+ 2,
2079
+ ),
2080
+ );
2081
+ });
2082
+ parent
2083
+ .command("cmgr-config-v2")
2084
+ .description("Show V2 config")
2085
+ .action(async () => {
2086
+ const m = await L();
2087
+ console.log(
2088
+ JSON.stringify(
2089
+ {
2090
+ maxActive: m.getMaxActiveCmgrProfilesPerOwnerV2(),
2091
+ maxPending: m.getMaxPendingCmgrAuditsPerProfileV2(),
2092
+ idleMs: m.getCmgrProfileIdleMsV2(),
2093
+ stuckMs: m.getCmgrAuditStuckMsV2(),
2094
+ },
2095
+ null,
2096
+ 2,
2097
+ ),
2098
+ );
2099
+ });
2100
+ parent
2101
+ .command("cmgr-set-max-active-v2 <n>")
2102
+ .description("Set max active")
2103
+ .action(async (n) => {
2104
+ (await L()).setMaxActiveCmgrProfilesPerOwnerV2(Number(n));
2105
+ console.log("ok");
2106
+ });
2107
+ parent
2108
+ .command("cmgr-set-max-pending-v2 <n>")
2109
+ .description("Set max pending")
2110
+ .action(async (n) => {
2111
+ (await L()).setMaxPendingCmgrAuditsPerProfileV2(Number(n));
2112
+ console.log("ok");
2113
+ });
2114
+ parent
2115
+ .command("cmgr-set-idle-ms-v2 <n>")
2116
+ .description("Set idle threshold ms")
2117
+ .action(async (n) => {
2118
+ (await L()).setCmgrProfileIdleMsV2(Number(n));
2119
+ console.log("ok");
2120
+ });
2121
+ parent
2122
+ .command("cmgr-set-stuck-ms-v2 <n>")
2123
+ .description("Set stuck threshold ms")
2124
+ .action(async (n) => {
2125
+ (await L()).setCmgrAuditStuckMsV2(Number(n));
2126
+ console.log("ok");
2127
+ });
2128
+ parent
2129
+ .command("cmgr-register-v2 <id> <owner>")
2130
+ .description("Register V2 profile")
2131
+ .option("--framework <v>", "framework")
2132
+ .action(async (id, owner, o) => {
2133
+ const m = await L();
2134
+ console.log(
2135
+ JSON.stringify(
2136
+ m.registerCmgrProfileV2({ id, owner, framework: o.framework }),
2137
+ null,
2138
+ 2,
2139
+ ),
2140
+ );
2141
+ });
2142
+ parent
2143
+ .command("cmgr-activate-v2 <id>")
2144
+ .description("Activate profile")
2145
+ .action(async (id) => {
2146
+ console.log(
2147
+ JSON.stringify((await L()).activateCmgrProfileV2(id), null, 2),
2148
+ );
2149
+ });
2150
+ parent
2151
+ .command("cmgr-deprecate-v2 <id>")
2152
+ .description("Deprecate profile")
2153
+ .action(async (id) => {
2154
+ console.log(
2155
+ JSON.stringify((await L()).deprecateCmgrProfileV2(id), null, 2),
2156
+ );
2157
+ });
2158
+ parent
2159
+ .command("cmgr-archive-v2 <id>")
2160
+ .description("Archive profile")
2161
+ .action(async (id) => {
2162
+ console.log(
2163
+ JSON.stringify((await L()).archiveCmgrProfileV2(id), null, 2),
2164
+ );
2165
+ });
2166
+ parent
2167
+ .command("cmgr-touch-v2 <id>")
2168
+ .description("Touch profile")
2169
+ .action(async (id) => {
2170
+ console.log(JSON.stringify((await L()).touchCmgrProfileV2(id), null, 2));
2171
+ });
2172
+ parent
2173
+ .command("cmgr-get-v2 <id>")
2174
+ .description("Get profile")
2175
+ .action(async (id) => {
2176
+ console.log(JSON.stringify((await L()).getCmgrProfileV2(id), null, 2));
2177
+ });
2178
+ parent
2179
+ .command("cmgr-list-v2")
2180
+ .description("List profiles")
2181
+ .action(async () => {
2182
+ console.log(JSON.stringify((await L()).listCmgrProfilesV2(), null, 2));
2183
+ });
2184
+ parent
2185
+ .command("cmgr-create-audit-v2 <id> <profileId>")
2186
+ .description("Create audit")
2187
+ .option("--control <v>", "control")
2188
+ .action(async (id, profileId, o) => {
2189
+ const m = await L();
2190
+ console.log(
2191
+ JSON.stringify(
2192
+ m.createCmgrAuditV2({ id, profileId, control: o.control }),
2193
+ null,
2194
+ 2,
2195
+ ),
2196
+ );
2197
+ });
2198
+ parent
2199
+ .command("cmgr-auditing-audit-v2 <id>")
2200
+ .description("Mark audit as auditing")
2201
+ .action(async (id) => {
2202
+ console.log(JSON.stringify((await L()).auditingCmgrAuditV2(id), null, 2));
2203
+ });
2204
+ parent
2205
+ .command("cmgr-complete-audit-v2 <id>")
2206
+ .description("Complete audit")
2207
+ .action(async (id) => {
2208
+ console.log(JSON.stringify((await L()).completeAuditCmgrV2(id), null, 2));
2209
+ });
2210
+ parent
2211
+ .command("cmgr-fail-audit-v2 <id> [reason]")
2212
+ .description("Fail audit")
2213
+ .action(async (id, reason) => {
2214
+ console.log(
2215
+ JSON.stringify((await L()).failCmgrAuditV2(id, reason), null, 2),
2216
+ );
2217
+ });
2218
+ parent
2219
+ .command("cmgr-cancel-audit-v2 <id> [reason]")
2220
+ .description("Cancel audit")
2221
+ .action(async (id, reason) => {
2222
+ console.log(
2223
+ JSON.stringify((await L()).cancelCmgrAuditV2(id, reason), null, 2),
2224
+ );
2225
+ });
2226
+ parent
2227
+ .command("cmgr-get-audit-v2 <id>")
2228
+ .description("Get audit")
2229
+ .action(async (id) => {
2230
+ console.log(JSON.stringify((await L()).getCmgrAuditV2(id), null, 2));
2231
+ });
2232
+ parent
2233
+ .command("cmgr-list-audits-v2")
2234
+ .description("List audits")
2235
+ .action(async () => {
2236
+ console.log(JSON.stringify((await L()).listCmgrAuditsV2(), null, 2));
2237
+ });
2238
+ parent
2239
+ .command("cmgr-auto-deprecate-idle-v2")
2240
+ .description("Auto-deprecate idle")
2241
+ .action(async () => {
2242
+ console.log(
2243
+ JSON.stringify((await L()).autoDeprecateIdleCmgrProfilesV2(), null, 2),
2244
+ );
2245
+ });
2246
+ parent
2247
+ .command("cmgr-auto-fail-stuck-v2")
2248
+ .description("Auto-fail stuck audits")
2249
+ .action(async () => {
2250
+ console.log(
2251
+ JSON.stringify((await L()).autoFailStuckCmgrAuditsV2(), null, 2),
2252
+ );
2253
+ });
2254
+ parent
2255
+ .command("cmgr-gov-stats-v2")
2256
+ .description("V2 gov stats")
2257
+ .action(async () => {
2258
+ console.log(
2259
+ JSON.stringify((await L()).getComplianceManagerGovStatsV2(), null, 2),
2260
+ );
2261
+ });
1842
2262
  }
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Compression Telemetry V2 governance commands — `cc compt ...`
3
+ * 在内存中治理 COMPT profile (pending/active/stale/archived) + sample 生命周期。
4
+ */
5
+ import {
6
+ COMPT_PROFILE_MATURITY_V2,
7
+ COMPT_SAMPLE_LIFECYCLE_V2,
8
+ registerComptProfileV2,
9
+ activateComptProfileV2,
10
+ staleComptProfileV2,
11
+ archiveComptProfileV2,
12
+ touchComptProfileV2,
13
+ getComptProfileV2,
14
+ listComptProfilesV2,
15
+ createComptSampleV2,
16
+ recordingComptSampleV2,
17
+ recordComptSampleV2,
18
+ failComptSampleV2,
19
+ cancelComptSampleV2,
20
+ getComptSampleV2,
21
+ listComptSamplesV2,
22
+ setMaxActiveComptProfilesPerOwnerV2,
23
+ getMaxActiveComptProfilesPerOwnerV2,
24
+ setMaxPendingComptSamplesPerProfileV2,
25
+ getMaxPendingComptSamplesPerProfileV2,
26
+ setComptProfileIdleMsV2,
27
+ getComptProfileIdleMsV2,
28
+ setComptSampleStuckMsV2,
29
+ getComptSampleStuckMsV2,
30
+ autoStaleIdleComptProfilesV2,
31
+ autoFailStuckComptSamplesV2,
32
+ getCompressionTelemetryGovStatsV2,
33
+ } from "../lib/compression-telemetry.js";
34
+
35
+ export function registerComptCommand(program) {
36
+ const c = program
37
+ .command("compt")
38
+ .description(
39
+ "Compression Telemetry V2 governance (in-memory, CLI v0.143.0)",
40
+ );
41
+
42
+ c.command("enums-v2").action(() =>
43
+ console.log(
44
+ JSON.stringify(
45
+ { COMPT_PROFILE_MATURITY_V2, COMPT_SAMPLE_LIFECYCLE_V2 },
46
+ null,
47
+ 2,
48
+ ),
49
+ ),
50
+ );
51
+ c.command("register-profile-v2")
52
+ .requiredOption("--id <id>")
53
+ .requiredOption("--owner <owner>")
54
+ .option("--kind <kind>", "telemetry kind", "default")
55
+ .action((o) =>
56
+ console.log(JSON.stringify(registerComptProfileV2(o), null, 2)),
57
+ );
58
+ c.command("activate-profile-v2 <id>").action((id) =>
59
+ console.log(JSON.stringify(activateComptProfileV2(id), null, 2)),
60
+ );
61
+ c.command("stale-profile-v2 <id>").action((id) =>
62
+ console.log(JSON.stringify(staleComptProfileV2(id), null, 2)),
63
+ );
64
+ c.command("archive-profile-v2 <id>").action((id) =>
65
+ console.log(JSON.stringify(archiveComptProfileV2(id), null, 2)),
66
+ );
67
+ c.command("touch-profile-v2 <id>").action((id) =>
68
+ console.log(JSON.stringify(touchComptProfileV2(id), null, 2)),
69
+ );
70
+ c.command("get-profile-v2 <id>").action((id) =>
71
+ console.log(JSON.stringify(getComptProfileV2(id), null, 2)),
72
+ );
73
+ c.command("list-profiles-v2").action(() =>
74
+ console.log(JSON.stringify(listComptProfilesV2(), null, 2)),
75
+ );
76
+
77
+ c.command("create-sample-v2")
78
+ .requiredOption("--id <id>")
79
+ .requiredOption("--profile-id <profileId>")
80
+ .option("--metric <metric>", "metric name", "")
81
+ .action((o) =>
82
+ console.log(JSON.stringify(createComptSampleV2(o), null, 2)),
83
+ );
84
+ c.command("recording-sample-v2 <id>").action((id) =>
85
+ console.log(JSON.stringify(recordingComptSampleV2(id), null, 2)),
86
+ );
87
+ c.command("record-sample-v2 <id>").action((id) =>
88
+ console.log(JSON.stringify(recordComptSampleV2(id), null, 2)),
89
+ );
90
+ c.command("fail-sample-v2 <id>")
91
+ .option("--reason <r>")
92
+ .action((id, o) =>
93
+ console.log(JSON.stringify(failComptSampleV2(id, o.reason), null, 2)),
94
+ );
95
+ c.command("cancel-sample-v2 <id>")
96
+ .option("--reason <r>")
97
+ .action((id, o) =>
98
+ console.log(JSON.stringify(cancelComptSampleV2(id, o.reason), null, 2)),
99
+ );
100
+ c.command("get-sample-v2 <id>").action((id) =>
101
+ console.log(JSON.stringify(getComptSampleV2(id), null, 2)),
102
+ );
103
+ c.command("list-samples-v2").action(() =>
104
+ console.log(JSON.stringify(listComptSamplesV2(), null, 2)),
105
+ );
106
+
107
+ c.command("config-v2").action(() =>
108
+ console.log(
109
+ JSON.stringify(
110
+ {
111
+ maxActiveComptProfilesPerOwner: getMaxActiveComptProfilesPerOwnerV2(),
112
+ maxPendingComptSamplesPerProfile:
113
+ getMaxPendingComptSamplesPerProfileV2(),
114
+ comptProfileIdleMs: getComptProfileIdleMsV2(),
115
+ comptSampleStuckMs: getComptSampleStuckMsV2(),
116
+ },
117
+ null,
118
+ 2,
119
+ ),
120
+ ),
121
+ );
122
+ c.command("set-max-active-profiles-v2 <n>").action((n) => {
123
+ setMaxActiveComptProfilesPerOwnerV2(Number(n));
124
+ console.log(
125
+ JSON.stringify(
126
+ {
127
+ maxActiveComptProfilesPerOwner: getMaxActiveComptProfilesPerOwnerV2(),
128
+ },
129
+ null,
130
+ 2,
131
+ ),
132
+ );
133
+ });
134
+ c.command("set-max-pending-samples-v2 <n>").action((n) => {
135
+ setMaxPendingComptSamplesPerProfileV2(Number(n));
136
+ console.log(
137
+ JSON.stringify(
138
+ {
139
+ maxPendingComptSamplesPerProfile:
140
+ getMaxPendingComptSamplesPerProfileV2(),
141
+ },
142
+ null,
143
+ 2,
144
+ ),
145
+ );
146
+ });
147
+ c.command("set-profile-idle-ms-v2 <ms>").action((ms) => {
148
+ setComptProfileIdleMsV2(Number(ms));
149
+ console.log(
150
+ JSON.stringify(
151
+ { comptProfileIdleMs: getComptProfileIdleMsV2() },
152
+ null,
153
+ 2,
154
+ ),
155
+ );
156
+ });
157
+ c.command("set-sample-stuck-ms-v2 <ms>").action((ms) => {
158
+ setComptSampleStuckMsV2(Number(ms));
159
+ console.log(
160
+ JSON.stringify(
161
+ { comptSampleStuckMs: getComptSampleStuckMsV2() },
162
+ null,
163
+ 2,
164
+ ),
165
+ );
166
+ });
167
+ c.command("auto-stale-idle-v2").action(() =>
168
+ console.log(JSON.stringify(autoStaleIdleComptProfilesV2(), null, 2)),
169
+ );
170
+ c.command("auto-fail-stuck-v2").action(() =>
171
+ console.log(JSON.stringify(autoFailStuckComptSamplesV2(), null, 2)),
172
+ );
173
+ c.command("gov-stats-v2").action(() =>
174
+ console.log(JSON.stringify(getCompressionTelemetryGovStatsV2(), null, 2)),
175
+ );
176
+ }