@jinion/core 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (377) hide show
  1. package/dist/agent/claude/backend.d.ts +4 -0
  2. package/dist/agent/claude/backend.d.ts.map +1 -1
  3. package/dist/agent/claude/backend.js.map +1 -1
  4. package/dist/agent/claude/events.js +1 -1
  5. package/dist/agent/claude/events.js.map +1 -1
  6. package/dist/agent/claude/guard.d.ts.map +1 -1
  7. package/dist/agent/claude/guard.js +2 -1
  8. package/dist/agent/claude/guard.js.map +1 -1
  9. package/dist/agent/claude/jinion-tools.d.ts +9 -1
  10. package/dist/agent/claude/jinion-tools.d.ts.map +1 -1
  11. package/dist/agent/claude/jinion-tools.js +14 -2
  12. package/dist/agent/claude/jinion-tools.js.map +1 -1
  13. package/dist/agent/claude/mcp.d.ts.map +1 -1
  14. package/dist/agent/claude/mcp.js +21 -1
  15. package/dist/agent/claude/mcp.js.map +1 -1
  16. package/dist/agent/claude/options.d.ts +9 -1
  17. package/dist/agent/claude/options.d.ts.map +1 -1
  18. package/dist/agent/claude/options.js +5 -3
  19. package/dist/agent/claude/options.js.map +1 -1
  20. package/dist/agent/claude/paths.d.ts +0 -3
  21. package/dist/agent/claude/paths.d.ts.map +1 -1
  22. package/dist/agent/claude/paths.js +1 -7
  23. package/dist/agent/claude/paths.js.map +1 -1
  24. package/dist/agent/claude/permissions.js +1 -1
  25. package/dist/agent/claude/permissions.js.map +1 -1
  26. package/dist/agent/claude/prompt.d.ts +2 -1
  27. package/dist/agent/claude/prompt.d.ts.map +1 -1
  28. package/dist/agent/claude/prompt.js +10 -5
  29. package/dist/agent/claude/prompt.js.map +1 -1
  30. package/dist/agent/claude/review.d.ts +4 -1
  31. package/dist/agent/claude/review.d.ts.map +1 -1
  32. package/dist/agent/claude/review.js +5 -2
  33. package/dist/agent/claude/review.js.map +1 -1
  34. package/dist/agent/claude/session.d.ts +7 -0
  35. package/dist/agent/claude/session.d.ts.map +1 -1
  36. package/dist/agent/claude/session.js +6 -1
  37. package/dist/agent/claude/session.js.map +1 -1
  38. package/dist/agent/claude/tool-calls.d.ts.map +1 -1
  39. package/dist/agent/claude/tool-calls.js +11 -2
  40. package/dist/agent/claude/tool-calls.js.map +1 -1
  41. package/dist/agent/codex/backend.d.ts +4 -0
  42. package/dist/agent/codex/backend.d.ts.map +1 -1
  43. package/dist/agent/codex/backend.js.map +1 -1
  44. package/dist/agent/codex/events.d.ts.map +1 -1
  45. package/dist/agent/codex/events.js +15 -1
  46. package/dist/agent/codex/events.js.map +1 -1
  47. package/dist/agent/codex/jinion-tools.d.ts +38 -4
  48. package/dist/agent/codex/jinion-tools.d.ts.map +1 -1
  49. package/dist/agent/codex/jinion-tools.js +57 -10
  50. package/dist/agent/codex/jinion-tools.js.map +1 -1
  51. package/dist/agent/codex/mcp.d.ts.map +1 -1
  52. package/dist/agent/codex/mcp.js +4 -0
  53. package/dist/agent/codex/mcp.js.map +1 -1
  54. package/dist/agent/codex/rewind.js +1 -47
  55. package/dist/agent/codex/rewind.js.map +1 -1
  56. package/dist/agent/codex/session.d.ts +9 -2
  57. package/dist/agent/codex/session.d.ts.map +1 -1
  58. package/dist/agent/codex/session.js +21 -7
  59. package/dist/agent/codex/session.js.map +1 -1
  60. package/dist/agent/demo/mcp.d.ts +2 -0
  61. package/dist/agent/demo/mcp.d.ts.map +1 -1
  62. package/dist/agent/demo/mcp.js +14 -0
  63. package/dist/agent/demo/mcp.js.map +1 -1
  64. package/dist/agent/demo/scenarios/pricing-card.d.ts +3 -0
  65. package/dist/agent/demo/scenarios/pricing-card.d.ts.map +1 -0
  66. package/dist/agent/demo/scenarios/pricing-card.js +43 -0
  67. package/dist/agent/demo/scenarios/pricing-card.js.map +1 -0
  68. package/dist/agent/demo/script.d.ts +6 -0
  69. package/dist/agent/demo/script.d.ts.map +1 -1
  70. package/dist/agent/demo/tasks.d.ts +3 -0
  71. package/dist/agent/demo/tasks.d.ts.map +1 -1
  72. package/dist/agent/events.d.ts +3 -0
  73. package/dist/agent/events.d.ts.map +1 -1
  74. package/dist/agent/events.js +2 -0
  75. package/dist/agent/events.js.map +1 -1
  76. package/dist/agent/mcp.d.ts +5 -0
  77. package/dist/agent/mcp.d.ts.map +1 -1
  78. package/dist/agent/mcp.js +2 -0
  79. package/dist/agent/mcp.js.map +1 -1
  80. package/dist/agent/patches.d.ts +5 -0
  81. package/dist/agent/patches.d.ts.map +1 -1
  82. package/dist/agent/patches.js +49 -0
  83. package/dist/agent/patches.js.map +1 -1
  84. package/dist/agent/review-tools.d.ts +15 -0
  85. package/dist/agent/review-tools.d.ts.map +1 -0
  86. package/dist/agent/review-tools.js +13 -0
  87. package/dist/agent/review-tools.js.map +1 -0
  88. package/dist/agent/review.d.ts +18 -6
  89. package/dist/agent/review.d.ts.map +1 -1
  90. package/dist/agent/review.js +52 -17
  91. package/dist/agent/review.js.map +1 -1
  92. package/dist/api/client.d.ts +15 -1
  93. package/dist/api/client.d.ts.map +1 -1
  94. package/dist/api/client.js +14 -3
  95. package/dist/api/client.js.map +1 -1
  96. package/dist/api/connection.d.ts +5 -0
  97. package/dist/api/connection.d.ts.map +1 -1
  98. package/dist/api/connection.js +6 -0
  99. package/dist/api/connection.js.map +1 -1
  100. package/dist/api/fields.d.ts +3 -1
  101. package/dist/api/fields.d.ts.map +1 -1
  102. package/dist/api/fields.js +3 -2
  103. package/dist/api/fields.js.map +1 -1
  104. package/dist/api/json-schema.d.ts +592 -89
  105. package/dist/api/json-schema.d.ts.map +1 -1
  106. package/dist/api/json-schema.js +2 -1
  107. package/dist/api/json-schema.js.map +1 -1
  108. package/dist/api/methods/accounts.d.ts.map +1 -1
  109. package/dist/api/methods/accounts.js +1 -2
  110. package/dist/api/methods/accounts.js.map +1 -1
  111. package/dist/api/methods/app.d.ts.map +1 -1
  112. package/dist/api/methods/app.js +9 -5
  113. package/dist/api/methods/app.js.map +1 -1
  114. package/dist/api/methods/files.d.ts +3 -1
  115. package/dist/api/methods/files.d.ts.map +1 -1
  116. package/dist/api/methods/files.js +75 -2
  117. package/dist/api/methods/files.js.map +1 -1
  118. package/dist/api/methods/git.d.ts.map +1 -1
  119. package/dist/api/methods/git.js +54 -6
  120. package/dist/api/methods/git.js.map +1 -1
  121. package/dist/api/methods/lsp.d.ts +7 -0
  122. package/dist/api/methods/lsp.d.ts.map +1 -0
  123. package/dist/api/methods/lsp.js +68 -0
  124. package/dist/api/methods/lsp.js.map +1 -0
  125. package/dist/api/methods/preview.d.ts +4 -1
  126. package/dist/api/methods/preview.d.ts.map +1 -1
  127. package/dist/api/methods/preview.js +19 -3
  128. package/dist/api/methods/preview.js.map +1 -1
  129. package/dist/api/methods/terminals.d.ts.map +1 -1
  130. package/dist/api/methods/terminals.js +7 -1
  131. package/dist/api/methods/terminals.js.map +1 -1
  132. package/dist/api/protocol.d.ts +762 -7
  133. package/dist/api/protocol.d.ts.map +1 -1
  134. package/dist/api/protocol.js +126 -8
  135. package/dist/api/protocol.js.map +1 -1
  136. package/dist/api/schemas.d.ts +7 -0
  137. package/dist/api/schemas.d.ts.map +1 -1
  138. package/dist/api/schemas.js +4 -0
  139. package/dist/api/schemas.js.map +1 -1
  140. package/dist/api/screen.d.ts +2 -0
  141. package/dist/api/screen.d.ts.map +1 -1
  142. package/dist/api/screen.js +3 -0
  143. package/dist/api/screen.js.map +1 -1
  144. package/dist/api/server.d.ts +2 -0
  145. package/dist/api/server.d.ts.map +1 -1
  146. package/dist/api/server.js +13 -0
  147. package/dist/api/server.js.map +1 -1
  148. package/dist/commands/builtin.d.ts.map +1 -1
  149. package/dist/commands/builtin.js +2 -0
  150. package/dist/commands/builtin.js.map +1 -1
  151. package/dist/commands/conversation.d.ts.map +1 -1
  152. package/dist/commands/conversation.js +2 -0
  153. package/dist/commands/conversation.js.map +1 -1
  154. package/dist/commands/feedback.d.ts.map +1 -1
  155. package/dist/commands/feedback.js +1 -0
  156. package/dist/commands/feedback.js.map +1 -1
  157. package/dist/commands/notifications.d.ts.map +1 -1
  158. package/dist/commands/notifications.js +5 -3
  159. package/dist/commands/notifications.js.map +1 -1
  160. package/dist/commands/registry.d.ts +3 -0
  161. package/dist/commands/registry.d.ts.map +1 -1
  162. package/dist/commands/registry.js +14 -0
  163. package/dist/commands/registry.js.map +1 -1
  164. package/dist/commands/skill.d.ts +5 -0
  165. package/dist/commands/skill.d.ts.map +1 -0
  166. package/dist/commands/skill.js +30 -0
  167. package/dist/commands/skill.js.map +1 -0
  168. package/dist/commands/views.d.ts.map +1 -1
  169. package/dist/commands/views.js +5 -1
  170. package/dist/commands/views.js.map +1 -1
  171. package/dist/controllers/accounts.d.ts +5 -2
  172. package/dist/controllers/accounts.d.ts.map +1 -1
  173. package/dist/controllers/accounts.js +11 -8
  174. package/dist/controllers/accounts.js.map +1 -1
  175. package/dist/controllers/context.d.ts +2 -0
  176. package/dist/controllers/context.d.ts.map +1 -1
  177. package/dist/controllers/context.js.map +1 -1
  178. package/dist/controllers/feedback.d.ts +1 -1
  179. package/dist/controllers/feedback.d.ts.map +1 -1
  180. package/dist/controllers/feedback.js +4 -1
  181. package/dist/controllers/feedback.js.map +1 -1
  182. package/dist/controllers/input.d.ts.map +1 -1
  183. package/dist/controllers/input.js +2 -0
  184. package/dist/controllers/input.js.map +1 -1
  185. package/dist/controllers/jinion.d.ts +7 -0
  186. package/dist/controllers/jinion.d.ts.map +1 -1
  187. package/dist/controllers/jinion.js +7 -0
  188. package/dist/controllers/jinion.js.map +1 -1
  189. package/dist/controllers/mcp.d.ts +7 -2
  190. package/dist/controllers/mcp.d.ts.map +1 -1
  191. package/dist/controllers/mcp.js +23 -7
  192. package/dist/controllers/mcp.js.map +1 -1
  193. package/dist/controllers/session.d.ts.map +1 -1
  194. package/dist/controllers/session.js +4 -0
  195. package/dist/controllers/session.js.map +1 -1
  196. package/dist/conversation/activity.d.ts +5 -0
  197. package/dist/conversation/activity.d.ts.map +1 -0
  198. package/dist/conversation/activity.js +41 -0
  199. package/dist/conversation/activity.js.map +1 -0
  200. package/dist/conversation/apply-event.d.ts.map +1 -1
  201. package/dist/conversation/apply-event.js +2 -1
  202. package/dist/conversation/apply-event.js.map +1 -1
  203. package/dist/conversation/edits.d.ts +5 -0
  204. package/dist/conversation/edits.d.ts.map +1 -1
  205. package/dist/conversation/edits.js +10 -0
  206. package/dist/conversation/edits.js.map +1 -1
  207. package/dist/conversation/reducer.d.ts +9 -0
  208. package/dist/conversation/reducer.d.ts.map +1 -1
  209. package/dist/design/guides.d.ts +78 -5
  210. package/dist/design/guides.d.ts.map +1 -1
  211. package/dist/design/guides.js +78 -5
  212. package/dist/design/guides.js.map +1 -1
  213. package/dist/design/prompt.d.ts +1 -1
  214. package/dist/design/prompt.d.ts.map +1 -1
  215. package/dist/design/prompt.js +2 -2
  216. package/dist/design/prompt.js.map +1 -1
  217. package/dist/design/tools.d.ts +2 -0
  218. package/dist/design/tools.d.ts.map +1 -1
  219. package/dist/design/tools.js +6 -2
  220. package/dist/design/tools.js.map +1 -1
  221. package/dist/directions/directions.d.ts +42 -0
  222. package/dist/directions/directions.d.ts.map +1 -0
  223. package/dist/directions/directions.js +120 -0
  224. package/dist/directions/directions.js.map +1 -0
  225. package/dist/directions/store.d.ts +34 -0
  226. package/dist/directions/store.d.ts.map +1 -0
  227. package/dist/directions/store.js +61 -0
  228. package/dist/directions/store.js.map +1 -0
  229. package/dist/directions/tools.d.ts +29 -0
  230. package/dist/directions/tools.d.ts.map +1 -0
  231. package/dist/directions/tools.js +57 -0
  232. package/dist/directions/tools.js.map +1 -0
  233. package/dist/directions/viewer.d.ts +6 -0
  234. package/dist/directions/viewer.d.ts.map +1 -0
  235. package/dist/directions/viewer.js +266 -0
  236. package/dist/directions/viewer.js.map +1 -0
  237. package/dist/files/names.d.ts +6 -0
  238. package/dist/files/names.d.ts.map +1 -0
  239. package/dist/files/names.js +18 -0
  240. package/dist/files/names.js.map +1 -0
  241. package/dist/files/operations.d.ts +54 -0
  242. package/dist/files/operations.d.ts.map +1 -0
  243. package/dist/files/operations.js +173 -0
  244. package/dist/files/operations.js.map +1 -0
  245. package/dist/files/search.d.ts +11 -0
  246. package/dist/files/search.d.ts.map +1 -0
  247. package/dist/files/search.js +112 -0
  248. package/dist/files/search.js.map +1 -0
  249. package/dist/files/trash.d.ts +11 -0
  250. package/dist/files/trash.d.ts.map +1 -0
  251. package/dist/files/trash.js +64 -0
  252. package/dist/files/trash.js.map +1 -0
  253. package/dist/files/types.d.ts +112 -0
  254. package/dist/files/types.d.ts.map +1 -0
  255. package/dist/files/types.js +47 -0
  256. package/dist/files/types.js.map +1 -0
  257. package/dist/files/watch.d.ts +26 -0
  258. package/dist/files/watch.d.ts.map +1 -0
  259. package/dist/files/watch.js +107 -0
  260. package/dist/files/watch.js.map +1 -0
  261. package/dist/git/blame.d.ts +10 -0
  262. package/dist/git/blame.d.ts.map +1 -0
  263. package/dist/git/blame.js +91 -0
  264. package/dist/git/blame.js.map +1 -0
  265. package/dist/git/repos.d.ts +5 -0
  266. package/dist/git/repos.d.ts.map +1 -1
  267. package/dist/git/repos.js +13 -0
  268. package/dist/git/repos.js.map +1 -1
  269. package/dist/git/staging.d.ts +10 -1
  270. package/dist/git/staging.d.ts.map +1 -1
  271. package/dist/git/staging.js +21 -0
  272. package/dist/git/staging.js.map +1 -1
  273. package/dist/git/types.d.ts +48 -0
  274. package/dist/git/types.d.ts.map +1 -1
  275. package/dist/git/types.js +25 -0
  276. package/dist/git/types.js.map +1 -1
  277. package/dist/host.d.ts +2 -0
  278. package/dist/host.d.ts.map +1 -1
  279. package/dist/host.js +8 -1
  280. package/dist/host.js.map +1 -1
  281. package/dist/lib/glob.d.ts +6 -0
  282. package/dist/lib/glob.d.ts.map +1 -0
  283. package/dist/lib/glob.js +49 -0
  284. package/dist/lib/glob.js.map +1 -0
  285. package/dist/lib/paths.d.ts +3 -0
  286. package/dist/lib/paths.d.ts.map +1 -1
  287. package/dist/lib/paths.js +9 -1
  288. package/dist/lib/paths.js.map +1 -1
  289. package/dist/look/tools.d.ts +7 -1
  290. package/dist/look/tools.d.ts.map +1 -1
  291. package/dist/look/tools.js +19 -4
  292. package/dist/look/tools.js.map +1 -1
  293. package/dist/lsp/code-intelligence.d.ts +87 -0
  294. package/dist/lsp/code-intelligence.d.ts.map +1 -0
  295. package/dist/lsp/code-intelligence.js +343 -0
  296. package/dist/lsp/code-intelligence.js.map +1 -0
  297. package/dist/lsp/edits.d.ts +4 -0
  298. package/dist/lsp/edits.d.ts.map +1 -0
  299. package/dist/lsp/edits.js +14 -0
  300. package/dist/lsp/edits.js.map +1 -0
  301. package/dist/lsp/project-check.d.ts +8 -0
  302. package/dist/lsp/project-check.d.ts.map +1 -0
  303. package/dist/lsp/project-check.js +71 -0
  304. package/dist/lsp/project-check.js.map +1 -0
  305. package/dist/lsp/results.d.ts +95 -0
  306. package/dist/lsp/results.d.ts.map +1 -0
  307. package/dist/lsp/results.js +116 -0
  308. package/dist/lsp/results.js.map +1 -0
  309. package/dist/lsp/server.d.ts +22 -0
  310. package/dist/lsp/server.d.ts.map +1 -0
  311. package/dist/lsp/server.js +123 -0
  312. package/dist/lsp/server.js.map +1 -0
  313. package/dist/lsp/servers.d.ts +21 -0
  314. package/dist/lsp/servers.d.ts.map +1 -0
  315. package/dist/lsp/servers.js +57 -0
  316. package/dist/lsp/servers.js.map +1 -0
  317. package/dist/lsp/transport.d.ts +9 -0
  318. package/dist/lsp/transport.d.ts.map +1 -0
  319. package/dist/lsp/transport.js +64 -0
  320. package/dist/lsp/transport.js.map +1 -0
  321. package/dist/lsp/types.d.ts +262 -0
  322. package/dist/lsp/types.d.ts.map +1 -0
  323. package/dist/lsp/types.js +64 -0
  324. package/dist/lsp/types.js.map +1 -0
  325. package/dist/map/prompt.d.ts.map +1 -1
  326. package/dist/map/prompt.js +2 -1
  327. package/dist/map/prompt.js.map +1 -1
  328. package/dist/map/review.d.ts +29 -9
  329. package/dist/map/review.d.ts.map +1 -1
  330. package/dist/map/review.js +105 -25
  331. package/dist/map/review.js.map +1 -1
  332. package/dist/mcp/login.d.ts +2 -0
  333. package/dist/mcp/login.d.ts.map +1 -1
  334. package/dist/mcp/login.js +5 -0
  335. package/dist/mcp/login.js.map +1 -1
  336. package/dist/preview/pages.d.ts +17 -0
  337. package/dist/preview/pages.d.ts.map +1 -0
  338. package/dist/preview/pages.js +92 -0
  339. package/dist/preview/pages.js.map +1 -0
  340. package/dist/preview/previews.d.ts +22 -0
  341. package/dist/preview/previews.d.ts.map +1 -0
  342. package/dist/preview/previews.js +28 -0
  343. package/dist/preview/previews.js.map +1 -0
  344. package/dist/preview/prompt.d.ts +3 -0
  345. package/dist/preview/prompt.d.ts.map +1 -0
  346. package/dist/preview/prompt.js +5 -0
  347. package/dist/preview/prompt.js.map +1 -0
  348. package/dist/preview/tools.d.ts +21 -0
  349. package/dist/preview/tools.d.ts.map +1 -0
  350. package/dist/preview/tools.js +34 -0
  351. package/dist/preview/tools.js.map +1 -0
  352. package/dist/preview/types.d.ts +7 -0
  353. package/dist/preview/types.d.ts.map +1 -1
  354. package/dist/preview/types.js +2 -0
  355. package/dist/preview/types.js.map +1 -1
  356. package/dist/prompt/files.d.ts +4 -1
  357. package/dist/prompt/files.d.ts.map +1 -1
  358. package/dist/prompt/files.js +23 -8
  359. package/dist/prompt/files.js.map +1 -1
  360. package/dist/skills/tools.d.ts +26 -0
  361. package/dist/skills/tools.d.ts.map +1 -0
  362. package/dist/skills/tools.js +34 -0
  363. package/dist/skills/tools.js.map +1 -0
  364. package/dist/state/session.d.ts +4 -0
  365. package/dist/state/session.d.ts.map +1 -1
  366. package/dist/state/session.js +1 -0
  367. package/dist/state/session.js.map +1 -1
  368. package/package.json +3 -1
  369. package/schema/api.json +3016 -45
  370. package/vendor/darwin-arm64/build.json +62 -0
  371. package/vendor/darwin-arm64/ffmpeg +0 -0
  372. package/vendor/darwin-arm64/ffprobe +0 -0
  373. package/vendor/darwin-arm64/licenses/README.md +13 -0
  374. package/vendor/darwin-arm64/licenses/ffmpeg-LGPL-2.1.txt +502 -0
  375. package/vendor/darwin-arm64/licenses/whisper.cpp-MIT.txt +21 -0
  376. package/vendor/darwin-arm64/voices.bin +0 -0
  377. package/vendor/darwin-arm64/whisper-cli +0 -0
