cuelo 0.10.52 → 0.10.53

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 (484) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +35 -35
  3. package/.next/build-manifest.json +4 -4
  4. package/.next/next-server.js.nft.json +1 -1
  5. package/.next/prerender-manifest.json +3 -3
  6. package/.next/react-loadable-manifest.json +549 -561
  7. package/.next/required-server-files.js +25 -25
  8. package/.next/required-server-files.json +25 -25
  9. package/.next/server/app/_global-error/page.js +3 -3
  10. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  11. package/.next/server/app/_global-error.html +1 -1
  12. package/.next/server/app/_global-error.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  16. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  17. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  18. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  19. package/.next/server/app/_not-found/page.js +2 -2
  20. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  21. package/.next/server/app/_not-found.html +1 -1
  22. package/.next/server/app/_not-found.rsc +2 -2
  23. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  24. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  25. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  26. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  27. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  28. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  29. package/.next/server/app/api/agent/[id]/account/route.js +1 -1
  30. package/.next/server/app/api/agent/[id]/account/route_client-reference-manifest.js +1 -1
  31. package/.next/server/app/api/agent/[id]/bash-output/route.js +1 -1
  32. package/.next/server/app/api/agent/[id]/bash-output/route_client-reference-manifest.js +1 -1
  33. package/.next/server/app/api/agent/[id]/events/route.js +2 -2
  34. package/.next/server/app/api/agent/[id]/events/route_client-reference-manifest.js +1 -1
  35. package/.next/server/app/api/agent/[id]/route.js +1 -1
  36. package/.next/server/app/api/agent/[id]/route_client-reference-manifest.js +1 -1
  37. package/.next/server/app/api/agent/new/route.js +1 -1
  38. package/.next/server/app/api/agent/new/route_client-reference-manifest.js +1 -1
  39. package/.next/server/app/api/agent/running/route.js +1 -1
  40. package/.next/server/app/api/agent/running/route_client-reference-manifest.js +1 -1
  41. package/.next/server/app/api/attachment-settings/route.js +1 -1
  42. package/.next/server/app/api/attachment-settings/route_client-reference-manifest.js +1 -1
  43. package/.next/server/app/api/attachments/[id]/transcription/route.js +2 -2
  44. package/.next/server/app/api/attachments/[id]/transcription/route_client-reference-manifest.js +1 -1
  45. package/.next/server/app/api/attachments/draft/route.js +1 -1
  46. package/.next/server/app/api/attachments/draft/route_client-reference-manifest.js +1 -1
  47. package/.next/server/app/api/attachments/route.js +2 -2
  48. package/.next/server/app/api/attachments/route_client-reference-manifest.js +1 -1
  49. package/.next/server/app/api/auth/all-providers/route.js +1 -1
  50. package/.next/server/app/api/auth/all-providers/route_client-reference-manifest.js +1 -1
  51. package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -1
  52. package/.next/server/app/api/auth/api-key/[provider]/route_client-reference-manifest.js +1 -1
  53. package/.next/server/app/api/auth/login/[provider]/route.js +1 -1
  54. package/.next/server/app/api/auth/login/[provider]/route_client-reference-manifest.js +1 -1
  55. package/.next/server/app/api/auth/logout/[provider]/route.js +1 -1
  56. package/.next/server/app/api/auth/logout/[provider]/route_client-reference-manifest.js +1 -1
  57. package/.next/server/app/api/auth/providers/route.js +1 -1
  58. package/.next/server/app/api/auth/providers/route_client-reference-manifest.js +1 -1
  59. package/.next/server/app/api/character-mode/route.js +1 -2
  60. package/.next/server/app/api/character-mode/route.js.nft.json +1 -1
  61. package/.next/server/app/api/character-mode/route_client-reference-manifest.js +1 -1
  62. package/.next/server/app/api/cwd/browse/route.js +1 -1
  63. package/.next/server/app/api/cwd/browse/route_client-reference-manifest.js +1 -1
  64. package/.next/server/app/api/cwd/validate/route.js +1 -1
  65. package/.next/server/app/api/cwd/validate/route_client-reference-manifest.js +1 -1
  66. package/.next/server/app/api/default-cwd/route.js +1 -1
  67. package/.next/server/app/api/default-cwd/route_client-reference-manifest.js +1 -1
  68. package/.next/server/app/api/display-settings/route.js +1 -1
  69. package/.next/server/app/api/display-settings/route_client-reference-manifest.js +1 -1
  70. package/.next/server/app/api/document-text/route.js +2 -2
  71. package/.next/server/app/api/document-text/route_client-reference-manifest.js +1 -1
  72. package/.next/server/app/api/experiments/route.js +1 -1
  73. package/.next/server/app/api/experiments/route_client-reference-manifest.js +1 -1
  74. package/.next/server/app/api/file-index/route.js +1 -1
  75. package/.next/server/app/api/file-index/route_client-reference-manifest.js +1 -1
  76. package/.next/server/app/api/files/[...path]/route.js +1 -1
  77. package/.next/server/app/api/files/[...path]/route_client-reference-manifest.js +1 -1
  78. package/.next/server/app/api/git/diff/route.js +1 -1
  79. package/.next/server/app/api/git/diff/route_client-reference-manifest.js +1 -1
  80. package/.next/server/app/api/git/status/route.js +2 -2
  81. package/.next/server/app/api/git/status/route_client-reference-manifest.js +1 -1
  82. package/.next/server/app/api/github/projects/route.js +1 -1
  83. package/.next/server/app/api/github/projects/route_client-reference-manifest.js +1 -1
  84. package/.next/server/app/api/gpt6/handles/route.js +1 -1
  85. package/.next/server/app/api/gpt6/handles/route_client-reference-manifest.js +1 -1
  86. package/.next/server/app/api/gpt6/reply/route.js +1 -1
  87. package/.next/server/app/api/gpt6/reply/route_client-reference-manifest.js +1 -1
  88. package/.next/server/app/api/gpt6/token/route.js +1 -1
  89. package/.next/server/app/api/gpt6/token/route_client-reference-manifest.js +1 -1
  90. package/.next/server/app/api/gpt6/web6-session/route.js +1 -1
  91. package/.next/server/app/api/gpt6/web6-session/route_client-reference-manifest.js +1 -1
  92. package/.next/server/app/api/home/route.js +1 -1
  93. package/.next/server/app/api/home/route_client-reference-manifest.js +1 -1
  94. package/.next/server/app/api/live/call/[callId]/route.js +2 -2
  95. package/.next/server/app/api/live/call/[callId]/route.js.nft.json +1 -1
  96. package/.next/server/app/api/live/call/[callId]/route_client-reference-manifest.js +1 -1
  97. package/.next/server/app/api/live/events/route.js +2 -2
  98. package/.next/server/app/api/live/events/route.js.nft.json +1 -1
  99. package/.next/server/app/api/live/events/route_client-reference-manifest.js +1 -1
  100. package/.next/server/app/api/live/interpret/route.js +2 -2
  101. package/.next/server/app/api/live/interpret/route.js.nft.json +1 -1
  102. package/.next/server/app/api/live/interpret/route_client-reference-manifest.js +1 -1
  103. package/.next/server/app/api/live/offer/route.js +1 -1
  104. package/.next/server/app/api/live/offer/route.js.nft.json +1 -1
  105. package/.next/server/app/api/live/offer/route_client-reference-manifest.js +1 -1
  106. package/.next/server/app/api/live/voices/route.js +1 -1
  107. package/.next/server/app/api/live/voices/route.js.nft.json +1 -1
  108. package/.next/server/app/api/live/voices/route_client-reference-manifest.js +1 -1
  109. package/.next/server/app/api/mcp/route.js +2 -2
  110. package/.next/server/app/api/mcp/route_client-reference-manifest.js +1 -1
  111. package/.next/server/app/api/model-roles/route.js +1 -1
  112. package/.next/server/app/api/model-roles/route_client-reference-manifest.js +1 -1
  113. package/.next/server/app/api/models/route.js +1 -1
  114. package/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
  115. package/.next/server/app/api/models-config/catalog/route.js +1 -1
  116. package/.next/server/app/api/models-config/catalog/route_client-reference-manifest.js +1 -1
  117. package/.next/server/app/api/models-config/discover/route.js +1 -1
  118. package/.next/server/app/api/models-config/discover/route_client-reference-manifest.js +1 -1
  119. package/.next/server/app/api/models-config/route.js +3 -3
  120. package/.next/server/app/api/models-config/route_client-reference-manifest.js +1 -1
  121. package/.next/server/app/api/models-config/test/route.js +1 -1
  122. package/.next/server/app/api/models-config/test/route_client-reference-manifest.js +1 -1
  123. package/.next/server/app/api/office-characters/[...path]/route.js +1 -2
  124. package/.next/server/app/api/office-characters/[...path]/route.js.nft.json +1 -1
  125. package/.next/server/app/api/office-characters/[...path]/route_client-reference-manifest.js +1 -1
  126. package/.next/server/app/api/plugins/route.js +1 -1
  127. package/.next/server/app/api/plugins/route_client-reference-manifest.js +1 -1
  128. package/.next/server/app/api/project-docs/route.js +1 -1
  129. package/.next/server/app/api/project-docs/route_client-reference-manifest.js +1 -1
  130. package/.next/server/app/api/project-trust/route.js +1 -1
  131. package/.next/server/app/api/project-trust/route_client-reference-manifest.js +1 -1
  132. package/.next/server/app/api/projects/route.js +2 -2
  133. package/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
  134. package/.next/server/app/api/runs/[runId]/prelude/route.js +1 -1
  135. package/.next/server/app/api/runs/[runId]/prelude/route_client-reference-manifest.js +1 -1
  136. package/.next/server/app/api/runs/[runId]/route.js +1 -1
  137. package/.next/server/app/api/runs/[runId]/route_client-reference-manifest.js +1 -1
  138. package/.next/server/app/api/runs/[runId]/turns/route.js +1 -1
  139. package/.next/server/app/api/runs/[runId]/turns/route_client-reference-manifest.js +1 -1
  140. package/.next/server/app/api/runs/route.js +1 -1
  141. package/.next/server/app/api/runs/route_client-reference-manifest.js +1 -1
  142. package/.next/server/app/api/sessions/[id]/auto-name/route.js +1 -1
  143. package/.next/server/app/api/sessions/[id]/auto-name/route_client-reference-manifest.js +1 -1
  144. package/.next/server/app/api/sessions/[id]/context/route.js +1 -1
  145. package/.next/server/app/api/sessions/[id]/context/route_client-reference-manifest.js +1 -1
  146. package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route.js +1 -1
  147. package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route_client-reference-manifest.js +1 -1
  148. package/.next/server/app/api/sessions/[id]/export/route.js +1 -1
  149. package/.next/server/app/api/sessions/[id]/export/route_client-reference-manifest.js +1 -1
  150. package/.next/server/app/api/sessions/[id]/route.js +1 -1
  151. package/.next/server/app/api/sessions/[id]/route_client-reference-manifest.js +1 -1
  152. package/.next/server/app/api/sessions/[id]/state/route.js +1 -1
  153. package/.next/server/app/api/sessions/[id]/state/route_client-reference-manifest.js +1 -1
  154. package/.next/server/app/api/sessions/route.js +1 -1
  155. package/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
  156. package/.next/server/app/api/sessions/search/route.js +1 -1
  157. package/.next/server/app/api/sessions/search/route_client-reference-manifest.js +1 -1
  158. package/.next/server/app/api/settings/route.js +1 -1
  159. package/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  160. package/.next/server/app/api/sidecars/[service]/[...path]/route.js +1 -1
  161. package/.next/server/app/api/sidecars/[service]/[...path]/route_client-reference-manifest.js +1 -1
  162. package/.next/server/app/api/skills/check/route.js +1 -1
  163. package/.next/server/app/api/skills/check/route_client-reference-manifest.js +1 -1
  164. package/.next/server/app/api/skills/install/route.js +2 -2
  165. package/.next/server/app/api/skills/install/route_client-reference-manifest.js +1 -1
  166. package/.next/server/app/api/skills/route.js +1 -1
  167. package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  168. package/.next/server/app/api/skills/search/route.js +1 -1
  169. package/.next/server/app/api/skills/search/route_client-reference-manifest.js +1 -1
  170. package/.next/server/app/api/skills/update/route.js +1 -1
  171. package/.next/server/app/api/skills/update/route_client-reference-manifest.js +1 -1
  172. package/.next/server/app/api/subagents/eta/route.js +1 -1
  173. package/.next/server/app/api/subagents/eta/route_client-reference-manifest.js +1 -1
  174. package/.next/server/app/api/theme/route.js +1 -1
  175. package/.next/server/app/api/theme/route_client-reference-manifest.js +1 -1
  176. package/.next/server/app/api/tool-image/route.js +1 -1
  177. package/.next/server/app/api/tool-image/route_client-reference-manifest.js +1 -1
  178. package/.next/server/app/api/update-maintenance/route.js +2 -2
  179. package/.next/server/app/api/update-maintenance/route_client-reference-manifest.js +1 -1
  180. package/.next/server/app/api/updates/route.js +1 -1
  181. package/.next/server/app/api/updates/route_client-reference-manifest.js +1 -1
  182. package/.next/server/app/api/web-access/recovery/route.js +1 -1
  183. package/.next/server/app/api/web-access/recovery/route_client-reference-manifest.js +1 -1
  184. package/.next/server/app/api/web-access/route.js +1 -1
  185. package/.next/server/app/api/web-access/route_client-reference-manifest.js +1 -1
  186. package/.next/server/app/api/web6/consults/route.js +1 -1
  187. package/.next/server/app/api/web6/consults/route_client-reference-manifest.js +1 -1
  188. package/.next/server/app/api/worktrees/route.js +1 -1
  189. package/.next/server/app/api/worktrees/route_client-reference-manifest.js +1 -1
  190. package/.next/server/app/favicon.ico/route.js +1 -1
  191. package/.next/server/app/index.html +1 -1
  192. package/.next/server/app/index.rsc +4 -4
  193. package/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  194. package/.next/server/app/index.segments/_full.segment.rsc +4 -4
  195. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  196. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  197. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  198. package/.next/server/app/manifest.webmanifest/route.js +2 -2
  199. package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
  200. package/.next/server/app/page.js +5 -5
  201. package/.next/server/app/page_client-reference-manifest.js +1 -1
  202. package/.next/server/app/recover/page.js +2 -2
  203. package/.next/server/app/recover/page_client-reference-manifest.js +1 -1
  204. package/.next/server/app/recover.html +1 -1
  205. package/.next/server/app/recover.rsc +3 -3
  206. package/.next/server/app/recover.segments/_full.segment.rsc +3 -3
  207. package/.next/server/app/recover.segments/_head.segment.rsc +1 -1
  208. package/.next/server/app/recover.segments/_index.segment.rsc +2 -2
  209. package/.next/server/app/recover.segments/_tree.segment.rsc +1 -1
  210. package/.next/server/app/recover.segments/recover/__PAGE__.segment.rsc +2 -2
  211. package/.next/server/app/recover.segments/recover.segment.rsc +1 -1
  212. package/.next/server/app-paths-manifest.json +35 -35
  213. package/.next/server/chunks/1008.js +2 -2
  214. package/.next/server/chunks/1966.js +2 -0
  215. package/.next/server/chunks/319.js +3 -3
  216. package/.next/server/chunks/6429.js +2 -2
  217. package/.next/server/chunks/6775.js +7 -0
  218. package/.next/server/middleware-build-manifest.js +1 -1
  219. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  220. package/.next/server/middleware.js +9 -9
  221. package/.next/server/pages/404.html +1 -1
  222. package/.next/server/pages/500.html +1 -1
  223. package/.next/server/server-reference-manifest.json +1 -1
  224. package/.next/static/chunks/app/_not-found/page-041b64675adcdf82.js +1 -0
  225. package/.next/static/chunks/app/layout-3b1f8b74c7fc5e77.js +1 -0
  226. package/.next/static/chunks/app/{page-3640086c732eb87d.js → page-efae4fdcf84b7a14.js} +4 -4
  227. package/.next/static/chunks/app/recover/{page-c0c40b3c215078a4.js → page-2bcd6a351f3eda3d.js} +1 -1
  228. package/.next/static/chunks/{main-app-fbc4aa3c15d48613.js → main-app-ca46ab75db2b4e4b.js} +1 -1
  229. package/.next/static/chunks/main-dd4c9daba44bef88.js +5 -0
  230. package/.next/static/chunks/next/dist/client/components/builtin/global-error-dac2a58a3b9eb28e.js +1 -0
  231. package/.next/static/chunks/webpack-546c8221d1906945.js +1 -0
  232. package/.next/trace +107 -107
  233. package/.next/trace-build +1 -1
  234. package/.next/types/app/api/agent/[id]/account/route.ts +1 -1
  235. package/.next/types/app/api/agent/[id]/bash-output/route.ts +1 -1
  236. package/.next/types/app/api/agent/[id]/events/route.ts +1 -1
  237. package/.next/types/app/api/agent/[id]/route.ts +1 -1
  238. package/.next/types/app/api/agent/new/route.ts +1 -1
  239. package/.next/types/app/api/agent/running/route.ts +1 -1
  240. package/.next/types/app/api/attachment-settings/route.ts +1 -1
  241. package/.next/types/app/api/attachments/[id]/transcription/route.ts +1 -1
  242. package/.next/types/app/api/attachments/draft/route.ts +1 -1
  243. package/.next/types/app/api/attachments/route.ts +1 -1
  244. package/.next/types/app/api/auth/all-providers/route.ts +1 -1
  245. package/.next/types/app/api/auth/api-key/[provider]/route.ts +1 -1
  246. package/.next/types/app/api/auth/login/[provider]/route.ts +1 -1
  247. package/.next/types/app/api/auth/logout/[provider]/route.ts +1 -1
  248. package/.next/types/app/api/auth/providers/route.ts +1 -1
  249. package/.next/types/app/api/character-mode/route.ts +1 -1
  250. package/.next/types/app/api/cwd/browse/route.ts +1 -1
  251. package/.next/types/app/api/cwd/validate/route.ts +1 -1
  252. package/.next/types/app/api/default-cwd/route.ts +1 -1
  253. package/.next/types/app/api/display-settings/route.ts +1 -1
  254. package/.next/types/app/api/document-text/route.ts +1 -1
  255. package/.next/types/app/api/experiments/route.ts +1 -1
  256. package/.next/types/app/api/file-index/route.ts +1 -1
  257. package/.next/types/app/api/files/[...path]/route.ts +1 -1
  258. package/.next/types/app/api/git/diff/route.ts +1 -1
  259. package/.next/types/app/api/git/status/route.ts +1 -1
  260. package/.next/types/app/api/github/projects/route.ts +1 -1
  261. package/.next/types/app/api/gpt6/handles/route.ts +1 -1
  262. package/.next/types/app/api/gpt6/reply/route.ts +1 -1
  263. package/.next/types/app/api/gpt6/token/route.ts +1 -1
  264. package/.next/types/app/api/gpt6/web6-session/route.ts +1 -1
  265. package/.next/types/app/api/home/route.ts +1 -1
  266. package/.next/types/app/api/live/call/[callId]/route.ts +1 -1
  267. package/.next/types/app/api/live/events/route.ts +1 -1
  268. package/.next/types/app/api/live/interpret/route.ts +1 -1
  269. package/.next/types/app/api/live/offer/route.ts +1 -1
  270. package/.next/types/app/api/live/voices/route.ts +1 -1
  271. package/.next/types/app/api/mcp/route.ts +1 -1
  272. package/.next/types/app/api/model-roles/route.ts +1 -1
  273. package/.next/types/app/api/models/route.ts +1 -1
  274. package/.next/types/app/api/models-config/catalog/route.ts +1 -1
  275. package/.next/types/app/api/models-config/discover/route.ts +1 -1
  276. package/.next/types/app/api/models-config/route.ts +1 -1
  277. package/.next/types/app/api/models-config/test/route.ts +1 -1
  278. package/.next/types/app/api/office-characters/[...path]/route.ts +1 -1
  279. package/.next/types/app/api/plugins/route.ts +1 -1
  280. package/.next/types/app/api/project-docs/route.ts +1 -1
  281. package/.next/types/app/api/project-trust/route.ts +1 -1
  282. package/.next/types/app/api/projects/route.ts +1 -1
  283. package/.next/types/app/api/runs/[runId]/prelude/route.ts +1 -1
  284. package/.next/types/app/api/runs/[runId]/route.ts +1 -1
  285. package/.next/types/app/api/runs/[runId]/turns/route.ts +1 -1
  286. package/.next/types/app/api/runs/route.ts +1 -1
  287. package/.next/types/app/api/sessions/[id]/auto-name/route.ts +1 -1
  288. package/.next/types/app/api/sessions/[id]/context/route.ts +1 -1
  289. package/.next/types/app/api/sessions/[id]/entries/[entryId]/thinking/route.ts +1 -1
  290. package/.next/types/app/api/sessions/[id]/export/route.ts +1 -1
  291. package/.next/types/app/api/sessions/[id]/route.ts +1 -1
  292. package/.next/types/app/api/sessions/[id]/state/route.ts +1 -1
  293. package/.next/types/app/api/sessions/route.ts +1 -1
  294. package/.next/types/app/api/sessions/search/route.ts +1 -1
  295. package/.next/types/app/api/settings/route.ts +1 -1
  296. package/.next/types/app/api/sidecars/[service]/[...path]/route.ts +1 -1
  297. package/.next/types/app/api/skills/check/route.ts +1 -1
  298. package/.next/types/app/api/skills/install/route.ts +1 -1
  299. package/.next/types/app/api/skills/route.ts +1 -1
  300. package/.next/types/app/api/skills/search/route.ts +1 -1
  301. package/.next/types/app/api/skills/update/route.ts +1 -1
  302. package/.next/types/app/api/subagents/eta/route.ts +1 -1
  303. package/.next/types/app/api/theme/route.ts +1 -1
  304. package/.next/types/app/api/tool-image/route.ts +1 -1
  305. package/.next/types/app/api/update-maintenance/route.ts +1 -1
  306. package/.next/types/app/api/updates/route.ts +1 -1
  307. package/.next/types/app/api/web-access/recovery/route.ts +1 -1
  308. package/.next/types/app/api/web-access/route.ts +1 -1
  309. package/.next/types/app/api/web6/consults/route.ts +1 -1
  310. package/.next/types/app/api/worktrees/route.ts +1 -1
  311. package/.next/types/app/layout.ts +1 -1
  312. package/.next/types/app/page.ts +1 -1
  313. package/.next/types/app/recover/page.ts +1 -1
  314. package/LICENSE +22 -22
  315. package/README.md +273 -271
  316. package/Tools/CUELO_Setup/files/btw-server.js +346 -346
  317. package/Tools/CUELO_Setup/files/native-runtime-patch.js +238 -238
  318. package/Tools/CUELO_Setup/files/subagent-server.js +587 -587
  319. package/Tools/CUELO_Setup/files/usage-server.js +1057 -1057
  320. package/Tools/OMP_Global_Config/agent/AGENTS.md +144 -144
  321. package/Tools/OMP_Global_Config/agent/RULES.md +140 -140
  322. package/Tools/OMP_Global_Config/agent/TITLE_SYSTEM.md +17 -17
  323. package/Tools/OMP_Global_Config/agent/WATCHDOG.md +55 -55
  324. package/Tools/OMP_Global_Config/agent/agents/maker.md +413 -413
  325. package/Tools/OMP_Global_Config/agent/extensions/character-voice.ts +1035 -1035
  326. package/Tools/OMP_Global_Config/agent/extensions/command-guard/index.ts +1110 -1110
  327. package/Tools/OMP_Global_Config/agent/extensions/command-guard/interop-hint.ts +133 -133
  328. package/Tools/OMP_Global_Config/agent/extensions/command-guard/matcher.ts +2258 -2258
  329. package/Tools/OMP_Global_Config/agent/extensions/command-guard/powershell-syntax.ts +210 -210
  330. package/Tools/OMP_Global_Config/agent/extensions/command-guard/task-guard.ts +1137 -1121
  331. package/Tools/OMP_Global_Config/agent/extensions/cross-review.ts +132 -132
  332. package/Tools/OMP_Global_Config/agent/extensions/docmap-route.ts +133 -133
  333. package/Tools/OMP_Global_Config/agent/extensions/draft/markdown.ts +226 -226
  334. package/Tools/OMP_Global_Config/agent/extensions/draft/ooxml.ts +222 -222
  335. package/Tools/OMP_Global_Config/agent/extensions/draft/pdf.ts +63 -63
  336. package/Tools/OMP_Global_Config/agent/extensions/draft/zip.ts +73 -73
  337. package/Tools/OMP_Global_Config/agent/extensions/draft.ts +204 -204
  338. package/Tools/OMP_Global_Config/agent/extensions/edit-lessons.ts +159 -159
  339. package/Tools/OMP_Global_Config/agent/extensions/external-advice-check.ts +36 -36
  340. package/Tools/OMP_Global_Config/agent/extensions/gitnexus-autosync.ts +406 -406
  341. package/Tools/OMP_Global_Config/agent/extensions/image-question-router.ts +55 -55
  342. package/Tools/OMP_Global_Config/agent/extensions/jev-runtime.ts +2700 -2700
  343. package/Tools/OMP_Global_Config/agent/extensions/korean-reply-guard.ts +190 -190
  344. package/Tools/OMP_Global_Config/agent/extensions/lib/cross-review.ts +1208 -1208
  345. package/Tools/OMP_Global_Config/agent/extensions/lib/docmap-search.ts +612 -612
  346. package/Tools/OMP_Global_Config/agent/extensions/lib/job-observation.ts +182 -182
  347. package/Tools/OMP_Global_Config/agent/extensions/lib/maker-routing.ts +1332 -1332
  348. package/Tools/OMP_Global_Config/agent/extensions/lib/mcp-selection.ts +361 -361
  349. package/Tools/OMP_Global_Config/agent/extensions/lib/memory-excerpt.ts +5 -5
  350. package/Tools/OMP_Global_Config/agent/extensions/lib/native-judge.ts +113 -113
  351. package/Tools/OMP_Global_Config/agent/extensions/lib/prepared-task.ts +211 -211
  352. package/Tools/OMP_Global_Config/agent/extensions/lib/routing-ledger.ts +538 -538
  353. package/Tools/OMP_Global_Config/agent/extensions/lib/session-identity.ts +34 -34
  354. package/Tools/OMP_Global_Config/agent/extensions/lib/task-progress.ts +492 -492
  355. package/Tools/OMP_Global_Config/agent/extensions/mcp-selection.ts +301 -301
  356. package/Tools/OMP_Global_Config/agent/extensions/prompt-compact.ts +67 -67
  357. package/Tools/OMP_Global_Config/agent/extensions/report-chart-guard.ts +102 -102
  358. package/Tools/OMP_Global_Config/agent/extensions/skim.ts +332 -332
  359. package/Tools/OMP_Global_Config/agent/extensions/steering-reply-gate.ts +207 -207
  360. package/Tools/OMP_Global_Config/agent/extensions/todo-nudge.ts +80 -80
  361. package/Tools/OMP_Global_Config/agent/extensions/turn-end-guard.ts +421 -421
  362. package/Tools/OMP_Global_Config/agent/prompt-copies/AGENTS.en.md +147 -147
  363. package/Tools/OMP_Global_Config/agent/prompt-copies/RULES.en.md +49 -49
  364. package/Tools/OMP_Global_Config/agent/rules/docs-handoff.md +39 -39
  365. package/Tools/OMP_Global_Config/agent/rules/frontend.md +74 -74
  366. package/Tools/OMP_Global_Config/agent/rules/harness-policy.json +1224 -1224
  367. package/Tools/OMP_Global_Config/agent/rules/legacy-encoding.md +21 -21
  368. package/Tools/OMP_Global_Config/agent/rules/meta-harness.md +45 -45
  369. package/Tools/OMP_Global_Config/agent/rules/omp-harness.md +151 -151
  370. package/Tools/OMP_Global_Config/agent/rules/subagent.md +750 -750
  371. package/Tools/OMP_Global_Config/agent/rules/task-guard.md +62 -62
  372. package/Tools/OMP_Global_Config/agent/rules/verdict.md +210 -210
  373. package/Tools/OMP_Global_Config/agent/rules/web6-consult.md +83 -83
  374. package/Tools/OMP_Global_Config/agent/sop/_common.md +136 -136
  375. package/Tools/OMP_Global_Config/agent/sop/_writer.md +259 -259
  376. package/Tools/OMP_Global_Config/agent/sop/maker.md +9 -9
  377. package/Tools/OMP_Global_Config/agent/tools/git-finalizer/finalizer.ps1 +409 -409
  378. package/Tools/OMP_Global_Config/agent/tools/git-finalizer/index.ts +303 -303
  379. package/Tools/OMP_Global_Config/agent/tools/git-finalizer/sync-checkout.ts +184 -184
  380. package/Tools/OMP_Global_Config/agent/tools/git-finalizer/wsl-git.ts +96 -96
  381. package/Tools/OMP_Global_Config/agent/tools/windows-build/index.ts +387 -387
  382. package/Tools/OMP_Global_Config/agent/tools/windows-control/control.ps1 +200 -200
  383. package/Tools/OMP_Global_Config/agent/tools/windows-control/index.ts +255 -255
  384. package/Tools/OMP_Global_Config/notices/orchestrate.md +26 -26
  385. package/Tools/OMP_Global_Config/notices/ultrathink.md +9 -9
  386. package/Tools/OMP_Global_Config/notices/workflow.md +16 -16
  387. package/Tools/OMP_Global_Config/patches/apply-core-patch.mjs +18339 -18304
  388. package/Tools/OMP_Global_Config/patches/apply-notices.mjs +135 -135
  389. package/bin/cuelo-options.js +38 -38
  390. package/bin/cuelo.js +273 -273
  391. package/bin/docker-entrypoint.mjs +19 -19
  392. package/bin/password-prompt.js +100 -100
  393. package/bin/prepare-runtime.js +112 -112
  394. package/bin/runtime.js +134 -134
  395. package/bin/web-auth-store.d.ts +104 -104
  396. package/bin/web-auth-store.js +593 -593
  397. package/install.mjs +427 -427
  398. package/next.config.ts +104 -104
  399. package/package.json +141 -141
  400. package/public/audio/completion/voices.json +1393 -1393
  401. package/public/fonts/cuelo-display/NOTICE.txt +15 -15
  402. package/public/fonts/fonts.css +288 -288
  403. package/public/fonts/jetbrains-mono/OFL.txt +93 -93
  404. package/public/fonts/wanted-sans/OFL.txt +93 -93
  405. package/public/icons/catppuccin/LICENSE +22 -22
  406. package/public/icons/catppuccin/README.md +8 -8
  407. package/public/icons/catppuccin/latte/_file.svg +3 -3
  408. package/public/icons/catppuccin/latte/_folder.svg +3 -3
  409. package/public/icons/catppuccin/latte/_folder_open.svg +3 -3
  410. package/public/icons/catppuccin/latte/bash.svg +7 -7
  411. package/public/icons/catppuccin/latte/bun-lock.svg +8 -8
  412. package/public/icons/catppuccin/latte/config.svg +3 -3
  413. package/public/icons/catppuccin/latte/css.svg +6 -6
  414. package/public/icons/catppuccin/latte/database.svg +3 -3
  415. package/public/icons/catppuccin/latte/docker.svg +3 -3
  416. package/public/icons/catppuccin/latte/env.svg +3 -3
  417. package/public/icons/catppuccin/latte/eslint.svg +6 -6
  418. package/public/icons/catppuccin/latte/git.svg +6 -6
  419. package/public/icons/catppuccin/latte/go.svg +3 -3
  420. package/public/icons/catppuccin/latte/graphql.svg +3 -3
  421. package/public/icons/catppuccin/latte/html.svg +6 -6
  422. package/public/icons/catppuccin/latte/javascript-react.svg +8 -8
  423. package/public/icons/catppuccin/latte/javascript.svg +6 -6
  424. package/public/icons/catppuccin/latte/json.svg +3 -3
  425. package/public/icons/catppuccin/latte/lock.svg +3 -3
  426. package/public/icons/catppuccin/latte/markdown.svg +3 -3
  427. package/public/icons/catppuccin/latte/ms-word.svg +6 -6
  428. package/public/icons/catppuccin/latte/next.svg +6 -6
  429. package/public/icons/catppuccin/latte/npm-lock.svg +7 -7
  430. package/public/icons/catppuccin/latte/pdf.svg +3 -3
  431. package/public/icons/catppuccin/latte/python.svg +8 -8
  432. package/public/icons/catppuccin/latte/rust.svg +6 -6
  433. package/public/icons/catppuccin/latte/sass.svg +3 -3
  434. package/public/icons/catppuccin/latte/terraform.svg +3 -3
  435. package/public/icons/catppuccin/latte/toml.svg +3 -3
  436. package/public/icons/catppuccin/latte/typescript-react.svg +8 -8
  437. package/public/icons/catppuccin/latte/typescript.svg +6 -6
  438. package/public/icons/catppuccin/latte/yaml.svg +3 -3
  439. package/public/icons/catppuccin/mocha/_file.svg +3 -3
  440. package/public/icons/catppuccin/mocha/_folder.svg +3 -3
  441. package/public/icons/catppuccin/mocha/_folder_open.svg +3 -3
  442. package/public/icons/catppuccin/mocha/bash.svg +7 -7
  443. package/public/icons/catppuccin/mocha/bun-lock.svg +8 -8
  444. package/public/icons/catppuccin/mocha/config.svg +3 -3
  445. package/public/icons/catppuccin/mocha/css.svg +6 -6
  446. package/public/icons/catppuccin/mocha/database.svg +3 -3
  447. package/public/icons/catppuccin/mocha/docker.svg +3 -3
  448. package/public/icons/catppuccin/mocha/env.svg +3 -3
  449. package/public/icons/catppuccin/mocha/eslint.svg +6 -6
  450. package/public/icons/catppuccin/mocha/git.svg +6 -6
  451. package/public/icons/catppuccin/mocha/go.svg +3 -3
  452. package/public/icons/catppuccin/mocha/graphql.svg +3 -3
  453. package/public/icons/catppuccin/mocha/html.svg +6 -6
  454. package/public/icons/catppuccin/mocha/javascript-react.svg +8 -8
  455. package/public/icons/catppuccin/mocha/javascript.svg +6 -6
  456. package/public/icons/catppuccin/mocha/json.svg +3 -3
  457. package/public/icons/catppuccin/mocha/lock.svg +3 -3
  458. package/public/icons/catppuccin/mocha/markdown.svg +3 -3
  459. package/public/icons/catppuccin/mocha/ms-word.svg +6 -6
  460. package/public/icons/catppuccin/mocha/next.svg +6 -6
  461. package/public/icons/catppuccin/mocha/npm-lock.svg +7 -7
  462. package/public/icons/catppuccin/mocha/pdf.svg +3 -3
  463. package/public/icons/catppuccin/mocha/python.svg +8 -8
  464. package/public/icons/catppuccin/mocha/rust.svg +6 -6
  465. package/public/icons/catppuccin/mocha/sass.svg +3 -3
  466. package/public/icons/catppuccin/mocha/terraform.svg +3 -3
  467. package/public/icons/catppuccin/mocha/toml.svg +3 -3
  468. package/public/icons/catppuccin/mocha/typescript-react.svg +8 -8
  469. package/public/icons/catppuccin/mocha/typescript.svg +6 -6
  470. package/public/icons/catppuccin/mocha/yaml.svg +3 -3
  471. package/public/icons/cuelo-icon.svg +8 -8
  472. package/public/offline.html +145 -145
  473. package/public/sw.js +135 -135
  474. package/.next/server/chunks/205.js +0 -7
  475. package/.next/server/chunks/7738.js +0 -1
  476. package/.next/static/chunks/1966.b8f83f7ba376c962.js +0 -1
  477. package/.next/static/chunks/3899.3f761f7e3a944e8c.js +0 -1
  478. package/.next/static/chunks/app/_not-found/page-9e5295df095e2e41.js +0 -1
  479. package/.next/static/chunks/app/layout-8b29ba206a96135e.js +0 -1
  480. package/.next/static/chunks/main-1ddb405481ce21f6.js +0 -5
  481. package/.next/static/chunks/next/dist/client/components/builtin/global-error-50782c8c9c06c8b5.js +0 -1
  482. package/.next/static/chunks/webpack-7b514b9855bd748c.js +0 -1
  483. /package/.next/static/{dQA--5NX6NZt_A6pLZUde → -mDQEyWQ8VQsAfLpiACIP}/_buildManifest.js +0 -0
  484. /package/.next/static/{dQA--5NX6NZt_A6pLZUde → -mDQEyWQ8VQsAfLpiACIP}/_ssgManifest.js +0 -0
