@hasna/switcher 0.1.8 → 0.2.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.
@@ -11,25 +11,29 @@ import { chmod, mkdir } from "fs/promises";
11
11
  import { dirname, resolve } from "path";
12
12
 
13
13
  // src/domain.ts
14
- import { z as z2 } from "zod";
14
+ import { z as z3 } from "zod";
15
15
 
16
- // src/model-policy-schema.ts
16
+ // src/reasoning.ts
17
17
  import { z } from "zod";
18
- var policyModelIdSchema = z.string().min(1).max(300).regex(/^[^\u0000-\u001f\u007f]+$/);
19
- var modelPolicyRoleSchema = z.enum(["subagent", "fast", "planning", "review", "summary", "compaction", "weak", "editor"]);
20
- var boundedModelList = z.array(policyModelIdSchema).max(500);
21
- var aliasSchema = z.string().regex(/^[A-Za-z0-9._/-]{1,120}$/).refine((v) => !["__proto__", "prototype", "constructor"].includes(v));
22
- var boundedModelMap = z.record(aliasSchema, policyModelIdSchema).superRefine((value, ctx) => {
18
+ var reasoningEffortSchema = z.enum(["none", "minimal", "low", "medium", "high", "xhigh", "max", "ultra"]);
19
+
20
+ // src/model-policy-schema.ts
21
+ import { z as z2 } from "zod";
22
+ var policyModelIdSchema = z2.string().min(1).max(300).regex(/^[^\u0000-\u001f\u007f]+$/);
23
+ var modelPolicyRoleSchema = z2.enum(["subagent", "fast", "planning", "review", "summary", "compaction", "weak", "editor"]);
24
+ var boundedModelList = z2.array(policyModelIdSchema).max(500);
25
+ var aliasSchema = z2.string().regex(/^[A-Za-z0-9._/-]{1,120}$/).refine((v) => !["__proto__", "prototype", "constructor"].includes(v));
26
+ var boundedModelMap = z2.record(aliasSchema, policyModelIdSchema).superRefine((value, ctx) => {
23
27
  if (Object.keys(value).length > 200)
24
28
  ctx.addIssue({ code: "custom", message: "Model policy maps may contain at most 200 entries." });
25
29
  });
26
- var fallbacksSchema = z.record(policyModelIdSchema, z.array(policyModelIdSchema).max(20)).superRefine((value, ctx) => {
30
+ var fallbacksSchema = z2.record(policyModelIdSchema, z2.array(policyModelIdSchema).max(20)).superRefine((value, ctx) => {
27
31
  if (Object.keys(value).length > 200)
28
32
  ctx.addIssue({ code: "custom", message: "Model policy fallback maps may contain at most 200 entries." });
29
33
  });
30
- var modelPolicySchema = z.object({
31
- version: z.literal(1).default(1),
32
- roles: z.object({
34
+ var modelPolicySchema = z2.object({
35
+ version: z2.literal(1).default(1),
36
+ roles: z2.object({
33
37
  subagent: policyModelIdSchema.optional(),
34
38
  fast: policyModelIdSchema.optional(),
35
39
  planning: policyModelIdSchema.optional(),
@@ -43,31 +47,32 @@ var modelPolicySchema = z.object({
43
47
  aliases: boundedModelMap.optional(),
44
48
  fallbacks: fallbacksSchema.optional()
45
49
  }).strict();
46
- var routingDecisionSchema = z.enum(["allow", "alias", "reject", "fallback"]);
47
- var routingEventRoleSchema = z.enum(["main", ...modelPolicyRoleSchema.options]);
48
- var routingEventSchema = z.object({
49
- at: z.string().datetime({ offset: true }),
50
- requestId: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/),
50
+ var routingDecisionSchema = z2.enum(["allow", "alias", "reject", "fallback"]);
51
+ var routingEventRoleSchema = z2.enum(["main", ...modelPolicyRoleSchema.options]);
52
+ var routingEventSchema = z2.object({
53
+ at: z2.string().datetime({ offset: true }),
54
+ requestId: z2.string().regex(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/),
51
55
  requestedModel: policyModelIdSchema,
52
56
  resolvedModel: policyModelIdSchema.optional(),
53
57
  reportedModel: policyModelIdSchema.optional(),
58
+ reasoningEffort: reasoningEffortSchema.optional(),
54
59
  decision: routingDecisionSchema,
55
60
  role: routingEventRoleSchema.optional(),
56
- reason: z.string().regex(/^[a-z][a-z0-9_]{0,63}$/).optional(),
57
- upstreamStatus: z.number().int().min(100).max(599).optional()
61
+ reason: z2.string().regex(/^[a-z][a-z0-9_]{0,63}$/).optional(),
62
+ upstreamStatus: z2.number().int().min(100).max(599).optional()
58
63
  }).strict();
59
- var routingEventsSchema = z.array(routingEventSchema).max(1000);
64
+ var routingEventsSchema = z2.array(routingEventSchema).max(1000);
60
65
  function canonicalPolicyJSON(value) {
61
66
  return JSON.stringify(value, (_key, item) => item && typeof item === "object" && !Array.isArray(item) ? Object.fromEntries(Object.entries(item).sort(([a], [b]) => a.localeCompare(b))) : item);
62
67
  }
63
68
 
64
69
  // src/domain.ts
65
- var VERSION = "0.1.8";
66
- var harnessSchema = z2.enum(["claude", "codex", "grok", "opencode", "opencode2", "pi", "omp", "dsh", "cline", "hermes", "prime-agent", "gemini", "aider", "kilo"]);
67
- var protocolSchema = z2.enum(["anthropic-messages", "openai-responses", "openai-chat", "gemini-generate-content"]);
68
- var idSchema = z2.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$/);
69
- var label = z2.string().min(1).max(200);
70
- var envRef = z2.string().regex(/^SWITCHER_PROVIDER_[A-Z0-9_]+$/);
70
+ var VERSION = "0.2.0";
71
+ var harnessSchema = z3.enum(["claude", "codex", "grok", "opencode", "opencode2", "pi", "omp", "dsh", "cline", "hermes", "prime-agent", "gemini", "aider", "kilo"]);
72
+ var protocolSchema = z3.enum(["anthropic-messages", "openai-responses", "openai-chat", "gemini-generate-content"]);
73
+ var idSchema = z3.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$/);
74
+ var label = z3.string().min(1).max(200);
75
+ var envRef = z3.string().regex(/^SWITCHER_PROVIDER_[A-Z0-9_]+$/);
71
76
  function endpoint(value) {
72
77
  let url;
73
78
  try {
@@ -80,85 +85,86 @@ function endpoint(value) {
80
85
  throw new Fault(400, "invalid_url", "URL must use HTTPS, contain no credentials/query/fragment, or use HTTP on loopback.");
81
86
  return url.href.replace(/\/+$/, "");
82
87
  }
83
- var urlSchema = z2.string().max(2000).superRefine((v, ctx) => {
88
+ var urlSchema = z3.string().max(2000).superRefine((v, ctx) => {
84
89
  try {
85
90
  endpoint(v);
86
91
  } catch {
87
92
  ctx.addIssue({ code: "custom", message: "Invalid endpoint URL" });
88
93
  }
89
94
  }).transform(endpoint);
90
- var expiresOnSchema = z2.string().regex(/^\d{4}-\d{2}-\d{2}$/).refine((value) => {
95
+ var expiresOnSchema = z3.string().regex(/^\d{4}-\d{2}-\d{2}$/).refine((value) => {
91
96
  const day = new Date(`${value}T00:00:00.000Z`);
92
97
  return Number.isFinite(day.getTime()) && day.toISOString().slice(0, 10) === value;
93
98
  }, "Use a real calendar date in YYYY-MM-DD format.");
94
- var modelSchema = z2.object({
95
- id: z2.string().min(1).max(300).refine((value) => value === value.trim() && !/[\x00-\x1f\x7f-\x9f]/.test(value), "Use a nonblank model ID without surrounding whitespace or control characters."),
99
+ var modelSchema = z3.object({
100
+ id: z3.string().min(1).max(300).refine((value) => value === value.trim() && !/[\x00-\x1f\x7f-\x9f]/.test(value), "Use a nonblank model ID without surrounding whitespace or control characters."),
96
101
  name: label,
97
- description: z2.string().max(8000).optional(),
98
- available: z2.boolean().optional(),
102
+ description: z3.string().max(8000).optional(),
103
+ available: z3.boolean().optional(),
99
104
  expiresOn: expiresOnSchema.optional(),
100
- contextWindow: z2.number().int().positive().optional(),
101
- maxOutputTokens: z2.number().int().positive().optional(),
102
- inputModalities: z2.array(z2.string().max(50)).max(20).optional(),
103
- outputModalities: z2.array(z2.string().max(50)).max(20).optional(),
104
- supportedParameters: z2.array(z2.string().max(100)).max(100).optional(),
105
- supportedGenerationMethods: z2.array(z2.string().min(1).max(100)).max(100).optional()
105
+ contextWindow: z3.number().int().positive().optional(),
106
+ maxOutputTokens: z3.number().int().positive().optional(),
107
+ inputModalities: z3.array(z3.string().max(50)).max(20).optional(),
108
+ outputModalities: z3.array(z3.string().max(50)).max(20).optional(),
109
+ supportedParameters: z3.array(z3.string().max(100)).max(100).optional(),
110
+ reasoningEfforts: z3.array(reasoningEffortSchema).max(8).optional(),
111
+ supportedGenerationMethods: z3.array(z3.string().min(1).max(100)).max(100).optional()
106
112
  }).strict();
107
- var providerInputSchema = z2.object({
113
+ var providerInputSchema = z3.object({
108
114
  id: idSchema,
109
115
  name: label,
110
116
  baseUrl: urlSchema,
111
117
  protocol: protocolSchema,
112
118
  credentialEnv: envRef.optional(),
113
- authStyle: z2.enum(["bearer", "x-api-key", "api-key"]).default("bearer"),
119
+ authStyle: z3.enum(["bearer", "x-api-key", "api-key"]).default("bearer"),
114
120
  catalogBaseUrl: urlSchema.optional(),
115
- catalogFormat: z2.enum(["openai", "ollama", "mistral", "together", "fireworks", "dashscope", "gemini", "none"]).optional(),
116
- catalogAuthStyle: z2.enum(["bearer", "x-api-key", "api-key", "none"]).optional(),
121
+ catalogFormat: z3.enum(["openai", "ollama", "mistral", "together", "fireworks", "dashscope", "gemini", "none"]).optional(),
122
+ catalogAuthStyle: z3.enum(["bearer", "x-api-key", "api-key", "none"]).optional(),
117
123
  catalogCredentialEnv: envRef.optional(),
118
- catalogAccountId: z2.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/).optional(),
119
- modelsPath: z2.string().regex(/^[a-zA-Z0-9_/-]+$/).max(200).default("models"),
120
- manualModels: z2.array(modelSchema).max(1e4).default([]),
121
- additionalModels: z2.array(modelSchema).max(1e4).optional()
124
+ catalogAccountId: z3.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/).optional(),
125
+ modelsPath: z3.string().regex(/^[a-zA-Z0-9_/-]+$/).max(200).default("models"),
126
+ manualModels: z3.array(modelSchema).max(1e4).default([]),
127
+ additionalModels: z3.array(modelSchema).max(1e4).optional()
122
128
  }).strict().refine((p) => !p.modelsPath.split("/").includes("..") && !p.modelsPath.startsWith("/"), "modelsPath must be relative");
123
- var providerPresetSchema = z2.object({
129
+ var providerPresetSchema = z3.object({
124
130
  id: idSchema,
125
131
  name: label,
126
132
  credentialEnv: envRef.optional(),
127
- credentialAliases: z2.array(z2.string().regex(/^[A-Z][A-Z0-9_]+$/)),
128
- protocols: z2.array(z2.object({
133
+ credentialAliases: z3.array(z3.string().regex(/^[A-Z][A-Z0-9_]+$/)),
134
+ protocols: z3.array(z3.object({
129
135
  protocol: protocolSchema,
130
136
  baseUrl: urlSchema.optional(),
131
- authStyle: z2.enum(["bearer", "x-api-key", "api-key"]),
137
+ authStyle: z3.enum(["bearer", "x-api-key", "api-key"]),
132
138
  catalogBaseUrl: urlSchema.optional(),
133
- catalogFormat: z2.enum(["openai", "ollama", "mistral", "together", "fireworks", "dashscope", "gemini", "none"]),
134
- catalogAuthStyle: z2.enum(["bearer", "x-api-key", "api-key", "none"]).optional(),
135
- modelsPath: z2.string(),
136
- notes: z2.array(z2.string())
139
+ catalogFormat: z3.enum(["openai", "ollama", "mistral", "together", "fireworks", "dashscope", "gemini", "none"]),
140
+ catalogAuthStyle: z3.enum(["bearer", "x-api-key", "api-key", "none"]).optional(),
141
+ modelsPath: z3.string(),
142
+ notes: z3.array(z3.string())
137
143
  }).strict()).min(1),
138
- sources: z2.array(z2.string().url()),
139
- verification: z2.literal("documented")
144
+ sources: z3.array(z3.string().url()),
145
+ verification: z3.literal("documented")
140
146
  }).strict();
141
- var profileInputSchema = z2.object({
147
+ var profileInputSchema = z3.object({
142
148
  id: idSchema,
143
149
  name: label,
144
150
  providerId: idSchema,
145
151
  harness: harnessSchema,
146
- model: z2.string().min(1).max(300),
152
+ model: z3.string().min(1).max(300),
147
153
  modelPolicy: modelPolicySchema.optional()
148
154
  }).strict();
149
- var runInputSchema = z2.object({
150
- modelPolicyVersion: z2.literal(1),
155
+ var runInputSchema = z3.object({
156
+ modelPolicyVersion: z3.literal(1),
151
157
  profileId: idSchema,
152
158
  harness: harnessSchema,
153
- model: z2.string().min(1).max(300),
159
+ model: z3.string().min(1).max(300),
154
160
  modelPolicy: modelPolicySchema.optional(),
155
- planToken: z2.string().regex(/^[a-f0-9]{64}$/)
161
+ planToken: z3.string().regex(/^[a-f0-9]{64}$/)
156
162
  }).strict();
157
- var runUpdateSchema = z2.object({
158
- status: z2.enum(["exited", "failed", "interrupted"]),
159
- exitCode: z2.number().int().min(0).max(255),
163
+ var runUpdateSchema = z3.object({
164
+ status: z3.enum(["exited", "failed", "interrupted"]),
165
+ exitCode: z3.number().int().min(0).max(255),
160
166
  routingEvents: routingEventsSchema.optional(),
161
- routingEventsDropped: z2.number().int().min(0).max(1e6).optional()
167
+ routingEventsDropped: z3.number().int().min(0).max(1e6).optional()
162
168
  }).strict();
163
169
 
164
170
  class Fault extends Error {
@@ -363,7 +369,7 @@ class Store {
363
369
 
364
370
  // src/service.ts
365
371
  import { createHash as createHash2, timingSafeEqual } from "crypto";
366
- import { z as z3 } from "zod";
372
+ import { z as z4 } from "zod";
367
373
 
368
374
  // src/http.ts
369
375
  var MAX_BYTES = 16 * 1024 * 1024;
@@ -831,7 +837,7 @@ var openapi_default = {
831
837
  openapi: "3.0.3",
832
838
  info: {
833
839
  title: "Switcher API",
834
- version: "0.1.8",
840
+ version: "0.2.0",
835
841
  description: "Authenticated provider/profile/catalog control plane. Launches run locally; the API never returns provider credentials."
836
842
  },
837
843
  security: [
@@ -2270,6 +2276,23 @@ var openapi_default = {
2270
2276
  },
2271
2277
  maxItems: 100
2272
2278
  },
2279
+ reasoningEfforts: {
2280
+ type: "array",
2281
+ items: {
2282
+ type: "string",
2283
+ enum: [
2284
+ "none",
2285
+ "minimal",
2286
+ "low",
2287
+ "medium",
2288
+ "high",
2289
+ "xhigh",
2290
+ "max",
2291
+ "ultra"
2292
+ ]
2293
+ },
2294
+ maxItems: 8
2295
+ },
2273
2296
  supportedGenerationMethods: {
2274
2297
  type: "array",
2275
2298
  items: {
@@ -2349,6 +2372,23 @@ var openapi_default = {
2349
2372
  },
2350
2373
  maxItems: 100
2351
2374
  },
2375
+ reasoningEfforts: {
2376
+ type: "array",
2377
+ items: {
2378
+ type: "string",
2379
+ enum: [
2380
+ "none",
2381
+ "minimal",
2382
+ "low",
2383
+ "medium",
2384
+ "high",
2385
+ "xhigh",
2386
+ "max",
2387
+ "ultra"
2388
+ ]
2389
+ },
2390
+ maxItems: 8
2391
+ },
2352
2392
  supportedGenerationMethods: {
2353
2393
  type: "array",
2354
2394
  items: {
@@ -2514,6 +2554,23 @@ var openapi_default = {
2514
2554
  },
2515
2555
  maxItems: 100
2516
2556
  },
2557
+ reasoningEfforts: {
2558
+ type: "array",
2559
+ items: {
2560
+ type: "string",
2561
+ enum: [
2562
+ "none",
2563
+ "minimal",
2564
+ "low",
2565
+ "medium",
2566
+ "high",
2567
+ "xhigh",
2568
+ "max",
2569
+ "ultra"
2570
+ ]
2571
+ },
2572
+ maxItems: 8
2573
+ },
2517
2574
  supportedGenerationMethods: {
2518
2575
  type: "array",
2519
2576
  items: {
@@ -2593,6 +2650,23 @@ var openapi_default = {
2593
2650
  },
2594
2651
  maxItems: 100
2595
2652
  },
2653
+ reasoningEfforts: {
2654
+ type: "array",
2655
+ items: {
2656
+ type: "string",
2657
+ enum: [
2658
+ "none",
2659
+ "minimal",
2660
+ "low",
2661
+ "medium",
2662
+ "high",
2663
+ "xhigh",
2664
+ "max",
2665
+ "ultra"
2666
+ ]
2667
+ },
2668
+ maxItems: 8
2669
+ },
2596
2670
  supportedGenerationMethods: {
2597
2671
  type: "array",
2598
2672
  items: {
@@ -2996,6 +3070,23 @@ var openapi_default = {
2996
3070
  },
2997
3071
  maxItems: 100
2998
3072
  },
3073
+ reasoningEfforts: {
3074
+ type: "array",
3075
+ items: {
3076
+ type: "string",
3077
+ enum: [
3078
+ "none",
3079
+ "minimal",
3080
+ "low",
3081
+ "medium",
3082
+ "high",
3083
+ "xhigh",
3084
+ "max",
3085
+ "ultra"
3086
+ ]
3087
+ },
3088
+ maxItems: 8
3089
+ },
2999
3090
  supportedGenerationMethods: {
3000
3091
  type: "array",
3001
3092
  items: {
@@ -3140,6 +3231,19 @@ var openapi_default = {
3140
3231
  maxLength: 300,
3141
3232
  pattern: "^[^\\u0000-\\u001f\\u007f]+$"
3142
3233
  },
3234
+ reasoningEffort: {
3235
+ type: "string",
3236
+ enum: [
3237
+ "none",
3238
+ "minimal",
3239
+ "low",
3240
+ "medium",
3241
+ "high",
3242
+ "xhigh",
3243
+ "max",
3244
+ "ultra"
3245
+ ]
3246
+ },
3143
3247
  decision: {
3144
3248
  type: "string",
3145
3249
  enum: [
@@ -3244,6 +3348,23 @@ var openapi_default = {
3244
3348
  },
3245
3349
  maxItems: 100
3246
3350
  },
3351
+ reasoningEfforts: {
3352
+ type: "array",
3353
+ items: {
3354
+ type: "string",
3355
+ enum: [
3356
+ "none",
3357
+ "minimal",
3358
+ "low",
3359
+ "medium",
3360
+ "high",
3361
+ "xhigh",
3362
+ "max",
3363
+ "ultra"
3364
+ ]
3365
+ },
3366
+ maxItems: 8
3367
+ },
3247
3368
  supportedGenerationMethods: {
3248
3369
  type: "array",
3249
3370
  items: {
@@ -3362,6 +3483,23 @@ var openapi_default = {
3362
3483
  },
3363
3484
  maxItems: 100
3364
3485
  },
3486
+ reasoningEfforts: {
3487
+ type: "array",
3488
+ items: {
3489
+ type: "string",
3490
+ enum: [
3491
+ "none",
3492
+ "minimal",
3493
+ "low",
3494
+ "medium",
3495
+ "high",
3496
+ "xhigh",
3497
+ "max",
3498
+ "ultra"
3499
+ ]
3500
+ },
3501
+ maxItems: 8
3502
+ },
3365
3503
  supportedGenerationMethods: {
3366
3504
  type: "array",
3367
3505
  items: {
@@ -3538,6 +3676,23 @@ var openapi_default = {
3538
3676
  },
3539
3677
  maxItems: 100
3540
3678
  },
3679
+ reasoningEfforts: {
3680
+ type: "array",
3681
+ items: {
3682
+ type: "string",
3683
+ enum: [
3684
+ "none",
3685
+ "minimal",
3686
+ "low",
3687
+ "medium",
3688
+ "high",
3689
+ "xhigh",
3690
+ "max",
3691
+ "ultra"
3692
+ ]
3693
+ },
3694
+ maxItems: 8
3695
+ },
3541
3696
  supportedGenerationMethods: {
3542
3697
  type: "array",
3543
3698
  items: {
@@ -3617,6 +3772,23 @@ var openapi_default = {
3617
3772
  },
3618
3773
  maxItems: 100
3619
3774
  },
3775
+ reasoningEfforts: {
3776
+ type: "array",
3777
+ items: {
3778
+ type: "string",
3779
+ enum: [
3780
+ "none",
3781
+ "minimal",
3782
+ "low",
3783
+ "medium",
3784
+ "high",
3785
+ "xhigh",
3786
+ "max",
3787
+ "ultra"
3788
+ ]
3789
+ },
3790
+ maxItems: 8
3791
+ },
3620
3792
  supportedGenerationMethods: {
3621
3793
  type: "array",
3622
3794
  items: {
@@ -3876,6 +4048,23 @@ var openapi_default = {
3876
4048
  },
3877
4049
  maxItems: 100
3878
4050
  },
4051
+ reasoningEfforts: {
4052
+ type: "array",
4053
+ items: {
4054
+ type: "string",
4055
+ enum: [
4056
+ "none",
4057
+ "minimal",
4058
+ "low",
4059
+ "medium",
4060
+ "high",
4061
+ "xhigh",
4062
+ "max",
4063
+ "ultra"
4064
+ ]
4065
+ },
4066
+ maxItems: 8
4067
+ },
3879
4068
  supportedGenerationMethods: {
3880
4069
  type: "array",
3881
4070
  items: {
@@ -4127,6 +4316,19 @@ var openapi_default = {
4127
4316
  maxLength: 300,
4128
4317
  pattern: "^[^\\u0000-\\u001f\\u007f]+$"
4129
4318
  },
4319
+ reasoningEffort: {
4320
+ type: "string",
4321
+ enum: [
4322
+ "none",
4323
+ "minimal",
4324
+ "low",
4325
+ "medium",
4326
+ "high",
4327
+ "xhigh",
4328
+ "max",
4329
+ "ultra"
4330
+ ]
4331
+ },
4130
4332
  decision: {
4131
4333
  type: "string",
4132
4334
  enum: [
@@ -4397,6 +4599,19 @@ var openapi_default = {
4397
4599
  maxLength: 300,
4398
4600
  pattern: "^[^\\u0000-\\u001f\\u007f]+$"
4399
4601
  },
4602
+ reasoningEffort: {
4603
+ type: "string",
4604
+ enum: [
4605
+ "none",
4606
+ "minimal",
4607
+ "low",
4608
+ "medium",
4609
+ "high",
4610
+ "xhigh",
4611
+ "max",
4612
+ "ultra"
4613
+ ]
4614
+ },
4400
4615
  decision: {
4401
4616
  type: "string",
4402
4617
  enum: [
@@ -4605,10 +4820,10 @@ function createHandler(store, apiKey, providerEnv = process.env, resolveCredenti
4605
4820
  const id2 = parts[2];
4606
4821
  if (id2)
4607
4822
  parse(idSchema, id2);
4608
- const page = () => parse(z3.object({
4609
- limit: z3.coerce.number().int().min(1).max(1000).default(100),
4610
- offset: z3.coerce.number().int().min(0).max(1e6).default(0),
4611
- search: z3.string().max(200).default("")
4823
+ const page = () => parse(z4.object({
4824
+ limit: z4.coerce.number().int().min(1).max(1000).default(100),
4825
+ offset: z4.coerce.number().int().min(0).max(1e6).default(0),
4826
+ search: z4.string().max(200).default("")
4612
4827
  }).strict(), Object.fromEntries(url.searchParams));
4613
4828
  if (request.method === "GET") {
4614
4829
  if (resource === "provider-presets" && parts.length <= 3)
@@ -4652,7 +4867,7 @@ function createHandler(store, apiKey, providerEnv = process.env, resolveCredenti
4652
4867
  return json(replay.value, request.method === "POST" && ["providers", "profiles", "runs"].includes(resource) && !id2 ? 201 : 200);
4653
4868
  let refreshed;
4654
4869
  if (resource === "providers" && id2 && parts[3] === "refresh" && parts.length === 4 && request.method === "POST") {
4655
- parse(z3.object({}).strict(), body);
4870
+ parse(z4.object({}).strict(), body);
4656
4871
  const provider = await store.get("providers", id2);
4657
4872
  refreshed = { provider, catalog: await discover(provider, providerEnv, resolveCredential) };
4658
4873
  }
@@ -4692,7 +4907,7 @@ function createHandler(store, apiKey, providerEnv = process.env, resolveCredenti
4692
4907
  return store.put("catalogs", { id: id2, ...catalog }, old?.version, db);
4693
4908
  }
4694
4909
  if (resource === "launch-plans" && !id2 && request.method === "POST") {
4695
- const { profileId } = parse(z3.object({ profileId: idSchema }).strict(), body);
4910
+ const { profileId } = parse(z4.object({ profileId: idSchema }).strict(), body);
4696
4911
  const profile = await store.get("profiles", profileId, db);
4697
4912
  const provider = await store.get("providers", profile.providerId, db);
4698
4913
  validateHarnessProvider(profile.harness, provider);