modelrig 0.9.0 → 0.11.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 (231) hide show
  1. package/CHANGELOG.md +227 -0
  2. package/README.md +51 -27
  3. package/data/PROVENANCE.md +14 -0
  4. package/data/pricing-map.json +26 -0
  5. package/dist/adapters/attempt-meta-map.d.ts +8 -1
  6. package/dist/adapters/attempt-meta-map.d.ts.map +1 -1
  7. package/dist/adapters/attempt-meta-map.js +4 -0
  8. package/dist/adapters/build-adapters.js +2 -2
  9. package/dist/adapters/gemini.d.ts +28 -1
  10. package/dist/adapters/gemini.d.ts.map +1 -1
  11. package/dist/adapters/gemini.js +38 -9
  12. package/dist/adapters/grok.d.ts.map +1 -1
  13. package/dist/adapters/grok.js +53 -4
  14. package/dist/adapters/openai-compat.d.ts +8 -2
  15. package/dist/adapters/openai-compat.d.ts.map +1 -1
  16. package/dist/adapters/openai-compat.js +8 -1
  17. package/dist/adapters/openai-stream.d.ts +10 -2
  18. package/dist/adapters/openai-stream.d.ts.map +1 -1
  19. package/dist/adapters/openai-stream.js +5 -1
  20. package/dist/adapters/openai.d.ts +10 -1
  21. package/dist/adapters/openai.d.ts.map +1 -1
  22. package/dist/adapters/openai.js +57 -7
  23. package/dist/adapters/responses-api.d.ts +61 -0
  24. package/dist/adapters/responses-api.d.ts.map +1 -0
  25. package/dist/adapters/responses-api.js +124 -0
  26. package/dist/artifacts/artifact.d.ts +20 -0
  27. package/dist/artifacts/artifact.d.ts.map +1 -1
  28. package/dist/artifacts/artifact.js +207 -171
  29. package/dist/artifacts/index.d.ts +3 -1
  30. package/dist/artifacts/index.d.ts.map +1 -1
  31. package/dist/artifacts/index.js +8 -1
  32. package/dist/bakeoff/groundedness.d.ts +58 -0
  33. package/dist/bakeoff/groundedness.d.ts.map +1 -0
  34. package/dist/bakeoff/groundedness.js +165 -0
  35. package/dist/bakeoff/quality.d.ts +14 -1
  36. package/dist/bakeoff/quality.d.ts.map +1 -1
  37. package/dist/bakeoff/quality.js +10 -0
  38. package/dist/bakeoff/replay.d.ts.map +1 -1
  39. package/dist/bakeoff/replay.js +4 -0
  40. package/dist/cli.d.ts.map +1 -1
  41. package/dist/cli.js +8 -0
  42. package/dist/config.d.ts +31 -0
  43. package/dist/config.d.ts.map +1 -1
  44. package/dist/config.js +23 -0
  45. package/dist/doctor-cli.d.ts +7 -0
  46. package/dist/doctor-cli.d.ts.map +1 -0
  47. package/dist/doctor-cli.js +68 -0
  48. package/dist/doctor-preflight.d.ts +64 -0
  49. package/dist/doctor-preflight.d.ts.map +1 -0
  50. package/dist/doctor-preflight.js +167 -0
  51. package/dist/feedback/coverage.d.ts.map +1 -1
  52. package/dist/feedback/coverage.js +9 -2
  53. package/dist/feedback/grade.d.ts +8 -1
  54. package/dist/feedback/grade.d.ts.map +1 -1
  55. package/dist/feedback/grade.js +4 -0
  56. package/dist/gateway/http-protocol.d.ts +19 -0
  57. package/dist/gateway/http-protocol.d.ts.map +1 -1
  58. package/dist/gateway/serve-client.d.ts +99 -0
  59. package/dist/gateway/serve-client.d.ts.map +1 -0
  60. package/dist/gateway/serve-client.js +360 -0
  61. package/dist/index.d.ts +31 -3
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +71 -8
  64. package/dist/prompts/manifest.d.ts +128 -0
  65. package/dist/prompts/manifest.d.ts.map +1 -0
  66. package/dist/prompts/manifest.js +214 -0
  67. package/dist/prompts/prompt-fetch.d.ts +84 -0
  68. package/dist/prompts/prompt-fetch.d.ts.map +1 -0
  69. package/dist/prompts/prompt-fetch.js +120 -0
  70. package/dist/prompts/prompt-resolve.d.ts +76 -0
  71. package/dist/prompts/prompt-resolve.d.ts.map +1 -0
  72. package/dist/prompts/prompt-resolve.js +93 -0
  73. package/dist/prompts/slot-resolver.d.ts +91 -0
  74. package/dist/prompts/slot-resolver.d.ts.map +1 -0
  75. package/dist/prompts/slot-resolver.js +135 -0
  76. package/dist/prompts/tools-register.d.ts +60 -0
  77. package/dist/prompts/tools-register.d.ts.map +1 -0
  78. package/dist/prompts/tools-register.js +48 -0
  79. package/dist/prompts/version-hash.d.ts +29 -0
  80. package/dist/prompts/version-hash.d.ts.map +1 -0
  81. package/dist/prompts/version-hash.js +54 -0
  82. package/dist/prompts-export-cli.d.ts +21 -0
  83. package/dist/prompts-export-cli.d.ts.map +1 -0
  84. package/dist/prompts-export-cli.js +130 -0
  85. package/dist/registry/cache-policy.d.ts.map +1 -1
  86. package/dist/registry/cache-policy.js +22 -0
  87. package/dist/registry/pricing-shape.d.ts +38 -8
  88. package/dist/registry/pricing-shape.d.ts.map +1 -1
  89. package/dist/registry/pricing-shape.js +40 -12
  90. package/dist/registry/pricing.d.ts +6 -5
  91. package/dist/registry/pricing.d.ts.map +1 -1
  92. package/dist/registry/pricing.js +9 -5
  93. package/dist/routes/destination-loader.d.ts +16 -0
  94. package/dist/routes/destination-loader.d.ts.map +1 -0
  95. package/dist/routes/destination-loader.js +29 -0
  96. package/dist/routes/draft.d.ts +7 -0
  97. package/dist/routes/draft.d.ts.map +1 -1
  98. package/dist/routes/draft.js +12 -0
  99. package/dist/routes/loader.d.ts.map +1 -1
  100. package/dist/routes/loader.js +27 -54
  101. package/dist/routes/output-loader.d.ts +42 -0
  102. package/dist/routes/output-loader.d.ts.map +1 -0
  103. package/dist/routes/output-loader.js +112 -0
  104. package/dist/routes/prompt-loader.d.ts +49 -0
  105. package/dist/routes/prompt-loader.d.ts.map +1 -0
  106. package/dist/routes/prompt-loader.js +113 -0
  107. package/dist/routes/resolved-bundle.d.ts +19 -0
  108. package/dist/routes/resolved-bundle.d.ts.map +1 -1
  109. package/dist/routes/resolved-bundle.js +24 -0
  110. package/dist/routes/screen-loader.d.ts +1 -1
  111. package/dist/routes/screen-loader.d.ts.map +1 -1
  112. package/dist/routes/screen-loader.js +8 -1
  113. package/dist/run/accept.d.ts +3 -0
  114. package/dist/run/accept.d.ts.map +1 -1
  115. package/dist/run/accept.js +1 -0
  116. package/dist/run/cost.d.ts +31 -2
  117. package/dist/run/cost.d.ts.map +1 -1
  118. package/dist/run/cost.js +57 -2
  119. package/dist/run/destination.d.ts +39 -0
  120. package/dist/run/destination.d.ts.map +1 -0
  121. package/dist/run/destination.js +45 -0
  122. package/dist/run/dispatch.d.ts +25 -3
  123. package/dist/run/dispatch.d.ts.map +1 -1
  124. package/dist/run/dispatch.js +26 -4
  125. package/dist/run/raw-defaults.d.ts.map +1 -1
  126. package/dist/run/raw-defaults.js +6 -1
  127. package/dist/run/raw-finalize.d.ts +96 -0
  128. package/dist/run/raw-finalize.d.ts.map +1 -0
  129. package/dist/run/raw-finalize.js +283 -0
  130. package/dist/run/raw-knobs.d.ts +36 -0
  131. package/dist/run/raw-knobs.d.ts.map +1 -0
  132. package/dist/run/raw-knobs.js +99 -0
  133. package/dist/run/raw-request.d.ts +24 -0
  134. package/dist/run/raw-request.d.ts.map +1 -0
  135. package/dist/run/raw-request.js +69 -0
  136. package/dist/run/raw-schema.d.ts +76 -0
  137. package/dist/run/raw-schema.d.ts.map +1 -0
  138. package/dist/run/raw-schema.js +166 -0
  139. package/dist/run/raw-search-cost.d.ts +49 -0
  140. package/dist/run/raw-search-cost.d.ts.map +1 -0
  141. package/dist/run/raw-search-cost.js +79 -0
  142. package/dist/run/raw-support.d.ts +64 -6
  143. package/dist/run/raw-support.d.ts.map +1 -1
  144. package/dist/run/raw-support.js +84 -11
  145. package/dist/run/raw.d.ts +25 -26
  146. package/dist/run/raw.d.ts.map +1 -1
  147. package/dist/run/raw.js +30 -351
  148. package/dist/run/record-attempt.d.ts +8 -0
  149. package/dist/run/record-attempt.d.ts.map +1 -1
  150. package/dist/run/record-attempt.js +26 -12
  151. package/dist/run/record-call.d.ts +104 -0
  152. package/dist/run/record-call.d.ts.map +1 -0
  153. package/dist/run/record-call.js +277 -0
  154. package/dist/run/repair-attempt.d.ts +68 -0
  155. package/dist/run/repair-attempt.d.ts.map +1 -0
  156. package/dist/run/repair-attempt.js +180 -0
  157. package/dist/run/resolve-destination.d.ts +49 -0
  158. package/dist/run/resolve-destination.d.ts.map +1 -0
  159. package/dist/run/resolve-destination.js +76 -0
  160. package/dist/run/routing-docs.d.ts.map +1 -1
  161. package/dist/run/routing-docs.js +9 -4
  162. package/dist/run/run.d.ts +30 -1
  163. package/dist/run/run.d.ts.map +1 -1
  164. package/dist/run/run.js +75 -148
  165. package/dist/run/telemetry-row.d.ts +92 -0
  166. package/dist/run/telemetry-row.d.ts.map +1 -0
  167. package/dist/run/telemetry-row.js +81 -0
  168. package/dist/run/validate.d.ts +12 -1
  169. package/dist/run/validate.d.ts.map +1 -1
  170. package/dist/run/validate.js +31 -0
  171. package/dist/run/web-search-pricing.d.ts +43 -0
  172. package/dist/run/web-search-pricing.d.ts.map +1 -0
  173. package/dist/run/web-search-pricing.js +56 -0
  174. package/dist/settings/grading-guide.d.ts +27 -1
  175. package/dist/settings/grading-guide.d.ts.map +1 -1
  176. package/dist/status.d.ts +6 -0
  177. package/dist/status.d.ts.map +1 -1
  178. package/dist/status.js +4 -1
  179. package/dist/telemetry/artifact-store.d.ts.map +1 -1
  180. package/dist/telemetry/artifact-store.js +11 -0
  181. package/dist/telemetry/attempt-meta.d.ts +66 -1
  182. package/dist/telemetry/attempt-meta.d.ts.map +1 -1
  183. package/dist/telemetry/attempt-meta.js +27 -1
  184. package/dist/telemetry/exporter-setup.d.ts +2 -0
  185. package/dist/telemetry/exporter-setup.d.ts.map +1 -1
  186. package/dist/telemetry/exporter-setup.js +6 -1
  187. package/dist/telemetry/grade-mappers.d.ts +5 -2
  188. package/dist/telemetry/grade-mappers.d.ts.map +1 -1
  189. package/dist/telemetry/grade-mappers.js +8 -2
  190. package/dist/telemetry/grades-sql.d.ts +4 -1
  191. package/dist/telemetry/grades-sql.d.ts.map +1 -1
  192. package/dist/telemetry/grades-sql.js +26 -3
  193. package/dist/telemetry/ingest-protocol.d.ts +26 -2
  194. package/dist/telemetry/ingest-protocol.d.ts.map +1 -1
  195. package/dist/telemetry/ingest-protocol.js +32 -29
  196. package/dist/telemetry/lanes.d.ts +31 -0
  197. package/dist/telemetry/lanes.d.ts.map +1 -0
  198. package/dist/telemetry/lanes.js +41 -0
  199. package/dist/telemetry/org-identity.d.ts +47 -0
  200. package/dist/telemetry/org-identity.d.ts.map +1 -0
  201. package/dist/telemetry/org-identity.js +100 -0
  202. package/dist/telemetry/route-registration.d.ts +48 -0
  203. package/dist/telemetry/route-registration.d.ts.map +1 -0
  204. package/dist/telemetry/route-registration.js +77 -0
  205. package/dist/telemetry/sinks.d.ts +10 -1
  206. package/dist/telemetry/sinks.d.ts.map +1 -1
  207. package/dist/telemetry/sinks.js +52 -6
  208. package/dist/telemetry/store-migrations.d.ts.map +1 -1
  209. package/dist/telemetry/store-migrations.js +13 -0
  210. package/dist/tenancy/api-key-format.d.ts +16 -1
  211. package/dist/tenancy/api-key-format.d.ts.map +1 -1
  212. package/dist/tenancy/api-key-format.js +17 -0
  213. package/dist/types/provider.d.ts +20 -3
  214. package/dist/types/provider.d.ts.map +1 -1
  215. package/dist/types/provider.js +1 -0
  216. package/dist/types/route.d.ts +76 -0
  217. package/dist/types/route.d.ts.map +1 -1
  218. package/dist/types/telemetry.d.ts +30 -2
  219. package/dist/types/telemetry.d.ts.map +1 -1
  220. package/docs/agent-skill/SKILL.md +75 -5
  221. package/docs/instrumentation.md +98 -36
  222. package/docs/llms.txt +96 -16
  223. package/docs/managed-serving.md +150 -0
  224. package/docs/mcp-oracle.md +75 -2
  225. package/docs/migration-playbook.md +5 -4
  226. package/docs/quickstart.md +169 -83
  227. package/package.json +3 -2
  228. package/registry/registry.json +82 -0
  229. package/dist/feedback/feedback.d.ts +0 -35
  230. package/dist/feedback/feedback.d.ts.map +0 -1
  231. package/dist/feedback/feedback.js +0 -39
