@autoview/cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +407 -0
  3. package/lib/AutoViewAgent.d.ts +109 -0
  4. package/lib/AutoViewAgent.js +123 -0
  5. package/lib/AutoViewAgent.js.map +1 -0
  6. package/lib/agent/emitMcpServer.d.ts +15 -0
  7. package/lib/agent/emitMcpServer.js +157 -0
  8. package/lib/agent/emitMcpServer.js.map +1 -0
  9. package/lib/agent/emitReport.d.ts +14 -0
  10. package/lib/agent/emitReport.js +85 -0
  11. package/lib/agent/emitReport.js.map +1 -0
  12. package/lib/agent/toolSurface.d.ts +130 -0
  13. package/lib/agent/toolSurface.js +342 -0
  14. package/lib/agent/toolSurface.js.map +1 -0
  15. package/lib/agent/verifyAgentTasks.d.ts +87 -0
  16. package/lib/agent/verifyAgentTasks.js +126 -0
  17. package/lib/agent/verifyAgentTasks.js.map +1 -0
  18. package/lib/cli/main.d.ts +2 -0
  19. package/lib/cli/main.js +295 -0
  20. package/lib/cli/main.js.map +1 -0
  21. package/lib/compiler/AutoViewInterfaceCompiler.d.ts +27 -0
  22. package/lib/compiler/AutoViewInterfaceCompiler.js +68 -0
  23. package/lib/compiler/AutoViewInterfaceCompiler.js.map +1 -0
  24. package/lib/constants/AutoViewFrontendTemplate.d.ts +1 -0
  25. package/lib/constants/AutoViewFrontendTemplate.js +46 -0
  26. package/lib/constants/AutoViewFrontendTemplate.js.map +1 -0
  27. package/lib/constants/AutoViewSystemPromptConstant.d.ts +5 -0
  28. package/lib/constants/AutoViewSystemPromptConstant.js +4 -0
  29. package/lib/constants/AutoViewSystemPromptConstant.js.map +1 -0
  30. package/lib/context/IAutoViewAgentContext.d.ts +60 -0
  31. package/lib/context/IAutoViewAgentContext.js +3 -0
  32. package/lib/context/IAutoViewAgentContext.js.map +1 -0
  33. package/lib/fromSwagger.d.ts +53 -0
  34. package/lib/fromSwagger.js +513 -0
  35. package/lib/fromSwagger.js.map +1 -0
  36. package/lib/generateDeterministic.d.ts +26 -0
  37. package/lib/generateDeterministic.js +75 -0
  38. package/lib/generateDeterministic.js.map +1 -0
  39. package/lib/index.d.ts +15 -0
  40. package/lib/index.js +41 -0
  41. package/lib/index.js.map +1 -0
  42. package/lib/orchestrate/orchestrateAutoView.d.ts +17 -0
  43. package/lib/orchestrate/orchestrateAutoView.js +491 -0
  44. package/lib/orchestrate/orchestrateAutoView.js.map +1 -0
  45. package/lib/orchestrate/orchestrateAutoViewProductPlan.d.ts +37 -0
  46. package/lib/orchestrate/orchestrateAutoViewProductPlan.js +109 -0
  47. package/lib/orchestrate/orchestrateAutoViewProductPlan.js.map +1 -0
  48. package/lib/orchestrate/orchestrateAutoViewRender.d.ts +133 -0
  49. package/lib/orchestrate/orchestrateAutoViewRender.js +943 -0
  50. package/lib/orchestrate/orchestrateAutoViewRender.js.map +1 -0
  51. package/lib/orchestrate/orchestrateAutoViewRenderDeterministic.d.ts +24 -0
  52. package/lib/orchestrate/orchestrateAutoViewRenderDeterministic.js +92 -0
  53. package/lib/orchestrate/orchestrateAutoViewRenderDeterministic.js.map +1 -0
  54. package/lib/orchestrate/orchestrateAutoViewReview.d.ts +48 -0
  55. package/lib/orchestrate/orchestrateAutoViewReview.js +328 -0
  56. package/lib/orchestrate/orchestrateAutoViewReview.js.map +1 -0
  57. package/lib/orchestrate/orchestrateAutoViewScaffold.d.ts +45 -0
  58. package/lib/orchestrate/orchestrateAutoViewScaffold.js +586 -0
  59. package/lib/orchestrate/orchestrateAutoViewScaffold.js.map +1 -0
  60. package/lib/orchestrate/orchestrateAutoViewSdkStudy.d.ts +26 -0
  61. package/lib/orchestrate/orchestrateAutoViewSdkStudy.js +85 -0
  62. package/lib/orchestrate/orchestrateAutoViewSdkStudy.js.map +1 -0
  63. package/lib/orchestrate/structures/IAutoViewProductPlan.d.ts +96 -0
  64. package/lib/orchestrate/structures/IAutoViewProductPlan.js +3 -0
  65. package/lib/orchestrate/structures/IAutoViewProductPlan.js.map +1 -0
  66. package/lib/orchestrate/structures/IAutoViewProductPlanApplication.d.ts +38 -0
  67. package/lib/orchestrate/structures/IAutoViewProductPlanApplication.js +3 -0
  68. package/lib/orchestrate/structures/IAutoViewProductPlanApplication.js.map +1 -0
  69. package/lib/orchestrate/structures/IAutoViewRenderApplication.d.ts +38 -0
  70. package/lib/orchestrate/structures/IAutoViewRenderApplication.js +3 -0
  71. package/lib/orchestrate/structures/IAutoViewRenderApplication.js.map +1 -0
  72. package/lib/orchestrate/structures/IAutoViewReviewApplication.d.ts +40 -0
  73. package/lib/orchestrate/structures/IAutoViewReviewApplication.js +3 -0
  74. package/lib/orchestrate/structures/IAutoViewReviewApplication.js.map +1 -0
  75. package/lib/orchestrate/structures/IAutoViewSdkMap.d.ts +63 -0
  76. package/lib/orchestrate/structures/IAutoViewSdkMap.js +3 -0
  77. package/lib/orchestrate/structures/IAutoViewSdkMap.js.map +1 -0
  78. package/lib/orchestrate/structures/IAutoViewSdkStudyApplication.d.ts +37 -0
  79. package/lib/orchestrate/structures/IAutoViewSdkStudyApplication.js +3 -0
  80. package/lib/orchestrate/structures/IAutoViewSdkStudyApplication.js.map +1 -0
  81. package/lib/orchestrate/utils/HistoryMessage.d.ts +10 -0
  82. package/lib/orchestrate/utils/HistoryMessage.js +25 -0
  83. package/lib/orchestrate/utils/HistoryMessage.js.map +1 -0
  84. package/lib/orchestrate/utils/auditFrontendRuntime.d.ts +53 -0
  85. package/lib/orchestrate/utils/auditFrontendRuntime.js +362 -0
  86. package/lib/orchestrate/utils/auditFrontendRuntime.js.map +1 -0
  87. package/lib/orchestrate/utils/buildDeterministicPlan.d.ts +4 -0
  88. package/lib/orchestrate/utils/buildDeterministicPlan.js +233 -0
  89. package/lib/orchestrate/utils/buildDeterministicPlan.js.map +1 -0
  90. package/lib/orchestrate/utils/buildDeterministicSdkMap.d.ts +22 -0
  91. package/lib/orchestrate/utils/buildDeterministicSdkMap.js +154 -0
  92. package/lib/orchestrate/utils/buildDeterministicSdkMap.js.map +1 -0
  93. package/lib/orchestrate/utils/cacheNodeModules.d.ts +31 -0
  94. package/lib/orchestrate/utils/cacheNodeModules.js +134 -0
  95. package/lib/orchestrate/utils/cacheNodeModules.js.map +1 -0
  96. package/lib/orchestrate/utils/describeEndpointPropsShape.d.ts +37 -0
  97. package/lib/orchestrate/utils/describeEndpointPropsShape.js +192 -0
  98. package/lib/orchestrate/utils/describeEndpointPropsShape.js.map +1 -0
  99. package/lib/orchestrate/utils/describeEndpointRequestBodyShape.d.ts +22 -0
  100. package/lib/orchestrate/utils/describeEndpointRequestBodyShape.js +29 -0
  101. package/lib/orchestrate/utils/describeEndpointRequestBodyShape.js.map +1 -0
  102. package/lib/orchestrate/utils/describeEndpointResponseShape.d.ts +19 -0
  103. package/lib/orchestrate/utils/describeEndpointResponseShape.js +30 -0
  104. package/lib/orchestrate/utils/describeEndpointResponseShape.js.map +1 -0
  105. package/lib/orchestrate/utils/executeCachedBatch.d.ts +22 -0
  106. package/lib/orchestrate/utils/executeCachedBatch.js +64 -0
  107. package/lib/orchestrate/utils/executeCachedBatch.js.map +1 -0
  108. package/lib/orchestrate/utils/loadShoppingFixture.d.ts +33 -0
  109. package/lib/orchestrate/utils/loadShoppingFixture.js +17 -0
  110. package/lib/orchestrate/utils/loadShoppingFixture.js.map +1 -0
  111. package/lib/orchestrate/utils/normalizeProductPlanPaths.d.ts +24 -0
  112. package/lib/orchestrate/utils/normalizeProductPlanPaths.js +77 -0
  113. package/lib/orchestrate/utils/normalizeProductPlanPaths.js.map +1 -0
  114. package/lib/orchestrate/utils/renderJsonSchema.d.ts +23 -0
  115. package/lib/orchestrate/utils/renderJsonSchema.js +122 -0
  116. package/lib/orchestrate/utils/renderJsonSchema.js.map +1 -0
  117. package/lib/orchestrate/utils/renderResourcePage.d.ts +36 -0
  118. package/lib/orchestrate/utils/renderResourcePage.js +1415 -0
  119. package/lib/orchestrate/utils/renderResourcePage.js.map +1 -0
  120. package/lib/orchestrate/utils/validateFrontendTypecheck.d.ts +109 -0
  121. package/lib/orchestrate/utils/validateFrontendTypecheck.js +274 -0
  122. package/lib/orchestrate/utils/validateFrontendTypecheck.js.map +1 -0
  123. package/lib/preview/renderPreview.d.ts +22 -0
  124. package/lib/preview/renderPreview.js +198 -0
  125. package/lib/preview/renderPreview.js.map +1 -0
  126. package/lib/typings/compiler.d.ts +39 -0
  127. package/lib/typings/compiler.js +3 -0
  128. package/lib/typings/compiler.js.map +1 -0
  129. package/lib/typings/events.d.ts +106 -0
  130. package/lib/typings/events.js +3 -0
  131. package/lib/typings/events.js.map +1 -0
  132. package/lib/typings/index.d.ts +10 -0
  133. package/lib/typings/index.js +27 -0
  134. package/lib/typings/index.js.map +1 -0
  135. package/lib/typings/misc.d.ts +78 -0
  136. package/lib/typings/misc.js +3 -0
  137. package/lib/typings/misc.js.map +1 -0
  138. package/lib/utils/ArrayUtil.d.ts +8 -0
  139. package/lib/utils/ArrayUtil.js +30 -0
  140. package/lib/utils/ArrayUtil.js.map +1 -0
  141. package/lib/utils/StringUtil.d.ts +11 -0
  142. package/lib/utils/StringUtil.js +28 -0
  143. package/lib/utils/StringUtil.js.map +1 -0
  144. package/lib/utils/classifyEndpoints.d.ts +62 -0
  145. package/lib/utils/classifyEndpoints.js +216 -0
  146. package/lib/utils/classifyEndpoints.js.map +1 -0
  147. package/lib/utils/endpointFilter.d.ts +26 -0
  148. package/lib/utils/endpointFilter.js +0 -0
  149. package/lib/utils/endpointFilter.js.map +1 -0
  150. package/lib/utils/extractFields.d.ts +85 -0
  151. package/lib/utils/extractFields.js +231 -0
  152. package/lib/utils/extractFields.js.map +1 -0
  153. package/lib/utils/index.d.ts +13 -0
  154. package/lib/utils/index.js +30 -0
  155. package/lib/utils/index.js.map +1 -0
  156. package/lib/utils/normalizeForNestia.d.ts +34 -0
  157. package/lib/utils/normalizeForNestia.js +133 -0
  158. package/lib/utils/normalizeForNestia.js.map +1 -0
  159. package/lib/utils/resourcePlan.d.ts +39 -0
  160. package/lib/utils/resourcePlan.js +95 -0
  161. package/lib/utils/resourcePlan.js.map +1 -0
  162. package/lib/utils/sliceDocument.d.ts +17 -0
  163. package/lib/utils/sliceDocument.js +114 -0
  164. package/lib/utils/sliceDocument.js.map +1 -0
  165. package/lib/utils/toEndpoints.d.ts +90 -0
  166. package/lib/utils/toEndpoints.js +227 -0
  167. package/lib/utils/toEndpoints.js.map +1 -0
  168. package/lib/verify/runWorkflows.d.ts +25 -0
  169. package/lib/verify/runWorkflows.js +366 -0
  170. package/lib/verify/runWorkflows.js.map +1 -0
  171. package/lib/verify/workflows.d.ts +53 -0
  172. package/lib/verify/workflows.js +107 -0
  173. package/lib/verify/workflows.js.map +1 -0
  174. package/package.json +82 -0
  175. package/prompts/AUTOVIEW_RENDER.md +398 -0
  176. package/prompts/AUTOVIEW_REVIEW.md +60 -0
  177. package/prompts/AUTOVIEW_SDK_STUDY.md +89 -0
  178. package/src/AutoViewAgent.ts +222 -0
  179. package/src/agent/emitMcpServer.integration.test.ts +168 -0
  180. package/src/agent/emitMcpServer.test.ts +51 -0
  181. package/src/agent/emitMcpServer.ts +178 -0
  182. package/src/agent/emitReport.ts +117 -0
  183. package/src/agent/toolSurface.test.ts +243 -0
  184. package/src/agent/toolSurface.ts +501 -0
  185. package/src/agent/verifyAgentTasks.test.ts +106 -0
  186. package/src/agent/verifyAgentTasks.ts +171 -0
  187. package/src/cli/main.ts +363 -0
  188. package/src/compiler/AutoViewInterfaceCompiler.ts +69 -0
  189. package/src/constants/AutoViewFrontendTemplate.ts +42 -0
  190. package/src/constants/AutoViewSystemPromptConstant.ts +6 -0
  191. package/src/context/IAutoViewAgentContext.ts +84 -0
  192. package/src/fromSwagger.test.ts +269 -0
  193. package/src/fromSwagger.ts +500 -0
  194. package/src/generateDeterministic.test.ts +39 -0
  195. package/src/generateDeterministic.ts +77 -0
  196. package/src/index.ts +30 -0
  197. package/src/orchestrate/orchestrateAutoView.ts +590 -0
  198. package/src/orchestrate/orchestrateAutoViewProductPlan.ts +121 -0
  199. package/src/orchestrate/orchestrateAutoViewRender.ts +1117 -0
  200. package/src/orchestrate/orchestrateAutoViewRenderDeterministic.ts +101 -0
  201. package/src/orchestrate/orchestrateAutoViewReview.ts +272 -0
  202. package/src/orchestrate/orchestrateAutoViewScaffold.ts +627 -0
  203. package/src/orchestrate/orchestrateAutoViewSdkStudy.ts +90 -0
  204. package/src/orchestrate/renderNavTs.test.ts +74 -0
  205. package/src/orchestrate/structures/IAutoViewProductPlan.ts +119 -0
  206. package/src/orchestrate/structures/IAutoViewProductPlanApplication.ts +41 -0
  207. package/src/orchestrate/structures/IAutoViewRenderApplication.ts +40 -0
  208. package/src/orchestrate/structures/IAutoViewReviewApplication.ts +42 -0
  209. package/src/orchestrate/structures/IAutoViewSdkMap.ts +72 -0
  210. package/src/orchestrate/structures/IAutoViewSdkStudyApplication.ts +40 -0
  211. package/src/orchestrate/utils/HistoryMessage.ts +41 -0
  212. package/src/orchestrate/utils/auditFrontendRuntime.test.ts +18 -0
  213. package/src/orchestrate/utils/auditFrontendRuntime.ts +454 -0
  214. package/src/orchestrate/utils/buildDeterministicPlan.test.ts +170 -0
  215. package/src/orchestrate/utils/buildDeterministicPlan.ts +289 -0
  216. package/src/orchestrate/utils/buildDeterministicSdkMap.test.ts +90 -0
  217. package/src/orchestrate/utils/buildDeterministicSdkMap.ts +169 -0
  218. package/src/orchestrate/utils/cacheNodeModules.ts +136 -0
  219. package/src/orchestrate/utils/describeEndpointPropsShape.test.ts +86 -0
  220. package/src/orchestrate/utils/describeEndpointPropsShape.ts +202 -0
  221. package/src/orchestrate/utils/describeEndpointRequestBodyShape.test.ts +87 -0
  222. package/src/orchestrate/utils/describeEndpointRequestBodyShape.ts +31 -0
  223. package/src/orchestrate/utils/describeEndpointResponseShape.test.ts +70 -0
  224. package/src/orchestrate/utils/describeEndpointResponseShape.ts +32 -0
  225. package/src/orchestrate/utils/executeCachedBatch.ts +59 -0
  226. package/src/orchestrate/utils/loadShoppingFixture.ts +52 -0
  227. package/src/orchestrate/utils/normalizeProductPlanPaths.ts +92 -0
  228. package/src/orchestrate/utils/renderJsonSchema.test.ts +162 -0
  229. package/src/orchestrate/utils/renderJsonSchema.ts +133 -0
  230. package/src/orchestrate/utils/renderResourcePage.test.ts +468 -0
  231. package/src/orchestrate/utils/renderResourcePage.ts +1624 -0
  232. package/src/orchestrate/utils/validateFrontendTypecheck.test.ts +32 -0
  233. package/src/orchestrate/utils/validateFrontendTypecheck.ts +335 -0
  234. package/src/preview/renderPreview.ts +273 -0
  235. package/src/typings/compiler.ts +47 -0
  236. package/src/typings/events.ts +155 -0
  237. package/src/typings/index.ts +10 -0
  238. package/src/typings/misc.ts +93 -0
  239. package/src/utils/ArrayUtil.ts +16 -0
  240. package/src/utils/StringUtil.ts +29 -0
  241. package/src/utils/classifyEndpoints.test.ts +86 -0
  242. package/src/utils/classifyEndpoints.ts +291 -0
  243. package/src/utils/endpointFilter.test.ts +50 -0
  244. package/src/utils/endpointFilter.ts +0 -0
  245. package/src/utils/extractFields.test.ts +82 -0
  246. package/src/utils/extractFields.ts +306 -0
  247. package/src/utils/index.ts +13 -0
  248. package/src/utils/normalizeForNestia.test.ts +93 -0
  249. package/src/utils/normalizeForNestia.ts +139 -0
  250. package/src/utils/resourcePlan.test.ts +104 -0
  251. package/src/utils/resourcePlan.ts +180 -0
  252. package/src/utils/sliceDocument.test.ts +85 -0
  253. package/src/utils/sliceDocument.ts +119 -0
  254. package/src/utils/toEndpoints.test.ts +251 -0
  255. package/src/utils/toEndpoints.ts +343 -0
  256. package/src/verify/runWorkflows.ts +403 -0
  257. package/src/verify/workflows.test.ts +117 -0
  258. package/src/verify/workflows.ts +154 -0
  259. package/template/CLAUDE.md +140 -0
  260. package/template/Dockerfile +31 -0
  261. package/template/PROMPT.md +80 -0
  262. package/template/SANDBOX.md +70 -0
  263. package/template/app/api/health/route.ts +10 -0
  264. package/template/app/globals.css +97 -0
  265. package/template/app/layout.tsx +30 -0
  266. package/template/app/page.tsx +19 -0
  267. package/template/components/AppShell.tsx +114 -0
  268. package/template/components/auto/CatalogGrid.tsx +159 -0
  269. package/template/components/auto/ConfirmButton.tsx +67 -0
  270. package/template/components/auto/EmbeddedCollection.tsx +144 -0
  271. package/template/components/auto/ResourceDashboard.tsx +104 -0
  272. package/template/components/auto/ResourceDetail.tsx +93 -0
  273. package/template/components/auto/ResourceForm.tsx +235 -0
  274. package/template/components/auto/ResourceIcon.tsx +88 -0
  275. package/template/components/auto/ResourceLanding.tsx +155 -0
  276. package/template/components/auto/ResourceTable.tsx +223 -0
  277. package/template/components/auto/formatValue.tsx +186 -0
  278. package/template/components/auto/types.ts +42 -0
  279. package/template/components/ui/badge.tsx +40 -0
  280. package/template/components/ui/button.tsx +57 -0
  281. package/template/components/ui/card.tsx +86 -0
  282. package/template/components/ui/dialog.tsx +119 -0
  283. package/template/components/ui/input.tsx +23 -0
  284. package/template/components/ui/label.tsx +24 -0
  285. package/template/components/ui/pagination.tsx +117 -0
  286. package/template/components/ui/select.tsx +92 -0
  287. package/template/components/ui/sheet.tsx +135 -0
  288. package/template/components/ui/skeleton.tsx +15 -0
  289. package/template/components/ui/table.tsx +120 -0
  290. package/template/components/ui/tabs.tsx +55 -0
  291. package/template/lib/utils.ts +35 -0
  292. package/template/next.config.mjs +52 -0
  293. package/template/package.json +46 -0
  294. package/template/postcss.config.js +6 -0
  295. package/template/scripts/start-shopping-backend.sh +56 -0
  296. package/template/tailwind.config.ts +96 -0
  297. package/template/tsconfig.json +29 -0
