groove-dev 0.27.92 → 0.27.94

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 (501) hide show
  1. package/moe-training/package.json +2 -1
  2. package/node_modules/@groove-dev/cli/package.json +1 -1
  3. package/node_modules/@groove-dev/daemon/package.json +1 -1
  4. package/node_modules/@groove-dev/daemon/src/api.js +17 -9
  5. package/node_modules/@groove-dev/daemon/src/process.js +2 -0
  6. package/node_modules/@groove-dev/gui/dist/assets/{codemirror-BBL3i_JW.js → codemirror-CFF1Lrnz.js} +10 -10
  7. package/{packages/gui/dist/assets/index-DWv32qyJ.js → node_modules/@groove-dev/gui/dist/assets/index-B3GUKInH.js} +1740 -1740
  8. package/{packages/gui/dist/assets/index-Bo6AeNmM.css → node_modules/@groove-dev/gui/dist/assets/index-C1k-GuDg.css} +1 -1
  9. package/node_modules/@groove-dev/gui/dist/index.html +3 -3
  10. package/node_modules/@groove-dev/gui/package.json +1 -1
  11. package/node_modules/@groove-dev/gui/src/components/agents/agent-panel.jsx +2 -0
  12. package/node_modules/@groove-dev/gui/src/components/editor/code-editor.jsx +3 -3
  13. package/node_modules/@groove-dev/gui/src/stores/groove.js +23 -16
  14. package/node_modules/@groove-dev/gui/src/views/agents.jsx +44 -113
  15. package/node_modules/base64-js/LICENSE +21 -0
  16. package/node_modules/base64-js/README.md +34 -0
  17. package/node_modules/base64-js/base64js.min.js +1 -0
  18. package/node_modules/base64-js/index.d.ts +3 -0
  19. package/node_modules/base64-js/index.js +150 -0
  20. package/node_modules/base64-js/package.json +47 -0
  21. package/node_modules/better-sqlite3/LICENSE +21 -0
  22. package/node_modules/better-sqlite3/README.md +99 -0
  23. package/node_modules/better-sqlite3/binding.gyp +38 -0
  24. package/node_modules/better-sqlite3/deps/common.gypi +68 -0
  25. package/node_modules/better-sqlite3/deps/copy.js +31 -0
  26. package/node_modules/better-sqlite3/deps/defines.gypi +41 -0
  27. package/node_modules/better-sqlite3/deps/download.sh +122 -0
  28. package/node_modules/better-sqlite3/deps/patches/1208.patch +15 -0
  29. package/node_modules/better-sqlite3/deps/sqlite3/sqlite3.c +268845 -0
  30. package/node_modules/better-sqlite3/deps/sqlite3/sqlite3.h +14335 -0
  31. package/node_modules/better-sqlite3/deps/sqlite3/sqlite3ext.h +739 -0
  32. package/node_modules/better-sqlite3/deps/sqlite3.gyp +80 -0
  33. package/node_modules/better-sqlite3/deps/test_extension.c +21 -0
  34. package/node_modules/better-sqlite3/lib/database.js +90 -0
  35. package/node_modules/better-sqlite3/lib/index.js +3 -0
  36. package/node_modules/better-sqlite3/lib/methods/aggregate.js +43 -0
  37. package/node_modules/better-sqlite3/lib/methods/backup.js +67 -0
  38. package/node_modules/better-sqlite3/lib/methods/function.js +31 -0
  39. package/node_modules/better-sqlite3/lib/methods/inspect.js +7 -0
  40. package/node_modules/better-sqlite3/lib/methods/pragma.js +12 -0
  41. package/node_modules/better-sqlite3/lib/methods/serialize.js +16 -0
  42. package/node_modules/better-sqlite3/lib/methods/table.js +189 -0
  43. package/node_modules/better-sqlite3/lib/methods/transaction.js +78 -0
  44. package/node_modules/better-sqlite3/lib/methods/wrappers.js +54 -0
  45. package/node_modules/better-sqlite3/lib/sqlite-error.js +20 -0
  46. package/node_modules/better-sqlite3/lib/util.js +12 -0
  47. package/node_modules/better-sqlite3/package.json +59 -0
  48. package/node_modules/better-sqlite3/src/addon.cpp +47 -0
  49. package/node_modules/better-sqlite3/src/better_sqlite3.cpp +74 -0
  50. package/node_modules/better-sqlite3/src/objects/backup.cpp +120 -0
  51. package/node_modules/better-sqlite3/src/objects/backup.hpp +36 -0
  52. package/node_modules/better-sqlite3/src/objects/database.cpp +417 -0
  53. package/node_modules/better-sqlite3/src/objects/database.hpp +103 -0
  54. package/node_modules/better-sqlite3/src/objects/statement-iterator.cpp +113 -0
  55. package/node_modules/better-sqlite3/src/objects/statement-iterator.hpp +50 -0
  56. package/node_modules/better-sqlite3/src/objects/statement.cpp +383 -0
  57. package/node_modules/better-sqlite3/src/objects/statement.hpp +58 -0
  58. package/node_modules/better-sqlite3/src/util/bind-map.cpp +73 -0
  59. package/node_modules/better-sqlite3/src/util/binder.cpp +193 -0
  60. package/node_modules/better-sqlite3/src/util/constants.cpp +172 -0
  61. package/node_modules/better-sqlite3/src/util/custom-aggregate.cpp +121 -0
  62. package/node_modules/better-sqlite3/src/util/custom-function.cpp +59 -0
  63. package/node_modules/better-sqlite3/src/util/custom-table.cpp +409 -0
  64. package/node_modules/better-sqlite3/src/util/data-converter.cpp +17 -0
  65. package/node_modules/better-sqlite3/src/util/data.cpp +194 -0
  66. package/node_modules/better-sqlite3/src/util/helpers.cpp +109 -0
  67. package/node_modules/better-sqlite3/src/util/macros.cpp +83 -0
  68. package/node_modules/better-sqlite3/src/util/query-macros.cpp +71 -0
  69. package/node_modules/better-sqlite3/src/util/row-builder.cpp +49 -0
  70. package/node_modules/bindings/LICENSE.md +22 -0
  71. package/node_modules/bindings/README.md +98 -0
  72. package/node_modules/bindings/bindings.js +221 -0
  73. package/node_modules/bindings/package.json +28 -0
  74. package/node_modules/bl/.travis.yml +17 -0
  75. package/node_modules/bl/BufferList.js +396 -0
  76. package/node_modules/bl/LICENSE.md +13 -0
  77. package/node_modules/bl/README.md +247 -0
  78. package/node_modules/bl/bl.js +84 -0
  79. package/node_modules/bl/package.json +37 -0
  80. package/node_modules/bl/test/convert.js +21 -0
  81. package/node_modules/bl/test/indexOf.js +492 -0
  82. package/node_modules/bl/test/isBufferList.js +32 -0
  83. package/node_modules/bl/test/test.js +869 -0
  84. package/node_modules/buffer/AUTHORS.md +70 -0
  85. package/node_modules/buffer/LICENSE +21 -0
  86. package/node_modules/buffer/README.md +410 -0
  87. package/node_modules/buffer/index.d.ts +186 -0
  88. package/node_modules/buffer/index.js +1817 -0
  89. package/node_modules/buffer/package.json +96 -0
  90. package/node_modules/decompress-response/index.d.ts +22 -0
  91. package/node_modules/decompress-response/index.js +58 -0
  92. package/node_modules/decompress-response/license +9 -0
  93. package/node_modules/decompress-response/node_modules/mimic-response/index.d.ts +17 -0
  94. package/node_modules/decompress-response/node_modules/mimic-response/index.js +77 -0
  95. package/node_modules/decompress-response/node_modules/mimic-response/license +9 -0
  96. package/node_modules/decompress-response/node_modules/mimic-response/package.json +42 -0
  97. package/node_modules/decompress-response/node_modules/mimic-response/readme.md +78 -0
  98. package/node_modules/decompress-response/package.json +56 -0
  99. package/node_modules/decompress-response/readme.md +48 -0
  100. package/node_modules/deep-extend/LICENSE +20 -0
  101. package/node_modules/deep-extend/README.md +91 -0
  102. package/node_modules/deep-extend/index.js +1 -0
  103. package/node_modules/deep-extend/lib/deep-extend.js +150 -0
  104. package/node_modules/deep-extend/package.json +62 -0
  105. package/node_modules/end-of-stream/LICENSE +21 -0
  106. package/node_modules/end-of-stream/README.md +54 -0
  107. package/node_modules/end-of-stream/index.js +96 -0
  108. package/node_modules/end-of-stream/package.json +37 -0
  109. package/node_modules/expand-template/.travis.yml +6 -0
  110. package/node_modules/expand-template/LICENSE +21 -0
  111. package/node_modules/expand-template/README.md +43 -0
  112. package/node_modules/expand-template/index.js +26 -0
  113. package/node_modules/expand-template/package.json +29 -0
  114. package/node_modules/expand-template/test.js +67 -0
  115. package/node_modules/file-uri-to-path/.npmignore +1 -0
  116. package/node_modules/file-uri-to-path/.travis.yml +30 -0
  117. package/node_modules/file-uri-to-path/History.md +21 -0
  118. package/node_modules/file-uri-to-path/LICENSE +20 -0
  119. package/node_modules/file-uri-to-path/README.md +74 -0
  120. package/node_modules/file-uri-to-path/index.d.ts +2 -0
  121. package/node_modules/file-uri-to-path/index.js +66 -0
  122. package/node_modules/file-uri-to-path/package.json +32 -0
  123. package/node_modules/file-uri-to-path/test/test.js +24 -0
  124. package/node_modules/file-uri-to-path/test/tests.json +13 -0
  125. package/node_modules/fs-constants/LICENSE +21 -0
  126. package/node_modules/fs-constants/README.md +26 -0
  127. package/node_modules/fs-constants/browser.js +1 -0
  128. package/node_modules/fs-constants/index.js +1 -0
  129. package/node_modules/fs-constants/package.json +19 -0
  130. package/node_modules/github-from-package/.travis.yml +4 -0
  131. package/node_modules/github-from-package/LICENSE +18 -0
  132. package/node_modules/github-from-package/example/package.json +8 -0
  133. package/node_modules/github-from-package/example/url.js +3 -0
  134. package/node_modules/github-from-package/index.js +17 -0
  135. package/node_modules/github-from-package/package.json +30 -0
  136. package/node_modules/github-from-package/readme.markdown +53 -0
  137. package/node_modules/github-from-package/test/a.json +8 -0
  138. package/node_modules/github-from-package/test/b.json +5 -0
  139. package/node_modules/github-from-package/test/c.json +5 -0
  140. package/node_modules/github-from-package/test/d.json +7 -0
  141. package/node_modules/github-from-package/test/e.json +5 -0
  142. package/node_modules/github-from-package/test/url.js +19 -0
  143. package/node_modules/ieee754/LICENSE +11 -0
  144. package/node_modules/ieee754/README.md +51 -0
  145. package/node_modules/ieee754/index.d.ts +10 -0
  146. package/node_modules/ieee754/index.js +85 -0
  147. package/node_modules/ieee754/package.json +52 -0
  148. package/node_modules/ini/LICENSE +15 -0
  149. package/node_modules/ini/README.md +102 -0
  150. package/node_modules/ini/ini.js +206 -0
  151. package/node_modules/ini/package.json +33 -0
  152. package/node_modules/minimist/.eslintrc +29 -0
  153. package/node_modules/minimist/.github/FUNDING.yml +12 -0
  154. package/node_modules/minimist/.nycrc +14 -0
  155. package/node_modules/minimist/CHANGELOG.md +298 -0
  156. package/node_modules/minimist/LICENSE +18 -0
  157. package/node_modules/minimist/README.md +121 -0
  158. package/node_modules/minimist/example/parse.js +4 -0
  159. package/node_modules/minimist/index.js +263 -0
  160. package/node_modules/minimist/package.json +75 -0
  161. package/node_modules/minimist/test/all_bool.js +34 -0
  162. package/node_modules/minimist/test/bool.js +177 -0
  163. package/node_modules/minimist/test/dash.js +43 -0
  164. package/node_modules/minimist/test/default_bool.js +37 -0
  165. package/node_modules/minimist/test/dotted.js +24 -0
  166. package/node_modules/minimist/test/kv_short.js +32 -0
  167. package/node_modules/minimist/test/long.js +33 -0
  168. package/node_modules/minimist/test/num.js +38 -0
  169. package/node_modules/minimist/test/parse.js +209 -0
  170. package/node_modules/minimist/test/parse_modified.js +11 -0
  171. package/node_modules/minimist/test/proto.js +64 -0
  172. package/node_modules/minimist/test/short.js +69 -0
  173. package/node_modules/minimist/test/stop_early.js +17 -0
  174. package/node_modules/minimist/test/unknown.js +104 -0
  175. package/node_modules/minimist/test/whitespace.js +10 -0
  176. package/node_modules/mkdirp-classic/LICENSE +21 -0
  177. package/node_modules/mkdirp-classic/README.md +18 -0
  178. package/node_modules/mkdirp-classic/index.js +98 -0
  179. package/node_modules/mkdirp-classic/package.json +18 -0
  180. package/node_modules/moe-training/DEPLOY_CENTRAL_COMMAND.md +413 -0
  181. package/node_modules/moe-training/client/consent.js +96 -0
  182. package/node_modules/moe-training/client/envelope-builder.js +56 -0
  183. package/node_modules/moe-training/client/index.js +10 -0
  184. package/node_modules/moe-training/client/parsers/claude-code.js +108 -0
  185. package/node_modules/moe-training/client/parsers/codex.js +80 -0
  186. package/node_modules/moe-training/client/parsers/gemini.js +80 -0
  187. package/node_modules/moe-training/client/parsers/grok.js +16 -0
  188. package/node_modules/moe-training/client/parsers/index.js +20 -0
  189. package/node_modules/moe-training/client/scrubber.js +128 -0
  190. package/node_modules/moe-training/client/session-attestation.js +115 -0
  191. package/node_modules/moe-training/client/step-classifier.js +68 -0
  192. package/node_modules/moe-training/client/trajectory-capture.js +307 -0
  193. package/node_modules/moe-training/client/transmission-queue.js +104 -0
  194. package/node_modules/moe-training/package.json +21 -0
  195. package/node_modules/moe-training/server/enrichment.js +24 -0
  196. package/node_modules/moe-training/server/index.js +119 -0
  197. package/node_modules/moe-training/server/ledger.js +110 -0
  198. package/node_modules/moe-training/server/routes/ingest.js +96 -0
  199. package/node_modules/moe-training/server/routes/sessions.js +43 -0
  200. package/node_modules/moe-training/server/routes/stats.js +31 -0
  201. package/node_modules/moe-training/server/scoring.js +63 -0
  202. package/node_modules/moe-training/server/session-registry.js +156 -0
  203. package/node_modules/moe-training/server/stats.js +129 -0
  204. package/node_modules/moe-training/server/stitcher.js +69 -0
  205. package/node_modules/moe-training/server/storage.js +147 -0
  206. package/node_modules/moe-training/server/verifier.js +102 -0
  207. package/node_modules/moe-training/shared/constants.js +30 -0
  208. package/node_modules/moe-training/shared/crypto.js +45 -0
  209. package/node_modules/moe-training/shared/envelope-schema.js +220 -0
  210. package/node_modules/moe-training/test/client/consent.test.js +121 -0
  211. package/node_modules/moe-training/test/client/envelope-builder.test.js +107 -0
  212. package/node_modules/moe-training/test/client/parsers/claude-code.test.js +119 -0
  213. package/node_modules/moe-training/test/client/parsers/codex.test.js +83 -0
  214. package/node_modules/moe-training/test/client/parsers/gemini.test.js +99 -0
  215. package/node_modules/moe-training/test/client/scrubber.test.js +143 -0
  216. package/node_modules/moe-training/test/client/session-attestation-security.test.js +95 -0
  217. package/node_modules/moe-training/test/client/step-classifier.test.js +135 -0
  218. package/node_modules/moe-training/test/client/transmission-queue.test.js +33 -0
  219. package/node_modules/moe-training/test/integration/handshake.test.js +260 -0
  220. package/node_modules/moe-training/test/server/ingest-security.test.js +166 -0
  221. package/node_modules/moe-training/test/server/ledger.test.js +131 -0
  222. package/node_modules/moe-training/test/server/scoring.test.js +242 -0
  223. package/node_modules/moe-training/test/server/session-registry.test.js +125 -0
  224. package/node_modules/moe-training/test/server/stitcher.test.js +157 -0
  225. package/node_modules/moe-training/test/server/verifier.test.js +232 -0
  226. package/node_modules/moe-training/test/shared/crypto.test.js +87 -0
  227. package/node_modules/moe-training/test/shared/envelope-schema.test.js +351 -0
  228. package/node_modules/napi-build-utils/.github/workflows/run-npm-tests.yml +31 -0
  229. package/node_modules/napi-build-utils/LICENSE +21 -0
  230. package/node_modules/napi-build-utils/README.md +52 -0
  231. package/node_modules/napi-build-utils/index.js +214 -0
  232. package/node_modules/napi-build-utils/index.md +0 -0
  233. package/node_modules/napi-build-utils/package.json +42 -0
  234. package/node_modules/prebuild-install/CHANGELOG.md +131 -0
  235. package/node_modules/prebuild-install/CONTRIBUTING.md +6 -0
  236. package/node_modules/prebuild-install/LICENSE +21 -0
  237. package/node_modules/prebuild-install/README.md +163 -0
  238. package/node_modules/prebuild-install/asset.js +44 -0
  239. package/node_modules/prebuild-install/bin.js +78 -0
  240. package/node_modules/prebuild-install/download.js +142 -0
  241. package/node_modules/prebuild-install/error.js +14 -0
  242. package/node_modules/prebuild-install/help.txt +16 -0
  243. package/node_modules/prebuild-install/index.js +1 -0
  244. package/node_modules/prebuild-install/log.js +33 -0
  245. package/node_modules/prebuild-install/node_modules/node-abi/LICENSE +21 -0
  246. package/node_modules/prebuild-install/node_modules/node-abi/README.md +54 -0
  247. package/node_modules/prebuild-install/node_modules/node-abi/abi_registry.json +439 -0
  248. package/node_modules/prebuild-install/node_modules/node-abi/index.js +179 -0
  249. package/node_modules/prebuild-install/node_modules/node-abi/package.json +45 -0
  250. package/node_modules/prebuild-install/node_modules/semver/LICENSE +15 -0
  251. package/node_modules/prebuild-install/node_modules/semver/README.md +665 -0
  252. package/node_modules/prebuild-install/node_modules/semver/bin/semver.js +191 -0
  253. package/node_modules/prebuild-install/node_modules/semver/classes/comparator.js +143 -0
  254. package/node_modules/prebuild-install/node_modules/semver/classes/index.js +7 -0
  255. package/node_modules/prebuild-install/node_modules/semver/classes/range.js +557 -0
  256. package/node_modules/prebuild-install/node_modules/semver/classes/semver.js +333 -0
  257. package/node_modules/prebuild-install/node_modules/semver/functions/clean.js +8 -0
  258. package/node_modules/prebuild-install/node_modules/semver/functions/cmp.js +54 -0
  259. package/node_modules/prebuild-install/node_modules/semver/functions/coerce.js +62 -0
  260. package/node_modules/prebuild-install/node_modules/semver/functions/compare-build.js +9 -0
  261. package/node_modules/prebuild-install/node_modules/semver/functions/compare-loose.js +5 -0
  262. package/node_modules/prebuild-install/node_modules/semver/functions/compare.js +7 -0
  263. package/node_modules/prebuild-install/node_modules/semver/functions/diff.js +60 -0
  264. package/node_modules/prebuild-install/node_modules/semver/functions/eq.js +5 -0
  265. package/node_modules/prebuild-install/node_modules/semver/functions/gt.js +5 -0
  266. package/node_modules/prebuild-install/node_modules/semver/functions/gte.js +5 -0
  267. package/node_modules/prebuild-install/node_modules/semver/functions/inc.js +21 -0
  268. package/node_modules/prebuild-install/node_modules/semver/functions/lt.js +5 -0
  269. package/node_modules/prebuild-install/node_modules/semver/functions/lte.js +5 -0
  270. package/node_modules/prebuild-install/node_modules/semver/functions/major.js +5 -0
  271. package/node_modules/prebuild-install/node_modules/semver/functions/minor.js +5 -0
  272. package/node_modules/prebuild-install/node_modules/semver/functions/neq.js +5 -0
  273. package/node_modules/prebuild-install/node_modules/semver/functions/parse.js +18 -0
  274. package/node_modules/prebuild-install/node_modules/semver/functions/patch.js +5 -0
  275. package/node_modules/prebuild-install/node_modules/semver/functions/prerelease.js +8 -0
  276. package/node_modules/prebuild-install/node_modules/semver/functions/rcompare.js +5 -0
  277. package/node_modules/prebuild-install/node_modules/semver/functions/rsort.js +5 -0
  278. package/node_modules/prebuild-install/node_modules/semver/functions/satisfies.js +12 -0
  279. package/node_modules/prebuild-install/node_modules/semver/functions/sort.js +5 -0
  280. package/node_modules/prebuild-install/node_modules/semver/functions/valid.js +8 -0
  281. package/node_modules/prebuild-install/node_modules/semver/index.js +91 -0
  282. package/node_modules/prebuild-install/node_modules/semver/internal/constants.js +37 -0
  283. package/node_modules/prebuild-install/node_modules/semver/internal/debug.js +11 -0
  284. package/node_modules/prebuild-install/node_modules/semver/internal/identifiers.js +29 -0
  285. package/node_modules/prebuild-install/node_modules/semver/internal/lrucache.js +42 -0
  286. package/node_modules/prebuild-install/node_modules/semver/internal/parse-options.js +17 -0
  287. package/node_modules/prebuild-install/node_modules/semver/internal/re.js +223 -0
  288. package/node_modules/prebuild-install/node_modules/semver/package.json +78 -0
  289. package/node_modules/prebuild-install/node_modules/semver/preload.js +4 -0
  290. package/node_modules/prebuild-install/node_modules/semver/range.bnf +16 -0
  291. package/node_modules/prebuild-install/node_modules/semver/ranges/gtr.js +6 -0
  292. package/node_modules/prebuild-install/node_modules/semver/ranges/intersects.js +9 -0
  293. package/node_modules/prebuild-install/node_modules/semver/ranges/ltr.js +6 -0
  294. package/node_modules/prebuild-install/node_modules/semver/ranges/max-satisfying.js +27 -0
  295. package/node_modules/prebuild-install/node_modules/semver/ranges/min-satisfying.js +26 -0
  296. package/node_modules/prebuild-install/node_modules/semver/ranges/min-version.js +63 -0
  297. package/node_modules/prebuild-install/node_modules/semver/ranges/outside.js +82 -0
  298. package/node_modules/prebuild-install/node_modules/semver/ranges/simplify.js +49 -0
  299. package/node_modules/prebuild-install/node_modules/semver/ranges/subset.js +249 -0
  300. package/node_modules/prebuild-install/node_modules/semver/ranges/to-comparators.js +10 -0
  301. package/node_modules/prebuild-install/node_modules/semver/ranges/valid.js +13 -0
  302. package/node_modules/prebuild-install/package.json +67 -0
  303. package/node_modules/prebuild-install/proxy.js +35 -0
  304. package/node_modules/prebuild-install/rc.js +64 -0
  305. package/node_modules/prebuild-install/util.js +143 -0
  306. package/node_modules/pump/.github/FUNDING.yml +2 -0
  307. package/node_modules/pump/.travis.yml +5 -0
  308. package/node_modules/pump/LICENSE +21 -0
  309. package/node_modules/pump/README.md +74 -0
  310. package/node_modules/pump/SECURITY.md +5 -0
  311. package/node_modules/pump/empty.js +1 -0
  312. package/node_modules/pump/index.js +86 -0
  313. package/node_modules/pump/package.json +30 -0
  314. package/node_modules/pump/test-browser.js +66 -0
  315. package/node_modules/pump/test-node.js +53 -0
  316. package/node_modules/rc/LICENSE.APACHE2 +15 -0
  317. package/node_modules/rc/LICENSE.BSD +26 -0
  318. package/node_modules/rc/LICENSE.MIT +24 -0
  319. package/node_modules/rc/README.md +227 -0
  320. package/node_modules/rc/browser.js +7 -0
  321. package/node_modules/rc/cli.js +4 -0
  322. package/node_modules/rc/index.js +53 -0
  323. package/node_modules/rc/lib/utils.js +104 -0
  324. package/node_modules/rc/package.json +29 -0
  325. package/node_modules/rc/test/ini.js +16 -0
  326. package/node_modules/rc/test/nested-env-vars.js +50 -0
  327. package/node_modules/rc/test/test.js +59 -0
  328. package/node_modules/readable-stream/CONTRIBUTING.md +38 -0
  329. package/node_modules/readable-stream/GOVERNANCE.md +136 -0
  330. package/node_modules/readable-stream/LICENSE +47 -0
  331. package/node_modules/readable-stream/README.md +106 -0
  332. package/node_modules/readable-stream/errors-browser.js +127 -0
  333. package/node_modules/readable-stream/errors.js +116 -0
  334. package/node_modules/readable-stream/experimentalWarning.js +17 -0
  335. package/node_modules/readable-stream/lib/_stream_duplex.js +126 -0
  336. package/node_modules/readable-stream/lib/_stream_passthrough.js +37 -0
  337. package/node_modules/readable-stream/lib/_stream_readable.js +1027 -0
  338. package/node_modules/readable-stream/lib/_stream_transform.js +190 -0
  339. package/node_modules/readable-stream/lib/_stream_writable.js +641 -0
  340. package/node_modules/readable-stream/lib/internal/streams/async_iterator.js +180 -0
  341. package/node_modules/readable-stream/lib/internal/streams/buffer_list.js +183 -0
  342. package/node_modules/readable-stream/lib/internal/streams/destroy.js +96 -0
  343. package/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +86 -0
  344. package/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
  345. package/node_modules/readable-stream/lib/internal/streams/from.js +52 -0
  346. package/node_modules/readable-stream/lib/internal/streams/pipeline.js +86 -0
  347. package/node_modules/readable-stream/lib/internal/streams/state.js +22 -0
  348. package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
  349. package/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
  350. package/node_modules/readable-stream/package.json +68 -0
  351. package/node_modules/readable-stream/readable-browser.js +9 -0
  352. package/node_modules/readable-stream/readable.js +16 -0
  353. package/node_modules/simple-concat/.travis.yml +3 -0
  354. package/node_modules/simple-concat/LICENSE +20 -0
  355. package/node_modules/simple-concat/README.md +44 -0
  356. package/node_modules/simple-concat/index.js +15 -0
  357. package/node_modules/simple-concat/package.json +47 -0
  358. package/node_modules/simple-concat/test/basic.js +41 -0
  359. package/node_modules/simple-get/.github/dependabot.yml +15 -0
  360. package/node_modules/simple-get/.github/workflows/ci.yml +23 -0
  361. package/node_modules/simple-get/LICENSE +20 -0
  362. package/node_modules/simple-get/README.md +333 -0
  363. package/node_modules/simple-get/index.js +108 -0
  364. package/node_modules/simple-get/package.json +67 -0
  365. package/node_modules/string_decoder/LICENSE +48 -0
  366. package/node_modules/string_decoder/README.md +47 -0
  367. package/node_modules/string_decoder/lib/string_decoder.js +296 -0
  368. package/node_modules/string_decoder/package.json +34 -0
  369. package/node_modules/strip-json-comments/index.js +70 -0
  370. package/node_modules/strip-json-comments/license +21 -0
  371. package/node_modules/strip-json-comments/package.json +42 -0
  372. package/node_modules/strip-json-comments/readme.md +64 -0
  373. package/node_modules/tar-fs/.travis.yml +6 -0
  374. package/node_modules/tar-fs/LICENSE +21 -0
  375. package/node_modules/tar-fs/README.md +165 -0
  376. package/node_modules/tar-fs/index.js +363 -0
  377. package/node_modules/tar-fs/node_modules/chownr/LICENSE +15 -0
  378. package/node_modules/tar-fs/node_modules/chownr/README.md +3 -0
  379. package/node_modules/tar-fs/node_modules/chownr/chownr.js +167 -0
  380. package/node_modules/tar-fs/node_modules/chownr/package.json +29 -0
  381. package/node_modules/tar-fs/package.json +41 -0
  382. package/node_modules/tar-fs/test/fixtures/a/hello.txt +1 -0
  383. package/node_modules/tar-fs/test/fixtures/b/a/test.txt +1 -0
  384. package/node_modules/tar-fs/test/fixtures/d/file1 +0 -0
  385. package/node_modules/tar-fs/test/fixtures/d/file2 +0 -0
  386. package/node_modules/tar-fs/test/fixtures/d/sub-dir/file5 +0 -0
  387. package/node_modules/tar-fs/test/fixtures/d/sub-files/file3 +0 -0
  388. package/node_modules/tar-fs/test/fixtures/d/sub-files/file4 +0 -0
  389. package/node_modules/tar-fs/test/fixtures/e/directory/.ignore +0 -0
  390. package/node_modules/tar-fs/test/fixtures/e/file +0 -0
  391. package/node_modules/tar-fs/test/fixtures/invalid.tar +0 -0
  392. package/node_modules/tar-fs/test/index.js +346 -0
  393. package/node_modules/tar-stream/LICENSE +21 -0
  394. package/node_modules/tar-stream/README.md +168 -0
  395. package/node_modules/tar-stream/extract.js +257 -0
  396. package/node_modules/tar-stream/headers.js +295 -0
  397. package/node_modules/tar-stream/index.js +2 -0
  398. package/node_modules/tar-stream/pack.js +255 -0
  399. package/node_modules/tar-stream/package.json +58 -0
  400. package/node_modules/tar-stream/sandbox.js +11 -0
  401. package/node_modules/tunnel-agent/LICENSE +55 -0
  402. package/node_modules/tunnel-agent/README.md +4 -0
  403. package/node_modules/tunnel-agent/index.js +244 -0
  404. package/node_modules/tunnel-agent/package.json +22 -0
  405. package/node_modules/util-deprecate/History.md +16 -0
  406. package/node_modules/util-deprecate/LICENSE +24 -0
  407. package/node_modules/util-deprecate/README.md +53 -0
  408. package/node_modules/util-deprecate/browser.js +67 -0
  409. package/node_modules/util-deprecate/node.js +6 -0
  410. package/node_modules/util-deprecate/package.json +27 -0
  411. package/node_modules/uuid/CHANGELOG.md +274 -0
  412. package/node_modules/uuid/CONTRIBUTING.md +18 -0
  413. package/node_modules/uuid/LICENSE.md +9 -0
  414. package/node_modules/uuid/README.md +466 -0
  415. package/node_modules/uuid/dist/bin/uuid +2 -0
  416. package/node_modules/uuid/dist/commonjs-browser/index.js +79 -0
  417. package/node_modules/uuid/dist/commonjs-browser/md5.js +223 -0
  418. package/node_modules/uuid/dist/commonjs-browser/native.js +11 -0
  419. package/node_modules/uuid/dist/commonjs-browser/nil.js +8 -0
  420. package/node_modules/uuid/dist/commonjs-browser/parse.js +45 -0
  421. package/node_modules/uuid/dist/commonjs-browser/regex.js +8 -0
  422. package/node_modules/uuid/dist/commonjs-browser/rng.js +25 -0
  423. package/node_modules/uuid/dist/commonjs-browser/sha1.js +104 -0
  424. package/node_modules/uuid/dist/commonjs-browser/stringify.js +44 -0
  425. package/node_modules/uuid/dist/commonjs-browser/v1.js +107 -0
  426. package/node_modules/uuid/dist/commonjs-browser/v3.js +16 -0
  427. package/node_modules/uuid/dist/commonjs-browser/v35.js +80 -0
  428. package/node_modules/uuid/dist/commonjs-browser/v4.js +43 -0
  429. package/node_modules/uuid/dist/commonjs-browser/v5.js +16 -0
  430. package/node_modules/uuid/dist/commonjs-browser/validate.js +17 -0
  431. package/node_modules/uuid/dist/commonjs-browser/version.js +21 -0
  432. package/node_modules/uuid/dist/esm-browser/index.js +9 -0
  433. package/node_modules/uuid/dist/esm-browser/md5.js +215 -0
  434. package/node_modules/uuid/dist/esm-browser/native.js +4 -0
  435. package/node_modules/uuid/dist/esm-browser/nil.js +1 -0
  436. package/node_modules/uuid/dist/esm-browser/parse.js +35 -0
  437. package/node_modules/uuid/dist/esm-browser/regex.js +1 -0
  438. package/node_modules/uuid/dist/esm-browser/rng.js +18 -0
  439. package/node_modules/uuid/dist/esm-browser/sha1.js +96 -0
  440. package/node_modules/uuid/dist/esm-browser/stringify.js +33 -0
  441. package/node_modules/uuid/dist/esm-browser/v1.js +95 -0
  442. package/node_modules/uuid/dist/esm-browser/v3.js +4 -0
  443. package/node_modules/uuid/dist/esm-browser/v35.js +66 -0
  444. package/node_modules/uuid/dist/esm-browser/v4.js +29 -0
  445. package/node_modules/uuid/dist/esm-browser/v5.js +4 -0
  446. package/node_modules/uuid/dist/esm-browser/validate.js +7 -0
  447. package/node_modules/uuid/dist/esm-browser/version.js +11 -0
  448. package/node_modules/uuid/dist/esm-node/index.js +9 -0
  449. package/node_modules/uuid/dist/esm-node/md5.js +13 -0
  450. package/node_modules/uuid/dist/esm-node/native.js +4 -0
  451. package/node_modules/uuid/dist/esm-node/nil.js +1 -0
  452. package/node_modules/uuid/dist/esm-node/parse.js +35 -0
  453. package/node_modules/uuid/dist/esm-node/regex.js +1 -0
  454. package/node_modules/uuid/dist/esm-node/rng.js +12 -0
  455. package/node_modules/uuid/dist/esm-node/sha1.js +13 -0
  456. package/node_modules/uuid/dist/esm-node/stringify.js +33 -0
  457. package/node_modules/uuid/dist/esm-node/v1.js +95 -0
  458. package/node_modules/uuid/dist/esm-node/v3.js +4 -0
  459. package/node_modules/uuid/dist/esm-node/v35.js +66 -0
  460. package/node_modules/uuid/dist/esm-node/v4.js +29 -0
  461. package/node_modules/uuid/dist/esm-node/v5.js +4 -0
  462. package/node_modules/uuid/dist/esm-node/validate.js +7 -0
  463. package/node_modules/uuid/dist/esm-node/version.js +11 -0
  464. package/node_modules/uuid/dist/index.js +79 -0
  465. package/node_modules/uuid/dist/md5-browser.js +223 -0
  466. package/node_modules/uuid/dist/md5.js +23 -0
  467. package/node_modules/uuid/dist/native-browser.js +11 -0
  468. package/node_modules/uuid/dist/native.js +15 -0
  469. package/node_modules/uuid/dist/nil.js +8 -0
  470. package/node_modules/uuid/dist/parse.js +45 -0
  471. package/node_modules/uuid/dist/regex.js +8 -0
  472. package/node_modules/uuid/dist/rng-browser.js +25 -0
  473. package/node_modules/uuid/dist/rng.js +24 -0
  474. package/node_modules/uuid/dist/sha1-browser.js +104 -0
  475. package/node_modules/uuid/dist/sha1.js +23 -0
  476. package/node_modules/uuid/dist/stringify.js +44 -0
  477. package/node_modules/uuid/dist/uuid-bin.js +85 -0
  478. package/node_modules/uuid/dist/v1.js +107 -0
  479. package/node_modules/uuid/dist/v3.js +16 -0
  480. package/node_modules/uuid/dist/v35.js +80 -0
  481. package/node_modules/uuid/dist/v4.js +43 -0
  482. package/node_modules/uuid/dist/v5.js +16 -0
  483. package/node_modules/uuid/dist/validate.js +17 -0
  484. package/node_modules/uuid/dist/version.js +21 -0
  485. package/node_modules/uuid/package.json +135 -0
  486. package/node_modules/uuid/wrapper.mjs +10 -0
  487. package/package.json +5 -3
  488. package/packages/cli/package.json +1 -1
  489. package/packages/daemon/package.json +1 -1
  490. package/packages/daemon/src/api.js +17 -9
  491. package/packages/daemon/src/process.js +2 -0
  492. package/packages/gui/dist/assets/{codemirror-BBL3i_JW.js → codemirror-CFF1Lrnz.js} +10 -10
  493. package/{node_modules/@groove-dev/gui/dist/assets/index-DWv32qyJ.js → packages/gui/dist/assets/index-B3GUKInH.js} +1740 -1740
  494. package/{node_modules/@groove-dev/gui/dist/assets/index-Bo6AeNmM.css → packages/gui/dist/assets/index-C1k-GuDg.css} +1 -1
  495. package/packages/gui/dist/index.html +3 -3
  496. package/packages/gui/package.json +1 -1
  497. package/packages/gui/src/components/agents/agent-panel.jsx +2 -0
  498. package/packages/gui/src/components/editor/code-editor.jsx +3 -3
  499. package/packages/gui/src/stores/groove.js +23 -16
  500. package/packages/gui/src/views/agents.jsx +44 -113
  501. package/workspace.png +0 -0
