raiton 6.10.0-beta.28 → 6.11.1-beta.30

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 (96) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +19 -0
  3. package/benchmarks/README.md +15 -0
  4. package/benchmarks/ai-debug.json +145 -0
  5. package/benchmarks/ai-debug.md +64 -0
  6. package/benchmarks/latest.json +71 -71
  7. package/benchmarks/latest.md +25 -25
  8. package/build/bin/index.mjs +6028 -2098
  9. package/build/types/commands/call.command.d.ts +10 -0
  10. package/build/types/commands/debug.shared.d.ts +16 -0
  11. package/build/types/commands/explain.command.d.ts +8 -0
  12. package/build/types/commands/mcp.command.d.ts +1 -0
  13. package/build/types/commands/requests.command.d.ts +8 -0
  14. package/build/types/commands/verify.command.d.ts +8 -0
  15. package/build/types/contracts/decorators.d.ts +18 -0
  16. package/build/types/contracts/errors.d.ts +29 -3
  17. package/build/types/contracts/schema.d.ts +13 -0
  18. package/build/types/core/application.d.ts +8 -0
  19. package/build/types/debug/cli.d.ts +33 -0
  20. package/build/types/debug/collector.d.ts +41 -0
  21. package/build/types/debug/collector.internal.d.ts +27 -0
  22. package/build/types/debug/config.d.ts +19 -0
  23. package/build/types/debug/examples.d.ts +43 -0
  24. package/build/types/debug/explain.d.ts +9 -0
  25. package/build/types/debug/index.d.ts +15 -0
  26. package/build/types/debug/invocation.d.ts +53 -0
  27. package/build/types/debug/journal.d.ts +49 -0
  28. package/build/types/debug/mcp-http.d.ts +17 -0
  29. package/build/types/debug/mcp.d.ts +14 -0
  30. package/build/types/debug/redaction.d.ts +48 -0
  31. package/build/types/debug/requests.d.ts +37 -0
  32. package/build/types/debug/runtime.d.ts +52 -0
  33. package/build/types/debug/session.d.ts +21 -0
  34. package/build/types/debug/source.d.ts +17 -0
  35. package/build/types/debug/surface.d.ts +10 -0
  36. package/build/types/debug/types.d.ts +271 -0
  37. package/build/types/debug/verify.d.ts +23 -0
  38. package/build/types/framework/errors/catalog.d.ts +16 -1
  39. package/build/types/manifest/schema.d.ts +64 -0
  40. package/build/types/types/config.d.ts +50 -0
  41. package/docs/AGENTS.md +1 -1
  42. package/docs/CLAUDE.md +1 -1
  43. package/docs/generated/cli/commands.md +5 -0
  44. package/docs/generated/config-schema.json +93 -0
  45. package/docs/generated/manifest-schema.json +76 -0
  46. package/docs/generated/manifest.json +20 -3
  47. package/docs/llms-full.txt +183 -4
  48. package/docs/llms.txt +6 -1
  49. package/docs/user-guide/README.md +1 -0
  50. package/docs/user-guide/cli.md +5 -0
  51. package/docs/user-guide/config.md +18 -0
  52. package/docs/user-guide/debug.md +130 -0
  53. package/package.json +3 -1
  54. package/scripts/bench-ai-debug.ts +572 -0
  55. package/source/bin/commands.registry.ts +8 -0
  56. package/source/commands/call.command.ts +247 -0
  57. package/source/commands/debug.shared.ts +90 -0
  58. package/source/commands/docs.command.ts +6 -0
  59. package/source/commands/explain.command.ts +119 -0
  60. package/source/commands/mcp.command.ts +64 -0
  61. package/source/commands/requests.command.ts +137 -0
  62. package/source/commands/verify.command.ts +173 -0
  63. package/source/contracts/decorators.ts +67 -2
  64. package/source/contracts/errors.ts +64 -5
  65. package/source/contracts/schema.ts +61 -0
  66. package/source/core/application.ts +120 -12
  67. package/source/core/builder.ts +4 -0
  68. package/source/core/config/config.ts +11 -0
  69. package/source/core/config/schema.ts +143 -0
  70. package/source/core/router/handler.ts +162 -13
  71. package/source/debug/cli.ts +206 -0
  72. package/source/debug/collector.internal.ts +27 -0
  73. package/source/debug/collector.ts +294 -0
  74. package/source/debug/config.ts +142 -0
  75. package/source/debug/examples.ts +188 -0
  76. package/source/debug/explain.ts +187 -0
  77. package/source/debug/index.ts +15 -0
  78. package/source/debug/invocation.ts +695 -0
  79. package/source/debug/journal.ts +249 -0
  80. package/source/debug/mcp-http.ts +145 -0
  81. package/source/debug/mcp.ts +410 -0
  82. package/source/debug/redaction.ts +225 -0
  83. package/source/debug/requests.ts +136 -0
  84. package/source/debug/runtime.ts +181 -0
  85. package/source/debug/session.ts +107 -0
  86. package/source/debug/source.ts +95 -0
  87. package/source/debug/surface.ts +375 -0
  88. package/source/debug/types.ts +311 -0
  89. package/source/debug/verify.ts +186 -0
  90. package/source/framework/errors/catalog.ts +57 -11
  91. package/source/framework/mcp/handler.ts +9 -1
  92. package/source/framework/utilities/openapi.utils.impl.ts +28 -0
  93. package/source/manifest/introspect.ts +5 -0
  94. package/source/manifest/manifest.ts +24 -1
  95. package/source/manifest/schema.ts +52 -1
  96. package/source/types/config.ts +56 -0
