History

fix

Rhys Sullivan committed 8 months ago

Commit fed691a1 parent bf7c1b93 files · +10 −11Browse files

Unified · Split

3 files
  1. executor/apps/web/next-env.d.ts +1 −1
  2. executor/apps/web/src/components/tools/explorer/source-form-panel.tsx +8 −9
  3. executor/packages/core/src/openapi-prepare.ts +1 −1
executor/apps/web/next-env.d.ts+1−1
@@ -1,6 +1,6 @@
11 /// <reference types="next" />
22 /// <reference types="next/image-types/global" />
3−import "./.next/dev/types/routes.d.ts";
3+import "./.next/types/routes.d.ts";
44
55 // NOTE: This file should not be edited
66 // see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
executor/apps/web/src/components/tools/explorer/source-form-panel.tsx+8−9
@@ -61,7 +61,7 @@ type SourceProgressState = { · 60 unmodified lines
6161 function progressStepStates(sourceType: ToolSourceRecord["type"], progress?: SourceProgressState) {
6262 const isOpenApi = sourceType === "openapi";
6363 const labels = isOpenApi
64− ? ["Download spec", "Extract operations", "Index tools"]
64+ ? ["Downloading & Extracting Operations", "Index tools"]
6565 : ["Connect", "Discover tools", "Index tools"];
6666
6767 const defaultSteps = labels.map((label, index) => ({
@@ -80,24 +80,23 @@ function progressStepStates(sourceType: ToolSourceRecord["type"], progress?: Sou · 12 unmodified lines
8080
8181 if (progress.state === "indexing") {
8282 return defaultSteps.map((step) => {
83− if (step.id < 3) return { ...step, status: "done" as const };
84− return { ...step, status: "active" as const };
83+ if (step.id === 1) return { ...step, status: "done" as const };
84+ if (step.id === 2) return { ...step, status: "active" as const };
85+ return step;
8586 });
8687 }
8788
8889 if (progress.state === "loading") {
89− const message = progress.message?.toLowerCase() ?? "";
90− const activeStep = message.includes("download") ? 1 : 2;
9190 return defaultSteps.map((step) => {
92− if (step.id < activeStep) return { ...step, status: "done" as const };
93− if (step.id === activeStep) return { ...step, status: "active" as const };
91+ if (step.id === 1) return { ...step, status: "active" as const };
9492 return step;
9593 });
9694 }
9795
9896 if (progress.state === "failed") {
99− const message = progress.message?.toLowerCase() ?? "";
100− const failedStep = message.includes("index") ? 3 : message.includes("download") ? 1 : 2;
97+ const failedStep = sourceType === "openapi"
98+ ? (typeof progress.processedTools === "number" && progress.toolCount > 0 ? 2 : 1)
99+ : (progress.message?.toLowerCase().includes("index") ? 3 : 2);
101100 return defaultSteps.map((step) => {
102101 if (step.id < failedStep) return { ...step, status: "done" as const };
103102 if (step.id === failedStep) return { ...step, status: "failed" as const };
executor/packages/core/src/openapi-prepare.ts+1−1
@@ -8,7 +8,7 @@ import { extractOperationIdsFromDts } from "./openapi/schema-hints"; · 7 unmodified lines
88 import type { PreparedOpenApiSpec } from "./tool/source-types";
99 import { toPlainObject } from "./utils";
1010
11−const unknownRecordSchema = z.record(z.unknown());
11+const unknownRecordSchema = z.record(z.string(), z.unknown());
1212 const OPENAPI_JSON_FETCH_TIMEOUT_MS = 45_000;
1313
1414 const openApiDocumentSchema = z.object({