package/dist/index.js CHANGED
@@ -24,11 +24,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
24
24
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.bundleFromResolved = exports.runStream = exports.evalCaseCaptureStore = exports.selectEvalCaseCaptures = exports.runBakeoffFromEvalCases = exports.resolveDeterministicQuality = exports.fieldAccuracy = exports.exactMatch = exports.KEY_SHAPED_PREFIXES = exports.containsKeyShapedString = exports.scrubSecrets = exports.hasScope = exports.parseScopes = exports.redactApiKey = exports.looksLikeApiKey = exports.hashApiKeySecret = exports.API_KEY_SECRET_BYTES = exports.API_KEY_SCOPES = exports.API_KEY_PREFIX = exports.resolveArtifactsConfig = exports.resolveOtlpConfig = exports.parseOtlpHeaders = exports.decodeOtlpProtobufTraces = exports.looksLikeLogsPayload = exports.normalizeOtlpTraces = exports.startOtlpEmitterIfConfigured = exports.createOtlpEmitter = exports.TRACEPARENT_TAG = exports.parseTraceparent = exports.buildExportTraceRequest = exports.inferenceToSpan = exports.SEMCONV_VERSION = exports.SinkSendError = exports.createDirectSink = exports.createApiSink = exports.createTelemetryExporter = exports.RESERVED_TAG_KEYS = exports.resolvePipelineSha = exports.reservedTagNearMisses = exports.renderRequestForHash = exports.sanitizeMetaForWire = exports.isMetaSafeString = exports.summarizeAttemptMeta = exports.DEFAULT_INGEST_URL = exports.INGEST_PROTOCOL_VERSION_V1 = exports.INGEST_PROTOCOL_VERSION = exports.INGEST_PATH = exports.foreignOrgGrades = exports.stampBatch = exports.loadConfigFromEnv = void 0;
28
- exports.RigFailureError = exports.extractCitations = exports.createTavilySearchProvider = exports.sampleQuality = exports.pairedRegret = exports.wilson95 = exports.aggregateVariantMetrics = exports.OUTPUT_MAX_BYTES = exports.retentionExpiry = exports.truncateOutput = exports.selectArmsToKeep = exports.buildBakeoffSamples = exports.createBakeoffSamplesClient = exports.deriveSwapDirection = exports.bakeoffEvidence = exports.computeProposal = exports.mirrorBakeoff = exports.runBakeoff = exports.replayVariant = exports.openTelemetryStore = exports.openCaptureStore = exports.SSE_DONE = exports.MODELRIG_REQUEST_HEADERS = exports.MODELRIG_HEADERS = exports.GATEWAY_PROTOCOL_VERSION = exports.MODELS_PATH = exports.CHAT_COMPLETIONS_PATH = exports.classifyLane = exports.ALL_CAPABILITY_FLAGS = exports.PROVIDER_IDS = exports.RAW_ONLY_FIX_HINT = exports.rawOnlyRouteFailure = exports.requireRoutesDir = exports.runRawStream = exports.runRaw = exports.resolveCallConfigForRun = exports.hashUnitKey = exports.armName = exports.drawArm = exports.narrowExperiment = exports.pinFromResolved = exports.parseCallConfig = exports.narrowCallConfigPin = exports.getCallConfig = exports.createCallConfigResolver = exports.createApiCallConfigFetcher = exports.applyCallConfig = exports.assertMirrorSafe = exports.hashResolvedBundle = exports.resolveRouteBundle = void 0;
29
- exports.seededCachePolicyProviders = exports.getCachePolicy = exports.DEFAULT_CACHE_HYSTERESIS = exports.classifyCacheVerdict = exports.effectiveInputRate = exports.estimateCostUsd = exports.getPricingV2 = exports.getPricing = exports.resolveCandidates = exports.OPENAI_COMPAT_HOSTS = exports.shapeFireworksModelId = exports.classifyCompatFailure = exports.buildOpenAICompatParams = exports.createOpenAICompatAdapter = exports.createGrokAdapter = exports.createAnthropicAdapter = exports.createDeepSeekAdapter = exports.createOpenAIAdapter = exports.GEMINI_THINKING_CAPABLE_MODELS = exports.createGeminiAdapter = exports.PROVIDER_KEY_ENV = exports.serveabilityWarnings = exports.checkServeability = exports.writeRouteDraft = exports.buildRouteDraft = exports.splitModelKey = exports.seedCandidates = exports.loadRegistryRows = exports.signatureFor = exports.PROVIDER_SIGNATURES = exports.readObjectLiteral = exports.findCallSitesInText = exports.scanRepoForCallSites = exports.capabilitiesFor = exports.routeNameFor = exports.buildMigrationMarkdown = exports.runInit = exports.renderConfigErrorForTerminal = exports.describeConfigFailure = exports.teachConfigError = exports.classifyConfigProblem = exports.CONFIG_TEACHING = exports.mergeLoadedRoutes = exports.loadRoutesWithExtra = exports.loadRoutes = exports.RouteConfigError = exports.renderFailureForTerminal = exports.teach = exports.FAILURE_TEACHING = exports.isRigFailure = void 0;
30
- exports.rollupConformRate = exports.evaluateConformDegradation = exports.runMonitorCycle = exports.assertTransition = exports.createProposalsClient = exports.MONITOR_SOURCE_PREFIX = exports.MONITOR_CYCLE_MARKER = exports.REGRET_MONITOR_MARGIN = exports.REGRET_MONITOR_MIN_N = exports.REGRET_MONITOR_BASELINE_DAYS = exports.REGRET_MONITOR_WINDOW_DAYS = exports.createRegretMonitorReads = exports.regretMonitorConfig = exports.cyclePointFromArtifact = exports.aggregateRegretBand = exports.evaluateRegretDrift = exports.runRegretMonitorCycle = exports.evaluateUpgradeOpportunities = exports.explainCacheContext = exports.PROPOSAL_TTL_DAYS = exports.regretBreachTriggerHash = exports.upgradeTriggerHash = exports.manualChallengerTriggerHash = exports.triggerHash = exports.evaluateEvents = exports.RUNG1_MIN_GRADES = exports.computeCoverage = exports.computeParity = exports.factsUnderCredential = exports.factsFor = exports.PROBE_FRESHNESS_SLO_DAYS = exports.stalenessSentence = exports.probeFreshness = exports.callNotesFor = exports.evaluateChallengerEligibility = exports.requirementPredicates = exports.PREDICATE_GLOSS = exports.ALL_CAPABILITY_PREDICATES = exports.explainEmptySelection = exports.hasCapability = exports.selectModels = exports.parseCapabilityQuery = exports.capabilityFactsFromEntry = exports.loadRegistryFacts = exports.fingerprintSchema = exports.loadManifest = exports.SNAPSHOT_BASIS = exports.describePricingV2 = exports.tierRates = exports.synthesizeFromFlat = void 0;
31
- exports.computeOdometer = exports.createSwapsClient = exports.executeSwap = exports.trialVariantName = exports.buildDeclareTrialChange = exports.buildRestoreYaml = exports.buildSwapChange = exports.runTelemetryQuery = exports.RESERVED_DIMENSION_NAMES = exports.METRIC_COLUMNS = exports.DIMENSION_COLUMNS = exports.sinceIsoFor = exports.savedQueryById = exports.SAVED_QUERIES = exports.ANALYTICS_SCAN_CAP = exports.selectableColumnsAreMetaSafe = exports.planAnalyticsRead = exports.evaluateAnalyticsQuery = exports.describeAnalyticsSchema = exports.parseQuery = exports.QueryGrammarError = exports.compileQuery = exports.writePriorsCells = exports.aggregatePairwiseFromTelemetry = exports.aggregatePriors = exports.DEFAULT_WATCH_MONTHLY_USD = exports.watchEnvelopeKey = exports.reserveWatchBudget = exports.WATCH_STATE_KEY = exports.createFileWatchStateStore = exports.createControlPlaneWatchStateStore = exports.createWatchStateStore = exports.saveWatchState = exports.loadWatchState = exports.computeWatchEvents = exports.buildPriceUniverse = exports.runWatchCycle = exports.DEFAULT_MONITOR_CONFIG = exports.createMonitorReads = void 0;
27
+ exports.redactApiKey = exports.looksLikeApiKey = exports.hashApiKeySecret = exports.API_KEY_SECRET_BYTES = exports.API_KEY_SCOPES = exports.API_KEY_PREFIX = exports.resolveArtifactsConfig = exports.createToolRegistry = exports.SlotResolutionError = exports.assemblePrompt = exports.createEmbeddedPrompts = exports.createPromptResolver = exports.parseServedPrompt = exports.createPromptCache = exports.createApiPromptFetcher = exports.promptTemplateSha = exports.normalizeManifest = exports.parseAuthoringDoc = exports.assertValidManifest = exports.validateManifest = exports.resolveOtlpConfig = exports.parseOtlpHeaders = exports.decodeOtlpProtobufTraces = exports.looksLikeLogsPayload = exports.normalizeOtlpTraces = exports.startOtlpEmitterIfConfigured = exports.createOtlpEmitter = exports.TRACEPARENT_TAG = exports.parseTraceparent = exports.buildExportTraceRequest = exports.inferenceToSpan = exports.SEMCONV_VERSION = exports.SinkSendError = exports.createDirectSink = exports.createApiSink = exports.createTelemetryExporter = exports.RESERVED_TAG_KEYS = exports.resolvePipelineSha = exports.reservedTagNearMisses = exports.renderRequestForHash = exports.sanitizeMetaForWire = exports.isMetaSafeString = exports.summarizeAttemptMeta = exports.DEFAULT_INGEST_URL = exports.INGEST_PROTOCOL_VERSION_V1 = exports.INGEST_PROTOCOL_VERSION = exports.INGEST_PATH = exports.foreignOrgGrades = exports.stampBatch = exports.loadConfigFromEnv = void 0;
28
+ exports.SSE_DONE = exports.MODELRIG_REQUEST_HEADERS = exports.MODELRIG_HEADERS = exports.GATEWAY_PROTOCOL_VERSION = exports.MODELS_PATH = exports.CHAT_COMPLETIONS_PATH = exports.classifyLane = exports.ALL_CAPABILITY_FLAGS = exports.PROVIDER_IDS = exports.RAW_ONLY_FIX_HINT = exports.rawOnlyRouteFailure = exports.requireRoutesDir = exports.RECORDED_TOOLTIP = exports.RECORDED_BADGE = exports.EXTERNAL_LANE = exports.RAW_LANE = exports.callLaneOf = exports.isRoutedLane = exports.runRawStream = exports.runRaw = exports.resolveCallConfigForRun = exports.hashUnitKey = exports.armName = exports.drawArm = exports.narrowExperiment = exports.pinFromResolved = exports.parseCallConfig = exports.narrowCallConfigPin = exports.getCallConfig = exports.createCallConfigResolver = exports.createApiCallConfigFetcher = exports.applyCallConfig = exports.assertMirrorSafe = exports.hashResolvedBundle = exports.resolveRouteBundle = exports.bundleFromResolved = exports.runStream = exports.evalCaseCaptureStore = exports.selectEvalCaseCaptures = exports.runBakeoffFromEvalCases = exports.extractEvidenceQuotes = exports.groundednessScore = exports.resolveDeterministicQuality = exports.fieldAccuracy = exports.exactMatch = exports.KEY_SHAPED_PREFIXES = exports.containsKeyShapedString = exports.scrubSecrets = exports.hasScope = exports.parseScopes = void 0;
29
+ exports.serveabilityWarnings = exports.checkServeability = exports.writeRouteDraft = exports.buildRouteDraft = exports.splitModelKey = exports.seedCandidates = exports.loadRegistryRows = exports.signatureFor = exports.PROVIDER_SIGNATURES = exports.readObjectLiteral = exports.findCallSitesInText = exports.scanRepoForCallSites = exports.capabilitiesFor = exports.routeNameFor = exports.buildMigrationMarkdown = exports.runInit = exports.renderConfigErrorForTerminal = exports.describeConfigFailure = exports.teachConfigError = exports.classifyConfigProblem = exports.CONFIG_TEACHING = exports.mergeLoadedRoutes = exports.loadRoutesWithExtra = exports.loadRoutes = exports.RouteConfigError = exports.renderFailureForTerminal = exports.teach = exports.FAILURE_TEACHING = exports.isRigFailure = exports.RigFailureError = exports.extractCitations = exports.createTavilySearchProvider = exports.sampleQuality = exports.pairedRegret = exports.wilson95 = exports.aggregateVariantMetrics = exports.OUTPUT_MAX_BYTES = exports.retentionExpiry = exports.truncateOutput = exports.selectArmsToKeep = exports.buildBakeoffSamples = exports.createBakeoffSamplesClient = exports.deriveSwapDirection = exports.bakeoffEvidence = exports.computeProposal = exports.mirrorBakeoff = exports.runBakeoff = exports.replayVariant = exports.openTelemetryStore = exports.openCaptureStore = void 0;
30
+ exports.RUNG1_MIN_GRADES = exports.computeCoverage = exports.computeParity = exports.factsUnderCredential = exports.factsFor = exports.PROBE_FRESHNESS_SLO_DAYS = exports.stalenessSentence = exports.probeFreshness = exports.callNotesFor = exports.evaluateChallengerEligibility = exports.requirementPredicates = exports.PREDICATE_GLOSS = exports.ALL_CAPABILITY_PREDICATES = exports.explainEmptySelection = exports.hasCapability = exports.selectModels = exports.parseCapabilityQuery = exports.capabilityFactsFromEntry = exports.loadRegistryFacts = exports.fingerprintSchema = exports.loadManifest = exports.SNAPSHOT_BASIS = exports.describePricingV2 = exports.tierRates = exports.synthesizeFromFlat = exports.seededCachePolicyProviders = exports.getCachePolicy = exports.DEFAULT_CACHE_HYSTERESIS = exports.classifyCacheVerdict = exports.effectiveInputRate = exports.estimateCostUsd = exports.getPricingV2 = exports.getPricing = exports.resolveCandidates = exports.OPENAI_COMPAT_HOSTS = exports.shapeFireworksModelId = exports.classifyCompatFailure = exports.buildOpenAICompatParams = exports.createOpenAICompatAdapter = exports.createGrokAdapter = exports.createAnthropicAdapter = exports.createDeepSeekAdapter = exports.createOpenAIAdapter = exports.destinationSupported = exports.servedDestinations = exports.DEFAULT_DESTINATION = exports.DESTINATIONS = exports.GEMINI_THINKING_CAPABLE_MODELS = exports.createGeminiAdapter = exports.PROVIDER_KEY_ENV = void 0;
31
+ exports.ANALYTICS_SCAN_CAP = exports.selectableColumnsAreMetaSafe = exports.planAnalyticsRead = exports.evaluateAnalyticsQuery = exports.describeAnalyticsSchema = exports.parseQuery = exports.QueryGrammarError = exports.compileQuery = exports.writePriorsCells = exports.aggregatePairwiseFromTelemetry = exports.aggregatePriors = exports.DEFAULT_WATCH_MONTHLY_USD = exports.watchEnvelopeKey = exports.reserveWatchBudget = exports.WATCH_STATE_KEY = exports.createFileWatchStateStore = exports.createControlPlaneWatchStateStore = exports.createWatchStateStore = exports.saveWatchState = exports.loadWatchState = exports.computeWatchEvents = exports.buildPriceUniverse = exports.runWatchCycle = exports.DEFAULT_MONITOR_CONFIG = exports.createMonitorReads = exports.rollupConformRate = exports.evaluateConformDegradation = exports.runMonitorCycle = exports.assertTransition = exports.createProposalsClient = exports.MONITOR_SOURCE_PREFIX = exports.MONITOR_CYCLE_MARKER = exports.REGRET_MONITOR_MARGIN = exports.REGRET_MONITOR_MIN_N = exports.REGRET_MONITOR_BASELINE_DAYS = exports.REGRET_MONITOR_WINDOW_DAYS = exports.createRegretMonitorReads = exports.regretMonitorConfig = exports.cyclePointFromArtifact = exports.aggregateRegretBand = exports.evaluateRegretDrift = exports.runRegretMonitorCycle = exports.evaluateUpgradeOpportunities = exports.explainCacheContext = exports.PROPOSAL_TTL_DAYS = exports.regretBreachTriggerHash = exports.upgradeTriggerHash = exports.manualChallengerTriggerHash = exports.triggerHash = exports.evaluateEvents = void 0;
32
+ exports.computeOdometer = exports.createSwapsClient = exports.executeSwap = exports.trialVariantName = exports.buildDeclareTrialChange = exports.buildRestoreYaml = exports.buildSwapChange = exports.runTelemetryQuery = exports.RESERVED_DIMENSION_NAMES = exports.METRIC_COLUMNS = exports.DIMENSION_COLUMNS = exports.sinceIsoFor = exports.savedQueryById = exports.SAVED_QUERIES = void 0;
32
33
  exports.createRig = createRig;
