-
Notifications
You must be signed in to change notification settings - Fork 6
Complete all P0/P1/P2 protocol optimizations (Sprints A–J) #609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5f22070
aaa6a3d
331b1c4
d823f56
02295f7
8d88103
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -241,6 +241,67 @@ export const ExternalLookupSchema = z.object({ | |||||||||||||
| */ | ||||||||||||||
| burstSize: z.number().optional().describe('Burst size'), | ||||||||||||||
| }).optional().describe('Rate limiting'), | ||||||||||||||
|
|
||||||||||||||
| /** | ||||||||||||||
| * Retry configuration with exponential backoff | ||||||||||||||
| * | ||||||||||||||
| * @example | ||||||||||||||
| * ```json | ||||||||||||||
| * { | ||||||||||||||
| * "maxRetries": 3, | ||||||||||||||
| * "initialDelayMs": 1000, | ||||||||||||||
| * "maxDelayMs": 30000, | ||||||||||||||
| * "backoffMultiplier": 2, | ||||||||||||||
| * "retryableStatusCodes": [429, 500, 502, 503, 504] | ||||||||||||||
| * } | ||||||||||||||
| * ``` | ||||||||||||||
| */ | ||||||||||||||
| retry: z.object({ | ||||||||||||||
| /** Maximum number of retry attempts */ | ||||||||||||||
| maxRetries: z.number().min(0).default(3).describe('Maximum retry attempts'), | ||||||||||||||
| /** Initial delay before first retry (ms) */ | ||||||||||||||
| initialDelayMs: z.number().default(1000).describe('Initial retry delay in milliseconds'), | ||||||||||||||
| /** Maximum delay between retries (ms) */ | ||||||||||||||
| maxDelayMs: z.number().default(30000).describe('Maximum retry delay in milliseconds'), | ||||||||||||||
| /** Backoff multiplier for exponential backoff */ | ||||||||||||||
| backoffMultiplier: z.number().default(2).describe('Exponential backoff multiplier'), | ||||||||||||||
| /** HTTP status codes that trigger a retry */ | ||||||||||||||
| retryableStatusCodes: z.array(z.number()).default([429, 500, 502, 503, 504]) | ||||||||||||||
| .describe('HTTP status codes that are retryable'), | ||||||||||||||
| }).optional().describe('Retry configuration with exponential backoff'), | ||||||||||||||
|
|
||||||||||||||
| /** | ||||||||||||||
| * Request/response transformation pipeline | ||||||||||||||
| * | ||||||||||||||
| * Allows transforming request parameters and response data | ||||||||||||||
| * before they are processed by the external lookup system. | ||||||||||||||
| */ | ||||||||||||||
| transform: z.object({ | ||||||||||||||
| /** Transform request parameters before sending */ | ||||||||||||||
| request: z.object({ | ||||||||||||||
| /** Header transformations (key-value additions) */ | ||||||||||||||
| headers: z.record(z.string(), z.string()).optional().describe('Additional request headers'), | ||||||||||||||
| /** Query parameter transformations */ | ||||||||||||||
| queryParams: z.record(z.string(), z.string()).optional().describe('Additional query parameters'), | ||||||||||||||
| }).optional().describe('Request transformation'), | ||||||||||||||
| /** Transform response data after receiving */ | ||||||||||||||
| response: z.object({ | ||||||||||||||
| /** JSONPath expression to extract data from response */ | ||||||||||||||
| dataPath: z.string().optional().describe('JSONPath to extract data (e.g., "$.data.results")'), | ||||||||||||||
| /** JSONPath expression to extract total count for pagination */ | ||||||||||||||
| totalPath: z.string().optional().describe('JSONPath to extract total count (e.g., "$.meta.total")'), | ||||||||||||||
| }).optional().describe('Response transformation'), | ||||||||||||||
| }).optional().describe('Request/response transformation pipeline'), | ||||||||||||||
|
|
||||||||||||||
| /** Pagination support for external data sources */ | ||||||||||||||
| pagination: z.object({ | ||||||||||||||
| /** Pagination type */ | ||||||||||||||
| type: z.enum(['offset', 'cursor', 'page']).default('offset').describe('Pagination type'), | ||||||||||||||
| /** Page size */ | ||||||||||||||
| pageSize: z.number().default(100).describe('Items per page'), | ||||||||||||||
| /** Maximum pages to fetch */ | ||||||||||||||
| maxPages: z.number().optional().describe('Maximum number of pages to fetch'), | ||||||||||||||
|
Comment on lines
+301
to
+303
|
||||||||||||||
| pageSize: z.number().default(100).describe('Items per page'), | |
| /** Maximum pages to fetch */ | |
| maxPages: z.number().optional().describe('Maximum number of pages to fetch'), | |
| pageSize: z.number().int().min(1).default(100).describe('Items per page'), | |
| /** Maximum pages to fetch */ | |
| maxPages: z.number().int().min(1).optional().describe('Maximum number of pages to fetch'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The retry config allows negative delays/multipliers (e.g.,
initialDelayMs,maxDelayMs,backoffMultiplier) because they are plainz.number(). These should be constrained to sensible ranges (e.g., delays>= 0, multiplier>= 1), and it’d be good to validatemaxDelayMs >= initialDelayMsto avoid impossible backoff configs.