@@ -1,132 +1,132 @@
1
- import { chmodSync, mkdirSync } from "node:fs";
2
- import type { ExtensionAPI, ExtensionContext, SessionManager } from "@oh-my-pi/pi-coding-agent";
3
- // 런타임 패키지는 legacy-pi 확장 loader가 host SDK 경로로 재작성하므로 아래에서 지연 import한다.
4
- import {
5
- REVIEW_SYSTEM,
6
- REVIEW_TIMEOUT_MS,
7
- ReviewerCallError,
8
- SLOT,
9
- ledgerPath,
10
- runResolve,
11
- runReview,
12
- snapshotRoot,
13
- spawnExec,
14
- type Family,
15
- type ReviewDeps,
16
- type ReviewInput,
17
- type ResolveInput,
18
- } from "./lib/cross-review";
19
- import { createRoutingLedger, readCrossReviewRecords } from "./lib/routing-ledger";
20
-
21
- /**
22
- * Main 전용 계열 교차검증 도구. Maker child의 tools 목록(agents/maker.md)에 없어 child는 받지 않고, 이 파일도 subagent
23
- * 세션에서는 실행을 거절한다. 모델 호출은 skim의 completeRole과 같은 경로(역할 slot 해석 → completeSimple → 비용 장부)이며
24
- * 대화·사용자 프로필 없이 고정 system 한 줄 + 변경 본문 한 통만 보낸다.
25
- */
26
-
27
- const OPENAI_PROVIDERS: Record<string, true> = { "openai-codex": true, openai: true };
28
-
29
- /** slot이 가리키는 모델을 해석해 한 번 부른다(reasoning high, 10분 제한). 응답이 돌아온 시도는 비용 장부에 남긴다. */
30
- async function completeReviewer(family: Family, prompt: string, ctx: ExtensionContext, signal: AbortSignal): Promise<{ model: string; text: string }> {
31
- const slot = SLOT[family];
32
- const [{ findScopedSettings }, { completeSimple }] = await Promise.all([
33
- import("@oh-my-pi/pi-coding-agent/config/settings"), import("@oh-my-pi/pi-ai"),
34
- ]);
35
- const selector = findScopedSettings(ctx.cwd)?.getModelRole(slot);
36
- if (!selector) throw new ReviewerCallError(`modelRoles.${slot} is not configured.`, `@${slot}`);
37
- const model = ctx.models.resolve(`@${slot}`);
38
- if (!model) throw new ReviewerCallError(`Could not resolve modelRoles.${slot} (${selector}).`, selector);
39
- const name = `${model.provider}/${model.id}`;
40
- // 같은 계열 모델이 slot에 들어가 있으면 교차검증이 아니므로 호출하지 않는다.
41
- const ok = family === "anthropic" ? model.provider === "anthropic" : Object.hasOwn(OPENAI_PROVIDERS, model.provider);
42
- if (!ok) throw new ReviewerCallError(`modelRoles.${slot} resolved to ${name}, which is not a ${family} model.`, name);
43
- const sessionId = ctx.sessionManager.getSessionId();
44
- if (!(await ctx.modelRegistry.getApiKey(model, sessionId, { signal }))) throw new ReviewerCallError(`No credentials for ${name}.`, name);
45
- const response = await completeSimple(model, {
46
- systemPrompt: [REVIEW_SYSTEM],
47
- messages: [{ role: "user", content: prompt, timestamp: Date.now() }],
48
- }, {
49
- apiKey: ctx.modelRegistry.resolver(model, sessionId), sessionId, maxTokens: model.maxTokens ?? undefined,
50
- reasoning: "high" as never, // Effort은 const enum이라 문자열을 단언한다.
51
- signal: AbortSignal.any([signal, AbortSignal.timeout(REVIEW_TIMEOUT_MS)]),
52
- });
53
- // 응답이 돌아온 시도는 오류·빈 답도 청구되므로 먼저 장부에 남긴다(skim completeRole과 같다).
54
- (ctx.sessionManager as Partial<Pick<SessionManager, "appendModelUsage">>).appendModelUsage?.({
55
- purpose: "cross-review", role: slot, api: model.api, provider: model.provider, model: model.id,
56
- usage: response.usage, stopReason: response.stopReason, errorMessage: response.errorMessage,
57
- }, { sessionId, parentId: ctx.sessionManager.getLeafId() });
58
- const text = response.content.filter((part) => part.type === "text").map((part) => part.text).join("").trim();
59
- // 출력 한도·오류로 끝나도 모델이 낸 부분 답은 원문으로 남긴다(통과는 못 한다).
60
- if (response.stopReason !== "stop") throw new ReviewerCallError(response.errorMessage ?? `Model stopped: ${response.stopReason}`, name, text || undefined);
61
- if (!text) throw new ReviewerCallError(`${name} returned an empty answer.`, name);
62
- return { model: name, text };
63
- }
64
-
65
- function reviewDeps(ctx: ExtensionContext, signal: AbortSignal): ReviewDeps {
66
- const path = ledgerPath();
67
- const ledger = createRoutingLedger(path);
68
- const current = ctx.models.current() ?? ctx.model;
69
- mkdirSync(snapshotRoot(), { recursive: true, mode: 0o700 });
70
- chmodSync(snapshotRoot(), 0o700);
71
- return {
72
- cwd: ctx.cwd, sessionId: ctx.sessionManager.getSessionId(), mainModel: current ? `${current.provider}/${current.id}` : undefined,
73
- exec: spawnExec(signal), readAll: () => readCrossReviewRecords(path), append: (record) => ledger.append(record),
74
- snapshotRoot: snapshotRoot(),
75
- complete: (family, prompt, attempt) => completeReviewer(family, prompt, ctx, attempt),
76
- };
77
- }
78
-
79
- export interface CrossReviewParams {
80
- action: string;
81
- files?: string[];
82
- acceptance?: string;
83
- authors?: string[];
84
- highRisk?: boolean;
85
- previousReviewId?: string;
86
- references?: string[];
87
- probeResults?: { findingId: string; command: string; exitCode: number; output: string }[];
88
- reviewId?: string;
89
- resolutions?: { id: string; status: string; evidence: string }[];
90
- }
91
-
92
- export async function executeCrossReview(params: CrossReviewParams, ctx: ExtensionContext, signal: AbortSignal): Promise<unknown> {
93
- if (ctx.agent?.kind === "sub") throw new Error("cross_review is Main-only.");
94
- const deps = reviewDeps(ctx, signal);
95
- if (params.action === "review") {
96
- const input: ReviewInput = {
97
- files: params.files ?? [], acceptance: params.acceptance ?? "", authors: params.authors ?? [],
98
- highRisk: params.highRisk, previousReviewId: params.previousReviewId, references: params.references, probeResults: params.probeResults,
99
- };
100
- return runReview(input, deps, signal);
101
- }
102
- if (params.action === "resolve") {
103
- if (!params.reviewId) throw new Error("resolve requires reviewId.");
104
- const input: ResolveInput = { reviewId: params.reviewId, resolutions: params.resolutions ?? [] };
105
- return runResolve(input, deps);
106
- }
107
- throw new Error(`Unknown action ${JSON.stringify(params.action)}; use "review" or "resolve".`);
108
- }
109
-
110
- export default function crossReview(pi: ExtensionAPI): void {
111
- const z = pi.zod;
112
- pi.registerTool({
113
- name: "cross_review", label: "Cross Review", loadMode: "essential", approval: "read",
114
- description: "Main 전용 계열 교차검증. action=review: files(cwd 기준 상대 경로)의 변경을 반대 계열 reviewer(Anthropic 저자→Astra, OpenAI·그 밖의 저자→Opus)가 acceptance 기준으로 적대적으로 읽고 {reviewId, reviewer 모델, round, triggers, findings[]}를 돌려준다. authors는 코드를 쓴 모델 selector 또는 \"main\"이며 두 계열이면 둘 다 돌린다. previousReviewId를 주면 다음 라운드이고 체인은 최대 3회(probe 라운드 1회 + probe가 아닌 라운드 2회)다: probe가 아닌 라운드는 직전 라운드가 본 내용 이후의 delta만 보며 바뀐 것이 없으면 거절한다. reviewer는 코드만으로 가릴 수 없는 의심에 finding.probe{steps, expectIfReal, expectIfNot?}(재현 실험)를 붙일 수 있다. Main이나 기존 Maker가 그 실험을 돌린 뒤 previousReviewId와 probeResults[{findingId, command, exitCode, output}]를 주면 probe 라운드가 되어 코드 변경이 없어도 실험 결과로 한 번 더 판단받고, reviewer가 finding마다 verdicts{confirmed|withdrawn|unresolved}를 낸다(판단이 빠지면 unresolved). 체인에 없는 findingId·중복 결과·두 번째 probe 라운드·개인키 블록이 든 결과는 거절하며, output은 발췌로 결과당 8KB(넘으면 앞뒤만 남김)·합계 40KB(넘으면 거절)이고 비밀 값은 가려 신뢰하지 않는 자료로 전달한다. verdict는 자문일 뿐 finding을 자동으로 닫거나 통과시키지 않는다. references(선택, 최대 10개)는 심사 대상이 아닌 맥락용 기존·신규 파일(예: 작업 기록, 계약 파일)의 현재 내용을 변경 뒤에 읽기 전용으로 싣는다. 명시한 경로만이며 통과 지문을 덮지 않고 references만으로는 심사하지 않는다. 비밀 경로·gitignore·심볼릭 링크·바이너리·파일당 64KB/합계 100KB 초과, 읽는 동안 열린 파일의 실제 경로가 고정한 저장소 루트 아래 요청 경로와 달라진 경우는 빠지고 skippedReferences에 이유가 나온다. 이 경로 확인은 Linux(WSL 포함)의 /proc/self/fd에 의존하므로 native Windows/macOS에서는 references를 읽지 않고 skippedReferences에 unsupported 이유를 남긴다(변경 파일 심사는 그대로). 파일 내용은 OpenAI 또는 Anthropic으로 전송되며 비밀 이름·내용·바이너리·큰 입력은 거절/제외한다. action=resolve: reviewId 체인의 모든 finding에 {id, status fixed|refuted|limit, evidence}가 있어야 pass:true이고 그 시점 파일 내용(git blob)이 통과 지문으로 기록된다(withdrawn 판단도 자동으로 닫지 않는다). git_finalize는 trigger·표본에 걸린 코드 파일에 이 통과 기록을 요구한다. reviewer의 PASS 표현은 근거가 아니다.",
115
- parameters: z.object({
116
- action: z.string(),
117
- files: z.array(z.string()).optional(),
118
- acceptance: z.string().optional(),
119
- authors: z.array(z.string()).optional(),
120
- highRisk: z.boolean().optional(),
121
- previousReviewId: z.string().optional(),
122
- references: z.array(z.string()).optional(),
123
- probeResults: z.array(z.object({ findingId: z.string(), command: z.string(), exitCode: z.number(), output: z.string() })).optional(),
124
- reviewId: z.string().optional(),
125
- resolutions: z.array(z.object({ id: z.string(), status: z.string(), evidence: z.string() })).optional(),
126
- }) as never,
127
- async execute(_id, params, signal, _onUpdate, ctx) {
128
- const result = await executeCrossReview(params as CrossReviewParams, ctx, signal ?? new AbortController().signal);
129
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], details: result };
130
- },
131
- });
132
- }
1
+ import { chmodSync, mkdirSync } from "node:fs";
2
+ import type { ExtensionAPI, ExtensionContext, SessionManager } from "@oh-my-pi/pi-coding-agent";
3
+ // 런타임 패키지는 legacy-pi 확장 loader가 host SDK 경로로 재작성하므로 아래에서 지연 import한다.
4
+ import {
5
+ REVIEW_SYSTEM,
6
+ REVIEW_TIMEOUT_MS,
7
+ ReviewerCallError,
8
+ SLOT,
9
+ ledgerPath,
10
+ runResolve,
11
+ runReview,
12
+ snapshotRoot,
13
+ spawnExec,
14
+ type Family,
15
+ type ReviewDeps,
16
+ type ReviewInput,
17
+ type ResolveInput,
18
+ } from "./lib/cross-review";
19
+ import { createRoutingLedger, readCrossReviewRecords } from "./lib/routing-ledger";
20
+
21
+ /**
22
+ * Main 전용 계열 교차검증 도구. Maker child의 tools 목록(agents/maker.md)에 없어 child는 받지 않고, 이 파일도 subagent
23
+ * 세션에서는 실행을 거절한다. 모델 호출은 skim의 completeRole과 같은 경로(역할 slot 해석 → completeSimple → 비용 장부)이며
24
+ * 대화·사용자 프로필 없이 고정 system 한 줄 + 변경 본문 한 통만 보낸다.
25
+ */
26
+
27
+ const OPENAI_PROVIDERS: Record<string, true> = { "openai-codex": true, openai: true };
28
+
29
+ /** slot이 가리키는 모델을 해석해 한 번 부른다(reasoning high, 10분 제한). 응답이 돌아온 시도는 비용 장부에 남긴다. */
30
+ async function completeReviewer(family: Family, prompt: string, ctx: ExtensionContext, signal: AbortSignal): Promise<{ model: string; text: string }> {
31
+ const slot = SLOT[family];
32
+ const [{ findScopedSettings }, { completeSimple }] = await Promise.all([
33
+ import("@oh-my-pi/pi-coding-agent/config/settings"), import("@oh-my-pi/pi-ai"),
34
+ ]);
35
+ const selector = findScopedSettings(ctx.cwd)?.getModelRole(slot);
36
+ if (!selector) throw new ReviewerCallError(`modelRoles.${slot} is not configured.`, `@${slot}`);
37
+ const model = ctx.models.resolve(`@${slot}`);
38
+ if (!model) throw new ReviewerCallError(`Could not resolve modelRoles.${slot} (${selector}).`, selector);
39
+ const name = `${model.provider}/${model.id}`;
40
+ // 같은 계열 모델이 slot에 들어가 있으면 교차검증이 아니므로 호출하지 않는다.
41
+ const ok = family === "anthropic" ? model.provider === "anthropic" : Object.hasOwn(OPENAI_PROVIDERS, model.provider);
42
+ if (!ok) throw new ReviewerCallError(`modelRoles.${slot} resolved to ${name}, which is not a ${family} model.`, name);
43
+ const sessionId = ctx.sessionManager.getSessionId();
44
+ if (!(await ctx.modelRegistry.getApiKey(model, sessionId, { signal }))) throw new ReviewerCallError(`No credentials for ${name}.`, name);
45
+ const response = await completeSimple(model, {
46
+ systemPrompt: [REVIEW_SYSTEM],
47
+ messages: [{ role: "user", content: prompt, timestamp: Date.now() }],
48
+ }, {
49
+ apiKey: ctx.modelRegistry.resolver(model, sessionId), sessionId, maxTokens: model.maxTokens ?? undefined,
50
+ reasoning: "high" as never, // Effort은 const enum이라 문자열을 단언한다.
51
+ signal: AbortSignal.any([signal, AbortSignal.timeout(REVIEW_TIMEOUT_MS)]),
52
+ });
53
+ // 응답이 돌아온 시도는 오류·빈 답도 청구되므로 먼저 장부에 남긴다(skim completeRole과 같다).
54
+ (ctx.sessionManager as Partial<Pick<SessionManager, "appendModelUsage">>).appendModelUsage?.({
55
+ purpose: "cross-review", role: slot, api: model.api, provider: model.provider, model: model.id,
56
+ usage: response.usage, stopReason: response.stopReason, errorMessage: response.errorMessage,
57
+ }, { sessionId, parentId: ctx.sessionManager.getLeafId() });
58
+ const text = response.content.filter((part) => part.type === "text").map((part) => part.text).join("").trim();
59
+ // 출력 한도·오류로 끝나도 모델이 낸 부분 답은 원문으로 남긴다(통과는 못 한다).
60
+ if (response.stopReason !== "stop") throw new ReviewerCallError(response.errorMessage ?? `Model stopped: ${response.stopReason}`, name, text || undefined);
61
+ if (!text) throw new ReviewerCallError(`${name} returned an empty answer.`, name);
62
+ return { model: name, text };
63
+ }
64
+
65
+ function reviewDeps(ctx: ExtensionContext, signal: AbortSignal): ReviewDeps {
66
+ const path = ledgerPath();
67
+ const ledger = createRoutingLedger(path);
68
+ const current = ctx.models.current() ?? ctx.model;
69
+ mkdirSync(snapshotRoot(), { recursive: true, mode: 0o700 });
70
+ chmodSync(snapshotRoot(), 0o700);
71
+ return {
72
+ cwd: ctx.cwd, sessionId: ctx.sessionManager.getSessionId(), mainModel: current ? `${current.provider}/${current.id}` : undefined,
73
+ exec: spawnExec(signal), readAll: () => readCrossReviewRecords(path), append: (record) => ledger.append(record),
74
+ snapshotRoot: snapshotRoot(),
75
+ complete: (family, prompt, attempt) => completeReviewer(family, prompt, ctx, attempt),
76
+ };
77
+ }
78
+
79
+ export interface CrossReviewParams {
80
+ action: string;
81
+ files?: string[];
82
+ acceptance?: string;
83
+ authors?: string[];
84
+ highRisk?: boolean;
85
+ previousReviewId?: string;
86
+ references?: string[];
87
+ probeResults?: { findingId: string; command: string; exitCode: number; output: string }[];
88
+ reviewId?: string;
89
+ resolutions?: { id: string; status: string; evidence: string }[];
90
+ }
91
+
92
+ export async function executeCrossReview(params: CrossReviewParams, ctx: ExtensionContext, signal: AbortSignal): Promise<unknown> {
93
+ if (ctx.agent?.kind === "sub") throw new Error("cross_review is Main-only.");
94
+ const deps = reviewDeps(ctx, signal);
95
+ if (params.action === "review") {
96
+ const input: ReviewInput = {
97
+ files: params.files ?? [], acceptance: params.acceptance ?? "", authors: params.authors ?? [],
98
+ highRisk: params.highRisk, previousReviewId: params.previousReviewId, references: params.references, probeResults: params.probeResults,
99
+ };
100
+ return runReview(input, deps, signal);
101
+ }
102
+ if (params.action === "resolve") {
103
+ if (!params.reviewId) throw new Error("resolve requires reviewId.");
104
+ const input: ResolveInput = { reviewId: params.reviewId, resolutions: params.resolutions ?? [] };
105
+ return runResolve(input, deps);
106
+ }
107
+ throw new Error(`Unknown action ${JSON.stringify(params.action)}; use "review" or "resolve".`);
108
+ }
109
+
110
+ export default function crossReview(pi: ExtensionAPI): void {
111
+ const z = pi.zod;
112
+ pi.registerTool({
113
+ name: "cross_review", label: "Cross Review", loadMode: "essential", approval: "read",
114
+ description: "Main 전용 계열 교차검증. action=review: files(cwd 기준 상대 경로)의 변경을 반대 계열 reviewer(Anthropic 저자→Astra, OpenAI·그 밖의 저자→Opus)가 acceptance 기준으로 적대적으로 읽고 {reviewId, reviewer 모델, round, triggers, findings[]}를 돌려준다. authors는 코드를 쓴 모델 selector 또는 \"main\"이며 두 계열이면 둘 다 돌린다. previousReviewId를 주면 다음 라운드이고 체인은 최대 3회(probe 라운드 1회 + probe가 아닌 라운드 2회)다: probe가 아닌 라운드는 직전 라운드가 본 내용 이후의 delta만 보며 바뀐 것이 없으면 거절한다. reviewer는 코드만으로 가릴 수 없는 의심에 finding.probe{steps, expectIfReal, expectIfNot?}(재현 실험)를 붙일 수 있다. Main이나 기존 Maker가 그 실험을 돌린 뒤 previousReviewId와 probeResults[{findingId, command, exitCode, output}]를 주면 probe 라운드가 되어 코드 변경이 없어도 실험 결과로 한 번 더 판단받고, reviewer가 finding마다 verdicts{confirmed|withdrawn|unresolved}를 낸다(판단이 빠지면 unresolved). 체인에 없는 findingId·중복 결과·두 번째 probe 라운드·개인키 블록이 든 결과는 거절하며, output은 발췌로 결과당 8KB(넘으면 앞뒤만 남김)·합계 40KB(넘으면 거절)이고 비밀 값은 가려 신뢰하지 않는 자료로 전달한다. verdict는 자문일 뿐 finding을 자동으로 닫거나 통과시키지 않는다. references(선택, 최대 10개)는 심사 대상이 아닌 맥락용 기존·신규 파일(예: 작업 기록, 계약 파일)의 현재 내용을 변경 뒤에 읽기 전용으로 싣는다. 명시한 경로만이며 통과 지문을 덮지 않고 references만으로는 심사하지 않는다. 비밀 경로·gitignore·심볼릭 링크·바이너리·파일당 64KB/합계 100KB 초과, 읽는 동안 열린 파일의 실제 경로가 고정한 저장소 루트 아래 요청 경로와 달라진 경우는 빠지고 skippedReferences에 이유가 나온다. 이 경로 확인은 Linux(WSL 포함)의 /proc/self/fd에 의존하므로 native Windows/macOS에서는 references를 읽지 않고 skippedReferences에 unsupported 이유를 남긴다(변경 파일 심사는 그대로). 파일 내용은 OpenAI 또는 Anthropic으로 전송되며 비밀 이름·내용·바이너리·큰 입력은 거절/제외한다. action=resolve: reviewId 체인의 모든 finding에 {id, status fixed|refuted|limit, evidence}가 있어야 pass:true이고 그 시점 파일 내용(git blob)이 통과 지문으로 기록된다(withdrawn 판단도 자동으로 닫지 않는다). git_finalize는 trigger·표본에 걸린 코드 파일에 이 통과 기록을 요구한다. reviewer의 PASS 표현은 근거가 아니다.",
115
+ parameters: z.object({
116
+ action: z.string(),
117
+ files: z.array(z.string()).optional(),
118
+ acceptance: z.string().optional(),
119
+ authors: z.array(z.string()).optional(),
120
+ highRisk: z.boolean().optional(),
121
+ previousReviewId: z.string().optional(),
122
+ references: z.array(z.string()).optional(),
123
+ probeResults: z.array(z.object({ findingId: z.string(), command: z.string(), exitCode: z.number(), output: z.string() })).optional(),
124
+ reviewId: z.string().optional(),
125
+ resolutions: z.array(z.object({ id: z.string(), status: z.string(), evidence: z.string() })).optional(),
126
+ }) as never,
127
+ async execute(_id, params, signal, _onUpdate, ctx) {
128
+ const result = await executeCrossReview(params as CrossReviewParams, ctx, signal ?? new AbortController().signal);
129
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], details: result };
130
+ },
131
+ });
132
+ }
@@ -1,133 +1,133 @@
1
- import type { ExtensionAPI, ExtensionContext } from "@oh-my-pi/pi-coding-agent";
2
- import { type DocmapCandidate, type DocmapRoute, routeDocmap } from "./lib/docmap-search";
3
- import { type CoreJudgmentModules, defaultLoadCore, JUDGE_STOPPED, type NativeJudge, resolveNativeJudge, stoppedBy } from "./lib/native-judge";
4
- import { onSessionLifecycle } from "./lib/session-identity";
5
-
6
- // 2026-10-16 재조사(doc/history/2026/10/16-rag-reinvestigation): 격리 표본 12건에서 문서 지도를 연 경우가 0건이었다.
7
- // 도구나 규칙만 두면 같은 문제가 되풀이되므로, 사용자 요청마다 하네스가 지도·RECORD 헤더 검색을 직접 돌려
8
- // 후보 기록과 맞는 구간을 그 prompt의 숨은 메시지로 넘긴다. 하한 미만·지도 없음·오류면 아무것도 붙이지 않는다.
9
- // 안내는 external-advice-check와 같은 이유로 aside가 아니라 그 prompt의 `before_agent_start` 메시지로만 붙인다.
10
- //
11
- // 2026-10-17 사용자 결정(doc/history/2026/10/17-docmap-judge): 낱말로 고른 후보의 절반은 주제만 겹치는 지시였다
12
- // (실제 프롬프트 표본 60건 중 맞는 첨부 29·엉뚱한 첨부 31). 낱말·길이·의도 표지로는 둘이 갈리지 않아, 붙이기 전에
13
- // native JEV에 후보마다 「요청이 가리키는 그 과거 작업의 기록인가」를 한 요청으로 묻고 P>=0.6인 후보만 붙인다(사용자 선택).
14
- // 같은 표본에서 맞는 첨부 19/29를 지키고 엉뚱한 첨부는 5/31만 남았다(0.5면 23/29·10/31). 판정 실패·제한 시간·native 판정기 없음은
15
- // 낱말 후보를 그대로 붙이고(재현율 보존), 실행 중 steering·queued 재요청은 판정하지 않는다(스티어링 지연 방지).
16
-
17
- export interface DocmapRouteDeps {
18
- /** 결정적 판정기 seam(테스트). 없으면 {@link loadCore}의 native JEV를 쓴다. */
19
- resolveJudge?: (ctx: ExtensionContext) => Promise<NativeJudge | undefined>;
20
- loadCore?: () => Promise<CoreJudgmentModules>;
21
- /** 판정 대기 상한. 테스트만 짧게 준다. 기본은 DOCMAP_JUDGE_TIMEOUT_MS다. */
22
- judgeTimeoutMs?: number;
23
- /** 날짜 의도 판정의 기준 시각(테스트). */
24
- now?: () => Date;
25
- }
26
-
27
- /** 판정 대기 상한. 넘으면 낱말 후보를 그대로 붙인다. */
28
- export const DOCMAP_JUDGE_TIMEOUT_MS = 1_500;
29
- /** 후보를 남기는 P(관련) 하한. */
30
- export const DOCMAP_JUDGE_KEEP = 0.6;
31
- const PROMPT_HEAD_CHARS = 1000;
32
- const PROMPT_TAIL_CHARS = 1000;
33
- const CUSTOM_TYPE = "docmap-route";
34
-
35
- function judgePrompt(prompt: string): string {
36
- return prompt.length <= PROMPT_HEAD_CHARS + PROMPT_TAIL_CHARS ? prompt : `${prompt.slice(0, PROMPT_HEAD_CHARS)}\n…\n${prompt.slice(-PROMPT_TAIL_CHARS)}`;
37
- }
38
-
39
- /** 후보마다 예/아니오(core 판정 API 이름 `noul`) 질문 하나. 같은 state를 보므로 한 요청에 묶는다. */
40
- export function buildDocmapJudgeRequest(prompt: string, route: DocmapRoute): { state: unknown; questions: Record<string, unknown> } {
41
- const questions: Record<string, unknown> = {};
42
- route.judgeCandidates.forEach((_, i) => {
43
- questions[`c${i + 1}`] = {
44
- type: "noul",
45
- instructions: `Is candidates[${i}] a record of the earlier work the prompt refers to (the same event, decision, procedure or state), not merely sharing words with it? The prompt is one message a user sent to a coding agent mid-conversation; a new instruction, a reaction or small talk that only shares vocabulary is "no".`,
46
- criteria: { true: "the prompt asks about or continues the work this record covers", false: "new instruction, reaction, small talk, or only topical word overlap" },
47
- };
48
- });
49
- return { state: { prompt: judgePrompt(prompt), candidates: route.judgeCandidates }, questions };
50
- }
51
-
52
- /** 판정 답에서 남길 후보. 답이 없는 후보는 버린다. */
53
- export function keptByJudge(route: DocmapRoute, answers: Record<string, { noul?: number } | undefined>): DocmapCandidate[] {
54
- return route.candidates.filter((_, i) => (answers[`c${i + 1}`]?.noul ?? 0) >= DOCMAP_JUDGE_KEEP);
55
- }
56
-
57
- export function createDocmapRoute(deps: DocmapRouteDeps = {}) {
58
- const loadCore = deps.loadCore ?? defaultLoadCore;
59
- const resolveJudge = deps.resolveJudge ?? ((ctx: ExtensionContext) => resolveNativeJudge(ctx, loadCore, "docmap_route"));
60
- const judgeTimeoutMs = deps.judgeTimeoutMs ?? DOCMAP_JUDGE_TIMEOUT_MS;
61
-
62
- return function docmapRoute(pi: ExtensionAPI): void {
63
- let pendingText: string | undefined;
64
- let judgePromise: Promise<NativeJudge | undefined> | undefined;
65
- /** agent_start~agent_end 사이. 실행 중 steering·queued 재요청은 판정 없이 붙인다(mcp-selection과 같은 추적). */
66
- let inRun = false;
67
- const judgeFor = (ctx: ExtensionContext) => (judgePromise ??= resolveJudge(ctx).catch(() => undefined));
68
-
69
- onSessionLifecycle(pi, { start: () => {
70
- pendingText = undefined;
71
- judgePromise = undefined;
72
- inRun = false;
73
- } });
74
- pi.on("session_shutdown", () => { pendingText = undefined; });
75
- pi.on("agent_start", () => { inRun = true; });
76
- pi.on("agent_end", () => { inRun = false; });
77
- pi.on("input", (event) => {
78
- pendingText = undefined;
79
- if (event.source !== "interactive" && event.source !== "rpc") return;
80
- const text = event.text.trim();
81
- if (text) pendingText = text;
82
- });
83
-
84
- /** 판정으로 거른 안내문. 판정 실패·제한 시간이면 낱말 후보 그대로. */
85
- const filtered = async (route: DocmapRoute, prompt: string, ctx: ExtensionContext): Promise<string> => {
86
- const controller = new AbortController();
87
- const stopped = stoppedBy(controller.signal);
88
- let timedOut = false;
89
- const timer = setTimeout(() => {
90
- timedOut = true;
91
- controller.abort();
92
- }, judgeTimeoutMs);
93
- try {
94
- const judge = await Promise.race([judgeFor(ctx), stopped]);
95
- if (judge === JUDGE_STOPPED) throw new Error("판정 취소");
96
- if (!judge) throw new Error("native JEV 판정기 없음");
97
- const result = await Promise.race([judge.judge(buildDocmapJudgeRequest(prompt, route), { signal: controller.signal }), stopped]);
98
- if (result === JUDGE_STOPPED) throw new Error("판정 취소");
99
- return route.render(keptByJudge(route, result.answers));
100
- } catch (error) {
101
- pi.logger.debug("docmap-route: JEV 후보 판정 없이 낱말 후보를 붙임", {
102
- error: timedOut ? "판정이 제한 시간 안에 끝나지 않음" : error instanceof Error ? error.message : String(error),
103
- });
104
- return route.text;
105
- } finally {
106
- clearTimeout(timer);
107
- }
108
- };
109
-
110
- pi.on("before_agent_start", async (event, ctx) => {
111
- // 대화형·RPC는 사용자 입력과 같은 본문의 prompt에만 붙인다. CUELO의 재개·업데이트 통지와 goal 계속 같은
112
- // 내부 prompt는 `input`을 내지 않아(lib/rpc-manager.ts isGenuineUserRequest) 여기서 빠진다.
113
- // `omp -p`는 input 이벤트가 없어 최상위 세션의 CLI prompt 자체를 사용자 요청으로 본다. CUELO도 확장을
114
- // mode 없이 초기화해 ctx.mode가 "print"이므로, UI 문맥이 없다는 것까지 봐야 CLI로 가를 수 있다.
115
- const fromInput = pendingText !== undefined && event.prompt.includes(pendingText);
116
- const cliPrompt = (ctx.mode === "print" || ctx.mode === "json") && !ctx.hasUI && ctx.agent?.kind === "main";
117
- if (!fromInput && !cliPrompt) return;
118
- const prompt = fromInput ? pendingText! : event.prompt;
119
- let route: DocmapRoute | undefined;
120
- try {
121
- route = routeDocmap(ctx.cwd, prompt, deps.now?.());
122
- } catch {
123
- return;
124
- }
125
- if (!route) return;
126
- const content = inRun ? route.text : await filtered(route, prompt, ctx);
127
- if (!content) return;
128
- return { message: { customType: CUSTOM_TYPE, content, display: false, attribution: "agent" } };
129
- });
130
- };
131
- }
132
-
133
- export default createDocmapRoute();
1
+ import type { ExtensionAPI, ExtensionContext } from "@oh-my-pi/pi-coding-agent";
2
+ import { type DocmapCandidate, type DocmapRoute, routeDocmap } from "./lib/docmap-search";
3
+ import { type CoreJudgmentModules, defaultLoadCore, JUDGE_STOPPED, type NativeJudge, resolveNativeJudge, stoppedBy } from "./lib/native-judge";
4
+ import { onSessionLifecycle } from "./lib/session-identity";
5
+
6
+ // 2026-10-16 재조사(doc/history/2026/10/16-rag-reinvestigation): 격리 표본 12건에서 문서 지도를 연 경우가 0건이었다.
7
+ // 도구나 규칙만 두면 같은 문제가 되풀이되므로, 사용자 요청마다 하네스가 지도·RECORD 헤더 검색을 직접 돌려
8
+ // 후보 기록과 맞는 구간을 그 prompt의 숨은 메시지로 넘긴다. 하한 미만·지도 없음·오류면 아무것도 붙이지 않는다.
9
+ // 안내는 external-advice-check와 같은 이유로 aside가 아니라 그 prompt의 `before_agent_start` 메시지로만 붙인다.
10
+ //
11
+ // 2026-10-17 사용자 결정(doc/history/2026/10/17-docmap-judge): 낱말로 고른 후보의 절반은 주제만 겹치는 지시였다
12
+ // (실제 프롬프트 표본 60건 중 맞는 첨부 29·엉뚱한 첨부 31). 낱말·길이·의도 표지로는 둘이 갈리지 않아, 붙이기 전에
13
+ // native JEV에 후보마다 「요청이 가리키는 그 과거 작업의 기록인가」를 한 요청으로 묻고 P>=0.6인 후보만 붙인다(사용자 선택).
14
+ // 같은 표본에서 맞는 첨부 19/29를 지키고 엉뚱한 첨부는 5/31만 남았다(0.5면 23/29·10/31). 판정 실패·제한 시간·native 판정기 없음은
15
+ // 낱말 후보를 그대로 붙이고(재현율 보존), 실행 중 steering·queued 재요청은 판정하지 않는다(스티어링 지연 방지).
16
+
17
+ export interface DocmapRouteDeps {
18
+ /** 결정적 판정기 seam(테스트). 없으면 {@link loadCore}의 native JEV를 쓴다. */
19
+ resolveJudge?: (ctx: ExtensionContext) => Promise<NativeJudge | undefined>;
20
+ loadCore?: () => Promise<CoreJudgmentModules>;
21
+ /** 판정 대기 상한. 테스트만 짧게 준다. 기본은 DOCMAP_JUDGE_TIMEOUT_MS다. */
22
+ judgeTimeoutMs?: number;
23
+ /** 날짜 의도 판정의 기준 시각(테스트). */
24
+ now?: () => Date;
25
+ }
26
+
27
+ /** 판정 대기 상한. 넘으면 낱말 후보를 그대로 붙인다. */
28
+ export const DOCMAP_JUDGE_TIMEOUT_MS = 1_500;
29
+ /** 후보를 남기는 P(관련) 하한. */
30
+ export const DOCMAP_JUDGE_KEEP = 0.6;
31
+ const PROMPT_HEAD_CHARS = 1000;
32
+ const PROMPT_TAIL_CHARS = 1000;
33
+ const CUSTOM_TYPE = "docmap-route";
34
+
35
+ function judgePrompt(prompt: string): string {
36
+ return prompt.length <= PROMPT_HEAD_CHARS + PROMPT_TAIL_CHARS ? prompt : `${prompt.slice(0, PROMPT_HEAD_CHARS)}\n…\n${prompt.slice(-PROMPT_TAIL_CHARS)}`;
37
+ }
38
+
39
+ /** 후보마다 예/아니오(core 판정 API 이름 `noul`) 질문 하나. 같은 state를 보므로 한 요청에 묶는다. */
40
+ export function buildDocmapJudgeRequest(prompt: string, route: DocmapRoute): { state: unknown; questions: Record<string, unknown> } {
41
+ const questions: Record<string, unknown> = {};
42
+ route.judgeCandidates.forEach((_, i) => {
43
+ questions[`c${i + 1}`] = {
44
+ type: "noul",
45
+ instructions: `Is candidates[${i}] a record of the earlier work the prompt refers to (the same event, decision, procedure or state), not merely sharing words with it? The prompt is one message a user sent to a coding agent mid-conversation; a new instruction, a reaction or small talk that only shares vocabulary is "no".`,
46
+ criteria: { true: "the prompt asks about or continues the work this record covers", false: "new instruction, reaction, small talk, or only topical word overlap" },
47
+ };
48
+ });
49
+ return { state: { prompt: judgePrompt(prompt), candidates: route.judgeCandidates }, questions };
50
+ }
51
+
52
+ /** 판정 답에서 남길 후보. 답이 없는 후보는 버린다. */
53
+ export function keptByJudge(route: DocmapRoute, answers: Record<string, { noul?: number } | undefined>): DocmapCandidate[] {
54
+ return route.candidates.filter((_, i) => (answers[`c${i + 1}`]?.noul ?? 0) >= DOCMAP_JUDGE_KEEP);
55
+ }
56
+
57
+ export function createDocmapRoute(deps: DocmapRouteDeps = {}) {
58
+ const loadCore = deps.loadCore ?? defaultLoadCore;
59
+ const resolveJudge = deps.resolveJudge ?? ((ctx: ExtensionContext) => resolveNativeJudge(ctx, loadCore, "docmap_route"));
60
+ const judgeTimeoutMs = deps.judgeTimeoutMs ?? DOCMAP_JUDGE_TIMEOUT_MS;
61
+
62
+ return function docmapRoute(pi: ExtensionAPI): void {
63
+ let pendingText: string | undefined;
64
+ let judgePromise: Promise<NativeJudge | undefined> | undefined;
65
+ /** agent_start~agent_end 사이. 실행 중 steering·queued 재요청은 판정 없이 붙인다(mcp-selection과 같은 추적). */
66
+ let inRun = false;
67
+ const judgeFor = (ctx: ExtensionContext) => (judgePromise ??= resolveJudge(ctx).catch(() => undefined));
68
+
69
+ onSessionLifecycle(pi, { start: () => {
70
+ pendingText = undefined;
71
+ judgePromise = undefined;
72
+ inRun = false;
73
+ } });
74
+ pi.on("session_shutdown", () => { pendingText = undefined; });
75
+ pi.on("agent_start", () => { inRun = true; });
76
+ pi.on("agent_end", () => { inRun = false; });
77
+ pi.on("input", (event) => {
78
+ pendingText = undefined;
79
+ if (event.source !== "interactive" && event.source !== "rpc") return;
80
+ const text = event.text.trim();
81
+ if (text) pendingText = text;
82
+ });
83
+
84
+ /** 판정으로 거른 안내문. 판정 실패·제한 시간이면 낱말 후보 그대로. */
85
+ const filtered = async (route: DocmapRoute, prompt: string, ctx: ExtensionContext): Promise<string> => {
86
+ const controller = new AbortController();
87
+ const stopped = stoppedBy(controller.signal);
88
+ let timedOut = false;
89
+ const timer = setTimeout(() => {
90
+ timedOut = true;
91
+ controller.abort();
92
+ }, judgeTimeoutMs);
93
+ try {
94
+ const judge = await Promise.race([judgeFor(ctx), stopped]);
95
+ if (judge === JUDGE_STOPPED) throw new Error("판정 취소");
96
+ if (!judge) throw new Error("native JEV 판정기 없음");
97
+ const result = await Promise.race([judge.judge(buildDocmapJudgeRequest(prompt, route), { signal: controller.signal }), stopped]);
98
+ if (result === JUDGE_STOPPED) throw new Error("판정 취소");
99
+ return route.render(keptByJudge(route, result.answers));
100
+ } catch (error) {
101
+ pi.logger.debug("docmap-route: JEV 후보 판정 없이 낱말 후보를 붙임", {
102
+ error: timedOut ? "판정이 제한 시간 안에 끝나지 않음" : error instanceof Error ? error.message : String(error),
103
+ });
104
+ return route.text;
105
+ } finally {
106
+ clearTimeout(timer);
107
+ }
108
+ };
109
+
110
+ pi.on("before_agent_start", async (event, ctx) => {
111
+ // 대화형·RPC는 사용자 입력과 같은 본문의 prompt에만 붙인다. CUELO의 재개·업데이트 통지와 goal 계속 같은
112
+ // 내부 prompt는 `input`을 내지 않아(lib/rpc-manager.ts isGenuineUserRequest) 여기서 빠진다.
113
+ // `omp -p`는 input 이벤트가 없어 최상위 세션의 CLI prompt 자체를 사용자 요청으로 본다. CUELO도 확장을
114
+ // mode 없이 초기화해 ctx.mode가 "print"이므로, UI 문맥이 없다는 것까지 봐야 CLI로 가를 수 있다.
115
+ const fromInput = pendingText !== undefined && event.prompt.includes(pendingText);
116
+ const cliPrompt = (ctx.mode === "print" || ctx.mode === "json") && !ctx.hasUI && ctx.agent?.kind === "main";
117
+ if (!fromInput && !cliPrompt) return;
118
+ const prompt = fromInput ? pendingText! : event.prompt;
119
+ let route: DocmapRoute | undefined;
120
+ try {
121
+ route = routeDocmap(ctx.cwd, prompt, deps.now?.());
122
+ } catch {
123
+ return;
124
+ }
125
+ if (!route) return;
126
+ const content = inRun ? route.text : await filtered(route, prompt, ctx);
127
+ if (!content) return;
128
+ return { message: { customType: CUSTOM_TYPE, content, display: false, attribution: "agent" } };
129
+ });
130
+ };
131
+ }
132
+
133
+ export default createDocmapRoute();