33
34
  const build_adapters_1 = require("./adapters/build-adapters");
34
35
  const config_1 = require("./config");
@@ -36,9 +37,11 @@ const rawonly_1 = require("./run/rawonly");
36
37
  const resolved_bundle_1 = require("./routes/resolved-bundle");
37
38
  const serveability_1 = require("./routes/serveability");
38
39
  const manifest_1 = require("./routes/manifest");
40
+ const tools_register_1 = require("./prompts/tools-register");
39
41
  const run_1 = require("./run/run");
40
42
  const stream_1 = require("./run/stream");
41
43
  const raw_1 = require("./run/raw");
44
+ const record_call_1 = require("./run/record-call");
42
45
  const node_path_1 = require("node:path");
43
46
  const node_os_1 = require("node:os");
44
47
  const grounding_1 = require("./run/grounding");
@@ -150,6 +153,7 @@ function createRig(config) {
150
153
  artifactsEnabled,
151
154
  artifactStore,
152
155
  ...(onArtifactsFlushed !== undefined ? { onArtifactsFlushed } : {}),
156
+ ...(config.expectOrg !== undefined ? { expectOrg: config.expectOrg } : {}),
153
157
  })
154
158
  : null;
155
159
  // Boot banner (§2) + one-time deprecation warnings (§3): posture, plus a loud