@@ -0,0 +1,52 @@
1
+ import type { ApplicationInterface } from "../types/application.ts";
2
+ import type { ProjectManifest } from "../manifest/schema.ts";
3
+ import { DebugCollector } from "./collector.ts";
4
+ import { DebugJournal } from "./journal.ts";
5
+ import type { DebugLogLine, ResolvedDebugConfig } from "./types.ts";
6
+ export interface DebugLogBuffer {
7
+ record(level: string, message: string): void;
8
+ tail(limit?: number): DebugLogLine[];
9
+ clear(): void;
10
+ }
11
+ export interface DebugRuntimeState {
12
+ config: ResolvedDebugConfig;
13
+ journal?: DebugJournal;
14
+ collector?: DebugCollector;
15
+ buildId: string;
16
+ development: boolean;
17
+ workdir: string;
18
+ application?: ApplicationInterface;
19
+ logs: DebugLogBuffer;
20
+ }
21
+ export interface ConfigureDebugOptions {
22
+ config: ResolvedDebugConfig;
23
+ development: boolean;
24
+ workdir?: string;
25
+ application?: ApplicationInterface;
26
+ buildId?: string;
27
+ }
28
+ /**
29
+ * Configure the process-wide debug runtime. The journal survives HMR reloads
30
+ * (it lives on `globalThis`) while a new build id marks older entries stale.
31
+ */
32
+ export declare function configureDebug(options: ConfigureDebugOptions): DebugRuntimeState;
33
+ export declare function getDebugRuntime(): DebugRuntimeState | undefined;
34
+ export declare function getDebugCollector(): DebugCollector | undefined;
35
+ export declare function getDebugJournal(): DebugJournal | undefined;
36
+ export declare function isDebugJournalEnabled(): boolean;
37
+ export declare function resetDebugRuntime(): void;
38
+ /**
39
+ * Mark every retained entry as stale after a hot reload. The journal survives,
40
+ * but old entries are never mixed with the new build without a marker.
41
+ */
42
+ export declare function rotateDebugBuild(): void;
43
+ export declare function recordDebugLog(level: string, message: string): void;
44
+ export interface DebugContextOptions {
45
+ workdir?: string;
46
+ application?: ApplicationInterface;
47
+ }
48
+ export declare function setDebugContext(options: DebugContextOptions): void;
49
+ /** Load the live project manifest, using the existing cache when possible. */
50
+ export declare function loadDebugManifest(refresh?: boolean): Promise<ProjectManifest>;
51
+ /** Resolve the session-journal file used to bridge short-lived CLI processes. */
52
+ export declare function sessionJournalFile(workdir?: string): string;
@@ -0,0 +1,21 @@
1
+ import { DebugJournal } from "./journal.ts";
2
+ import type { DebugJournalEntry } from "./types.ts";
3
+ interface DebugSessionFile {
4
+ schemaVersion: string;
5
+ updatedAt: string;
6
+ entries: DebugJournalEntry[];
7
+ }
8
+ /**
9
+ * Read the bounded CLI session journal.
10
+ *
11
+ * The in-memory journal remains the runtime source of truth; this file only
12
+ * bridges two short-lived CLI processes (`raiton call` then `raiton explain`)
13
+ * when no running application is targeted. It is bounded, expires after 15
14
+ * minutes and is never written on a request hot path.
15
+ */
16
+ export declare function readSessionFile(workdir?: string): DebugSessionFile;
17
+ export declare function readSessionEntries(workdir?: string): DebugJournalEntry[];
18
+ export declare function loadSessionJournal(workdir?: string): DebugJournal;
19
+ export declare function appendSessionEntry(entry: DebugJournalEntry, workdir?: string): void;
20
+ export declare function clearSessionJournal(workdir?: string): void;
21
+ export {};
@@ -0,0 +1,17 @@
1
+ import type { DebugRouteSource } from "./types.ts";
2
+ export declare function relativePath(workdir: string, filename: string): string;
3
+ /** Relativize a `file:line` location captured by a decorator. */
4
+ export declare function relativeLocation(location: string | undefined, workdir?: string): string | undefined;
5
+ /** Clear cached line numbers after an HMR reload. */
6
+ export declare function invalidateSourceCache(): void;
7
+ /**
8
+ * Resolve the source location of a compiled route. Called once per handler
9
+ * compilation, never on the request hot path.
10
+ */
11
+ export declare function resolveRouteSource(controllerClass: any, controllerMeta: any, routeMeta: any, workdir?: string): DebugRouteSource;
12
+ /**
13
+ * Extract the first application frame from a stack trace. Used only in
14
+ * development to point at the throwing line.
15
+ */
16
+ export declare function firstUserFrame(stack?: string): string | undefined;
17
+ export declare function stackLines(error: any, limit?: number): string[] | undefined;
@@ -0,0 +1,10 @@
1
+ import type { PluginInterface } from "../types/plugin.ts";
2
+ import { type DebugRuntimeState } from "./runtime.ts";
3
+ /**
4
+ * Mount the HTTP debug surface and the debug MCP transport.
5
+ *
6
+ * All handlers are marked internal so they never appear in the public manifest
7
+ * inventory. The plugin is only registered when debug is enabled.
8
+ */
9
+ export declare function debugPlugin(runtime: DebugRuntimeState): PluginInterface;
10
+ export declare function debugSurfaceEnabled(): boolean;
@@ -0,0 +1,271 @@
1
+ import type { DebugCaptureMode, DebugConfigInterface, DebugJournalConfigInterface } from "../types/config.ts";
2
+ /** Version of every debug artefact (journal, invocation, explanation, report). */
3
+ export declare const DEBUG_SCHEMA_VERSION = "1.0.0";
4
+ export declare const SUPPORTED_DEBUG_SCHEMA_VERSIONS: Set<string>;
5
+ export declare function isSupportedDebugSchemaVersion(version: unknown): boolean;
6
+ export declare class DebugSchemaVersionError extends Error {
7
+ readonly version: unknown;
8
+ constructor(version: unknown);
9
+ readonly code: string;
10
+ }
11
+ export type DebugCapture = DebugCaptureMode;
12
+ export interface ResolvedDebugJournalConfig {
13
+ enabled: boolean;
14
+ capacity: number;
15
+ maxBodyBytes: number;
16
+ capture: DebugCapture;
17
+ ttlMs: number;
18
+ sampleRate: number;
19
+ redact: string[];
20
+ /** Hard budget for the whole journal, in bytes. @default 8388608 */
21
+ maxTotalBytes: number;
22
+ }
23
+ export interface ResolvedDebugHttpConfig {
24
+ enabled: boolean;
25
+ basePath: string;
26
+ loopbackOnly: boolean;
27
+ tokenEnv: string;
28
+ token?: string;
29
+ }
30
+ export interface ResolvedDebugMcpConfig {
31
+ enabled: boolean;
32
+ path: string;
33
+ }
34
+ export interface ResolvedDebugConfig {
35
+ enabled: boolean;
36
+ journal: ResolvedDebugJournalConfig;
37
+ http: ResolvedDebugHttpConfig;
38
+ mcp: ResolvedDebugMcpConfig;
39
+ replay: {
40
+ allowUnsafeMethods: boolean;
41
+ };
42
+ development: boolean;
43
+ raw: DebugConfigInterface;
44
+ }
45
+ export interface DebugRouteSource {
46
+ file: string;
47
+ line: number;
48
+ controller: string;
49
+ handler: string;
50
+ decorator?: string;
51
+ }
52
+ export interface DebugTimelineStep {
53
+ step: string;
54
+ durationMs?: number;
55
+ result?: string;
56
+ detail?: string;
57
+ }
58
+ export interface DebugValidationIssue {
59
+ path: string;
60
+ code: string;
61
+ message: string;
62
+ expected?: string;
63
+ received?: string;
64
+ location?: string;
65
+ }
66
+ export interface DebugValidationSummary {
67
+ ok: boolean;
68
+ absent?: boolean;
69
+ issues: DebugValidationIssue[];
70
+ }
71
+ export interface DebugJournalRequest {
72
+ method: string;
73
+ route: string;
74
+ pattern: string;
75
+ path: string;
76
+ query?: Record<string, any>;
77
+ params?: Record<string, any>;
78
+ headers?: Record<string, string>;
79
+ body?: any;
80
+ }
81
+ export interface DebugJournalResponse {
82
+ status: number;
83
+ durationMs: number;
84
+ body?: any;
85
+ }
86
+ export interface DebugJournalError {
87
+ code: string;
88
+ message: string;
89
+ statusCode?: number;
90
+ stack?: string[];
91
+ location?: string;
92
+ }
93
+ export interface DebugRelease {
94
+ hmr: boolean;
95
+ buildId: string;
96
+ }
97
+ export interface DebugJournalEntry {
98
+ schemaVersion: string;
99
+ requestId: string;
100
+ traceId: string;
101
+ startedAt: string;
102
+ request: DebugJournalRequest;
103
+ response: DebugJournalResponse;
104
+ source?: DebugRouteSource;
105
+ timeline: DebugTimelineStep[];
106
+ validation?: DebugValidationSummary;
107
+ error?: DebugJournalError;
108
+ cache?: {
109
+ hit: boolean;
110
+ };
111
+ release: DebugRelease;
112
+ replayedFrom?: string;
113
+ stale?: boolean;
114
+ }
115
+ export interface DebugJournalFilter {
116
+ sinceMs?: number;
117
+ status?: string;
118
+ route?: string;
119
+ limit?: number;
120
+ includeBodies?: boolean;
121
+ }
122
+ export interface DebugRequestsList {
123
+ schemaVersion: string;
124
+ count: number;
125
+ capacity: number;
126
+ enabled: boolean;
127
+ requests: Array<{
128
+ requestId: string;
129
+ traceId: string;
130
+ startedAt: string;
131
+ method: string;
132
+ route: string;
133
+ status: number;
134
+ durationMs: number;
135
+ stale?: boolean;
136
+ }>;
137
+ }
138
+ export interface DebugInvocationRequest {
139
+ method: string;
140
+ path: string;
141
+ params?: Record<string, any>;
142
+ query?: Record<string, any>;
143
+ headers?: Record<string, any>;
144
+ body?: any;
145
+ example?: string;
146
+ dryRun?: boolean;
147
+ validate?: boolean;
148
+ timeoutMs?: number;
149
+ baseUrl?: string;
150
+ failOn?: string[];
151
+ replayedFrom?: string;
152
+ }
153
+ export interface DebugResolvedRequest {
154
+ method: string;
155
+ path: string;
156
+ url: string;
157
+ params: Record<string, any>;
158
+ query: Record<string, any>;
159
+ headers: Record<string, string>;
160
+ body?: any;
161
+ }
162
+ export interface DebugContractStatus {
163
+ input: "valid" | "invalid" | "absent" | "skipped";
164
+ output: "valid" | "invalid" | "absent" | "unknown";
165
+ issues: DebugValidationIssue[];
166
+ /** Route label used to attribute output contract violations. */
167
+ route?: string;
168
+ }
169
+ export interface DebugInvocationResult {
170
+ schemaVersion: string;
171
+ request: {
172
+ method: string;
173
+ path: string;
174
+ url?: string;
175
+ headers: Record<string, string>;
176
+ query?: Record<string, any>;
177
+ params?: Record<string, any>;
178
+ body?: any;
179
+ dryRun?: boolean;
180
+ };
181
+ response: {
182
+ status: number;
183
+ durationMs: number;
184
+ requestId: string;
185
+ traceId: string;
186
+ body?: any;
187
+ };
188
+ contract: DebugContractStatus;
189
+ nextActions: string[];
190
+ replayedFrom?: string;
191
+ comparison?: DebugReplayComparison;
192
+ }
193
+ export interface DebugReplayComparison {
194
+ status: "same" | "changed";
195
+ body: "same" | "changed" | "unknown";
196
+ previousStatus: number;
197
+ currentStatus: number;
198
+ differences: string[];
199
+ }
200
+ export interface DebugExplanation {
201
+ schemaVersion: string;
202
+ requestId: string;
203
+ request: {
204
+ method: string;
205
+ route: string;
206
+ status: number;
207
+ durationMs: number;
208
+ startedAt: string;
209
+ };
210
+ source?: DebugRouteSource;
211
+ timeline: DebugTimelineStep[];
212
+ diagnosis: {
213
+ code: string;
214
+ rootCause: string;
215
+ issues: DebugValidationIssue[];
216
+ hint: string;
217
+ /** Development-only launch site. */
218
+ location?: string;
219
+ /** Development-only stack lines. */
220
+ stack?: string[];
221
+ };
222
+ nextActions: string[];
223
+ stale?: boolean;
224
+ request_verbose?: DebugJournalRequest;
225
+ response_verbose?: DebugJournalResponse;
226
+ }
227
+ export interface DebugVerificationResult {
228
+ method: string;
229
+ path: string;
230
+ status?: number;
231
+ expectedStatus?: number;
232
+ contract: "valid" | "invalid" | "absent" | "skipped";
233
+ passed: boolean;
234
+ skipped?: boolean;
235
+ reason?: string;
236
+ issue?: string;
237
+ field?: string;
238
+ expected?: string;
239
+ actual?: string;
240
+ source?: string;
241
+ requestId?: string;
242
+ }
243
+ export interface DebugVerificationReport {
244
+ schemaVersion: string;
245
+ summary: {
246
+ routes: number;
247
+ passed: number;
248
+ failed: number;
249
+ skipped: number;
250
+ durationMs: number;
251
+ };
252
+ results: DebugVerificationResult[];
253
+ }
254
+ export interface DebugDoctorCheck {
255
+ name: string;
256
+ passed: boolean;
257
+ detail?: string;
258
+ hint?: string;
259
+ }
260
+ export interface DebugDoctorReport {
261
+ schemaVersion: string;
262
+ passed: boolean;
263
+ checks: DebugDoctorCheck[];
264
+ }
265
+ export interface DebugLogLine {
266
+ at: string;
267
+ level: string;
268
+ message: string;
269
+ }
270
+ /** Loose config accepted by `defineConfig`; kept for editor completion. */
271
+ export type { DebugConfigInterface, DebugJournalConfigInterface };
@@ -0,0 +1,23 @@
1
+ import type { ProjectManifest } from "../manifest/schema.ts";
2
+ import type { ApplicationInterface } from "../types/application.ts";
3
+ import type { ResolvedDebugConfig } from "./types.ts";
4
+ import type { DebugVerificationReport } from "./types.ts";
5
+ export interface VerifyOptions {
6
+ manifest: ProjectManifest;
7
+ application?: ApplicationInterface;
8
+ baseUrl?: string;
9
+ config?: ResolvedDebugConfig;
10
+ route?: string;
11
+ allowUnsafe?: boolean;
12
+ failOn?: string[];
13
+ timeoutMs?: number;
14
+ workdir?: string;
15
+ headers?: Record<string, string>;
16
+ }
17
+ /**
18
+ * Call every route with its documented example, validate the status and output
19
+ * contract, and return a per-route report. Non-idempotent methods are skipped
20
+ * unless explicitly allowed.
21
+ */
22
+ export declare function verifyManifest(options: VerifyOptions): Promise<DebugVerificationReport>;
23
+ export declare function verifyHuman(report: DebugVerificationReport): string;
@@ -4,7 +4,10 @@ export interface ErrorCatalogEntry {
4
4
  status: HttpStatus;
5
5
  message: string;
6
6
  docsPath: string;
7
+ hint?: string;
7
8
  }
