@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.
- package/LICENSE +661 -0
- package/README.md +407 -0
- package/lib/AutoViewAgent.d.ts +109 -0
- package/lib/AutoViewAgent.js +123 -0
- package/lib/AutoViewAgent.js.map +1 -0
- package/lib/agent/emitMcpServer.d.ts +15 -0
- package/lib/agent/emitMcpServer.js +157 -0
- package/lib/agent/emitMcpServer.js.map +1 -0
- package/lib/agent/emitReport.d.ts +14 -0
- package/lib/agent/emitReport.js +85 -0
- package/lib/agent/emitReport.js.map +1 -0
- package/lib/agent/toolSurface.d.ts +130 -0
- package/lib/agent/toolSurface.js +342 -0
- package/lib/agent/toolSurface.js.map +1 -0
- package/lib/agent/verifyAgentTasks.d.ts +87 -0
- package/lib/agent/verifyAgentTasks.js +126 -0
- package/lib/agent/verifyAgentTasks.js.map +1 -0
- package/lib/cli/main.d.ts +2 -0
- package/lib/cli/main.js +295 -0
- package/lib/cli/main.js.map +1 -0
- package/lib/compiler/AutoViewInterfaceCompiler.d.ts +27 -0
- package/lib/compiler/AutoViewInterfaceCompiler.js +68 -0
- package/lib/compiler/AutoViewInterfaceCompiler.js.map +1 -0
- package/lib/constants/AutoViewFrontendTemplate.d.ts +1 -0
- package/lib/constants/AutoViewFrontendTemplate.js +46 -0
- package/lib/constants/AutoViewFrontendTemplate.js.map +1 -0
- package/lib/constants/AutoViewSystemPromptConstant.d.ts +5 -0
- package/lib/constants/AutoViewSystemPromptConstant.js +4 -0
- package/lib/constants/AutoViewSystemPromptConstant.js.map +1 -0
- package/lib/context/IAutoViewAgentContext.d.ts +60 -0
- package/lib/context/IAutoViewAgentContext.js +3 -0
- package/lib/context/IAutoViewAgentContext.js.map +1 -0
- package/lib/fromSwagger.d.ts +53 -0
- package/lib/fromSwagger.js +513 -0
- package/lib/fromSwagger.js.map +1 -0
- package/lib/generateDeterministic.d.ts +26 -0
- package/lib/generateDeterministic.js +75 -0
- package/lib/generateDeterministic.js.map +1 -0
- package/lib/index.d.ts +15 -0
- package/lib/index.js +41 -0
- package/lib/index.js.map +1 -0
- package/lib/orchestrate/orchestrateAutoView.d.ts +17 -0
- package/lib/orchestrate/orchestrateAutoView.js +491 -0
- package/lib/orchestrate/orchestrateAutoView.js.map +1 -0
- package/lib/orchestrate/orchestrateAutoViewProductPlan.d.ts +37 -0
- package/lib/orchestrate/orchestrateAutoViewProductPlan.js +109 -0
- package/lib/orchestrate/orchestrateAutoViewProductPlan.js.map +1 -0
- package/lib/orchestrate/orchestrateAutoViewRender.d.ts +133 -0
- package/lib/orchestrate/orchestrateAutoViewRender.js +943 -0
- package/lib/orchestrate/orchestrateAutoViewRender.js.map +1 -0
- package/lib/orchestrate/orchestrateAutoViewRenderDeterministic.d.ts +24 -0
- package/lib/orchestrate/orchestrateAutoViewRenderDeterministic.js +92 -0
- package/lib/orchestrate/orchestrateAutoViewRenderDeterministic.js.map +1 -0
- package/lib/orchestrate/orchestrateAutoViewReview.d.ts +48 -0
- package/lib/orchestrate/orchestrateAutoViewReview.js +328 -0
- package/lib/orchestrate/orchestrateAutoViewReview.js.map +1 -0
- package/lib/orchestrate/orchestrateAutoViewScaffold.d.ts +45 -0
- package/lib/orchestrate/orchestrateAutoViewScaffold.js +586 -0
- package/lib/orchestrate/orchestrateAutoViewScaffold.js.map +1 -0
- package/lib/orchestrate/orchestrateAutoViewSdkStudy.d.ts +26 -0
- package/lib/orchestrate/orchestrateAutoViewSdkStudy.js +85 -0
- package/lib/orchestrate/orchestrateAutoViewSdkStudy.js.map +1 -0
- package/lib/orchestrate/structures/IAutoViewProductPlan.d.ts +96 -0
- package/lib/orchestrate/structures/IAutoViewProductPlan.js +3 -0
- package/lib/orchestrate/structures/IAutoViewProductPlan.js.map +1 -0
- package/lib/orchestrate/structures/IAutoViewProductPlanApplication.d.ts +38 -0
- package/lib/orchestrate/structures/IAutoViewProductPlanApplication.js +3 -0
- package/lib/orchestrate/structures/IAutoViewProductPlanApplication.js.map +1 -0
- package/lib/orchestrate/structures/IAutoViewRenderApplication.d.ts +38 -0
- package/lib/orchestrate/structures/IAutoViewRenderApplication.js +3 -0
- package/lib/orchestrate/structures/IAutoViewRenderApplication.js.map +1 -0
- package/lib/orchestrate/structures/IAutoViewReviewApplication.d.ts +40 -0
- package/lib/orchestrate/structures/IAutoViewReviewApplication.js +3 -0
- package/lib/orchestrate/structures/IAutoViewReviewApplication.js.map +1 -0
- package/lib/orchestrate/structures/IAutoViewSdkMap.d.ts +63 -0
- package/lib/orchestrate/structures/IAutoViewSdkMap.js +3 -0
- package/lib/orchestrate/structures/IAutoViewSdkMap.js.map +1 -0
- package/lib/orchestrate/structures/IAutoViewSdkStudyApplication.d.ts +37 -0
- package/lib/orchestrate/structures/IAutoViewSdkStudyApplication.js +3 -0
- package/lib/orchestrate/structures/IAutoViewSdkStudyApplication.js.map +1 -0
- package/lib/orchestrate/utils/HistoryMessage.d.ts +10 -0
- package/lib/orchestrate/utils/HistoryMessage.js +25 -0
- package/lib/orchestrate/utils/HistoryMessage.js.map +1 -0
- package/lib/orchestrate/utils/auditFrontendRuntime.d.ts +53 -0
- package/lib/orchestrate/utils/auditFrontendRuntime.js +362 -0
- package/lib/orchestrate/utils/auditFrontendRuntime.js.map +1 -0
- package/lib/orchestrate/utils/buildDeterministicPlan.d.ts +4 -0
- package/lib/orchestrate/utils/buildDeterministicPlan.js +233 -0
- package/lib/orchestrate/utils/buildDeterministicPlan.js.map +1 -0
- package/lib/orchestrate/utils/buildDeterministicSdkMap.d.ts +22 -0
- package/lib/orchestrate/utils/buildDeterministicSdkMap.js +154 -0
- package/lib/orchestrate/utils/buildDeterministicSdkMap.js.map +1 -0
- package/lib/orchestrate/utils/cacheNodeModules.d.ts +31 -0
- package/lib/orchestrate/utils/cacheNodeModules.js +134 -0
- package/lib/orchestrate/utils/cacheNodeModules.js.map +1 -0
- package/lib/orchestrate/utils/describeEndpointPropsShape.d.ts +37 -0
- package/lib/orchestrate/utils/describeEndpointPropsShape.js +192 -0
- package/lib/orchestrate/utils/describeEndpointPropsShape.js.map +1 -0
- package/lib/orchestrate/utils/describeEndpointRequestBodyShape.d.ts +22 -0
- package/lib/orchestrate/utils/describeEndpointRequestBodyShape.js +29 -0
- package/lib/orchestrate/utils/describeEndpointRequestBodyShape.js.map +1 -0
- package/lib/orchestrate/utils/describeEndpointResponseShape.d.ts +19 -0
- package/lib/orchestrate/utils/describeEndpointResponseShape.js +30 -0
- package/lib/orchestrate/utils/describeEndpointResponseShape.js.map +1 -0
- package/lib/orchestrate/utils/executeCachedBatch.d.ts +22 -0
- package/lib/orchestrate/utils/executeCachedBatch.js +64 -0
- package/lib/orchestrate/utils/executeCachedBatch.js.map +1 -0
- package/lib/orchestrate/utils/loadShoppingFixture.d.ts +33 -0
- package/lib/orchestrate/utils/loadShoppingFixture.js +17 -0
- package/lib/orchestrate/utils/loadShoppingFixture.js.map +1 -0
- package/lib/orchestrate/utils/normalizeProductPlanPaths.d.ts +24 -0
- package/lib/orchestrate/utils/normalizeProductPlanPaths.js +77 -0
- package/lib/orchestrate/utils/normalizeProductPlanPaths.js.map +1 -0
- package/lib/orchestrate/utils/renderJsonSchema.d.ts +23 -0
- package/lib/orchestrate/utils/renderJsonSchema.js +122 -0
- package/lib/orchestrate/utils/renderJsonSchema.js.map +1 -0
- package/lib/orchestrate/utils/renderResourcePage.d.ts +36 -0
- package/lib/orchestrate/utils/renderResourcePage.js +1415 -0
- package/lib/orchestrate/utils/renderResourcePage.js.map +1 -0
- package/lib/orchestrate/utils/validateFrontendTypecheck.d.ts +109 -0
- package/lib/orchestrate/utils/validateFrontendTypecheck.js +274 -0
- package/lib/orchestrate/utils/validateFrontendTypecheck.js.map +1 -0
- package/lib/preview/renderPreview.d.ts +22 -0
- package/lib/preview/renderPreview.js +198 -0
- package/lib/preview/renderPreview.js.map +1 -0
- package/lib/typings/compiler.d.ts +39 -0
- package/lib/typings/compiler.js +3 -0
- package/lib/typings/compiler.js.map +1 -0
- package/lib/typings/events.d.ts +106 -0
- package/lib/typings/events.js +3 -0
- package/lib/typings/events.js.map +1 -0
- package/lib/typings/index.d.ts +10 -0
- package/lib/typings/index.js +27 -0
- package/lib/typings/index.js.map +1 -0
- package/lib/typings/misc.d.ts +78 -0
- package/lib/typings/misc.js +3 -0
- package/lib/typings/misc.js.map +1 -0
- package/lib/utils/ArrayUtil.d.ts +8 -0
- package/lib/utils/ArrayUtil.js +30 -0
- package/lib/utils/ArrayUtil.js.map +1 -0
- package/lib/utils/StringUtil.d.ts +11 -0
- package/lib/utils/StringUtil.js +28 -0
- package/lib/utils/StringUtil.js.map +1 -0
- package/lib/utils/classifyEndpoints.d.ts +62 -0
- package/lib/utils/classifyEndpoints.js +216 -0
- package/lib/utils/classifyEndpoints.js.map +1 -0
- package/lib/utils/endpointFilter.d.ts +26 -0
- package/lib/utils/endpointFilter.js +0 -0
- package/lib/utils/endpointFilter.js.map +1 -0
- package/lib/utils/extractFields.d.ts +85 -0
- package/lib/utils/extractFields.js +231 -0
- package/lib/utils/extractFields.js.map +1 -0
- package/lib/utils/index.d.ts +13 -0
- package/lib/utils/index.js +30 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/normalizeForNestia.d.ts +34 -0
- package/lib/utils/normalizeForNestia.js +133 -0
- package/lib/utils/normalizeForNestia.js.map +1 -0
- package/lib/utils/resourcePlan.d.ts +39 -0
- package/lib/utils/resourcePlan.js +95 -0
- package/lib/utils/resourcePlan.js.map +1 -0
- package/lib/utils/sliceDocument.d.ts +17 -0
- package/lib/utils/sliceDocument.js +114 -0
- package/lib/utils/sliceDocument.js.map +1 -0
- package/lib/utils/toEndpoints.d.ts +90 -0
- package/lib/utils/toEndpoints.js +227 -0
- package/lib/utils/toEndpoints.js.map +1 -0
- package/lib/verify/runWorkflows.d.ts +25 -0
- package/lib/verify/runWorkflows.js +366 -0
- package/lib/verify/runWorkflows.js.map +1 -0
- package/lib/verify/workflows.d.ts +53 -0
- package/lib/verify/workflows.js +107 -0
- package/lib/verify/workflows.js.map +1 -0
- package/package.json +82 -0
- package/prompts/AUTOVIEW_RENDER.md +398 -0
- package/prompts/AUTOVIEW_REVIEW.md +60 -0
- package/prompts/AUTOVIEW_SDK_STUDY.md +89 -0
- package/src/AutoViewAgent.ts +222 -0
- package/src/agent/emitMcpServer.integration.test.ts +168 -0
- package/src/agent/emitMcpServer.test.ts +51 -0
- package/src/agent/emitMcpServer.ts +178 -0
- package/src/agent/emitReport.ts +117 -0
- package/src/agent/toolSurface.test.ts +243 -0
- package/src/agent/toolSurface.ts +501 -0
- package/src/agent/verifyAgentTasks.test.ts +106 -0
- package/src/agent/verifyAgentTasks.ts +171 -0
- package/src/cli/main.ts +363 -0
- package/src/compiler/AutoViewInterfaceCompiler.ts +69 -0
- package/src/constants/AutoViewFrontendTemplate.ts +42 -0
- package/src/constants/AutoViewSystemPromptConstant.ts +6 -0
- package/src/context/IAutoViewAgentContext.ts +84 -0
- package/src/fromSwagger.test.ts +269 -0
- package/src/fromSwagger.ts +500 -0
- package/src/generateDeterministic.test.ts +39 -0
- package/src/generateDeterministic.ts +77 -0
- package/src/index.ts +30 -0
- package/src/orchestrate/orchestrateAutoView.ts +590 -0
- package/src/orchestrate/orchestrateAutoViewProductPlan.ts +121 -0
- package/src/orchestrate/orchestrateAutoViewRender.ts +1117 -0
- package/src/orchestrate/orchestrateAutoViewRenderDeterministic.ts +101 -0
- package/src/orchestrate/orchestrateAutoViewReview.ts +272 -0
- package/src/orchestrate/orchestrateAutoViewScaffold.ts +627 -0
- package/src/orchestrate/orchestrateAutoViewSdkStudy.ts +90 -0
- package/src/orchestrate/renderNavTs.test.ts +74 -0
- package/src/orchestrate/structures/IAutoViewProductPlan.ts +119 -0
- package/src/orchestrate/structures/IAutoViewProductPlanApplication.ts +41 -0
- package/src/orchestrate/structures/IAutoViewRenderApplication.ts +40 -0
- package/src/orchestrate/structures/IAutoViewReviewApplication.ts +42 -0
- package/src/orchestrate/structures/IAutoViewSdkMap.ts +72 -0
- package/src/orchestrate/structures/IAutoViewSdkStudyApplication.ts +40 -0
- package/src/orchestrate/utils/HistoryMessage.ts +41 -0
- package/src/orchestrate/utils/auditFrontendRuntime.test.ts +18 -0
- package/src/orchestrate/utils/auditFrontendRuntime.ts +454 -0
- package/src/orchestrate/utils/buildDeterministicPlan.test.ts +170 -0
- package/src/orchestrate/utils/buildDeterministicPlan.ts +289 -0
- package/src/orchestrate/utils/buildDeterministicSdkMap.test.ts +90 -0
- package/src/orchestrate/utils/buildDeterministicSdkMap.ts +169 -0
- package/src/orchestrate/utils/cacheNodeModules.ts +136 -0
- package/src/orchestrate/utils/describeEndpointPropsShape.test.ts +86 -0
- package/src/orchestrate/utils/describeEndpointPropsShape.ts +202 -0
- package/src/orchestrate/utils/describeEndpointRequestBodyShape.test.ts +87 -0
- package/src/orchestrate/utils/describeEndpointRequestBodyShape.ts +31 -0
- package/src/orchestrate/utils/describeEndpointResponseShape.test.ts +70 -0
- package/src/orchestrate/utils/describeEndpointResponseShape.ts +32 -0
- package/src/orchestrate/utils/executeCachedBatch.ts +59 -0
- package/src/orchestrate/utils/loadShoppingFixture.ts +52 -0
- package/src/orchestrate/utils/normalizeProductPlanPaths.ts +92 -0
- package/src/orchestrate/utils/renderJsonSchema.test.ts +162 -0
- package/src/orchestrate/utils/renderJsonSchema.ts +133 -0
- package/src/orchestrate/utils/renderResourcePage.test.ts +468 -0
- package/src/orchestrate/utils/renderResourcePage.ts +1624 -0
- package/src/orchestrate/utils/validateFrontendTypecheck.test.ts +32 -0
- package/src/orchestrate/utils/validateFrontendTypecheck.ts +335 -0
- package/src/preview/renderPreview.ts +273 -0
- package/src/typings/compiler.ts +47 -0
- package/src/typings/events.ts +155 -0
- package/src/typings/index.ts +10 -0
- package/src/typings/misc.ts +93 -0
- package/src/utils/ArrayUtil.ts +16 -0
- package/src/utils/StringUtil.ts +29 -0
- package/src/utils/classifyEndpoints.test.ts +86 -0
- package/src/utils/classifyEndpoints.ts +291 -0
- package/src/utils/endpointFilter.test.ts +50 -0
- package/src/utils/endpointFilter.ts +0 -0
- package/src/utils/extractFields.test.ts +82 -0
- package/src/utils/extractFields.ts +306 -0
- package/src/utils/index.ts +13 -0
- package/src/utils/normalizeForNestia.test.ts +93 -0
- package/src/utils/normalizeForNestia.ts +139 -0
- package/src/utils/resourcePlan.test.ts +104 -0
- package/src/utils/resourcePlan.ts +180 -0
- package/src/utils/sliceDocument.test.ts +85 -0
- package/src/utils/sliceDocument.ts +119 -0
- package/src/utils/toEndpoints.test.ts +251 -0
- package/src/utils/toEndpoints.ts +343 -0
- package/src/verify/runWorkflows.ts +403 -0
- package/src/verify/workflows.test.ts +117 -0
- package/src/verify/workflows.ts +154 -0
- package/template/CLAUDE.md +140 -0
- package/template/Dockerfile +31 -0
- package/template/PROMPT.md +80 -0
- package/template/SANDBOX.md +70 -0
- package/template/app/api/health/route.ts +10 -0
- package/template/app/globals.css +97 -0
- package/template/app/layout.tsx +30 -0
- package/template/app/page.tsx +19 -0
- package/template/components/AppShell.tsx +114 -0
- package/template/components/auto/CatalogGrid.tsx +159 -0
- package/template/components/auto/ConfirmButton.tsx +67 -0
- package/template/components/auto/EmbeddedCollection.tsx +144 -0
- package/template/components/auto/ResourceDashboard.tsx +104 -0
- package/template/components/auto/ResourceDetail.tsx +93 -0
- package/template/components/auto/ResourceForm.tsx +235 -0
- package/template/components/auto/ResourceIcon.tsx +88 -0
- package/template/components/auto/ResourceLanding.tsx +155 -0
- package/template/components/auto/ResourceTable.tsx +223 -0
- package/template/components/auto/formatValue.tsx +186 -0
- package/template/components/auto/types.ts +42 -0
- package/template/components/ui/badge.tsx +40 -0
- package/template/components/ui/button.tsx +57 -0
- package/template/components/ui/card.tsx +86 -0
- package/template/components/ui/dialog.tsx +119 -0
- package/template/components/ui/input.tsx +23 -0
- package/template/components/ui/label.tsx +24 -0
- package/template/components/ui/pagination.tsx +117 -0
- package/template/components/ui/select.tsx +92 -0
- package/template/components/ui/sheet.tsx +135 -0
- package/template/components/ui/skeleton.tsx +15 -0
- package/template/components/ui/table.tsx +120 -0
- package/template/components/ui/tabs.tsx +55 -0
- package/template/lib/utils.ts +35 -0
- package/template/next.config.mjs +52 -0
- package/template/package.json +46 -0
- package/template/postcss.config.js +6 -0
- package/template/scripts/start-shopping-backend.sh +56 -0
- package/template/tailwind.config.ts +96 -0
- package/template/tsconfig.json +29 -0
package/lib/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.loadShoppingFixture = exports.auditFrontendRuntime = exports.validateFrontendTypecheck = exports.hashFrontendDependencies = exports.renderNamedSchema = exports.renderJsonSchema = exports.describeEndpointResponseShape = exports.describeEndpointRequestBodyShape = exports.describeRequestBodyHint = exports.describeEndpointPropsShape = exports.AutoViewFrontendTemplate = void 0;
|
|
18
|
+
__exportStar(require("./AutoViewAgent"), exports);
|
|
19
|
+
__exportStar(require("./context/IAutoViewAgentContext"), exports);
|
|
20
|
+
__exportStar(require("./fromSwagger"), exports);
|
|
21
|
+
__exportStar(require("./orchestrate/orchestrateAutoView"), exports);
|
|
22
|
+
var AutoViewFrontendTemplate_1 = require("./constants/AutoViewFrontendTemplate");
|
|
23
|
+
Object.defineProperty(exports, "AutoViewFrontendTemplate", { enumerable: true, get: function () { return AutoViewFrontendTemplate_1.AutoViewFrontendTemplate; } });
|
|
24
|
+
var describeEndpointPropsShape_1 = require("./orchestrate/utils/describeEndpointPropsShape");
|
|
25
|
+
Object.defineProperty(exports, "describeEndpointPropsShape", { enumerable: true, get: function () { return describeEndpointPropsShape_1.describeEndpointPropsShape; } });
|
|
26
|
+
Object.defineProperty(exports, "describeRequestBodyHint", { enumerable: true, get: function () { return describeEndpointPropsShape_1.describeRequestBodyHint; } });
|
|
27
|
+
var describeEndpointRequestBodyShape_1 = require("./orchestrate/utils/describeEndpointRequestBodyShape");
|
|
28
|
+
Object.defineProperty(exports, "describeEndpointRequestBodyShape", { enumerable: true, get: function () { return describeEndpointRequestBodyShape_1.describeEndpointRequestBodyShape; } });
|
|
29
|
+
var describeEndpointResponseShape_1 = require("./orchestrate/utils/describeEndpointResponseShape");
|
|
30
|
+
Object.defineProperty(exports, "describeEndpointResponseShape", { enumerable: true, get: function () { return describeEndpointResponseShape_1.describeEndpointResponseShape; } });
|
|
31
|
+
var renderJsonSchema_1 = require("./orchestrate/utils/renderJsonSchema");
|
|
32
|
+
Object.defineProperty(exports, "renderJsonSchema", { enumerable: true, get: function () { return renderJsonSchema_1.renderJsonSchema; } });
|
|
33
|
+
Object.defineProperty(exports, "renderNamedSchema", { enumerable: true, get: function () { return renderJsonSchema_1.renderNamedSchema; } });
|
|
34
|
+
var validateFrontendTypecheck_1 = require("./orchestrate/utils/validateFrontendTypecheck");
|
|
35
|
+
Object.defineProperty(exports, "hashFrontendDependencies", { enumerable: true, get: function () { return validateFrontendTypecheck_1.hashFrontendDependencies; } });
|
|
36
|
+
Object.defineProperty(exports, "validateFrontendTypecheck", { enumerable: true, get: function () { return validateFrontendTypecheck_1.validateFrontendTypecheck; } });
|
|
37
|
+
var auditFrontendRuntime_1 = require("./orchestrate/utils/auditFrontendRuntime");
|
|
38
|
+
Object.defineProperty(exports, "auditFrontendRuntime", { enumerable: true, get: function () { return auditFrontendRuntime_1.auditFrontendRuntime; } });
|
|
39
|
+
var loadShoppingFixture_1 = require("./orchestrate/utils/loadShoppingFixture");
|
|
40
|
+
Object.defineProperty(exports, "loadShoppingFixture", { enumerable: true, get: function () { return loadShoppingFixture_1.loadShoppingFixture; } });
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,kEAAgD;AAChD,gDAA8B;AAC9B,oEAAkD;AAClD,iFAAgF;AAAvE,oIAAA,wBAAwB,OAAA;AACjC,6FAGwD;AAFtD,wIAAA,0BAA0B,OAAA;AAC1B,qIAAA,uBAAuB,OAAA;AAEzB,yGAAwG;AAA/F,oJAAA,gCAAgC,OAAA;AACzC,mGAAkG;AAAzF,8IAAA,6BAA6B,OAAA;AACtC,yEAG8C;AAF5C,oHAAA,gBAAgB,OAAA;AAChB,qHAAA,iBAAiB,OAAA;AAEnB,2FAGuD;AAFrD,qIAAA,wBAAwB,OAAA;AACxB,sIAAA,yBAAyB,OAAA;AAM3B,iFAAgF;AAAvE,4HAAA,oBAAoB,OAAA;AAK7B,+EAA8E;AAArE,0HAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IAutoBeRunAutoViewOptions } from "../typings";
|
|
2
|
+
import { IAutoViewAgentContext } from "../context/IAutoViewAgentContext";
|
|
3
|
+
/**
|
|
4
|
+
* Top-level AutoView orchestrator.
|
|
5
|
+
*
|
|
6
|
+
* Walks through the five phases — SDK Study, Product Plan, Scaffold, Render,
|
|
7
|
+
* Review — emitting one event per phase plus per-page progress during Render.
|
|
8
|
+
* The final `autoViewComplete` event carries the assembled frontend project as
|
|
9
|
+
* a flat `path → content` map ready for Sandbox deploy.
|
|
10
|
+
*
|
|
11
|
+
* All five phases (SDK Study → Product Plan → Scaffold → Render → UI Review)
|
|
12
|
+
* are implemented. Visual screenshot capture is intentionally out of scope for
|
|
13
|
+
* the agent itself — the operator runs Playwright against the Sandbox deploy —
|
|
14
|
+
* but the Review phase still produces the `wiki/sdk-feedback.md` audit so the
|
|
15
|
+
* SDK-quality signal lands in the archive.
|
|
16
|
+
*/
|
|
17
|
+
export declare function orchestrateAutoView(ctx: IAutoViewAgentContext, options?: IAutoBeRunAutoViewOptions): Promise<void>;
|
|
@@ -0,0 +1,491 @@
|
|
|
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.orchestrateAutoView = orchestrateAutoView;
|
|
13
|
+
const uuid_1 = require("uuid");
|
|
14
|
+
const orchestrateAutoViewProductPlan_1 = require("./orchestrateAutoViewProductPlan");
|
|
15
|
+
const orchestrateAutoViewRender_1 = require("./orchestrateAutoViewRender");
|
|
16
|
+
const orchestrateAutoViewRenderDeterministic_1 = require("./orchestrateAutoViewRenderDeterministic");
|
|
17
|
+
const orchestrateAutoViewReview_1 = require("./orchestrateAutoViewReview");
|
|
18
|
+
const orchestrateAutoViewScaffold_1 = require("./orchestrateAutoViewScaffold");
|
|
19
|
+
const orchestrateAutoViewSdkStudy_1 = require("./orchestrateAutoViewSdkStudy");
|
|
20
|
+
const auditFrontendRuntime_1 = require("./utils/auditFrontendRuntime");
|
|
21
|
+
const executeCachedBatch_1 = require("./utils/executeCachedBatch");
|
|
22
|
+
const loadShoppingFixture_1 = require("./utils/loadShoppingFixture");
|
|
23
|
+
const normalizeProductPlanPaths_1 = require("./utils/normalizeProductPlanPaths");
|
|
24
|
+
const validateFrontendTypecheck_1 = require("./utils/validateFrontendTypecheck");
|
|
25
|
+
const workflows_1 = require("../verify/workflows");
|
|
26
|
+
const runWorkflows_1 = require("../verify/runWorkflows");
|
|
27
|
+
const sliceDocument_1 = require("../utils/sliceDocument");
|
|
28
|
+
/**
|
|
29
|
+
* Top-level AutoView orchestrator.
|
|
30
|
+
*
|
|
31
|
+
* Walks through the five phases — SDK Study, Product Plan, Scaffold, Render,
|
|
32
|
+
* Review — emitting one event per phase plus per-page progress during Render.
|
|
33
|
+
* The final `autoViewComplete` event carries the assembled frontend project as
|
|
34
|
+
* a flat `path → content` map ready for Sandbox deploy.
|
|
35
|
+
*
|
|
36
|
+
* All five phases (SDK Study → Product Plan → Scaffold → Render → UI Review)
|
|
37
|
+
* are implemented. Visual screenshot capture is intentionally out of scope for
|
|
38
|
+
* the agent itself — the operator runs Playwright against the Sandbox deploy —
|
|
39
|
+
* but the Review phase still produces the `wiki/sdk-feedback.md` audit so the
|
|
40
|
+
* SDK-quality signal lands in the archive.
|
|
41
|
+
*/
|
|
42
|
+
function orchestrateAutoView(ctx_1) {
|
|
43
|
+
return __awaiter(this, arguments, void 0, function* (ctx, options = {}) {
|
|
44
|
+
var _a, _b, _c;
|
|
45
|
+
const source = (_a = options.source) !== null && _a !== void 0 ? _a : "interface";
|
|
46
|
+
const designTheme = ((_b = options.designTheme) !== null && _b !== void 0 ? _b : "").trim();
|
|
47
|
+
const { document: fullDocument, step, reason, backend, } = resolveSource(ctx, source, {
|
|
48
|
+
backend: (_c = options.backend) !== null && _c !== void 0 ? _c : null,
|
|
49
|
+
});
|
|
50
|
+
// Apply `--include` / `--exclude` at the DOCUMENT level, not just the screen
|
|
51
|
+
// list: slicing the paths AND pruning component schemas to their transitive
|
|
52
|
+
// closure is what lets a large swagger (Box, Stripe) actually run — otherwise
|
|
53
|
+
// SDK Study compiles all ~180 schemas and overflows the model's context.
|
|
54
|
+
const document = (0, sliceDocument_1.sliceDocument)(fullDocument, {
|
|
55
|
+
include: options.include,
|
|
56
|
+
exclude: options.exclude,
|
|
57
|
+
});
|
|
58
|
+
const startedAt = Date.now();
|
|
59
|
+
ctx.dispatch({
|
|
60
|
+
type: "autoViewStart",
|
|
61
|
+
id: (0, uuid_1.v7)(),
|
|
62
|
+
created_at: new Date().toISOString(),
|
|
63
|
+
source,
|
|
64
|
+
step,
|
|
65
|
+
designTheme,
|
|
66
|
+
reason,
|
|
67
|
+
});
|
|
68
|
+
// Phase 1 — SDK Study.
|
|
69
|
+
const { map: sdkMap, markdown: sdkMapMarkdown } = yield (0, orchestrateAutoViewSdkStudy_1.orchestrateAutoViewSdkStudy)(ctx, { document, step });
|
|
70
|
+
// Phase 2 — Product Plan.
|
|
71
|
+
const { plan: rawProductPlan, markdown: productPlanMarkdown } = yield (0, orchestrateAutoViewProductPlan_1.orchestrateAutoViewProductPlan)(ctx, {
|
|
72
|
+
document,
|
|
73
|
+
sdkMap,
|
|
74
|
+
designTheme,
|
|
75
|
+
step,
|
|
76
|
+
filter: { include: options.include, exclude: options.exclude },
|
|
77
|
+
});
|
|
78
|
+
// Next.js refuses to start when sibling routes under the same parent
|
|
79
|
+
// disagree on the dynamic-segment name (e.g. `/sales/[id]` vs.
|
|
80
|
+
// `/sales/[saleId]`). The planner cannot always avoid that — run the
|
|
81
|
+
// plan through a deterministic normalizer before the scaffold step
|
|
82
|
+
// bakes the paths into the file tree.
|
|
83
|
+
const productPlan = (0, normalizeProductPlanPaths_1.normalizeProductPlanPaths)(rawProductPlan);
|
|
84
|
+
// Phase 3 — Scaffold (deterministic).
|
|
85
|
+
const scaffolded = yield (0, orchestrateAutoViewScaffold_1.orchestrateAutoViewScaffold)(ctx, {
|
|
86
|
+
document,
|
|
87
|
+
sdkMap,
|
|
88
|
+
sdkMapMarkdown,
|
|
89
|
+
productPlan,
|
|
90
|
+
productPlanMarkdown,
|
|
91
|
+
step,
|
|
92
|
+
backend,
|
|
93
|
+
});
|
|
94
|
+
// Phase 4 — Render (deterministic). Emits one thin `page.tsx` per screen
|
|
95
|
+
// that wires the typed SDK call to a universal `Resource*` component, with
|
|
96
|
+
// column / field metadata baked from the swagger schema. No LLM, no
|
|
97
|
+
// parser-retry roulette: every screen gets a page and every property of its
|
|
98
|
+
// row / response / request type becomes a column / row / input. The rendered
|
|
99
|
+
// pages overwrite the scaffold placeholders in place.
|
|
100
|
+
const render = yield (0, orchestrateAutoViewRenderDeterministic_1.orchestrateAutoViewRenderDeterministic)(ctx, {
|
|
101
|
+
document,
|
|
102
|
+
productPlan,
|
|
103
|
+
step,
|
|
104
|
+
});
|
|
105
|
+
for (const [key, value] of Object.entries(render.files)) {
|
|
106
|
+
scaffolded[key] = value;
|
|
107
|
+
}
|
|
108
|
+
// Phase 4.5 — deterministic `tsc --noEmit` against the assembled tree,
|
|
109
|
+
// plus a typecheck-driven retry pass for screens whose pages failed
|
|
110
|
+
// the gate. The per-screen parser check inside Render only catches
|
|
111
|
+
// grammar failures; type errors against the SDK (the model inventing
|
|
112
|
+
// properties on response types, wrong-casing fields, sending a second
|
|
113
|
+
// argument to a parameterless endpoint, etc.) escape every render
|
|
114
|
+
// attempt unless we actually compile the project the way the user
|
|
115
|
+
// will. Materializing into a temp dir + `npm install` + `tsc` is
|
|
116
|
+
// expensive (~30s on first run) but the typecheck session reuses the
|
|
117
|
+
// installed node_modules across retry rounds, so subsequent
|
|
118
|
+
// typecheck runs cost only the actual compile time.
|
|
119
|
+
const { typecheck, recovered } = yield runTypecheckPhase(ctx, {
|
|
120
|
+
scaffolded,
|
|
121
|
+
document,
|
|
122
|
+
sdkMap,
|
|
123
|
+
productPlan,
|
|
124
|
+
designTheme,
|
|
125
|
+
});
|
|
126
|
+
scaffolded["wiki/typecheck.md"] = typecheck.markdown;
|
|
127
|
+
// Phase 6 — runtime audit (opt-in). After typecheck closes the static
|
|
128
|
+
// gate, boot `next dev` against the assembled tree, walk every screen
|
|
129
|
+
// with a headless Chromium, capture console / pageerror / navigation
|
|
130
|
+
// diagnostics, and re-render broken pages with the live errors in the
|
|
131
|
+
// prompt. The retry pass closes the class of bugs `tsc --noEmit`
|
|
132
|
+
// cannot see — `obj?.array.method(...)` undefined-access patterns,
|
|
133
|
+
// react render crashes against simulator data, hydration mismatches.
|
|
134
|
+
// Skipped when `options.runtimeAudit !== true` because the gate
|
|
135
|
+
// installs Playwright + Chromium (~150MB) and boots `next dev` twice
|
|
136
|
+
// per run, adding ~10–20 minutes to the agent's wall clock.
|
|
137
|
+
let runtimeAudit = null;
|
|
138
|
+
let runtimeRecovered = 0;
|
|
139
|
+
if (options.runtimeAudit === true) {
|
|
140
|
+
const result = yield runRuntimeAuditPhase(ctx, {
|
|
141
|
+
scaffolded,
|
|
142
|
+
document,
|
|
143
|
+
sdkMap,
|
|
144
|
+
productPlan,
|
|
145
|
+
designTheme,
|
|
146
|
+
});
|
|
147
|
+
runtimeAudit = result.audit;
|
|
148
|
+
runtimeRecovered = result.recovered;
|
|
149
|
+
scaffolded["wiki/runtime-audit.md"] = runtimeAudit.markdown;
|
|
150
|
+
}
|
|
151
|
+
// Phase 7 — workflow verification (opt-in). Derive the user workflows from
|
|
152
|
+
// the plan and drive them in a real headless browser, asserting each step's
|
|
153
|
+
// positive outcome (data rendered, navigation moved). Writes
|
|
154
|
+
// `wiki/verification.md` — the evidence that the generated app actually works
|
|
155
|
+
// for a user, not just that it compiles. Skipped unless `options.verify`
|
|
156
|
+
// because it installs Chromium and boots `next dev`.
|
|
157
|
+
if (options.verify === true) {
|
|
158
|
+
try {
|
|
159
|
+
const workflows = (0, workflows_1.deriveWorkflows)(productPlan);
|
|
160
|
+
const verification = yield (0, runWorkflows_1.runWorkflows)(scaffolded, workflows);
|
|
161
|
+
scaffolded["wiki/verification.md"] = verification.markdown;
|
|
162
|
+
}
|
|
163
|
+
catch (err) {
|
|
164
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
165
|
+
scaffolded["wiki/verification.md"] = [
|
|
166
|
+
"# Workflow verification",
|
|
167
|
+
"",
|
|
168
|
+
"Verification could not run against the assembled project:",
|
|
169
|
+
"",
|
|
170
|
+
"```",
|
|
171
|
+
message,
|
|
172
|
+
"```",
|
|
173
|
+
].join("\n");
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
// Phase 5 — UI Review. Code-and-spec audit; produces the
|
|
177
|
+
// operator-facing `wiki/sdk-feedback.md` document. Visual
|
|
178
|
+
// verification is left to the Sandbox deploy step.
|
|
179
|
+
const review = yield (0, orchestrateAutoViewReview_1.orchestrateAutoViewReview)(ctx, {
|
|
180
|
+
document,
|
|
181
|
+
sdkMap,
|
|
182
|
+
productPlan,
|
|
183
|
+
render,
|
|
184
|
+
typecheck,
|
|
185
|
+
recovered: recovered + runtimeRecovered,
|
|
186
|
+
step,
|
|
187
|
+
});
|
|
188
|
+
scaffolded["wiki/sdk-feedback.md"] = review.markdown;
|
|
189
|
+
ctx.dispatch({
|
|
190
|
+
type: "autoViewComplete",
|
|
191
|
+
id: (0, uuid_1.v7)(),
|
|
192
|
+
created_at: new Date().toISOString(),
|
|
193
|
+
step,
|
|
194
|
+
source,
|
|
195
|
+
elapsed: Date.now() - startedAt,
|
|
196
|
+
pages: productPlan.screens.length,
|
|
197
|
+
files: scaffolded,
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
function resolveSource(ctx, source, overrides) {
|
|
202
|
+
var _a, _b;
|
|
203
|
+
if (source === "shopping") {
|
|
204
|
+
// Stable reference SDK derived from `@samchon/shopping-api`. Lets
|
|
205
|
+
// the AutoView pipeline run end-to-end without waiting for the
|
|
206
|
+
// live AutoBE interface phase to complete, which is the whole
|
|
207
|
+
// reason the bundled fixture exists.
|
|
208
|
+
//
|
|
209
|
+
// Default the backend at `http://127.0.0.1:37001` instead of the
|
|
210
|
+
// swagger's `servers[0].url` (the public host is not reachable from
|
|
211
|
+
// most networks). The frontend pack ships
|
|
212
|
+
// `scripts/start-shopping-backend.sh`, which clones
|
|
213
|
+
// `samchon/shopping` and boots its NestJS server on that port — so
|
|
214
|
+
// the demo runs end-to-end against the real backend with seeded
|
|
215
|
+
// product data instead of typia-random gibberish.
|
|
216
|
+
const fixture = (0, loadShoppingFixture_1.loadShoppingFixture)();
|
|
217
|
+
return {
|
|
218
|
+
document: fixture.document,
|
|
219
|
+
step: 0,
|
|
220
|
+
reason: "User triggered AutoView against the bundled @samchon/shopping-api reference.",
|
|
221
|
+
backend: (_a = overrides.backend) !== null && _a !== void 0 ? _a : { host: "http://127.0.0.1:37001" },
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
const interfaceHistory = ctx.state().interface;
|
|
225
|
+
if (interfaceHistory === null) {
|
|
226
|
+
throw new Error("AutoView requires the interface phase to be complete first. " +
|
|
227
|
+
'Run with source: "shopping" to use the bundled reference instead.');
|
|
228
|
+
}
|
|
229
|
+
return {
|
|
230
|
+
document: interfaceHistory.document,
|
|
231
|
+
step: interfaceHistory.step,
|
|
232
|
+
reason: "User triggered AutoView against the AutoBE interface output.",
|
|
233
|
+
// Honor the caller's backend hint (CLI extracts it from swagger
|
|
234
|
+
// `servers[]`, or accepts a `--backend <url>` flag). When none was
|
|
235
|
+
// given the scaffold falls back to simulate-only mode — only useful
|
|
236
|
+
// for swaggers that genuinely have no backend (AutoBE's interface
|
|
237
|
+
// phase before the operator wires their own server).
|
|
238
|
+
backend: (_b = overrides.backend) !== null && _b !== void 0 ? _b : { host: null },
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Maximum number of full typecheck+rerender rounds. Initial render counts as
|
|
243
|
+
* round 0, so this many additional rounds may follow it.
|
|
244
|
+
*/
|
|
245
|
+
const MAX_TYPECHECK_RETRY_ROUNDS = 2;
|
|
246
|
+
/**
|
|
247
|
+
* Phase 4.5 in full: open a typecheck session against the assembled file map,
|
|
248
|
+
* iterate "typecheck → re-render broken screens → typecheck" up to
|
|
249
|
+
* {@link MAX_TYPECHECK_RETRY_ROUNDS} rounds, and return the final result. The
|
|
250
|
+
* scaffolded map is mutated in place — each successful re-render overwrites the
|
|
251
|
+
* broken file so the assembled output reflects the final state seen by the
|
|
252
|
+
* typecheck gate.
|
|
253
|
+
*
|
|
254
|
+
* Returns the last typecheck result + `recovered` count (screens that the loop
|
|
255
|
+
* fixed) so the Review event can report both honestly. On infra failure (npm
|
|
256
|
+
* install crash, etc.) returns a marker typecheck result and a recovered count
|
|
257
|
+
* of zero — the operator still gets the file map.
|
|
258
|
+
*/
|
|
259
|
+
function runTypecheckPhase(ctx, args) {
|
|
260
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
261
|
+
let session;
|
|
262
|
+
try {
|
|
263
|
+
session = yield validateFrontendTypecheck_1.FrontendTypecheckSession.open(args.scaffolded);
|
|
264
|
+
}
|
|
265
|
+
catch (err) {
|
|
266
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
267
|
+
return {
|
|
268
|
+
typecheck: {
|
|
269
|
+
diagnostics: new Map(),
|
|
270
|
+
totalErrors: 0,
|
|
271
|
+
markdown: [
|
|
272
|
+
"# Typecheck report",
|
|
273
|
+
"",
|
|
274
|
+
"`tsc --noEmit` could not be run against the assembled project:",
|
|
275
|
+
"",
|
|
276
|
+
"```",
|
|
277
|
+
message,
|
|
278
|
+
"```",
|
|
279
|
+
"",
|
|
280
|
+
"Re-run the project locally with `npm install && npm run typecheck` to validate.",
|
|
281
|
+
].join("\n"),
|
|
282
|
+
elapsedMs: 0,
|
|
283
|
+
},
|
|
284
|
+
recovered: 0,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
try {
|
|
288
|
+
let typecheck = yield session.typecheck();
|
|
289
|
+
let recovered = 0;
|
|
290
|
+
const allScreenPaths = args.productPlan.screens.map((s) => s.path);
|
|
291
|
+
const semaphoreCap = typeof ctx.vendor.semaphore === "number"
|
|
292
|
+
? ctx.vendor.semaphore
|
|
293
|
+
: ctx.vendor.semaphore !== undefined
|
|
294
|
+
? ctx.vendor.semaphore.max()
|
|
295
|
+
: 8;
|
|
296
|
+
for (let round = 0; round < MAX_TYPECHECK_RETRY_ROUNDS && typecheck.totalErrors > 0; round++) {
|
|
297
|
+
// Build the set of (screen, previousTsx, errors) tuples for every
|
|
298
|
+
// broken file that maps back to a known screen. Non-screen files
|
|
299
|
+
// (scaffold components, generated SDK, wiki) are not fixable by
|
|
300
|
+
// re-rendering a single screen — they are left to fail loudly.
|
|
301
|
+
const tasks = [];
|
|
302
|
+
for (const [filePath, diagnostics] of typecheck.diagnostics) {
|
|
303
|
+
const screenPath = (0, orchestrateAutoViewRender_1.fileToScreenPath)(filePath);
|
|
304
|
+
if (screenPath === null)
|
|
305
|
+
continue;
|
|
306
|
+
const screen = args.productPlan.screens.find((s) => s.path === screenPath);
|
|
307
|
+
if (screen === undefined)
|
|
308
|
+
continue;
|
|
309
|
+
const previousTsx = args.scaffolded[filePath];
|
|
310
|
+
if (previousTsx === undefined)
|
|
311
|
+
continue;
|
|
312
|
+
tasks.push({
|
|
313
|
+
screen,
|
|
314
|
+
filePath,
|
|
315
|
+
previousTsx,
|
|
316
|
+
errors: diagnostics.map((d) => ({
|
|
317
|
+
line: d.line,
|
|
318
|
+
column: d.column,
|
|
319
|
+
code: d.code,
|
|
320
|
+
message: d.message,
|
|
321
|
+
})),
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
if (tasks.length === 0)
|
|
325
|
+
break;
|
|
326
|
+
const fixed = new Set();
|
|
327
|
+
yield (0, executeCachedBatch_1.executeCachedBatch)(semaphoreCap, tasks.map((task) => (promptCacheKey) => __awaiter(this, void 0, void 0, function* () {
|
|
328
|
+
const result = yield (0, orchestrateAutoViewRender_1.rerenderScreenForTypecheck)(ctx, {
|
|
329
|
+
screen: task.screen,
|
|
330
|
+
document: args.document,
|
|
331
|
+
sdkMap: args.sdkMap,
|
|
332
|
+
designTheme: args.designTheme,
|
|
333
|
+
promptCacheKey,
|
|
334
|
+
allScreenPaths,
|
|
335
|
+
previousTsx: task.previousTsx,
|
|
336
|
+
typecheckErrors: task.errors,
|
|
337
|
+
});
|
|
338
|
+
if (result === null || !result.ok)
|
|
339
|
+
return;
|
|
340
|
+
args.scaffolded[task.filePath] = result.tsx;
|
|
341
|
+
yield session.writeFile(task.filePath, result.tsx);
|
|
342
|
+
fixed.add(task.filePath);
|
|
343
|
+
})));
|
|
344
|
+
if (fixed.size === 0)
|
|
345
|
+
break;
|
|
346
|
+
const next = yield session.typecheck();
|
|
347
|
+
const errorsBefore = new Set(typecheck.diagnostics.keys());
|
|
348
|
+
const errorsAfter = new Set(next.diagnostics.keys());
|
|
349
|
+
for (const filePath of fixed) {
|
|
350
|
+
if (errorsBefore.has(filePath) && !errorsAfter.has(filePath)) {
|
|
351
|
+
recovered++;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
typecheck = next;
|
|
355
|
+
}
|
|
356
|
+
return { typecheck, recovered };
|
|
357
|
+
}
|
|
358
|
+
finally {
|
|
359
|
+
yield session.dispose();
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Phase 6 in full: open a runtime audit session (npm install + playwright +
|
|
365
|
+
* chromium + `next dev`), capture per-page console / pageerror / navigation
|
|
366
|
+
* diagnostics, re-render the broken pages with the diagnostics in the prompt,
|
|
367
|
+
* and audit one more time. The orchestrator mutates `scaffolded` in place so
|
|
368
|
+
* the next phase sees the corrected output.
|
|
369
|
+
*
|
|
370
|
+
* Returns the final audit + `recovered` count (pages that the loop fixed) so
|
|
371
|
+
* the Review event can report runtime quality alongside the typecheck quality.
|
|
372
|
+
* On infra failure (Playwright install crashed, next dev never became ready,
|
|
373
|
+
* Chromium download blocked) returns a marker audit body and a recovered count
|
|
374
|
+
* of zero — the operator still gets the file map.
|
|
375
|
+
*/
|
|
376
|
+
function runRuntimeAuditPhase(ctx, args) {
|
|
377
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
378
|
+
const pages = args.productPlan.screens.map((s) => s.path);
|
|
379
|
+
let firstAudit;
|
|
380
|
+
try {
|
|
381
|
+
firstAudit = yield (0, auditFrontendRuntime_1.auditFrontendRuntime)(args.scaffolded, pages);
|
|
382
|
+
}
|
|
383
|
+
catch (err) {
|
|
384
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
385
|
+
return {
|
|
386
|
+
audit: {
|
|
387
|
+
diagnostics: [],
|
|
388
|
+
byPage: new Map(),
|
|
389
|
+
visited: pages,
|
|
390
|
+
markdown: [
|
|
391
|
+
"# Runtime audit",
|
|
392
|
+
"",
|
|
393
|
+
"Playwright runtime audit could not be run against the assembled project:",
|
|
394
|
+
"",
|
|
395
|
+
"```",
|
|
396
|
+
message,
|
|
397
|
+
"```",
|
|
398
|
+
"",
|
|
399
|
+
"Re-run the project locally with `npm install && npm run dev` and visit pages by hand to validate.",
|
|
400
|
+
].join("\n"),
|
|
401
|
+
elapsedMs: 0,
|
|
402
|
+
},
|
|
403
|
+
recovered: 0,
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
if (firstAudit.byPage.size === 0) {
|
|
407
|
+
return { audit: firstAudit, recovered: 0 };
|
|
408
|
+
}
|
|
409
|
+
const tasks = [];
|
|
410
|
+
for (const [pagePath, diagnostics] of firstAudit.byPage) {
|
|
411
|
+
const screen = args.productPlan.screens.find((s) => s.path === pagePath);
|
|
412
|
+
if (screen === undefined)
|
|
413
|
+
continue;
|
|
414
|
+
const filePath = (0, orchestrateAutoViewRender_1.screenPathToFile)(screen.path);
|
|
415
|
+
const previousTsx = args.scaffolded[filePath];
|
|
416
|
+
if (previousTsx === undefined)
|
|
417
|
+
continue;
|
|
418
|
+
tasks.push({
|
|
419
|
+
screen,
|
|
420
|
+
filePath,
|
|
421
|
+
previousTsx,
|
|
422
|
+
runtimeErrors: diagnostics.map((d) => ({
|
|
423
|
+
type: d.type,
|
|
424
|
+
message: d.message,
|
|
425
|
+
})),
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
if (tasks.length === 0)
|
|
429
|
+
return { audit: firstAudit, recovered: 0 };
|
|
430
|
+
const allScreenPaths = args.productPlan.screens.map((s) => s.path);
|
|
431
|
+
const semaphoreCap = typeof ctx.vendor.semaphore === "number"
|
|
432
|
+
? ctx.vendor.semaphore
|
|
433
|
+
: ctx.vendor.semaphore !== undefined
|
|
434
|
+
? ctx.vendor.semaphore.max()
|
|
435
|
+
: 8;
|
|
436
|
+
const fixed = new Set();
|
|
437
|
+
yield (0, executeCachedBatch_1.executeCachedBatch)(semaphoreCap, tasks.map((task) => (promptCacheKey) => __awaiter(this, void 0, void 0, function* () {
|
|
438
|
+
const result = yield (0, orchestrateAutoViewRender_1.rerenderScreenForRuntime)(ctx, {
|
|
439
|
+
screen: task.screen,
|
|
440
|
+
document: args.document,
|
|
441
|
+
sdkMap: args.sdkMap,
|
|
442
|
+
designTheme: args.designTheme,
|
|
443
|
+
promptCacheKey,
|
|
444
|
+
allScreenPaths,
|
|
445
|
+
previousTsx: task.previousTsx,
|
|
446
|
+
runtimeErrors: task.runtimeErrors,
|
|
447
|
+
});
|
|
448
|
+
if (result === null || !result.ok)
|
|
449
|
+
return;
|
|
450
|
+
args.scaffolded[task.filePath] = result.tsx;
|
|
451
|
+
fixed.add(task.screen.path);
|
|
452
|
+
})));
|
|
453
|
+
if (fixed.size === 0)
|
|
454
|
+
return { audit: firstAudit, recovered: 0 };
|
|
455
|
+
// Re-audit to measure recovery. Only one retry round to keep the gate
|
|
456
|
+
// bounded; further rounds rarely help once a page survived the prompt
|
|
457
|
+
// rewrite with the diagnostics in hand.
|
|
458
|
+
let secondAudit;
|
|
459
|
+
try {
|
|
460
|
+
secondAudit = yield (0, auditFrontendRuntime_1.auditFrontendRuntime)(args.scaffolded, pages);
|
|
461
|
+
}
|
|
462
|
+
catch (err) {
|
|
463
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
464
|
+
secondAudit = {
|
|
465
|
+
diagnostics: [],
|
|
466
|
+
byPage: new Map(),
|
|
467
|
+
visited: pages,
|
|
468
|
+
markdown: [
|
|
469
|
+
"# Runtime audit (post-retry)",
|
|
470
|
+
"",
|
|
471
|
+
"Second-round Playwright audit could not be run:",
|
|
472
|
+
"",
|
|
473
|
+
"```",
|
|
474
|
+
message,
|
|
475
|
+
"```",
|
|
476
|
+
"",
|
|
477
|
+
"First-round results above are the last known runtime state.",
|
|
478
|
+
].join("\n"),
|
|
479
|
+
elapsedMs: 0,
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
let recovered = 0;
|
|
483
|
+
for (const pagePath of fixed) {
|
|
484
|
+
if (firstAudit.byPage.has(pagePath) && !secondAudit.byPage.has(pagePath)) {
|
|
485
|
+
recovered++;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
return { audit: secondAudit, recovered };
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
//# sourceMappingURL=orchestrateAutoView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrateAutoView.js","sourceRoot":"","sources":["../../src/orchestrate/orchestrateAutoView.ts"],"names":[],"mappings":";;;;;;;;;;;AAiDA,kDA8KC;AAzND,+BAA0B;AAG1B,qFAAkF;AAClF,2EAKqC;AACrC,qGAAkG;AAClG,2EAAwE;AACxE,+EAA4E;AAC5E,+EAA4E;AAC5E,uEAGsC;AACtC,mEAAgE;AAChE,qEAAkE;AAClE,iFAA8E;AAC9E,iFAG2C;AAC3C,mDAAsD;AACtD,yDAAsD;AACtD,0DAAuD;AAEvD;;;;;;;;;;;;;GAaG;AACH,SAAsB,mBAAmB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CAAC;IAC3C,CAAC;CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { OpenApi } from "@typia/interface";
|
|
2
|
+
import { IAutoViewAgentContext } from "../context/IAutoViewAgentContext";
|
|
3
|
+
import { IAutoViewProductPlan } from "./structures/IAutoViewProductPlan";
|
|
4
|
+
import { IAutoViewSdkMap } from "./structures/IAutoViewSdkMap";
|
|
5
|
+
/**
|
|
6
|
+
* Phase 2 of the AutoView agent — Product Plan.
|
|
7
|
+
*
|
|
8
|
+
* Receives the SDK domain map from Phase 1 plus the optional design theme, asks
|
|
9
|
+
* the LLM to turn it into a frontend product (screens, navigation per actor,
|
|
10
|
+
* intentional omissions), and validates the plan against the real SDK before
|
|
11
|
+
* letting the run proceed.
|
|
12
|
+
*
|
|
13
|
+
* Validation invariants (deterministic, no LLM judgment):
|
|
14
|
+
*
|
|
15
|
+
* - At least one screen.
|
|
16
|
+
* - Every screen's `actor` is declared in the SDK map.
|
|
17
|
+
* - Every screen's `endpoints[]` entries match a real accessor path in the
|
|
18
|
+
* OpenAPI document (no inventions).
|
|
19
|
+
* - Every actor with at least one resource in the SDK map has at least one screen
|
|
20
|
+
* (no actors silently dropped).
|
|
21
|
+
* - Navigation entries reference actors that exist in the plan and only point at
|
|
22
|
+
* screen paths the plan declared.
|
|
23
|
+
*/
|
|
24
|
+
export declare function orchestrateAutoViewProductPlan(ctx: IAutoViewAgentContext, props: {
|
|
25
|
+
document: OpenApi.IDocument;
|
|
26
|
+
sdkMap: IAutoViewSdkMap;
|
|
27
|
+
designTheme: string;
|
|
28
|
+
step: number;
|
|
29
|
+
filter?: {
|
|
30
|
+
include?: string[];
|
|
31
|
+
exclude?: string[];
|
|
32
|
+
};
|
|
33
|
+
}): Promise<{
|
|
34
|
+
plan: IAutoViewProductPlan;
|
|
35
|
+
markdown: string;
|
|
36
|
+
}>;
|
|
37
|
+
export declare function renderProductPlanMarkdown(summary: string, plan: IAutoViewProductPlan): string;
|