-
Notifications
You must be signed in to change notification settings - Fork 2
feat(rag): Phase 1.5 — ChatRAGBuilder consumer ordering (#918) #922
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
c8b330d
203fb65
6323b7c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,6 +18,38 @@ import type { RecipeToolDeclaration } from '../../recipes/shared/RecipeTypes'; | |||||||||||
| */ | ||||||||||||
| export type RAGDomain = 'chat' | 'academy' | 'game' | 'code' | 'analysis'; | ||||||||||||
|
|
||||||||||||
| /** | ||||||||||||
| * Prompt tier — declares how often a RAG source's contribution changes between | ||||||||||||
| * requests. Drives stable-byte-prefix prompt assembly so llama-server / vllm / | ||||||||||||
| * DMR can reuse the KV cache for the invariant region instead of reprocessing | ||||||||||||
| * the full prompt every turn. | ||||||||||||
| * | ||||||||||||
| * The contract: a section's bytes must be byte-identical across requests for | ||||||||||||
| * sources at the same tier with the same inputs. INVARIANT and SEMI_STABLE | ||||||||||||
| * sources MUST NOT contain timestamps, request IDs, or any per-request | ||||||||||||
| * volatile data. Those go in VOLATILE only. | ||||||||||||
| * | ||||||||||||
| * Final assembly order is always: INVARIANT → SEMI_STABLE → VOLATILE. | ||||||||||||
| * Within each tier, sources are sorted by name (alphabetical) so the byte | ||||||||||||
| * order is fully deterministic. | ||||||||||||
|
Comment on lines
+33
to
+34
|
||||||||||||
| * Within each tier, sources are sorted by name (alphabetical) so the byte | |
| * order is fully deterministic. | |
| * Within a tier, source order must be deterministic. Consumers may apply | |
| * tier-specific ordering rules before any fallback alphabetical ordering; for | |
| * example, `tool-definitions` is hoisted ahead of other INVARIANT sources. |
Copilot
AI
Apr 18, 2026
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.
PromptTier is declared as a const enum, but it’s also imported/re-exported as a value (export { PromptTier } ...). Since const enums are erased in JS output, this can break ESM/bundler consumers with “module does not provide an export named 'PromptTier'”. Consider switching PromptTier to a normal export enum (or as const object + union type), or make the re-export/imports type-only and stop re-exporting it as a runtime value.
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 file imports and re-exports
PromptTieras a runtime symbol (import { PromptTier } ...+export { PromptTier } ...), butPromptTieris aconst enum(erased at emit). In ESM this can cause a hard runtime failure when the re-exported binding doesn’t exist. Safer options: (a) makePromptTiera normalenum, or (b) remove the runtime re-export and have consumersimport type { PromptTier }/ use string literals.