modelrig 0.8.1 → 0.10.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.
- package/CHANGELOG.md +324 -0
- package/README.md +55 -29
- package/data/PROVENANCE.md +14 -0
- package/data/pricing-map.json +26 -0
- package/dist/adapters/attempt-meta-map.d.ts +8 -1
- package/dist/adapters/attempt-meta-map.d.ts.map +1 -1
- package/dist/adapters/attempt-meta-map.js +4 -0
- package/dist/adapters/build-adapters.js +2 -2
- package/dist/adapters/gemini.d.ts +28 -1
- package/dist/adapters/gemini.d.ts.map +1 -1
- package/dist/adapters/gemini.js +38 -9
- package/dist/adapters/grok.d.ts.map +1 -1
- package/dist/adapters/grok.js +53 -4
- package/dist/adapters/openai-compat.d.ts +8 -2
- package/dist/adapters/openai-compat.d.ts.map +1 -1
- package/dist/adapters/openai-compat.js +8 -1
- package/dist/adapters/openai-stream.d.ts +10 -2
- package/dist/adapters/openai-stream.d.ts.map +1 -1
- package/dist/adapters/openai-stream.js +5 -1
- package/dist/adapters/openai.d.ts +10 -1
- package/dist/adapters/openai.d.ts.map +1 -1
- package/dist/adapters/openai.js +57 -7
- package/dist/adapters/responses-api.d.ts +61 -0
- package/dist/adapters/responses-api.d.ts.map +1 -0
- package/dist/adapters/responses-api.js +124 -0
- package/dist/artifacts/artifact.d.ts +31 -12
- package/dist/artifacts/artifact.d.ts.map +1 -1
- package/dist/artifacts/artifact.js +218 -188
- package/dist/artifacts/index.d.ts +15 -5
- package/dist/artifacts/index.d.ts.map +1 -1
- package/dist/artifacts/index.js +19 -5
- package/dist/artifacts/run-context.d.ts +3 -24
- package/dist/artifacts/run-context.d.ts.map +1 -1
- package/dist/artifacts/run-context.js +3 -39
- package/dist/bakeoff/engine.d.ts +29 -0
- package/dist/bakeoff/engine.d.ts.map +1 -1
- package/dist/bakeoff/engine.js +47 -0
- package/dist/bakeoff/eval-cases-rig.d.ts +36 -0
- package/dist/bakeoff/eval-cases-rig.d.ts.map +1 -0
- package/dist/bakeoff/eval-cases-rig.js +27 -0
- package/dist/bakeoff/eval-cases.d.ts +19 -0
- package/dist/bakeoff/eval-cases.d.ts.map +1 -1
- package/dist/bakeoff/eval-cases.js +18 -1
- package/dist/bakeoff/golden-judge.d.ts +47 -0
- package/dist/bakeoff/golden-judge.d.ts.map +1 -0
- package/dist/bakeoff/golden-judge.js +49 -0
- package/dist/bakeoff/groundedness.d.ts +58 -0
- package/dist/bakeoff/groundedness.d.ts.map +1 -0
- package/dist/bakeoff/groundedness.js +165 -0
- package/dist/bakeoff/quality.d.ts +43 -0
- package/dist/bakeoff/quality.d.ts.map +1 -1
- package/dist/bakeoff/quality.js +31 -0
- package/dist/bakeoff/replay.d.ts +11 -0
- package/dist/bakeoff/replay.d.ts.map +1 -1
- package/dist/bakeoff/replay.js +12 -0
- package/dist/bakeoff/report.d.ts +7 -0
- package/dist/bakeoff/report.d.ts.map +1 -1
- package/dist/bakeoff/report.js +26 -0
- package/dist/cli-judge.d.ts +12 -0
- package/dist/cli-judge.d.ts.map +1 -0
- package/dist/cli-judge.js +48 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +22 -42
- package/dist/config.d.ts +85 -29
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +109 -47
- package/dist/detect/detector.d.ts +4 -2
- package/dist/detect/detector.d.ts.map +1 -1
- package/dist/detect/safe-harbor.d.ts +57 -0
- package/dist/detect/safe-harbor.d.ts.map +1 -0
- package/dist/detect/safe-harbor.js +278 -0
- package/dist/doctor-cli.d.ts +7 -0
- package/dist/doctor-cli.d.ts.map +1 -0
- package/dist/doctor-cli.js +67 -0
- package/dist/doctor-preflight.d.ts +52 -0
- package/dist/doctor-preflight.d.ts.map +1 -0
- package/dist/doctor-preflight.js +112 -0
- package/dist/feedback/coverage.d.ts +11 -8
- package/dist/feedback/coverage.d.ts.map +1 -1
- package/dist/feedback/coverage.js +29 -16
- package/dist/feedback/grade.d.ts +58 -0
- package/dist/feedback/grade.d.ts.map +1 -0
- package/dist/feedback/grade.js +67 -0
- package/dist/gateway/http-protocol.d.ts +20 -1
- package/dist/gateway/http-protocol.d.ts.map +1 -1
- package/dist/gateway/http-protocol.js +1 -1
- package/dist/gateway/serve-client.d.ts +99 -0
- package/dist/gateway/serve-client.d.ts.map +1 -0
- package/dist/gateway/serve-client.js +360 -0
- package/dist/index.d.ts +68 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +167 -46
- package/dist/init/observe-cli.js +1 -1
- package/dist/init/observe.d.ts +2 -2
- package/dist/init/observe.d.ts.map +1 -1
- package/dist/init/observe.js +11 -7
- package/dist/mask/arm.d.ts +112 -0
- package/dist/mask/arm.d.ts.map +1 -0
- package/dist/mask/arm.js +179 -0
- package/dist/mask/index.d.ts +2 -0
- package/dist/mask/index.d.ts.map +1 -1
- package/dist/mask/index.js +7 -1
- package/dist/mask/mask-policy-cli.d.ts +12 -4
- package/dist/mask/mask-policy-cli.d.ts.map +1 -1
- package/dist/mask/mask-policy-cli.js +34 -9
- package/dist/prompts/manifest.d.ts +128 -0
- package/dist/prompts/manifest.d.ts.map +1 -0
- package/dist/prompts/manifest.js +214 -0
- package/dist/prompts/prompt-fetch.d.ts +84 -0
- package/dist/prompts/prompt-fetch.d.ts.map +1 -0
- package/dist/prompts/prompt-fetch.js +120 -0
- package/dist/prompts/prompt-resolve.d.ts +76 -0
- package/dist/prompts/prompt-resolve.d.ts.map +1 -0
- package/dist/prompts/prompt-resolve.js +93 -0
- package/dist/prompts/slot-resolver.d.ts +91 -0
- package/dist/prompts/slot-resolver.d.ts.map +1 -0
- package/dist/prompts/slot-resolver.js +135 -0
- package/dist/prompts/tools-register.d.ts +60 -0
- package/dist/prompts/tools-register.d.ts.map +1 -0
- package/dist/prompts/tools-register.js +48 -0
- package/dist/prompts/version-hash.d.ts +29 -0
- package/dist/prompts/version-hash.d.ts.map +1 -0
- package/dist/prompts/version-hash.js +54 -0
- package/dist/prompts-export-cli.d.ts +21 -0
- package/dist/prompts-export-cli.d.ts.map +1 -0
- package/dist/prompts-export-cli.js +130 -0
- package/dist/query/grammar.d.ts +2 -2
- package/dist/query/grammar.d.ts.map +1 -1
- package/dist/query/grammar.js +3 -1
- package/dist/query/saved.d.ts +13 -0
- package/dist/query/saved.d.ts.map +1 -1
- package/dist/query/saved.js +67 -1
- package/dist/receipts/types.d.ts +1 -1
- package/dist/receipts/types.d.ts.map +1 -1
- package/dist/receipts/types.js +1 -0
- package/dist/registry/build.d.ts +43 -1
- package/dist/registry/build.d.ts.map +1 -1
- package/dist/registry/build.js +52 -0
- package/dist/registry/cache-policy.d.ts.map +1 -1
- package/dist/registry/cache-policy.js +22 -0
- package/dist/registry/pricing-shape.d.ts +67 -8
- package/dist/registry/pricing-shape.d.ts.map +1 -1
- package/dist/registry/pricing-shape.js +50 -13
- package/dist/registry/pricing.d.ts +6 -5
- package/dist/registry/pricing.d.ts.map +1 -1
- package/dist/registry/pricing.js +9 -5
- package/dist/registry/rows.d.ts.map +1 -1
- package/dist/registry/rows.js +1 -0
- package/dist/registry/select.d.ts +6 -1
- package/dist/registry/select.d.ts.map +1 -1
- package/dist/registry/select.js +11 -0
- package/dist/routes/call-config.d.ts +199 -0
- package/dist/routes/call-config.d.ts.map +1 -0
- package/dist/routes/call-config.js +343 -0
- package/dist/routes/destination-loader.d.ts +16 -0
- package/dist/routes/destination-loader.d.ts.map +1 -0
- package/dist/routes/destination-loader.js +29 -0
- package/dist/routes/draft.d.ts +7 -0
- package/dist/routes/draft.d.ts.map +1 -1
- package/dist/routes/draft.js +12 -0
- package/dist/routes/loader.d.ts.map +1 -1
- package/dist/routes/loader.js +31 -56
- package/dist/routes/objective-loader.d.ts +12 -0
- package/dist/routes/objective-loader.d.ts.map +1 -1
- package/dist/routes/objective-loader.js +82 -0
- package/dist/routes/output-loader.d.ts +42 -0
- package/dist/routes/output-loader.d.ts.map +1 -0
- package/dist/routes/output-loader.js +112 -0
- package/dist/routes/prompt-loader.d.ts +49 -0
- package/dist/routes/prompt-loader.d.ts.map +1 -0
- package/dist/routes/prompt-loader.js +113 -0
- package/dist/routes/resolved-bundle.d.ts +69 -0
- package/dist/routes/resolved-bundle.d.ts.map +1 -1
- package/dist/routes/resolved-bundle.js +76 -0
- package/dist/routes/screen-loader.d.ts +29 -1
- package/dist/routes/screen-loader.d.ts.map +1 -1
- package/dist/routes/screen-loader.js +59 -1
- package/dist/run/accept.d.ts +5 -0
- package/dist/run/accept.d.ts.map +1 -1
- package/dist/run/accept.js +2 -0
- package/dist/run/cost.d.ts +31 -2
- package/dist/run/cost.d.ts.map +1 -1
- package/dist/run/cost.js +57 -2
- package/dist/run/destination.d.ts +39 -0
- package/dist/run/destination.d.ts.map +1 -0
- package/dist/run/destination.js +45 -0
- package/dist/run/dispatch.d.ts +67 -16
- package/dist/run/dispatch.d.ts.map +1 -1
- package/dist/run/dispatch.js +133 -29
- package/dist/run/grounding.d.ts +28 -2
- package/dist/run/grounding.d.ts.map +1 -1
- package/dist/run/grounding.js +54 -10
- package/dist/run/raw-defaults.d.ts.map +1 -1
- package/dist/run/raw-defaults.js +6 -1
- package/dist/run/raw-finalize.d.ts +50 -0
- package/dist/run/raw-finalize.d.ts.map +1 -0
- package/dist/run/raw-finalize.js +266 -0
- package/dist/run/raw-knobs.d.ts +36 -0
- package/dist/run/raw-knobs.d.ts.map +1 -0
- package/dist/run/raw-knobs.js +99 -0
- package/dist/run/raw-request.d.ts +24 -0
- package/dist/run/raw-request.d.ts.map +1 -0
- package/dist/run/raw-request.js +69 -0
- package/dist/run/raw-schema.d.ts +76 -0
- package/dist/run/raw-schema.d.ts.map +1 -0
- package/dist/run/raw-schema.js +166 -0
- package/dist/run/raw-search-cost.d.ts +48 -0
- package/dist/run/raw-search-cost.d.ts.map +1 -0
- package/dist/run/raw-search-cost.js +78 -0
- package/dist/run/raw-support.d.ts +64 -6
- package/dist/run/raw-support.d.ts.map +1 -1
- package/dist/run/raw-support.js +84 -11
- package/dist/run/raw.d.ts +25 -26
- package/dist/run/raw.d.ts.map +1 -1
- package/dist/run/raw.js +30 -351
- package/dist/run/record-attempt.d.ts +12 -0
- package/dist/run/record-attempt.d.ts.map +1 -1
- package/dist/run/record-attempt.js +30 -12
- package/dist/run/repair-attempt.d.ts +68 -0
- package/dist/run/repair-attempt.d.ts.map +1 -0
- package/dist/run/repair-attempt.js +180 -0
- package/dist/run/resolve-destination.d.ts +49 -0
- package/dist/run/resolve-destination.d.ts.map +1 -0
- package/dist/run/resolve-destination.js +76 -0
- package/dist/run/routing-docs.d.ts.map +1 -1
- package/dist/run/routing-docs.js +10 -5
- package/dist/run/run.d.ts +30 -1
- package/dist/run/run.d.ts.map +1 -1
- package/dist/run/run.js +94 -172
- package/dist/run/telemetry-row.d.ts +92 -0
- package/dist/run/telemetry-row.d.ts.map +1 -0
- package/dist/run/telemetry-row.js +81 -0
- package/dist/run/validate.d.ts +12 -1
- package/dist/run/validate.d.ts.map +1 -1
- package/dist/run/validate.js +31 -0
- package/dist/run/web-search-pricing.d.ts +43 -0
- package/dist/run/web-search-pricing.d.ts.map +1 -0
- package/dist/run/web-search-pricing.js +56 -0
- package/dist/savings/odometer.d.ts +4 -0
- package/dist/savings/odometer.d.ts.map +1 -1
- package/dist/savings/odometer.js +20 -1
- package/dist/savings/swap-execute.d.ts +7 -0
- package/dist/savings/swap-execute.d.ts.map +1 -1
- package/dist/savings/swap-execute.js +30 -0
- package/dist/savings/swaps-client.d.ts +10 -0
- package/dist/savings/swaps-client.d.ts.map +1 -1
- package/dist/screen/fixtures/probe-corpora.d.ts +23 -0
- package/dist/screen/fixtures/probe-corpora.d.ts.map +1 -0
- package/dist/screen/fixtures/probe-corpora.js +69 -0
- package/dist/screen/index.d.ts +21 -0
- package/dist/screen/index.d.ts.map +1 -0
- package/dist/screen/index.js +64 -0
- package/dist/screen/model-screen.d.ts +111 -0
- package/dist/screen/model-screen.d.ts.map +1 -0
- package/dist/screen/model-screen.js +178 -0
- package/dist/screen/patterns.d.ts +51 -0
- package/dist/screen/patterns.d.ts.map +1 -0
- package/dist/screen/patterns.js +151 -0
- package/dist/screen/phi-gate.d.ts +52 -0
- package/dist/screen/phi-gate.d.ts.map +1 -0
- package/dist/screen/phi-gate.js +86 -0
- package/dist/screen/policy.d.ts +71 -0
- package/dist/screen/policy.d.ts.map +1 -0
- package/dist/screen/policy.js +334 -0
- package/dist/screen/probe.d.ts +118 -0
- package/dist/screen/probe.d.ts.map +1 -0
- package/dist/screen/probe.js +132 -0
- package/dist/screen/screen-cli.d.ts +16 -0
- package/dist/screen/screen-cli.d.ts.map +1 -0
- package/dist/screen/screen-cli.js +178 -0
- package/dist/screen/screen.d.ts +99 -0
- package/dist/screen/screen.d.ts.map +1 -0
- package/dist/screen/screen.js +0 -0
- package/dist/screen/sidecar.d.ts +69 -0
- package/dist/screen/sidecar.d.ts.map +1 -0
- package/dist/screen/sidecar.js +145 -0
- package/dist/screen/types.d.ts +43 -2
- package/dist/screen/types.d.ts.map +1 -1
- package/dist/settings/api-fetcher.d.ts +14 -3
- package/dist/settings/api-fetcher.d.ts.map +1 -1
- package/dist/settings/api-fetcher.js +61 -10
- package/dist/settings/grading-guide.d.ts +102 -0
- package/dist/settings/grading-guide.d.ts.map +1 -0
- package/dist/settings/grading-guide.js +23 -0
- package/dist/settings/index.d.ts +3 -2
- package/dist/settings/index.d.ts.map +1 -1
- package/dist/settings/index.js +2 -1
- package/dist/settings/task-settings.d.ts +44 -7
- package/dist/settings/task-settings.d.ts.map +1 -1
- package/dist/settings/task-settings.js +53 -12
- package/dist/status.d.ts +32 -20
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +51 -30
- package/dist/telemetry/artifact-store.d.ts +5 -6
- package/dist/telemetry/artifact-store.d.ts.map +1 -1
- package/dist/telemetry/artifact-store.js +21 -24
- package/dist/telemetry/attempt-meta.d.ts +76 -1
- package/dist/telemetry/attempt-meta.d.ts.map +1 -1
- package/dist/telemetry/attempt-meta.js +33 -1
- package/dist/telemetry/exporter-setup.d.ts +2 -0
- package/dist/telemetry/exporter-setup.d.ts.map +1 -1
- package/dist/telemetry/exporter-setup.js +6 -1
- package/dist/telemetry/exporter.d.ts +2 -2
- package/dist/telemetry/exporter.d.ts.map +1 -1
- package/dist/telemetry/exporter.js +22 -41
- package/dist/telemetry/grade-mappers.d.ts +25 -0
- package/dist/telemetry/grade-mappers.d.ts.map +1 -0
- package/dist/telemetry/grade-mappers.js +64 -0
- package/dist/telemetry/grades-sql.d.ts +56 -0
- package/dist/telemetry/grades-sql.d.ts.map +1 -0
- package/dist/telemetry/grades-sql.js +156 -0
- package/dist/telemetry/ingest-protocol.d.ts +55 -48
- package/dist/telemetry/ingest-protocol.d.ts.map +1 -1
- package/dist/telemetry/ingest-protocol.js +48 -83
- package/dist/telemetry/org-identity.d.ts +44 -0
- package/dist/telemetry/org-identity.d.ts.map +1 -0
- package/dist/telemetry/org-identity.js +98 -0
- package/dist/telemetry/route-registration.d.ts +48 -0
- package/dist/telemetry/route-registration.d.ts.map +1 -0
- package/dist/telemetry/route-registration.js +77 -0
- package/dist/telemetry/sinks.d.ts +10 -1
- package/dist/telemetry/sinks.d.ts.map +1 -1
- package/dist/telemetry/sinks.js +52 -6
- package/dist/telemetry/store-migrations.d.ts.map +1 -1
- package/dist/telemetry/store-migrations.js +64 -0
- package/dist/telemetry/store.d.ts +9 -6
- package/dist/telemetry/store.d.ts.map +1 -1
- package/dist/telemetry/store.js +8 -50
- package/dist/tenancy/api-key-format.d.ts +45 -1
- package/dist/tenancy/api-key-format.d.ts.map +1 -1
- package/dist/tenancy/api-key-format.js +50 -1
- package/dist/types/provider.d.ts +23 -3
- package/dist/types/provider.d.ts.map +1 -1
- package/dist/types/provider.js +26 -0
- package/dist/types/route.d.ts +154 -2
- package/dist/types/route.d.ts.map +1 -1
- package/dist/types/telemetry.d.ts +73 -48
- package/dist/types/telemetry.d.ts.map +1 -1
- package/dist/validate-cli.d.ts.map +1 -1
- package/dist/validate-cli.js +32 -0
- package/dist/verify/verify.d.ts +5 -0
- package/dist/verify/verify.d.ts.map +1 -1
- package/dist/verify/verify.js +2 -0
- package/dist/watch/evaluate.d.ts +84 -1
- package/dist/watch/evaluate.d.ts.map +1 -1
- package/dist/watch/evaluate.js +28 -0
- package/dist/watch/monitor.d.ts +8 -2
- package/dist/watch/monitor.d.ts.map +1 -1
- package/dist/watch/monitor.js +13 -5
- package/dist/watch/regret-monitor-cli.d.ts +16 -0
- package/dist/watch/regret-monitor-cli.d.ts.map +1 -0
- package/dist/watch/regret-monitor-cli.js +137 -0
- package/dist/watch/regret-monitor.d.ts +168 -0
- package/dist/watch/regret-monitor.d.ts.map +1 -0
- package/dist/watch/regret-monitor.js +304 -0
- package/dist/watch/upgrade.d.ts +62 -0
- package/dist/watch/upgrade.d.ts.map +1 -0
- package/dist/watch/upgrade.js +57 -0
- package/docs/agent-skill/SKILL.md +181 -9
- package/docs/how-it-fits.md +3 -2
- package/docs/instrumentation.md +219 -46
- package/docs/llms.txt +158 -35
- package/docs/managed-serving.md +150 -0
- package/docs/mcp-oracle.md +322 -0
- package/docs/migration-playbook.md +5 -4
- package/docs/quickstart.md +263 -89
- package/package.json +18 -4
- package/registry/leaderboard.json +74 -0
- package/registry/registry.json +232 -112
- package/screen.d.ts +16 -0
- package/templates/call-disposition-qa.json +77 -0
- package/templates/catalog-cleansing.json +77 -0
- package/templates/compliance-review.json +76 -0
- package/templates/cs-next-action.json +76 -0
- package/templates/document-extraction.json +78 -0
- package/templates/financial-classification.json +75 -0
- package/templates/lead-qualification.json +76 -0
- package/templates/medical-classification.json +71 -0
- package/templates/ticket-triage.json +76 -0
- package/dist/feedback/feedback.d.ts +0 -35
- package/dist/feedback/feedback.d.ts.map +0 -1
- package/dist/feedback/feedback.js +0 -39
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PSR-2b — the client-fill engine (spec §4 "two-layer resolution", ADJ-2;
|
|
3
|
+
* authoring-guide §5–§6). Resolves a served {@link Manifest} into an assembled
|
|
4
|
+
* prompt string, ENTIRELY in the customer's process.
|
|
5
|
+
*
|
|
6
|
+
* Per call the SDK walks the manifest's slots IN ORDER (order = send order, D6)
|
|
7
|
+
* and fills each one:
|
|
8
|
+
* • `static` → authored text (inline `text`, or `from: system|template`)
|
|
9
|
+
* • `dynamic·tool` → the registered {@link ToolFn}, run in-process with the
|
|
10
|
+
* customer's keys (spec §4)
|
|
11
|
+
* • `dynamic·cache` → the declared cache handle, read by the caller's reader
|
|
12
|
+
* • `dynamic·upstream` → the prior step's APPROVED output (from the caller)
|
|
13
|
+
* • `dynamic·variable` → the call's variable whitelist
|
|
14
|
+
* then assembles the resolved parts in order. The assembled text is a plain
|
|
15
|
+
* string the caller dispatches through the existing `rig.run`/`runRaw` seam.
|
|
16
|
+
*
|
|
17
|
+
* FAIL CLOSED, NEVER SILENT (spec §4, HARD requirement). A `dynamic·tool` slot
|
|
18
|
+
* whose tool is not registered throws a teaching {@link SlotResolutionError} that
|
|
19
|
+
* NAMES the missing tool and what IS bound — never an empty slot, never a silent
|
|
20
|
+
* skip. The same discipline covers every dynamic kind: a slot that cannot be
|
|
21
|
+
* filled from what the caller provided fails closed, so a half-assembled prompt
|
|
22
|
+
* is never dispatched.
|
|
23
|
+
*
|
|
24
|
+
* PRIVACY: this module has ZERO network/telemetry imports. Its inputs (tool fns,
|
|
25
|
+
* cache reader, upstream outputs, variables) and its output (the assembled text)
|
|
26
|
+
* are all in-process values. Nothing tool-derived is sent anywhere — assembly is
|
|
27
|
+
* a local computation. That is the "tool keys + dynamic data never leave the
|
|
28
|
+
* process" guarantee, structural rather than promised.
|
|
29
|
+
*/
|
|
30
|
+
import type { Manifest } from "./manifest";
|
|
31
|
+
import type { ToolRegistry } from "./tools-register";
|
|
32
|
+
/** Reads a `dynamic·cache` slot's declared handle into text, in-process. Async
|
|
33
|
+
* (a cache is usually an out-of-band read). The handle is the slot's
|
|
34
|
+
* `source.ref`; the reader is the customer's — ModelRig never reads it. */
|
|
35
|
+
export type CacheReader = (handle: string) => string | Promise<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Everything the resolver needs to fill slots — supplied by the caller, all
|
|
38
|
+
* in-process. Only the kinds a given manifest uses need be present; a slot of a
|
|
39
|
+
* kind the caller did not provide for FAILS CLOSED (never a silent empty slot).
|
|
40
|
+
*/
|
|
41
|
+
export interface SlotResolveContext {
|
|
42
|
+
/** The authored template text a `from: template` static slot pulls (the served
|
|
43
|
+
* `ServedPrompt.template`). */
|
|
44
|
+
readonly template: string;
|
|
45
|
+
/** The authored system text a `from: system` static slot pulls, when the
|
|
46
|
+
* manifest declares one. */
|
|
47
|
+
readonly system?: string;
|
|
48
|
+
/** The tool bindings (`rig.tools`) a `dynamic·tool` slot resolves against. */
|
|
49
|
+
readonly tools: ToolRegistry;
|
|
50
|
+
/** The variable whitelist — the customer's own call inputs. A
|
|
51
|
+
* `dynamic·variable` slot reads `variables[ref]`; also passed to each tool as
|
|
52
|
+
* its {@link ToolResolveContext.input}. */
|
|
53
|
+
readonly variables?: Readonly<Record<string, unknown>>;
|
|
54
|
+
/** Reader for `dynamic·cache` slots. Absent ⇒ a cache slot fails closed. */
|
|
55
|
+
readonly cache?: CacheReader;
|
|
56
|
+
/** Prior steps' APPROVED outputs, keyed by step key — a `dynamic·upstream`
|
|
57
|
+
* slot reads `upstream[ref]`. Absent/missing ref ⇒ fails closed. */
|
|
58
|
+
readonly upstream?: Readonly<Record<string, string>>;
|
|
59
|
+
}
|
|
60
|
+
/** One resolved slot: its id and the text it contributed, in send order. */
|
|
61
|
+
export interface ResolvedSlot {
|
|
62
|
+
readonly id: string;
|
|
63
|
+
readonly text: string;
|
|
64
|
+
}
|
|
65
|
+
/** The assembled prompt plus the per-slot parts (send order preserved). `text`
|
|
66
|
+
* is `parts` joined with a blank line — the string the caller dispatches. */
|
|
67
|
+
export interface AssembledPrompt {
|
|
68
|
+
readonly text: string;
|
|
69
|
+
readonly parts: readonly ResolvedSlot[];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A slot that could not be filled — the fail-closed signal (spec §4). Carries
|
|
73
|
+
* the slot id and a teaching message; the tool-unbound case names the missing
|
|
74
|
+
* tool and the bound names, so the fix is obvious at the call site.
|
|
75
|
+
*/
|
|
76
|
+
export declare class SlotResolutionError extends Error {
|
|
77
|
+
readonly slotId: string;
|
|
78
|
+
constructor(slotId: string, message: string);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Resolve every slot of a served manifest IN ORDER and assemble the prompt
|
|
82
|
+
* (spec §4). Slots resolve sequentially so `upstream` ordering and any
|
|
83
|
+
* side-effecting tool run in declared send order. Throws
|
|
84
|
+
* {@link SlotResolutionError} on the FIRST slot that cannot be filled — the
|
|
85
|
+
* prompt is never dispatched half-assembled (fail closed).
|
|
86
|
+
*
|
|
87
|
+
* Pure over its inputs apart from the tool/cache functions the caller supplies,
|
|
88
|
+
* which run in-process. The returned {@link AssembledPrompt} is a local value.
|
|
89
|
+
*/
|
|
90
|
+
export declare function assemblePrompt(manifest: Manifest, ctx: SlotResolveContext): Promise<AssembledPrompt>;
|
|
91
|
+
//# sourceMappingURL=slot-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot-resolver.d.ts","sourceRoot":"","sources":["../../src/prompts/slot-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAQ,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD;;2EAE2E;AAC3E,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAEvE;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC;mCAC+B;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;gCAC4B;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,8EAA8E;IAC9E,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B;;+CAE2C;IAC3C,QAAQ,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACvD,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC;IAC7B;wEACoE;IACpE,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACtD;AAED,4EAA4E;AAC5E,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;6EAC6E;AAC7E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;CACzC;AAED;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBACZ,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK5C;AAiGD;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,kBAAkB,GACtB,OAAO,CAAC,eAAe,CAAC,CAO1B"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* PSR-2b — the client-fill engine (spec §4 "two-layer resolution", ADJ-2;
|
|
4
|
+
* authoring-guide §5–§6). Resolves a served {@link Manifest} into an assembled
|
|
5
|
+
* prompt string, ENTIRELY in the customer's process.
|
|
6
|
+
*
|
|
7
|
+
* Per call the SDK walks the manifest's slots IN ORDER (order = send order, D6)
|
|
8
|
+
* and fills each one:
|
|
9
|
+
* • `static` → authored text (inline `text`, or `from: system|template`)
|
|
10
|
+
* • `dynamic·tool` → the registered {@link ToolFn}, run in-process with the
|
|
11
|
+
* customer's keys (spec §4)
|
|
12
|
+
* • `dynamic·cache` → the declared cache handle, read by the caller's reader
|
|
13
|
+
* • `dynamic·upstream` → the prior step's APPROVED output (from the caller)
|
|
14
|
+
* • `dynamic·variable` → the call's variable whitelist
|
|
15
|
+
* then assembles the resolved parts in order. The assembled text is a plain
|
|
16
|
+
* string the caller dispatches through the existing `rig.run`/`runRaw` seam.
|
|
17
|
+
*
|
|
18
|
+
* FAIL CLOSED, NEVER SILENT (spec §4, HARD requirement). A `dynamic·tool` slot
|
|
19
|
+
* whose tool is not registered throws a teaching {@link SlotResolutionError} that
|
|
20
|
+
* NAMES the missing tool and what IS bound — never an empty slot, never a silent
|
|
21
|
+
* skip. The same discipline covers every dynamic kind: a slot that cannot be
|
|
22
|
+
* filled from what the caller provided fails closed, so a half-assembled prompt
|
|
23
|
+
* is never dispatched.
|
|
24
|
+
*
|
|
25
|
+
* PRIVACY: this module has ZERO network/telemetry imports. Its inputs (tool fns,
|
|
26
|
+
* cache reader, upstream outputs, variables) and its output (the assembled text)
|
|
27
|
+
* are all in-process values. Nothing tool-derived is sent anywhere — assembly is
|
|
28
|
+
* a local computation. That is the "tool keys + dynamic data never leave the
|
|
29
|
+
* process" guarantee, structural rather than promised.
|
|
30
|
+
*/
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.SlotResolutionError = void 0;
|
|
33
|
+
exports.assemblePrompt = assemblePrompt;
|
|
34
|
+
/**
|
|
35
|
+
* A slot that could not be filled — the fail-closed signal (spec §4). Carries
|
|
36
|
+
* the slot id and a teaching message; the tool-unbound case names the missing
|
|
37
|
+
* tool and the bound names, so the fix is obvious at the call site.
|
|
38
|
+
*/
|
|
39
|
+
class SlotResolutionError extends Error {
|
|
40
|
+
constructor(slotId, message) {
|
|
41
|
+
super(message);
|
|
42
|
+
this.name = "SlotResolutionError";
|
|
43
|
+
this.slotId = slotId;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.SlotResolutionError = SlotResolutionError;
|
|
47
|
+
/** The separator between assembled slot parts — a blank line, so adjacent blocks
|
|
48
|
+
* stay legible and a cache `prefix` slot keeps a stable boundary. */
|
|
49
|
+
const PART_SEPARATOR = "\n\n";
|
|
50
|
+
/** Resolve ONE slot to its text, or throw {@link SlotResolutionError} (fail
|
|
51
|
+
* closed). Every branch either returns a concrete string or throws — a slot
|
|
52
|
+
* never resolves to `undefined`/empty by omission. */
|
|
53
|
+
async function resolveSlot(slot, ctx) {
|
|
54
|
+
if (slot.kind === "static") {
|
|
55
|
+
if (slot.text !== undefined)
|
|
56
|
+
return slot.text;
|
|
57
|
+
if (slot.from === "template")
|
|
58
|
+
return ctx.template;
|
|
59
|
+
if (slot.from === "system") {
|
|
60
|
+
if (ctx.system === undefined) {
|
|
61
|
+
throw new SlotResolutionError(slot.id, `static slot "${slot.id}" references \`from: system\`, but no authored ` +
|
|
62
|
+
"`system` text was provided to the resolver");
|
|
63
|
+
}
|
|
64
|
+
return ctx.system;
|
|
65
|
+
}
|
|
66
|
+
// A validated manifest guarantees text XOR from; this is unreachable for a
|
|
67
|
+
// validated slot, but fail closed rather than emit an empty slot.
|
|
68
|
+
throw new SlotResolutionError(slot.id, `static slot "${slot.id}" has neither inline \`text\` nor a \`from\` reference`);
|
|
69
|
+
}
|
|
70
|
+
// dynamic — a validated manifest guarantees a well-formed `source`.
|
|
71
|
+
const source = slot.source;
|
|
72
|
+
if (source === undefined) {
|
|
73
|
+
throw new SlotResolutionError(slot.id, `dynamic slot "${slot.id}" is missing its \`source\``);
|
|
74
|
+
}
|
|
75
|
+
const ref = source.ref;
|
|
76
|
+
switch (source.kind) {
|
|
77
|
+
case "tool": {
|
|
78
|
+
const fn = ctx.tools.get(ref);
|
|
79
|
+
if (fn === undefined) {
|
|
80
|
+
const bound = ctx.tools.names();
|
|
81
|
+
const boundList = bound.length > 0 ? `bound tools: ${bound.join(", ")}` : "no tools are bound";
|
|
82
|
+
throw new SlotResolutionError(slot.id, `slot "${slot.id}" needs tool "${ref}", but it is not bound — call ` +
|
|
83
|
+
`rig.tools.register("${ref}", fn) before this route runs (${boundList}). ` +
|
|
84
|
+
"The prompt was NOT sent with an empty slot (spec §4, fail closed).");
|
|
85
|
+
}
|
|
86
|
+
return fn({ ref, input: ctx.variables ?? {} });
|
|
87
|
+
}
|
|
88
|
+
case "cache": {
|
|
89
|
+
if (ctx.cache === undefined) {
|
|
90
|
+
throw new SlotResolutionError(slot.id, `slot "${slot.id}" needs cache handle "${ref}", but no cache reader was ` +
|
|
91
|
+
"provided to the resolver");
|
|
92
|
+
}
|
|
93
|
+
return ctx.cache(ref);
|
|
94
|
+
}
|
|
95
|
+
case "upstream": {
|
|
96
|
+
const value = ctx.upstream?.[ref];
|
|
97
|
+
if (value === undefined) {
|
|
98
|
+
throw new SlotResolutionError(slot.id, `slot "${slot.id}" needs the approved output of upstream step "${ref}", ` +
|
|
99
|
+
"but it was not provided to the resolver");
|
|
100
|
+
}
|
|
101
|
+
return value;
|
|
102
|
+
}
|
|
103
|
+
case "variable": {
|
|
104
|
+
const value = ctx.variables?.[ref];
|
|
105
|
+
if (value === undefined) {
|
|
106
|
+
throw new SlotResolutionError(slot.id, `slot "${slot.id}" needs variable "${ref}", but it is not in the call's ` +
|
|
107
|
+
"variable whitelist");
|
|
108
|
+
}
|
|
109
|
+
return typeof value === "string" ? value : JSON.stringify(value);
|
|
110
|
+
}
|
|
111
|
+
default: {
|
|
112
|
+
// Exhaustive over DynamicSourceKind; a future kind fails closed here.
|
|
113
|
+
const exhaustive = source.kind;
|
|
114
|
+
throw new SlotResolutionError(slot.id, `slot "${slot.id}" has an unknown dynamic source kind ${JSON.stringify(exhaustive)}`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Resolve every slot of a served manifest IN ORDER and assemble the prompt
|
|
120
|
+
* (spec §4). Slots resolve sequentially so `upstream` ordering and any
|
|
121
|
+
* side-effecting tool run in declared send order. Throws
|
|
122
|
+
* {@link SlotResolutionError} on the FIRST slot that cannot be filled — the
|
|
123
|
+
* prompt is never dispatched half-assembled (fail closed).
|
|
124
|
+
*
|
|
125
|
+
* Pure over its inputs apart from the tool/cache functions the caller supplies,
|
|
126
|
+
* which run in-process. The returned {@link AssembledPrompt} is a local value.
|
|
127
|
+
*/
|
|
128
|
+
async function assemblePrompt(manifest, ctx) {
|
|
129
|
+
const parts = [];
|
|
130
|
+
for (const slot of manifest.slots) {
|
|
131
|
+
const text = await resolveSlot(slot, ctx);
|
|
132
|
+
parts.push({ id: slot.id, text });
|
|
133
|
+
}
|
|
134
|
+
return { text: parts.map((p) => p.text).join(PART_SEPARATOR), parts };
|
|
135
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PSR-2b — the client-side tool-binding registry (spec §4 ADJ-2, authoring-guide
|
|
3
|
+
* §5). The client-fill half of the prompt system-of-record.
|
|
4
|
+
*
|
|
5
|
+
* A `dynamic·tool` manifest slot NAMES a tool (`source.ref`, e.g.
|
|
6
|
+
* `"search_tickets"`); it carries no code and no data (structure-only, D6). To
|
|
7
|
+
* fill that slot at call time the SDK needs a **client-side binding** from that
|
|
8
|
+
* name to a function that runs IN THE CUSTOMER'S PROCESS, with the customer's
|
|
9
|
+
* keys. `rig.tools.register(name, fn)` is that binding.
|
|
10
|
+
*
|
|
11
|
+
* The privacy guarantee lives here: a bound tool `fn` closes over the customer's
|
|
12
|
+
* credentials and does its work locally; ModelRig only ever knows the tool's
|
|
13
|
+
* NAME (already in the manifest). Nothing this registry holds — not a fn, not a
|
|
14
|
+
* key it closes over, not a value it returns — is ever serialized or sent
|
|
15
|
+
* anywhere. This module has ZERO network/telemetry imports, by design, so
|
|
16
|
+
* "tool keys never leave the process" is a structural property, not a promise.
|
|
17
|
+
*
|
|
18
|
+
* Pure + dependency-free.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* The context a bound tool receives when the SDK resolves its slot. Carries the
|
|
22
|
+
* tool NAME being filled and the call's variable whitelist (the same values a
|
|
23
|
+
* `dynamic·variable` slot draws from) so a tool can shape its work from the
|
|
24
|
+
* call's inputs — never anything ModelRig-side. Read-only: a tool observes, it
|
|
25
|
+
* does not mutate the call.
|
|
26
|
+
*/
|
|
27
|
+
export interface ToolResolveContext {
|
|
28
|
+
/** The tool name being resolved (the slot's `source.ref`). */
|
|
29
|
+
readonly ref: string;
|
|
30
|
+
/** The call's variable whitelist — the customer's own inputs, in-process. */
|
|
31
|
+
readonly input: Readonly<Record<string, unknown>>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A bound tool: runs in-process with the customer's keys and returns the text
|
|
35
|
+
* to place in its slot. May be async (a tool usually calls out to the customer's
|
|
36
|
+
* own upstream). Whatever it returns stays local — it becomes the slot's filled
|
|
37
|
+
* text and is assembled into the prompt on the customer's machine.
|
|
38
|
+
*/
|
|
39
|
+
export type ToolFn = (ctx: ToolResolveContext) => string | Promise<string>;
|
|
40
|
+
/**
|
|
41
|
+
* The registry backing `rig.tools`. `register` binds a name → fn (last write
|
|
42
|
+
* wins, so a re-register is a rebind, never a silent duplicate); `get`/`has`
|
|
43
|
+
* look a binding up by name; `names` lists the bound names (for a teaching
|
|
44
|
+
* error). Never throws on read — the caller decides what a missing binding
|
|
45
|
+
* means (the slot resolver FAILS CLOSED with a teaching error, spec §4).
|
|
46
|
+
*/
|
|
47
|
+
export interface ToolRegistry {
|
|
48
|
+
/** Bind `name` to `fn`. Rejects an empty name or a non-function with a
|
|
49
|
+
* teaching error — a misbinding is a bug at the developer's machine, surfaced
|
|
50
|
+
* at register time, never a mystery at call time. */
|
|
51
|
+
register(name: string, fn: ToolFn): void;
|
|
52
|
+
get(name: string): ToolFn | undefined;
|
|
53
|
+
has(name: string): boolean;
|
|
54
|
+
/** The bound names, sorted — used to name what IS available when a slot
|
|
55
|
+
* references a tool that is not. */
|
|
56
|
+
names(): readonly string[];
|
|
57
|
+
}
|
|
58
|
+
/** Build an empty {@link ToolRegistry}. One per rig; `rig.tools` exposes it. */
|
|
59
|
+
export declare function createToolRegistry(): ToolRegistry;
|
|
60
|
+
//# sourceMappingURL=tools-register.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools-register.d.ts","sourceRoot":"","sources":["../../src/prompts/tools-register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,8DAA8D;IAC9D,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACnD;AAED;;;;;GAKG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,kBAAkB,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAE3E;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B;;yDAEqD;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACtC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B;wCACoC;IACpC,KAAK,IAAI,SAAS,MAAM,EAAE,CAAC;CAC5B;AAED,gFAAgF;AAChF,wBAAgB,kBAAkB,IAAI,YAAY,CA4BjD"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* PSR-2b — the client-side tool-binding registry (spec §4 ADJ-2, authoring-guide
|
|
4
|
+
* §5). The client-fill half of the prompt system-of-record.
|
|
5
|
+
*
|
|
6
|
+
* A `dynamic·tool` manifest slot NAMES a tool (`source.ref`, e.g.
|
|
7
|
+
* `"search_tickets"`); it carries no code and no data (structure-only, D6). To
|
|
8
|
+
* fill that slot at call time the SDK needs a **client-side binding** from that
|
|
9
|
+
* name to a function that runs IN THE CUSTOMER'S PROCESS, with the customer's
|
|
10
|
+
* keys. `rig.tools.register(name, fn)` is that binding.
|
|
11
|
+
*
|
|
12
|
+
* The privacy guarantee lives here: a bound tool `fn` closes over the customer's
|
|
13
|
+
* credentials and does its work locally; ModelRig only ever knows the tool's
|
|
14
|
+
* NAME (already in the manifest). Nothing this registry holds — not a fn, not a
|
|
15
|
+
* key it closes over, not a value it returns — is ever serialized or sent
|
|
16
|
+
* anywhere. This module has ZERO network/telemetry imports, by design, so
|
|
17
|
+
* "tool keys never leave the process" is a structural property, not a promise.
|
|
18
|
+
*
|
|
19
|
+
* Pure + dependency-free.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.createToolRegistry = createToolRegistry;
|
|
23
|
+
/** Build an empty {@link ToolRegistry}. One per rig; `rig.tools` exposes it. */
|
|
24
|
+
function createToolRegistry() {
|
|
25
|
+
const bindings = new Map();
|
|
26
|
+
return {
|
|
27
|
+
register(name, fn) {
|
|
28
|
+
if (typeof name !== "string" || name.length === 0) {
|
|
29
|
+
throw new Error("rig.tools.register: the tool name must be a non-empty string (it is the " +
|
|
30
|
+
"name a `dynamic·tool` manifest slot references)");
|
|
31
|
+
}
|
|
32
|
+
if (typeof fn !== "function") {
|
|
33
|
+
throw new Error(`rig.tools.register: the binding for tool "${name}" must be a function ` +
|
|
34
|
+
"(it runs in-process with your keys to fill the slot)");
|
|
35
|
+
}
|
|
36
|
+
bindings.set(name, fn);
|
|
37
|
+
},
|
|
38
|
+
get(name) {
|
|
39
|
+
return bindings.get(name);
|
|
40
|
+
},
|
|
41
|
+
has(name) {
|
|
42
|
+
return bindings.has(name);
|
|
43
|
+
},
|
|
44
|
+
names() {
|
|
45
|
+
return [...bindings.keys()].sort();
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PSR-2 — the content-hash id for a prompt version (`template_sha`).
|
|
3
|
+
*
|
|
4
|
+
* A prompt version is identified by the sha256 of its `template` + `manifest`
|
|
5
|
+
* (spec §2, the Humanloop content-hash pattern: identical content ⇒ no
|
|
6
|
+
* duplicate row). This is the ONE definition of that hash, used by:
|
|
7
|
+
* • the ingest + create-version writer (dedupe: an identical re-ingest resolves
|
|
8
|
+
* to the existing row rather than appending a byte-identical version), and
|
|
9
|
+
* • the served-projection check (does routes.bundle carry THIS version? — the
|
|
10
|
+
* "served this call" marker compares template_sha, PSR-2b).
|
|
11
|
+
*
|
|
12
|
+
* The manifest is CANONICALIZED first (object keys sorted recursively, array
|
|
13
|
+
* order preserved) so a semantically-identical manifest always hashes the same
|
|
14
|
+
* regardless of key order in the source artifact — the same discipline
|
|
15
|
+
* `resolved-bundle.ts` uses for `bundle_sha`. Callers MUST normalize the manifest
|
|
16
|
+
* ({@link normalizeManifest}) before hashing so incidental unknown keys never
|
|
17
|
+
* split the dedupe. Pure + dependency-free (node:crypto only).
|
|
18
|
+
*/
|
|
19
|
+
import type { Manifest } from "./manifest";
|
|
20
|
+
/**
|
|
21
|
+
* The content-hash id of a prompt version — `sha256:<hex>`, self-describing so a
|
|
22
|
+
* future algorithm change is visible in the stored value rather than silent
|
|
23
|
+
* (parity with `hashResolvedBundle`). The template is hashed verbatim; the
|
|
24
|
+
* manifest is canonicalized. The two are joined with a NUL separator that cannot
|
|
25
|
+
* appear in the template, so no `(template, manifest)` pair can collide with a
|
|
26
|
+
* different pair by boundary ambiguity.
|
|
27
|
+
*/
|
|
28
|
+
export declare function promptTemplateSha(template: string, manifest: Manifest): string;
|
|
29
|
+
//# sourceMappingURL=version-hash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version-hash.d.ts","sourceRoot":"","sources":["../../src/prompts/version-hash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAkB3C;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAO9E"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* PSR-2 — the content-hash id for a prompt version (`template_sha`).
|
|
4
|
+
*
|
|
5
|
+
* A prompt version is identified by the sha256 of its `template` + `manifest`
|
|
6
|
+
* (spec §2, the Humanloop content-hash pattern: identical content ⇒ no
|
|
7
|
+
* duplicate row). This is the ONE definition of that hash, used by:
|
|
8
|
+
* • the ingest + create-version writer (dedupe: an identical re-ingest resolves
|
|
9
|
+
* to the existing row rather than appending a byte-identical version), and
|
|
10
|
+
* • the served-projection check (does routes.bundle carry THIS version? — the
|
|
11
|
+
* "served this call" marker compares template_sha, PSR-2b).
|
|
12
|
+
*
|
|
13
|
+
* The manifest is CANONICALIZED first (object keys sorted recursively, array
|
|
14
|
+
* order preserved) so a semantically-identical manifest always hashes the same
|
|
15
|
+
* regardless of key order in the source artifact — the same discipline
|
|
16
|
+
* `resolved-bundle.ts` uses for `bundle_sha`. Callers MUST normalize the manifest
|
|
17
|
+
* ({@link normalizeManifest}) before hashing so incidental unknown keys never
|
|
18
|
+
* split the dedupe. Pure + dependency-free (node:crypto only).
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.promptTemplateSha = promptTemplateSha;
|
|
22
|
+
const node_crypto_1 = require("node:crypto");
|
|
23
|
+
/** Deterministic JSON: object keys sorted recursively, array order preserved.
|
|
24
|
+
* The same value always produces the same bytes, so the hash is stable across
|
|
25
|
+
* processes. Mirrors resolved-bundle.ts's canonicalize (kept local so the two
|
|
26
|
+
* hashers stay independently auditable). */
|
|
27
|
+
function canonicalize(value) {
|
|
28
|
+
if (Array.isArray(value))
|
|
29
|
+
return value.map(canonicalize);
|
|
30
|
+
if (value !== null && typeof value === "object") {
|
|
31
|
+
const out = {};
|
|
32
|
+
for (const key of Object.keys(value).sort()) {
|
|
33
|
+
out[key] = canonicalize(value[key]);
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The content-hash id of a prompt version — `sha256:<hex>`, self-describing so a
|
|
41
|
+
* future algorithm change is visible in the stored value rather than silent
|
|
42
|
+
* (parity with `hashResolvedBundle`). The template is hashed verbatim; the
|
|
43
|
+
* manifest is canonicalized. The two are joined with a NUL separator that cannot
|
|
44
|
+
* appear in the template, so no `(template, manifest)` pair can collide with a
|
|
45
|
+
* different pair by boundary ambiguity.
|
|
46
|
+
*/
|
|
47
|
+
function promptTemplateSha(template, manifest) {
|
|
48
|
+
const canonicalManifest = JSON.stringify(canonicalize(manifest));
|
|
49
|
+
const hash = (0, node_crypto_1.createHash)("sha256");
|
|
50
|
+
hash.update(template, "utf8");
|
|
51
|
+
hash.update("\0", "utf8");
|
|
52
|
+
hash.update(canonicalManifest, "utf8");
|
|
53
|
+
return `sha256:${hash.digest("hex")}`;
|
|
54
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `modelrig prompts export` — PSR-3 (spec §3, the anti-lock-in gate).
|
|
3
|
+
*
|
|
4
|
+
* modelrig prompts export --route <route> [--out modelrig/routes]
|
|
5
|
+
* [--label prod | --version N] [--segment default] [--json]
|
|
6
|
+
*
|
|
7
|
+
* Fetches a prompt version from the ModelRig System-of-Record
|
|
8
|
+
* (`GET /v1/prompts/:route/export`, key-authed — a read needs only an org-scoped
|
|
9
|
+
* key) and writes its git files: the authored `template` to `<route>.md` and the
|
|
10
|
+
* assembly `manifest` to a sibling `<route>.manifest.json`, BYTE-FAITHFULLY. The
|
|
11
|
+
* command then PROVES the round-trip locally — it re-hashes the written files the
|
|
12
|
+
* way the store would (validate → normalize → hash) and checks the content id
|
|
13
|
+
* matches what ModelRig returned. ModelRig being your prompt's primary store
|
|
14
|
+
* never traps it in git.
|
|
15
|
+
*
|
|
16
|
+
* Goes through the API boundary (T12: the CLI never holds a DB client); the
|
|
17
|
+
* server scopes the read to the key's org (T11).
|
|
18
|
+
*/
|
|
19
|
+
import type { Flags } from "./cli";
|
|
20
|
+
export declare function cmdPromptsExport(flags: Flags): Promise<number>;
|
|
21
|
+
//# sourceMappingURL=prompts-export-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts-export-cli.d.ts","sourceRoot":"","sources":["../src/prompts-export-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AA0CnC,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CA4EpE"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* `modelrig prompts export` — PSR-3 (spec §3, the anti-lock-in gate).
|
|
4
|
+
*
|
|
5
|
+
* modelrig prompts export --route <route> [--out modelrig/routes]
|
|
6
|
+
* [--label prod | --version N] [--segment default] [--json]
|
|
7
|
+
*
|
|
8
|
+
* Fetches a prompt version from the ModelRig System-of-Record
|
|
9
|
+
* (`GET /v1/prompts/:route/export`, key-authed — a read needs only an org-scoped
|
|
10
|
+
* key) and writes its git files: the authored `template` to `<route>.md` and the
|
|
11
|
+
* assembly `manifest` to a sibling `<route>.manifest.json`, BYTE-FAITHFULLY. The
|
|
12
|
+
* command then PROVES the round-trip locally — it re-hashes the written files the
|
|
13
|
+
* way the store would (validate → normalize → hash) and checks the content id
|
|
14
|
+
* matches what ModelRig returned. ModelRig being your prompt's primary store
|
|
15
|
+
* never traps it in git.
|
|
16
|
+
*
|
|
17
|
+
* Goes through the API boundary (T12: the CLI never holds a DB client); the
|
|
18
|
+
* server scopes the read to the key's org (T11).
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.cmdPromptsExport = cmdPromptsExport;
|
|
22
|
+
const node_fs_1 = require("node:fs");
|
|
23
|
+
const node_path_1 = require("node:path");
|
|
24
|
+
const config_1 = require("./config");
|
|
25
|
+
const index_1 = require("./index");
|
|
26
|
+
const DEFAULT_OUT = "modelrig/routes";
|
|
27
|
+
function usage() {
|
|
28
|
+
return [
|
|
29
|
+
"usage: modelrig prompts export --route <route> [--out modelrig/routes]",
|
|
30
|
+
" [--label prod | --version N] [--segment default] [--json]",
|
|
31
|
+
"",
|
|
32
|
+
"Exports a prompt version from ModelRig back to git files (the anti-lock-in guarantee):",
|
|
33
|
+
" <route>.md the authored prompt template, verbatim",
|
|
34
|
+
" <route>.manifest.json the assembly manifest (structure only)",
|
|
35
|
+
"A version re-created from these files carries the SAME content hash — proven after write.",
|
|
36
|
+
"",
|
|
37
|
+
" MODELRIG_API_KEY a rig_sk_ key in your org (a read needs no special scope)",
|
|
38
|
+
" MODELRIG_INGEST_URL optional — the server base; defaults to the hosted API",
|
|
39
|
+
].join("\n");
|
|
40
|
+
}
|
|
41
|
+
/** The content id a version re-created from the written files would carry — the
|
|
42
|
+
* store's write discipline (validate → normalize → hash) run locally, so the
|
|
43
|
+
* round-trip is proven without a second server call. */
|
|
44
|
+
function recreatedSha(templateFile, manifestFile) {
|
|
45
|
+
let parsed;
|
|
46
|
+
try {
|
|
47
|
+
parsed = JSON.parse(manifestFile);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
const validated = (0, index_1.validateManifest)(parsed);
|
|
53
|
+
if (!validated.ok)
|
|
54
|
+
return null;
|
|
55
|
+
return (0, index_1.promptTemplateSha)(templateFile, (0, index_1.normalizeManifest)(validated.manifest));
|
|
56
|
+
}
|
|
57
|
+
async function cmdPromptsExport(flags) {
|
|
58
|
+
// The subcommand token ("export") is flags.positional[0]; require it explicitly
|
|
59
|
+
// so `modelrig prompts` (no verb) prints usage rather than guessing.
|
|
60
|
+
if (flags.positional[0] !== "export") {
|
|
61
|
+
console.error(usage());
|
|
62
|
+
return 1;
|
|
63
|
+
}
|
|
64
|
+
const route = flags.named.get("route");
|
|
65
|
+
const out = flags.named.get("out") ?? DEFAULT_OUT;
|
|
66
|
+
const label = flags.named.get("label");
|
|
67
|
+
const versionRaw = flags.named.get("version");
|
|
68
|
+
const segment = flags.named.get("segment");
|
|
69
|
+
const asJson = flags.bare.has("json");
|
|
70
|
+
const exp = (0, config_1.loadConfigFromEnv)().export;
|
|
71
|
+
const api = exp !== undefined && exp.mode === "api" ? exp : undefined;
|
|
72
|
+
const base = api !== undefined ? new URL(api.ingestUrl).origin : "";
|
|
73
|
+
const key = api?.apiKey ?? "";
|
|
74
|
+
if (route === undefined || route === "" || base === "" || key === "") {
|
|
75
|
+
console.error(usage());
|
|
76
|
+
return 1;
|
|
77
|
+
}
|
|
78
|
+
const query = [];
|
|
79
|
+
if (versionRaw !== undefined && versionRaw !== "")
|
|
80
|
+
query.push(`version=${encodeURIComponent(versionRaw)}`);
|
|
81
|
+
else if (label !== undefined && label !== "")
|
|
82
|
+
query.push(`label=${encodeURIComponent(label)}`);
|
|
83
|
+
if (segment !== undefined && segment !== "")
|
|
84
|
+
query.push(`segment=${encodeURIComponent(segment)}`);
|
|
85
|
+
const suffix = query.length > 0 ? `?${query.join("&")}` : "";
|
|
86
|
+
let res;
|
|
87
|
+
try {
|
|
88
|
+
res = await fetch(`${base}/v1/prompts/${encodeURIComponent(route)}/export${suffix}`, {
|
|
89
|
+
headers: { authorization: `Bearer ${key}` },
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
console.error(`prompts export: could not reach ${base}: ${err instanceof Error ? err.message : String(err)}`);
|
|
94
|
+
return 1;
|
|
95
|
+
}
|
|
96
|
+
const payload = (await res.json().catch(() => ({})));
|
|
97
|
+
if (!res.ok) {
|
|
98
|
+
console.error(`prompts export ${res.status}: ${[payload.error, payload.fix_hint].filter(Boolean).join(" — ") || "failed"}`);
|
|
99
|
+
return 1;
|
|
100
|
+
}
|
|
101
|
+
const files = payload.files ?? [];
|
|
102
|
+
if (files.length === 0 || payload.template_sha === undefined) {
|
|
103
|
+
console.error("prompts export: the server returned no files");
|
|
104
|
+
return 1;
|
|
105
|
+
}
|
|
106
|
+
// Write each file under --out, creating directories as needed.
|
|
107
|
+
const written = [];
|
|
108
|
+
for (const f of files) {
|
|
109
|
+
const dest = (0, node_path_1.join)(out, f.path);
|
|
110
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(dest), { recursive: true });
|
|
111
|
+
(0, node_fs_1.writeFileSync)(dest, f.content);
|
|
112
|
+
written.push(dest);
|
|
113
|
+
}
|
|
114
|
+
// Prove the round-trip from the bytes on disk (never trust the transfer): the
|
|
115
|
+
// template file + the manifest file must re-hash to the server's content id.
|
|
116
|
+
const md = files.find((f) => f.path.endsWith(".md"));
|
|
117
|
+
const mf = files.find((f) => f.path.endsWith(".manifest.json"));
|
|
118
|
+
const rehashed = md !== undefined && mf !== undefined ? recreatedSha(md.content, mf.content) : null;
|
|
119
|
+
const roundTripped = rehashed !== null && rehashed === payload.template_sha;
|
|
120
|
+
if (asJson) {
|
|
121
|
+
console.log(JSON.stringify({ route: payload.route, version: payload.version, template_sha: payload.template_sha, written, round_trip: roundTripped }, null, 2));
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
console.log(`Exported ${route} version ${String(payload.version)} → ${written.join(", ")}`);
|
|
125
|
+
console.log(roundTripped
|
|
126
|
+
? `Round-trip verified: re-creating from these files reproduces the same content hash (${payload.template_sha.slice(0, 12)}…). Your prompt is not locked in.`
|
|
127
|
+
: "WARNING: the written files did NOT re-hash to the server's content id — do not rely on this export; re-run.");
|
|
128
|
+
}
|
|
129
|
+
return roundTripped ? 0 : 1;
|
|
130
|
+
}
|
package/dist/query/grammar.d.ts
CHANGED
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
import type { Classification, ColumnSource } from "./columns";
|
|
34
34
|
export { describeAnalyticsSchema, evaluateAnalyticsQuery, planAnalyticsRead, ANALYTICS_SCAN_CAP, selectableColumnsAreMetaSafe, } from "./analytics";
|
|
35
35
|
export type { AnalyticsSchema, AnalyticsSchemaField, AnalyticsResult, AnalyticsReadPlan, AnalyticsRow } from "./analytics";
|
|
36
|
-
export { SAVED_QUERIES, savedQueryById, sinceIsoFor } from "./saved";
|
|
37
|
-
export type { SavedQuery } from "./saved";
|
|
36
|
+
export { SAVED_QUERIES, savedQueryById, sinceIsoFor, LAUNCH_COHORT_QUERIES, cohortQueryById } from "./saved";
|
|
37
|
+
export type { SavedQuery, CohortQuery } from "./saved";
|
|
38
38
|
export { DIMENSION_COLUMNS, METRIC_COLUMNS, RESERVED_DIMENSION_NAMES } from "./columns";
|
|
39
39
|
export type { ColumnDef, Classification, ColumnSource } from "./columns";
|
|
40
40
|
export declare class QueryGrammarError extends Error {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grammar.d.ts","sourceRoot":"","sources":["../../src/query/grammar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAa,YAAY,EAAE,MAAM,WAAW,CAAC;AAKzE,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,eAAe,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3H,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"grammar.d.ts","sourceRoot":"","sources":["../../src/query/grammar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAa,YAAY,EAAE,MAAM,WAAW,CAAC;AAKzE,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,eAAe,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3H,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC7G,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACxF,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzE,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAI5B;AAED,4CAA4C;AAC5C,MAAM,MAAM,UAAU,GAClB;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;CAAE,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;CACjD;AAID,MAAM,MAAM,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAElD;6DAC6D;AAC7D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,aAAa,GACrB;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;CAAE,GAC1D;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GACnD;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9G,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AA8ID;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAgIlD;AAuBD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,aAAa,CAqC5E"}
|
package/dist/query/grammar.js
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* enum/number/boolean/hash/identifier/timestamp (columns.ts), never content.
|
|
33
33
|
*/
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.QueryGrammarError = exports.RESERVED_DIMENSION_NAMES = exports.METRIC_COLUMNS = exports.DIMENSION_COLUMNS = exports.sinceIsoFor = exports.savedQueryById = exports.SAVED_QUERIES = exports.selectableColumnsAreMetaSafe = exports.ANALYTICS_SCAN_CAP = exports.planAnalyticsRead = exports.evaluateAnalyticsQuery = exports.describeAnalyticsSchema = void 0;
|
|
35
|
+
exports.QueryGrammarError = exports.RESERVED_DIMENSION_NAMES = exports.METRIC_COLUMNS = exports.DIMENSION_COLUMNS = exports.cohortQueryById = exports.LAUNCH_COHORT_QUERIES = exports.sinceIsoFor = exports.savedQueryById = exports.SAVED_QUERIES = exports.selectableColumnsAreMetaSafe = exports.ANALYTICS_SCAN_CAP = exports.planAnalyticsRead = exports.evaluateAnalyticsQuery = exports.describeAnalyticsSchema = void 0;
|
|
36
36
|
exports.parseQuery = parseQuery;
|
|
37
37
|
exports.compileQuery = compileQuery;
|
|
38
38
|
const columns_1 = require("./columns");
|
|
@@ -48,6 +48,8 @@ var saved_1 = require("./saved");
|
|
|
48
48
|
Object.defineProperty(exports, "SAVED_QUERIES", { enumerable: true, get: function () { return saved_1.SAVED_QUERIES; } });
|
|
49
49
|
Object.defineProperty(exports, "savedQueryById", { enumerable: true, get: function () { return saved_1.savedQueryById; } });
|
|
50
50
|
Object.defineProperty(exports, "sinceIsoFor", { enumerable: true, get: function () { return saved_1.sinceIsoFor; } });
|
|
51
|
+
Object.defineProperty(exports, "LAUNCH_COHORT_QUERIES", { enumerable: true, get: function () { return saved_1.LAUNCH_COHORT_QUERIES; } });
|
|
52
|
+
Object.defineProperty(exports, "cohortQueryById", { enumerable: true, get: function () { return saved_1.cohortQueryById; } });
|
|
51
53
|
var columns_2 = require("./columns");
|
|
52
54
|
Object.defineProperty(exports, "DIMENSION_COLUMNS", { enumerable: true, get: function () { return columns_2.DIMENSION_COLUMNS; } });
|
|
53
55
|
Object.defineProperty(exports, "METRIC_COLUMNS", { enumerable: true, get: function () { return columns_2.METRIC_COLUMNS; } });
|