@cleocode/adapters 2026.4.129 → 2026.4.131
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/dist/index.js +171 -110
- package/dist/index.js.map +4 -4
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1045,6 +1045,66 @@ var init_session2 = __esm({
|
|
|
1045
1045
|
}
|
|
1046
1046
|
});
|
|
1047
1047
|
|
|
1048
|
+
// packages/contracts/src/session-journal.ts
|
|
1049
|
+
import { z as z4 } from "zod";
|
|
1050
|
+
var SESSION_JOURNAL_SCHEMA_VERSION, sessionJournalDoctorSummarySchema, sessionJournalDebriefSummarySchema, sessionJournalEntrySchema;
|
|
1051
|
+
var init_session_journal = __esm({
|
|
1052
|
+
"packages/contracts/src/session-journal.ts"() {
|
|
1053
|
+
"use strict";
|
|
1054
|
+
SESSION_JOURNAL_SCHEMA_VERSION = "1.0";
|
|
1055
|
+
sessionJournalDoctorSummarySchema = z4.object({
|
|
1056
|
+
/** `true` when zero noise patterns were detected. */
|
|
1057
|
+
isClean: z4.boolean(),
|
|
1058
|
+
/** Total number of noise findings across all patterns. */
|
|
1059
|
+
findingsCount: z4.number().int().nonnegative(),
|
|
1060
|
+
/** Pattern names that were detected (empty when isClean). */
|
|
1061
|
+
patterns: z4.array(z4.string()),
|
|
1062
|
+
/** Total brain entries scanned. `0` = empty or unavailable. */
|
|
1063
|
+
totalScanned: z4.number().int().nonnegative()
|
|
1064
|
+
});
|
|
1065
|
+
sessionJournalDebriefSummarySchema = z4.object({
|
|
1066
|
+
/** First 200 characters of the session end note (if provided). */
|
|
1067
|
+
noteExcerpt: z4.string().max(200).optional(),
|
|
1068
|
+
/** Number of tasks completed during the session. */
|
|
1069
|
+
tasksCompletedCount: z4.number().int().nonnegative(),
|
|
1070
|
+
/** Up to 5 task IDs (not titles) that were the focus of the session. */
|
|
1071
|
+
tasksFocused: z4.array(z4.string()).max(5).optional()
|
|
1072
|
+
});
|
|
1073
|
+
sessionJournalEntrySchema = z4.object({
|
|
1074
|
+
// Identity
|
|
1075
|
+
/** Schema version for forward-compatibility. Always `'1.0'` in this release. */
|
|
1076
|
+
schemaVersion: z4.literal(SESSION_JOURNAL_SCHEMA_VERSION),
|
|
1077
|
+
/** ISO 8601 timestamp when the entry was written. */
|
|
1078
|
+
timestamp: z4.string(),
|
|
1079
|
+
/** CLEO session ID (e.g. `ses_20260424055456_ede571`). */
|
|
1080
|
+
sessionId: z4.string(),
|
|
1081
|
+
/** Event type that triggered this journal entry. */
|
|
1082
|
+
eventType: z4.enum(["session_start", "session_end", "observation", "decision", "error"]),
|
|
1083
|
+
// Session metadata (set on session_start / session_end)
|
|
1084
|
+
/** Agent identifier (e.g. `cleo-prime`, `claude-code`). */
|
|
1085
|
+
agentIdentifier: z4.string().optional(),
|
|
1086
|
+
/** Provider adapter ID active for this session. */
|
|
1087
|
+
providerId: z4.string().optional(),
|
|
1088
|
+
/** Session scope string (e.g. `'global'` or `'epic:T1263'`). */
|
|
1089
|
+
scope: z4.string().optional(),
|
|
1090
|
+
// Session-end fields
|
|
1091
|
+
/** Duration of the session in seconds (session_end only). */
|
|
1092
|
+
duration: z4.number().int().nonnegative().optional(),
|
|
1093
|
+
/** Task IDs (not titles) completed during the session. */
|
|
1094
|
+
tasksCompleted: z4.array(z4.string()).optional(),
|
|
1095
|
+
// Doctor summary (T1262 absorbed)
|
|
1096
|
+
/** Compact result of `scanBrainNoise` run at session-end. */
|
|
1097
|
+
doctorSummary: sessionJournalDoctorSummarySchema.optional(),
|
|
1098
|
+
// Debrief summary
|
|
1099
|
+
/** Compact excerpt from session debrief data. */
|
|
1100
|
+
debriefSummary: sessionJournalDebriefSummarySchema.optional(),
|
|
1101
|
+
// Optional hash chain
|
|
1102
|
+
/** SHA-256 hex of the previous entry's raw JSON string (for integrity chain). */
|
|
1103
|
+
prevEntryHash: z4.string().optional()
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
});
|
|
1107
|
+
|
|
1048
1108
|
// packages/contracts/src/status-registry.ts
|
|
1049
1109
|
var init_status_registry = __esm({
|
|
1050
1110
|
"packages/contracts/src/status-registry.ts"() {
|
|
@@ -1053,52 +1113,52 @@ var init_status_registry = __esm({
|
|
|
1053
1113
|
});
|
|
1054
1114
|
|
|
1055
1115
|
// packages/contracts/src/task-evidence.ts
|
|
1056
|
-
import { z as
|
|
1116
|
+
import { z as z5 } from "zod";
|
|
1057
1117
|
var fileEvidenceSchema, logEvidenceSchema, screenshotEvidenceSchema, testOutputEvidenceSchema, commandOutputEvidenceSchema, taskEvidenceSchema;
|
|
1058
1118
|
var init_task_evidence = __esm({
|
|
1059
1119
|
"packages/contracts/src/task-evidence.ts"() {
|
|
1060
1120
|
"use strict";
|
|
1061
|
-
fileEvidenceSchema =
|
|
1062
|
-
kind:
|
|
1063
|
-
sha256:
|
|
1064
|
-
timestamp:
|
|
1065
|
-
path:
|
|
1066
|
-
mime:
|
|
1067
|
-
description:
|
|
1121
|
+
fileEvidenceSchema = z5.object({
|
|
1122
|
+
kind: z5.literal("file"),
|
|
1123
|
+
sha256: z5.string().length(64),
|
|
1124
|
+
timestamp: z5.string().datetime(),
|
|
1125
|
+
path: z5.string().min(1),
|
|
1126
|
+
mime: z5.string().optional(),
|
|
1127
|
+
description: z5.string().optional()
|
|
1068
1128
|
});
|
|
1069
|
-
logEvidenceSchema =
|
|
1070
|
-
kind:
|
|
1071
|
-
sha256:
|
|
1072
|
-
timestamp:
|
|
1073
|
-
source:
|
|
1074
|
-
description:
|
|
1129
|
+
logEvidenceSchema = z5.object({
|
|
1130
|
+
kind: z5.literal("log"),
|
|
1131
|
+
sha256: z5.string().length(64),
|
|
1132
|
+
timestamp: z5.string().datetime(),
|
|
1133
|
+
source: z5.string().min(1),
|
|
1134
|
+
description: z5.string().optional()
|
|
1075
1135
|
});
|
|
1076
|
-
screenshotEvidenceSchema =
|
|
1077
|
-
kind:
|
|
1078
|
-
sha256:
|
|
1079
|
-
timestamp:
|
|
1080
|
-
mime:
|
|
1081
|
-
description:
|
|
1136
|
+
screenshotEvidenceSchema = z5.object({
|
|
1137
|
+
kind: z5.literal("screenshot"),
|
|
1138
|
+
sha256: z5.string().length(64),
|
|
1139
|
+
timestamp: z5.string().datetime(),
|
|
1140
|
+
mime: z5.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
|
|
1141
|
+
description: z5.string().optional()
|
|
1082
1142
|
});
|
|
1083
|
-
testOutputEvidenceSchema =
|
|
1084
|
-
kind:
|
|
1085
|
-
sha256:
|
|
1086
|
-
timestamp:
|
|
1087
|
-
passed:
|
|
1088
|
-
failed:
|
|
1089
|
-
skipped:
|
|
1090
|
-
exitCode:
|
|
1091
|
-
description:
|
|
1143
|
+
testOutputEvidenceSchema = z5.object({
|
|
1144
|
+
kind: z5.literal("test-output"),
|
|
1145
|
+
sha256: z5.string().length(64),
|
|
1146
|
+
timestamp: z5.string().datetime(),
|
|
1147
|
+
passed: z5.number().int().nonnegative(),
|
|
1148
|
+
failed: z5.number().int().nonnegative(),
|
|
1149
|
+
skipped: z5.number().int().nonnegative(),
|
|
1150
|
+
exitCode: z5.number().int(),
|
|
1151
|
+
description: z5.string().optional()
|
|
1092
1152
|
});
|
|
1093
|
-
commandOutputEvidenceSchema =
|
|
1094
|
-
kind:
|
|
1095
|
-
sha256:
|
|
1096
|
-
timestamp:
|
|
1097
|
-
cmd:
|
|
1098
|
-
exitCode:
|
|
1099
|
-
description:
|
|
1153
|
+
commandOutputEvidenceSchema = z5.object({
|
|
1154
|
+
kind: z5.literal("command-output"),
|
|
1155
|
+
sha256: z5.string().length(64),
|
|
1156
|
+
timestamp: z5.string().datetime(),
|
|
1157
|
+
cmd: z5.string().min(1),
|
|
1158
|
+
exitCode: z5.number().int(),
|
|
1159
|
+
description: z5.string().optional()
|
|
1100
1160
|
});
|
|
1101
|
-
taskEvidenceSchema =
|
|
1161
|
+
taskEvidenceSchema = z5.discriminatedUnion("kind", [
|
|
1102
1162
|
fileEvidenceSchema,
|
|
1103
1163
|
logEvidenceSchema,
|
|
1104
1164
|
screenshotEvidenceSchema,
|
|
@@ -1123,6 +1183,7 @@ var init_src = __esm({
|
|
|
1123
1183
|
init_params();
|
|
1124
1184
|
init_peer();
|
|
1125
1185
|
init_session2();
|
|
1186
|
+
init_session_journal();
|
|
1126
1187
|
init_status_registry();
|
|
1127
1188
|
init_task_evidence();
|
|
1128
1189
|
}
|
|
@@ -15111,7 +15172,7 @@ function resolveRef(ref, ctx) {
|
|
|
15111
15172
|
function convertBaseSchema(schema, ctx) {
|
|
15112
15173
|
if (schema.not !== void 0) {
|
|
15113
15174
|
if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
|
|
15114
|
-
return
|
|
15175
|
+
return z6.never();
|
|
15115
15176
|
}
|
|
15116
15177
|
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
15117
15178
|
}
|
|
@@ -15133,7 +15194,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
15133
15194
|
return ctx.refs.get(refPath);
|
|
15134
15195
|
}
|
|
15135
15196
|
if (ctx.processing.has(refPath)) {
|
|
15136
|
-
return
|
|
15197
|
+
return z6.lazy(() => {
|
|
15137
15198
|
if (!ctx.refs.has(refPath)) {
|
|
15138
15199
|
throw new Error(`Circular reference not resolved: ${refPath}`);
|
|
15139
15200
|
}
|
|
@@ -15150,25 +15211,25 @@ function convertBaseSchema(schema, ctx) {
|
|
|
15150
15211
|
if (schema.enum !== void 0) {
|
|
15151
15212
|
const enumValues = schema.enum;
|
|
15152
15213
|
if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
|
|
15153
|
-
return
|
|
15214
|
+
return z6.null();
|
|
15154
15215
|
}
|
|
15155
15216
|
if (enumValues.length === 0) {
|
|
15156
|
-
return
|
|
15217
|
+
return z6.never();
|
|
15157
15218
|
}
|
|
15158
15219
|
if (enumValues.length === 1) {
|
|
15159
|
-
return
|
|
15220
|
+
return z6.literal(enumValues[0]);
|
|
15160
15221
|
}
|
|
15161
15222
|
if (enumValues.every((v) => typeof v === "string")) {
|
|
15162
|
-
return
|
|
15223
|
+
return z6.enum(enumValues);
|
|
15163
15224
|
}
|
|
15164
|
-
const literalSchemas = enumValues.map((v) =>
|
|
15225
|
+
const literalSchemas = enumValues.map((v) => z6.literal(v));
|
|
15165
15226
|
if (literalSchemas.length < 2) {
|
|
15166
15227
|
return literalSchemas[0];
|
|
15167
15228
|
}
|
|
15168
|
-
return
|
|
15229
|
+
return z6.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
|
|
15169
15230
|
}
|
|
15170
15231
|
if (schema.const !== void 0) {
|
|
15171
|
-
return
|
|
15232
|
+
return z6.literal(schema.const);
|
|
15172
15233
|
}
|
|
15173
15234
|
const type = schema.type;
|
|
15174
15235
|
if (Array.isArray(type)) {
|
|
@@ -15177,68 +15238,68 @@ function convertBaseSchema(schema, ctx) {
|
|
|
15177
15238
|
return convertBaseSchema(typeSchema, ctx);
|
|
15178
15239
|
});
|
|
15179
15240
|
if (typeSchemas.length === 0) {
|
|
15180
|
-
return
|
|
15241
|
+
return z6.never();
|
|
15181
15242
|
}
|
|
15182
15243
|
if (typeSchemas.length === 1) {
|
|
15183
15244
|
return typeSchemas[0];
|
|
15184
15245
|
}
|
|
15185
|
-
return
|
|
15246
|
+
return z6.union(typeSchemas);
|
|
15186
15247
|
}
|
|
15187
15248
|
if (!type) {
|
|
15188
|
-
return
|
|
15249
|
+
return z6.any();
|
|
15189
15250
|
}
|
|
15190
15251
|
let zodSchema2;
|
|
15191
15252
|
switch (type) {
|
|
15192
15253
|
case "string": {
|
|
15193
|
-
let stringSchema =
|
|
15254
|
+
let stringSchema = z6.string();
|
|
15194
15255
|
if (schema.format) {
|
|
15195
15256
|
const format = schema.format;
|
|
15196
15257
|
if (format === "email") {
|
|
15197
|
-
stringSchema = stringSchema.check(
|
|
15258
|
+
stringSchema = stringSchema.check(z6.email());
|
|
15198
15259
|
} else if (format === "uri" || format === "uri-reference") {
|
|
15199
|
-
stringSchema = stringSchema.check(
|
|
15260
|
+
stringSchema = stringSchema.check(z6.url());
|
|
15200
15261
|
} else if (format === "uuid" || format === "guid") {
|
|
15201
|
-
stringSchema = stringSchema.check(
|
|
15262
|
+
stringSchema = stringSchema.check(z6.uuid());
|
|
15202
15263
|
} else if (format === "date-time") {
|
|
15203
|
-
stringSchema = stringSchema.check(
|
|
15264
|
+
stringSchema = stringSchema.check(z6.iso.datetime());
|
|
15204
15265
|
} else if (format === "date") {
|
|
15205
|
-
stringSchema = stringSchema.check(
|
|
15266
|
+
stringSchema = stringSchema.check(z6.iso.date());
|
|
15206
15267
|
} else if (format === "time") {
|
|
15207
|
-
stringSchema = stringSchema.check(
|
|
15268
|
+
stringSchema = stringSchema.check(z6.iso.time());
|
|
15208
15269
|
} else if (format === "duration") {
|
|
15209
|
-
stringSchema = stringSchema.check(
|
|
15270
|
+
stringSchema = stringSchema.check(z6.iso.duration());
|
|
15210
15271
|
} else if (format === "ipv4") {
|
|
15211
|
-
stringSchema = stringSchema.check(
|
|
15272
|
+
stringSchema = stringSchema.check(z6.ipv4());
|
|
15212
15273
|
} else if (format === "ipv6") {
|
|
15213
|
-
stringSchema = stringSchema.check(
|
|
15274
|
+
stringSchema = stringSchema.check(z6.ipv6());
|
|
15214
15275
|
} else if (format === "mac") {
|
|
15215
|
-
stringSchema = stringSchema.check(
|
|
15276
|
+
stringSchema = stringSchema.check(z6.mac());
|
|
15216
15277
|
} else if (format === "cidr") {
|
|
15217
|
-
stringSchema = stringSchema.check(
|
|
15278
|
+
stringSchema = stringSchema.check(z6.cidrv4());
|
|
15218
15279
|
} else if (format === "cidr-v6") {
|
|
15219
|
-
stringSchema = stringSchema.check(
|
|
15280
|
+
stringSchema = stringSchema.check(z6.cidrv6());
|
|
15220
15281
|
} else if (format === "base64") {
|
|
15221
|
-
stringSchema = stringSchema.check(
|
|
15282
|
+
stringSchema = stringSchema.check(z6.base64());
|
|
15222
15283
|
} else if (format === "base64url") {
|
|
15223
|
-
stringSchema = stringSchema.check(
|
|
15284
|
+
stringSchema = stringSchema.check(z6.base64url());
|
|
15224
15285
|
} else if (format === "e164") {
|
|
15225
|
-
stringSchema = stringSchema.check(
|
|
15286
|
+
stringSchema = stringSchema.check(z6.e164());
|
|
15226
15287
|
} else if (format === "jwt") {
|
|
15227
|
-
stringSchema = stringSchema.check(
|
|
15288
|
+
stringSchema = stringSchema.check(z6.jwt());
|
|
15228
15289
|
} else if (format === "emoji") {
|
|
15229
|
-
stringSchema = stringSchema.check(
|
|
15290
|
+
stringSchema = stringSchema.check(z6.emoji());
|
|
15230
15291
|
} else if (format === "nanoid") {
|
|
15231
|
-
stringSchema = stringSchema.check(
|
|
15292
|
+
stringSchema = stringSchema.check(z6.nanoid());
|
|
15232
15293
|
} else if (format === "cuid") {
|
|
15233
|
-
stringSchema = stringSchema.check(
|
|
15294
|
+
stringSchema = stringSchema.check(z6.cuid());
|
|
15234
15295
|
} else if (format === "cuid2") {
|
|
15235
|
-
stringSchema = stringSchema.check(
|
|
15296
|
+
stringSchema = stringSchema.check(z6.cuid2());
|
|
15236
15297
|
} else if (format === "ulid") {
|
|
15237
|
-
stringSchema = stringSchema.check(
|
|
15298
|
+
stringSchema = stringSchema.check(z6.ulid());
|
|
15238
15299
|
} else if (format === "xid") {
|
|
15239
|
-
stringSchema = stringSchema.check(
|
|
15300
|
+
stringSchema = stringSchema.check(z6.xid());
|
|
15240
15301
|
} else if (format === "ksuid") {
|
|
15241
|
-
stringSchema = stringSchema.check(
|
|
15302
|
+
stringSchema = stringSchema.check(z6.ksuid());
|
|
15242
15303
|
}
|
|
15243
15304
|
}
|
|
15244
15305
|
if (typeof schema.minLength === "number") {
|
|
@@ -15255,7 +15316,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
15255
15316
|
}
|
|
15256
15317
|
case "number":
|
|
15257
15318
|
case "integer": {
|
|
15258
|
-
let numberSchema = type === "integer" ?
|
|
15319
|
+
let numberSchema = type === "integer" ? z6.number().int() : z6.number();
|
|
15259
15320
|
if (typeof schema.minimum === "number") {
|
|
15260
15321
|
numberSchema = numberSchema.min(schema.minimum);
|
|
15261
15322
|
}
|
|
@@ -15279,11 +15340,11 @@ function convertBaseSchema(schema, ctx) {
|
|
|
15279
15340
|
break;
|
|
15280
15341
|
}
|
|
15281
15342
|
case "boolean": {
|
|
15282
|
-
zodSchema2 =
|
|
15343
|
+
zodSchema2 = z6.boolean();
|
|
15283
15344
|
break;
|
|
15284
15345
|
}
|
|
15285
15346
|
case "null": {
|
|
15286
|
-
zodSchema2 =
|
|
15347
|
+
zodSchema2 = z6.null();
|
|
15287
15348
|
break;
|
|
15288
15349
|
}
|
|
15289
15350
|
case "object": {
|
|
@@ -15296,14 +15357,14 @@ function convertBaseSchema(schema, ctx) {
|
|
|
15296
15357
|
}
|
|
15297
15358
|
if (schema.propertyNames) {
|
|
15298
15359
|
const keySchema = convertSchema(schema.propertyNames, ctx);
|
|
15299
|
-
const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) :
|
|
15360
|
+
const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z6.any();
|
|
15300
15361
|
if (Object.keys(shape).length === 0) {
|
|
15301
|
-
zodSchema2 =
|
|
15362
|
+
zodSchema2 = z6.record(keySchema, valueSchema);
|
|
15302
15363
|
break;
|
|
15303
15364
|
}
|
|
15304
|
-
const objectSchema2 =
|
|
15305
|
-
const recordSchema =
|
|
15306
|
-
zodSchema2 =
|
|
15365
|
+
const objectSchema2 = z6.object(shape).passthrough();
|
|
15366
|
+
const recordSchema = z6.looseRecord(keySchema, valueSchema);
|
|
15367
|
+
zodSchema2 = z6.intersection(objectSchema2, recordSchema);
|
|
15307
15368
|
break;
|
|
15308
15369
|
}
|
|
15309
15370
|
if (schema.patternProperties) {
|
|
@@ -15312,28 +15373,28 @@ function convertBaseSchema(schema, ctx) {
|
|
|
15312
15373
|
const looseRecords = [];
|
|
15313
15374
|
for (const pattern of patternKeys) {
|
|
15314
15375
|
const patternValue = convertSchema(patternProps[pattern], ctx);
|
|
15315
|
-
const keySchema =
|
|
15316
|
-
looseRecords.push(
|
|
15376
|
+
const keySchema = z6.string().regex(new RegExp(pattern));
|
|
15377
|
+
looseRecords.push(z6.looseRecord(keySchema, patternValue));
|
|
15317
15378
|
}
|
|
15318
15379
|
const schemasToIntersect = [];
|
|
15319
15380
|
if (Object.keys(shape).length > 0) {
|
|
15320
|
-
schemasToIntersect.push(
|
|
15381
|
+
schemasToIntersect.push(z6.object(shape).passthrough());
|
|
15321
15382
|
}
|
|
15322
15383
|
schemasToIntersect.push(...looseRecords);
|
|
15323
15384
|
if (schemasToIntersect.length === 0) {
|
|
15324
|
-
zodSchema2 =
|
|
15385
|
+
zodSchema2 = z6.object({}).passthrough();
|
|
15325
15386
|
} else if (schemasToIntersect.length === 1) {
|
|
15326
15387
|
zodSchema2 = schemasToIntersect[0];
|
|
15327
15388
|
} else {
|
|
15328
|
-
let result =
|
|
15389
|
+
let result = z6.intersection(schemasToIntersect[0], schemasToIntersect[1]);
|
|
15329
15390
|
for (let i = 2; i < schemasToIntersect.length; i++) {
|
|
15330
|
-
result =
|
|
15391
|
+
result = z6.intersection(result, schemasToIntersect[i]);
|
|
15331
15392
|
}
|
|
15332
15393
|
zodSchema2 = result;
|
|
15333
15394
|
}
|
|
15334
15395
|
break;
|
|
15335
15396
|
}
|
|
15336
|
-
const objectSchema =
|
|
15397
|
+
const objectSchema = z6.object(shape);
|
|
15337
15398
|
if (schema.additionalProperties === false) {
|
|
15338
15399
|
zodSchema2 = objectSchema.strict();
|
|
15339
15400
|
} else if (typeof schema.additionalProperties === "object") {
|
|
@@ -15350,33 +15411,33 @@ function convertBaseSchema(schema, ctx) {
|
|
|
15350
15411
|
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
15351
15412
|
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
|
|
15352
15413
|
if (rest) {
|
|
15353
|
-
zodSchema2 =
|
|
15414
|
+
zodSchema2 = z6.tuple(tupleItems).rest(rest);
|
|
15354
15415
|
} else {
|
|
15355
|
-
zodSchema2 =
|
|
15416
|
+
zodSchema2 = z6.tuple(tupleItems);
|
|
15356
15417
|
}
|
|
15357
15418
|
if (typeof schema.minItems === "number") {
|
|
15358
|
-
zodSchema2 = zodSchema2.check(
|
|
15419
|
+
zodSchema2 = zodSchema2.check(z6.minLength(schema.minItems));
|
|
15359
15420
|
}
|
|
15360
15421
|
if (typeof schema.maxItems === "number") {
|
|
15361
|
-
zodSchema2 = zodSchema2.check(
|
|
15422
|
+
zodSchema2 = zodSchema2.check(z6.maxLength(schema.maxItems));
|
|
15362
15423
|
}
|
|
15363
15424
|
} else if (Array.isArray(items)) {
|
|
15364
15425
|
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
15365
15426
|
const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0;
|
|
15366
15427
|
if (rest) {
|
|
15367
|
-
zodSchema2 =
|
|
15428
|
+
zodSchema2 = z6.tuple(tupleItems).rest(rest);
|
|
15368
15429
|
} else {
|
|
15369
|
-
zodSchema2 =
|
|
15430
|
+
zodSchema2 = z6.tuple(tupleItems);
|
|
15370
15431
|
}
|
|
15371
15432
|
if (typeof schema.minItems === "number") {
|
|
15372
|
-
zodSchema2 = zodSchema2.check(
|
|
15433
|
+
zodSchema2 = zodSchema2.check(z6.minLength(schema.minItems));
|
|
15373
15434
|
}
|
|
15374
15435
|
if (typeof schema.maxItems === "number") {
|
|
15375
|
-
zodSchema2 = zodSchema2.check(
|
|
15436
|
+
zodSchema2 = zodSchema2.check(z6.maxLength(schema.maxItems));
|
|
15376
15437
|
}
|
|
15377
15438
|
} else if (items !== void 0) {
|
|
15378
15439
|
const element = convertSchema(items, ctx);
|
|
15379
|
-
let arraySchema =
|
|
15440
|
+
let arraySchema = z6.array(element);
|
|
15380
15441
|
if (typeof schema.minItems === "number") {
|
|
15381
15442
|
arraySchema = arraySchema.min(schema.minItems);
|
|
15382
15443
|
}
|
|
@@ -15385,7 +15446,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
15385
15446
|
}
|
|
15386
15447
|
zodSchema2 = arraySchema;
|
|
15387
15448
|
} else {
|
|
15388
|
-
zodSchema2 =
|
|
15449
|
+
zodSchema2 = z6.array(z6.any());
|
|
15389
15450
|
}
|
|
15390
15451
|
break;
|
|
15391
15452
|
}
|
|
@@ -15402,37 +15463,37 @@ function convertBaseSchema(schema, ctx) {
|
|
|
15402
15463
|
}
|
|
15403
15464
|
function convertSchema(schema, ctx) {
|
|
15404
15465
|
if (typeof schema === "boolean") {
|
|
15405
|
-
return schema ?
|
|
15466
|
+
return schema ? z6.any() : z6.never();
|
|
15406
15467
|
}
|
|
15407
15468
|
let baseSchema = convertBaseSchema(schema, ctx);
|
|
15408
15469
|
const hasExplicitType = schema.type || schema.enum !== void 0 || schema.const !== void 0;
|
|
15409
15470
|
if (schema.anyOf && Array.isArray(schema.anyOf)) {
|
|
15410
15471
|
const options = schema.anyOf.map((s) => convertSchema(s, ctx));
|
|
15411
|
-
const anyOfUnion =
|
|
15412
|
-
baseSchema = hasExplicitType ?
|
|
15472
|
+
const anyOfUnion = z6.union(options);
|
|
15473
|
+
baseSchema = hasExplicitType ? z6.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
15413
15474
|
}
|
|
15414
15475
|
if (schema.oneOf && Array.isArray(schema.oneOf)) {
|
|
15415
15476
|
const options = schema.oneOf.map((s) => convertSchema(s, ctx));
|
|
15416
|
-
const oneOfUnion =
|
|
15417
|
-
baseSchema = hasExplicitType ?
|
|
15477
|
+
const oneOfUnion = z6.xor(options);
|
|
15478
|
+
baseSchema = hasExplicitType ? z6.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
15418
15479
|
}
|
|
15419
15480
|
if (schema.allOf && Array.isArray(schema.allOf)) {
|
|
15420
15481
|
if (schema.allOf.length === 0) {
|
|
15421
|
-
baseSchema = hasExplicitType ? baseSchema :
|
|
15482
|
+
baseSchema = hasExplicitType ? baseSchema : z6.any();
|
|
15422
15483
|
} else {
|
|
15423
15484
|
let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
|
|
15424
15485
|
const startIdx = hasExplicitType ? 0 : 1;
|
|
15425
15486
|
for (let i = startIdx; i < schema.allOf.length; i++) {
|
|
15426
|
-
result =
|
|
15487
|
+
result = z6.intersection(result, convertSchema(schema.allOf[i], ctx));
|
|
15427
15488
|
}
|
|
15428
15489
|
baseSchema = result;
|
|
15429
15490
|
}
|
|
15430
15491
|
}
|
|
15431
15492
|
if (schema.nullable === true && ctx.version === "openapi-3.0") {
|
|
15432
|
-
baseSchema =
|
|
15493
|
+
baseSchema = z6.nullable(baseSchema);
|
|
15433
15494
|
}
|
|
15434
15495
|
if (schema.readOnly === true) {
|
|
15435
|
-
baseSchema =
|
|
15496
|
+
baseSchema = z6.readonly(baseSchema);
|
|
15436
15497
|
}
|
|
15437
15498
|
const extraMeta = {};
|
|
15438
15499
|
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
@@ -15459,7 +15520,7 @@ function convertSchema(schema, ctx) {
|
|
|
15459
15520
|
}
|
|
15460
15521
|
function fromJSONSchema(schema, params) {
|
|
15461
15522
|
if (typeof schema === "boolean") {
|
|
15462
|
-
return schema ?
|
|
15523
|
+
return schema ? z6.any() : z6.never();
|
|
15463
15524
|
}
|
|
15464
15525
|
const version2 = detectVersion(schema, params?.defaultTarget);
|
|
15465
15526
|
const defs = schema.$defs || schema.definitions || {};
|
|
@@ -15473,14 +15534,14 @@ function fromJSONSchema(schema, params) {
|
|
|
15473
15534
|
};
|
|
15474
15535
|
return convertSchema(schema, ctx);
|
|
15475
15536
|
}
|
|
15476
|
-
var
|
|
15537
|
+
var z6, RECOGNIZED_KEYS;
|
|
15477
15538
|
var init_from_json_schema = __esm({
|
|
15478
15539
|
"node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/from-json-schema.js"() {
|
|
15479
15540
|
init_registries();
|
|
15480
15541
|
init_checks2();
|
|
15481
15542
|
init_iso();
|
|
15482
15543
|
init_schemas2();
|
|
15483
|
-
|
|
15544
|
+
z6 = {
|
|
15484
15545
|
...schemas_exports2,
|
|
15485
15546
|
...checks_exports2,
|
|
15486
15547
|
iso: iso_exports
|