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 @@
1/// <reference types="next" />1/// <reference types="next" />
2/// <reference types="next/image-types/global" />2/// <reference types="next/image-types/global" />
3import "./.next/dev/types/routes.d.ts";3import "./.next/types/routes.d.ts";
4 4
5// NOTE: This file should not be edited5// NOTE: This file should not be edited
6// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.6// 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
61function progressStepStates(sourceType: ToolSourceRecord["type"], progress?: SourceProgressState) {61function progressStepStates(sourceType: ToolSourceRecord["type"], progress?: SourceProgressState) {
62 const isOpenApi = sourceType === "openapi";62 const isOpenApi = sourceType === "openapi";
63 const labels = isOpenApi63 const labels = isOpenApi
64 ? ["Download spec", "Extract operations", "Index tools"]64 ? ["Downloading & Extracting Operations", "Index tools"]
65 : ["Connect", "Discover tools", "Index tools"];65 : ["Connect", "Discover tools", "Index tools"];
66 66
67 const defaultSteps = labels.map((label, index) => ({67 const defaultSteps = labels.map((label, index) => ({
@@ -80,24 +80,23 @@ function progressStepStates(sourceType: ToolSourceRecord["type"], progress?: Sou · 12 unmodified lines
80 80
81 if (progress.state === "indexing") {81 if (progress.state === "indexing") {
82 return defaultSteps.map((step) => {82 return defaultSteps.map((step) => {
83 if (step.id < 3) return { ...step, status: "done" as const };83 if (step.id === 1) return { ...step, status: "done" as const };
84 return { ...step, status: "active" as const };84 if (step.id === 2) return { ...step, status: "active" as const };
85 return step;
85 });86 });
86 }87 }
87 88
88 if (progress.state === "loading") {89 if (progress.state === "loading") {
89 const message = progress.message?.toLowerCase() ?? "";
90 const activeStep = message.includes("download") ? 1 : 2;
91 return defaultSteps.map((step) => {90 return defaultSteps.map((step) => {
92 if (step.id < activeStep) return { ...step, status: "done" as const };91 if (step.id === 1) return { ...step, status: "active" as const };
93 if (step.id === activeStep) return { ...step, status: "active" as const };
94 return step;92 return step;
95 });93 });
96 }94 }
97 95
98 if (progress.state === "failed") {96 if (progress.state === "failed") {
99 const message = progress.message?.toLowerCase() ?? "";97 const failedStep = sourceType === "openapi"
100 const failedStep = message.includes("index") ? 3 : message.includes("download") ? 1 : 2;98 ? (typeof progress.processedTools === "number" && progress.toolCount > 0 ? 2 : 1)
99 : (progress.message?.toLowerCase().includes("index") ? 3 : 2);
101 return defaultSteps.map((step) => {100 return defaultSteps.map((step) => {
102 if (step.id < failedStep) return { ...step, status: "done" as const };101 if (step.id < failedStep) return { ...step, status: "done" as const };
103 if (step.id === failedStep) return { ...step, status: "failed" as const };102 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
8import type { PreparedOpenApiSpec } from "./tool/source-types";8import type { PreparedOpenApiSpec } from "./tool/source-types";
9import { toPlainObject } from "./utils";9import { toPlainObject } from "./utils";
10 10
11const unknownRecordSchema = z.record(z.unknown());11const unknownRecordSchema = z.record(z.string(), z.unknown());
12const OPENAPI_JSON_FETCH_TIMEOUT_MS = 45_000;12const OPENAPI_JSON_FETCH_TIMEOUT_MS = 45_000;
13 13
14const openApiDocumentSchema = z.object({14const openApiDocumentSchema = z.object({