9
+ /** Version of the stable error envelope. */
10
+ export declare const ERROR_SCHEMA_VERSION = "1.0.0";
8
11
  export declare function errorDocsUrl(path: string): string;
9
12
  /**
10
13
  * Stable public error catalogue. Codes never change once published; new codes
@@ -18,20 +21,32 @@ export interface ErrorPayloadOptions {
18
21
  statusCode?: number;
19
22
  docsUrl?: string;
20
23
  data?: any;
24
+ /** Actionable next step. Defaults to the catalogue hint. */
25
+ hint?: string;
26
+ /** Development-only source location. */
27
+ location?: string;
28
+ /** Development-only stack lines. */
29
+ stack?: string[];
30
+ redact?: string[];
21
31
  }
32
+ export declare function hintFor(code: string): string;
22
33
  /**
23
34
  * Build a stable error body. In production it never contains a stack trace or
24
35
  * internal detail beyond the catalogue entry and validated public fields.
25
36
  */
26
37
  export declare function errorPayload(code: string, options?: ErrorPayloadOptions): {
27
38
  error: boolean;
39
+ schemaVersion: string;
28
40
  code: string;
29
41
  statusCode: number;
30
42
  message: string;
31
43
  docsUrl: string;
44
+ hint: string;
32
45
  requestId?: string | undefined;
33
46
  details?: any;
34
47
  data?: any;
48
+ location?: string | undefined;
49
+ stack?: string[] | undefined;
35
50
  };
