@neurouter/shared 0.0.0-stage → 0.1.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.
Files changed (161) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +10 -0
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/api/audit.d.ts +776 -0
  5. package/dist/api/audit.d.ts.map +1 -0
  6. package/dist/api/audit.js +106 -0
  7. package/dist/api/audit.js.map +1 -0
  8. package/dist/api/auth.d.ts +345 -0
  9. package/dist/api/auth.d.ts.map +1 -0
  10. package/dist/api/auth.js +94 -0
  11. package/dist/api/auth.js.map +1 -0
  12. package/dist/api/common.d.ts +303 -0
  13. package/dist/api/common.d.ts.map +1 -0
  14. package/dist/api/common.js +153 -0
  15. package/dist/api/common.js.map +1 -0
  16. package/dist/api/endpoint.d.ts +55 -0
  17. package/dist/api/endpoint.d.ts.map +1 -0
  18. package/dist/api/endpoint.js +41 -0
  19. package/dist/api/endpoint.js.map +1 -0
  20. package/dist/api/environments.d.ts +2420 -0
  21. package/dist/api/environments.d.ts.map +1 -0
  22. package/dist/api/environments.js +218 -0
  23. package/dist/api/environments.js.map +1 -0
  24. package/dist/api/evals.d.ts +3582 -0
  25. package/dist/api/evals.d.ts.map +1 -0
  26. package/dist/api/evals.js +296 -0
  27. package/dist/api/evals.js.map +1 -0
  28. package/dist/api/inbox.d.ts +1117 -0
  29. package/dist/api/inbox.d.ts.map +1 -0
  30. package/dist/api/inbox.js +115 -0
  31. package/dist/api/inbox.js.map +1 -0
  32. package/dist/api/index.d.ts +19 -0
  33. package/dist/api/index.d.ts.map +1 -0
  34. package/dist/api/index.js +19 -0
  35. package/dist/api/index.js.map +1 -0
  36. package/dist/api/keys.d.ts +724 -0
  37. package/dist/api/keys.d.ts.map +1 -0
  38. package/dist/api/keys.js +111 -0
  39. package/dist/api/keys.js.map +1 -0
  40. package/dist/api/metrics.d.ts +506 -0
  41. package/dist/api/metrics.d.ts.map +1 -0
  42. package/dist/api/metrics.js +66 -0
  43. package/dist/api/metrics.js.map +1 -0
  44. package/dist/api/overlays.d.ts +966 -0
  45. package/dist/api/overlays.d.ts.map +1 -0
  46. package/dist/api/overlays.js +111 -0
  47. package/dist/api/overlays.js.map +1 -0
  48. package/dist/api/public.d.ts +99 -0
  49. package/dist/api/public.d.ts.map +1 -0
  50. package/dist/api/public.js +29 -0
  51. package/dist/api/public.js.map +1 -0
  52. package/dist/api/readiness.d.ts +129 -0
  53. package/dist/api/readiness.d.ts.map +1 -0
  54. package/dist/api/readiness.js +40 -0
  55. package/dist/api/readiness.js.map +1 -0
  56. package/dist/api/routes.d.ts +10215 -0
  57. package/dist/api/routes.d.ts.map +1 -0
  58. package/dist/api/routes.js +132 -0
  59. package/dist/api/routes.js.map +1 -0
  60. package/dist/api/servers.d.ts +2632 -0
  61. package/dist/api/servers.d.ts.map +1 -0
  62. package/dist/api/servers.js +145 -0
  63. package/dist/api/servers.js.map +1 -0
  64. package/dist/api/settings.d.ts +1329 -0
  65. package/dist/api/settings.d.ts.map +1 -0
  66. package/dist/api/settings.js +220 -0
  67. package/dist/api/settings.js.map +1 -0
  68. package/dist/api/specs.d.ts +1393 -0
  69. package/dist/api/specs.d.ts.map +1 -0
  70. package/dist/api/specs.js +170 -0
  71. package/dist/api/specs.js.map +1 -0
  72. package/dist/api/tasks.d.ts +1006 -0
  73. package/dist/api/tasks.d.ts.map +1 -0
  74. package/dist/api/tasks.js +173 -0
  75. package/dist/api/tasks.js.map +1 -0
  76. package/dist/api/tools.d.ts +555 -0
  77. package/dist/api/tools.d.ts.map +1 -0
  78. package/dist/api/tools.js +109 -0
  79. package/dist/api/tools.js.map +1 -0
  80. package/dist/config/index.d.ts +6 -0
  81. package/dist/config/index.d.ts.map +1 -0
  82. package/dist/config/index.js +6 -0
  83. package/dist/config/index.js.map +1 -0
  84. package/dist/config/limits.d.ts +79 -0
  85. package/dist/config/limits.d.ts.map +1 -0
  86. package/dist/config/limits.js +53 -0
  87. package/dist/config/limits.js.map +1 -0
  88. package/dist/config/llm-models.d.ts +34 -0
  89. package/dist/config/llm-models.d.ts.map +1 -0
  90. package/dist/config/llm-models.js +48 -0
  91. package/dist/config/llm-models.js.map +1 -0
  92. package/dist/config/neurouter-yaml.d.ts +690 -0
  93. package/dist/config/neurouter-yaml.d.ts.map +1 -0
  94. package/dist/config/neurouter-yaml.js +203 -0
  95. package/dist/config/neurouter-yaml.js.map +1 -0
  96. package/dist/config/policy.d.ts +72 -0
  97. package/dist/config/policy.d.ts.map +1 -0
  98. package/dist/config/policy.js +39 -0
  99. package/dist/config/policy.js.map +1 -0
  100. package/dist/config/secret-ref.d.ts +21 -0
  101. package/dist/config/secret-ref.d.ts.map +1 -0
  102. package/dist/config/secret-ref.js +19 -0
  103. package/dist/config/secret-ref.js.map +1 -0
  104. package/dist/domain/assertions.d.ts +63 -0
  105. package/dist/domain/assertions.d.ts.map +1 -0
  106. package/dist/domain/assertions.js +35 -0
  107. package/dist/domain/assertions.js.map +1 -0
  108. package/dist/domain/capabilities.d.ts +29 -0
  109. package/dist/domain/capabilities.d.ts.map +1 -0
  110. package/dist/domain/capabilities.js +31 -0
  111. package/dist/domain/capabilities.js.map +1 -0
  112. package/dist/domain/enums.d.ts +416 -0
  113. package/dist/domain/enums.d.ts.map +1 -0
  114. package/dist/domain/enums.js +104 -0
  115. package/dist/domain/enums.js.map +1 -0
  116. package/dist/domain/error-codes.d.ts +15 -0
  117. package/dist/domain/error-codes.d.ts.map +1 -0
  118. package/dist/domain/error-codes.js +70 -0
  119. package/dist/domain/error-codes.js.map +1 -0
  120. package/dist/domain/index.d.ts +7 -0
  121. package/dist/domain/index.d.ts.map +1 -0
  122. package/dist/domain/index.js +7 -0
  123. package/dist/domain/index.js.map +1 -0
  124. package/dist/domain/roles.d.ts +8 -0
  125. package/dist/domain/roles.d.ts.map +1 -0
  126. package/dist/domain/roles.js +4 -0
  127. package/dist/domain/roles.js.map +1 -0
  128. package/dist/domain/tool-model.d.ts +257 -0
  129. package/dist/domain/tool-model.d.ts.map +1 -0
  130. package/dist/domain/tool-model.js +37 -0
  131. package/dist/domain/tool-model.js.map +1 -0
  132. package/dist/index.d.ts +7 -0
  133. package/dist/index.d.ts.map +1 -0
  134. package/dist/index.js +7 -0
  135. package/dist/index.js.map +1 -0
  136. package/dist/mcp/index.d.ts +3 -0
  137. package/dist/mcp/index.d.ts.map +1 -0
  138. package/dist/mcp/index.js +3 -0
  139. package/dist/mcp/index.js.map +1 -0
  140. package/dist/mcp/meta-keys.d.ts +26 -0
  141. package/dist/mcp/meta-keys.d.ts.map +1 -0
  142. package/dist/mcp/meta-keys.js +29 -0
  143. package/dist/mcp/meta-keys.js.map +1 -0
  144. package/dist/mcp/tool-names.d.ts +20 -0
  145. package/dist/mcp/tool-names.d.ts.map +1 -0
  146. package/dist/mcp/tool-names.js +30 -0
  147. package/dist/mcp/tool-names.js.map +1 -0
  148. package/dist/overlay/index.d.ts +2 -0
  149. package/dist/overlay/index.d.ts.map +1 -0
  150. package/dist/overlay/index.js +2 -0
  151. package/dist/overlay/index.js.map +1 -0
  152. package/dist/overlay/schema.d.ts +243 -0
  153. package/dist/overlay/schema.d.ts.map +1 -0
  154. package/dist/overlay/schema.js +103 -0
  155. package/dist/overlay/schema.js.map +1 -0
  156. package/dist/version.d.ts +9 -0
  157. package/dist/version.d.ts.map +1 -0
  158. package/dist/version.js +8 -0
  159. package/dist/version.js.map +1 -0
  160. package/package.json +72 -4
  161. package/README.md +0 -3