@@ -0,0 +1,131 @@
1
+ // FSL-1.1-Apache-2.0 — see LICENSE
2
+
3
+ import { describe, it, beforeEach, afterEach } from 'node:test';
4
+ import assert from 'node:assert/strict';
5
+ import { mkdtempSync, rmSync } from 'node:fs';
6
+ import { join } from 'node:path';
7
+ import { tmpdir } from 'node:os';
8
+ import { ContributorLedger } from '../../server/ledger.js';
9
+
10
+ describe('ContributorLedger', () => {
11
+ let ledger;
12
+ let tmpDir;
13
+
14
+ beforeEach(() => {
15
+ tmpDir = mkdtempSync(join(tmpdir(), 'ledger-test-'));
16
+ ledger = new ContributorLedger(join(tmpDir, 'ledger.db'));
17
+ });
18
+
19
+ afterEach(() => {
20
+ ledger.close();
21
+ rmSync(tmpDir, { recursive: true, force: true });
22
+ });
23
+
24
+ it('credits a contributor and updates balance', () => {
25
+ ledger.credit('contrib_001', 'sess_001', {
26
+ basePoints: 10,
27
+ totalPoints: 50,
28
+ modelMultiplier: 5,
29
+ correctionBonus: 0,
30
+ coordinationBonus: 0,
31
+ errorRecoveryBonus: 0,
32
+ complexityBonus: 0,
33
+ qualityBonus: 0,
34
+ });
35
+
36
+ const balance = ledger.getBalance('contrib_001');
37
+ assert.ok(balance);
38
+ assert.equal(balance.total_points, 50);
39
+ assert.equal(balance.total_sessions, 1);
40
+ assert.equal(balance.trust_score, 1.0);
41
+ });
42
+
43
+ it('accumulates multiple credits', () => {
44
+ const scoreResult = {
45
+ basePoints: 5, totalPoints: 25, modelMultiplier: 5,
46
+ correctionBonus: 0, coordinationBonus: 0, errorRecoveryBonus: 0,
47
+ complexityBonus: 0, qualityBonus: 0,
48
+ };
49
+
50
+ ledger.credit('contrib_002', 'sess_a', scoreResult);
51
+ ledger.credit('contrib_002', 'sess_b', scoreResult);
52
+ ledger.credit('contrib_002', 'sess_c', scoreResult);
53
+
54
+ const balance = ledger.getBalance('contrib_002');
55
+ assert.equal(balance.total_points, 75);
56
+ assert.equal(balance.total_sessions, 3);
57
+ });
58
+
59
+ it('returns null for unknown contributor', () => {
60
+ assert.equal(ledger.getBalance('nonexistent'), null);
61
+ });
62
+
63
+ it('returns leaderboard sorted by points', () => {
64
+ const score = (pts) => ({
65
+ basePoints: 1, totalPoints: pts, modelMultiplier: 1,
66
+ correctionBonus: 0, coordinationBonus: 0, errorRecoveryBonus: 0,
67
+ complexityBonus: 0, qualityBonus: 0,
68
+ });
69
+
70
+ ledger.credit('user_a', 'sess_1', score(100));
71
+ ledger.credit('user_b', 'sess_2', score(300));
72
+ ledger.credit('user_c', 'sess_3', score(200));
73
+
74
+ const board = ledger.getLeaderboard(10);
75
+ assert.equal(board.length, 3);
76
+ assert.equal(board[0].contributor_id, 'user_b');
77
+ assert.equal(board[0].total_points, 300);
78
+ assert.equal(board[1].contributor_id, 'user_c');
79
+ assert.equal(board[2].contributor_id, 'user_a');
80
+ });
81
+
82
+ it('gets credit history for a contributor', () => {
83
+ const scoreResult = {
84
+ basePoints: 5, totalPoints: 25, modelMultiplier: 5,
85
+ correctionBonus: 0, coordinationBonus: 0, errorRecoveryBonus: 0,
86
+ complexityBonus: 0, qualityBonus: 0,
87
+ };
88
+
89
+ ledger.credit('contrib_hist', 'sess_x', scoreResult);
90
+ ledger.credit('contrib_hist', 'sess_y', scoreResult);
91
+
92
+ const credits = ledger.getCreditsForContributor('contrib_hist');
93
+ assert.equal(credits.length, 2);
94
+ assert.ok(credits[0].multiplier_breakdown);
95
+ });
96
+
97
+ it('daily credits aggregation works', () => {
98
+ const scoreResult = {
99
+ basePoints: 10, totalPoints: 50, modelMultiplier: 5,
100
+ correctionBonus: 0, coordinationBonus: 0, errorRecoveryBonus: 0,
101
+ complexityBonus: 0, qualityBonus: 0,
102
+ };
103
+
104
+ ledger.credit('contrib_daily', 'sess_d1', scoreResult);
105
+ ledger.credit('contrib_daily', 'sess_d2', scoreResult);
106
+
107
+ const daily = ledger.getDailyCredits(7);
108
+ assert.ok(daily.length >= 1);
109
+ const today = daily.find(d => d.date === new Date().toISOString().slice(0, 10));
110
+ assert.ok(today);
111
+ assert.equal(today.totalPoints, 100);
112
+ assert.equal(today.totalSessions, 2);
113
+ });
114
+
115
+ it('adjusts trust score within bounds', () => {
116
+ const scoreResult = {
117
+ basePoints: 1, totalPoints: 1, modelMultiplier: 1,
118
+ correctionBonus: 0, coordinationBonus: 0, errorRecoveryBonus: 0,
119
+ complexityBonus: 0, qualityBonus: 0,
120
+ };
121
+ ledger.credit('trust_user', 'sess_t', scoreResult);
122
+
123
+ ledger.adjustTrustScore('trust_user', 2.5);
124
+ let balance = ledger.getBalance('trust_user');
125
+ assert.equal(balance.trust_score, 3.5);
126
+
127
+ ledger.adjustTrustScore('trust_user', -10);
128
+ balance = ledger.getBalance('trust_user');
129
+ assert.equal(balance.trust_score, 0);
130
+ });
131
+ });
@@ -0,0 +1,242 @@
1
+ // FSL-1.1-Apache-2.0 — see LICENSE
2
+
3
+ import { describe, it } from 'node:test';
4
+ import assert from 'node:assert/strict';
5
+ import { TrajectoryScorer } from '../../server/scoring.js';
6
+ import { MODEL_TIERS, QUALITY_MULTIPLIERS } from '../../shared/constants.js';
7
+
8
+ const scorer = new TrajectoryScorer({ MODEL_TIERS, QUALITY_MULTIPLIERS });
9
+
10
+ function makeTrajectory(overrides = {}) {
11
+ return {
12
+ trajectory_log: overrides.steps || [
13
+ { step: 1, type: 'thought', token_count: 10 },
14
+ { step: 2, type: 'action', token_count: 5 },
15
+ { step: 3, type: 'observation', token_count: 8 },
16
+ ],
17
+ metadata: overrides.metadata || {},
18
+ };
19
+ }
20
+
21
+ describe('TrajectoryScorer', () => {
22
+ it('base scoring: 1 point per step', () => {
23
+ const result = scorer.score(makeTrajectory());
24
+ assert.equal(result.basePoints, 3);
25
+ });
26
+
27
+ it('caps base points at 5000', () => {
28
+ const steps = Array.from({ length: 6000 }, (_, i) => ({ step: i, type: 'thought' }));
29
+ const result = scorer.score(makeTrajectory({ steps }));
30
+ assert.equal(result.basePoints, 5000);
31
+ });
32
+
33
+ it('applies model multiplier correctly (5x for opus)', () => {
34
+ const result = scorer.score(makeTrajectory({
35
+ metadata: { model_engine: 'claude-opus-4-6' },
36
+ }));
37
+ assert.equal(result.basePoints, 3);
38
+ assert.equal(result.modelMultiplier, 5);
39
+ assert.equal(result.totalPoints, 3 * 5);
40
+ });
41
+
42
+ it('derives correction bonus from actual trajectory steps (not outcome)', () => {
43
+ const result = scorer.score(makeTrajectory({
44
+ steps: [
45
+ { step: 1, type: 'thought', token_count: 10 },
46
+ { step: 2, type: 'correction', token_count: 5 },
47
+ { step: 3, type: 'action', token_count: 8 },
48
+ { step: 4, type: 'action', token_count: 3 },
49
+ ],
50
+ }));
51
+ // 4 steps, 30% cap = 1, 1 correction step * 10 = 10
52
+ assert.equal(result.correctionBonus, 10);
53
+ });
54
+
55
+ it('caps correction steps at 30% of trajectory', () => {
56
+ // 10 steps, 5 are corrections — only 3 should count (30% of 10)
57
+ const steps = [
58
+ { step: 1, type: 'thought' },
59
+ { step: 2, type: 'correction' },
60
+ { step: 3, type: 'correction' },
61
+ { step: 4, type: 'correction' },
62
+ { step: 5, type: 'correction' },
63
+ { step: 6, type: 'correction' },
64
+ { step: 7, type: 'action' },
65
+ { step: 8, type: 'action' },
66
+ { step: 9, type: 'action' },
67
+ { step: 10, type: 'action' },
68
+ ];
69
+ const result = scorer.score(makeTrajectory({ steps }));
70
+ assert.equal(result.correctionBonus, 3 * 10); // 3 capped corrections x 10
71
+ });
72
+
73
+ it('derives coordination bonus from actual trajectory steps (not outcome)', () => {
74
+ const result = scorer.score(makeTrajectory({
75
+ steps: [
76
+ { step: 1, type: 'thought', token_count: 10 },
77
+ { step: 2, type: 'coordination', token_count: 5 },
78
+ { step: 3, type: 'coordination', token_count: 3 },
79
+ { step: 4, type: 'action', token_count: 8 },
80
+ { step: 5, type: 'action', token_count: 4 },
81
+ ],
82
+ }));
83
+ // 5 steps, 20% cap = 1, but 2 coordination steps → capped at 1 * 5 = 5
84
+ assert.equal(result.coordinationBonus, 5);
85
+ });
86
+
87
+ it('caps coordination steps at 20% of trajectory', () => {
88
+ // 10 steps, 4 are coordination — only 2 should count (20% of 10)
89
+ const steps = [
90
+ { step: 1, type: 'thought' },
91
+ { step: 2, type: 'coordination' },
92
+ { step: 3, type: 'coordination' },
93
+ { step: 4, type: 'coordination' },
94
+ { step: 5, type: 'coordination' },
95
+ { step: 6, type: 'action' },
96
+ { step: 7, type: 'action' },
97
+ { step: 8, type: 'action' },
98
+ { step: 9, type: 'action' },
99
+ { step: 10, type: 'action' },
100
+ ];
101
+ const result = scorer.score(makeTrajectory({ steps }));
102
+ assert.equal(result.coordinationBonus, 2 * 5); // 2 capped coordination x 5
103
+ });
104
+
105
+ it('derives error recovery from actual error and resolution steps', () => {
106
+ const result = scorer.score(makeTrajectory({
107
+ steps: [
108
+ { step: 1, type: 'error', token_count: 5 },
109
+ { step: 2, type: 'resolution', token_count: 10 },
110
+ ],
111
+ }));
112
+ assert.equal(result.errorRecoveryBonus, 3);
113
+ });
114
+
115
+ it('error recovery: can not recover more than encountered', () => {
116
+ const result = scorer.score(makeTrajectory({
117
+ steps: [
118
+ { step: 1, type: 'error' },
119
+ { step: 2, type: 'resolution' },
120
+ { step: 3, type: 'resolution' },
121
+ { step: 4, type: 'resolution' },
122
+ ],
123
+ }));
124
+ // only 1 error, 3 resolutions → errorsRecovered = min(1,3) = 1
125
+ assert.equal(result.errorRecoveryBonus, 1 * 3);
126
+ });
127
+
128
+ it('no error recovery bonus when no resolution steps', () => {
129
+ const result = scorer.score(makeTrajectory({
130
+ steps: [{ step: 1, type: 'error', token_count: 5 }],
131
+ }));
132
+ assert.equal(result.errorRecoveryBonus, 0);
133
+ });
134
+
135
+ it('applies complexity bonus for heavy tasks', () => {
136
+ const result = scorer.score(makeTrajectory({
137
+ metadata: { task_complexity: 'heavy' },
138
+ }));
139
+ assert.equal(result.basePoints, 3);
140
+ assert.equal(result.complexityBonus, 3);
141
+ });
142
+
143
+ it('no complexity bonus for medium tasks', () => {
144
+ const result = scorer.score(makeTrajectory({
145
+ metadata: { task_complexity: 'medium' },
146
+ }));
147
+ assert.equal(result.complexityBonus, 0);
148
+ });
149
+
150
+ it('client-provided session_quality is ignored (quality is server-derived)', () => {
151
+ // Without resolution steps, quality bonus should be 0 regardless of metadata
152
+ const result = scorer.score(makeTrajectory({
153
+ metadata: { session_quality: 100 },
154
+ }));
155
+ assert.equal(result.qualityBonus, 0);
156
+ });
157
+
158
+ it('quality bonus applies when trajectory has resolution and reasonable length', () => {
159
+ const steps = Array.from({ length: 10 }, (_, i) => ({ step: i, type: 'thought' }));
160
+ steps.push({ step: 10, type: 'resolution' });
161
+ const result = scorer.score(makeTrajectory({ steps }));
162
+ assert.ok(result.qualityBonus > 0);
163
+ });
164
+
165
+ it('quality bonus is 0 when trajectory has no resolution', () => {
166
+ const steps = Array.from({ length: 10 }, (_, i) => ({ step: i, type: 'thought' }));
167
+ const result = scorer.score(makeTrajectory({ steps }));
168
+ assert.equal(result.qualityBonus, 0);
169
+ });
170
+
171
+ it('quality bonus is 0 when trajectory is too short (< 5 steps)', () => {
172
+ const result = scorer.score(makeTrajectory({
173
+ steps: [
174
+ { step: 1, type: 'thought' },
175
+ { step: 2, type: 'resolution' },
176
+ ],
177
+ }));
178
+ assert.equal(result.qualityBonus, 0);
179
+ });
180
+
181
+ it('stacks all multipliers correctly (server-derived)', () => {
182
+ const steps = [
183
+ { step: 1, type: 'thought' },
184
+ { step: 2, type: 'correction' },
185
+ { step: 3, type: 'coordination' },
186
+ { step: 4, type: 'error' },
187
+ { step: 5, type: 'resolution' },
188
+ { step: 6, type: 'action' },
189
+ { step: 7, type: 'action' },
190
+ { step: 8, type: 'action' },
191
+ { step: 9, type: 'action' },
192
+ { step: 10, type: 'action' },
193
+ ];
194
+ const result = scorer.score(makeTrajectory({
195
+ steps,
196
+ metadata: { model_engine: 'claude-opus-4-6', task_complexity: 'heavy' },
197
+ }));
198
+
199
+ assert.equal(result.basePoints, 10);
200
+ assert.equal(result.modelMultiplier, 5);
201
+ // 1 correction out of 10 steps, max 3 → 1 * 10 = 10
202
+ assert.equal(result.correctionBonus, 10);
203
+ // 1 coordination out of 10 steps, max 2 → 1 * 5 = 5
204
+ assert.equal(result.coordinationBonus, 5);
205
+ // 1 error, 1 resolution → 1 recovered * 3 = 3
206
+ assert.equal(result.errorRecoveryBonus, 3);
207
+ // heavy task: basePoints * 1 = 10
208
+ assert.equal(result.complexityBonus, 10);
209
+
210
+ const subtotal = (10 * 5) + 10 + 5 + 3 + 10; // 78
211
+ // has resolution + length >= 5 → quality = floor(78 * 0.1) = 7
212
+ assert.equal(result.qualityBonus, Math.floor(subtotal * 0.1));
213
+ assert.equal(result.totalPoints, subtotal + result.qualityBonus);
214
+ });
215
+
216
+ it('ignores outcome.user_interventions — score derives from step count only', () => {
217
+ const result = scorer.score({
218
+ trajectory_log: [
219
+ { step: 1, type: 'thought', token_count: 10 },
220
+ ],
221
+ metadata: { model_engine: 'claude-opus-4-6' },
222
+ outcome: { user_interventions: 1_000_000 },
223
+ });
224
+ assert.equal(result.basePoints, 1);
225
+ assert.equal(result.modelMultiplier, 5);
226
+ assert.equal(result.totalPoints, 5);
227
+ assert.ok(result.totalPoints < 100, 'score should be small, NOT derived from user_interventions');
228
+ });
229
+
230
+ it('ignores outcome entirely for multiplier calculations', () => {
231
+ const withOutcome = scorer.score({
232
+ trajectory_log: [{ step: 1, type: 'thought' }],
233
+ metadata: {},
234
+ outcome: { errors_encountered: 999, errors_recovered: 999, coordination_events: 999 },
235
+ });
236
+ const withoutOutcome = scorer.score({
237
+ trajectory_log: [{ step: 1, type: 'thought' }],
238
+ metadata: {},
239
+ });
240
+ assert.equal(withOutcome.totalPoints, withoutOutcome.totalPoints);
241
+ });
242
+ });
@@ -0,0 +1,125 @@
1
+ // FSL-1.1-Apache-2.0 — see LICENSE
2
+
3
+ import { describe, it, beforeEach, afterEach } from 'node:test';
4
+ import assert from 'node:assert/strict';
5
+ import { mkdtempSync, rmSync } from 'node:fs';
6
+ import { join } from 'node:path';
7
+ import { tmpdir } from 'node:os';
8
+ import { generateECDHKeypair } from '../../shared/crypto.js';
9
+ import { SessionRegistry } from '../../server/session-registry.js';
10
+
11
+ describe('SessionRegistry', () => {
12
+ let registry;
13
+ let tmpDir;
14
+
15
+ beforeEach(() => {
16
+ tmpDir = mkdtempSync(join(tmpdir(), 'sess-test-'));
17
+ registry = new SessionRegistry(join(tmpDir, 'sessions.db'));
18
+ });
19
+
20
+ afterEach(() => {
21
+ registry.close();
22
+ rmSync(tmpDir, { recursive: true, force: true });
23
+ });
24
+
25
+ it('opens a session and returns server public key', () => {
26
+ const clientKeypair = generateECDHKeypair();
27
+ const result = registry.openSession(
28
+ 'sess_001', clientKeypair.publicKey, 'claude-code', 'claude-opus-4-6',
29
+ 'fp_abc123', 'hash_xyz', '0.27.77'
30
+ );
31
+ assert.ok(result.serverPublicKey);
32
+ assert.equal(typeof result.serverPublicKey, 'string');
33
+ assert.ok(result.serverPublicKey.length > 10);
34
+ });
35
+
36
+ it('gets a session with all fields stored', () => {
37
+ const clientKeypair = generateECDHKeypair();
38
+ registry.openSession(
39
+ 'sess_002', clientKeypair.publicKey, 'codex', 'o3',
40
+ 'fp_def456', 'hash_abc', '0.27.77'
41
+ );
42
+
43
+ const session = registry.getSession('sess_002');
44
+ assert.ok(session);
45
+ assert.equal(session.session_id, 'sess_002');
46
+ assert.equal(session.provider, 'codex');
47
+ assert.equal(session.model, 'o3');
48
+ assert.equal(session.machine_fingerprint, 'fp_def456');
49
+ assert.equal(session.app_version_hash, 'hash_abc');
50
+ assert.equal(session.groove_version, '0.27.77');
51
+ assert.equal(session.status, 'active');
52
+ assert.equal(session.expected_sequence, 0);
53
+ assert.ok(session.server_public_key);
54
+ assert.ok(session.server_private_key);
55
+ assert.ok(session.shared_secret);
56
+ assert.ok(session.created_at);
57
+ });
58
+
59
+ it('returns null for unknown session', () => {
60
+ assert.equal(registry.getSession('nonexistent'), null);
61
+ });
62
+
63
+ it('increments sequence atomically and monotonically', () => {
64
+ const clientKeypair = generateECDHKeypair();
65
+ registry.openSession(
66
+ 'sess_003', clientKeypair.publicKey, 'claude-code', 'claude-opus-4-6',
67
+ 'fp_seq', 'hash_seq', '0.27.77'
68
+ );
69
+
70
+ const seq1 = registry.incrementSequence('sess_003');
71
+ assert.equal(seq1, 1);
72
+
73
+ const seq2 = registry.incrementSequence('sess_003');
74
+ assert.equal(seq2, 2);
75
+
76
+ const seq3 = registry.incrementSequence('sess_003');
77
+ assert.equal(seq3, 3);
78
+
79
+ const session = registry.getSession('sess_003');
80
+ assert.equal(session.expected_sequence, 3);
81
+ });
82
+
83
+ it('closes a session with status and timestamp', () => {
84
+ const clientKeypair = generateECDHKeypair();
85
+ registry.openSession(
86
+ 'sess_004', clientKeypair.publicKey, 'gemini', 'gemini-2.5-pro',
87
+ 'fp_close', 'hash_close', '0.27.77'
88
+ );
89
+
90
+ registry.closeSession('sess_004');
91
+ const session = registry.getSession('sess_004');
92
+ assert.equal(session.status, 'closed');
93
+ assert.ok(session.closed_at);
94
+ });
95
+
96
+ it('rate limits at 20 sessions per fingerprint per hour', () => {
97
+ const clientKeypair = generateECDHKeypair();
98
+ const fp = 'fp_ratelimit';
99
+
100
+ for (let i = 0; i < 20; i++) {
101
+ const result = registry.openSession(
102
+ `sess_rl_${i}`, clientKeypair.publicKey, 'claude-code', 'claude-opus-4-6',
103
+ fp, 'hash_rl', '0.27.77'
104
+ );
105
+ assert.ok(result.serverPublicKey, `session ${i} should succeed`);
106
+ }
107
+
108
+ const result = registry.openSession(
109
+ 'sess_rl_21', clientKeypair.publicKey, 'claude-code', 'claude-opus-4-6',
110
+ fp, 'hash_rl', '0.27.77'
111
+ );
112
+ assert.equal(result.rateLimited, true);
113
+ });
114
+
115
+ it('returns active sessions', () => {
116
+ const clientKeypair = generateECDHKeypair();
117
+ registry.openSession('sess_a1', clientKeypair.publicKey, 'claude-code', 'claude-opus-4-6', 'fp1', 'h1', '0.27.77');
118
+ registry.openSession('sess_a2', clientKeypair.publicKey, 'codex', 'o3', 'fp2', 'h2', '0.27.77');
119
+ registry.closeSession('sess_a1');
120
+
121
+ const active = registry.getActiveSessions();
122
+ assert.equal(active.length, 1);
123
+ assert.equal(active[0].session_id, 'sess_a2');
124
+ });
125
+ });
@@ -0,0 +1,157 @@
1
+ // FSL-1.1-Apache-2.0 — see LICENSE
2
+
3
+ import { describe, it, beforeEach, afterEach } from 'node:test';
4
+ import assert from 'node:assert/strict';
5
+ import { mkdtempSync, rmSync } from 'node:fs';
6
+ import { join } from 'node:path';
7
+ import { tmpdir } from 'node:os';
8
+ import { EnvelopeStorage } from '../../server/storage.js';
9
+ import { TrajectoryStitcher } from '../../server/stitcher.js';
10
+
11
+ describe('TrajectoryStitcher', () => {
12
+ let storage;
13
+ let stitcher;
14
+ let tmpDir;
15
+
16
+ beforeEach(() => {
17
+ tmpDir = mkdtempSync(join(tmpdir(), 'stitch-test-'));
18
+ storage = new EnvelopeStorage(join(tmpDir, 'envelopes'));
19
+ stitcher = new TrajectoryStitcher(storage);
20
+ });
21
+
22
+ afterEach(() => {
23
+ rmSync(tmpDir, { recursive: true, force: true });
24
+ });
25
+
26
+ it('stitches 3 chunks into correct order', () => {
27
+ const sessionId = 'sess_stitch_001';
28
+
29
+ storage.store({
30
+ session_id: sessionId, chunk_sequence: 2, contributor_id: 'contrib_1',
31
+ metadata: { model_engine: 'claude-opus-4-6', provider: 'claude-code' },
32
+ trajectory_log: [
33
+ { step: 3, type: 'action', tool: 'Edit', token_count: 20 },
34
+ { step: 4, type: 'observation', content: 'done', token_count: 5 },
35
+ ],
36
+ });
37
+ storage.store({
38
+ session_id: sessionId, chunk_sequence: 0, contributor_id: 'contrib_1',
39
+ metadata: { model_engine: 'claude-opus-4-6', provider: 'claude-code' },
40
+ trajectory_log: [
41
+ { step: 1, type: 'thought', content: 'plan', token_count: 10 },
42
+ ],
43
+ });
44
+ storage.store({
45
+ session_id: sessionId, chunk_sequence: 1, contributor_id: 'contrib_1',
46
+ metadata: { model_engine: 'claude-opus-4-6', provider: 'claude-code' },
47
+ trajectory_log: [
48
+ { step: 2, type: 'action', tool: 'Grep', token_count: 15 },
49
+ ],
50
+ });
51
+
52
+ const result = stitcher.stitch(sessionId);
53
+
54
+ assert.ok(result);
55
+ assert.equal(result.session_id, sessionId);
56
+ assert.equal(result.total_steps, 4);
57
+ assert.equal(result.total_chunks, 3);
58
+ assert.deepEqual(result.trajectory_log.map(s => s.step), [1, 2, 3, 4]);
59
+ });
60
+
61
+ it('has all steps present and ordered by step number', () => {
62
+ const sessionId = 'sess_stitch_002';
63
+
64
+ storage.store({
65
+ session_id: sessionId, chunk_sequence: 0, contributor_id: 'c1',
66
+ metadata: {},
67
+ trajectory_log: [
68
+ { step: 1, type: 'thought', token_count: 5 },
69
+ { step: 2, type: 'action', tool: 'Read', token_count: 3 },
70
+ ],
71
+ });
72
+ storage.store({
73
+ session_id: sessionId, chunk_sequence: 1, contributor_id: 'c1',
74
+ metadata: {},
75
+ trajectory_log: [
76
+ { step: 3, type: 'observation', token_count: 8 },
77
+ ],
78
+ });
79
+
80
+ const result = stitcher.stitch(sessionId);
81
+ assert.equal(result.total_steps, 3);
82
+ assert.equal(result.total_tokens, 16);
83
+
84
+ for (let i = 0; i < result.trajectory_log.length - 1; i++) {
85
+ assert.ok(result.trajectory_log[i].step < result.trajectory_log[i + 1].step);
86
+ }
87
+ });
88
+
89
+ it('computes step_type_distribution correctly', () => {
90
+ const sessionId = 'sess_stitch_003';
91
+
92
+ storage.store({
93
+ session_id: sessionId, chunk_sequence: 0, contributor_id: 'c1',
94
+ metadata: {},
95
+ trajectory_log: [
96
+ { step: 1, type: 'thought', token_count: 5 },
97
+ { step: 2, type: 'action', tool: 'Read', token_count: 3 },
98
+ { step: 3, type: 'action', tool: 'Edit', token_count: 4 },
99
+ { step: 4, type: 'observation', token_count: 2 },
100
+ { step: 5, type: 'error', token_count: 1 },
101
+ ],
102
+ });
103
+
104
+ const result = stitcher.stitch(sessionId);
105
+ assert.deepEqual(result.step_type_distribution, {
106
+ thought: 1,
107
+ action: 2,
108
+ observation: 1,
109
+ error: 1,
110
+ });
111
+ assert.deepEqual(result.unique_tools_used.sort(), ['Edit', 'Read']);
112
+ });
113
+
114
+ it('returns null for unknown session', () => {
115
+ const result = stitcher.stitch('sess_nonexistent');
116
+ assert.equal(result, null);
117
+ });
118
+
119
+ it('includes outcome from SESSION_CLOSE envelope', () => {
120
+ const sessionId = 'sess_stitch_004';
121
+
122
+ storage.store({
123
+ session_id: sessionId, chunk_sequence: 0, contributor_id: 'c1',
124
+ metadata: {},
125
+ trajectory_log: [{ step: 1, type: 'thought', token_count: 5 }],
126
+ });
127
+ storage.store({
128
+ session_id: sessionId, type: 'SESSION_CLOSE',
129
+ outcome: { status: 'SUCCESS', total_steps: 1, user_interventions: 0 },
130
+ });
131
+
132
+ const result = stitcher.stitch(sessionId);
133
+ assert.ok(result.outcome);
134
+ assert.equal(result.outcome.status, 'SUCCESS');
135
+ });
136
+
137
+ it('links coordination steps', () => {
138
+ const sessionId = 'sess_stitch_005';
139
+
140
+ storage.store({
141
+ session_id: sessionId, chunk_sequence: 0, contributor_id: 'c1',
142
+ metadata: {},
143
+ trajectory_log: [
144
+ { step: 1, type: 'coordination', coordination_id: 'coord_1', direction: 'outbound', target_agent: 'backend-1', token_count: 5 },
145
+ { step: 2, type: 'thought', token_count: 3 },
146
+ ],
147
+ });
148
+
149
+ const result = stitcher.stitch(sessionId);
150
+ const enriched = stitcher.linkCoordination(result);
151
+
152
+ const coordStep = enriched.trajectory_log.find(s => s.type === 'coordination');
153
+ assert.ok(coordStep.coordination_partner);
154
+ assert.equal(coordStep.coordination_partner.coordination_id, 'coord_1');
155
+ assert.equal(coordStep.coordination_partner.linked, true);
156
+ });
157
+ });