36
51
  export declare function catalogEntry(code: string): ErrorCatalogEntry;
37
52
  export declare function codeForStatus(status: number): string;
@@ -39,4 +54,4 @@ export declare function codeForStatus(status: number): string;
39
54
  * Enrich a legacy exception payload with the stable catalogue fields without
40
55
  * removing existing fields (backward-compatible additive change).
41
56
  */
42
- export declare function enrichErrorPayload(payload: any, statusCode?: number, requestId?: string): any;
57
+ export declare function enrichErrorPayload(payload: any, statusCode?: number, requestId?: string, options?: ErrorPayloadOptions): any;
@@ -1,4 +1,18 @@
1
1
  export declare const MANIFEST_SCHEMA_VERSION = "1.0.0";
2
+ export declare const SUPPORTED_MANIFEST_SCHEMA_VERSIONS: Set<string>;
3
+ export declare const RouteExampleSchema: import("@sinclair/typebox").TObject<{
4
+ name: import("@sinclair/typebox").TString;
5
+ body: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
6
+ params: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
7
+ query: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
8
+ headers: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
9
+ expectedStatus: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
10
+ }>;
11
+ export declare const RouteErrorSchema: import("@sinclair/typebox").TObject<{
12
+ code: import("@sinclair/typebox").TString;
13
+ status: import("@sinclair/typebox").TNumber;
14
+ description: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
15
+ }>;
2
16
  export declare const RouteManifestSchema: import("@sinclair/typebox").TObject<{
3
17
  method: import("@sinclair/typebox").TString;
4
18
  path: import("@sinclair/typebox").TString;
@@ -11,6 +25,22 @@ export declare const RouteManifestSchema: import("@sinclair/typebox").TObject<{
11
25
  output: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
12
26
  inputSchema: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
13
27
  outputSchema: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
28
+ querySchema: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
29
+ paramsSchema: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
30
+ headersSchema: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
31
+ examples: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
32
+ name: import("@sinclair/typebox").TString;
33
+ body: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
34
+ params: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
35
+ query: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
36
+ headers: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
37
+ expectedStatus: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
38
+ }>>>;
39
+ errors: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
40
+ code: import("@sinclair/typebox").TString;
41
+ status: import("@sinclair/typebox").TNumber;
42
+ description: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
43
+ }>>>;
14
44
  }>;