package/README.md ADDED
@@ -0,0 +1,407 @@
1
+ # AutoView
2
+
3
+ **Read any OpenAPI document, prove it can actually be driven as a product, and
4
+ emit the surfaces that drive it — a human frontend, an agent tool surface (MCP) —
5
+ each verified to work.**
6
+
7
+ ```
8
+ ┌─▶ frontend/ a human admin UI (Next.js + shadcn/ui)
9
+ swagger.json ─┼─▶ --emit mcp an agent tool surface (runnable MCP server)
10
+ (any) ├─▶ --emit report consumability verdict (can this API be driven?)
11
+ └─▶ verify proof it works (real browser / real agent)
12
+ ```
13
+
14
+ AutoView reads an OpenAPI 3.x document into a deterministic **semantic model of
15
+ the API** — its resources, their hierarchy, which endpoint produces the id
16
+ another endpoint consumes, what is a read vs a mutation — and projects that one
17
+ model into the surfaces that consume the API. Then it **verifies** them: the
18
+ frontend's user journeys in a real browser, the agent's tasks against the live
19
+ backend, and a static consumability report that flags ids no endpoint can supply.
20
+
21
+ The point is not "a pretty generated screen" (that is a commodity). The point is
22
+ **proof**: that your API is consumable as a product, demonstrated rather than
23
+ asserted.
24
+
25
+ AutoView is **standalone** and the whole READ → MAP → EMIT pipeline is
26
+ **LLM-free and deterministic** — same document, same output, every time. The
27
+ domain map, the screen set, and the page render are all derived structurally, so
28
+ even a large swagger generates whole, un-sliced (Box's 234 operations → 142
29
+ pages, DigitalOcean's 287 → 106, both typecheck-clean). A model you supply is
30
+ used only as an optional typecheck-recovery pass during frontend generation, and
31
+ for agent-task verification.
32
+
33
+ <sub>Origin note: AutoView was first written inside the
34
+ [AutoBE](https://github.com/wrtnlabs/autobe) monorepo and is published as
35
+ `@autoview/cli`. All `@autobe/*` runtime dependencies have been removed.</sub>
36
+
37
+ ---
38
+
39
+ ## Table of contents
40
+
41
+ - [The one idea](#the-one-idea)
42
+ - [What it emits](#what-it-emits)
43
+ - [From an AutoBE backend to a UI (demo workflow)](#from-an-autobe-backend-to-a-ui-demo-workflow)
44
+ - [Quick start](#quick-start)
45
+ - [Verification — proof, not assertion](#verification--proof-not-assertion)
46
+ - [How it reads the API (the IR)](#how-it-reads-the-api-the-ir)
47
+ - [CLI](#cli)
48
+ - [Install & programmatic API](#install--programmatic-api)
49
+ - [Verified on](#verified-on)
50
+ - [Honest limits](#honest-limits)
51
+ - [License](#license)
52
+
53
+ ---
54
+
55
+ ## The one idea
56
+
57
+ Everything is one deterministic **IR** (intermediate representation — the API's
58
+ semantic model) and several **emits** off it. Build the IR once; every surface
59
+ and every check is a projection of it.
60
+
61
+ ```
62
+ ┌── frontend (human view)
63
+ swagger ─▶ IR ───────┼── tool surface / MCP (agent view)
64
+ │ └── consumability report (verdict)
65
+
66
+ └── verification (proves the emits actually work)
67
+ ```
68
+
69
+ The IR carries, per operation: the resource it belongs to and the resource
70
+ **hierarchy** (`sales → questions → comments`), its **role** (list / detail /
71
+ create / update / delete / action → read vs write), and the **producer→consumer
72
+ chain** (the `saleId` that `questions.list` needs is produced by `sales.list`'s
73
+ `id`). That model is what a flat "OpenAPI → tools" or "OpenAPI → CRUD UI" dump
74
+ lacks, and it is what makes the surfaces navigable and the report possible.
75
+
76
+ ---
77
+
78
+ ## What it emits
79
+
80
+ | Emit | Command | For | LLM |
81
+ | --- | --- | --- | --- |
82
+ | **Frontend** | `autoview swagger.json --out ./frontend` | humans — a Next.js + shadcn/ui admin (sidebar nav, dense tables, detail views with actions, forms) | optional |
83
+ | **Agent tool surface (MCP)** | `autoview swagger.json --emit mcp` | AI agents — a runnable MCP server; each tool carries read/write annotations and producer hints, and executes the real API over HTTP | none |
84
+ | **Consumability report** | `autoview swagger.json --emit report` | API authors / CI — a deterministic verdict: every id a tool needs should be obtainable from another tool | none |
85
+ | **Preview** | `autoview swagger.json --preview` | a quick look — the endpoint tree + schemas as one HTML page | none |
86
+
87
+ All four read the **same IR**. The frontend and the MCP server are the same
88
+ resource model rendered for two different consumers; the report is that model
89
+ checked for navigability.
90
+
91
+ > **Two different things are called a "mode" — don't conflate them.**
92
+ > 1. **Emit mode** — *what AutoView produces*, chosen on the `autoview` command
93
+ > line (the four rows above: frontend / `--emit mcp` / `--emit report` /
94
+ > `--preview`).
95
+ > 2. **Data mode** — *how the generated frontend runs*, chosen later at
96
+ > `npm run dev` time: **simulate** (typia-mock data, no backend —
97
+ > `NEXT_PUBLIC_API_SIMULATE=true`) or **live** (real backend —
98
+ > `NEXT_PUBLIC_API_HOST=<host>`). It is just an env toggle on the generated
99
+ > app, switchable without regenerating.
100
+ >
101
+ > For a demo you only touch one emit (frontend) and one data mode at a time
102
+ > (simulate to always have populated screens; live when the backend is up).
103
+
104
+ ---
105
+
106
+ ## From an AutoBE backend to a UI (demo workflow)
107
+
108
+ AutoBE generates a backend and its OpenAPI document. AutoView turns that document
109
+ into a running Next.js admin you can open in a browser — the human-facing proof
110
+ that the AutoBE backend actually works. The whole flow is four commands, and with
111
+ `--no-llm` **no API key is needed at all** — the READ → MAP → render pipeline is
112
+ fully deterministic.
113
+
114
+ ### 0 · One-time setup (in this repo)
115
+
116
+ ```bash
117
+ npm install
118
+ npm run build # builds lib/cli/main.js — invoked below as `node lib/cli/main.js`
119
+ ```
120
+
121
+ ### 1 · Inspect the swagger first — instant
122
+
123
+ ```bash
124
+ node lib/cli/main.js ./erp.swagger.json --preview --out ./out
125
+ open ./out/preview.html # endpoint tree + schemas + a READ-layer report
126
+ ```
127
+
128
+ ### 2 · Generate the frontend (no key)
129
+
130
+ ```bash
131
+ node lib/cli/main.js ./erp.swagger.json --out ./erp-frontend --no-llm \
132
+ --backend https://your-erp-host
133
+ ```
134
+
135
+ `--no-llm` generates everything deterministically — same swagger, same output,
136
+ zero tokens. (Drop `--no-llm` and pass `--model`/`--api-key` only if you want the
137
+ optional LLM pass that repairs a page on the rare chance the deterministic render
138
+ does not typecheck.)
139
+
140
+ - `--backend` is the live ERP host baked into `connection.ts`. Omit it and
141
+ AutoView auto-extracts `servers[0].url` from the swagger.
142
+ - **Large ERP swagger?** Slice it — `--include` keeps only matching paths *and*
143
+ the component schemas they reference, so even a huge spec generates:
144
+ `--include "erp/admin/**,erp/inventory/**"` (or generate the whole thing; Box's
145
+ 234 operations → 142 pages compiles clean).
146
+
147
+ ### 3 · Open it in the browser
148
+
149
+ ```bash
150
+ cd erp-frontend && npm install
151
+
152
+ # A) Guaranteed populated demo — typia-mock data, no backend needed:
153
+ NEXT_PUBLIC_API_SIMULATE=true npm run dev # → http://localhost:3000
154
+
155
+ # B) Real data — against the live ERP backend (host must be reachable + allow CORS):
156
+ NEXT_PUBLIC_API_HOST=https://your-erp-host npm run dev
157
+ ```
158
+
159
+ For a demo where the backend might not be reachable, use **(A)** — every list,
160
+ detail, and form renders with mock data so the whole UI is walkable. Switch to
161
+ **(B)** the moment the real ERP host is up to show live rows.
162
+
163
+ > **Tip for an ERP swagger with authentication:** in live mode the app may try to
164
+ > bootstrap a session against the auth endpoints on first load. If that stalls
165
+ > (host down, CORS, no seed account), demo in **simulate mode (A)** — it never
166
+ > calls the backend, so the full UI is always walkable.
167
+
168
+ **Common knobs**
169
+
170
+ | Goal | Flag |
171
+ | --- | --- |
172
+ | Slice a huge ERP spec | `--include "erp/admin/**"` (and `--exclude` to drop noise) |
173
+ | Force mock mode at generate time | `--backend=""` |
174
+ | Inspect without generating | `--preview` (HTML) or `--emit report` (navigability verdict) |
175
+ | Tune render concurrency | `--semaphore 8` |
176
+
177
+ ---
178
+
179
+ ## Quick start
180
+
181
+ ```bash
182
+ npm install -g @autoview/cli # installs the `autoview` command — or: npx @autoview/cli ...
183
+ ```
184
+
185
+ **A human frontend** — deterministic, no key needed with `--no-llm`:
186
+
187
+ ```bash
188
+ autoview ./swagger.json --out ./frontend --no-llm
189
+ cd frontend && npm install && npm run dev # http://localhost:3000
190
+ ```
191
+
192
+ (Drop `--no-llm` and pass `--model`/`--api-key` to add the optional LLM
193
+ typecheck-recovery pass.)
194
+
195
+ **An agent tool surface (MCP server):**
196
+
197
+ ```bash
198
+ autoview ./swagger.json --emit mcp --out ./mcp
199
+ cd mcp && npm install
200
+ API_HOST=https://api.example.com API_TOKEN="Bearer …" npm start
201
+ ```
202
+
203
+ Then wire it into Claude Desktop / Cursor / Claude Code (the generated
204
+ `README.md` has the exact `mcpServers` JSON).
205
+
206
+ **A consumability verdict:**
207
+
208
+ ```bash
209
+ autoview ./swagger.json --emit report --out ./out
210
+ cat out/consumability-report.md
211
+ ```
212
+
213
+ ---
214
+
215
+ ## Verification — proof, not assertion
216
+
217
+ A typecheck score is not proof a product works. AutoView verifies the emits the
218
+ way a user (or an agent) actually exercises them.
219
+
220
+ - **Frontend workflows** — `autoview … --verify` boots the generated app in a
221
+ real headless browser and walks the derived user journeys (open the list →
222
+ it renders rows or an honest empty state → open a record → its fields render),
223
+ writing `wiki/verification.md` with per-step pass/fail evidence.
224
+ - **Agent tasks** — `verifyAgentTasks(document, { client, model, baseUrl, tasks })`
225
+ drives a real agent through named tasks against the tool surface + live
226
+ backend and grades each. The model and key are **injected by you** (e.g. from
227
+ `.env`) — which model your API's agents use is your call, not ours.
228
+ - **Structural (LLM-free)** — `analyzeConsumability(document)` proves the tool
229
+ graph is navigable, with one model shared by the tool surface so the report
230
+ never claims navigability the tools don't hint. Each path-param input is one
231
+ of: **resolved** (a list/search tool produces the id and the surface says
232
+ which one), **nested** (the id appears inside a parent read's response —
233
+ `order` → `goods[].id` — navigable but not via a dedicated list), **orphan**
234
+ (an entity `*_id` no endpoint can supply — a genuine gap), **caller-supplied
235
+ key** (`repository_name`, `scope` — a human-known value, not a chained id), or
236
+ **undetermined** (the resource is read but no id could be traced, often an
237
+ inline schema). A detail read is never counted as its own producer (circular);
238
+ only true id orphans count as defects.
239
+
240
+ That find-and-fix loop is the product: run it, and you get the surface **plus**
241
+ the evidence it works — or exactly which step/endpoint breaks.
242
+
243
+ ### Run it yourself
244
+
245
+ [`examples/verify-agent.ts`](examples/verify-agent.ts) verifies a swagger as an
246
+ agent tool surface both ways — structurally (always) and behaviorally (when a
247
+ model is configured):
248
+
249
+ ```bash
250
+ npm run verify:agent # bundled petstore → public backend
251
+ # or: npm run verify:agent ./your.json https://api.example.com
252
+ ```
253
+
254
+ ```
255
+ ── structural (deterministic) ──
256
+ 18 tools — 8 read, 10 write
257
+ 8 id inputs resolved · 0 orphan · 100% navigable
258
+
259
+ ── behavioral (openai/gpt-4o-mini → https://petstore3.swagger.io/api/v3) ──
260
+ PASS list
261
+ tools: pet.findByStatus.get
262
+ PASS producer→consumer chain
263
+ tools: pet.findByStatus.get → pet.getByPetid
264
+ answer: The pet's ID is 105484548 and its name is "modi".
265
+
266
+ 2/2 tasks passed end-to-end (real agent, live backend).
267
+ ```
268
+
269
+ The chain task is the point: the agent **lists** pets, takes an id **from the
270
+ response**, and calls the **detail** endpoint with it — the producer→consumer
271
+ link the tool surface declares, exercised against a live server. The structural
272
+ pass runs with no key; the behavioral pass needs `AUTOVIEW_API_KEY` +
273
+ `AUTOVIEW_MODEL` (the model is your choice).
274
+
275
+ ---
276
+
277
+ ## How it reads the API (the IR)
278
+
279
+ ```
280
+ swagger.json
281
+
282
+ ▼ READ fromSwagger() → toEndpoints() (deterministic, LLM-free)
283
+ │ • upgrade Swagger 2 / OpenAPI 3.0/3.1 → one normalized document
284
+ │ • resolve $ref parameters (incl. cross-path JSON pointers),
285
+ │ flatten allOf composition, drop unroutable (`#`-fragment) paths
286
+ │ • every operation: method · path · accessor · path-params ·
287
+ │ QUERY · requestBody · responseBody
288
+
289
+ ▼ MAP classifyEndpoints → resourcePlan (deterministic, LLM-free)
290
+ │ • CRUD role per endpoint (read vs write)
291
+ │ • resource hierarchy / chain from the path
292
+ │ • producer→consumer links (which id comes from where)
293
+
294
+ ▼ EMIT frontend page-gen · MCP tools · report (deterministic)
295
+ │ + optional LLM typecheck-recovery pass on the frontend only
296
+
297
+ surfaces + verification
298
+ ```
299
+
300
+ The READ and MAP layers — the IR — are 100% deterministic and reused by every
301
+ emit. Robustness was hardened against real third-party specs: `$ref` parameter
302
+ pointers (DigitalOcean), `allOf` composition and `entries`-style collection
303
+ wrappers (Box), numeric ids, and `#`-fragment paths.
304
+
305
+ ---
306
+
307
+ ## CLI
308
+
309
+ ```
310
+ autoview <swagger.json> [options]
311
+
312
+ --out <dir> Output directory (default: ./frontend)
313
+ --emit mcp Generate a runnable MCP server (agent tool surface). LLM-free.
314
+ --emit report Write consumability-report.md (navigable graph + orphans). LLM-free.
315
+ --preview Write preview.html (endpoint tree + schemas). LLM-free.
316
+ --verify Verify the frontend in a real headless browser (user workflows).
317
+ --backend <url> Live backend for the frontend's connection.ts / the report's hints.
318
+ Auto-extracted from the swagger's servers[] when omitted.
319
+ --include <globs> Comma-separated path globs to KEEP — slices the whole
320
+ document (paths AND the component schemas they reference),
321
+ so a large swagger fits the model and actually generates.
322
+ --exclude <globs> Comma-separated path globs to DROP (applied after include).
323
+ --model <name> LLM model (only for the optional frontend RENDER polish).
324
+ --api-key <key> Vendor key (or AUTOVIEW_API_KEY / OPENAI_API_KEY env).
325
+ --base-url <url> OpenAI-compatible endpoint (or AUTOVIEW_BASE_URL env).
326
+ ```
327
+
328
+ `--emit`, `--report`, and `--preview` need no model or key — they are
329
+ deterministic.
330
+
331
+ ---
332
+
333
+ ## Install & programmatic API
334
+
335
+ ```bash
336
+ npm install @autoview/cli
337
+ ```
338
+
339
+ ```ts
340
+ import {
341
+ fromSwagger,
342
+ buildToolSurface, // IR → agent tools (read/write annotated, producer hints)
343
+ emitMcpServer, // IR → a runnable MCP server project (files map)
344
+ analyzeConsumability, // IR → navigable / orphan / undetermined breakdown
345
+ emitConsumabilityReport, // → markdown report
346
+ verifyAgentTasks, // run an agent through tasks against the tool surface
347
+ AutoViewAgent, // the frontend generator (optional LLM polish)
348
+ } from "@autoview/cli";
349
+
350
+ const document = fromSwagger(require("./swagger.json"));
351
+
352
+ // agent tool surface + structural proof — no LLM, no network
353
+ const tools = buildToolSurface(document);
354
+ const coverage = analyzeConsumability(document);
355
+ console.log(`${tools.length} tools, ${coverage.orphan.length} orphan inputs`);
356
+
357
+ // a runnable MCP server, written to disk by the caller
358
+ const files = emitMcpServer(document, { backend: "https://api.example.com" });
359
+ ```
360
+
361
+ ---
362
+
363
+ ## Verified on
364
+
365
+ Real third-party OpenAPI documents, end-to-end:
366
+
367
+ | Swagger | Domain | Ops | Frontend typecheck | Navigability (report) |
368
+ | --- | --- | --- | --- | --- |
369
+ | `@samchon/shopping` | e-commerce | 206 | 0 errors | 100% (203 resolved + 11 nested, 0 orphan) |
370
+ | DigitalOcean | cloud infra | 287 | 0 errors (106 pages, whole) | 99% (146 resolved, 1 orphan; 47 undetermined, 52 caller-keys) |
371
+ | Box | file platform | 234 | 0 errors (142 pages, whole) | 97% (77 resolved, 2 orphan; 84 undetermined, 19 caller-keys) |
372
+ | Petstore | (canonical) | 18 | 0 errors (11 pages) | 100% (3 resolved, 0 orphan) |
373
+
374
+ Frontend workflow verification (real browser): shopping 13/13 journeys pass,
375
+ DigitalOcean 7/7. The emitted MCP server was driven end-to-end by a real MCP
376
+ client; agent tasks pass against the tool surface with a configurable model.
377
+
378
+ ---
379
+
380
+ ## Honest limits
381
+
382
+ - **Tool *shaping* helps exactly where the chain is hard to guess.** On a flat
383
+ 1-hop chain (list → detail), a capable model reconstructs it from names alone,
384
+ so a naive surface chains about as well as the shaped one — shaping is not
385
+ magic there. But on a **nested** chain — an id buried in a parent's response
386
+ array (a sale's `units[].stocks[].id`) — the model cannot guess where the id
387
+ lives, and a naive surface fails. A blind A/B (same model, same backend;
388
+ [`examples/ab-nested-chain.ts`](examples/ab-nested-chain.ts), `npm run ab:nested`)
389
+ is decisive: **naive 0/5, shaped 5/5** — the naive agent blindly calls the deep
390
+ endpoint with ids it doesn't have; the shaped agent is told "stockId ← sale
391
+ detail at `units[].stocks[].id`" and gets it in two calls. So the durable value
392
+ is the **read/write safety annotations**, the **deterministic navigability
393
+ proof**, AND the **nested producer hints** that close chains a model can't infer.
394
+ - **Inline response schemas are partly handled.** The producer→consumer analysis
395
+ now introspects inline object responses and resource-named collection wrappers
396
+ (`{ databases: [...] }`) including inline array items — lifting DigitalOcean's
397
+ navigability from 13% to 86%. Inputs it still cannot trace are reported as
398
+ *undetermined*, never as a defect.
399
+ - **Frontend RENDER is deterministic by default.** The pages are generated from
400
+ the schema (one column per field, typed SDK wiring) — no LLM needed for a
401
+ working app. An LLM is only used for an optional aesthetic polish pass.
402
+
403
+ ---
404
+
405
+ ## License
406
+
407
+ See [LICENSE](./LICENSE).
@@ -0,0 +1,109 @@
1
+ import { OpenApi } from "@typia/interface";
2
+ import { IAgenticaVendor } from "@agentica/core";
3
+ import { IAutoBeCompiler } from "./typings";
4
+ import { AutoViewDispatchEvent } from "./context/IAutoViewAgentContext";
5
+ /**
6
+ * Standalone entry point for the AutoView agent.
7
+ *
8
+ * Generates a runnable Next.js + shadcn/ui frontend from any
9
+ * {@link OpenApi.IDocument} — typically produced by passing a third party
10
+ * `swagger.json` through `@autobe/utils.invertOpenApiDocument`. Does not
11
+ * require `@autobe/agent`; the only requirement is an {@link IAgenticaVendor}
12
+ * (model + API key) and a compiler instance for SDK writing.
13
+ *
14
+ * Backward compat: `@autobe/agent`'s `AutoBeAgent.runAutoView()` still works as
15
+ * before — it bypasses this class and hands its own context to the same
16
+ * `orchestrateAutoView` directly.
17
+ */
18
+ export interface IAutoViewAgentProps {
19
+ /**
20
+ * The OpenAPI document the frontend will be generated against. For a
21
+ * third-party Swagger payload, run it through `invertOpenApiDocument` from
22
+ * `@autobe/utils` first.
23
+ */
24
+ document: OpenApi.IDocument;
25
+ /**
26
+ * Agentica vendor — model + API key + optional semaphore. Same shape
27
+ * `@autobe/agent` accepts; the agent's quota-tracker / mistral-shim helpers
28
+ * are not wired here because they are AutoBE-specific.
29
+ */
30
+ vendor: IAgenticaVendor;
31
+ /**
32
+ * Optional design theme passed through to the Product Plan + Render phases.
33
+ * Empty / undefined means "prototype-first, content-first defaults".
34
+ */
35
+ designTheme?: string;
36
+ /**
37
+ * Compiler instance used to write the SDK files. Falls back to a fresh
38
+ * `AutoBeCompiler` when not provided. Pass your own instance if you want to
39
+ * share one across multiple AutoViewAgent runs in the same process.
40
+ */
41
+ compiler?: IAutoBeCompiler;
42
+ /** Concurrency cap for the per-screen render batch. Defaults to 8. */
43
+ semaphore?: number;
44
+ /**
45
+ * Live backend the generated frontend should connect to. When given, the
46
+ * scaffold wires `connection.ts` with `simulate: false` so the dev server
47
+ * renders real data on first boot — the standalone CLI's reason to exist.
48
+ *
49
+ * Omit to fall back to simulator mode (only useful for swaggers that
50
+ * genuinely have no backend). `extractBackendFromSwagger(payload)` in this
51
+ * package is a small helper for pulling the URL out of a swagger's
52
+ * `servers[0].url` field automatically.
53
+ */
54
+ backend?: {
55
+ host: string;
56
+ } | null;
57
+ /**
58
+ * Opt into Phase 6 runtime audit: after typecheck, boot `next dev`, walk
59
+ * every page with Playwright, and re-render any page that console-errored /
60
+ * crashed / failed to navigate. Catches the class of bugs `tsc --noEmit`
61
+ * cannot see (`obj?.array.method(...)` undefined-access, react render crashes
62
+ * on simulator data).
63
+ *
64
+ * Defaults to `false` because it installs Playwright + Chromium (~150MB) and
65
+ * boots `next dev` twice per agent run, adding ~10–20 minutes.
66
+ */
67
+ runtimeAudit?: boolean;
68
+ /**
69
+ * Opt into workflow verification: after typecheck, boot the generated app in
70
+ * a real headless browser and walk the derived user workflows, writing
71
+ * `wiki/verification.md`. Proves the app works for a user, not just compiles.
72
+ * Heavy (Chromium + `next dev`); defaults to `false`.
73
+ */
74
+ verify?: boolean;
75
+ /**
76
+ * Path globs to KEEP — only endpoints whose path matches become screens.
77
+ * Slices a large swagger to one actor surface, e.g.
78
+ * `["shoppings/customers/**"]`. Empty/absent means "all".
79
+ */
80
+ include?: string[];
81
+ /** Path globs to DROP after include, e.g. `["**​/monitors/**"]`. */
82
+ exclude?: string[];
83
+ /**
84
+ * Optional callback for every event the orchestrators dispatch
85
+ * (`autoViewStart`, `autoViewSdkStudy`, `autoViewProductPlan`,
86
+ * `autoViewScaffold`, per-page `autoViewRenderPage`, `autoViewReview`,
87
+ * `autoViewComplete`). Useful for progress bars, structured logging, etc.
88
+ */
89
+ onEvent?: (event: AutoViewDispatchEvent) => void;
90
+ }
91
+ /** Public result of {@link AutoViewAgent.run}. */
92
+ export interface IAutoViewAgentResult {
93
+ /** Path → content map of the generated frontend project. */
94
+ files: Record<string, string>;
95
+ }
96
+ export declare class AutoViewAgent {
97
+ private readonly props;
98
+ constructor(props: IAutoViewAgentProps);
99
+ /**
100
+ * Drive every AutoView phase end-to-end and return the assembled frontend
101
+ * project as a flat `path → content` map.
102
+ *
103
+ * Mutates nothing on disk; serialize the map to ZIP, push it to a Sandbox, or
104
+ * write it out directly with `@autobe/filesystem` — your choice. The CLI
105
+ * binary (`bin/autoview`) does the disk-write step.
106
+ */
107
+ run(): Promise<IAutoViewAgentResult>;
108
+ private conversate;
109
+ }
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AutoViewAgent = void 0;
13
+ const core_1 = require("@agentica/core");
14
+ const AutoViewInterfaceCompiler_1 = require("./compiler/AutoViewInterfaceCompiler");
15
+ const orchestrateAutoView_1 = require("./orchestrate/orchestrateAutoView");
16
+ class AutoViewAgent {
17
+ constructor(props) {
18
+ this.props = props;
19
+ }
20
+ /**
21
+ * Drive every AutoView phase end-to-end and return the assembled frontend
22
+ * project as a flat `path → content` map.
23
+ *
24
+ * Mutates nothing on disk; serialize the map to ZIP, push it to a Sandbox, or
25
+ * write it out directly with `@autobe/filesystem` — your choice. The CLI
26
+ * binary (`bin/autoview`) does the disk-write step.
27
+ */
28
+ run() {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ var _a, _b, _c, _d, _e;
31
+ const compiler = (_a = this.props.compiler) !== null && _a !== void 0 ? _a : {
32
+ interface: new AutoViewInterfaceCompiler_1.AutoViewInterfaceCompiler(),
33
+ };
34
+ let captured = {};
35
+ const ctx = {
36
+ state: () => ({
37
+ interface: { document: this.props.document, step: 0 },
38
+ }),
39
+ compiler: () => __awaiter(this, void 0, void 0, function* () { return compiler; }),
40
+ vendor: { semaphore: (_b = this.props.semaphore) !== null && _b !== void 0 ? _b : 8 },
41
+ dispatch: (event) => {
42
+ var _a, _b;
43
+ if (event.type === "autoViewComplete") {
44
+ captured = event.files;
45
+ }
46
+ (_b = (_a = this.props).onEvent) === null || _b === void 0 ? void 0 : _b.call(_a, event);
47
+ return event;
48
+ },
49
+ conversate: (cprops) => this.conversate(cprops),
50
+ };
51
+ yield (0, orchestrateAutoView_1.orchestrateAutoView)(ctx, {
52
+ source: "interface",
53
+ designTheme: this.props.designTheme,
54
+ backend: (_c = this.props.backend) !== null && _c !== void 0 ? _c : null,
55
+ runtimeAudit: (_d = this.props.runtimeAudit) !== null && _d !== void 0 ? _d : false,
56
+ verify: (_e = this.props.verify) !== null && _e !== void 0 ? _e : false,
57
+ include: this.props.include,
58
+ exclude: this.props.exclude,
59
+ });
60
+ return { files: captured };
61
+ });
62
+ }
63
+ conversate(cprops) {
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ // Minimal agentica wiring — no quota tracker, no vendor-specific
66
+ // shims, no compaction. The full AutoBE agent layers those on for
67
+ // its own concerns; the standalone path keeps things thin so it
68
+ // works against any OpenAI-compatible endpoint that supports tool
69
+ // calling.
70
+ const agent = new core_1.MicroAgentica({
71
+ vendor: this.props.vendor,
72
+ config: {
73
+ executor: { describe: false },
74
+ stream: cprops.enforceFunctionCall === false,
75
+ },
76
+ histories: cprops.histories,
77
+ controllers: [cprops.controller],
78
+ });
79
+ let tokenUsage = zeroTokenUsage();
80
+ const metric = {
81
+ attempt: 0,
82
+ success: 0,
83
+ invalidJson: 0,
84
+ validationFailure: 0,
85
+ consent: 0,
86
+ };
87
+ agent.on("call", () => {
88
+ metric.attempt++;
89
+ });
90
+ agent.on("execute", () => {
91
+ metric.success++;
92
+ });
93
+ agent.on("jsonParseError", () => {
94
+ metric.invalidJson++;
95
+ });
96
+ agent.on("validate", () => {
97
+ metric.validationFailure++;
98
+ });
99
+ yield agent.conversate(cprops.userMessage);
100
+ const usage = agent.getTokenUsage().aggregate;
101
+ tokenUsage = {
102
+ total: usage.total,
103
+ input: usage.input,
104
+ output: usage.output,
105
+ };
106
+ return { metric, tokenUsage };
107
+ });
108
+ }
109
+ }
110
+ exports.AutoViewAgent = AutoViewAgent;
111
+ function zeroTokenUsage() {
112
+ return {
113
+ total: 0,
114
+ input: { total: 0, cached: 0 },
115
+ output: {
116
+ total: 0,
117
+ reasoning: 0,
118
+ accepted_prediction: 0,
119
+ rejected_prediction: 0,
120
+ },
121
+ };
122
+ }
123
+ //# sourceMappingURL=AutoViewAgent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutoViewAgent.js","sourceRoot":"","sources":["../src/AutoViewAgent.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,15 @@
1
+ import { OpenApi } from "@typia/interface";
2
+ /**
3
+ * Emit a runnable MCP (Model Context Protocol) server from an OpenAPI document —
4
+ * the agent-facing counterpart of the generated frontend. The server exposes the
5
+ * shaped tool surface (read/write annotations + producer hints) and, on a tool
6
+ * call, executes the real API over HTTP against the configured backend.
7
+ *
8
+ * Returns a flat `path → content` project map (server + package.json + README),
9
+ * the same shape the frontend scaffold returns, so the CLI writes it the same
10
+ * way. Deterministic: same document → same server.
11
+ */
12
+ export declare function emitMcpServer(document: OpenApi.IDocument, options?: {
13
+ backend: string | null;
14
+ title?: string;
15
+ }): Record<string, string>;