@far-world-labs/verblets 0.2.0 → 0.3.2

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 (330) hide show
  1. package/README.md +86 -213
  2. package/dist/index.browser.js +74 -0
  3. package/dist/index.js +548 -0
  4. package/dist/shared-C6kPWghF.js +7806 -0
  5. package/package.json +32 -11
  6. package/.cursor/launch.json +0 -30
  7. package/.cursor/settings.json +0 -20
  8. package/.github/workflows/branch-protection.yml +0 -22
  9. package/.github/workflows/ci.yml +0 -165
  10. package/.husky/pre-commit +0 -4
  11. package/.prettierrc +0 -6
  12. package/.release-it.json +0 -12
  13. package/.vitest.config.examples.js +0 -12
  14. package/.vitest.config.js +0 -8
  15. package/.vscode/launch.json +0 -31
  16. package/AGENTS.md +0 -220
  17. package/DEVELOPING.md +0 -105
  18. package/docker-compose.yml +0 -7
  19. package/eslint.config.js +0 -80
  20. package/scripts/clear-redis.js +0 -74
  21. package/scripts/generate-chain/index.js +0 -111
  22. package/scripts/generate-lib/index.js +0 -68
  23. package/scripts/generate-test/index.js +0 -137
  24. package/scripts/generate-verblet/README.md +0 -17
  25. package/scripts/generate-verblet/index.js +0 -110
  26. package/scripts/run.sh +0 -15
  27. package/scripts/runner/index.js +0 -56
  28. package/scripts/simple-editor/README.md +0 -34
  29. package/scripts/simple-editor/index.js +0 -79
  30. package/scripts/summarize-files/index.js +0 -70
  31. package/src/chains/README.md +0 -30
  32. package/src/chains/anonymize/README.md +0 -21
  33. package/src/chains/anonymize/index.examples.js +0 -75
  34. package/src/chains/anonymize/index.js +0 -121
  35. package/src/chains/anonymize/index.spec.js +0 -78
  36. package/src/chains/bulk-central-tendency/index.examples.js +0 -138
  37. package/src/chains/bulk-central-tendency/index.js +0 -91
  38. package/src/chains/bulk-filter/README.md +0 -21
  39. package/src/chains/bulk-filter/index.examples.js +0 -22
  40. package/src/chains/bulk-filter/index.js +0 -58
  41. package/src/chains/bulk-filter/index.spec.js +0 -38
  42. package/src/chains/bulk-find/README.md +0 -16
  43. package/src/chains/bulk-find/index.examples.js +0 -20
  44. package/src/chains/bulk-find/index.js +0 -30
  45. package/src/chains/bulk-find/index.spec.js +0 -26
  46. package/src/chains/bulk-group/README.md +0 -23
  47. package/src/chains/bulk-group/index.examples.js +0 -18
  48. package/src/chains/bulk-group/index.js +0 -34
  49. package/src/chains/bulk-group/index.spec.js +0 -41
  50. package/src/chains/bulk-map/README.md +0 -43
  51. package/src/chains/bulk-map/index.examples.js +0 -17
  52. package/src/chains/bulk-map/index.js +0 -86
  53. package/src/chains/bulk-map/index.spec.js +0 -44
  54. package/src/chains/bulk-reduce/README.md +0 -12
  55. package/src/chains/bulk-reduce/index.examples.js +0 -15
  56. package/src/chains/bulk-reduce/index.js +0 -13
  57. package/src/chains/bulk-reduce/index.spec.js +0 -25
  58. package/src/chains/bulk-score/README.md +0 -16
  59. package/src/chains/bulk-score/bulk-score-result.json +0 -18
  60. package/src/chains/bulk-score/index.examples.js +0 -22
  61. package/src/chains/bulk-score/index.js +0 -133
  62. package/src/chains/bulk-score/index.spec.js +0 -30
  63. package/src/chains/category-samples/README.md +0 -61
  64. package/src/chains/category-samples/index.examples.js +0 -103
  65. package/src/chains/category-samples/index.js +0 -134
  66. package/src/chains/collect-terms/README.md +0 -12
  67. package/src/chains/collect-terms/index.examples.js +0 -16
  68. package/src/chains/collect-terms/index.js +0 -44
  69. package/src/chains/collect-terms/index.spec.js +0 -25
  70. package/src/chains/conversation/README.md +0 -26
  71. package/src/chains/conversation/index.examples.js +0 -398
  72. package/src/chains/conversation/index.js +0 -126
  73. package/src/chains/conversation/index.spec.js +0 -148
  74. package/src/chains/conversation/turn-policies.js +0 -93
  75. package/src/chains/conversation/turn-policies.md +0 -123
  76. package/src/chains/conversation/turn-policies.spec.js +0 -135
  77. package/src/chains/date/README.md +0 -12
  78. package/src/chains/date/index.examples.js +0 -47
  79. package/src/chains/date/index.js +0 -74
  80. package/src/chains/date/index.spec.js +0 -62
  81. package/src/chains/disambiguate/README.md +0 -22
  82. package/src/chains/disambiguate/disambiguate-meanings-result.json +0 -16
  83. package/src/chains/disambiguate/index.examples.js +0 -18
  84. package/src/chains/disambiguate/index.js +0 -92
  85. package/src/chains/disambiguate/index.spec.js +0 -25
  86. package/src/chains/dismantle/README.md +0 -67
  87. package/src/chains/dismantle/dismantle.examples.js +0 -27
  88. package/src/chains/dismantle/index.examples.js +0 -30
  89. package/src/chains/dismantle/index.js +0 -303
  90. package/src/chains/dismantle/index.spec.js +0 -32
  91. package/src/chains/expect/README.md +0 -171
  92. package/src/chains/expect/index.examples.js +0 -146
  93. package/src/chains/expect/index.js +0 -207
  94. package/src/chains/expect/index.spec.js +0 -324
  95. package/src/chains/filter-ambiguous/README.md +0 -11
  96. package/src/chains/filter-ambiguous/index.examples.js +0 -20
  97. package/src/chains/filter-ambiguous/index.js +0 -49
  98. package/src/chains/filter-ambiguous/index.spec.js +0 -31
  99. package/src/chains/glossary/README.md +0 -19
  100. package/src/chains/glossary/index.examples.js +0 -386
  101. package/src/chains/glossary/index.js +0 -75
  102. package/src/chains/glossary/index.spec.js +0 -19
  103. package/src/chains/intersections/README.md +0 -166
  104. package/src/chains/intersections/index.examples.js +0 -280
  105. package/src/chains/intersections/index.js +0 -218
  106. package/src/chains/intersections/intersection-result.json +0 -38
  107. package/src/chains/list/index.examples.js +0 -68
  108. package/src/chains/list/index.js +0 -214
  109. package/src/chains/list/index.spec.js +0 -67
  110. package/src/chains/list/list-result.json +0 -16
  111. package/src/chains/list/schema.json +0 -24
  112. package/src/chains/llm-logger/README.md +0 -366
  113. package/src/chains/llm-logger/index.js +0 -591
  114. package/src/chains/llm-logger/index.spec.js +0 -391
  115. package/src/chains/llm-logger/schema.json +0 -105
  116. package/src/chains/questions/index.examples.js +0 -69
  117. package/src/chains/questions/index.js +0 -135
  118. package/src/chains/questions/index.spec.js +0 -29
  119. package/src/chains/scan-js/index.js +0 -116
  120. package/src/chains/set-interval/README.md +0 -81
  121. package/src/chains/set-interval/index.examples.js +0 -64
  122. package/src/chains/set-interval/index.js +0 -152
  123. package/src/chains/set-interval/index.spec.js +0 -70
  124. package/src/chains/socratic/README.md +0 -17
  125. package/src/chains/socratic/index.js +0 -64
  126. package/src/chains/socratic/index.spec.js +0 -24
  127. package/src/chains/sort/index.examples.js +0 -36
  128. package/src/chains/sort/index.js +0 -163
  129. package/src/chains/sort/index.spec.js +0 -112
  130. package/src/chains/sort/sort-result.json +0 -16
  131. package/src/chains/summary-map/README.md +0 -41
  132. package/src/chains/summary-map/index.examples.js +0 -64
  133. package/src/chains/summary-map/index.js +0 -226
  134. package/src/chains/summary-map/index.spec.js +0 -153
  135. package/src/chains/test/index.js +0 -114
  136. package/src/chains/test-advice/index.js +0 -35
  137. package/src/chains/themes/README.md +0 -20
  138. package/src/chains/themes/index.examples.js +0 -17
  139. package/src/chains/themes/index.js +0 -28
  140. package/src/chains/themes/index.spec.js +0 -19
  141. package/src/chains/veiled-variants/index.examples.js +0 -18
  142. package/src/chains/veiled-variants/index.js +0 -107
  143. package/src/chains/veiled-variants/index.spec.js +0 -40
  144. package/src/constants/common.js +0 -13
  145. package/src/constants/messages.js +0 -3
  146. package/src/constants/models.js +0 -184
  147. package/src/index.js +0 -203
  148. package/src/json-schemas/README.md +0 -13
  149. package/src/json-schemas/cars-test.json +0 -11
  150. package/src/json-schemas/index.js +0 -12
  151. package/src/json-schemas/intent.json +0 -38
  152. package/src/json-schemas/schema-dot-org-photograph.json +0 -133
  153. package/src/json-schemas/schema-dot-org-place.json +0 -129
  154. package/src/lib/README.md +0 -26
  155. package/src/lib/any-signal/index.js +0 -28
  156. package/src/lib/assert/README.md +0 -84
  157. package/src/lib/assert/index.js +0 -50
  158. package/src/lib/bulk-filter/README.md +0 -22
  159. package/src/lib/bulk-filter/index.examples.js +0 -27
  160. package/src/lib/bulk-filter/index.js +0 -63
  161. package/src/lib/bulk-filter/index.spec.js +0 -38
  162. package/src/lib/bulk-find/README.md +0 -18
  163. package/src/lib/bulk-find/index.examples.js +0 -19
  164. package/src/lib/bulk-find/index.js +0 -30
  165. package/src/lib/bulk-find/index.spec.js +0 -41
  166. package/src/lib/chatgpt/index.js +0 -163
  167. package/src/lib/combinations/index.js +0 -30
  168. package/src/lib/combinations/index.spec.js +0 -23
  169. package/src/lib/editor/index.js +0 -31
  170. package/src/lib/functional/index.js +0 -28
  171. package/src/lib/logger-service/index.js +0 -32
  172. package/src/lib/parse-js-parts/index.js +0 -321
  173. package/src/lib/parse-js-parts/index.spec.js +0 -156
  174. package/src/lib/parse-llm-list/README.md +0 -39
  175. package/src/lib/parse-llm-list/index.js +0 -54
  176. package/src/lib/parse-llm-list/index.spec.js +0 -59
  177. package/src/lib/path-aliases/index.js +0 -37
  178. package/src/lib/path-aliases/index.spec.js +0 -64
  179. package/src/lib/pave/index.js +0 -34
  180. package/src/lib/pave/index.spec.js +0 -76
  181. package/src/lib/prompt-cache/index.js +0 -50
  182. package/src/lib/retry/index.js +0 -66
  183. package/src/lib/retry/index.spec.js +0 -86
  184. package/src/lib/ring-buffer/README.md +0 -82
  185. package/src/lib/ring-buffer/index.js +0 -235
  186. package/src/lib/ring-buffer/index.spec.js +0 -388
  187. package/src/lib/search-best-first/city-walk.spec.js +0 -37
  188. package/src/lib/search-best-first/index.js +0 -97
  189. package/src/lib/search-best-first/index.spec.js +0 -35
  190. package/src/lib/search-js-files/code-features-property-definitions.json +0 -123
  191. package/src/lib/search-js-files/index.examples.js +0 -22
  192. package/src/lib/search-js-files/index.js +0 -155
  193. package/src/lib/search-js-files/index.spec.js +0 -34
  194. package/src/lib/search-js-files/scan-file.js +0 -242
  195. package/src/lib/shorten-text/index.js +0 -25
  196. package/src/lib/shorten-text/index.spec.js +0 -68
  197. package/src/lib/strip-numeric/index.js +0 -5
  198. package/src/lib/strip-response/index.js +0 -30
  199. package/src/lib/template-replace/index.js +0 -23
  200. package/src/lib/template-replace/index.spec.js +0 -60
  201. package/src/lib/timed-abort-controller/index.js +0 -41
  202. package/src/lib/to-bool/index.js +0 -8
  203. package/src/lib/to-date/index.js +0 -11
  204. package/src/lib/to-enum/index.js +0 -14
  205. package/src/lib/to-number/index.js +0 -12
  206. package/src/lib/to-number-with-units/index.js +0 -51
  207. package/src/lib/transcribe/index.js +0 -78
  208. package/src/prompts/README.md +0 -17
  209. package/src/prompts/as-enum.js +0 -5
  210. package/src/prompts/as-json-schema.js +0 -9
  211. package/src/prompts/as-object-with-schema.js +0 -26
  212. package/src/prompts/as-schema-org-text.js +0 -25
  213. package/src/prompts/as-schema-org-type.js +0 -1
  214. package/src/prompts/blog-post.js +0 -7
  215. package/src/prompts/code-features.js +0 -24
  216. package/src/prompts/constants.js +0 -101
  217. package/src/prompts/features-json-schema.js +0 -27
  218. package/src/prompts/generate-collection.js +0 -26
  219. package/src/prompts/generate-list.js +0 -48
  220. package/src/prompts/generate-questions.js +0 -19
  221. package/src/prompts/index.js +0 -20
  222. package/src/prompts/intent.js +0 -60
  223. package/src/prompts/output-succinct-names.js +0 -3
  224. package/src/prompts/select-from-threshold.js +0 -17
  225. package/src/prompts/sort.js +0 -31
  226. package/src/prompts/style.js +0 -38
  227. package/src/prompts/summarize.js +0 -13
  228. package/src/prompts/token-budget.js +0 -3
  229. package/src/prompts/wrap-list.js +0 -11
  230. package/src/prompts/wrap-variable.js +0 -36
  231. package/src/services/llm-model/global-overrides.spec.js +0 -432
  232. package/src/services/llm-model/index.js +0 -308
  233. package/src/services/llm-model/model.js +0 -21
  234. package/src/services/llm-model/negotiate.spec.js +0 -447
  235. package/src/services/redis/index.js +0 -147
  236. package/src/test/setup.js +0 -20
  237. package/src/verblets/README.md +0 -26
  238. package/src/verblets/auto/index.examples.js +0 -31
  239. package/src/verblets/auto/index.js +0 -28
  240. package/src/verblets/auto/index.spec.js +0 -32
  241. package/src/verblets/bool/README.md +0 -36
  242. package/src/verblets/bool/index.examples.js +0 -80
  243. package/src/verblets/bool/index.js +0 -25
  244. package/src/verblets/bool/index.schema.json +0 -14
  245. package/src/verblets/bool/index.spec.js +0 -33
  246. package/src/verblets/central-tendency/README.md +0 -166
  247. package/src/verblets/central-tendency/central-tendency-result.json +0 -24
  248. package/src/verblets/central-tendency/index.examples.js +0 -196
  249. package/src/verblets/central-tendency/index.js +0 -171
  250. package/src/verblets/central-tendency/index.spec.js +0 -148
  251. package/src/verblets/conversation-turn/README.md +0 -33
  252. package/src/verblets/conversation-turn/index.examples.js +0 -218
  253. package/src/verblets/conversation-turn/index.js +0 -68
  254. package/src/verblets/conversation-turn/index.spec.js +0 -77
  255. package/src/verblets/conversation-turn-multi/README.md +0 -31
  256. package/src/verblets/conversation-turn-multi/index.examples.js +0 -160
  257. package/src/verblets/conversation-turn-multi/index.js +0 -104
  258. package/src/verblets/conversation-turn-multi/index.spec.js +0 -63
  259. package/src/verblets/enum/index.examples.js +0 -30
  260. package/src/verblets/enum/index.js +0 -18
  261. package/src/verblets/enum/index.spec.js +0 -35
  262. package/src/verblets/expect/README.md +0 -64
  263. package/src/verblets/expect/index.examples.js +0 -109
  264. package/src/verblets/expect/index.js +0 -75
  265. package/src/verblets/expect/index.spec.js +0 -127
  266. package/src/verblets/intent/index.examples.js +0 -139
  267. package/src/verblets/intent/index.js +0 -60
  268. package/src/verblets/intent/index.spec.js +0 -31
  269. package/src/verblets/intersection/README.md +0 -16
  270. package/src/verblets/intersection/index.examples.js +0 -89
  271. package/src/verblets/intersection/index.js +0 -125
  272. package/src/verblets/intersection/index.spec.js +0 -60
  273. package/src/verblets/intersection/intersection-result.json +0 -16
  274. package/src/verblets/list-expand/README.md +0 -10
  275. package/src/verblets/list-expand/index.examples.js +0 -14
  276. package/src/verblets/list-expand/index.js +0 -104
  277. package/src/verblets/list-expand/index.spec.js +0 -18
  278. package/src/verblets/list-expand/list-expand-result.json +0 -16
  279. package/src/verblets/list-filter/README.md +0 -22
  280. package/src/verblets/list-filter/index.examples.js +0 -26
  281. package/src/verblets/list-filter/index.js +0 -18
  282. package/src/verblets/list-filter/index.spec.js +0 -19
  283. package/src/verblets/list-find/README.md +0 -11
  284. package/src/verblets/list-find/index.examples.js +0 -15
  285. package/src/verblets/list-find/index.js +0 -17
  286. package/src/verblets/list-find/index.spec.js +0 -19
  287. package/src/verblets/list-group/README.md +0 -16
  288. package/src/verblets/list-group/index.examples.js +0 -16
  289. package/src/verblets/list-group/index.js +0 -112
  290. package/src/verblets/list-group/index.spec.js +0 -35
  291. package/src/verblets/list-group/list-group-result.json +0 -16
  292. package/src/verblets/list-map/README.md +0 -11
  293. package/src/verblets/list-map/index.examples.js +0 -15
  294. package/src/verblets/list-map/index.js +0 -26
  295. package/src/verblets/list-map/index.spec.js +0 -17
  296. package/src/verblets/list-reduce/README.md +0 -10
  297. package/src/verblets/list-reduce/index.examples.js +0 -14
  298. package/src/verblets/list-reduce/index.js +0 -21
  299. package/src/verblets/list-reduce/index.spec.js +0 -27
  300. package/src/verblets/list-reduce/index.spec.jsx +0 -27
  301. package/src/verblets/name/README.md +0 -15
  302. package/src/verblets/name/index.examples.js +0 -28
  303. package/src/verblets/name/index.js +0 -19
  304. package/src/verblets/name/index.spec.js +0 -33
  305. package/src/verblets/name-similar-to/README.md +0 -26
  306. package/src/verblets/name-similar-to/index.examples.js +0 -18
  307. package/src/verblets/name-similar-to/index.js +0 -20
  308. package/src/verblets/name-similar-to/index.spec.js +0 -13
  309. package/src/verblets/number/index.examples.js +0 -199
  310. package/src/verblets/number/index.js +0 -25
  311. package/src/verblets/number/index.spec.js +0 -33
  312. package/src/verblets/number-with-units/index.examples.js +0 -38
  313. package/src/verblets/number-with-units/index.js +0 -84
  314. package/src/verblets/number-with-units/index.spec.js +0 -46
  315. package/src/verblets/number-with-units/number-with-units-result.json +0 -23
  316. package/src/verblets/people-list/README.md +0 -28
  317. package/src/verblets/people-list/index.examples.js +0 -184
  318. package/src/verblets/people-list/index.js +0 -44
  319. package/src/verblets/people-list/index.spec.js +0 -49
  320. package/src/verblets/schema-org/index.examples.js +0 -51
  321. package/src/verblets/schema-org/index.js +0 -37
  322. package/src/verblets/schema-org/index.spec.js +0 -39
  323. package/src/verblets/sentiment/README.md +0 -10
  324. package/src/verblets/sentiment/index.examples.js +0 -20
  325. package/src/verblets/sentiment/index.js +0 -9
  326. package/src/verblets/sentiment/index.spec.js +0 -20
  327. package/src/verblets/to-object/README.md +0 -38
  328. package/src/verblets/to-object/index.examples.js +0 -29
  329. package/src/verblets/to-object/index.js +0 -131
  330. package/src/verblets/to-object/index.spec.js +0 -71