15
45
  export declare const McpToolManifestSchema: import("@sinclair/typebox").TObject<{
16
46
  name: import("@sinclair/typebox").TString;
@@ -75,6 +105,22 @@ export declare const ProjectManifestSchema: import("@sinclair/typebox").TObject<
75
105
  output: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
76
106
  inputSchema: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
77
107
  outputSchema: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
108
+ querySchema: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
109
+ paramsSchema: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
110
+ headersSchema: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
111
+ examples: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
112
+ name: import("@sinclair/typebox").TString;
113
+ body: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
114
+ params: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
115
+ query: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
116
+ headers: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
117
+ expectedStatus: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
118
+ }>>>;
119
+ errors: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
120
+ code: import("@sinclair/typebox").TString;
121
+ status: import("@sinclair/typebox").TNumber;
122
+ description: import("@sinclair/typebox").TOptional<import("../contracts/typebox.ts").TSchema>;
123
+ }>>>;
78
124
  }>>;
79
125
  injection: import("@sinclair/typebox").TNever;
80
126
  artifacts: import("@sinclair/typebox").TArray<import("../contracts/typebox.ts").TSchema>;
@@ -130,6 +176,19 @@ export interface McpServerManifest {
130
176
  prompts?: Array<Record<string, any>>;
131
177
  resources?: Array<Record<string, any>>;
132
178
  }