@@ -0,0 +1,262 @@
1
+ import { z } from 'zod';
2
+ /** A place in a file, counted from 0, its character in UTF-16 code units as a JavaScript string counts them. */
3
+ export declare const Position: z.ZodObject<{
4
+ line: z.ZodNumber;
5
+ character: z.ZodNumber;
6
+ }, z.core.$strip>;
7
+ export type Position = z.infer<typeof Position>;
8
+ export declare const Range: z.ZodObject<{
9
+ start: z.ZodObject<{
10
+ line: z.ZodNumber;
11
+ character: z.ZodNumber;
12
+ }, z.core.$strip>;
13
+ end: z.ZodObject<{
14
+ line: z.ZodNumber;
15
+ character: z.ZodNumber;
16
+ }, z.core.$strip>;
17
+ }, z.core.$strip>;
18
+ export type Range = z.infer<typeof Range>;
19
+ /** A file by its path in the session's folder, or a whole one for a file outside it, such as a library's types. */
20
+ export declare const Location: z.ZodObject<{
21
+ path: z.ZodString;
22
+ range: z.ZodObject<{
23
+ start: z.ZodObject<{
24
+ line: z.ZodNumber;
25
+ character: z.ZodNumber;
26
+ }, z.core.$strip>;
27
+ end: z.ZodObject<{
28
+ line: z.ZodNumber;
29
+ character: z.ZodNumber;
30
+ }, z.core.$strip>;
31
+ }, z.core.$strip>;
32
+ }, z.core.$strip>;
33
+ export type Location = z.infer<typeof Location>;
34
+ export declare const TextEdit: z.ZodObject<{
35
+ range: z.ZodObject<{
36
+ start: z.ZodObject<{
37
+ line: z.ZodNumber;
38
+ character: z.ZodNumber;
39
+ }, z.core.$strip>;
40
+ end: z.ZodObject<{
41
+ line: z.ZodNumber;
42
+ character: z.ZodNumber;
43
+ }, z.core.$strip>;
44
+ }, z.core.$strip>;
45
+ text: z.ZodString;
46
+ }, z.core.$strip>;
47
+ export type TextEdit = z.infer<typeof TextEdit>;
48
+ export declare const FileEdits: z.ZodObject<{
49
+ path: z.ZodString;
50
+ edits: z.ZodArray<z.ZodObject<{
51
+ range: z.ZodObject<{
52
+ start: z.ZodObject<{
53
+ line: z.ZodNumber;
54
+ character: z.ZodNumber;
55
+ }, z.core.$strip>;
56
+ end: z.ZodObject<{
57
+ line: z.ZodNumber;
58
+ character: z.ZodNumber;
59
+ }, z.core.$strip>;
60
+ }, z.core.$strip>;
61
+ text: z.ZodString;
62
+ }, z.core.$strip>>;
63
+ }, z.core.$strip>;
64
+ export type FileEdits = z.infer<typeof FileEdits>;
65
+ export declare const DiagnosticSeverity: z.ZodEnum<{
66
+ error: "error";
67
+ hint: "hint";
68
+ info: "info";
69
+ warning: "warning";
70
+ }>;
71
+ export type DiagnosticSeverity = z.infer<typeof DiagnosticSeverity>;
72
+ export declare const Diagnostic: z.ZodObject<{
73
+ range: z.ZodObject<{
74
+ start: z.ZodObject<{
75
+ line: z.ZodNumber;
76
+ character: z.ZodNumber;
77
+ }, z.core.$strip>;
78
+ end: z.ZodObject<{
79
+ line: z.ZodNumber;
80
+ character: z.ZodNumber;
81
+ }, z.core.$strip>;
82
+ }, z.core.$strip>;
83
+ severity: z.ZodEnum<{
84
+ error: "error";
85
+ hint: "hint";
86
+ info: "info";
87
+ warning: "warning";
88
+ }>;
89
+ message: z.ZodString;
90
+ source: z.ZodOptional<z.ZodString>;
91
+ code: z.ZodOptional<z.ZodString>;
92
+ unnecessary: z.ZodOptional<z.ZodBoolean>;
93
+ deprecated: z.ZodOptional<z.ZodBoolean>;
94
+ }, z.core.$strip>;
95
+ export type Diagnostic = z.infer<typeof Diagnostic>;
96
+ /** A file's errors and warnings; an empty list once it has none. */
97
+ export declare const FileDiagnostics: z.ZodObject<{
98
+ path: z.ZodString;
99
+ diagnostics: z.ZodArray<z.ZodObject<{
100
+ range: z.ZodObject<{
101
+ start: z.ZodObject<{
102
+ line: z.ZodNumber;
103
+ character: z.ZodNumber;
104
+ }, z.core.$strip>;
105
+ end: z.ZodObject<{
106
+ line: z.ZodNumber;
107
+ character: z.ZodNumber;
108
+ }, z.core.$strip>;
109
+ }, z.core.$strip>;
110
+ severity: z.ZodEnum<{
111
+ error: "error";
112
+ hint: "hint";
113
+ info: "info";
114
+ warning: "warning";
115
+ }>;
116
+ message: z.ZodString;
117
+ source: z.ZodOptional<z.ZodString>;
118
+ code: z.ZodOptional<z.ZodString>;
119
+ unnecessary: z.ZodOptional<z.ZodBoolean>;
120
+ deprecated: z.ZodOptional<z.ZodBoolean>;
121
+ }, z.core.$strip>>;
122
+ }, z.core.$strip>;
123
+ export type FileDiagnostics = z.infer<typeof FileDiagnostics>;
124
+ /** What the code under a position is, as Markdown. */
125
+ export declare const Hover: z.ZodObject<{
126
+ contents: z.ZodString;
127
+ range: z.ZodOptional<z.ZodObject<{
128
+ start: z.ZodObject<{
129
+ line: z.ZodNumber;
130
+ character: z.ZodNumber;
131
+ }, z.core.$strip>;
132
+ end: z.ZodObject<{
133
+ line: z.ZodNumber;
134
+ character: z.ZodNumber;
135
+ }, z.core.$strip>;
136
+ }, z.core.$strip>>;
137
+ }, z.core.$strip>;
138
+ export type Hover = z.infer<typeof Hover>;
139
+ export declare const CompletionItem: z.ZodObject<{
140
+ label: z.ZodString;
141
+ kind: z.ZodOptional<z.ZodNumber>;
142
+ detail: z.ZodOptional<z.ZodString>;
143
+ documentation: z.ZodOptional<z.ZodString>;
144
+ insertText: z.ZodString;
145
+ snippet: z.ZodOptional<z.ZodBoolean>;
146
+ range: z.ZodOptional<z.ZodObject<{
147
+ start: z.ZodObject<{
148
+ line: z.ZodNumber;
149
+ character: z.ZodNumber;
150
+ }, z.core.$strip>;
151
+ end: z.ZodObject<{
152
+ line: z.ZodNumber;
153
+ character: z.ZodNumber;
154
+ }, z.core.$strip>;
155
+ }, z.core.$strip>>;
156
+ sortText: z.ZodOptional<z.ZodString>;
157
+ filterText: z.ZodOptional<z.ZodString>;
158
+ preselect: z.ZodOptional<z.ZodBoolean>;
159
+ commitCharacters: z.ZodOptional<z.ZodArray<z.ZodString>>;
160
+ additionalEdits: z.ZodOptional<z.ZodArray<z.ZodObject<{
161
+ range: z.ZodObject<{
162
+ start: z.ZodObject<{
163
+ line: z.ZodNumber;
164
+ character: z.ZodNumber;
165
+ }, z.core.$strip>;
166
+ end: z.ZodObject<{
167
+ line: z.ZodNumber;
168
+ character: z.ZodNumber;
169
+ }, z.core.$strip>;
170
+ }, z.core.$strip>;
171
+ text: z.ZodString;
172
+ }, z.core.$strip>>>;
173
+ data: z.ZodOptional<z.ZodUnknown>;
174
+ }, z.core.$strip>;
175
+ export type CompletionItem = z.infer<typeof CompletionItem>;
176
+ /** `incomplete` when typing on should ask again rather than filter what came. */
177
+ export declare const Completions: z.ZodObject<{
178
+ incomplete: z.ZodBoolean;
179
+ items: z.ZodArray<z.ZodObject<{
180
+ label: z.ZodString;
181
+ kind: z.ZodOptional<z.ZodNumber>;
182
+ detail: z.ZodOptional<z.ZodString>;
183
+ documentation: z.ZodOptional<z.ZodString>;
184
+ insertText: z.ZodString;
185
+ snippet: z.ZodOptional<z.ZodBoolean>;
186
+ range: z.ZodOptional<z.ZodObject<{
187
+ start: z.ZodObject<{
188
+ line: z.ZodNumber;
189
+ character: z.ZodNumber;
190
+ }, z.core.$strip>;
191
+ end: z.ZodObject<{
192
+ line: z.ZodNumber;
193
+ character: z.ZodNumber;
194
+ }, z.core.$strip>;
195
+ }, z.core.$strip>>;
196
+ sortText: z.ZodOptional<z.ZodString>;
197
+ filterText: z.ZodOptional<z.ZodString>;
198
+ preselect: z.ZodOptional<z.ZodBoolean>;
199
+ commitCharacters: z.ZodOptional<z.ZodArray<z.ZodString>>;
200
+ additionalEdits: z.ZodOptional<z.ZodArray<z.ZodObject<{
201
+ range: z.ZodObject<{
202
+ start: z.ZodObject<{
203
+ line: z.ZodNumber;
204
+ character: z.ZodNumber;
205
+ }, z.core.$strip>;
206
+ end: z.ZodObject<{
207
+ line: z.ZodNumber;
208
+ character: z.ZodNumber;
209
+ }, z.core.$strip>;
210
+ }, z.core.$strip>;
211
+ text: z.ZodString;
212
+ }, z.core.$strip>>>;
213
+ data: z.ZodOptional<z.ZodUnknown>;
214
+ }, z.core.$strip>>;
215
+ }, z.core.$strip>;
216
+ export type Completions = z.infer<typeof Completions>;
217
+ export declare const SignatureParameter: z.ZodObject<{
218
+ label: z.ZodUnion<readonly [z.ZodString, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>]>;
219
+ documentation: z.ZodOptional<z.ZodString>;
220
+ }, z.core.$strip>;
221
+ export declare const Signature: z.ZodObject<{
222
+ label: z.ZodString;
223
+ documentation: z.ZodOptional<z.ZodString>;
224
+ parameters: z.ZodArray<z.ZodObject<{
225
+ label: z.ZodUnion<readonly [z.ZodString, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>]>;
226
+ documentation: z.ZodOptional<z.ZodString>;
227
+ }, z.core.$strip>>;
228
+ }, z.core.$strip>;
229
+ export declare const SignatureHelp: z.ZodObject<{
230
+ signatures: z.ZodArray<z.ZodObject<{
231
+ label: z.ZodString;
232
+ documentation: z.ZodOptional<z.ZodString>;
233
+ parameters: z.ZodArray<z.ZodObject<{
234
+ label: z.ZodUnion<readonly [z.ZodString, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>]>;
235
+ documentation: z.ZodOptional<z.ZodString>;
236
+ }, z.core.$strip>>;
237
+ }, z.core.$strip>>;
238
+ activeSignature: z.ZodNumber;
239
+ activeParameter: z.ZodNumber;
240
+ }, z.core.$strip>;
241
+ export type SignatureHelp = z.infer<typeof SignatureHelp>;
242
+ /**
243
+ * How a folder's language server stands: `stopped` before its first file is opened and after it ends, as when nothing
244
+ * held it a while, and `failed` with why when it couldn't start; any file of it opened or changed starts it again.
245
+ */
246
+ export declare const ServerState: z.ZodObject<{
247
+ server: z.ZodEnum<{
248
+ css: "css";
249
+ html: "html";
250
+ json: "json";
251
+ typescript: "typescript";
252
+ }>;
253
+ state: z.ZodEnum<{
254
+ failed: "failed";
255
+ running: "running";
256
+ starting: "starting";
257
+ stopped: "stopped";
258
+ }>;
259
+ error: z.ZodOptional<z.ZodString>;
260
+ }, z.core.$strip>;
261
+ export type ServerState = z.infer<typeof ServerState>;
262
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lsp/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gHAAgH;AAChH,eAAO,MAAM,QAAQ;;;iBAAkF,CAAC;AAExG,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,eAAO,MAAM,KAAK;;;;;;;;;iBAA+C,CAAC;AAElE,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC;AAE1C,mHAAmH;AACnH,eAAO,MAAM,QAAQ;;;;;;;;;;;;iBAA+C,CAAC;AAErE,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,eAAO,MAAM,QAAQ;;;;;;;;;;;;iBAA+C,CAAC;AAErE,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;iBAA2D,CAAC;AAElF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD,eAAO,MAAM,kBAAkB;;;;;EAA+C,CAAC;AAE/E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;iBAUrB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,oEAAoE;AACpE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;iBAAmE,CAAC;AAEhG,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,sDAAsD;AACtD,eAAO,MAAM,KAAK;;;;;;;;;;;;iBAA8D,CAAC;AAEjF,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC;AAE1C,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoBzB,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,iFAAiF;AACjF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAwE,CAAC;AAEjG,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,eAAO,MAAM,kBAAkB;;;iBAI7B,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;;iBAAiH,CAAC;AAExI,eAAO,MAAM,aAAa;;;;;;;;;;;iBAAqH,CAAC;AAEhJ,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;iBAItB,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
@@ -0,0 +1,64 @@
1
+ import { z } from 'zod';
2
+ /** A place in a file, counted from 0, its character in UTF-16 code units as a JavaScript string counts them. */
3
+ export const Position = z.object({ line: z.number().int().min(0), character: z.number().int().min(0) });
4
+ export const Range = z.object({ start: Position, end: Position });
5
+ /** A file by its path in the session's folder, or a whole one for a file outside it, such as a library's types. */
6
+ export const Location = z.object({ path: z.string(), range: Range });
7
+ export const TextEdit = z.object({ range: Range, text: z.string() });
8
+ export const FileEdits = z.object({ path: z.string(), edits: z.array(TextEdit) });
9
+ export const DiagnosticSeverity = z.enum(['error', 'warning', 'info', 'hint']);
10
+ export const Diagnostic = z.object({
11
+ range: Range,
12
+ severity: DiagnosticSeverity,
13
+ message: z.string(),
14
+ /** What found it, such as `ts`. */
15
+ source: z.string().optional(),
16
+ code: z.string().optional(),
17
+ /** Code that is never used, or deprecated, which an editor fades or strikes through. */
18
+ unnecessary: z.boolean().optional(),
19
+ deprecated: z.boolean().optional(),
20
+ });
21
+ /** A file's errors and warnings; an empty list once it has none. */
22
+ export const FileDiagnostics = z.object({ path: z.string(), diagnostics: z.array(Diagnostic) });
23
+ /** What the code under a position is, as Markdown. */
24
+ export const Hover = z.object({ contents: z.string(), range: Range.optional() });
25
+ export const CompletionItem = z.object({
26
+ label: z.string(),
27
+ /** The language server protocol's kind, from 1 for text to 25 for a type parameter. */
28
+ kind: z.number().int().optional(),
29
+ detail: z.string().optional(),
30
+ /** Markdown. */
31
+ documentation: z.string().optional(),
32
+ insertText: z.string(),
33
+ /** `insertText` holds tab stops, as `$1`. */
34
+ snippet: z.boolean().optional(),
35
+ /** What `insertText` replaces; the word at the position when left out. */
36
+ range: Range.optional(),
37
+ sortText: z.string().optional(),
38
+ filterText: z.string().optional(),
39
+ preselect: z.boolean().optional(),
40
+ commitCharacters: z.array(z.string()).optional(),
41
+ /** Edits elsewhere in the file, such as an import the item needs. */
42
+ additionalEdits: z.array(TextEdit).optional(),
43
+ /** The server's own, to send back with `lsp/completion-detail`. */
44
+ data: z.unknown().optional(),
45
+ });
46
+ /** `incomplete` when typing on should ask again rather than filter what came. */
47
+ export const Completions = z.object({ incomplete: z.boolean(), items: z.array(CompletionItem) });
48
+ export const SignatureParameter = z.object({
49
+ /** Its text, or where it is in the signature's label. */
50
+ label: z.union([z.string(), z.tuple([z.number().int(), z.number().int()])]),
51
+ documentation: z.string().optional(),
52
+ });
53
+ export const Signature = z.object({ label: z.string(), documentation: z.string().optional(), parameters: z.array(SignatureParameter) });
54
+ export const SignatureHelp = z.object({ signatures: z.array(Signature), activeSignature: z.number().int(), activeParameter: z.number().int() });
55
+ /**
56
+ * How a folder's language server stands: `stopped` before its first file is opened and after it ends, as when nothing
57
+ * held it a while, and `failed` with why when it couldn't start; any file of it opened or changed starts it again.
58
+ */
59
+ export const ServerState = z.object({
60
+ server: z.enum(['typescript', 'json', 'css', 'html']),
61
+ state: z.enum(['starting', 'running', 'failed', 'stopped']),
62
+ error: z.string().optional(),
63
+ });
64
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/lsp/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gHAAgH;AAChH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAIxG,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;AAIlE,mHAAmH;AACnH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;AAIrE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAIrE,MAAM,CAAC,MAAM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U,sBA4BzC"}
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/map/prompt.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAQ3C,wBAAgB,UAAU,CAAC,GAAG,EAAE,UAAU,sBA6BzC"}
@@ -28,7 +28,8 @@ ${parts.join('\n\n')}
28
28
 