@@ -171,6 +175,16 @@ function createRig(config) {
171
175
  captures,
172
176
  search,
173
177
  settings, // §1.5 resolver (null local-only); capture-WRITE gate consults it
178
+ managedServingEnabled: config.managedServing === true, // U3 (D-2): `config.managedServing`, set IN CODE via createRig (NOT an env var); default off ⇒ `modelrig-served` fails closed pre-dispatch
179
+ // K1 (managed-serving-keyless §2/§3): the hosted-gateway serving transport,
180
+ // resolved from the SAME `api`-mode export the telemetry sink uses — the
181
+ // ingest host (MODELRIG_INGEST_URL ‖ default) as `baseUrl`, the `rig_sk_` key
182
+ // as the Bearer credential (NO provider key ever). Absent for local-only /
183
+ // direct rigs ⇒ a `modelrig-served` run fails closed (no control plane to
184
+ // serve it), never a silent `direct` fall back. Read ONLY on the served path.
185
+ ...(config.export?.mode === "api"
186
+ ? { serve: { baseUrl: config.export.ingestUrl, apiKey: config.export.apiKey } }
187
+ : {}),
174
188
  ...(config.envelopeBudgetUsd !== undefined
175
189
  ? { envelopeBudgetUsd: config.envelopeBudgetUsd }
176
190
  : {}),
@@ -197,11 +211,16 @@ function createRig(config) {
197
211
  // Bake-off review-sample sink (addendum A3) — direct mode only (see buildDirectSamplesSink; undefined for api/local rigs). S7: scrubs input+output with the task ScrubMode before persist.
198
212
  const samplesSink = config.export?.mode === "direct" ? (0, samples_1.buildDirectSamplesSink)({ ...config.export, resolver: settings, defaultScrub: config.artifacts?.content !== undefined ? config_1.DEFAULT_CONTENT_SCRUB_MODE : "off" }) : undefined;
199
213
  const resolveReferenceAuto = (0, reference_1.makeReferenceAutoResolver)(config.registryPath); // RB-1 reference:auto
214
+ // PSR-2b (spec §4 ADJ-2): the client-fill tool registry backing rig.tools.
215
+ // One per rig; empty until the app calls rig.tools.register. In-process only —
216
+ // no network/telemetry reach, so bound tool keys never leave the process.
217
+ const tools = (0, tools_register_1.createToolRegistry)();
200
218
  return {
201
219
  serveability,
202
220
  capabilities,
203
221
  searchAvailable: search !== null && search !== undefined,
204
222
  artifacts: artifactNamespace,
223
+ tools,
205
224
  exporterStats: () => (exporter !== null ? exporter.stats() : { poisonSkipped: {} }),
206
225
  status: () => (0, status_1.buildRigStatus)(config, settings?.snapshot() ?? new Map(), undefined, settings?.posture() ?? null),
207
226
  run(route, opts) {
@@ -232,6 +251,7 @@ function createRig(config) {
232
251
  runRawStream(input) {
233
252
  return (0, raw_1.runRawStream)(rawDeps, input);
234
253
  },
254
+ recordCall: (input) => (0, record_call_1.recordCall)(rawDeps, input),
235
255
  grade: gradeApi.grade,
236
256
  replay(route, opts) {
237
257
  return (0, replay_1.replayVariant)(deps, captureStoreForReplay(), {
@@ -363,6 +383,33 @@ Object.defineProperty(exports, "resolveOtlpConfig", { enumerable: true, get: fun
363
383
  // Artifact / execution-graph namespace (Expansion E2) — the barrel re-exports
364
384
  // step/run-context/types; the run lifecycle is bound per-rig via rig.artifacts.
365
385
  __exportStar(require("./artifacts"), exports);
386
+ // PSR-1 — the structure-only assembly-manifest model (spec §2.1), re-exported
387
+ // EXPLICITLY from the package entry (not only transitively via the artifacts
388
+ // star-export) so an external consumer resolving the built `dist/index.d.ts`
389
+ // gets `Manifest`/`Slot` + the validators on the public surface unambiguously.
390
+ var manifest_2 = require("./prompts/manifest");
391
+ Object.defineProperty(exports, "validateManifest", { enumerable: true, get: function () { return manifest_2.validateManifest; } });
392
+ Object.defineProperty(exports, "assertValidManifest", { enumerable: true, get: function () { return manifest_2.assertValidManifest; } });
393
+ Object.defineProperty(exports, "parseAuthoringDoc", { enumerable: true, get: function () { return manifest_2.parseAuthoringDoc; } });
394
+ Object.defineProperty(exports, "normalizeManifest", { enumerable: true, get: function () { return manifest_2.normalizeManifest; } });
395
+ // PSR-2 — the content-hash id (`template_sha`) the version store dedupes on.
396
+ var version_hash_1 = require("./prompts/version-hash");
397
+ Object.defineProperty(exports, "promptTemplateSha", { enumerable: true, get: function () { return version_hash_1.promptTemplateSha; } });
398
+ // PSR-2b — SDK fetch-by-label + content cache + fail-open resolver + the
399
+ // client-fill engine (slot resolver) + the tool-binding registry (rig.tools).
400
+ // All client-side / in-process (spec §3–§4).
401
+ var prompt_fetch_1 = require("./prompts/prompt-fetch");
402
+ Object.defineProperty(exports, "createApiPromptFetcher", { enumerable: true, get: function () { return prompt_fetch_1.createApiPromptFetcher; } });
403
+ Object.defineProperty(exports, "createPromptCache", { enumerable: true, get: function () { return prompt_fetch_1.createPromptCache; } });
404
+ Object.defineProperty(exports, "parseServedPrompt", { enumerable: true, get: function () { return prompt_fetch_1.parseServedPrompt; } });
405
+ var prompt_resolve_1 = require("./prompts/prompt-resolve");
406
+ Object.defineProperty(exports, "createPromptResolver", { enumerable: true, get: function () { return prompt_resolve_1.createPromptResolver; } });
407
+ Object.defineProperty(exports, "createEmbeddedPrompts", { enumerable: true, get: function () { return prompt_resolve_1.createEmbeddedPrompts; } });
408
+ var slot_resolver_1 = require("./prompts/slot-resolver");
409
+ Object.defineProperty(exports, "assemblePrompt", { enumerable: true, get: function () { return slot_resolver_1.assemblePrompt; } });
410
+ Object.defineProperty(exports, "SlotResolutionError", { enumerable: true, get: function () { return slot_resolver_1.SlotResolutionError; } });
411
+ var tools_register_2 = require("./prompts/tools-register");
412
+ Object.defineProperty(exports, "createToolRegistry", { enumerable: true, get: function () { return tools_register_2.createToolRegistry; } });
366
413
  var config_4 = require("./config");
367
414
  Object.defineProperty(exports, "resolveArtifactsConfig", { enumerable: true, get: function () { return config_4.resolveArtifactsConfig; } });
368
415
  __exportStar(require("./detect/detector"), exports); // shared Detector interface (screening A1, types-only)
@@ -391,6 +438,9 @@ var quality_1 = require("./bakeoff/quality"); // LRE-1b graders
391
438
  Object.defineProperty(exports, "exactMatch", { enumerable: true, get: function () { return quality_1.exactMatch; } });
392
439
  Object.defineProperty(exports, "fieldAccuracy", { enumerable: true, get: function () { return quality_1.fieldAccuracy; } });
393
440
  Object.defineProperty(exports, "resolveDeterministicQuality", { enumerable: true, get: function () { return quality_1.resolveDeterministicQuality; } });
441
+ var groundedness_1 = require("./bakeoff/groundedness"); // call-QA F3/G6 evidence-grounded grader
442
+ Object.defineProperty(exports, "groundednessScore", { enumerable: true, get: function () { return groundedness_1.groundednessScore; } });
443
+ Object.defineProperty(exports, "extractEvidenceQuotes", { enumerable: true, get: function () { return groundedness_1.extractEvidenceQuotes; } });
394
444
  // LRE-1b server runner: the from-eval-cases orchestrator + injected-store contract so modelrig-server drives a cross-plane golden bake-off with the rig's keyed adapters (rig.bakeoffFromEvalCasesWith).
395
445
  var eval_cases_1 = require("./bakeoff/eval-cases");
396
446
  Object.defineProperty(exports, "runBakeoffFromEvalCases", { enumerable: true, get: function () { return eval_cases_1.runBakeoffFromEvalCases; } });
@@ -423,6 +473,13 @@ Object.defineProperty(exports, "resolveCallConfigForRun", { enumerable: true, ge
423
473
  var raw_2 = require("./run/raw");
424
474
  Object.defineProperty(exports, "runRaw", { enumerable: true, get: function () { return raw_2.runRaw; } });
425
475
  Object.defineProperty(exports, "runRawStream", { enumerable: true, get: function () { return raw_2.runRawStream; } });
476
+ var lanes_1 = require("./telemetry/lanes");
477
+ Object.defineProperty(exports, "isRoutedLane", { enumerable: true, get: function () { return lanes_1.isRoutedLane; } });
478
+ Object.defineProperty(exports, "callLaneOf", { enumerable: true, get: function () { return lanes_1.callLaneOf; } });
479
+ Object.defineProperty(exports, "RAW_LANE", { enumerable: true, get: function () { return lanes_1.RAW_LANE; } });
480
+ Object.defineProperty(exports, "EXTERNAL_LANE", { enumerable: true, get: function () { return lanes_1.EXTERNAL_LANE; } });
481
+ Object.defineProperty(exports, "RECORDED_BADGE", { enumerable: true, get: function () { return lanes_1.RECORDED_BADGE; } });
482
+ Object.defineProperty(exports, "RECORDED_TOOLTIP", { enumerable: true, get: function () { return lanes_1.RECORDED_TOOLTIP; } });
426
483
  // CE-8 runRaw-only (routesDir: null): the string-narrowing guard route-required
427
484
  // consumers (server, oracle) use, plus the teaching failure it throws.
428
485
  var rawonly_2 = require("./run/rawonly");
@@ -525,8 +582,14 @@ Object.defineProperty(exports, "PROVIDER_KEY_ENV", { enumerable: true, get: func
525
582
  var gemini_1 = require("./adapters/gemini");
526
583
  Object.defineProperty(exports, "createGeminiAdapter", { enumerable: true, get: function () { return gemini_1.createGeminiAdapter; } });
527
584
  Object.defineProperty(exports, "GEMINI_THINKING_CAPABLE_MODELS", { enumerable: true, get: function () { return gemini_1.GEMINI_THINKING_CAPABLE_MODELS; } });
528
- // CE-9 R5/R6 — the raw-lane provider × knob support matrix (single source of truth for the guard AND the docs) + `rawKnobSupport(p)` so customers don't duplicate our provider lists.
585
+ // CE-9 R5/R6 + Unified Route U1 — the one provider × capability vocabulary (single source of truth for the guard, the docs matrix, AND the serving-destination lookups) + `rawKnobSupport(p)` / `destinationSupport(p)` so customers don't duplicate our provider lists.
529
586
  __exportStar(require("./run/raw-support"), exports);
587
+ // Unified Route U1 (ruling D-2) — the serving `destination` vocabulary; its lookups read the `serving` cell of the capability table above (one source of truth). Managed serving is gated behind the `config.managedServing` flag (set in code via createRig, default off; U3).
588
+ var destination_1 = require("./run/destination");
589
+ Object.defineProperty(exports, "DESTINATIONS", { enumerable: true, get: function () { return destination_1.DESTINATIONS; } });
590
+ Object.defineProperty(exports, "DEFAULT_DESTINATION", { enumerable: true, get: function () { return destination_1.DEFAULT_DESTINATION; } });
591
+ Object.defineProperty(exports, "servedDestinations", { enumerable: true, get: function () { return destination_1.servedDestinations; } });
592
+ Object.defineProperty(exports, "destinationSupported", { enumerable: true, get: function () { return destination_1.destinationSupported; } });
530
593
  var openai_1 = require("./adapters/openai");
531
594
  Object.defineProperty(exports, "createOpenAIAdapter", { enumerable: true, get: function () { return openai_1.createOpenAIAdapter; } });
532
595
  var deepseek_1 = require("./adapters/deepseek");
@@ -561,8 +624,8 @@ Object.defineProperty(exports, "synthesizeFromFlat", { enumerable: true, get: fu
561
624
  Object.defineProperty(exports, "tierRates", { enumerable: true, get: function () { return pricing_shape_1.tierRates; } });
562
625
  Object.defineProperty(exports, "describePricingV2", { enumerable: true, get: function () { return pricing_shape_1.describePricingV2; } });
563
626
  Object.defineProperty(exports, "SNAPSHOT_BASIS", { enumerable: true, get: function () { return pricing_shape_1.SNAPSHOT_BASIS; } });
564
- var manifest_2 = require("./routes/manifest");
565
- Object.defineProperty(exports, "loadManifest", { enumerable: true, get: function () { return manifest_2.loadManifest; } });
627
+ var manifest_3 = require("./routes/manifest");
628
+ Object.defineProperty(exports, "loadManifest", { enumerable: true, get: function () { return manifest_3.loadManifest; } });
566
629
  var fingerprint_1 = require("./registry/fingerprint");
567
630
  Object.defineProperty(exports, "fingerprintSchema", { enumerable: true, get: function () { return fingerprint_1.fingerprintSchema; } });
568
631
  var facts_2 = require("./registry/facts");
@@ -0,0 +1,128 @@
1
+ /**
2
+ * PSR-1 — the assembly-manifest model (spec §2.1, authoring-guide §2–§3).
3
+ *
4
+ * A prompt in ModelRig is TWO things: the authored `template` text and the
5
+ * `manifest` — the ordered recipe for assembling the final prompt at call time.
6
+ * This module is the **structure-only** manifest: its `Slot[]` records HOW each
7
+ * part of the prompt is filled, never the filled value (the privacy guarantee —
8
+ * a `dynamic·tool` slot names `search_tickets`, never what it returned).
9
+ *
10
+ * PSR-1 is ZERO-DDL and validate-only: nothing here serves or stores a version.
11
+ * It exists to prove the model against real prompts (the InferWealth inference)
12
+ * and a hand-authored doc (ADJ-1) before PSR-2 builds the `prompt_versions`
13
+ * store. Pure + dependency-free (no YAML dep — the authoring doc is accepted as
14
+ * JSON per §7; YAML is an optional future add).
15
+ */
16
+ /** A slot is either authored text (`static`) or filled at run time (`dynamic`). */
17
+ export type SlotKind = "static" | "dynamic";
18
+ /** How a `dynamic` slot is filled (authoring-guide §2). Never the value. */
19
+ export type DynamicSourceKind = "tool" | "cache" | "upstream" | "variable";
20
+ /** Cache placement for a slot's content — `prefix` puts it at the front so the
21
+ * provider caches it across calls (maps to inferences.cache_key / prefix
22
+ * fingerprint); `none` is uncached. */
23
+ export type CachePolicy = "prefix" | "none";
24
+ /** Which authored field a `static` slot pulls its text from when it is not
25
+ * inlined (authoring-guide §3: the first static slot is `from: system`, the
26
+ * task instructions are `from: template`). */
27
+ export type StaticFrom = "system" | "template";
28
+ /** A `dynamic` slot's fill declaration — the source kind, the reference it
29
+ * resolves (tool name / cache handle / upstream step key / variable name), and
30
+ * an optional cache policy. Structure only; carries no resolved data (D6). */
31
+ export interface DynamicSource {
32
+ readonly kind: DynamicSourceKind;
33
+ readonly ref: string;
34
+ readonly cache_policy?: CachePolicy;
35
+ }
36
+ /**
37
+ * One slot in the assembly manifest.
38
+ *
39
+ * A `static` slot carries EITHER inline `text` OR a `from` reference to the
40
+ * doc's authored `system` / `template` field — exactly one (text XOR from;
41
+ * authoring-guide §3 uses `from`, spec §2.1 uses inline `text` — both are
42
+ * reconciled here). A `dynamic` slot carries a `source`.
43
+ */
44
+ export interface Slot {
45
+ readonly id: string;
46
+ readonly kind: SlotKind;
47
+ /** static only — inline authored text (XOR `from`). */
48
+ readonly text?: string;
49
+ /** static only — pull the text from the doc's `system`/`template` (XOR `text`). */
50
+ readonly from?: StaticFrom;
51
+ /** dynamic only — how the slot is filled at run time. */
52
+ readonly source?: DynamicSource;
53
+ }
54
+ /** The assembly manifest — an ordered list of slots; list order = send order.
55
+ * No resolved values are ever present (structure only, D6). */
56
+ export interface Manifest {
57
+ readonly slots: readonly Slot[];
58
+ }
59
+ /** Result of {@link validateManifest} — a discriminated union so callers get the
60
+ * narrowed `Manifest` on success and a teaching error list on failure. */
61
+ export type ManifestValidation = {
62
+ readonly ok: true;
63
+ readonly manifest: Manifest;
64
+ } | {
65
+ readonly ok: false;
66
+ readonly errors: readonly string[];
67
+ };
68
+ /** Validate an untrusted value as a {@link Manifest} (spec §4). Rejects: an
69
+ * unknown slot kind, a `static` slot with BOTH or NEITHER `text`/`from`, a
70
+ * `dynamic` slot missing its `source` (or with a bad source kind / empty ref /
71
+ * bad cache_policy), a slot carrying fields of the wrong kind, and duplicate
72
+ * slot ids. Never throws — returns a result. */
73
+ export declare function validateManifest(input: unknown): ManifestValidation;
74
+ /** Throwing form of {@link validateManifest} — returns the narrowed manifest or
75
+ * throws with the joined error list. Use where an invalid manifest is a bug the
76
+ * caller wants surfaced (tests, the emit path's guard). */
77
+ export declare function assertValidManifest(input: unknown): Manifest;
78
+ /**
79
+ * Reduce a validated {@link Manifest} to ITS CANONICAL SHAPE — the ONE clean
80
+ * projection PSR-2 persists (spec §4 "re-validate + normalize on ingest").
81
+ *
82
+ * WHY (a PSR-1 QA finding): {@link validateManifest} NARROWS an untrusted value
83
+ * to `Manifest` but casts `slots as Slot[]` — it does NOT strip unknown keys, so
84
+ * a raw artifact blob can carry extra fields (`text` alongside a `from`, a stray
85
+ * `note`, a `source` on a static slot) that pass validation and would be stored
86
+ * verbatim. The ingest path (prompt-ingest.ts) must NEVER trust the artifact blob
87
+ * as-is: it re-validates AND normalizes here so `template_sha` (computed over the
88
+ * normalized manifest) is stable — identical content always dedupes to one row,
89
+ * regardless of incidental key noise in the source artifact.
90
+ *
91
+ * Each slot is rebuilt from scratch keeping ONLY the canonical keys:
92
+ * static → { id, kind, text } XOR { id, kind, from }
93
+ * dynamic → { id, kind, source: { kind, ref, cache_policy? } }
94
+ * Slot order is preserved (order = send order, D6). The rebuilt manifest is
95
+ * re-validated ({@link assertValidManifest}) so a caller that skipped validation
96
+ * still cannot persist a malformed shape.
97
+ */
98
+ export declare function normalizeManifest(input: Manifest): Manifest;
99
+ /** The declared authoring document (authoring-guide §3). A superset of the
100
+ * manifest: the authored `system`/`template` text a `from`-slot references, plus
101
+ * the route metadata PSR-2/PSR-3 persist. PSR-1 reads only `manifest.slots`
102
+ * (validating that every `from` resolves to a present field). */
103
+ export interface AuthoringDoc {
104
+ readonly route?: string;
105
+ readonly segment?: string;
106
+ readonly system?: string;
107
+ readonly template?: string;
108
+ readonly manifest?: {
109
+ readonly slots?: unknown;
110
+ };
111
+ readonly output_schema?: unknown;
112
+ readonly candidates?: unknown;
113
+ }
114
+ /**
115
+ * ADJ-1 — the "author from scratch" on-ramp. Parse a declared authoring doc
116
+ * (authoring-guide §3) into a validated {@link Manifest}. Accepts the doc as a
117
+ * JSON string OR an already-parsed object (§7: the MCP tool takes JSON; YAML is
118
+ * an optional future add and is NOT parsed here — a YAML string throws a
119
+ * teaching error). Beyond {@link validateManifest} it cross-checks that every
120
+ * `static` slot's `from: system|template` resolves to a present top-level field,
121
+ * so an author cannot reference authored text the doc does not carry.
122
+ *
123
+ * Structure-only: the returned manifest's slots are the authored slots verbatim
124
+ * (a `from`-slot keeps its `from`; the authored text is NOT inlined), so
125
+ * `parseAuthoringDoc` round-trips a hand-authored doc.
126
+ */
127
+ export declare function parseAuthoringDoc(input: string | AuthoringDoc): Manifest;
128
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/prompts/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,mFAAmF;AACnF,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE5C,4EAA4E;AAC5E,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAC;AAE3E;;uCAEuC;AACvC,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE5C;;8CAE8C;AAC9C,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE/C;;8EAE8E;AAC9E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,YAAY,CAAC,EAAE,WAAW,CAAC;CACrC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,uDAAuD;IACvD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,mFAAmF;IACnF,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;IAC3B,yDAAyD;IACzD,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;CACjC;AAED;+DAC+D;AAC/D,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;CACjC;AAED;0EAC0E;AAC1E,MAAM,MAAM,kBAAkB,GAC1B;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,GAClD;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAmB/D;;;;gDAIgD;AAChD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,CA2DnE;AAkBD;;2DAE2D;AAC3D,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAM5D;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,GAAG,QAAQ,CAiB3D;AAED;;;iEAGiE;AACjE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IACjD,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,QAAQ,CAmCxE"}
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+ /**
3
+ * PSR-1 — the assembly-manifest model (spec §2.1, authoring-guide §2–§3).
4
+ *
5
+ * A prompt in ModelRig is TWO things: the authored `template` text and the
6
+ * `manifest` — the ordered recipe for assembling the final prompt at call time.
7
+ * This module is the **structure-only** manifest: its `Slot[]` records HOW each
8
+ * part of the prompt is filled, never the filled value (the privacy guarantee —
9
+ * a `dynamic·tool` slot names `search_tickets`, never what it returned).
10
+ *
11
+ * PSR-1 is ZERO-DDL and validate-only: nothing here serves or stores a version.
12
+ * It exists to prove the model against real prompts (the InferWealth inference)
13
+ * and a hand-authored doc (ADJ-1) before PSR-2 builds the `prompt_versions`
14
+ * store. Pure + dependency-free (no YAML dep — the authoring doc is accepted as
15
+ * JSON per §7; YAML is an optional future add).
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.validateManifest = validateManifest;
19
+ exports.assertValidManifest = assertValidManifest;
20
+ exports.normalizeManifest = normalizeManifest;
21
+ exports.parseAuthoringDoc = parseAuthoringDoc;
22
+ const DYNAMIC_KINDS = new Set([
23
+ "tool",
24
+ "cache",
25
+ "upstream",
26
+ "variable",
27
+ ]);
28
+ const CACHE_POLICIES = new Set(["prefix", "none"]);
29
+ const STATIC_FROMS = new Set(["system", "template"]);
30
+ function isRecord(v) {
31
+ return typeof v === "object" && v !== null && !Array.isArray(v);
32
+ }
33
+ function isNonEmptyString(v) {
34
+ return typeof v === "string" && v.length > 0;
35
+ }
36
+ /** Validate an untrusted value as a {@link Manifest} (spec §4). Rejects: an
37
+ * unknown slot kind, a `static` slot with BOTH or NEITHER `text`/`from`, a
38
+ * `dynamic` slot missing its `source` (or with a bad source kind / empty ref /
39
+ * bad cache_policy), a slot carrying fields of the wrong kind, and duplicate
40
+ * slot ids. Never throws — returns a result. */
41
+ function validateManifest(input) {
42
+ const errors = [];
43
+ if (!isRecord(input)) {
44
+ return { ok: false, errors: ["manifest must be an object with a `slots` array"] };
45
+ }
46
+ const slots = input["slots"];
47
+ if (!Array.isArray(slots)) {
48
+ return { ok: false, errors: ["manifest.slots must be an array"] };
49
+ }
50
+ const seenIds = new Set();
51
+ slots.forEach((raw, i) => {
52
+ const at = `slots[${i}]`;
53
+ if (!isRecord(raw)) {
54
+ errors.push(`${at} must be an object`);
55
+ return;
56
+ }
57
+ const id = raw["id"];
58
+ if (!isNonEmptyString(id)) {
59
+ errors.push(`${at}.id must be a non-empty string`);
60
+ }
61
+ else if (seenIds.has(id)) {
62
+ errors.push(`${at}.id "${id}" is a duplicate — slot ids must be unique`);
63
+ }
64
+ else {
65
+ seenIds.add(id);
66
+ }
67
+ const kind = raw["kind"];
68
+ const hasText = raw["text"] !== undefined;
69
+ const hasFrom = raw["from"] !== undefined;
70
+ const hasSource = raw["source"] !== undefined;
71
+ if (kind === "static") {
72
+ if (hasSource)
73
+ errors.push(`${at} is static but carries a dynamic \`source\``);
74
+ if (hasText && hasFrom) {
75
+ errors.push(`${at} static slot has BOTH \`text\` and \`from\` — exactly one is allowed`);
76
+ }
77
+ else if (!hasText && !hasFrom) {
78
+ errors.push(`${at} static slot has NEITHER \`text\` nor \`from\` — exactly one is required`);
79
+ }
80
+ else if (hasText && typeof raw["text"] !== "string") {
81
+ errors.push(`${at}.text must be a string`);
82
+ }
83
+ else if (hasFrom && !STATIC_FROMS.has(raw["from"])) {
84
+ errors.push(`${at}.from must be one of system, template`);
85
+ }
86
+ }
87
+ else if (kind === "dynamic") {
88
+ if (hasText || hasFrom) {
89
+ errors.push(`${at} is dynamic but carries static \`text\`/\`from\``);
90
+ }
91
+ if (!hasSource) {
92
+ errors.push(`${at} dynamic slot is missing its \`source\``);
93
+ }
94
+ else {
95
+ validateSource(raw["source"], at, errors);
96
+ }
97
+ }
98
+ else {
99
+ errors.push(`${at}.kind must be one of static, dynamic (got ${JSON.stringify(kind)})`);
100
+ }
101
+ });
102
+ if (errors.length > 0)
103
+ return { ok: false, errors };
104
+ return { ok: true, manifest: { slots: slots } };
105
+ }
106
+ function validateSource(source, at, errors) {
107
+ if (!isRecord(source)) {
108
+ errors.push(`${at}.source must be an object`);
109
+ return;
110
+ }
111
+ if (!DYNAMIC_KINDS.has(source["kind"])) {
112
+ errors.push(`${at}.source.kind must be one of tool, cache, upstream, variable`);
113
+ }
114
+ if (!isNonEmptyString(source["ref"])) {
115
+ errors.push(`${at}.source.ref must be a non-empty string`);
116
+ }
117
+ if (source["cache_policy"] !== undefined && !CACHE_POLICIES.has(source["cache_policy"])) {
118
+ errors.push(`${at}.source.cache_policy must be one of prefix, none`);
119
+ }
120
+ }
121
+ /** Throwing form of {@link validateManifest} — returns the narrowed manifest or
122
+ * throws with the joined error list. Use where an invalid manifest is a bug the
123
+ * caller wants surfaced (tests, the emit path's guard). */
124
+ function assertValidManifest(input) {
125
+ const result = validateManifest(input);
126
+ if (!result.ok) {
127
+ throw new Error(`invalid manifest: ${result.errors.join("; ")}`);
128
+ }
129
+ return result.manifest;
130
+ }
131
+ /**
132
+ * Reduce a validated {@link Manifest} to ITS CANONICAL SHAPE — the ONE clean
133
+ * projection PSR-2 persists (spec §4 "re-validate + normalize on ingest").
134
+ *
135
+ * WHY (a PSR-1 QA finding): {@link validateManifest} NARROWS an untrusted value
136
+ * to `Manifest` but casts `slots as Slot[]` — it does NOT strip unknown keys, so
137
+ * a raw artifact blob can carry extra fields (`text` alongside a `from`, a stray
138
+ * `note`, a `source` on a static slot) that pass validation and would be stored
139
+ * verbatim. The ingest path (prompt-ingest.ts) must NEVER trust the artifact blob
140
+ * as-is: it re-validates AND normalizes here so `template_sha` (computed over the
141
+ * normalized manifest) is stable — identical content always dedupes to one row,
142
+ * regardless of incidental key noise in the source artifact.
143
+ *
144
+ * Each slot is rebuilt from scratch keeping ONLY the canonical keys:
145
+ * static → { id, kind, text } XOR { id, kind, from }
146
+ * dynamic → { id, kind, source: { kind, ref, cache_policy? } }
147
+ * Slot order is preserved (order = send order, D6). The rebuilt manifest is
148
+ * re-validated ({@link assertValidManifest}) so a caller that skipped validation
149
+ * still cannot persist a malformed shape.
150
+ */
151
+ function normalizeManifest(input) {
152
+ const slots = input.slots.map((slot) => {
153
+ if (slot.kind === "static") {
154
+ // text XOR from — validation guarantees exactly one is present.
155
+ if (slot.text !== undefined) {
156
+ return { id: slot.id, kind: "static", text: slot.text };
157
+ }
158
+ return { id: slot.id, kind: "static", from: slot.from };
159
+ }
160
+ const src = slot.source;
161
+ const source = src.cache_policy !== undefined
162
+ ? { kind: src.kind, ref: src.ref, cache_policy: src.cache_policy }
163
+ : { kind: src.kind, ref: src.ref };
164
+ return { id: slot.id, kind: "dynamic", source };
165
+ });
166
+ return assertValidManifest({ slots });
167
+ }
168
+ /**
169
+ * ADJ-1 — the "author from scratch" on-ramp. Parse a declared authoring doc
170
+ * (authoring-guide §3) into a validated {@link Manifest}. Accepts the doc as a
171
+ * JSON string OR an already-parsed object (§7: the MCP tool takes JSON; YAML is
172
+ * an optional future add and is NOT parsed here — a YAML string throws a
173
+ * teaching error). Beyond {@link validateManifest} it cross-checks that every
174
+ * `static` slot's `from: system|template` resolves to a present top-level field,
175
+ * so an author cannot reference authored text the doc does not carry.
176
+ *
177
+ * Structure-only: the returned manifest's slots are the authored slots verbatim
178
+ * (a `from`-slot keeps its `from`; the authored text is NOT inlined), so
179
+ * `parseAuthoringDoc` round-trips a hand-authored doc.
180
+ */
181
+ function parseAuthoringDoc(input) {
182
+ let doc = input;
183
+ if (typeof input === "string") {
184
+ try {
185
+ doc = JSON.parse(input);
186
+ }
187
+ catch (err) {
188
+ throw new Error("authoring doc must be JSON (YAML is not parsed here — pass JSON per authoring-guide §7): " +
189
+ (err instanceof Error ? err.message : String(err)));
190
+ }
191
+ }
192
+ if (!isRecord(doc)) {
193
+ throw new Error("authoring doc must be an object");
194
+ }
195
+ const manifestBlock = doc["manifest"];
196
+ if (!isRecord(manifestBlock)) {
197
+ throw new Error("authoring doc is missing a `manifest` block");
198
+ }
199
+ const manifest = assertValidManifest(manifestBlock);
200
+ // ADJ-1 cross-check: a `from` slot must reference a present authored field.
201
+ const hasSystem = typeof doc["system"] === "string";
202
+ const hasTemplate = typeof doc["template"] === "string";
203
+ const missing = [];
204
+ for (const slot of manifest.slots) {
205
+ if (slot.from === "system" && !hasSystem)
206
+ missing.push(`slot "${slot.id}" references \`system\``);
207
+ if (slot.from === "template" && !hasTemplate)
208
+ missing.push(`slot "${slot.id}" references \`template\``);
209
+ }
210
+ if (missing.length > 0) {
211
+ throw new Error(`authoring doc has \`from\` slots with no matching authored field: ${missing.join("; ")}`);
212
+ }
213
+ return manifest;
214
+ }
@@ -0,0 +1,84 @@
1
+ /**
2
+ * PSR-2b — SDK fetch-by-label + the content-addressed prompt cache (spec §3
3
+ * "SDK read", §4). The remote half of serving a prompt by its movable `prod`
4
+ * label.
5
+ *
6
+ * The gateway already serves the promoted version's template+manifest through
7
+ * `routes.bundle` (PSR-2a's write-through). This module adds the OPTIONAL
8
+ * explicit read the SDK uses when it wants a prompt by label directly:
9
+ * GET /v1/prompts/:route?label=prod (key-auth, org-scoped)
10
+ * → { version, template, manifest, template_sha }
11
+ * ETag: <template_sha> (304 Not Modified when it matches)
12
+ *
13
+ * The fetcher mirrors `call-config.ts`'s leak discipline: header-only auth, no
14
+ * body/URL in an error (C2), and it NEVER throws — a network/HTTP failure
15
+ * resolves `null`, a 304 resolves `"not-modified"`, a malformed 200 resolves
16
+ * `null`. So the fail-open resolver ({@link ./prompt-resolve}) always stays
17
+ * fail-open around it.
18
+ *
19
+ * The cache is CONTENT-ADDRESSED, keyed `label+template_sha` (spec §3): the
20
+ * same served content is one entry regardless of how many times it is fetched,
21
+ * and a per-(route,label) pointer records the last-known-good sha — the tier the
22
+ * resolver falls back to when the control plane is unreachable.
23
+ */
24
+ import { type Manifest } from "./manifest";
25
+ /** A prompt served by label — the explicit endpoint's body and the unit the
26
+ * client cache holds. `template_sha` is both the content id and the ETag. */
27
+ export interface ServedPrompt {
28
+ readonly version: number;
29
+ readonly template: string;
30
+ readonly manifest: Manifest;
31
+ readonly template_sha: string;
32
+ }
33
+ /** Pulls one route's prompt for a label, ETag-aware. Returns the prompt, `"not-
34
+ * modified"` (304 — keep the cache), or `null` (miss/error — the resolver keeps
35
+ * last-known-good). NEVER throws. */
36
+ export interface PromptFetcher {
37
+ fetch(route: string, label: string, etag: string | undefined): Promise<ServedPrompt | "not-modified" | null>;
38
+ }
39
+ /**
40
+ * Narrow an untrusted endpoint body into a {@link ServedPrompt}, or null when the
41
+ * shape is not what the endpoint promises (a malformed 200 is a miss, never
42
+ * trusted — we never fabricate a served prompt from junk). The manifest is
43
+ * validated with the shared {@link validateManifest} so a structurally-broken
44
+ * manifest can never reach the client-fill engine.
45
+ */
46
+ export declare function parseServedPrompt(body: unknown): ServedPrompt | null;
47
+ /**
48
+ * The content-addressed prompt cache (spec §3). Holds served content keyed
49
+ * `label+template_sha`, plus a per-(route,label) pointer to the last-known-good
50
+ * sha. `put` stores the content AND advances the pointer (a fetched version is
51
+ * now the last-known-good); `lastKnown` reads the current content for a label —
52
+ * the fail-open tier the resolver serves when a fetch cannot complete.
53
+ */
54
+ export interface PromptCache {
55
+ /** The served content for an exact (route,label,sha), if held. */
56
+ get(route: string, label: string, sha: string): ServedPrompt | undefined;
57
+ /** The last-known-good served content for (route,label), if any has landed. */
58
+ lastKnown(route: string, label: string): ServedPrompt | undefined;
59
+ /** The last-known-good sha for (route,label) — the ETag to revalidate with. */
60
+ lastKnownSha(route: string, label: string): string | undefined;
61
+ /** Store content and advance the last-known-good pointer to its sha. */
62
+ put(route: string, label: string, prompt: ServedPrompt): void;
63
+ }
64
+ /** Build an empty {@link PromptCache}. One per rig. In-memory only — a prompt
65
+ * cache is a per-process convenience, never durable state. */
66
+ export declare function createPromptCache(): PromptCache;
67
+ export interface ApiPromptFetcherConfig {
68
+ /** Base URL of the hosted control plane — the SAME `ingestUrl` the api sink
69
+ * and call-config fetcher use (the prompt path hangs off the host). */
70
+ readonly ingestUrl: string;
71
+ /** `rig_sk_…` key. A read rides the readable route + prompt rows; header only,
72
+ * never a URL (C2). */
73
+ readonly apiKey: string;
74
+ readonly fetchFn?: typeof fetch;
75
+ }
76
+ /**
77
+ * The api-mode prompt fetcher: one authenticated, ETag-aware GET per (route,
78
+ * label). Mirrors the api sink's leak discipline (status only, never the
79
+ * body/URL in an error — C2). NEVER throws: a network/HTTP failure resolves
80
+ * null, a 304 resolves "not-modified", a malformed 200 resolves null — so the
81
+ * resolver stays fail-open.
82
+ */
83
+ export declare function createApiPromptFetcher(config: ApiPromptFetcherConfig): PromptFetcher;
84
+ //# sourceMappingURL=prompt-fetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-fetch.d.ts","sourceRoot":"","sources":["../../src/prompts/prompt-fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAoB,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE7D;6EAC6E;AAC7E,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED;;qCAEqC;AACrC,MAAM,WAAW,aAAa;IAC5B,KAAK,CACH,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GAAG,SAAS,GACvB,OAAO,CAAC,YAAY,GAAG,cAAc,GAAG,IAAI,CAAC,CAAC;CAClD;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI,CAcpE;AAYD;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,kEAAkE;IAClE,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAAC;IACzE,+EAA+E;IAC/E,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAAC;IAClE,+EAA+E;IAC/E,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC/D,wEAAwE;IACxE,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;CAC/D;AAED;8DAC8D;AAC9D,wBAAgB,iBAAiB,IAAI,WAAW,CAmB/C;AAED,MAAM,WAAW,sBAAsB;IACrC;2EACuE;IACvE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;2BACuB;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;CACjC;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,sBAAsB,GAAG,aAAa,CA4BpF"}