179
+ export interface ManifestRouteExample {
180
+ name: string;
181
+ body?: any;
182
+ params?: Record<string, any>;
183
+ query?: Record<string, any>;
184
+ headers?: Record<string, any>;
185
+ expectedStatus?: number;
186
+ }
187
+ export interface ManifestRouteError {
188
+ code: string;
189
+ status: number;
190
+ description?: string;
191
+ }
133
192
  export interface ProjectRouteManifest {
134
193
  method: string;
135
194
  path: string;
@@ -142,6 +201,11 @@ export interface ProjectRouteManifest {
142
201
  output?: string;
143
202
  inputSchema?: Record<string, any>;
144
203
  outputSchema?: Record<string, any>;
204
+ querySchema?: Record<string, any>;
205
+ paramsSchema?: Record<string, any>;
206
+ headersSchema?: Record<string, any>;
207
+ examples?: ManifestRouteExample[];
208
+ errors?: ManifestRouteError[];
145
209
  }
146
210
  export interface ProjectManifest {
147
211
  schemaVersion: string;
@@ -37,6 +37,54 @@ export interface McpConfigInterface {
37
37
  /** Per-tool calls per minute. 0 disables the limiter. */
38
38
  rateLimitPerMinute?: number;
39
39
  }
40
+ export type DebugCaptureMode = "off" | "metadata" | "full";
41
+ export interface DebugJournalConfigInterface {
42
+ /** Capture requests in the bounded in-memory journal. */
43
+ enabled?: boolean;
44
+ /** Maximum number of retained entries. @default 1000 */
45
+ capacity?: number;
46
+ /** Maximum serialized body size, in bytes. @default 65536 */
47
+ maxBodyBytes?: number;
48
+ /** `off`, `metadata` (ids and scalars) or `full` (redacted bodies). */
49
+ capture?: DebugCaptureMode;
50
+ /** Entries older than this are evicted. @default 900000 */
51
+ ttlMs?: number;
52
+ /** Sampling rate between 0 and 1. @default 1 */
53
+ sampleRate?: number;
54
+ /** Additional sensitive keys, merged with the built-in list. */
55
+ redact?: string[];
56
+ }
57
+ export interface DebugHttpConfigInterface {
58
+ /** Mount the HTTP debug surface. */
59
+ enabled?: boolean;
60
+ /** Base path of the HTTP debug surface. @default '/__raiton' */
61
+ basePath?: string;
62
+ /** Only answer requests originating from the loopback interface. @default true */
63
+ loopbackOnly?: boolean;
64
+ /** Environment variable holding the debug token. @default 'RAITON_DEBUG_TOKEN' */
65
+ tokenEnv?: string;
66
+ }
67
+ export interface DebugMcpConfigInterface {
68
+ /** Mount the debug MCP server. */
69
+ enabled?: boolean;
70
+ /** MCP endpoint in application mode. @default '/__raiton/mcp' */
71
+ path?: string;
72
+ }
73
+ export interface DebugReplayConfigInterface {
74
+ /** Allow replaying non-idempotent methods without an explicit flag. */
75
+ allowUnsafeMethods?: boolean;
76
+ }
77
+ export interface DebugConfigInterface {
78
+ /**
79
+ * Enable every debug surface. Defaults to `true` in development and
80
+ * `false` otherwise; an explicit value always wins.
81
+ */
82
+ enabled?: boolean;
83
+ journal?: DebugJournalConfigInterface;
84
+ http?: DebugHttpConfigInterface;
85
+ mcp?: DebugMcpConfigInterface;
86
+ replay?: DebugReplayConfigInterface;
87
+ }
40
88
  export interface ConfigurableInterface {
41
89
  rootDir: string;
42
90
  version: string;
@@ -54,6 +102,8 @@ export interface ConfigurableInterface {
54
102
  shutdown?: ShutdownConfigInterface;
55
103
  devPage?: DevPageConfigInterface;
56
104
  mcp?: McpConfigInterface;
105
+ /** AI-assisted runtime debug surfaces. Opt-in outside development. */
106
+ debug?: DebugConfigInterface;
57
107
  /** Documentation generation options. */
58
108
  docs?: {
59
109
  dir?: string;
package/docs/AGENTS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # AGENTS.md — Raiton conventions
2
2
 
3
- This repository uses **Raiton** (raiton 6.8.9-beta.25).
3
+ This repository uses **Raiton** (raiton 6.10.0-beta.28).
4
4
 
5
5
  ## Deterministic commands
6
6
 
package/docs/CLAUDE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # AGENTS.md — Raiton conventions
2
2
 
3
- This repository uses **Raiton** (raiton 6.8.9-beta.25).
3
+ This repository uses **Raiton** (raiton 6.10.0-beta.28).
4
4
 
5
5
  ## Deterministic commands
6
6
 
@@ -9,6 +9,10 @@ Generated by `raiton docs agents`. Do not edit by hand.
9
9
  | `raiton routes` | List mounted routes |
10
10
  | `raiton inspect` | Emit the versioned project manifest |
11
11
  | `raiton why <method> <path>` | Explain which file registered a route |
12
+ | `raiton call [method] [path]` | Invoke a route with local validation and a structured result |
13
+ | `raiton requests` | List recently captured requests |
14
+ | `raiton explain [requestId]` | Explain a request: timeline, root cause and next actions |
15
+ | `raiton verify` | Call route examples and validate status and output contracts |
12
16
  | `raiton doctor` | Diagnose runtime, configuration and prerequisites |
13
17
  | `raiton openapi export` | Export the OpenAPI document |
14
18
  | `raiton client` | Generate a typed client |
@@ -19,6 +23,7 @@ Generated by `raiton docs agents`. Do not edit by hand.
19
23
  | `raiton mcp test <server>.<tool>` | Call an MCP tool |
20
24
  | `raiton mcp serve [server]` | Serve an MCP server over stdio |
21
25
  | `raiton mcp conformance [server]` | Run the HTTP + stdio conformance suite |
26
+ | `raiton mcp debug` | Serve the AI-assisted debug MCP server (stdio or HTTP) |
22
27
  | `raiton docs agents` | Generate llms.txt, llms-full.txt, AGENTS.md and CLAUDE.md |
23
28
  | `raiton artifact --dump` | Inspect detected artifacts |
24
29
  | `raiton dev` | Run the application with HMR |