mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 09:30:43 +00:00
style: format repository
This commit is contained in:
@@ -2,18 +2,11 @@ import AjvPkg, { type ValidateFunction } from "ajv";
|
||||
import dynamicToolCallParamsSchema from "./protocol-generated/json/DynamicToolCallParams.json" with { type: "json" };
|
||||
import errorNotificationSchema from "./protocol-generated/json/v2/ErrorNotification.json" with { type: "json" };
|
||||
import modelListResponseSchema from "./protocol-generated/json/v2/ModelListResponse.json" with { type: "json" };
|
||||
import threadResumeResponseSchema from "./protocol-generated/json/v2/ThreadResumeResponse.json" with {
|
||||
type: "json",
|
||||
};
|
||||
import threadStartResponseSchema from "./protocol-generated/json/v2/ThreadStartResponse.json" with {
|
||||
type: "json",
|
||||
};
|
||||
import turnCompletedNotificationSchema from "./protocol-generated/json/v2/TurnCompletedNotification.json" with {
|
||||
type: "json",
|
||||
};
|
||||
import turnStartResponseSchema from "./protocol-generated/json/v2/TurnStartResponse.json" with {
|
||||
type: "json",
|
||||
};
|
||||
import threadResumeResponseSchema from "./protocol-generated/json/v2/ThreadResumeResponse.json" with { type: "json" };
|
||||
import threadStartResponseSchema from "./protocol-generated/json/v2/ThreadStartResponse.json" with { type: "json" };
|
||||
import turnCompletedNotificationSchema from "./protocol-generated/json/v2/TurnCompletedNotification.json" with { type: "json" };
|
||||
import turnStartResponseSchema from "./protocol-generated/json/v2/TurnStartResponse.json" with { type: "json" };
|
||||
import type { v2 } from "./protocol-generated/typescript/index.js";
|
||||
import type {
|
||||
CodexDynamicToolCallParams,
|
||||
CodexThreadResumeResponse,
|
||||
@@ -21,7 +14,6 @@ import type {
|
||||
CodexTurn,
|
||||
CodexTurnStartResponse,
|
||||
} from "./protocol.js";
|
||||
import type { v2 } from "./protocol-generated/typescript/index.js";
|
||||
|
||||
type AjvInstance = import("ajv").default;
|
||||
|
||||
@@ -38,8 +30,9 @@ const validateDynamicToolCallParams = ajv.compile<CodexDynamicToolCallParams>(
|
||||
);
|
||||
const validateErrorNotification = ajv.compile<v2.ErrorNotification>(errorNotificationSchema);
|
||||
const validateModelListResponse = ajv.compile<v2.ModelListResponse>(modelListResponseSchema);
|
||||
const validateThreadResumeResponse =
|
||||
ajv.compile<CodexThreadResumeResponse>(threadResumeResponseSchema);
|
||||
const validateThreadResumeResponse = ajv.compile<CodexThreadResumeResponse>(
|
||||
threadResumeResponseSchema,
|
||||
);
|
||||
const validateThreadStartResponse =
|
||||
ajv.compile<CodexThreadStartResponse>(threadStartResponseSchema);
|
||||
const validateTurnCompletedNotification = ajv.compile<v2.TurnCompletedNotification>(
|
||||
@@ -85,14 +78,13 @@ export function readCodexTurn(value: unknown): CodexTurn | undefined {
|
||||
export function readCodexTurnCompletedNotification(
|
||||
value: unknown,
|
||||
): v2.TurnCompletedNotification | undefined {
|
||||
return readCodexShape(validateTurnCompletedNotification, normalizeTurnCompletedNotification(value));
|
||||
return readCodexShape(
|
||||
validateTurnCompletedNotification,
|
||||
normalizeTurnCompletedNotification(value),
|
||||
);
|
||||
}
|
||||
|
||||
function assertCodexShape<T>(
|
||||
validate: ValidateFunction<T>,
|
||||
value: unknown,
|
||||
label: string,
|
||||
): T {
|
||||
function assertCodexShape<T>(validate: ValidateFunction<T>, value: unknown, label: string): T {
|
||||
if (validate(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user