usesteady 0.1.0-alpha.1

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 (665) hide show
  1. package/LICENSE +186 -0
  2. package/README.md +724 -0
  3. package/bin/use-steady.js +13 -0
  4. package/dist/server-store.d.ts +68 -0
  5. package/dist/server-store.d.ts.map +1 -0
  6. package/dist/server-store.js +133 -0
  7. package/dist/server-store.js.map +1 -0
  8. package/dist/server.d.ts +35 -0
  9. package/dist/server.d.ts.map +1 -0
  10. package/dist/server.js +569 -0
  11. package/dist/server.js.map +1 -0
  12. package/dist/src/claude/adapters/api-adapter.d.ts +99 -0
  13. package/dist/src/claude/adapters/api-adapter.d.ts.map +1 -0
  14. package/dist/src/claude/adapters/api-adapter.js +415 -0
  15. package/dist/src/claude/adapters/api-adapter.js.map +1 -0
  16. package/dist/src/claude/adapters/stub-adapter.d.ts +73 -0
  17. package/dist/src/claude/adapters/stub-adapter.d.ts.map +1 -0
  18. package/dist/src/claude/adapters/stub-adapter.js +114 -0
  19. package/dist/src/claude/adapters/stub-adapter.js.map +1 -0
  20. package/dist/src/claude/artifact-mapper.d.ts +85 -0
  21. package/dist/src/claude/artifact-mapper.d.ts.map +1 -0
  22. package/dist/src/claude/artifact-mapper.js +187 -0
  23. package/dist/src/claude/artifact-mapper.js.map +1 -0
  24. package/dist/src/claude/delivery-gate.d.ts +136 -0
  25. package/dist/src/claude/delivery-gate.d.ts.map +1 -0
  26. package/dist/src/claude/delivery-gate.js +231 -0
  27. package/dist/src/claude/delivery-gate.js.map +1 -0
  28. package/dist/src/claude/index.d.ts +24 -0
  29. package/dist/src/claude/index.d.ts.map +1 -0
  30. package/dist/src/claude/index.js +23 -0
  31. package/dist/src/claude/index.js.map +1 -0
  32. package/dist/src/claude/types.d.ts +223 -0
  33. package/dist/src/claude/types.d.ts.map +1 -0
  34. package/dist/src/claude/types.js +64 -0
  35. package/dist/src/claude/types.js.map +1 -0
  36. package/dist/src/control/compiler.d.ts +125 -0
  37. package/dist/src/control/compiler.d.ts.map +1 -0
  38. package/dist/src/control/compiler.js +179 -0
  39. package/dist/src/control/compiler.js.map +1 -0
  40. package/dist/src/control/constraints.d.ts +42 -0
  41. package/dist/src/control/constraints.d.ts.map +1 -0
  42. package/dist/src/control/constraints.js +116 -0
  43. package/dist/src/control/constraints.js.map +1 -0
  44. package/dist/src/control/drift-detector.d.ts +49 -0
  45. package/dist/src/control/drift-detector.d.ts.map +1 -0
  46. package/dist/src/control/drift-detector.js +115 -0
  47. package/dist/src/control/drift-detector.js.map +1 -0
  48. package/dist/src/control/index.d.ts +44 -0
  49. package/dist/src/control/index.d.ts.map +1 -0
  50. package/dist/src/control/index.js +40 -0
  51. package/dist/src/control/index.js.map +1 -0
  52. package/dist/src/control/types.d.ts +144 -0
  53. package/dist/src/control/types.d.ts.map +1 -0
  54. package/dist/src/control/types.js +57 -0
  55. package/dist/src/control/types.js.map +1 -0
  56. package/dist/src/cursor/adapters/inprocess-adapter.d.ts +78 -0
  57. package/dist/src/cursor/adapters/inprocess-adapter.d.ts.map +1 -0
  58. package/dist/src/cursor/adapters/inprocess-adapter.js +308 -0
  59. package/dist/src/cursor/adapters/inprocess-adapter.js.map +1 -0
  60. package/dist/src/cursor/adapters/stub-adapter.d.ts +75 -0
  61. package/dist/src/cursor/adapters/stub-adapter.d.ts.map +1 -0
  62. package/dist/src/cursor/adapters/stub-adapter.js +120 -0
  63. package/dist/src/cursor/adapters/stub-adapter.js.map +1 -0
  64. package/dist/src/cursor/artifact-mapper.d.ts +81 -0
  65. package/dist/src/cursor/artifact-mapper.d.ts.map +1 -0
  66. package/dist/src/cursor/artifact-mapper.js +203 -0
  67. package/dist/src/cursor/artifact-mapper.js.map +1 -0
  68. package/dist/src/cursor/delivery-gate.d.ts +144 -0
  69. package/dist/src/cursor/delivery-gate.d.ts.map +1 -0
  70. package/dist/src/cursor/delivery-gate.js +208 -0
  71. package/dist/src/cursor/delivery-gate.js.map +1 -0
  72. package/dist/src/cursor/glob-matcher.d.ts +30 -0
  73. package/dist/src/cursor/glob-matcher.d.ts.map +1 -0
  74. package/dist/src/cursor/glob-matcher.js +68 -0
  75. package/dist/src/cursor/glob-matcher.js.map +1 -0
  76. package/dist/src/cursor/index.d.ts +43 -0
  77. package/dist/src/cursor/index.d.ts.map +1 -0
  78. package/dist/src/cursor/index.js +44 -0
  79. package/dist/src/cursor/index.js.map +1 -0
  80. package/dist/src/cursor/ocd-evaluator.d.ts +89 -0
  81. package/dist/src/cursor/ocd-evaluator.d.ts.map +1 -0
  82. package/dist/src/cursor/ocd-evaluator.js +142 -0
  83. package/dist/src/cursor/ocd-evaluator.js.map +1 -0
  84. package/dist/src/cursor/types.d.ts +309 -0
  85. package/dist/src/cursor/types.d.ts.map +1 -0
  86. package/dist/src/cursor/types.js +48 -0
  87. package/dist/src/cursor/types.js.map +1 -0
  88. package/dist/src/execution/claude/claude-execution-coordinator.d.ts +164 -0
  89. package/dist/src/execution/claude/claude-execution-coordinator.d.ts.map +1 -0
  90. package/dist/src/execution/claude/claude-execution-coordinator.js +198 -0
  91. package/dist/src/execution/claude/claude-execution-coordinator.js.map +1 -0
  92. package/dist/src/execution/claude/index.d.ts +13 -0
  93. package/dist/src/execution/claude/index.d.ts.map +1 -0
  94. package/dist/src/execution/claude/index.js +12 -0
  95. package/dist/src/execution/claude/index.js.map +1 -0
  96. package/dist/src/execution/cursor/cursor-execution-coordinator.d.ts +216 -0
  97. package/dist/src/execution/cursor/cursor-execution-coordinator.d.ts.map +1 -0
  98. package/dist/src/execution/cursor/cursor-execution-coordinator.js +233 -0
  99. package/dist/src/execution/cursor/cursor-execution-coordinator.js.map +1 -0
  100. package/dist/src/execution/cursor/index.d.ts +20 -0
  101. package/dist/src/execution/cursor/index.d.ts.map +1 -0
  102. package/dist/src/execution/cursor/index.js +18 -0
  103. package/dist/src/execution/cursor/index.js.map +1 -0
  104. package/dist/src/execution/reminders/index.d.ts +11 -0
  105. package/dist/src/execution/reminders/index.d.ts.map +1 -0
  106. package/dist/src/execution/reminders/index.js +9 -0
  107. package/dist/src/execution/reminders/index.js.map +1 -0
  108. package/dist/src/execution/reminders/reminder-execution-coordinator.d.ts +125 -0
  109. package/dist/src/execution/reminders/reminder-execution-coordinator.d.ts.map +1 -0
  110. package/dist/src/execution/reminders/reminder-execution-coordinator.js +129 -0
  111. package/dist/src/execution/reminders/reminder-execution-coordinator.js.map +1 -0
  112. package/dist/src/execution/reminders/reminder-execution-types.d.ts +161 -0
  113. package/dist/src/execution/reminders/reminder-execution-types.d.ts.map +1 -0
  114. package/dist/src/execution/reminders/reminder-execution-types.js +39 -0
  115. package/dist/src/execution/reminders/reminder-execution-types.js.map +1 -0
  116. package/dist/src/execution/reminders/reminder-execution-validator.d.ts +45 -0
  117. package/dist/src/execution/reminders/reminder-execution-validator.d.ts.map +1 -0
  118. package/dist/src/execution/reminders/reminder-execution-validator.js +92 -0
  119. package/dist/src/execution/reminders/reminder-execution-validator.js.map +1 -0
  120. package/dist/src/execution/reminders/reminder-executor.d.ts +62 -0
  121. package/dist/src/execution/reminders/reminder-executor.d.ts.map +1 -0
  122. package/dist/src/execution/reminders/reminder-executor.js +113 -0
  123. package/dist/src/execution/reminders/reminder-executor.js.map +1 -0
  124. package/dist/src/execution/reminders/reminder-time-parser.d.ts +41 -0
  125. package/dist/src/execution/reminders/reminder-time-parser.d.ts.map +1 -0
  126. package/dist/src/execution/reminders/reminder-time-parser.js +113 -0
  127. package/dist/src/execution/reminders/reminder-time-parser.js.map +1 -0
  128. package/dist/src/friction/auto-capture.d.ts +38 -0
  129. package/dist/src/friction/auto-capture.d.ts.map +1 -0
  130. package/dist/src/friction/auto-capture.js +133 -0
  131. package/dist/src/friction/auto-capture.js.map +1 -0
  132. package/dist/src/friction/client.d.ts +39 -0
  133. package/dist/src/friction/client.d.ts.map +1 -0
  134. package/dist/src/friction/client.js +165 -0
  135. package/dist/src/friction/client.js.map +1 -0
  136. package/dist/src/friction/config.d.ts +16 -0
  137. package/dist/src/friction/config.d.ts.map +1 -0
  138. package/dist/src/friction/config.js +56 -0
  139. package/dist/src/friction/config.js.map +1 -0
  140. package/dist/src/friction/github-auth.d.ts +41 -0
  141. package/dist/src/friction/github-auth.d.ts.map +1 -0
  142. package/dist/src/friction/github-auth.js +155 -0
  143. package/dist/src/friction/github-auth.js.map +1 -0
  144. package/dist/src/friction/github-issues.d.ts +51 -0
  145. package/dist/src/friction/github-issues.d.ts.map +1 -0
  146. package/dist/src/friction/github-issues.js +118 -0
  147. package/dist/src/friction/github-issues.js.map +1 -0
  148. package/dist/src/friction/payout-ledger.d.ts +45 -0
  149. package/dist/src/friction/payout-ledger.d.ts.map +1 -0
  150. package/dist/src/friction/payout-ledger.js +111 -0
  151. package/dist/src/friction/payout-ledger.js.map +1 -0
  152. package/dist/src/friction/queue.d.ts +42 -0
  153. package/dist/src/friction/queue.d.ts.map +1 -0
  154. package/dist/src/friction/queue.js +179 -0
  155. package/dist/src/friction/queue.js.map +1 -0
  156. package/dist/src/friction/reviewer.d.ts +42 -0
  157. package/dist/src/friction/reviewer.d.ts.map +1 -0
  158. package/dist/src/friction/reviewer.js +269 -0
  159. package/dist/src/friction/reviewer.js.map +1 -0
  160. package/dist/src/friction/types.d.ts +63 -0
  161. package/dist/src/friction/types.d.ts.map +1 -0
  162. package/dist/src/friction/types.js +18 -0
  163. package/dist/src/friction/types.js.map +1 -0
  164. package/dist/src/history/index.d.ts +39 -0
  165. package/dist/src/history/index.d.ts.map +1 -0
  166. package/dist/src/history/index.js +41 -0
  167. package/dist/src/history/index.js.map +1 -0
  168. package/dist/src/history/session-chain.d.ts +36 -0
  169. package/dist/src/history/session-chain.d.ts.map +1 -0
  170. package/dist/src/history/session-chain.js +91 -0
  171. package/dist/src/history/session-chain.js.map +1 -0
  172. package/dist/src/history/types.d.ts +130 -0
  173. package/dist/src/history/types.d.ts.map +1 -0
  174. package/dist/src/history/types.js +32 -0
  175. package/dist/src/history/types.js.map +1 -0
  176. package/dist/src/history/workflow-history.d.ts +48 -0
  177. package/dist/src/history/workflow-history.d.ts.map +1 -0
  178. package/dist/src/history/workflow-history.js +116 -0
  179. package/dist/src/history/workflow-history.js.map +1 -0
  180. package/dist/src/index.d.ts +88 -0
  181. package/dist/src/index.d.ts.map +1 -0
  182. package/dist/src/index.js +58 -0
  183. package/dist/src/index.js.map +1 -0
  184. package/dist/src/intake/classify-intent-state.d.ts +20 -0
  185. package/dist/src/intake/classify-intent-state.d.ts.map +1 -0
  186. package/dist/src/intake/classify-intent-state.js +29 -0
  187. package/dist/src/intake/classify-intent-state.js.map +1 -0
  188. package/dist/src/intake/intake-service.d.ts +105 -0
  189. package/dist/src/intake/intake-service.d.ts.map +1 -0
  190. package/dist/src/intake/intake-service.js +407 -0
  191. package/dist/src/intake/intake-service.js.map +1 -0
  192. package/dist/src/intake/response-planner.d.ts +25 -0
  193. package/dist/src/intake/response-planner.d.ts.map +1 -0
  194. package/dist/src/intake/response-planner.js +52 -0
  195. package/dist/src/intake/response-planner.js.map +1 -0
  196. package/dist/src/intake/signal-extractor.d.ts +25 -0
  197. package/dist/src/intake/signal-extractor.d.ts.map +1 -0
  198. package/dist/src/intake/signal-extractor.js +42 -0
  199. package/dist/src/intake/signal-extractor.js.map +1 -0
  200. package/dist/src/intake/trace.d.ts +157 -0
  201. package/dist/src/intake/trace.d.ts.map +1 -0
  202. package/dist/src/intake/trace.js +38 -0
  203. package/dist/src/intake/trace.js.map +1 -0
  204. package/dist/src/intake/types.d.ts +70 -0
  205. package/dist/src/intake/types.d.ts.map +1 -0
  206. package/dist/src/intake/types.js +30 -0
  207. package/dist/src/intake/types.js.map +1 -0
  208. package/dist/src/interaction/defaults.d.ts +12 -0
  209. package/dist/src/interaction/defaults.d.ts.map +1 -0
  210. package/dist/src/interaction/defaults.js +26 -0
  211. package/dist/src/interaction/defaults.js.map +1 -0
  212. package/dist/src/interaction/guidance-order.d.ts +53 -0
  213. package/dist/src/interaction/guidance-order.d.ts.map +1 -0
  214. package/dist/src/interaction/guidance-order.js +131 -0
  215. package/dist/src/interaction/guidance-order.js.map +1 -0
  216. package/dist/src/interaction/observe.d.ts +57 -0
  217. package/dist/src/interaction/observe.d.ts.map +1 -0
  218. package/dist/src/interaction/observe.js +77 -0
  219. package/dist/src/interaction/observe.js.map +1 -0
  220. package/dist/src/interaction/selectors.d.ts +16 -0
  221. package/dist/src/interaction/selectors.d.ts.map +1 -0
  222. package/dist/src/interaction/selectors.js +23 -0
  223. package/dist/src/interaction/selectors.js.map +1 -0
  224. package/dist/src/interaction/types.d.ts +105 -0
  225. package/dist/src/interaction/types.d.ts.map +1 -0
  226. package/dist/src/interaction/types.js +48 -0
  227. package/dist/src/interaction/types.js.map +1 -0
  228. package/dist/src/interaction/updater.d.ts +22 -0
  229. package/dist/src/interaction/updater.d.ts.map +1 -0
  230. package/dist/src/interaction/updater.js +87 -0
  231. package/dist/src/interaction/updater.js.map +1 -0
  232. package/dist/src/present/boundary-explanation/boundary-explanation-detector.d.ts +48 -0
  233. package/dist/src/present/boundary-explanation/boundary-explanation-detector.d.ts.map +1 -0
  234. package/dist/src/present/boundary-explanation/boundary-explanation-detector.js +107 -0
  235. package/dist/src/present/boundary-explanation/boundary-explanation-detector.js.map +1 -0
  236. package/dist/src/present/boundary-explanation/boundary-explanation-types.d.ts +43 -0
  237. package/dist/src/present/boundary-explanation/boundary-explanation-types.d.ts.map +1 -0
  238. package/dist/src/present/boundary-explanation/boundary-explanation-types.js +20 -0
  239. package/dist/src/present/boundary-explanation/boundary-explanation-types.js.map +1 -0
  240. package/dist/src/present/boundary-explanation/index.d.ts +10 -0
  241. package/dist/src/present/boundary-explanation/index.d.ts.map +1 -0
  242. package/dist/src/present/boundary-explanation/index.js +2 -0
  243. package/dist/src/present/boundary-explanation/index.js.map +1 -0
  244. package/dist/src/present/control-visibility/control-visibility-assertions.d.ts +70 -0
  245. package/dist/src/present/control-visibility/control-visibility-assertions.d.ts.map +1 -0
  246. package/dist/src/present/control-visibility/control-visibility-assertions.js +138 -0
  247. package/dist/src/present/control-visibility/control-visibility-assertions.js.map +1 -0
  248. package/dist/src/present/control-visibility/control-visibility-evaluator.d.ts +67 -0
  249. package/dist/src/present/control-visibility/control-visibility-evaluator.d.ts.map +1 -0
  250. package/dist/src/present/control-visibility/control-visibility-evaluator.js +146 -0
  251. package/dist/src/present/control-visibility/control-visibility-evaluator.js.map +1 -0
  252. package/dist/src/present/control-visibility/control-visibility-types.d.ts +113 -0
  253. package/dist/src/present/control-visibility/control-visibility-types.d.ts.map +1 -0
  254. package/dist/src/present/control-visibility/control-visibility-types.js +24 -0
  255. package/dist/src/present/control-visibility/control-visibility-types.js.map +1 -0
  256. package/dist/src/present/control-visibility/index.d.ts +16 -0
  257. package/dist/src/present/control-visibility/index.d.ts.map +1 -0
  258. package/dist/src/present/control-visibility/index.js +15 -0
  259. package/dist/src/present/control-visibility/index.js.map +1 -0
  260. package/dist/src/present/format.d.ts +57 -0
  261. package/dist/src/present/format.d.ts.map +1 -0
  262. package/dist/src/present/format.js +150 -0
  263. package/dist/src/present/format.js.map +1 -0
  264. package/dist/src/present/present-coordinator.d.ts +153 -0
  265. package/dist/src/present/present-coordinator.d.ts.map +1 -0
  266. package/dist/src/present/present-coordinator.js +213 -0
  267. package/dist/src/present/present-coordinator.js.map +1 -0
  268. package/dist/src/present/reminders/index.d.ts +22 -0
  269. package/dist/src/present/reminders/index.d.ts.map +1 -0
  270. package/dist/src/present/reminders/index.js +22 -0
  271. package/dist/src/present/reminders/index.js.map +1 -0
  272. package/dist/src/present/reminders/reminder-presenter.d.ts +76 -0
  273. package/dist/src/present/reminders/reminder-presenter.d.ts.map +1 -0
  274. package/dist/src/present/reminders/reminder-presenter.js +359 -0
  275. package/dist/src/present/reminders/reminder-presenter.js.map +1 -0
  276. package/dist/src/present/reminders/reminder-renderer.d.ts +82 -0
  277. package/dist/src/present/reminders/reminder-renderer.d.ts.map +1 -0
  278. package/dist/src/present/reminders/reminder-renderer.js +136 -0
  279. package/dist/src/present/reminders/reminder-renderer.js.map +1 -0
  280. package/dist/src/present/reminders/reminder-types.d.ts +131 -0
  281. package/dist/src/present/reminders/reminder-types.d.ts.map +1 -0
  282. package/dist/src/present/reminders/reminder-types.js +29 -0
  283. package/dist/src/present/reminders/reminder-types.js.map +1 -0
  284. package/dist/src/present/types.d.ts +114 -0
  285. package/dist/src/present/types.d.ts.map +1 -0
  286. package/dist/src/present/types.js +18 -0
  287. package/dist/src/present/types.js.map +1 -0
  288. package/dist/src/product/claude-product-session.d.ts +146 -0
  289. package/dist/src/product/claude-product-session.d.ts.map +1 -0
  290. package/dist/src/product/claude-product-session.js +362 -0
  291. package/dist/src/product/claude-product-session.js.map +1 -0
  292. package/dist/src/product/cursor-product-session.d.ts +211 -0
  293. package/dist/src/product/cursor-product-session.d.ts.map +1 -0
  294. package/dist/src/product/cursor-product-session.js +390 -0
  295. package/dist/src/product/cursor-product-session.js.map +1 -0
  296. package/dist/src/product/index.d.ts +28 -0
  297. package/dist/src/product/index.d.ts.map +1 -0
  298. package/dist/src/product/index.js +22 -0
  299. package/dist/src/product/index.js.map +1 -0
  300. package/dist/src/product/session-resilience/index.d.ts +17 -0
  301. package/dist/src/product/session-resilience/index.d.ts.map +1 -0
  302. package/dist/src/product/session-resilience/index.js +15 -0
  303. package/dist/src/product/session-resilience/index.js.map +1 -0
  304. package/dist/src/product/session-resilience/session-serializer.d.ts +43 -0
  305. package/dist/src/product/session-resilience/session-serializer.d.ts.map +1 -0
  306. package/dist/src/product/session-resilience/session-serializer.js +84 -0
  307. package/dist/src/product/session-resilience/session-serializer.js.map +1 -0
  308. package/dist/src/product/session-resilience/session-snapshot-types.d.ts +35 -0
  309. package/dist/src/product/session-resilience/session-snapshot-types.d.ts.map +1 -0
  310. package/dist/src/product/session-resilience/session-snapshot-types.js +21 -0
  311. package/dist/src/product/session-resilience/session-snapshot-types.js.map +1 -0
  312. package/dist/src/product/session-resilience/session-staleness.d.ts +54 -0
  313. package/dist/src/product/session-resilience/session-staleness.d.ts.map +1 -0
  314. package/dist/src/product/session-resilience/session-staleness.js +62 -0
  315. package/dist/src/product/session-resilience/session-staleness.js.map +1 -0
  316. package/dist/src/product/session-resilience/session-summary.d.ts +40 -0
  317. package/dist/src/product/session-resilience/session-summary.d.ts.map +1 -0
  318. package/dist/src/product/session-resilience/session-summary.js +72 -0
  319. package/dist/src/product/session-resilience/session-summary.js.map +1 -0
  320. package/dist/src/prv/patterns.d.ts +32 -0
  321. package/dist/src/prv/patterns.d.ts.map +1 -0
  322. package/dist/src/prv/patterns.js +40 -0
  323. package/dist/src/prv/patterns.js.map +1 -0
  324. package/dist/src/prv/prv.d.ts +13 -0
  325. package/dist/src/prv/prv.d.ts.map +1 -0
  326. package/dist/src/prv/prv.js +22 -0
  327. package/dist/src/prv/prv.js.map +1 -0
  328. package/dist/src/prv/types.d.ts +26 -0
  329. package/dist/src/prv/types.d.ts.map +1 -0
  330. package/dist/src/prv/types.js +15 -0
  331. package/dist/src/prv/types.js.map +1 -0
  332. package/dist/src/safety/detectors/arbitrary-exec.detector.d.ts +3 -0
  333. package/dist/src/safety/detectors/arbitrary-exec.detector.d.ts.map +1 -0
  334. package/dist/src/safety/detectors/arbitrary-exec.detector.js +31 -0
  335. package/dist/src/safety/detectors/arbitrary-exec.detector.js.map +1 -0
  336. package/dist/src/safety/detectors/bulk-data-exfil.detector.d.ts +21 -0
  337. package/dist/src/safety/detectors/bulk-data-exfil.detector.d.ts.map +1 -0
  338. package/dist/src/safety/detectors/bulk-data-exfil.detector.js +90 -0
  339. package/dist/src/safety/detectors/bulk-data-exfil.detector.js.map +1 -0
  340. package/dist/src/safety/detectors/destructive.detector.d.ts +3 -0
  341. package/dist/src/safety/detectors/destructive.detector.d.ts.map +1 -0
  342. package/dist/src/safety/detectors/destructive.detector.js +28 -0
  343. package/dist/src/safety/detectors/destructive.detector.js.map +1 -0
  344. package/dist/src/safety/detectors/evasion.detector.d.ts +3 -0
  345. package/dist/src/safety/detectors/evasion.detector.d.ts.map +1 -0
  346. package/dist/src/safety/detectors/evasion.detector.js +28 -0
  347. package/dist/src/safety/detectors/evasion.detector.js.map +1 -0
  348. package/dist/src/safety/detectors/secret-access.detector.d.ts +31 -0
  349. package/dist/src/safety/detectors/secret-access.detector.d.ts.map +1 -0
  350. package/dist/src/safety/detectors/secret-access.detector.js +78 -0
  351. package/dist/src/safety/detectors/secret-access.detector.js.map +1 -0
  352. package/dist/src/safety/registry.d.ts +9 -0
  353. package/dist/src/safety/registry.d.ts.map +1 -0
  354. package/dist/src/safety/registry.js +22 -0
  355. package/dist/src/safety/registry.js.map +1 -0
  356. package/dist/src/safety/safety-gate.d.ts +16 -0
  357. package/dist/src/safety/safety-gate.d.ts.map +1 -0
  358. package/dist/src/safety/safety-gate.js +26 -0
  359. package/dist/src/safety/safety-gate.js.map +1 -0
  360. package/dist/src/safety/types.d.ts +35 -0
  361. package/dist/src/safety/types.d.ts.map +1 -0
  362. package/dist/src/safety/types.js +14 -0
  363. package/dist/src/safety/types.js.map +1 -0
  364. package/dist/src/shell/claude-shell.d.ts +63 -0
  365. package/dist/src/shell/claude-shell.d.ts.map +1 -0
  366. package/dist/src/shell/claude-shell.js +81 -0
  367. package/dist/src/shell/claude-shell.js.map +1 -0
  368. package/dist/src/shell/cli/friction-admin.d.ts +14 -0
  369. package/dist/src/shell/cli/friction-admin.d.ts.map +1 -0
  370. package/dist/src/shell/cli/friction-admin.js +276 -0
  371. package/dist/src/shell/cli/friction-admin.js.map +1 -0
  372. package/dist/src/shell/cli/friction-report.d.ts +16 -0
  373. package/dist/src/shell/cli/friction-report.d.ts.map +1 -0
  374. package/dist/src/shell/cli/friction-report.js +156 -0
  375. package/dist/src/shell/cli/friction-report.js.map +1 -0
  376. package/dist/src/shell/cli/main.d.ts +68 -0
  377. package/dist/src/shell/cli/main.d.ts.map +1 -0
  378. package/dist/src/shell/cli/main.js +488 -0
  379. package/dist/src/shell/cli/main.js.map +1 -0
  380. package/dist/src/shell/cli/use-steady.d.ts +26 -0
  381. package/dist/src/shell/cli/use-steady.d.ts.map +1 -0
  382. package/dist/src/shell/cli/use-steady.js +117 -0
  383. package/dist/src/shell/cli/use-steady.js.map +1 -0
  384. package/dist/src/shell/cursor-shell.d.ts +63 -0
  385. package/dist/src/shell/cursor-shell.d.ts.map +1 -0
  386. package/dist/src/shell/cursor-shell.js +88 -0
  387. package/dist/src/shell/cursor-shell.js.map +1 -0
  388. package/dist/src/shell/defaults.d.ts +51 -0
  389. package/dist/src/shell/defaults.d.ts.map +1 -0
  390. package/dist/src/shell/defaults.js +78 -0
  391. package/dist/src/shell/defaults.js.map +1 -0
  392. package/dist/src/shell/history-render.d.ts +56 -0
  393. package/dist/src/shell/history-render.d.ts.map +1 -0
  394. package/dist/src/shell/history-render.js +166 -0
  395. package/dist/src/shell/history-render.js.map +1 -0
  396. package/dist/src/shell/index.d.ts +43 -0
  397. package/dist/src/shell/index.d.ts.map +1 -0
  398. package/dist/src/shell/index.js +45 -0
  399. package/dist/src/shell/index.js.map +1 -0
  400. package/dist/src/shell/render.d.ts +42 -0
  401. package/dist/src/shell/render.d.ts.map +1 -0
  402. package/dist/src/shell/render.js +122 -0
  403. package/dist/src/shell/render.js.map +1 -0
  404. package/dist/src/shell/types.d.ts +46 -0
  405. package/dist/src/shell/types.d.ts.map +1 -0
  406. package/dist/src/shell/types.js +19 -0
  407. package/dist/src/shell/types.js.map +1 -0
  408. package/dist/src/shell/workflow-defaults.d.ts +23 -0
  409. package/dist/src/shell/workflow-defaults.d.ts.map +1 -0
  410. package/dist/src/shell/workflow-defaults.js +27 -0
  411. package/dist/src/shell/workflow-defaults.js.map +1 -0
  412. package/dist/src/shell/workflow-render.d.ts +54 -0
  413. package/dist/src/shell/workflow-render.d.ts.map +1 -0
  414. package/dist/src/shell/workflow-render.js +319 -0
  415. package/dist/src/shell/workflow-render.js.map +1 -0
  416. package/dist/src/shell/workflow-shell.d.ts +110 -0
  417. package/dist/src/shell/workflow-shell.d.ts.map +1 -0
  418. package/dist/src/shell/workflow-shell.js +180 -0
  419. package/dist/src/shell/workflow-shell.js.map +1 -0
  420. package/dist/src/skills/audit.d.ts +118 -0
  421. package/dist/src/skills/audit.d.ts.map +1 -0
  422. package/dist/src/skills/audit.js +147 -0
  423. package/dist/src/skills/audit.js.map +1 -0
  424. package/dist/src/skills/invocation.d.ts +131 -0
  425. package/dist/src/skills/invocation.d.ts.map +1 -0
  426. package/dist/src/skills/invocation.js +165 -0
  427. package/dist/src/skills/invocation.js.map +1 -0
  428. package/dist/src/skills/loader.d.ts +70 -0
  429. package/dist/src/skills/loader.d.ts.map +1 -0
  430. package/dist/src/skills/loader.js +220 -0
  431. package/dist/src/skills/loader.js.map +1 -0
  432. package/dist/src/skills/local-recovery-adapter.d.ts +49 -0
  433. package/dist/src/skills/local-recovery-adapter.d.ts.map +1 -0
  434. package/dist/src/skills/local-recovery-adapter.js +184 -0
  435. package/dist/src/skills/local-recovery-adapter.js.map +1 -0
  436. package/dist/src/skills/parser.d.ts +53 -0
  437. package/dist/src/skills/parser.d.ts.map +1 -0
  438. package/dist/src/skills/parser.js +336 -0
  439. package/dist/src/skills/parser.js.map +1 -0
  440. package/dist/src/skills/registry.d.ts +123 -0
  441. package/dist/src/skills/registry.d.ts.map +1 -0
  442. package/dist/src/skills/registry.js +144 -0
  443. package/dist/src/skills/registry.js.map +1 -0
  444. package/dist/src/skills/types.d.ts +242 -0
  445. package/dist/src/skills/types.d.ts.map +1 -0
  446. package/dist/src/skills/types.js +50 -0
  447. package/dist/src/skills/types.js.map +1 -0
  448. package/dist/src/skills/validator.d.ts +31 -0
  449. package/dist/src/skills/validator.d.ts.map +1 -0
  450. package/dist/src/skills/validator.js +366 -0
  451. package/dist/src/skills/validator.js.map +1 -0
  452. package/dist/src/ucp/envelope.d.ts +165 -0
  453. package/dist/src/ucp/envelope.d.ts.map +1 -0
  454. package/dist/src/ucp/envelope.js +241 -0
  455. package/dist/src/ucp/envelope.js.map +1 -0
  456. package/dist/src/ucp/hashes.d.ts +36 -0
  457. package/dist/src/ucp/hashes.d.ts.map +1 -0
  458. package/dist/src/ucp/hashes.js +59 -0
  459. package/dist/src/ucp/hashes.js.map +1 -0
  460. package/dist/src/ucp/mappers/map-artifact.d.ts +58 -0
  461. package/dist/src/ucp/mappers/map-artifact.d.ts.map +1 -0
  462. package/dist/src/ucp/mappers/map-artifact.js +51 -0
  463. package/dist/src/ucp/mappers/map-artifact.js.map +1 -0
  464. package/dist/src/ucp/mappers/map-change-interpretation.d.ts +12 -0
  465. package/dist/src/ucp/mappers/map-change-interpretation.d.ts.map +1 -0
  466. package/dist/src/ucp/mappers/map-change-interpretation.js +18 -0
  467. package/dist/src/ucp/mappers/map-change-interpretation.js.map +1 -0
  468. package/dist/src/ucp/mappers/map-completion.d.ts +10 -0
  469. package/dist/src/ucp/mappers/map-completion.d.ts.map +1 -0
  470. package/dist/src/ucp/mappers/map-completion.js +24 -0
  471. package/dist/src/ucp/mappers/map-completion.js.map +1 -0
  472. package/dist/src/ucp/mappers/map-context.d.ts +9 -0
  473. package/dist/src/ucp/mappers/map-context.d.ts.map +1 -0
  474. package/dist/src/ucp/mappers/map-context.js +13 -0
  475. package/dist/src/ucp/mappers/map-context.js.map +1 -0
  476. package/dist/src/ucp/mappers/map-debug-trace.d.ts +10 -0
  477. package/dist/src/ucp/mappers/map-debug-trace.d.ts.map +1 -0
  478. package/dist/src/ucp/mappers/map-debug-trace.js +18 -0
  479. package/dist/src/ucp/mappers/map-debug-trace.js.map +1 -0
  480. package/dist/src/ucp/mappers/map-disambiguation.d.ts +10 -0
  481. package/dist/src/ucp/mappers/map-disambiguation.d.ts.map +1 -0
  482. package/dist/src/ucp/mappers/map-disambiguation.js +21 -0
  483. package/dist/src/ucp/mappers/map-disambiguation.js.map +1 -0
  484. package/dist/src/ucp/mappers/map-execution-trace.d.ts +64 -0
  485. package/dist/src/ucp/mappers/map-execution-trace.d.ts.map +1 -0
  486. package/dist/src/ucp/mappers/map-execution-trace.js +57 -0
  487. package/dist/src/ucp/mappers/map-execution-trace.js.map +1 -0
  488. package/dist/src/ucp/mappers/map-intent-interpretation.d.ts +11 -0
  489. package/dist/src/ucp/mappers/map-intent-interpretation.d.ts.map +1 -0
  490. package/dist/src/ucp/mappers/map-intent-interpretation.js +17 -0
  491. package/dist/src/ucp/mappers/map-intent-interpretation.js.map +1 -0
  492. package/dist/src/ucp/mappers/map-intent.d.ts +9 -0
  493. package/dist/src/ucp/mappers/map-intent.d.ts.map +1 -0
  494. package/dist/src/ucp/mappers/map-intent.js +11 -0
  495. package/dist/src/ucp/mappers/map-intent.js.map +1 -0
  496. package/dist/src/ucp/mappers/map-prv.d.ts +10 -0
  497. package/dist/src/ucp/mappers/map-prv.d.ts.map +1 -0
  498. package/dist/src/ucp/mappers/map-prv.js +14 -0
  499. package/dist/src/ucp/mappers/map-prv.js.map +1 -0
  500. package/dist/src/ucp/mappers/map-reminder-execution.d.ts +57 -0
  501. package/dist/src/ucp/mappers/map-reminder-execution.d.ts.map +1 -0
  502. package/dist/src/ucp/mappers/map-reminder-execution.js +69 -0
  503. package/dist/src/ucp/mappers/map-reminder-execution.js.map +1 -0
  504. package/dist/src/ucp/mappers/map-replay-report.d.ts +81 -0
  505. package/dist/src/ucp/mappers/map-replay-report.d.ts.map +1 -0
  506. package/dist/src/ucp/mappers/map-replay-report.js +76 -0
  507. package/dist/src/ucp/mappers/map-replay-report.js.map +1 -0
  508. package/dist/src/ucp/mappers/map-response.d.ts +13 -0
  509. package/dist/src/ucp/mappers/map-response.d.ts.map +1 -0
  510. package/dist/src/ucp/mappers/map-response.js +25 -0
  511. package/dist/src/ucp/mappers/map-response.js.map +1 -0
  512. package/dist/src/ucp/mappers/map-safety.d.ts +14 -0
  513. package/dist/src/ucp/mappers/map-safety.d.ts.map +1 -0
  514. package/dist/src/ucp/mappers/map-safety.js +22 -0
  515. package/dist/src/ucp/mappers/map-safety.js.map +1 -0
  516. package/dist/src/ucp/persistence/index.d.ts +24 -0
  517. package/dist/src/ucp/persistence/index.d.ts.map +1 -0
  518. package/dist/src/ucp/persistence/index.js +22 -0
  519. package/dist/src/ucp/persistence/index.js.map +1 -0
  520. package/dist/src/ucp/persistence/query.d.ts +164 -0
  521. package/dist/src/ucp/persistence/query.d.ts.map +1 -0
  522. package/dist/src/ucp/persistence/query.js +240 -0
  523. package/dist/src/ucp/persistence/query.js.map +1 -0
  524. package/dist/src/ucp/persistence/reader.d.ts +43 -0
  525. package/dist/src/ucp/persistence/reader.d.ts.map +1 -0
  526. package/dist/src/ucp/persistence/reader.js +104 -0
  527. package/dist/src/ucp/persistence/reader.js.map +1 -0
  528. package/dist/src/ucp/persistence/store.d.ts +77 -0
  529. package/dist/src/ucp/persistence/store.d.ts.map +1 -0
  530. package/dist/src/ucp/persistence/store.js +177 -0
  531. package/dist/src/ucp/persistence/store.js.map +1 -0
  532. package/dist/src/ucp/persistence/write.d.ts +48 -0
  533. package/dist/src/ucp/persistence/write.d.ts.map +1 -0
  534. package/dist/src/ucp/persistence/write.js +59 -0
  535. package/dist/src/ucp/persistence/write.js.map +1 -0
  536. package/dist/src/ucp/projection.d.ts +146 -0
  537. package/dist/src/ucp/projection.d.ts.map +1 -0
  538. package/dist/src/ucp/projection.js +139 -0
  539. package/dist/src/ucp/projection.js.map +1 -0
  540. package/dist/src/ucp/types.d.ts +585 -0
  541. package/dist/src/ucp/types.d.ts.map +1 -0
  542. package/dist/src/ucp/types.js +57 -0
  543. package/dist/src/ucp/types.js.map +1 -0
  544. package/dist/src/understand/completion/completion.d.ts +26 -0
  545. package/dist/src/understand/completion/completion.d.ts.map +1 -0
  546. package/dist/src/understand/completion/completion.js +45 -0
  547. package/dist/src/understand/completion/completion.js.map +1 -0
  548. package/dist/src/understand/completion/rules.d.ts +61 -0
  549. package/dist/src/understand/completion/rules.d.ts.map +1 -0
  550. package/dist/src/understand/completion/rules.js +268 -0
  551. package/dist/src/understand/completion/rules.js.map +1 -0
  552. package/dist/src/understand/completion/types.d.ts +68 -0
  553. package/dist/src/understand/completion/types.d.ts.map +1 -0
  554. package/dist/src/understand/completion/types.js +34 -0
  555. package/dist/src/understand/completion/types.js.map +1 -0
  556. package/dist/src/understand/context/context-alignment.d.ts +18 -0
  557. package/dist/src/understand/context/context-alignment.d.ts.map +1 -0
  558. package/dist/src/understand/context/context-alignment.js +61 -0
  559. package/dist/src/understand/context/context-alignment.js.map +1 -0
  560. package/dist/src/understand/context/types.d.ts +20 -0
  561. package/dist/src/understand/context/types.d.ts.map +1 -0
  562. package/dist/src/understand/context/types.js +13 -0
  563. package/dist/src/understand/context/types.js.map +1 -0
  564. package/dist/src/understand/disambiguation/detectors/missing-context.detector.d.ts +12 -0
  565. package/dist/src/understand/disambiguation/detectors/missing-context.detector.d.ts.map +1 -0
  566. package/dist/src/understand/disambiguation/detectors/missing-context.detector.js +60 -0
  567. package/dist/src/understand/disambiguation/detectors/missing-context.detector.js.map +1 -0
  568. package/dist/src/understand/disambiguation/detectors/overloaded-term.detector.d.ts +13 -0
  569. package/dist/src/understand/disambiguation/detectors/overloaded-term.detector.d.ts.map +1 -0
  570. package/dist/src/understand/disambiguation/detectors/overloaded-term.detector.js +57 -0
  571. package/dist/src/understand/disambiguation/detectors/overloaded-term.detector.js.map +1 -0
  572. package/dist/src/understand/disambiguation/detectors/typo-adjacent.detector.d.ts +16 -0
  573. package/dist/src/understand/disambiguation/detectors/typo-adjacent.detector.d.ts.map +1 -0
  574. package/dist/src/understand/disambiguation/detectors/typo-adjacent.detector.js +56 -0
  575. package/dist/src/understand/disambiguation/detectors/typo-adjacent.detector.js.map +1 -0
  576. package/dist/src/understand/disambiguation/registry.d.ts +14 -0
  577. package/dist/src/understand/disambiguation/registry.d.ts.map +1 -0
  578. package/dist/src/understand/disambiguation/registry.js +27 -0
  579. package/dist/src/understand/disambiguation/registry.js.map +1 -0
  580. package/dist/src/understand/disambiguation/types.d.ts +34 -0
  581. package/dist/src/understand/disambiguation/types.d.ts.map +1 -0
  582. package/dist/src/understand/disambiguation/types.js +15 -0
  583. package/dist/src/understand/disambiguation/types.js.map +1 -0
  584. package/dist/src/understand/intent-interpretation/intent-interpretation.d.ts +86 -0
  585. package/dist/src/understand/intent-interpretation/intent-interpretation.d.ts.map +1 -0
  586. package/dist/src/understand/intent-interpretation/intent-interpretation.js +141 -0
  587. package/dist/src/understand/intent-interpretation/intent-interpretation.js.map +1 -0
  588. package/dist/src/understand/intent-interpretation/interpreters/color-intent.interpreter.d.ts +33 -0
  589. package/dist/src/understand/intent-interpretation/interpreters/color-intent.interpreter.d.ts.map +1 -0
  590. package/dist/src/understand/intent-interpretation/interpreters/color-intent.interpreter.js +66 -0
  591. package/dist/src/understand/intent-interpretation/interpreters/color-intent.interpreter.js.map +1 -0
  592. package/dist/src/understand/intent-interpretation/interpreters/config-intent.interpreter.d.ts +20 -0
  593. package/dist/src/understand/intent-interpretation/interpreters/config-intent.interpreter.d.ts.map +1 -0
  594. package/dist/src/understand/intent-interpretation/interpreters/config-intent.interpreter.js +80 -0
  595. package/dist/src/understand/intent-interpretation/interpreters/config-intent.interpreter.js.map +1 -0
  596. package/dist/src/understand/intent-interpretation/interpreters/text-intent.interpreter.d.ts +25 -0
  597. package/dist/src/understand/intent-interpretation/interpreters/text-intent.interpreter.d.ts.map +1 -0
  598. package/dist/src/understand/intent-interpretation/interpreters/text-intent.interpreter.js +47 -0
  599. package/dist/src/understand/intent-interpretation/interpreters/text-intent.interpreter.js.map +1 -0
  600. package/dist/src/understand/intent-interpretation/interpreters/workflow-intent.interpreter.d.ts +35 -0
  601. package/dist/src/understand/intent-interpretation/interpreters/workflow-intent.interpreter.d.ts.map +1 -0
  602. package/dist/src/understand/intent-interpretation/interpreters/workflow-intent.interpreter.js +89 -0
  603. package/dist/src/understand/intent-interpretation/interpreters/workflow-intent.interpreter.js.map +1 -0
  604. package/dist/src/understand/intent-interpretation/registry.d.ts +18 -0
  605. package/dist/src/understand/intent-interpretation/registry.d.ts.map +1 -0
  606. package/dist/src/understand/intent-interpretation/registry.js +26 -0
  607. package/dist/src/understand/intent-interpretation/registry.js.map +1 -0
  608. package/dist/src/understand/intent-interpretation/types.d.ts +83 -0
  609. package/dist/src/understand/intent-interpretation/types.d.ts.map +1 -0
  610. package/dist/src/understand/intent-interpretation/types.js +40 -0
  611. package/dist/src/understand/intent-interpretation/types.js.map +1 -0
  612. package/dist/src/understand/interpretation/intent.d.ts +72 -0
  613. package/dist/src/understand/interpretation/intent.d.ts.map +1 -0
  614. package/dist/src/understand/interpretation/intent.js +414 -0
  615. package/dist/src/understand/interpretation/intent.js.map +1 -0
  616. package/dist/src/understand/interpretation/interpretation.d.ts +26 -0
  617. package/dist/src/understand/interpretation/interpretation.d.ts.map +1 -0
  618. package/dist/src/understand/interpretation/interpretation.js +43 -0
  619. package/dist/src/understand/interpretation/interpretation.js.map +1 -0
  620. package/dist/src/understand/interpretation/parser.d.ts +20 -0
  621. package/dist/src/understand/interpretation/parser.d.ts.map +1 -0
  622. package/dist/src/understand/interpretation/parser.js +88 -0
  623. package/dist/src/understand/interpretation/parser.js.map +1 -0
  624. package/dist/src/understand/interpretation/rules.d.ts +19 -0
  625. package/dist/src/understand/interpretation/rules.d.ts.map +1 -0
  626. package/dist/src/understand/interpretation/rules.js +222 -0
  627. package/dist/src/understand/interpretation/rules.js.map +1 -0
  628. package/dist/src/understand/interpretation/types.d.ts +90 -0
  629. package/dist/src/understand/interpretation/types.d.ts.map +1 -0
  630. package/dist/src/understand/interpretation/types.js +29 -0
  631. package/dist/src/understand/interpretation/types.js.map +1 -0
  632. package/dist/src/understand/shared/types.d.ts +13 -0
  633. package/dist/src/understand/shared/types.d.ts.map +1 -0
  634. package/dist/src/understand/shared/types.js +9 -0
  635. package/dist/src/understand/shared/types.js.map +1 -0
  636. package/dist/src/understand/silent-guidance/index.d.ts +4 -0
  637. package/dist/src/understand/silent-guidance/index.d.ts.map +1 -0
  638. package/dist/src/understand/silent-guidance/index.js +3 -0
  639. package/dist/src/understand/silent-guidance/index.js.map +1 -0
  640. package/dist/src/understand/silent-guidance/selector.d.ts +44 -0
  641. package/dist/src/understand/silent-guidance/selector.d.ts.map +1 -0
  642. package/dist/src/understand/silent-guidance/selector.js +158 -0
  643. package/dist/src/understand/silent-guidance/selector.js.map +1 -0
  644. package/dist/src/understand/silent-guidance/templates.d.ts +31 -0
  645. package/dist/src/understand/silent-guidance/templates.d.ts.map +1 -0
  646. package/dist/src/understand/silent-guidance/templates.js +109 -0
  647. package/dist/src/understand/silent-guidance/templates.js.map +1 -0
  648. package/dist/src/understand/silent-guidance/types.d.ts +36 -0
  649. package/dist/src/understand/silent-guidance/types.d.ts.map +1 -0
  650. package/dist/src/understand/silent-guidance/types.js +2 -0
  651. package/dist/src/understand/silent-guidance/types.js.map +1 -0
  652. package/dist/src/workflow/coordinator.d.ts +197 -0
  653. package/dist/src/workflow/coordinator.d.ts.map +1 -0
  654. package/dist/src/workflow/coordinator.js +682 -0
  655. package/dist/src/workflow/coordinator.js.map +1 -0
  656. package/dist/src/workflow/index.d.ts +30 -0
  657. package/dist/src/workflow/index.d.ts.map +1 -0
  658. package/dist/src/workflow/index.js +30 -0
  659. package/dist/src/workflow/index.js.map +1 -0
  660. package/dist/src/workflow/types.d.ts +213 -0
  661. package/dist/src/workflow/types.d.ts.map +1 -0
  662. package/dist/src/workflow/types.js +27 -0
  663. package/dist/src/workflow/types.js.map +1 -0
  664. package/package.json +54 -0
  665. package/ui/README.md +73 -0
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Claude API Adapter — Phase 8C.
3
+ *
4
+ * ── Role ──────────────────────────────────────────────────────────────────────
5
+ *
6
+ * The real ClaudeAgentPlugin implementation. Translates a ClaudeDeliveryRequest
7
+ * into an Anthropic API call and maps the response back to ClaudeDeliveryResponse.
8
+ *
9
+ * This is the transport-specific adapter the delivery gate uses when operating
10
+ * against the real Anthropic API. It replaces ClaudeStubAdapter in production.
11
+ *
12
+ * ── What this adapter does ────────────────────────────────────────────────────
13
+ *
14
+ * 1. Builds a system prompt from artifact constraints (allowedFiles,
15
+ * prohibitedPatterns, allowedTools, executionDomain).
16
+ * 2. Builds the user message from taskSpec ONLY — never from raw user input.
17
+ * 3. Maps allowedTools names to Anthropic tool schemas (known-tool registry).
18
+ * 4. Always includes `request_scope_clarification` as a gate protocol tool.
19
+ * 5. Calls the Anthropic messages API.
20
+ * 6. Maps the API response to ClaudeDeliveryResponse:
21
+ * - stop_reason "end_turn" → accepted (sessionId = API response id)
22
+ * - tool_use + scope tool → refused_due_to_scope with candidates
23
+ * - tool_use + other → accepted (Claude used a task tool; session live)
24
+ * - API error / timeout → refused_due_to_execution_error
25
+ * - Network interruption → refused_due_to_execution_error (code: session_interrupted)
26
+ *
27
+ * ── Model Insertion Policy (Section 9.5) ─────────────────────────────────────
28
+ *
29
+ * This module calls the Anthropic API. A deterministic bypass path is required.
30
+ * Bypass is provided by passing `bypass: ClaudeAgentPlugin` in the config and
31
+ * setting the environment variable USESTEADY_USE_CLAUDE to any value other than "true".
32
+ * In CI, callers use ClaudeStubAdapter as the bypass.
33
+ *
34
+ * ── Phase A locked truths (enforced here) ────────────────────────────────────
35
+ *
36
+ * A1 — We never re-classify executionDomain. We use artifact.executionDomain as-is.
37
+ * A2 — networkAccess "deny" is enforced at the system prompt level: no HTTP tools.
38
+ * A3 — On interruption/timeout, we return session_interrupted (non-resumable).
39
+ * A4 — We never call back into Intake. We use only artifact.taskSpec for prompts.
40
+ *
41
+ * ── Candidate generation (Phase 8C) ──────────────────────────────────────────
42
+ *
43
+ * When Claude calls `request_scope_clarification`, it provides candidates from
44
+ * within allowedFiles (or searches within the workspace for real candidate paths).
45
+ * This is the Phase 8C upgrade over the stub, which used pre-configured candidates.
46
+ *
47
+ * See: docs/claude-agent-phase-a-architecture.md
48
+ */
49
+ import Anthropic from "@anthropic-ai/sdk";
50
+ import type { ClaudeAgentPlugin } from "../delivery-gate.js";
51
+ import type { ClaudeDeliveryRequest, ClaudeDeliveryResponse } from "../types.js";
52
+ /**
53
+ * Configuration for ClaudeApiAdapter.
54
+ *
55
+ * apiKey — Anthropic API key. Required.
56
+ * model — Anthropic model ID. Defaults to "claude-opus-4-5".
57
+ * maxTokens — Max tokens for the response. Defaults to 4096.
58
+ * timeoutMs — API call timeout. Defaults to 30 000 ms.
59
+ * bypass — Deterministic fallback plugin (model insertion policy).
60
+ * Used when USESTEADY_USE_CLAUDE !== "true".
61
+ * _anthropic — Injectable Anthropic client (for testing only).
62
+ * When provided, the real Anthropic client is not created.
63
+ */
64
+ export type ClaudeApiAdapterConfig = {
65
+ readonly apiKey: string;
66
+ readonly model?: string;
67
+ readonly maxTokens?: number;
68
+ readonly timeoutMs?: number;
69
+ /** Deterministic fallback for CI and model-disabled environments. */
70
+ readonly bypass?: ClaudeAgentPlugin;
71
+ /** Injectable Anthropic client for unit tests. Not for production use. */
72
+ readonly _anthropic?: Pick<Anthropic, "messages">;
73
+ };
74
+ /**
75
+ * ClaudeApiAdapter — real ClaudeAgentPlugin backed by the Anthropic API.
76
+ *
77
+ * Production usage:
78
+ * const adapter = new ClaudeApiAdapter({ apiKey: process.env.ANTHROPIC_API_KEY! });
79
+ * const gate = new ClaudeDeliveryGate(adapter, storeDir);
80
+ *
81
+ * CI usage (model disabled):
82
+ * const adapter = new ClaudeApiAdapter({
83
+ * apiKey: "ci-key",
84
+ * bypass: ClaudeStubAdapter.accepted("ci-session"),
85
+ * });
86
+ * // USESTEADY_USE_CLAUDE is unset → bypass is used automatically
87
+ */
88
+ export declare class ClaudeApiAdapter implements ClaudeAgentPlugin {
89
+ private readonly client;
90
+ private readonly model;
91
+ private readonly maxTokens;
92
+ private readonly timeoutMs;
93
+ private readonly bypass;
94
+ constructor(config: ClaudeApiAdapterConfig);
95
+ receive(request: ClaudeDeliveryRequest): Promise<ClaudeDeliveryResponse>;
96
+ /** Returns true if the adapter is configured to make real API calls. */
97
+ get isLive(): boolean;
98
+ }
99
+ //# sourceMappingURL=api-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-adapter.d.ts","sourceRoot":"","sources":["../../../../src/claude/adapters/api-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAU,qBAAqB,CAAC;AACjE,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EAIvB,MAAM,aAAa,CAAC;AAIrB;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,MAAM,EAAQ,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAQ,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAI,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAI,MAAM,CAAC;IAC9B,qEAAqE;IACrE,QAAQ,CAAC,MAAM,CAAC,EAAO,iBAAiB,CAAC;IACzC,0EAA0E;IAC1E,QAAQ,CAAC,UAAU,CAAC,EAAG,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;CACpD,CAAC;AAUF;;;;;;;;;;;;;GAaG;AACH,qBAAa,gBAAiB,YAAW,iBAAiB;IACxD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiC;IACxD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmC;gBAE9C,MAAM,EAAE,sBAAsB;IAWpC,OAAO,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IA4B9E,wEAAwE;IACxE,IAAI,MAAM,IAAI,OAAO,CAEpB;CACF"}
@@ -0,0 +1,415 @@
1
+ /**
2
+ * Claude API Adapter — Phase 8C.
3
+ *
4
+ * ── Role ──────────────────────────────────────────────────────────────────────
5
+ *
6
+ * The real ClaudeAgentPlugin implementation. Translates a ClaudeDeliveryRequest
7
+ * into an Anthropic API call and maps the response back to ClaudeDeliveryResponse.
8
+ *
9
+ * This is the transport-specific adapter the delivery gate uses when operating
10
+ * against the real Anthropic API. It replaces ClaudeStubAdapter in production.
11
+ *
12
+ * ── What this adapter does ────────────────────────────────────────────────────
13
+ *
14
+ * 1. Builds a system prompt from artifact constraints (allowedFiles,
15
+ * prohibitedPatterns, allowedTools, executionDomain).
16
+ * 2. Builds the user message from taskSpec ONLY — never from raw user input.
17
+ * 3. Maps allowedTools names to Anthropic tool schemas (known-tool registry).
18
+ * 4. Always includes `request_scope_clarification` as a gate protocol tool.
19
+ * 5. Calls the Anthropic messages API.
20
+ * 6. Maps the API response to ClaudeDeliveryResponse:
21
+ * - stop_reason "end_turn" → accepted (sessionId = API response id)
22
+ * - tool_use + scope tool → refused_due_to_scope with candidates
23
+ * - tool_use + other → accepted (Claude used a task tool; session live)
24
+ * - API error / timeout → refused_due_to_execution_error
25
+ * - Network interruption → refused_due_to_execution_error (code: session_interrupted)
26
+ *
27
+ * ── Model Insertion Policy (Section 9.5) ─────────────────────────────────────
28
+ *
29
+ * This module calls the Anthropic API. A deterministic bypass path is required.
30
+ * Bypass is provided by passing `bypass: ClaudeAgentPlugin` in the config and
31
+ * setting the environment variable USESTEADY_USE_CLAUDE to any value other than "true".
32
+ * In CI, callers use ClaudeStubAdapter as the bypass.
33
+ *
34
+ * ── Phase A locked truths (enforced here) ────────────────────────────────────
35
+ *
36
+ * A1 — We never re-classify executionDomain. We use artifact.executionDomain as-is.
37
+ * A2 — networkAccess "deny" is enforced at the system prompt level: no HTTP tools.
38
+ * A3 — On interruption/timeout, we return session_interrupted (non-resumable).
39
+ * A4 — We never call back into Intake. We use only artifact.taskSpec for prompts.
40
+ *
41
+ * ── Candidate generation (Phase 8C) ──────────────────────────────────────────
42
+ *
43
+ * When Claude calls `request_scope_clarification`, it provides candidates from
44
+ * within allowedFiles (or searches within the workspace for real candidate paths).
45
+ * This is the Phase 8C upgrade over the stub, which used pre-configured candidates.
46
+ *
47
+ * See: docs/claude-agent-phase-a-architecture.md
48
+ */
49
+ import Anthropic from "@anthropic-ai/sdk";
50
+ // ─── Defaults ─────────────────────────────────────────────────────────────────
51
+ const DEFAULT_MODEL = "claude-opus-4-5";
52
+ const DEFAULT_MAX_TOKENS = 4096;
53
+ const DEFAULT_TIMEOUT_MS = 30_000;
54
+ // ─── Adapter ──────────────────────────────────────────────────────────────────
55
+ /**
56
+ * ClaudeApiAdapter — real ClaudeAgentPlugin backed by the Anthropic API.
57
+ *
58
+ * Production usage:
59
+ * const adapter = new ClaudeApiAdapter({ apiKey: process.env.ANTHROPIC_API_KEY! });
60
+ * const gate = new ClaudeDeliveryGate(adapter, storeDir);
61
+ *
62
+ * CI usage (model disabled):
63
+ * const adapter = new ClaudeApiAdapter({
64
+ * apiKey: "ci-key",
65
+ * bypass: ClaudeStubAdapter.accepted("ci-session"),
66
+ * });
67
+ * // USESTEADY_USE_CLAUDE is unset → bypass is used automatically
68
+ */
69
+ export class ClaudeApiAdapter {
70
+ client;
71
+ model;
72
+ maxTokens;
73
+ timeoutMs;
74
+ bypass;
75
+ constructor(config) {
76
+ this.client = config._anthropic ?? new Anthropic({
77
+ apiKey: config.apiKey,
78
+ timeout: config.timeoutMs ?? DEFAULT_TIMEOUT_MS,
79
+ });
80
+ this.model = config.model ?? DEFAULT_MODEL;
81
+ this.maxTokens = config.maxTokens ?? DEFAULT_MAX_TOKENS;
82
+ this.timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
83
+ this.bypass = config.bypass;
84
+ }
85
+ async receive(request) {
86
+ // Model Insertion Policy: use bypass when Claude is not enabled
87
+ if (!isClaudeEnabled() && this.bypass !== undefined) {
88
+ return this.bypass.receive(request);
89
+ }
90
+ const { artifact } = request;
91
+ const systemPrompt = buildSystemPrompt(artifact);
92
+ const userMessage = buildUserMessage(artifact.taskSpec);
93
+ const tools = resolveTools(artifact.allowedTools);
94
+ try {
95
+ const response = await this.client.messages.create({
96
+ model: this.model,
97
+ max_tokens: this.maxTokens,
98
+ system: systemPrompt,
99
+ messages: [{ role: "user", content: userMessage }],
100
+ tools,
101
+ });
102
+ return mapApiResponse(response, artifact);
103
+ }
104
+ catch (err) {
105
+ return mapApiError(err);
106
+ }
107
+ }
108
+ /** Returns true if the adapter is configured to make real API calls. */
109
+ get isLive() {
110
+ return isClaudeEnabled() || this.bypass === undefined;
111
+ }
112
+ }
113
+ // ─── Model insertion policy ───────────────────────────────────────────────────
114
+ function isClaudeEnabled() {
115
+ return process.env["USESTEADY_USE_CLAUDE"] === "true";
116
+ }
117
+ // ─── System prompt ────────────────────────────────────────────────────────────
118
+ function buildSystemPrompt(artifact) {
119
+ const lines = [
120
+ "You are a governed code editor operating under the UseSteady control framework.",
121
+ "",
122
+ "═══ AUTHORITY CONSTRAINTS (non-negotiable) ═══",
123
+ "",
124
+ ];
125
+ // File scope
126
+ if (artifact.allowedFiles.length > 0) {
127
+ lines.push("ALLOWED FILES (you may ONLY edit or read these paths):", ...artifact.allowedFiles.map((f) => ` - ${f}`), "");
128
+ }
129
+ else {
130
+ lines.push("ALLOWED FILES: No explicit restriction. Search within the workspace.", "");
131
+ }
132
+ // Prohibited patterns
133
+ if (artifact.prohibitedPatterns.length > 0) {
134
+ lines.push("PROHIBITED PATTERNS (you must NEVER touch files matching these globs):", ...artifact.prohibitedPatterns.map((p) => ` - ${p}`), "");
135
+ }
136
+ // Tool constraints
137
+ lines.push("ALLOWED TOOLS:", ...artifact.allowedTools.map((t) => ` - ${t}`), "", "NETWORK ACCESS: DENIED. You must not attempt any external HTTP requests.", "FILESYSTEM MODE: scoped_only. All file operations must stay within allowedFiles.", "");
138
+ // OCD clearance status
139
+ lines.push(`OCD CLEARANCE: ${artifact.ocdClearance === "clear"
140
+ ? "clear — no detected conflicts."
141
+ : "conflict_accepted — human has reviewed and accepted the conflict."}`, "", "═══ SCOPE CLARIFICATION PROTOCOL ═══", "", "If the target file is ambiguous or not in allowedFiles, you MUST call", "request_scope_clarification with real file path candidates.", "Do NOT guess file paths. Do NOT widen scope beyond allowedFiles.", "", "═══ TASK ═══");
142
+ lines.push("", `Execution domain: ${artifact.executionDomain}`);
143
+ return lines.join("\n");
144
+ }
145
+ // ─── User message ─────────────────────────────────────────────────────────────
146
+ function buildUserMessage(taskSpec) {
147
+ const lines = [
148
+ `Task category: ${taskSpec.category}`,
149
+ `Task summary: ${taskSpec.summary}`,
150
+ ];
151
+ if (taskSpec.parsedChange) {
152
+ const pc = taskSpec.parsedChange;
153
+ lines.push("");
154
+ lines.push("Structured edit:");
155
+ if (pc.filePath)
156
+ lines.push(` File: ${pc.filePath}`);
157
+ if (pc.oldValue)
158
+ lines.push(` Replace: "${pc.oldValue}"`);
159
+ if (pc.newValue)
160
+ lines.push(` With: "${pc.newValue}"`);
161
+ }
162
+ lines.push("");
163
+ lines.push("Complete the task using only the allowed tools and files. " +
164
+ "If the scope is ambiguous, call request_scope_clarification.");
165
+ return lines.join("\n");
166
+ }
167
+ // ─── Tool resolution ──────────────────────────────────────────────────────────
168
+ /**
169
+ * The gate protocol tool — always included regardless of allowedTools.
170
+ * Claude calls this when scope clarification is needed before it can proceed.
171
+ */
172
+ const SCOPE_CLARIFICATION_TOOL = {
173
+ name: "request_scope_clarification",
174
+ description: "Call this when you cannot proceed without human clarification about which file(s) " +
175
+ "or scope to apply the change to. Provide the candidates you found, or an empty array " +
176
+ "if no matching candidates exist.",
177
+ input_schema: {
178
+ type: "object",
179
+ properties: {
180
+ questionKind: {
181
+ type: "string",
182
+ enum: [
183
+ "need_file_path",
184
+ "need_scope_selection",
185
+ "need_tool_permission",
186
+ "ambiguous_old_value",
187
+ ],
188
+ description: "The kind of scope ambiguity encountered.",
189
+ },
190
+ candidates: {
191
+ type: "array",
192
+ items: { type: "string" },
193
+ description: "List of candidate file paths or values for human selection.",
194
+ },
195
+ explanation: {
196
+ type: "string",
197
+ description: "Human-readable description of the ambiguity.",
198
+ },
199
+ },
200
+ required: ["questionKind", "candidates", "explanation"],
201
+ },
202
+ };
203
+ /**
204
+ * Known V1 tool registry.
205
+ *
206
+ * Maps tool names (as they appear in allowedTools) to Anthropic tool schemas.
207
+ * Only tools in this registry may be used via the Claude seam.
208
+ * Network-enabled tools are intentionally excluded (A2: networkAccess deny).
209
+ */
210
+ const KNOWN_TOOLS = {
211
+ str_replace_editor: {
212
+ name: "str_replace_editor",
213
+ description: "View and edit file contents using exact string replacement. " +
214
+ "Only operates on files within the approved scope.",
215
+ input_schema: {
216
+ type: "object",
217
+ properties: {
218
+ command: {
219
+ type: "string",
220
+ enum: ["view", "str_replace", "create", "insert"],
221
+ description: "The editing command to execute.",
222
+ },
223
+ path: {
224
+ type: "string",
225
+ description: "File path relative to workspace root (must be within allowedFiles).",
226
+ },
227
+ old_str: {
228
+ type: "string",
229
+ description: "The exact string to search for (required for str_replace).",
230
+ },
231
+ new_str: {
232
+ type: "string",
233
+ description: "The replacement string (required for str_replace and insert).",
234
+ },
235
+ insert_line: {
236
+ type: "number",
237
+ description: "Line number to insert after (required for insert).",
238
+ },
239
+ },
240
+ required: ["command", "path"],
241
+ },
242
+ },
243
+ read_file: {
244
+ name: "read_file",
245
+ description: "Read the contents of a file. Only reads files within the approved scope.",
246
+ input_schema: {
247
+ type: "object",
248
+ properties: {
249
+ path: {
250
+ type: "string",
251
+ description: "File path relative to workspace root.",
252
+ },
253
+ start_line: {
254
+ type: "number",
255
+ description: "First line to return (1-based, optional).",
256
+ },
257
+ end_line: {
258
+ type: "number",
259
+ description: "Last line to return (1-based, optional).",
260
+ },
261
+ },
262
+ required: ["path"],
263
+ },
264
+ },
265
+ list_files: {
266
+ name: "list_files",
267
+ description: "List files matching a glob pattern within the workspace. " +
268
+ "Results are constrained to allowedFiles scope.",
269
+ input_schema: {
270
+ type: "object",
271
+ properties: {
272
+ pattern: {
273
+ type: "string",
274
+ description: "Glob pattern to match (e.g. 'src/**/*.ts').",
275
+ },
276
+ },
277
+ required: ["pattern"],
278
+ },
279
+ },
280
+ run_tests: {
281
+ name: "run_tests",
282
+ description: "Run the test suite for a specific file or pattern. " +
283
+ "Results are returned as structured pass/fail output.",
284
+ input_schema: {
285
+ type: "object",
286
+ properties: {
287
+ pattern: {
288
+ type: "string",
289
+ description: "Test file path or glob pattern.",
290
+ },
291
+ },
292
+ required: ["pattern"],
293
+ },
294
+ },
295
+ };
296
+ function resolveTools(allowedTools) {
297
+ const tools = [SCOPE_CLARIFICATION_TOOL];
298
+ for (const toolName of allowedTools) {
299
+ const def = KNOWN_TOOLS[toolName];
300
+ if (def !== undefined) {
301
+ tools.push(def);
302
+ }
303
+ }
304
+ return tools;
305
+ }
306
+ // ─── Response mapping ─────────────────────────────────────────────────────────
307
+ function mapApiResponse(response, artifact) {
308
+ // Scope clarification: Claude called request_scope_clarification
309
+ if (response.stop_reason === "tool_use") {
310
+ const scopeQuestion = extractScopeQuestion(response, artifact);
311
+ if (scopeQuestion !== null) {
312
+ return { kind: "refused_due_to_scope", question: scopeQuestion };
313
+ }
314
+ // Claude used a task tool (not scope clarification) — session is live
315
+ return { kind: "accepted", sessionId: response.id };
316
+ }
317
+ // Normal completion
318
+ if (response.stop_reason === "end_turn") {
319
+ return { kind: "accepted", sessionId: response.id };
320
+ }
321
+ // max_tokens reached: not a clean completion, but not a refusal either
322
+ // Treat as accepted — the session ran; content may be truncated
323
+ if (response.stop_reason === "max_tokens") {
324
+ return { kind: "accepted", sessionId: response.id };
325
+ }
326
+ // stop_sequence or unknown stop_reason: fail-closed
327
+ return {
328
+ kind: "refused_due_to_execution_error",
329
+ code: "unexpected_stop_reason",
330
+ message: `Claude stopped with unexpected reason: "${response.stop_reason}".`,
331
+ };
332
+ }
333
+ function extractScopeQuestion(response, artifact) {
334
+ for (const block of response.content) {
335
+ if (block.type !== "tool_use")
336
+ continue;
337
+ if (block.name !== "request_scope_clarification")
338
+ continue;
339
+ const input = block.input;
340
+ const questionKind = input["questionKind"];
341
+ const rawCandidates = input["candidates"];
342
+ const explanation = input["explanation"] ?? "Scope clarification needed.";
343
+ if (!questionKind)
344
+ continue;
345
+ // Candidates: Claude-provided list, filtered to be within allowedFiles (or all if empty scope)
346
+ const candidates = normalizeCandidates(rawCandidates, artifact);
347
+ return { questionKind, candidates, explanation };
348
+ }
349
+ return null;
350
+ }
351
+ /**
352
+ * Normalize scope candidates from Claude's tool call.
353
+ *
354
+ * If allowedFiles is non-empty, filters candidates to those matching the allowed set.
355
+ * If no filtered candidates remain, returns all as-is (human will decide scope).
356
+ */
357
+ function normalizeCandidates(rawCandidates, artifact) {
358
+ if (!Array.isArray(rawCandidates))
359
+ return [];
360
+ const candidates = rawCandidates
361
+ .filter((c) => typeof c === "string" && c.trim().length > 0)
362
+ .map((c) => c.trim());
363
+ if (artifact.allowedFiles.length === 0 || candidates.length === 0) {
364
+ return candidates;
365
+ }
366
+ // Filter to paths within allowedFiles
367
+ const allowed = new Set(artifact.allowedFiles);
368
+ const filtered = candidates.filter((c) => allowed.has(c));
369
+ return filtered.length > 0 ? filtered : candidates;
370
+ }
371
+ // ─── Error mapping ────────────────────────────────────────────────────────────
372
+ function mapApiError(err) {
373
+ if (err instanceof Anthropic.APIConnectionError ||
374
+ err instanceof Anthropic.APIConnectionTimeoutError) {
375
+ return {
376
+ kind: "refused_due_to_execution_error",
377
+ code: "session_interrupted",
378
+ message: "Claude session was interrupted due to a connection error. Non-resumable in V1.",
379
+ };
380
+ }
381
+ if (err instanceof Anthropic.RateLimitError) {
382
+ return {
383
+ kind: "refused_due_to_execution_error",
384
+ code: "rate_limited",
385
+ message: "Claude API rate limit exceeded. Retry after a brief delay.",
386
+ };
387
+ }
388
+ if (err instanceof Anthropic.AuthenticationError) {
389
+ return {
390
+ kind: "refused_due_to_execution_error",
391
+ code: "auth_error",
392
+ message: "Claude API authentication failed. Check the API key.",
393
+ };
394
+ }
395
+ if (err instanceof Anthropic.APIError) {
396
+ const status = err.status ?? 0;
397
+ const code = status >= 500 ? "api_server_error" : "api_client_error";
398
+ return {
399
+ kind: "refused_due_to_execution_error",
400
+ code,
401
+ message: `Claude API returned HTTP ${status}: ${safeMessage(err)}.`,
402
+ };
403
+ }
404
+ return {
405
+ kind: "refused_due_to_execution_error",
406
+ code: "api_error",
407
+ message: `Claude API call failed: ${safeMessage(err)}.`,
408
+ };
409
+ }
410
+ function safeMessage(err) {
411
+ if (err instanceof Error)
412
+ return err.message;
413
+ return String(err);
414
+ }
415
+ //# sourceMappingURL=api-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-adapter.js","sourceRoot":"","sources":["../../../../src/claude/adapters/api-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAmC1C,iFAAiF;AAEjF,MAAM,aAAa,GAAQ,iBAAiB,CAAC;AAC7C,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAChC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,iFAAiF;AAEjF;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,gBAAgB;IACV,MAAM,CAAiC;IACvC,KAAK,CAAa;IAClB,SAAS,CAAS;IAClB,SAAS,CAAS;IAClB,MAAM,CAAmC;IAE1D,YAAY,MAA8B;QACxC,IAAI,CAAC,MAAM,GAAM,MAAM,CAAC,UAAU,IAAI,IAAI,SAAS,CAAC;YAClD,MAAM,EAAG,MAAM,CAAC,MAAM;YACtB,OAAO,EAAE,MAAM,CAAC,SAAS,IAAI,kBAAkB;SAChD,CAAC,CAAC;QACH,IAAI,CAAC,KAAK,GAAO,MAAM,CAAC,KAAK,IAAS,aAAa,CAAC;QACpD,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAK,kBAAkB,CAAC;QACzD,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAK,kBAAkB,CAAC;QACzD,IA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@@ -0,0 +1,73 @@
1
+ /**
2
+ * Claude Stub Adapter — Phase 8B.
3
+ *
4
+ * ── Role ──────────────────────────────────────────────────────────────────────
5
+ *
6
+ * The stub adapter is the first concrete implementation of ClaudeAgentPlugin.
7
+ * It proves that the mechanism-agnostic contract works — the same delivery gate
8
+ * operates identically whether the plugin returns a response immediately (stub)
9
+ * or asynchronously (real Anthropic API client).
10
+ *
11
+ * ── Transport proof ───────────────────────────────────────────────────────────
12
+ *
13
+ * ClaudeStubAdapter proves all three delivery paths:
14
+ * - accepted: stub returns ClaudeAccepted
15
+ * - refused_due_to_scope: stub returns ClaudeRefusedDueToScope
16
+ * - refused_due_to_execution_error: stub returns ClaudeRefusedDueToExecutionError
17
+ *
18
+ * The gate does not change behavior based on which adapter is used.
19
+ *
20
+ * ── Usage ─────────────────────────────────────────────────────────────────────
21
+ *
22
+ * In tests:
23
+ * const plugin = ClaudeStubAdapter.accepted("session-xyz");
24
+ * const gate = new ClaudeDeliveryGate(plugin, storeDir, deps);
25
+ * const result = await gate.deliver(approvedArtifact);
26
+ * expect(result.outcome).toBe("accepted");
27
+ *
28
+ * For a configurable sequence (scope refusal then accept):
29
+ * const plugin = ClaudeStubAdapter.sequence([
30
+ * ClaudeStubAdapter.scopeRefusalResponse({ questionKind: "need_file_path", ... }),
31
+ * ClaudeStubAdapter.acceptedResponse("session-abc"),
32
+ * ]);
33
+ *
34
+ * ── What this is NOT ──────────────────────────────────────────────────────────
35
+ *
36
+ * This is not a fake Anthropic API. It does not execute tasks, read files,
37
+ * or produce real agent outputs. It is purely for proving the delivery gate
38
+ * contract works against all three response kinds.
39
+ *
40
+ * See: src/claude/delivery-gate.ts — ClaudeAgentPlugin interface
41
+ */
42
+ import type { ClaudeAgentPlugin } from "../delivery-gate.js";
43
+ import type { ClaudeDeliveryRequest } from "../types.js";
44
+ import type { ClaudeDeliveryResponse, ClaudeAccepted, ClaudeRefusedDueToScope, ClaudeRefusedDueToExecutionError, ClaudeScopeQuestion } from "../types.js";
45
+ /**
46
+ * A configurable in-process ClaudeAgentPlugin.
47
+ *
48
+ * Configured at construction with a fixed response or a sequence of responses.
49
+ * Returns responses immediately (no async delay).
50
+ * Throws if a call is made beyond the configured responses.
51
+ */
52
+ export declare class ClaudeStubAdapter implements ClaudeAgentPlugin {
53
+ private readonly responses;
54
+ private callIndex;
55
+ constructor(responses: ClaudeDeliveryResponse[]);
56
+ receive(request: ClaudeDeliveryRequest): Promise<ClaudeDeliveryResponse>;
57
+ /** How many times receive() has been called. */
58
+ get callCount(): number;
59
+ /** Adapter that always returns "accepted" with the given sessionId. */
60
+ static accepted(sessionId?: string): ClaudeStubAdapter;
61
+ /** Adapter that returns a scope refusal with the given question. */
62
+ static refusedScope(question: ClaudeScopeQuestion): ClaudeStubAdapter;
63
+ /** Adapter that returns an execution error with the given code. */
64
+ static refusedError(code?: string, message?: string): ClaudeStubAdapter;
65
+ /** Adapter that simulates a session interruption (A3: non-resumable). */
66
+ static sessionInterrupted(): ClaudeStubAdapter;
67
+ /** Adapter that returns responses in sequence. Throws if exhausted. */
68
+ static sequence(responses: ClaudeDeliveryResponse[]): ClaudeStubAdapter;
69
+ static acceptedResponse(sessionId?: string): ClaudeAccepted;
70
+ static scopeRefusalResponse(question: ClaudeScopeQuestion): ClaudeRefusedDueToScope;
71
+ static executionErrorResponse(code?: string, message?: string): ClaudeRefusedDueToExecutionError;
72
+ }
73
+ //# sourceMappingURL=stub-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stub-adapter.d.ts","sourceRoot":"","sources":["../../../../src/claude/adapters/stub-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAgB,qBAAqB,CAAC;AACvE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAY,aAAa,CAAC;AAC/D,OAAO,KAAK,EACV,sBAAsB,EACtB,cAAc,EACd,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