package/package.json CHANGED
@@ -1,25 +1,40 @@
1
1
  {
2
2
  "name": "@far-world-labs/verblets",
3
- "version": "0.2.0",
3
+ "version": "0.3.2",
4
4
  "description": "Verblets is a collection of tools for building LLM-powered applications.",
5
- "main": "src/index.js",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
6
7
  "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "node": "./dist/index.js",
11
+ "browser": "./dist/index.browser.js",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
7
18
  "repository": {
8
19
  "type": "git",
9
20
  "url": "git+https://github.com/Far-World-Labs/Verblets.git"
10
21
  },
11
22
  "scripts": {
23
+ "prepublishOnly": "npm run build",
12
24
  "start": "node scripts/runner/index.js",
13
25
  "dev": "nodemon --no-warnings scripts/runner/index.js",
14
26
  "editor": "node scripts/simple-editor/index.js",
15
27
  "--": "npm run script -- generate-verblet foo",
16
28
  "script": "./scripts/run.sh",
17
29
  "test": "vitest",
18
- "clear-test-cache": "node scripts/clear-redis.js",
19
- "examples:warn": "source .env && LLM_EXPECT_MODE=info EXAMPLES=true vitest --config .vitest.config.examples.js",
20
- "examples": "source .env && LLM_EXPECT_MODE=error EXAMPLES=true ENABLE_LONG_EXAMPLES=false vitest --config .vitest.config.examples.js",
21
- "examples:all": "source .env && LLM_EXPECT_MODE=error EXAMPLES=true ENABLE_LONG_EXAMPLES=true vitest --config .vitest.config.examples.js",
22
- "examples:fresh": "npm run clear-test-cache && npm run examples:all",
30
+ "test:browser": "vitest --config vitest.config.browser.js",
31
+ "examples": "source .env && USE_REDIS_CACHE=true node_modules/.bin/vitest --config vitest.config.examples.js",
32
+ "examples:browser": "source .env && USE_REDIS_CACHE=true vitest --config vitest.config.browser.examples.js",
33
+ "arch": "source .env && vitest --config vitest.config.arch.js",
34
+ "clear-cache": "node scripts/clear-redis.js",
35
+ "arch:debug": "source .env && ARCH_DEBUG=true vitest --config .vitest.config.arch.js --run",
36
+ "build": "vite build",
37
+ "build:watch": "vite build --watch",
23
38
  "lint": "eslint 'src/**/*.{js,jsx}'",
24
39
  "lint:fix": "eslint 'src/**/*.{js,jsx}' --fix",
25
40
  "check:deps": "npx npm-deprecated-check current",
@@ -46,26 +61,29 @@
46
61
  "change-case": "^4.1.2",
47
62
  "commander": "^11.0.0",
48
63
  "compromise": "^14.14.4",
49
- "dependency-tree": "^10.0.1",
50
64
  "dotenv": "^16.0.3",
65
+ "fast-xml-parser": "^5.2.5",
66
+ "glob": "^11.0.3",
51
67
  "gpt-tokenizer": "^2.1.2",
52
68
  "gpt4-tokenizer": "^1.3.0",
53
- "lodash": "^4.17.21",
54
69
  "mocha": "^10.2.0",
70
+ "natural": "^8.1.0",
55
71
  "node-fetch": "^3.3.0",
56
72
  "node-record-lpcm16": "^1.0.1",
73
+ "p-limit": "^6.2.0",
57
74
  "ramda": "^0.29.0",
58
75
  "redis": "^4.6.5",
59
76
  "uuid": "^9.0.0",
60
77
  "vitest": "^3.1.3",
61
- "whisper-node": "^1.1.1",
62
78
  "yargs": "^17.7.1"
63
79
  },
64
80
  "devDependencies": {
65
81
  "@eslint/js": "^9.28.0",
66
82
  "@stylistic/eslint-plugin": "^4.4.0",
67
- "@types/node": "^18.16.3",
83
+ "@types/node": "^20.19.0",
68
84
  "@vitest/ui": "^3.1.3",
85
+ "dependency-cruiser": "^16.10.3",
86
+ "dependency-tree": "^10.0.1",
69
87
  "eslint": "^9.28.0",
70
88
  "eslint-config-prettier": "^8.8.0",
71
89
  "eslint-plugin-import": "^2.31.0",
@@ -75,11 +93,14 @@
75
93
  "eslint-plugin-vitest": "^0.5.4",
76
94
  "husky": "^8.0.3",
77
95
  "install-peerdeps": "^3.0.3",
96
+ "jsdom": "^26.1.0",
78
97
  "lint-staged": "^13.2.2",
79
98
  "nodemon": "^3.1.10",
80
99
  "npm-deprecated-check": "^1.5.0",
81
100
  "prettier": "^2.8.8",
82
101
  "release-it": "^19.0.3",
102
+ "terminal-kit": "^3.1.2",
103
+ "vite": "^7.0.6",
83
104
  "why-is-node-running": "^2.2.2"
84
105
  },
85
106
  "lint-staged": {
@@ -1,30 +0,0 @@
1
- {
2
- "version": "0.2.0",
3
- "configurations": [
4
- {
5
- "type": "node",
6
- "request": "launch",
7
- "name": "Run Regular Tests",
8
- "autoAttachChildProcesses": true,
9
- "skipFiles": ["<node_internals>/**"],
10
- "program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
11
- "args": ["run", "--config", ".vitest.config.js"],
12
- "smartStep": true,
13
- "console": "integratedTerminal"
14
- },
15
- {
16
- "type": "node",
17
- "request": "launch",
18
- "name": "Run Example Tests",
19
- "autoAttachChildProcesses": true,
20
- "skipFiles": ["<node_internals>/**"],
21
- "program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
22
- "args": ["run", "--config", ".vitest.config.examples.js"],
23
- "env": {
24
- "EXAMPLES": "true"
25
- },
26
- "smartStep": true,
27
- "console": "integratedTerminal"
28
- }
29
- ]
30
- }
@@ -1,20 +0,0 @@
1
- {
2
- "vitest.enable": true,
3
- "vitest.configPath": ".vitest.config.examples.js",
4
- "vitest.env": {
5
- "EXAMPLES": "true"
6
- },
7
- "testExplorer": {
8
- "showOnRun": true,
9
- "showOutputOnFailure": true,
10
- "configPath": ".vitest.config.examples.js"
11
- },
12
- "vitest.testExplorer": {
13
- "showOutputOnFailure": true,
14
- "showOutputOnRun": true,
15
- "configPath": ".vitest.config.examples.js"
16
- },
17
- "vitest.testFiles": ["**/*.examples.js"],
18
- "vitest.include": ["src/**/*.examples.js"],
19
- "vitest.commandLine": "vitest --config .vitest.config.examples.js"
20
- }
@@ -1,22 +0,0 @@
1
- name: Branch Protection
2
-
3
- on:
4
- pull_request:
5
- types: [opened, synchronize, reopened]
6
-
7
- jobs:
8
- # Simple gate that waits for essential checks
9
- merge-gate:
10
- name: 🚪 Merge Gate
11
- runs-on: ubuntu-latest
12
- if: github.event_name == 'pull_request'
13
- steps:
14
- - name: Wait for essential checks
15
- run: |
16
- echo "This job serves as a merge gate."
17
- echo "Configure branch protection rules in GitHub to require:"
18
- echo "- 🔍 Lint Code"
19
- echo "- At least one 🧪 Test on Node job"
20
- echo "- This 🚪 Merge Gate job"
21
- echo ""
22
- echo "✅ Merge gate check passed"
@@ -1,165 +0,0 @@
1
- name: CI/CD Pipeline
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- pull_request:
8
- branches:
9
- - main
10
-
11
- env:
12
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
13
-
14
- jobs:
15
- get-lts-versions:
16
- name: 🧱 Get LTS Node Versions
17
- runs-on: ubuntu-latest
18
- outputs:
19
- matrix: ${{ steps.set-matrix.outputs.matrix }}
20
- steps:
21
- - name: Fetch Node LTS versions
22
- id: set-matrix
23
- run: |
24
- LTS_VERSIONS=$(curl -s https://raw.githubusercontent.com/nodejs/Release/main/schedule.json | \
25
- jq -cr 'to_entries | map(select(.value.lts != false and .value.end > (now | strftime("%Y-%m-%d")))) | map(.key)')
26
- echo "matrix={\"node-version\": $LTS_VERSIONS}" >> $GITHUB_OUTPUT
27
-
28
- lint:
29
- name: 🔍 Lint Code
30
- runs-on: ubuntu-latest
31
- steps:
32
- - uses: actions/checkout@v4
33
- - uses: actions/setup-node@v4
34
- with:
35
- node-version: 20.x
36
- cache: 'npm'
37
- cache-dependency-path: '**/package-lock.json'
38
- - run: npm ci
39
- - name: Run ESLint
40
- run: npm run lint
41
-
42
- test:
43
- name: 🧪 Test on Node ${{ matrix.node-version }}
44
- needs: get-lts-versions
45
- runs-on: ubuntu-latest
46
- strategy:
47
- matrix: ${{ fromJson(needs.get-lts-versions.outputs.matrix) }}
48
- steps:
49
- - uses: actions/checkout@v4
50
- - uses: actions/setup-node@v4
51
- with:
52
- node-version: ${{ matrix.node-version }}
53
- cache: 'npm'
54
- cache-dependency-path: '**/package-lock.json'
55
- - name: Cache npm global
56
- uses: actions/cache@v4
57
- with:
58
- path: ~/.npm
59
- key: npm-global-${{ runner.os }}-${{ matrix.node-version }}
60
- - run: npm ci
61
- - name: Run tests
62
- run: npm test -- --run
63
-
64
- build:
65
- name: 🛠️ Build
66
- runs-on: ubuntu-latest
67
- needs: [lint, test]
68
- steps:
69
- - name: Build complete
70
- run: |
71
- echo "✅ All tests passed across Node.js LTS versions"
72
- echo "✅ ESLint checks completed"
73
- echo "✅ Library is ready for deployment"
74
-
75
- # Required status check that gates merge operations
76
- pr-ready-to-merge:
77
- name: ✅ PR Ready to Merge
78
- runs-on: ubuntu-latest
79
- needs: [lint, test, build]
80
- if: github.event_name == 'pull_request'
81
- steps:
82
- - name: All checks passed
83
- run: |
84
- echo "🎉 All required checks have passed!"
85
- echo "✅ Linting: Passed"
86
- echo "✅ Tests: Passed on all LTS Node versions"
87
- echo "✅ Build: Successful"
88
- echo "ℹ️ Version: Will be checked on merge (publish only if bumped)"
89
- echo ""
90
- echo "This PR is now ready for squash and merge."
91
-
92
- # Publish to NPM and create git tag - only if version was bumped
93
- release:
94
- name: 🚀 Publish to NPM
95
- runs-on: ubuntu-latest
96
- needs: build
97
- if: github.ref == 'refs/heads/main' && github.event_name == 'push'
98
- permissions:
99
- contents: write
100
- pull-requests: write
101
- steps:
102
- - uses: actions/checkout@v4
103
- with:
104
- fetch-depth: 0
105
- token: ${{ secrets.GITHUB_TOKEN }}
106
- - uses: actions/setup-node@v4
107
- with:
108
- node-version: 20.x
109
- registry-url: 'https://registry.npmjs.org'
110
- cache: 'npm'
111
- - run: npm ci
112
-
113
- - name: Check if version was bumped
114
- id: version-check
115
- run: |
116
- CURRENT_VERSION=$(node -p "require('./package.json').version")
117
- PUBLISHED_VERSION=$(npm view @far-world-labs/verblets version 2>/dev/null || echo "0.0.0")
118
-
119
- echo "📦 Current version in package.json: $CURRENT_VERSION"
120
- echo "📦 Published version on npm: $PUBLISHED_VERSION"
121
-
122
- if [ "$CURRENT_VERSION" = "$PUBLISHED_VERSION" ]; then
123
- echo "should-publish=false" >> $GITHUB_OUTPUT
124
- echo "ℹ️ No version bump detected - skipping publish"
125
- else
126
- echo "should-publish=true" >> $GITHUB_OUTPUT
127
- echo "✅ Version bump detected: $PUBLISHED_VERSION → $CURRENT_VERSION - will publish"
128
- fi
129
-
130
- - name: Create Git Tag
131
- if: steps.version-check.outputs.should-publish == 'true'
132
- run: |
133
- VERSION=$(node -p "require('./package.json').version")
134
- git config --global user.name "github-actions[bot]"
135
- git config --global user.email "github-actions[bot]@users.noreply.github.com"
136
- git tag -a "v$VERSION" -m "Release v$VERSION"
137
- git push origin "v$VERSION"
138
-
139
- - name: Publish to NPM
140
- if: steps.version-check.outputs.should-publish == 'true'
141
- env:
142
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
143
- run: |
144
- # Version was manually bumped and validated in PR
145
- npm publish --access public
146
-
147
- - name: Create GitHub Release
148
- if: steps.version-check.outputs.should-publish == 'true'
149
- env:
150
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151
- run: |
152
- # Get version from package.json
153
- VERSION=$(node -p "require('./package.json').version")
154
-
155
- # Create GitHub release
156
- gh release create "v$VERSION" \
157
- --title "Release v$VERSION" \
158
- --notes "Automated release of version $VERSION" \
159
- --latest
160
-
161
- - name: Skip publish
162
- if: steps.version-check.outputs.should-publish == 'false'
163
- run: |
164
- echo "ℹ️ No version bump detected - publish skipped"
165
- echo "This merge completed without triggering a release"
package/.husky/pre-commit DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
4
- npm run lint
package/.prettierrc DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "singleQuote": true,
3
- "trailingComma": "es5",
4
- "semi": true,
5
- "printWidth": 100
6
- }
package/.release-it.json DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "git": {
3
- "commitMessage": "chore: release v${version}",
4
- "tagName": "v${version}"
5
- },
6
- "npm": {
7
- "publish": true
8
- },
9
- "github": {
10
- "release": true
11
- }
12
- }
@@ -1,12 +0,0 @@
1
- import { configDefaults, defineConfig } from 'vitest/config'
2
- import dotenv from 'dotenv'
3
-
4
- // Load environment variables from .env file
5
- dotenv.config()
6
-
7
- export default defineConfig({
8
- test: {
9
- exclude: [...configDefaults.exclude],
10
- include: ['src/**/*.examples.js']
11
- },
12
- });
package/.vitest.config.js DELETED
@@ -1,8 +0,0 @@
1
- import { configDefaults, defineConfig } from 'vitest/config'
2
-
3
- export default defineConfig({
4
- test: {
5
- exclude: [...configDefaults.exclude],
6
- include: ['**/*.spec.js']
7
- },
8
- });
@@ -1,31 +0,0 @@
1
- {
2
- "version": "0.2.0",
3
- "configurations": [
4
-
5
- {
6
- "type": "node",
7
- "request": "launch",
8
- "name": "Run Regular Tests",
9
- "autoAttachChildProcesses": true,
10
- "skipFiles": ["<node_internals>/**"],
11
- "program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
12
- "args": ["run"],
13
- "smartStep": true,
14
- "console": "integratedTerminal"
15
- },
16
- {
17
- "type": "node",
18
- "request": "launch",
19
- "name": "Run Example Tests",
20
- "autoAttachChildProcesses": true,
21
- "skipFiles": ["<node_internals>/**"],
22
- "program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
23
- "args": ["run", "--config", ".vitest.config.examples.js"],
24
- "env": {
25
- "EXAMPLES": "true"
26
- },
27
- "smartStep": true,
28
- "console": "integratedTerminal"
29
- }
30
- ]
31
- }
package/AGENTS.md DELETED
@@ -1,220 +0,0 @@
1
- # Agents Guide
2
-
3
- This document explains the internal architecture and development practices for the verblets project. It's intended for AI agents and developers working on the codebase.
4
-
5
- ## Architecture Overview
6
-
7
- The verblets project has two main types of components:
8
-
9
- ### **Chains** (`src/chains/`)
10
- LLM orchestrations that combine multiple verblets, other chains, and library utilities to perform complex workflows. Chains handle multi-step reasoning, batch processing, and sophisticated AI operations.
11
-
12
- **Examples:**
13
- - `anonymize` - Multi-step process to identify and replace sensitive information
14
- - `socratic` - Iterative questioning dialogue using multiple LLM calls
15
- - `bulk-map` - Parallel processing of large datasets with retry logic
16
- - `summary-map` - Self-resizing hash table with AI-powered summarization
17
-
18
- **Characteristics:**
19
- - Use multiple LLM calls or orchestrate other modules
20
- - Handle complex workflows and state management
21
- - Often include retry logic and error handling
22
- - May process data in chunks or batches
23
-
24
- ### **Verblets** (`src/verblets/`)
25
- Single LLM calls with carefully crafted prompts and prompt-supporting functions. Each verblet performs one specific AI task with high reliability and constrained outputs.
26
-
27
- **Examples:**
28
- - `bool` - Extract true/false decisions from natural language
29
- - `enum` - Map text to predefined options with high accuracy
30
- - `intent` - Parse user intent and extract structured parameters
31
- - `to-object` - Convert descriptions to structured JSON objects
32
-
33
- **Characteristics:**
34
- - Single LLM call per operation
35
- - Substantial, optimized prompts with prompt variables
36
- - Constrained outputs to prevent hallucination
37
- - High reliability for specific tasks
38
-
39
- ### **Library Utilities** (`src/lib/`)
40
- Supporting utilities that don't use LLMs directly. These provide infrastructure, data processing, and reusable functions that support both chains and verblets.
41
-
42
- **Examples:**
43
- - `chatgpt` - OpenAI API wrapper with error handling
44
- - `prompt-cache` - Caching layer for LLM responses
45
- - `retry` - Robust retry logic for async operations
46
- - `parse-js-parts` - JavaScript AST parsing utilities
47
- - `parse-llm-list` - Parse JSON arrays or CSV from LLM responses with filtering
48
-
49
- **Characteristics:**
50
- - No direct LLM usage
51
- - Pure functions or utility classes
52
- - Infrastructure and data processing
53
- - Reusable across verblets and chains
54
-
55
- ## Module Structure
56
-
57
- Every module (chain, verblet, or lib utility) follows a consistent structure:
58
-
59
- ```
60
- module-name/
61
- ├── index.js # Main implementation
62
- ├── index.spec.js # Deterministic tests with mocks
63
- ├── index.examples.js # Non-deterministic tests with real LLM calls
64
- └── README.md # Documentation with compelling examples and docs for the JS API
65
- ```
66
-
67
- ### Required Files
68
-
69
- #### `index.js`
70
- The main implementation. Should export a default function or class.
71
-
72
- #### `index.spec.js`
73
- Deterministic tests using table-driven examples. These tests:
74
- - Mock LLM interfaces (chatGPT, etc.)
75
- - Use predictable inputs and expected outputs
76
- - Run quickly and reliably in CI/CD
77
- - Follow the `examples` array pattern
78
-
79
- **Example:** See [`src/verblets/bool/index.spec.js`](src/verblets/bool/index.spec.js) for the table-driven testing pattern.
80
-
81
- #### `index.examples.js`
82
- Non-deterministic tests using real LLM calls. These tests:
83
- - Use actual API calls (require API keys)
84
- - Verify behavior with LLM assertion chains
85
- - Use the `expect` chain or verblet for intelligent assertions
86
- - Include `longTestTimeout` for API call delays
87
-
88
- **Example:** See [`src/verblets/bool/index.examples.js`](src/verblets/bool/index.examples.js) for LLM assertion usage.
89
-
90
- #### `README.md`
91
- Documentation with at least one compelling example that demonstrates how LLM programming changes what's possible. Should show real-world value and be accessible to developers.
92
-
93
- **Example:** See [`src/chains/socratic/README.md`](src/chains/socratic/README.md) for compelling documentation.
94
-
95
- ## Testing Strategy
96
-
97
- ### Two-Tier Testing Approach
98
-
99
- 1. **Spec Tests** (`*.spec.js`)
100
- - Fast, deterministic, mocked
101
- - Table-driven with `examples` arrays
102
- - Run with `npm run test`
103
- - Essential for CI/CD and development
104
-
105
- 2. **Example Tests** (`*.examples.js`)
106
- - Slow, non-deterministic, real LLM calls
107
- - LLM assertions using `expect` chain or verblet
108
- - Run with `npm run examples` (requires API keys--not possible as an agent)
109
- - Validate real-world behavior
110
-
111
- ### Testing Patterns
112
-
113
- #### Table-Driven Examples
114
- All tests use a consistent `examples` array structure. See [`src/verblets/enum/index.spec.js`](src/verblets/enum/index.spec.js) for the standard pattern.
115
-
116
- #### LLM Assertion Chains
117
- For example tests, use the `expect` chain or verblet for assertions that blind assertions cannot handle:
118
-
119
- **Chain Usage:** See [`src/chains/expect/index.examples.js`](src/chains/expect/index.examples.js) for enhanced LLM assertions.
120
-
121
- **Verblet Usage:** See [`src/verblets/expect/index.examples.js`](src/verblets/expect/index.examples.js) for simple LLM assertions.
122
-
123
- **Real-World Usage:** See [`src/chains/intersections/index.examples.js`](src/chains/intersections/index.examples.js) for LLM assertions in practice.
124
-
125
- **Key Benefits of LLM Assertions:**
126
- - Verify semantic meaning, not just structure
127
- - Check content quality and appropriateness
128
- - Validate business logic and context understanding
129
- - Handle cases where traditional assertions are insufficient
130
-
131
- ## Development Commands
132
-
133
- ### Core Commands
134
- - `npm run test` - Run deterministic spec tests
135
- - `npm run lint` - Check code style
136
- - `npm run lint:fix` - Auto-fix linting issues
137
-
138
- ### Example Commands (Require API Keys)
139
- - `npm run examples` - Run non-deterministic example tests
140
- - `npm run examples:warn` - Run examples with warning-level LLM expectations
141
-
142
- **Note for Agents:** The `npm run examples` command won't work for AI agents since it requires API keys that agents don't have access to.
143
-
144
- ## Export Strategy
145
-
146
- ### Internal Organization
147
- Internally, we maintain clear distinctions between chains, verblets, and lib utilities for architectural clarity and development organization.
148
-
149
- ### Public API
150
- In the top-level README and `src/index.js`, we export everything as "verblets" to provide a unified, simple API for users. See [`src/index.js`](src/index.js) for the export structure.
151
-
152
- This approach:
153
- - Simplifies the user experience
154
- - Maintains internal architectural clarity
155
- - Allows for easy refactoring and organization
156
- - Provides a consistent mental model for users
157
-
158
- ## Documentation Standards
159
-
160
- ### README Requirements
161
- Every module README must include:
162
-
163
- 1. **Clear description** of what the module does
164
- 2. **At least one compelling example** showing real-world value
165
- 3. **Demonstration of LLM capabilities** that would be difficult/impossible with traditional programming
166
- 4. **Accessible code examples** that developers can immediately understand and use
167
-
168
- ### Example Quality
169
- Examples should demonstrate transformative capabilities. See [`src/verblets/bool/README.md`](src/verblets/bool/README.md) and [`src/verblets/enum/README.md`](src/verblets/enum/README.md) for examples that show LLM understanding of context and nuance.
170
-
171
- ### Linking Strategy
172
- - Most modules should be linked from the top-level README
173
- - Organize by functional categories (primitives, lists, content, etc.)
174
- - Prioritize modules that best demonstrate LLM capabilities
175
- - Include brief descriptions that highlight unique value
176
-
177
- ## Development Environment
178
-
179
- ### .cursor Directory
180
- The `.cursor` directory contains IDE-specific configuration and rules for the Cursor editor. This should include:
181
- - Code style preferences
182
- - AI assistant behavior guidelines
183
- - Project-specific linting rules
184
- - Development workflow configurations
185
-
186
- **Note:** The `.cursor` directory should have comprehensive rules to guide development practices, though these may not be fully implemented yet.
187
-
188
- ## Best Practices
189
-
190
- ### For Chains
191
- - Use clear step-by-step orchestration
192
- - Include robust error handling and retry logic
193
- - Document the workflow in comments
194
- - Consider chunking for large datasets
195
- - Provide progress feedback for long operations
196
-
197
- ### For Verblets
198
- - Craft prompts carefully for reliability
199
- - Constrain outputs to prevent hallucination
200
- - Use JSON schemas for structured outputs
201
- - Test edge cases thoroughly
202
- - Optimize for single-call efficiency
203
-
204
- ### For Library Utilities
205
- - Keep functions pure when possible
206
- - Provide comprehensive error handling
207
- - Include detailed JSDoc comments
208
- - Design for reusability across modules
209
- - Follow standard JavaScript patterns
210
-
211
- ### Testing Guidelines
212
- - Write spec tests first (TDD approach)
213
- - Mock all external dependencies in spec tests
214
- - Use realistic but simple examples
215
- - Make example tests robust with LLM assertions
216
- - Include edge cases and error conditions
217
- - Test both success and failure paths
218
- - Use LLM assertions for content that traditional assertions cannot verify
219
-
220
- This architecture enables building sophisticated AI-powered applications while maintaining code quality, testability, and developer experience.