29
29
  - Before you write a new component, hook, helper, class, type, constant, design token or style, look for one that already does the job with \`find_existing\`. Search by what it does and by the other names it could have, since what exists rarely has the name you would give it.
30
30
  - Use what you find, or extend it to cover your case, rather than writing a second one beside it. When nothing fits, put the new one where its kind lives and name it the way its neighbours are named.
31
- - Write what you add the way the project is written and looks above, also where the language or the framework allows another way: its file names, its declarations, its tokens and the classes it already uses. A value the project doesn't have yet, such as a new color, size or radius, is a decision: say that you are adding it and why nothing existing fits.`;
31
+ - Write what you add the way the project is written and looks above, also where the language or the framework allows another way: its file names, its declarations, its tokens and the classes it already uses. A value the project doesn't have yet, such as a new color, size or radius, is a decision: say that you are adding it and why nothing existing fits.
32
+ - Once your changes are done and before your last message, call \`review_turn\`. It holds what this turn wrote against the map; put right what it finds or keep it with a reason, then end with one short report: what changed and how to try it.`;
32
33
  }
33
34
  function offered({ count, files, folders }) {
34
35
  const told = folders.map(({ folder, names, more }) => `${folder}/: ${names.join(', ')}${more > 0 ? `, and ${more} more` : ''}`);
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/map/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,yHAAyH;AACzH,MAAM,SAAS,GACb,yUAAyU,CAAC;AAE5U,MAAM,UAAU,UAAU,CAAC,GAAe;IACxC,MAAM,QAA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AGP,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;;;;;kPAK8N,CAAC;AACnP,CAAC;AAED,SAAS,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAA6B;IACnE,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,GAAG,MAAM,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAChI,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,oDAAoD,EAAE,4DAA4D,CAAC,CAAC;IAEjJ,OAAO,oCAAoC,MAAM,OAAO,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,uFAAuF,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AACnL,CAAC;AAED,MAAM,IAAI,GAAG,CAAC,KAAe,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC"}
@@ -1,23 +1,43 @@
1
1
  import type { ToolCall } from '../agent/tools.js';
2
2
  import type { MappedFiles, ProjectMap } from './map.js';
3
3
  import type { Brief } from './purposes.js';
4
- export interface Review {
5
- points: string[];
6
- /** The points as the agent is told them. */
7
- message: string;
4
+ /** The order the user reads them in: pieces the project had, its habits, then its look. */
5
+ declare const KINDS: readonly ['existing', 'habit', 'look'];
6
+ export type PointKind = (typeof KINDS)[number];
7
+ export interface ReviewPoint {
8
+ kind: PointKind;
9
+ /** The same as the point's when it is found again later in the turn. */
10
+ key: string;
11
+ /** As the agent is told it. */
12
+ text: string;
13
+ /** As the user reads it, in plain words. */
14
+ plain: string;
15
+ path: string;
16
+ /** The piece it is about, for a point about one; it was put right once the file no longer has it. */
17
+ name?: string;
8
18
  }
9
19
  /**
10
20
  * What the files changed since `before` added that the project already had, or that goes against how it is written and
11
- * looks: said to the agent as its turn ends, so it is put right before the user has to notice. `undefined` when
21
+ * looks: said to the agent before its report, so it is put right before the user has to notice. `undefined` when
12
22
  * nothing stands out.
13
23
  */
14
- export declare function review(before: MappedFiles, map: ProjectMap, sameJob?: string[]): Review | undefined;
24
+ export declare function review(before: MappedFiles, map: ProjectMap, sameJob?: ReviewPoint[]): ReviewPoint[] | undefined;
25
+ /** What `review_turn` answers the agent, before its report. */
26
+ export declare function checkMessage(points: ReviewPoint[]): string;
27
+ /** What the agent is told after a report it wrote without checking first; it answers in a few lines, not a second report. */
28
+ export declare function lateMessage(points: ReviewPoint[]): string;
15
29
  /**
16
30
  * The new pieces that do the job of one the project already had under another name, which names can't tell: the
17
31
  * backend's small model is shown each beside the existing pieces closest to it, with their sentences, and says which
18
32
  * does the same. So only where the map has sentences, which is with `describeMap` on.
19
33
  */
20
- export declare function sameJobs(before: MappedFiles, map: ProjectMap, brief: Brief): Promise<string[]>;
21
- /** The review as the conversation shows it, worded alike whichever backend it was sent through. */
22
- export declare function reviewCall({ points }: Review): ToolCall;
34
+ export declare function sameJobs(before: MappedFiles, map: ProjectMap, brief: Brief): Promise<ReviewPoint[]>;
35
+ /**
36
+ * The review as the conversation shows it, worded alike whichever backend it was sent through. With `fixed`, the keys of
37
+ * the points the agent put right, as the turn ends.
38
+ */
39
+ export declare function reviewCall(points: ReviewPoint[], fixed?: Set<string>): ToolCall;
40
+ /** A line for each point, in plain words, with what came of it once the turn ends. */
41
+ export declare function reviewLines(points: ReviewPoint[], fixed?: Set<string>): string[];
42
+ export {};
23
43
  //# sourceMappingURL=review.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/map/review.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAKl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qG;IACrG,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAMD;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,GAAE,WAAW,EAAO,GAAG,WAAW,EAAE,GAAG,SAAS,CA6DnH;AAED,+DAA+D;AAC/D,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,UAQjD;AAED,6HAA6H;AAC7H,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,UAQhD;AAaD;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,0BAoChF;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,KAAK,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,QAAQ,CAK/E;AAED,sFAAsF;AACtF,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,KAAK,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,YAErE"}
@@ -15,9 +15,13 @@ const TOKENS = 5;
15
15
  /** How many of a turn's new pieces the small model is asked about, each a request of its own, beside how many existing ones. */
16
16
  const JUDGED = 3;
17
17
  const CLOSEST = 6;
18
+ /** The order the user reads them in: pieces the project had, its habits, then its look. */
19
+ const KINDS = ['existing', 'habit', 'look'];
20
+ /** The project's way, against which the points are weighed; said with the points wherever they are told. */
21
+ const WEIGH = "The points are about what you chose yourself. What the user asked for in so many words stays exactly as they asked, even where it is new to the project: keep it, and tell them in a line that the project didn't have it. For the rest: where the project already had what you added, use that and remove yours; where the project writes it another way, change yours to match; where your way is needed, leave it and tell the user what you added and why nothing existing fit. A point about a file you didn't write in this turn is about the user's own work: leave the file as it is and only mention it.";
18
22
  /**
19
23
  * What the files changed since `before` added that the project already had, or that goes against how it is written and
20
- * looks: said to the agent as its turn ends, so it is put right before the user has to notice. `undefined` when
24
+ * looks: said to the agent before its report, so it is put right before the user has to notice. `undefined` when
21
25
  * nothing stands out.
22
26
  */
23
27
  export function review(before, map, sameJob = []) {
@@ -44,31 +48,59 @@ export function review(before, map, sameJob = []) {
44
48
  points.push(point);
45
49
  }
46
50
  for (const { side, convention } of strays(habitsOf(path, file.habits), was ? habitsOf(path, was.habits) : {}, habits)) {
47
- points.push(astray(path, side, convention));
51
+ points.push({ kind: 'habit', key: `habit:${path}:${convention.choice}`, path, ...astray(path, side, convention) });
48
52
  }
49
53
  for (const name of Object.keys(file.classes ?? {})) {
50
54
  const members = kept.get(familyOf(name) ?? '');
51
55
  if (!members || knownClasses.has(name) || namesToken(name, named))
52
56
  continue;
53
57
  const used = members.slice(0, CLOSE + 2).map((member) => `${member.name} (${member.uses})`);
54
- points.push(`\`${name}\` in ${path} is new to the project, which keeps to ${used.join(', ')} there. Keep it only if none of those is what is meant.`);
58
+ points.push({
59
+ kind: 'look',
60
+ key: `class:${path}:${name}`,
61
+ path,
62
+ text: `\`${name}\` in ${path} is new to the project, which keeps to ${used.join(', ')} there. Keep it only if none of those is what is meant.`,
63
+ plain: `${name} in ${path} is a class the project doesn't use there; it keeps to ${members.slice(0, CLOSE).map((member) => member.name).join(', ')}`,
64
+ });
55
65
  }
56
66
  if (tokens.length >= TOKENS && (file.colors ?? 0) > (was?.colors ?? 0)) {
57
67
  const added = (file.colors ?? 0) - (was?.colors ?? 0);
58
- points.push(`${path} writes out ${plural(added, 'more color')}, while the project keeps its colors in design tokens (${tokens.length} of them). Use a token, or add one where the others are.`);
68
+ points.push({
69
+ kind: 'look',
70
+ key: `color:${path}`,
71
+ path,
72
+ text: `${path} writes out ${plural(added, 'more color')}, while the project keeps its colors in design tokens (${tokens.length} of them). Use a token, or add one where the others are.`,
73
+ plain: `${path} writes out ${plural(added, 'color')} instead of taking ${added === 1 ? 'a token' : 'tokens'}`,
74
+ });
59
75
  }
60
76
  }
61
77
  if (points.length === 0)
62
78
  return undefined;
63
- const more = points.length > POINTS ? [`And ${plural(points.length - POINTS, 'more point')} of the same kinds.`] : [];
64
- return {
65
- points,
66
- message: `Jinion compared what this turn wrote with its map of the project. Go through each point below before you finish.
79
+ return points.sort((a, b) => KINDS.indexOf(a.kind) - KINDS.indexOf(b.kind));
80
+ }
81
+ /** What `review_turn` answers the agent, before its report. */
82
+ export function checkMessage(points) {
83
+ return `Jinion compared what this turn wrote with its map of the project. Go through each point below now.
67
84
 
68
- The points are about what you chose yourself. What the user asked for in so many words stays exactly as they asked, even where it is new to the project: keep it, and tell them in a line that the project didn't have it. For the rest: where the project already had what you added, use that and remove yours; where the project writes it another way, change yours to match; where your way is needed, leave it and tell the user what you added and why nothing existing fit. A point about a file you didn't write in this turn is about the user's own work: leave the file as it is and only mention it.
85
+ ${WEIGH}
69
86
 
70
- ${[...points.slice(0, POINTS), ...more].map((point) => `- ${point}`).join('\n')}`,
71
- };
87
+ ${listed(points)}
88
+
89
+ Then end with one short report: what changed and how to try it. Mention a point only if you kept it, with why, in a few words.`;
90
+ }
91
+ /** What the agent is told after a report it wrote without checking first; it answers in a few lines, not a second report. */
92
+ export function lateMessage(points) {
93
+ return `Jinion compared what this turn wrote with its map of the project. Go through each point below before you finish.
94
+
95
+ ${WEIGH}
96
+
97
+ ${listed(points)}
98
+
99
+ Answer in a few lines: what you changed, and what you kept and why. Don't repeat your report.`;
100
+ }
101
+ function listed(points) {
102
+ const more = points.length > POINTS ? [`And ${plural(points.length - POINTS, 'more point')} of the same kinds.`] : [];
103
+ return [...points.slice(0, POINTS).map((point) => point.text), ...more].map((line) => `- ${line}`).join('\n');
72
104
  }
73
105
  const JUDGE = `You check whether a newly written piece of code repeats one its codebase already has.
74
106
 
@@ -96,14 +128,30 @@ export async function sameJobs(before, map, brief) {
96
128
  const answer = await brief(JUDGE, `The new piece, ${piece.name} (${piece.kind}) in ${piece.path}:\n\`\`\`\n${code}\n\`\`\`\n\nThe existing pieces:\n${listed}`);
97
129
  const same = closest[Number(/\d+/.exec(answer ?? '')?.[0] ?? 0) - 1];
98
130
  if (same) {
99
- points.push(`\`${piece.name}\` (${piece.kind}) in ${piece.path}:${piece.line} does the job of \`${same.name}\` ${place(same)}, which the project already had: ${same.purpose}`);
131
+ points.push({
132
+ kind: 'existing',
133
+ key: `existing:${piece.path}:${piece.name}`,
134
+ path: piece.path,
135
+ name: piece.name,
136
+ text: `\`${piece.name}\` (${piece.kind}) in ${piece.path}:${piece.line} does the job of \`${same.name}\` ${place(same)}, which the project already had: ${same.purpose}`,
137
+ plain: `New ${piece.name} does the job of the existing ${same.name} ${usedIn(same)}`,
138
+ });
100
139
  }
101
140
  }