@@ -0,0 +1,303 @@
1
+ import * as z from 'zod';
2
+ /** ISO-8601 UTC timestamp in responses (e.g. `2026-11-24T10:00:00.000Z`). */
3
+ export declare const IsoDateTime: z.ZodISODateTime;
4
+ export type IsoDateTime = z.infer<typeof IsoDateTime>;
5
+ /** ISO-8601 timestamp accepted in requests/query strings (offsets allowed, server normalizes to UTC). */
6
+ export declare const IsoDateTimeInput: z.ZodISODateTime;
7
+ /** Opaque id (UUIDv7 string). Kept loose so fixtures and legacy ids still parse; the server generates UUIDv7. */
8
+ export declare const Id: z.ZodString;
9
+ export type Id = z.infer<typeof Id>;
10
+ export declare const Ref: z.ZodObject<{
11
+ id: z.ZodString;
12
+ name: z.ZodString;
13
+ }, z.core.$strip>;
14
+ /** Reference with a slug (servers, environments). */
15
+ export declare const SlugRef: z.ZodObject<{
16
+ id: z.ZodString;
17
+ slug: z.ZodString;
18
+ name: z.ZodString;
19
+ }, z.core.$strip>;
20
+ export type SlugRef = z.infer<typeof SlugRef>;
21
+ export type Ref = z.infer<typeof Ref>;
22
+ export declare const ServerRef: z.ZodObject<{
23
+ id: z.ZodString;
24
+ slug: z.ZodString;
25
+ name: z.ZodString;
26
+ }, z.core.$strip>;
27
+ export type ServerRef = z.infer<typeof ServerRef>;
28
+ export declare const UserRefWithEmail: z.ZodObject<{
29
+ id: z.ZodString;
30
+ name: z.ZodString;
31
+ email: z.ZodString;
32
+ }, z.core.$strip>;
33
+ export type UserRefWithEmail = z.infer<typeof UserRefWithEmail>;
34
+ export declare const IdParams: z.ZodObject<{
35
+ id: z.ZodString;
36
+ }, z.core.$strip>;
37
+ export declare const Slug: z.ZodString;
38
+ export declare const EnvSlug: z.ZodString;
39
+ export type IdParams = z.infer<typeof IdParams>;
40
+ export declare const SortOrder: z.ZodEnum<{
41
+ asc: "asc";
42
+ desc: "desc";
43
+ }>;
44
+ export type SortOrder = z.infer<typeof SortOrder>;
45
+ export declare const JsonObject: z.ZodRecord<z.ZodString, z.ZodUnknown>;
46
+ export type JsonObject = z.infer<typeof JsonObject>;
47
+ /** `{ "$redacted": "<rule-name>" }` marker the audit redactor leaves in place of a value. */
48
+ export declare const RedactedMarker: z.ZodObject<{
49
+ $redacted: z.ZodString;
50
+ }, z.core.$strip>;
51
+ export type RedactedMarker = z.infer<typeof RedactedMarker>;
52
+ export declare function isRedactedMarker(v: unknown): v is RedactedMarker;
53
+ /** A repeated query key (`a=1&a=2`) arrives as string | string[]; normalize to an array. */
54
+ export declare function queryArray<T extends z.ZodType>(item: T): z.ZodPreprocess<z.ZodOptional<z.ZodArray<T>>, unknown>;
55
+ /** `true` / `false` (also `1` / `0`) in a query string. */
56
+ export declare const QueryBool: z.ZodPreprocess<z.ZodBoolean, unknown>;
57
+ /** Drops empty strings (the API ignores empty query values). */
58
+ export declare function queryOptional<T extends z.ZodType>(schema: T): z.ZodPreprocess<z.ZodOptional<T>, unknown>;
59
+ export declare const PAGE_LIMIT_DEFAULT = 50;
60
+ export declare const PAGE_LIMIT_MAX = 200;
61
+ export declare const CursorQuery: z.ZodObject<{
62
+ cursor: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
63
+ limit: z.ZodPreprocess<z.ZodOptional<z.ZodCoercedNumber<unknown>>, unknown>;
64
+ }, z.core.$strip>;
65
+ export type CursorQuery = z.infer<typeof CursorQuery>;
66
+ /** `Page<T> = { items, nextCursor, totalEstimate? }` (backend §14.1). */
67
+ export declare function Page<T extends z.ZodType>(item: T): z.ZodObject<{
68
+ items: z.ZodArray<T>;
69
+ nextCursor: z.ZodNullable<z.ZodString>;
70
+ totalEstimate: z.ZodOptional<z.ZodNumber>;
71
+ }, z.core.$strip>;
72
+ export type Page<T> = {
73
+ items: T[];
74
+ nextCursor: string | null;
75
+ totalEstimate?: number;
76
+ };
77
+ export declare function Items<T extends z.ZodType>(item: T): z.ZodObject<{
78
+ items: z.ZodArray<T>;
79
+ }, z.core.$strip>;
80
+ /** Sort param from a per-endpoint allowlist. */
81
+ export declare function sortParam<const F extends readonly [string, ...string[]]>(fields: F): z.ZodPreprocess<z.ZodOptional<z.ZodEnum<{ [k_1 in F[number]]: k_1; } extends infer T ? { [k in keyof T]: T[k]; } : never>>, unknown>;
82
+ export declare const PROBLEM_CONTENT_TYPE = "application/problem+json";
83
+ export declare const PROBLEM_TYPE_BASE = "https://neurouter.dev/problems/";
84
+ /** Error codes, statuses and titles (backend §14.1; Hub codes + Neurouter codes). `type` URIs are stable per code. */
85
+ export declare const PROBLEM_CODES: {
86
+ readonly bad_request: {
87
+ readonly status: 400;
88
+ readonly title: "Bad request";
89
+ };
90
+ readonly unauthenticated: {
91
+ readonly status: 401;
92
+ readonly title: "Authentication required";
93
+ };
94
+ readonly forbidden: {
95
+ readonly status: 403;
96
+ readonly title: "Forbidden";
97
+ };
98
+ readonly not_found: {
99
+ readonly status: 404;
100
+ readonly title: "Not found";
101
+ };
102
+ readonly method_not_allowed: {
103
+ readonly status: 405;
104
+ readonly title: "Method not allowed";
105
+ };
106
+ readonly conflict: {
107
+ readonly status: 409;
108
+ readonly title: "Conflict";
109
+ };
110
+ readonly gone: {
111
+ readonly status: 410;
112
+ readonly title: "Gone";
113
+ };
114
+ readonly precondition_failed: {
115
+ readonly status: 412;
116
+ readonly title: "Precondition failed";
117
+ };
118
+ readonly payload_too_large: {
119
+ readonly status: 413;
120
+ readonly title: "Payload too large";
121
+ };
122
+ readonly unsupported_media_type: {
123
+ readonly status: 415;
124
+ readonly title: "Unsupported media type";
125
+ };
126
+ readonly validation_failed: {
127
+ readonly status: 422;
128
+ readonly title: "Validation failed";
129
+ };
130
+ readonly rate_limited: {
131
+ readonly status: 429;
132
+ readonly title: "Too many requests";
133
+ };
134
+ readonly internal: {
135
+ readonly status: 500;
136
+ readonly title: "Internal server error";
137
+ };
138
+ readonly upstream_unavailable: {
139
+ readonly status: 502;
140
+ readonly title: "Upstream unavailable";
141
+ };
142
+ readonly service_unavailable: {
143
+ readonly status: 503;
144
+ readonly title: "Service unavailable";
145
+ };
146
+ readonly config_managed: {
147
+ readonly status: 409;
148
+ readonly title: "Managed by neurouter.yaml";
149
+ };
150
+ readonly spec_invalid: {
151
+ readonly status: 422;
152
+ readonly title: "Invalid spec";
153
+ };
154
+ readonly spec_unsupported: {
155
+ readonly status: 422;
156
+ readonly title: "Unsupported spec";
157
+ };
158
+ readonly spec_fetch_failed: {
159
+ readonly status: 502;
160
+ readonly title: "Could not fetch the spec";
161
+ };
162
+ readonly overlay_invalid: {
163
+ readonly status: 422;
164
+ readonly title: "Invalid overlay";
165
+ };
166
+ readonly build_failed: {
167
+ readonly status: 422;
168
+ readonly title: "Build failed";
169
+ };
170
+ readonly draft_conflict: {
171
+ readonly status: 409;
172
+ readonly title: "Draft changed";
173
+ };
174
+ readonly llm_key_missing: {
175
+ readonly status: 412;
176
+ readonly title: "Model provider key missing";
177
+ };
178
+ readonly executor_unavailable: {
179
+ readonly status: 503;
180
+ readonly title: "Code-mode executor unavailable";
181
+ };
182
+ readonly job_running: {
183
+ readonly status: 409;
184
+ readonly title: "A job is already running";
185
+ };
186
+ };
187
+ export type ProblemCode = keyof typeof PROBLEM_CODES;
188
+ export declare const ProblemCodeSchema: z.ZodEnum<{
189
+ executor_unavailable: "executor_unavailable";
190
+ rate_limited: "rate_limited";
191
+ bad_request: "bad_request";
192
+ unauthenticated: "unauthenticated";
193
+ forbidden: "forbidden";
194
+ not_found: "not_found";
195
+ method_not_allowed: "method_not_allowed";
196
+ conflict: "conflict";
197
+ gone: "gone";
198
+ precondition_failed: "precondition_failed";
199
+ payload_too_large: "payload_too_large";
200
+ unsupported_media_type: "unsupported_media_type";
201
+ validation_failed: "validation_failed";
202
+ internal: "internal";
203
+ upstream_unavailable: "upstream_unavailable";
204
+ service_unavailable: "service_unavailable";
205
+ config_managed: "config_managed";
206
+ spec_invalid: "spec_invalid";
207
+ spec_unsupported: "spec_unsupported";
208
+ spec_fetch_failed: "spec_fetch_failed";
209
+ overlay_invalid: "overlay_invalid";
210
+ build_failed: "build_failed";
211
+ draft_conflict: "draft_conflict";
212
+ llm_key_missing: "llm_key_missing";
213
+ job_running: "job_running";
214
+ }>;
215
+ export declare function problemType(code: string): string;
216
+ export declare const ProblemFieldError: z.ZodObject<{
217
+ path: z.ZodArray<z.ZodString>;
218
+ message: z.ZodString;
219
+ code: z.ZodString;
220
+ }, z.core.$strip>;
221
+ export type ProblemFieldError = z.infer<typeof ProblemFieldError>;
222
+ /** RFC 9457 problem details + Neurouter extensions (`code`, `requestId`, `errors`). `code` is open for forward compat. */
223
+ export declare const Problem: z.ZodObject<{
224
+ type: z.ZodString;
225
+ title: z.ZodString;
226
+ status: z.ZodNumber;
227
+ detail: z.ZodOptional<z.ZodString>;
228
+ instance: z.ZodOptional<z.ZodString>;
229
+ code: z.ZodString;
230
+ requestId: z.ZodString;
231
+ errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
232
+ path: z.ZodArray<z.ZodString>;
233
+ message: z.ZodString;
234
+ code: z.ZodString;
235
+ }, z.core.$strip>>>;
236
+ }, z.core.$loose>;
237
+ export type Problem = z.infer<typeof Problem>;
238
+ /** Converts a zod error path to the problem `errors[].path` form (strings only). */
239
+ export declare function toProblemPath(path: readonly PropertyKey[]): string[];
240
+ export declare const ClientInfo: z.ZodObject<{
241
+ name: z.ZodNullable<z.ZodString>;
242
+ version: z.ZodNullable<z.ZodString>;
243
+ }, z.core.$strip>;
244
+ /** The principal behind an MCP call (API key, OAuth user or external-AS subject). */
245
+ export declare const PrincipalView: z.ZodObject<{
246
+ type: z.ZodEnum<{
247
+ user: "user";
248
+ api_key: "api_key";
249
+ external: "external";
250
+ }>;
251
+ id: z.ZodString;
252
+ name: z.ZodString;
253
+ }, z.core.$strip>;
254
+ export type PrincipalView = z.infer<typeof PrincipalView>;
255
+ /** `ceil(utf8Bytes / 4)` token estimate (A43). */
256
+ export declare const TokenEstimate: z.ZodNumber;
257
+ export type ClientInfo = z.infer<typeof ClientInfo>;
258
+ /** `403 forbidden` reasons (problem extension `reason`). */
259
+ export declare const ForbiddenReason: z.ZodEnum<{
260
+ csrf: "csrf";
261
+ demo_read_only: "demo_read_only";
262
+ capability: "capability";
263
+ }>;
264
+ export type ForbiddenReason = z.infer<typeof ForbiddenReason>;
265
+ /** `spec_fetch_failed` reasons (problem extension `reason`). */
266
+ export declare const SpecFetchFailReason: z.ZodEnum<{
267
+ unreachable: "unreachable";
268
+ too_large: "too_large";
269
+ not_a_spec: "not_a_spec";
270
+ blocked_host: "blocked_host";
271
+ }>;
272
+ export type SpecFetchFailReason = z.infer<typeof SpecFetchFailReason>;
273
+ /** Extensions of `config_managed` problems. */
274
+ export declare const ConfigManagedExtension: z.ZodObject<{
275
+ configPath: z.ZodString;
276
+ configLine: z.ZodNullable<z.ZodNumber>;
277
+ }, z.core.$strip>;
278
+ /** Where a file-managed resource is defined (`FileManagedNote`). */
279
+ export declare const ConfigLocation: z.ZodObject<{
280
+ path: z.ZodString;
281
+ line: z.ZodNullable<z.ZodNumber>;
282
+ }, z.core.$strip>;
283
+ export type ConfigLocation = z.infer<typeof ConfigLocation>;
284
+ export declare const JobAccepted: z.ZodObject<{
285
+ jobId: z.ZodString;
286
+ status: z.ZodEnum<{
287
+ running: "running";
288
+ queued: "queued";
289
+ succeeded: "succeeded";
290
+ failed: "failed";
291
+ }>;
292
+ }, z.core.$strip>;
293
+ export type JobAccepted = z.infer<typeof JobAccepted>;
294
+ export declare const TimeRangeQuery: z.ZodObject<{
295
+ from: z.ZodPreprocess<z.ZodOptional<z.ZodISODateTime>, unknown>;
296
+ to: z.ZodPreprocess<z.ZodOptional<z.ZodISODateTime>, unknown>;
297
+ }, z.core.$strip>;
298
+ /** Time-ranged lists default to the last 24 h and allow at most 90 days (backend §14.1). */
299
+ export declare const DEFAULT_TIME_RANGE_MS: number;
300
+ export declare const MAX_TIME_RANGE_DAYS = 90;
301
+ export declare const DEFAULT_AUDIT_MAX_RANGE_DAYS = 90;
302
+ export declare function timeRangeIssue(from: string, to: string, maxDays?: number): string | null;
303
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/api/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAIzB,6EAA6E;AAC7E,eAAO,MAAM,WAAW,kBAAmB,CAAC;AAC5C,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,yGAAyG;AACzG,eAAO,MAAM,gBAA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eAAO,MAAM,sBAAsB;;;iBAAgF,CAAC;AAEpH,oEAAoE;AACpE,eAAO,MAAM,cAAc;;;iBAAoE,CAAC;AAChG,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,eAAO,MAAM,WAAW;;;;;;;;iBAAwF,CAAC;AACjH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,eAAO,MAAM,cAAc;;;iBAGzB,CAAC;AAEH,4FAA4F;AAC5F,eAAO,MAAM,qBAAqB,QAAiB,CAAC;AACpD,eAAO,MAAM,mBAAmB,KAAK,CAAC;AACtC,eAAO,MAAM,4BAA4B,KAAsB,CAAC;AAEhE,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,SAA+B,GAAG,MAAM,GAAG,IAAI,CAO9G"}
@@ -0,0 +1,153 @@
1
+ import * as z from 'zod';
2
+ /* ------------------------------------------------------------------ primitives */
3
+ /** ISO-8601 UTC timestamp in responses (e.g. `2026-11-24T10:00:00.000Z`). */
4
+ export const IsoDateTime = z.iso.datetime();
5
+ /** ISO-8601 timestamp accepted in requests/query strings (offsets allowed, server normalizes to UTC). */
6
+ export const IsoDateTimeInput = z.iso.datetime({ offset: true });
7
+ /** Opaque id (UUIDv7 string). Kept loose so fixtures and legacy ids still parse; the server generates UUIDv7. */
8
+ export const Id = z.string().min(1).max(128);
9
+ export const Ref = z.object({ id: Id, name: z.string() });
10
+ /** Reference with a slug (servers, environments). */
11
+ export const SlugRef = z.object({ id: Id, slug: z.string(), name: z.string() });
12
+ export const ServerRef = SlugRef;
13
+ export const UserRefWithEmail = Ref.extend({ email: z.string() });
14
+ export const IdParams = z.object({ id: Id });
15
+ export const Slug = z.string().regex(/^[a-z][a-z0-9-]{1,38}[a-z0-9]$/, 'lowercase letters, digits and dashes (3–40 chars)');
16
+ export const EnvSlug = z.string().regex(/^[a-z][a-z0-9-]{0,30}$/, 'lowercase letters, digits and dashes (1–31 chars)');
17
+ export const SortOrder = z.enum(['asc', 'desc']);
18
+ export const JsonObject = z.record(z.string(), z.unknown());
19
+ /** `{ "$redacted": "<rule-name>" }` marker the audit redactor leaves in place of a value. */
20
+ export const RedactedMarker = z.object({ $redacted: z.string() });
21
+ export function isRedactedMarker(v) {
22
+ return typeof v === 'object' && v !== null && !Array.isArray(v) && Object.keys(v).length === 1 && typeof v.$redacted === 'string';
23
+ }
24
+ /* ------------------------------------------------------------------ query helpers */
25
+ /** A repeated query key (`a=1&a=2`) arrives as string | string[]; normalize to an array. */
26
+ export function queryArray(item) {
27
+ return z.preprocess((v) => (v === undefined || v === '' ? undefined : Array.isArray(v) ? v : [v]), z.array(item).optional());
28
+ }
29
+ /** `true` / `false` (also `1` / `0`) in a query string. */
30
+ export const QueryBool = z.preprocess((v) => {
31
+ if (v === 'true' || v === '1' || v === true)
32
+ return true;
33
+ if (v === 'false' || v === '0' || v === false)
34
+ return false;
35
+ return v;
36
+ }, z.boolean());
37
+ /** Drops empty strings (the API ignores empty query values). */
38
+ export function queryOptional(schema) {
39
+ return z.preprocess((v) => (v === '' ? undefined : v), schema.optional());
40
+ }
41
+ /* ------------------------------------------------------------------ pagination */
42
+ export const PAGE_LIMIT_DEFAULT = 50;
43
+ export const PAGE_LIMIT_MAX = 200;
44
+ export const CursorQuery = z.object({
45
+ cursor: queryOptional(z.string().max(2048)),
46
+ limit: z.preprocess((v) => (v === '' ? undefined : v), z.coerce.number().int().min(1).max(PAGE_LIMIT_MAX).optional()),
47
+ });
48
+ /** `Page<T> = { items, nextCursor, totalEstimate? }` (backend §14.1). */
49
+ export function Page(item) {
50
+ return z.object({
51
+ items: z.array(item),
52
+ nextCursor: z.string().nullable(),
53
+ totalEstimate: z.number().int().nonnegative().optional(),
54
+ });
55
+ }
56
+ export function Items(item) {
57
+ return z.object({ items: z.array(item) });
58
+ }
59
+ /** Sort param from a per-endpoint allowlist. */
60
+ export function sortParam(fields) {
61
+ return queryOptional(z.enum(fields));
62
+ }
63
+ /* ------------------------------------------------------------------ errors (RFC 9457) */
64
+ export const PROBLEM_CONTENT_TYPE = 'application/problem+json';
65
+ export const PROBLEM_TYPE_BASE = 'https://neurouter.dev/problems/';
66
+ /** Error codes, statuses and titles (backend §14.1; Hub codes + Neurouter codes). `type` URIs are stable per code. */
67
+ export const PROBLEM_CODES = {
68
+ bad_request: { status: 400, title: 'Bad request' },
69
+ unauthenticated: { status: 401, title: 'Authentication required' },
70
+ forbidden: { status: 403, title: 'Forbidden' },
71
+ not_found: { status: 404, title: 'Not found' },
72
+ method_not_allowed: { status: 405, title: 'Method not allowed' },
73
+ conflict: { status: 409, title: 'Conflict' },
74
+ gone: { status: 410, title: 'Gone' },
75
+ precondition_failed: { status: 412, title: 'Precondition failed' },
76
+ payload_too_large: { status: 413, title: 'Payload too large' },
77
+ unsupported_media_type: { status: 415, title: 'Unsupported media type' },
78
+ validation_failed: { status: 422, title: 'Validation failed' },
79
+ rate_limited: { status: 429, title: 'Too many requests' },
80
+ internal: { status: 500, title: 'Internal server error' },
81
+ upstream_unavailable: { status: 502, title: 'Upstream unavailable' },
82
+ service_unavailable: { status: 503, title: 'Service unavailable' },
83
+ // Neurouter codes (backend §14.1)
84
+ config_managed: { status: 409, title: 'Managed by neurouter.yaml' },
85
+ spec_invalid: { status: 422, title: 'Invalid spec' },
86
+ spec_unsupported: { status: 422, title: 'Unsupported spec' },
87
+ spec_fetch_failed: { status: 502, title: 'Could not fetch the spec' },
88
+ overlay_invalid: { status: 422, title: 'Invalid overlay' },
89
+ build_failed: { status: 422, title: 'Build failed' },
90
+ draft_conflict: { status: 409, title: 'Draft changed' },
91
+ llm_key_missing: { status: 412, title: 'Model provider key missing' },
92
+ executor_unavailable: { status: 503, title: 'Code-mode executor unavailable' },
93
+ job_running: { status: 409, title: 'A job is already running' },
94
+ };
95
+ export const ProblemCodeSchema = z.enum(Object.keys(PROBLEM_CODES));
96
+ export function problemType(code) {
97
+ return PROBLEM_TYPE_BASE + code.replaceAll('_', '-');
98
+ }
99
+ export const ProblemFieldError = z.object({
100
+ path: z.array(z.string()),
101
+ message: z.string(),
102
+ code: z.string(),
103
+ });
104
+ /** RFC 9457 problem details + Neurouter extensions (`code`, `requestId`, `errors`). `code` is open for forward compat. */
105
+ export const Problem = z.looseObject({
106
+ type: z.string(),
107
+ title: z.string(),
108
+ status: z.number().int().min(400).max(599),
109
+ detail: z.string().optional(),
110
+ instance: z.string().optional(),
111
+ code: z.string(),
112
+ requestId: z.string(),
113
+ errors: z.array(ProblemFieldError).optional(),
114
+ });
115
+ /** Converts a zod error path to the problem `errors[].path` form (strings only). */
116
+ export function toProblemPath(path) {
117
+ return path.map((p) => String(p));
118
+ }
119
+ /* ------------------------------------------------------------------ misc shapes */
120
+ export const ClientInfo = z.object({ name: z.string().nullable(), version: z.string().nullable() });
121
+ /** The principal behind an MCP call (API key, OAuth user or external-AS subject). */
122
+ export const PrincipalView = z.object({ type: z.enum(['user', 'api_key', 'external']), id: z.string(), name: z.string() });
123
+ /** `ceil(utf8Bytes / 4)` token estimate (A43). */
124
+ export const TokenEstimate = z.number().int().nonnegative();
125
+ /** `403 forbidden` reasons (problem extension `reason`). */
126
+ export const ForbiddenReason = z.enum(['csrf', 'demo_read_only', 'capability']);
127
+ /** `spec_fetch_failed` reasons (problem extension `reason`). */
128
+ export const SpecFetchFailReason = z.enum(['unreachable', 'too_large', 'not_a_spec', 'blocked_host']);
129
+ /** Extensions of `config_managed` problems. */
130
+ export const ConfigManagedExtension = z.object({ configPath: z.string(), configLine: z.number().int().nullable() });
131
+ /** Where a file-managed resource is defined (`FileManagedNote`). */
132
+ export const ConfigLocation = z.object({ path: z.string(), line: z.number().int().nullable() });
133
+ export const JobAccepted = z.object({ jobId: Id, status: z.enum(['queued', 'running', 'succeeded', 'failed']) });
134
+ export const TimeRangeQuery = z.object({
135
+ from: queryOptional(IsoDateTimeInput),
136
+ to: queryOptional(IsoDateTimeInput),
137
+ });
138
+ /** Time-ranged lists default to the last 24 h and allow at most 90 days (backend §14.1). */
139
+ export const DEFAULT_TIME_RANGE_MS = 24 * 3_600_000;
140
+ export const MAX_TIME_RANGE_DAYS = 90;
141
+ export const DEFAULT_AUDIT_MAX_RANGE_DAYS = MAX_TIME_RANGE_DAYS;
142
+ export function timeRangeIssue(from, to, maxDays = DEFAULT_AUDIT_MAX_RANGE_DAYS) {
143
+ const f = Date.parse(from);
144
+ const t = Date.parse(to);
145
+ if (Number.isNaN(f) || Number.isNaN(t))
146
+ return 'from and to must be ISO-8601 timestamps';
147
+ if (t <= f)
148
+ return '`to` must be after `from`';
149
+ if (t - f > maxDays * 86_400_000)
150
+ return `time range must not exceed ${maxDays} days`;
151
+ return null;
152
+ }
153
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/api/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,mFAAmF;AAEnF,6EAA6E;AAC7E,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;AAG5C,yGAAyG;AACzG,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AAEjE,iHAAiH;AACjH,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAG7C,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAE1D,qDAAqD;AACrD,MAAM,CAAC,MAAM,OAAO,GAAG,CAA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AS,CAAC;AACpD,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AACtC,MAAM,CAAC,MAAM,4BAA4B,GAAG,mBAAmB,CAAC;AAEhE,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,EAAU,EAAE,OAAO,GAAG,4BAA4B;IAC7F,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACzB,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAAE,OAAO,yCAAyC,CAAC;IACzF,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,2BAA2B,CAAC;IAC/C,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,GAAG,UAAU;QAAE,OAAO,8BAA8B,OAAO,OAAO,CAAC;IACtF,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,55 @@
1
+ import type * as z from 'zod';
2
+ import type { Access } from '../domain/capabilities.js';
3
+ export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
4
+ /**
5
+ * How the endpoint responds:
6
+ * - `json`: JSON body validated by `response`
7
+ * - `empty`: 204 No Content
8
+ * - `navigation`: browser navigation that answers with a 302 (never fetched by the SPA)
9
+ * - `sse`: `text/event-stream`
10
+ * - `download`: streamed attachment (CSV / NDJSON)
11
+ * - `binary`: raw bytes (icons)
12
+ */
13
+ export type EndpointKind = 'json' | 'empty' | 'navigation' | 'sse' | 'download' | 'binary';
14
+ /**
15
+ * Who may call the endpoint: a console capability (Admin has all, Viewer the `:read` set), `public`
16
+ * (no session) or `user` (any signed-in user, incl. the demo's anonymous viewer). Any listed entry
17
+ * grants access. Server-side checks are authoritative.
18
+ */
19
+ export type AccessLevel = Access;
20
+ export interface EndpointDef {
21
+ method: HttpMethod;
22
+ /** Fastify style path with `:param` segments, including the `/api` prefix (or `/public`, `/oauth` for the few non-API keys). */
23
+ path: string;
24
+ kind: EndpointKind;
25
+ /** Success status (200 unless stated). */
26
+ status: number;
27
+ access: readonly AccessLevel[];
28
+ summary: string;
29
+ params?: z.ZodType;
30
+ query?: z.ZodType;
31
+ body?: z.ZodType;
32
+ response?: z.ZodType;
33
+ }
34
+ export declare function endpoint<const D extends Omit<EndpointDef, 'status'> & {
35
+ status?: number;
36
+ }>(def: D): D & {
37
+ status: number;
38
+ };
39
+ type Shape<D, K extends string> = D extends Record<K, infer S> ? (S extends z.ZodType ? z.infer<S> : never) : undefined;
40
+ export type EndpointParams<D> = Shape<D, 'params'>;
41
+ export type EndpointQuery<D> = Shape<D, 'query'>;
42
+ export type EndpointBody<D> = Shape<D, 'body'>;
43
+ export type EndpointResponse<D> = Shape<D, 'response'>;
44
+ /** Names of the `:param` segments of a path, in order. */
45
+ export declare function pathParamNames(path: string): string[];
46
+ /** Fills `:param` segments (URI-encoded). Throws on a missing param. */
47
+ export declare function buildPath(path: string, params?: Record<string, string | number>): string;
48
+ export type QueryValue = string | number | boolean | Date | null | undefined | readonly (string | number | boolean | Date)[];
49
+ /**
50
+ * Serializes a query object the way the API expects (backend §14.1): arrays as repeated keys,
51
+ * dates as ISO-8601, empty / null / undefined values dropped. Keys are emitted in insertion order.
52
+ */
53
+ export declare function serializeQuery(query: Record<string, QueryValue> | undefined): string;
54
+ export {};
55
+ //# sourceMappingURL=endpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../../src/api/endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,CAAC,MAAM,KAAK,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AAErE;;;;;;;;GAQG;A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ACjD,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAC/C,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;AAEvD,0DAA0D;AAC1D,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAErD;AAED,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAM,GAAG,MAAM,CAM5F;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC;AAE7H;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,SAAS,GAAG,MAAM,CAapF"}
@@ -0,0 +1,41 @@
1
+ export function endpoint(def) {
2
+ return { status: def.kind === 'empty' ? 204 : 200, ...def };
3
+ }
4
+ /** Names of the `:param` segments of a path, in order. */
5
+ export function pathParamNames(path) {
6
+ return [...path.matchAll(/:([A-Za-z0-9_]+)/g)].map((m) => m[1]);
7
+ }
8
+ /** Fills `:param` segments (URI-encoded). Throws on a missing param. */
9
+ export function buildPath(path, params = {}) {
10
+ return path.replace(/:([A-Za-z0-9_]+)/g, (_, name) => {
11
+ const v = params[name];
12
+ if (v === undefined || v === '')
13
+ throw new Error(`Missing path param "${name}" for ${path}`);
14
+ return encodeURIComponent(String(v));
15
+ });
16
+ }
17
+ /**
18
+ * Serializes a query object the way the API expects (backend §14.1): arrays as repeated keys,
19
+ * dates as ISO-8601, empty / null / undefined values dropped. Keys are emitted in insertion order.
20
+ */
21
+ export function serializeQuery(query) {
22
+ if (!query)
23
+ return '';
24
+ const parts = [];
25
+ const add = (k, v) => {
26
+ const s = v instanceof Date ? v.toISOString() : String(v);
27
+ if (s !== '')
28
+ parts.push(`${encodeURIComponent(k)}=${encodeURIComponent(s)}`);
29
+ };
30
+ for (const [k, v] of Object.entries(query)) {
31
+ if (v === undefined || v === null)
32
+ continue;
33
+ if (Array.isArray(v))
34
+ for (const item of v)
35
+ add(k, item);
36
+ else
37
+ add(k, v);
38
+ }
39
+ return parts.length ? `?${parts.join('&')}` : '';
40
+ }
41
+ //# sourceMappingURL=endpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoint.js","sourceRoot":"","sources":["../../src/api/endpoint.ts"],"names":[],"mappings":"AAsCA,MAAM,UAAU,QAAQ,CAAoE,GAAM;IAChG,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,GAAG,EAA4B,CAAC;AACxF,CAAC;AAQD,0DAA0D;AAC1D,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAW,CAAC,CAAC;AAC5E,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,SAA0C,EAAE;IAClF,OAAO,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC,EAAE,IAAY,EAAE,EAAE;QAC3D,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QACvB,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,SAAS,IAAI,EAAE,CAAC,CAAC;QAC7F,OAAO,kBAAkB,CAAC,M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