102
141
  return points;
103
142
  }
104
- /** The review as the conversation shows it, worded alike whichever backend it was sent through. */
105
- export function reviewCall({ points }) {
106
- return { name: 'other', input: { title: 'Review what the turn added', detail: plural(points.length, 'point') } };
143
+ /**
144
+ * The review as the conversation shows it, worded alike whichever backend it was sent through. With `fixed`, the keys of
145
+ * the points the agent put right, as the turn ends.
146
+ */
147
+ export function reviewCall(points, fixed) {
148
+ const things = plural(points.length, 'thing');
149
+ const put = fixed && points.filter((point) => fixed.has(point.key)).length;
150
+ return { name: 'other', input: { title: 'Checked against the project', detail: put ? `${things}, ${put} fixed` : things } };
151
+ }
152
+ /** A line for each point, in plain words, with what came of it once the turn ends. */
153
+ export function reviewLines(points, fixed) {
154
+ return points.map((point) => (fixed ? `${fixed.has(point.key) ? 'Fixed' : 'Kept'}: ${point.plain}` : point.plain));
107
155
  }
108
156
  /**
109
157
  * The same name elsewhere, or a piece whose name says nothing the new one's doesn't: `Button` for a new `SubmitButton`,
@@ -114,8 +162,14 @@ function alike(added, entries) {
114
162
  const others = entries.filter((entry) => entry.kind === added.kind && entry.path !== added.path);
115
163
  const same = others.filter((entry) => entry.name.toLowerCase() === added.name.toLowerCase());
116
164
  const where = `\`${added.name}\` (${added.kind}) in ${added.path}:${added.line}`;
117
- if (same.length > 0)
118
- return `${where}: the project already has one by that name, ${same.slice(0, CLOSE).map(place).join(' and ')}.`;
165
+ const point = { kind: 'existing', key: `existing:${added.path}:${added.name}`, path: added.path, name: added.name };
166
+ if (same.length > 0) {
167
+ return {
168
+ ...point,
169
+ text: `${where}: the project already has one by that name, ${same.slice(0, CLOSE).map(place).join(' and ')}.`,
170
+ plain: `New ${added.name} repeats the ${same[0].name} the project already has ${usedIn(same[0])}`,
171
+ };
172
+ }
119
173
  const about = significant(added.name);
120
174
  const close = others
121
175
  .filter((entry) => {
@@ -124,18 +178,44 @@ function alike(added, entries) {
124
178
  })
125
179
  .sort((a, b) => b.users - a.users)
126
180
  .slice(0, CLOSE);
127
- return close.length > 0 ? `${where} is close to what exists: ${close.map((entry) => `\`${entry.name}\` ${place(entry)}`).join(', ')}.` : undefined;
181
+ if (close.length === 0)
182
+ return undefined;
183
+ return {
184
+ ...point,
185
+ text: `${where} is close to what exists: ${close.map((entry) => `\`${entry.name}\` ${place(entry)}`).join(', ')}.`,
186
+ plain: `New ${added.name} looks like the existing ${close[0].name} ${usedIn(close[0])}`,
187
+ };
128
188
  }
189
+ /** For the agent with the share that makes it the project's habit, for the user in plain words. */
129
190
  function astray(path, side, { choice, side: usual, count, total }) {
130
191
  const share = `${percent(count, total)} of ${grouped(total)}`;
131
- if (choice.startsWith('file:'))
132
- return `${path} is named in ${side}, while the project names its \`${choice.slice('file:'.length)}\` files in ${usual} (${share}).`;
133
- if (choice === 'shape')
134
- return `${path} declares an object shape with \`${side}\`, while the project uses \`${usual}\` (${share}).`;
135
- if (choice === 'export')
136
- return `${path} exports ${side === 'default' ? 'a default' : 'by name'}, while the project's modules export ${usual === 'default' ? 'a default' : 'by name'} (${share}).`;
137
- return `${path} writes a top-level function as ${side === 'arrow' ? 'an arrow function in a constant' : 'a `function` declaration'}, while the project writes ${usual === 'arrow' ? 'arrow functions in constants' : '`function` declarations'} (${share}).`;
192
+ if (choice.startsWith('file:')) {
193
+ const extension = choice.slice('file:'.length);
194
+ return {
195
+ text: `${path} is named in ${side}, while the project names its \`${extension}\` files in ${usual} (${share}).`,
196
+ plain: `${path} is named in ${side}, while the project's ${extension} files are in ${usual}`,
197
+ };
198
+ }
199
+ if (choice === 'shape') {
200
+ return {
201
+ text: `${path} declares an object shape with \`${side}\`, while the project uses \`${usual}\` (${share}).`,
202
+ plain: `${path} declares a shape with ${side}, while the project uses ${usual}`,
203
+ };
204
+ }
205
+ if (choice === 'export') {
206
+ const how = (way) => (way === 'default' ? 'a default' : 'by name');
207
+ return {
208
+ text: `${path} exports ${how(side)}, while the project's modules export ${how(usual)} (${share}).`,
209
+ plain: `${path} exports ${how(side)}, while the project exports ${how(usual)}`,
210
+ };
211
+ }
212
+ const how = (way) => (way === 'arrow' ? 'arrow functions' : 'function declarations');
213
+ return {
214
+ text: `${path} writes a top-level function as ${side === 'arrow' ? 'an arrow function in a constant' : 'a `function` declaration'}, while the project writes ${usual === 'arrow' ? 'arrow functions in constants' : '`function` declarations'} (${share}).`,
215
+ plain: `${path} writes ${how(side)}, while the project writes ${how(usual)}`,
216
+ };
138
217
  }
139
218
  const significant = (name) => words(name).filter((word) => !COMMON.has(word));
140
219
  const place = (entry) => `in ${entry.path}:${entry.line} (used in ${plural(entry.users, 'file')})`;
220
+ const usedIn = (entry) => `(used in ${plural(entry.users, 'file')})`;
141
221
  //# sourceMappingURL=review.js.map