@lightdash-tools/mcp 0.13.2 → 0.16.1

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 (137) hide show
  1. package/README.md +54 -18
  2. package/dist/auth/oauth-broker/lightdash-token.d.ts +6 -5
  3. package/dist/auth/oauth-broker/lightdash-token.js +6 -10
  4. package/dist/auth/oauth-broker/mcp-access-token.d.ts +31 -0
  5. package/dist/auth/oauth-broker/mcp-access-token.js +109 -0
  6. package/dist/auth/oauth-broker/mcp-access-token.test.d.ts +1 -0
  7. package/dist/auth/oauth-broker/mcp-access-token.test.js +61 -0
  8. package/dist/auth/oauth-broker/pending-store.d.ts +9 -3
  9. package/dist/auth/oauth-broker/pending-store.js +5 -3
  10. package/dist/auth/oauth-broker/pending-store.test.js +28 -44
  11. package/dist/auth/oauth-broker/routes.d.ts +2 -1
  12. package/dist/auth/oauth-broker/routes.js +97 -45
  13. package/dist/auth/oauth-broker/routes.test.js +81 -13
  14. package/dist/auth/request-state-key.d.ts +1 -1
  15. package/dist/auth/request-state-key.js +1 -1
  16. package/dist/auth/resource-server/lightdash-oauth-middleware.d.ts +2 -0
  17. package/dist/auth/resource-server/lightdash-oauth-middleware.js +58 -37
  18. package/dist/auth/resource-server/lightdash-oauth-middleware.test.js +59 -57
  19. package/dist/auth/resource-server/oauth-protected-resource.d.ts +2 -2
  20. package/dist/auth/resource-server/oauth-protected-resource.js +10 -9
  21. package/dist/bin.js +34 -8
  22. package/dist/config/enabled-profiles.d.ts +23 -0
  23. package/dist/config/enabled-profiles.js +57 -0
  24. package/dist/config/enabled-profiles.test.d.ts +1 -0
  25. package/dist/config/enabled-profiles.test.js +62 -0
  26. package/dist/config/env.d.ts +7 -0
  27. package/dist/config/env.js +8 -1
  28. package/dist/config/load-mcp-config.d.ts +15 -1
  29. package/dist/config/load-mcp-config.js +21 -9
  30. package/dist/config/load-mcp-config.test.js +61 -0
  31. package/dist/config/prompt-context-policy.d.ts +18 -0
  32. package/dist/config/prompt-context-policy.js +40 -0
  33. package/dist/config/prompt-context-policy.test.d.ts +4 -0
  34. package/dist/config/prompt-context-policy.test.js +35 -0
  35. package/dist/config/test-mcp-http-config.js +4 -1
  36. package/dist/governance/mcp-post-factory-context.d.ts +2 -0
  37. package/dist/http.d.ts +7 -1
  38. package/dist/http.integration.test.js +102 -44
  39. package/dist/http.js +10 -1
  40. package/dist/index.d.ts +6 -1
  41. package/dist/index.integration.test.js +3 -12
  42. package/dist/index.js +6 -3
  43. package/dist/policy/content-developer.d.ts +5 -0
  44. package/dist/policy/content-developer.js +25 -1
  45. package/dist/policy/content-developer.test.js +29 -0
  46. package/dist/profiles/ai-agent-ops/v1/invariants.d.ts +27 -0
  47. package/dist/profiles/ai-agent-ops/v1/invariants.js +39 -0
  48. package/dist/profiles/ai-agent-ops/v1/prompts.d.ts +3 -2
  49. package/dist/profiles/ai-agent-ops/v1/prompts.js +67 -41
  50. package/dist/profiles/ai-agent-ops/v1/resources/playbooks.d.ts +2 -1
  51. package/dist/profiles/ai-agent-ops/v1/resources/playbooks.js +10 -3
  52. package/dist/profiles/content-developer/v1/invariants.d.ts +69 -0
  53. package/dist/profiles/content-developer/v1/invariants.js +95 -0
  54. package/dist/profiles/content-developer/v1/prompt-specs.d.ts +32 -0
  55. package/dist/profiles/content-developer/v1/prompt-specs.js +56 -0
  56. package/dist/profiles/content-developer/v1/prompts.d.ts +4 -3
  57. package/dist/profiles/content-developer/v1/prompts.js +65 -71
  58. package/dist/profiles/content-developer/v1/prompts.test.js +61 -7
  59. package/dist/profiles/content-developer/v1/resources/playbooks/chart-types.md +2 -1
  60. package/dist/profiles/content-developer/v1/resources/playbooks/core.md +3 -1
  61. package/dist/profiles/content-developer/v1/resources/playbooks/dashboard-design.md +11 -1
  62. package/dist/profiles/content-developer/v1/resources/playbooks/dashboards.md +1 -1
  63. package/dist/profiles/content-developer/v1/resources/playbooks/index.md +11 -8
  64. package/dist/profiles/content-developer/v1/resources/playbooks/recovery/dashboard-diff.md +15 -0
  65. package/dist/profiles/content-developer/v1/resources/playbooks/recovery/preview-required.md +14 -0
  66. package/dist/profiles/content-developer/v1/resources/playbooks/recovery/preview-stale.md +21 -0
  67. package/dist/profiles/content-developer/v1/resources/playbooks/table-calculations.md +15 -3
  68. package/dist/profiles/content-developer/v1/resources/playbooks.d.ts +3 -2
  69. package/dist/profiles/content-developer/v1/resources/playbooks.js +35 -21
  70. package/dist/profiles/content-governance/v1/invariants.d.ts +27 -0
  71. package/dist/profiles/content-governance/v1/invariants.js +39 -0
  72. package/dist/profiles/content-governance/v1/prompts.d.ts +4 -2
  73. package/dist/profiles/content-governance/v1/prompts.js +31 -19
  74. package/dist/profiles/content-governance/v1/resources/playbooks.d.ts +2 -1
  75. package/dist/profiles/content-governance/v1/resources/playbooks.js +8 -9
  76. package/dist/profiles/content-reader/v1/index.js +1 -0
  77. package/dist/profiles/content-reader/v1/invariants.d.ts +33 -0
  78. package/dist/profiles/content-reader/v1/invariants.js +47 -0
  79. package/dist/profiles/content-reader/v1/prompt-specs.d.ts +18 -0
  80. package/dist/profiles/content-reader/v1/prompt-specs.js +33 -0
  81. package/dist/profiles/content-reader/v1/prompts.d.ts +3 -2
  82. package/dist/profiles/content-reader/v1/prompts.js +69 -75
  83. package/dist/profiles/content-reader/v1/resources/playbooks/compare.md +1 -1
  84. package/dist/profiles/content-reader/v1/resources/playbooks/core.md +1 -0
  85. package/dist/profiles/content-reader/v1/resources/playbooks/discover.md +12 -3
  86. package/dist/profiles/content-reader/v1/resources/playbooks/explain-run.md +2 -1
  87. package/dist/profiles/content-reader/v1/resources/playbooks.d.ts +2 -1
  88. package/dist/profiles/content-reader/v1/resources/playbooks.js +10 -11
  89. package/dist/profiles/data-analyst/v1/invariants.d.ts +21 -0
  90. package/dist/profiles/data-analyst/v1/invariants.js +31 -0
  91. package/dist/profiles/data-analyst/v1/prompts.d.ts +3 -2
  92. package/dist/profiles/data-analyst/v1/prompts.js +17 -9
  93. package/dist/profiles/data-analyst/v1/resources/playbooks.d.ts +2 -1
  94. package/dist/profiles/data-analyst/v1/resources/playbooks.js +6 -7
  95. package/dist/profiles/index.d.ts +2 -1
  96. package/dist/profiles/index.js +2 -1
  97. package/dist/profiles/index.test.js +2 -1
  98. package/dist/profiles/lib/playbook-resources.d.ts +16 -34
  99. package/dist/profiles/lib/playbook-resources.js +55 -76
  100. package/dist/profiles/lib/prompt-context.d.ts +71 -0
  101. package/dist/profiles/lib/prompt-context.js +205 -0
  102. package/dist/profiles/lib/prompt-context.test.d.ts +4 -0
  103. package/dist/profiles/lib/prompt-context.test.js +154 -0
  104. package/dist/profiles/lib/prompt-invariants.d.ts +20 -0
  105. package/dist/profiles/lib/prompt-invariants.js +54 -0
  106. package/dist/profiles/organization-audit/v1/invariants.d.ts +24 -0
  107. package/dist/profiles/organization-audit/v1/invariants.js +35 -0
  108. package/dist/profiles/organization-audit/v1/prompts.d.ts +3 -2
  109. package/dist/profiles/organization-audit/v1/prompts.js +44 -28
  110. package/dist/profiles/organization-audit/v1/resources/playbooks.d.ts +2 -1
  111. package/dist/profiles/organization-audit/v1/resources/playbooks.js +10 -3
  112. package/dist/profiles/semantic-layer/v1/invariants.d.ts +27 -0
  113. package/dist/profiles/semantic-layer/v1/invariants.js +39 -0
  114. package/dist/profiles/semantic-layer/v1/prompts.d.ts +3 -2
  115. package/dist/profiles/semantic-layer/v1/prompts.js +37 -26
  116. package/dist/profiles/semantic-layer/v1/resources/playbooks.d.ts +2 -4
  117. package/dist/profiles/semantic-layer/v1/resources/playbooks.js +8 -7
  118. package/dist/profiles/test-support/prompt-context-budget.test.d.ts +5 -0
  119. package/dist/profiles/test-support/prompt-context-budget.test.js +72 -0
  120. package/dist/profiles/types.d.ts +6 -1
  121. package/dist/server/capabilities.d.ts +3 -0
  122. package/dist/server/capabilities.js +4 -2
  123. package/dist/stdio.process.test.js +2 -1
  124. package/dist/tools/lib/schema-fields.d.ts +4 -0
  125. package/dist/tools/lib/schema-fields.js +8 -1
  126. package/dist/tools/project/developer-content-preview.js +1 -1
  127. package/dist/tools/project/developer-content.js +2 -2
  128. package/dist/tools/project/reader-content.d.ts +2 -0
  129. package/dist/tools/project/reader-content.js +28 -1
  130. package/dist/tools/query/reader-tool-helpers.d.ts +2 -2
  131. package/dist/tools/query/reader-tool-helpers.js +2 -2
  132. package/dist/tools/query/reader-tool-helpers.test.js +1 -0
  133. package/dist/tools/shared.d.ts +6 -1
  134. package/dist/tools/shared.js +12 -2
  135. package/dist/transports/streamable-http.js +16 -6
  136. package/dist/transports/streamable-http.test.js +16 -0
  137. package/package.json +3 -3
@@ -4,13 +4,16 @@ URI: `lightdash://playbooks/content-developer`
4
4
 
5
5
  Workflow-scoped playbooks (always load **core** plus one topic with a prompt):
6
6
 
7
- | Topic | URI |
8
- | ------------------------------------------------------------ | ------------------------------------------------------------ |
9
- | Core (gates & bans) | `lightdash://playbooks/content-developer/core` |
10
- | Dashboards & dashboard-owned charts | `lightdash://playbooks/content-developer/dashboards` |
11
- | Dashboard design (Design Spec + layout / markdown / filters) | `lightdash://playbooks/content-developer/dashboard-design` |
12
- | Chart types (cartesian + pie/funnel/…) | `lightdash://playbooks/content-developer/chart-types` |
13
- | Table calculations (template / formula / sql) | `lightdash://playbooks/content-developer/table-calculations` |
14
- | Content move | `lightdash://playbooks/content-developer/content-move` |
7
+ | Topic | URI |
8
+ | ------------------------------------------------------------ | ------------------------------------------------------------------- |
9
+ | Core (gates & bans) | `lightdash://playbooks/content-developer/core` |
10
+ | Dashboards & dashboard-owned charts | `lightdash://playbooks/content-developer/dashboards` |
11
+ | Dashboard design (Design Spec + layout / markdown / filters) | `lightdash://playbooks/content-developer/dashboard-design` |
12
+ | Chart types (cartesian + pie/funnel/…) | `lightdash://playbooks/content-developer/chart-types` |
13
+ | Table calculations (template / formula / sql) | `lightdash://playbooks/content-developer/table-calculations` |
14
+ | Content move | `lightdash://playbooks/content-developer/content-move` |
15
+ | Recovery: PREVIEW_STALE | `lightdash://playbooks/content-developer/recovery/preview-stale` |
16
+ | Recovery: PREVIEW_REQUIRED | `lightdash://playbooks/content-developer/recovery/preview-required` |
17
+ | Recovery: dashboard preview diff | `lightdash://playbooks/content-developer/recovery/dashboard-diff` |
15
18
 
16
19
  **Authoring order:** clarify Objective → Design Spec → approve → dashboard shell → charts with `dashboardSlug` → tiles (+ optional filters; prefer one explore or `tileTargets` exclude by tile UUID). Always pass **`projectUuid`** on `confirm_preview` and apply when there is no HTTP pin. Clone via `get_chart_as_code`; never invent fieldIds or skinny `chartConfig` (cartesian series need `encode.xRef`/`yRef`). Multi-viz / all chart types only when the user explicitly asks (batch: shell → charts ≤2 parallel → one tile update). Cap concurrent writes at ≤2 on hosted tunnels. Spaces are Terraform / out-of-band (`list_spaces` / `get_space` only).
@@ -0,0 +1,15 @@
1
+ # Recovery: dashboard preview diff noise
2
+
3
+ URI: `lightdash://playbooks/content-developer/recovery/dashboard-diff`
4
+
5
+ ## When
6
+
7
+ Interpreting `diff.removed` / `diff.added` on dashboard **update** previews before apply.
8
+
9
+ ## Noise (safe to ignore)
10
+
11
+ Server-owned metadata often listed as removed when omitted from the proposal: `access`, `views`, `updatedAt`, `uuid`, `slug`, `organizationUuid`, and similar.
12
+
13
+ ## Real omissions (do not apply)
14
+
15
+ If **`tiles`**, **`tabs`**, or **`filters`** appear in `diff.removed`, you omitted them from `changes`. Re-preview with the full intentional `tiles`/`tabs`/`filters` (copy layout from preview `current` when only editing name/description). Never ship a description-only body that drops the board.
@@ -0,0 +1,14 @@
1
+ # Recovery: PREVIEW_REQUIRED
2
+
3
+ URI: `lightdash://playbooks/content-developer/recovery/preview-required`
4
+
5
+ ## When
6
+
7
+ Tool error `PREVIEW_REQUIRED` — missing, invalid, or expired preview token (“invalid or expired”). There is no separate `PREVIEW_EXPIRED` code (~10 min TTL).
8
+
9
+ ## Recover
10
+
11
+ 1. Run the matching `preview_*` again for this write (new draft token).
12
+ 2. `confirm_preview` with that draft + exact `resourceKind` / `resourceKey` + `projectUuid` when there is no HTTP pin.
13
+ 3. Apply with the **new** validated token from confirm — never reuse a draft token after confirm.
14
+ 4. If confirm returned `PREVIEW_NOT_VALIDATED` / `PREVIEW_NOT_OWNED`, fix kind/key/ownership and re-preview; do not treat `validate_*` as an unlock.
@@ -0,0 +1,21 @@
1
+ # Recovery: PREVIEW_STALE
2
+
3
+ URI: `lightdash://playbooks/content-developer/recovery/preview-stale`
4
+
5
+ ## When
6
+
7
+ Tool error `PREVIEW_STALE` — content hash mismatch, baseline `updatedAt` drift, create race, or resourceKey/kind mismatch.
8
+
9
+ ## Recover
10
+
11
+ 1. Stop applying. Do **not** retry the same validated token with a tweaked body.
12
+ 2. Re-`preview_*` with the **intended full proposed payload** (same nested `chart`/`dashboard`/`changes` you will apply).
13
+ 3. `confirm_preview` with the new draft token + exact `resourceKind` / `resourceKey` + `projectUuid` (required without HTTP pin).
14
+ 4. Apply using the **returned** validated token and the **identical** proposed body — no description/name/SQL/tiles tidy between confirm and apply.
15
+ 5. Cap retries at **≤2** per resource after `PREVIEW_STALE`.
16
+
17
+ ## Common causes
18
+
19
+ - Edited proposed fields after preview (hash mismatch).
20
+ - Resource changed under you (`updatedAt` / create appeared).
21
+ - Create-chart preview omitted top-level `slug` → `resourceKey` mismatch at apply.
@@ -4,11 +4,22 @@ URI: `lightdash://playbooks/content-developer/table-calculations`
4
4
 
5
5
  Add chart-local metrics on top of explore dimensions/metrics via `metricQuery.tableCalculations`. Prefer clone (`get_chart_as_code`) then append calcs. This profile **cannot** run queries to verify row values.
6
6
 
7
- Docs: [overview](https://docs.lightdash.com/guides/table-calculations) · [formula](https://docs.lightdash.com/guides/formula-table-calculations) · [SQL templates](https://docs.lightdash.com/guides/table-calculations/sql-templates) · [as-code](https://docs.lightdash.com/guides/developer/dashboards-as-code) · [row](https://docs.lightdash.com/references/table-calculation-functions/row-functions) / [pivot](https://docs.lightdash.com/references/table-calculation-functions/pivot-functions) / [aggregate](https://docs.lightdash.com/references/table-calculation-functions/aggregate-functions) functions.
7
+ Docs: [overview](https://docs.lightdash.com/guides/table-calculations) · [formula](https://docs.lightdash.com/guides/formula-table-calculations) · [SQL templates](https://docs.lightdash.com/guides/table-calculations/sql-templates) · [as-code](https://docs.lightdash.com/guides/developer/dashboards-as-code) · [period-over-period](https://docs.lightdash.com/guides/period-over-period) · [row](https://docs.lightdash.com/references/table-calculation-functions/row-functions) / [pivot](https://docs.lightdash.com/references/table-calculation-functions/pivot-functions) / [aggregate](https://docs.lightdash.com/references/table-calculation-functions/aggregate-functions) functions.
8
8
 
9
- ## When to use
9
+ ## Native PoP metrics (prefer before table calcs)
10
10
 
11
- - Chart-specific PoP, % of total, rank, running total, rolling window, pivot share.
11
+ Period-over-period may already exist on a seed as **system-generated metrics** ([period-over-period guide](https://docs.lightdash.com/guides/period-over-period); OpenAPI `generationType: periodOverPeriod`).
12
+
13
+ 1. `get_chart_as_code` on a rendering seed.
14
+ 2. If any metric has `generationType: periodOverPeriod` (plus `baseMetricId` / `timeDimensionId` / `periodOffset` / `granularity` as present), **preserve those metrics verbatim** — do not rebuild them as table calculations.
15
+ 3. Else use table calculations below for % change, lag, running totals, etc.
16
+ 4. KPI `big_number` with `showComparison` / compare-to-previous-row: keep from seed when present.
17
+
18
+ **Hard ban:** do not invent PoP metrics by hand. This profile cannot use the Explorer “Add period comparison” UI — only clone as-code bodies.
19
+
20
+ ## When to use table calculations
21
+
22
+ - Chart-specific PoP (when no native PoP metrics on the seed), % of total, rank, running total, rolling window, pivot share.
12
23
  - If the same calc is reused across many boards → put it in **dbt** / the semantic layer instead ([overview](https://docs.lightdash.com/guides/table-calculations)).
13
24
 
14
25
  ## Preference (playbook policy)
@@ -113,6 +124,7 @@ Field IDs are **illustrative** — copy real `fieldId`s from the explore / seed.
113
124
  - Do not invent `fieldId`s or results-header column names. Copy them from `get_chart_as_code` / explore seeds — playbook skeletons are examples only.
114
125
  - `preview_chart_changes` / `confirm_preview` do **not** prove template `fieldId`s or formula headers exist; inventing IDs can still preview-validate and only fail at query time.
115
126
  - Do not invent SQL helpers — use `total()` / `row_total()` ([aggregate](https://docs.lightdash.com/references/table-calculation-functions/aggregate-functions)) or documented `pivot_*` ([pivot](https://docs.lightdash.com/references/table-calculation-functions/pivot-functions)). There is no `pivot_row_total`.
127
+ - Do not invent native PoP metrics (`generationType: periodOverPeriod`) — clone from a seed or use table calcs instead.
116
128
  - Do not convert formula ↔ sql in place — recreate the calc.
117
129
  - Do not use `pivot_*` / `row_total` without a pivoted dimension (`pivotConfig.columns`).
118
130
  - Do not author SQL **charts** or open data-analyst / raw SQL execution to “fix” a table calc on this profile.
@@ -2,9 +2,10 @@
2
2
  * Content-developer multi-playbook resources (core + topics + index).
3
3
  */
4
4
  import type { McpServer } from '@modelcontextprotocol/server';
5
- export type ContentDeveloperPlaybookTopic = 'chart-types' | 'content-move' | 'dashboard-design' | 'dashboards' | 'table-calculations';
6
- export declare const CONTENT_DEVELOPER_HARD_BANS: string;
5
+ export type ContentDeveloperPlaybookTopic = 'chart-types' | 'content-move' | 'dashboard-design' | 'dashboards' | 'recovery/dashboard-diff' | 'recovery/preview-required' | 'recovery/preview-stale' | 'table-calculations';
6
+ export { CONTENT_DEVELOPER_HARD_BANS } from '../invariants.js';
7
7
  export declare const getAllPlaybookMarkdown: () => string;
8
8
  export declare const CONTENT_DEVELOPER_CORE_PLAYBOOK: import("../../../lib/playbook-resources.js").EmbeddedPlaybook;
9
9
  export declare const CONTENT_DEVELOPER_TOPIC_PLAYBOOKS: Readonly<Record<ContentDeveloperPlaybookTopic, import("../../../lib/playbook-resources.js").EmbeddedPlaybook>>;
10
+ export declare const CONTENT_DEVELOPER_TOPIC_META: Readonly<Record<ContentDeveloperPlaybookTopic, import("../../../lib/playbook-resources.js").PromptTopicMeta>>;
10
11
  export declare function registerContentDeveloperPlaybook(server: McpServer): void;
@@ -3,31 +3,12 @@
3
3
  * Content-developer multi-playbook resources (core + topics + index).
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CONTENT_DEVELOPER_TOPIC_PLAYBOOKS = exports.CONTENT_DEVELOPER_CORE_PLAYBOOK = exports.getAllPlaybookMarkdown = exports.CONTENT_DEVELOPER_HARD_BANS = void 0;
6
+ exports.CONTENT_DEVELOPER_TOPIC_META = exports.CONTENT_DEVELOPER_TOPIC_PLAYBOOKS = exports.CONTENT_DEVELOPER_CORE_PLAYBOOK = exports.getAllPlaybookMarkdown = exports.CONTENT_DEVELOPER_HARD_BANS = void 0;
7
7
  exports.registerContentDeveloperPlaybook = registerContentDeveloperPlaybook;
8
8
  const playbook_resources_js_1 = require("../../../lib/playbook-resources.js");
9
9
  const playbooks = (0, playbook_resources_js_1.defineProfilePlaybooks)({
10
10
  profileId: 'content-developer',
11
11
  moduleDir: __dirname,
12
- hardBans: `Do not execute arbitrary metric queries, raw SQL, warehouse runs, or saved-chart execution.
13
- Do not author or upsert SQL charts.
14
- Do not hard-delete, rollback, or promote content (use content-governance for promote).
15
- Do not perform organization administration or list org-wide projects.
16
- Do not create or update spaces — spaces are Terraform / out-of-band; use existing spaces only.
17
- Do not create space-only charts for dashboard work — set dashboardSlug to the dashboard shell already created.
18
- Do not call preview_* or write tools for a new dashboard or a material dashboard redesign until a Design Spec (with settled Objective) was presented and the user approved or amended it in-thread.
19
- Do not start writes from a viz-type or all-chart-types checklist alone — settle Objective and insight questions first (an explicit user all-types ask may be the Objective after a one-line restatement).
20
- Do not call confirm_preview without projectUuid when there is no HTTP X-Lightdash-Project pin (PROJECT_SCOPE_REQUIRED).
21
- Do not attach dashboard filters whose target.tableName is absent from a tile explore without excluding that tile (or remapping) via tileTargets.
22
- Do not treat chart create as done without a dashboard shell and tiles.
23
- Do not invent fieldIds — clone via get_chart_as_code / get_chart or use semantic-layer.
24
- Do not invent skinny chartConfig — clone a working as-code body and keep series/layout/encode.
25
- Do not apply a write tool without a confirmed, unexpired HMAC previewToken from the matching preview_* tool (confirm_preview unlocks every write; use the new validated token).
26
- Do not mutate the proposed payload after preview_* (description/name/SQL/metrics/tiles) — apply must reuse the identical proposed body or PREVIEW_STALE (content hash mismatch); any edit requires a new preview_*.
27
- Do not treat validate_chart / validate_dashboard as a preview unlock — they are saved-UUID health checks only (validate_chart needs chartUuid).
28
- Do not reuse a draft previewToken after confirm; re-run preview if the resource drifts (PREVIEW_STALE).
29
- Do not use subagent-driven-development or multi-task writing-plans solely to click MCP preview/confirm/apply for lab boards (e.g. experiments) — after Design Spec approval, run Batch SOP inline in the same session.
30
- Do not reveal secrets, warehouse credentials, or saved SQL chart bodies.`,
31
12
  coreDescription: 'Hard bans, tools, project scope, preview gate, and apply pitfalls',
32
13
  topics: [
33
14
  {
@@ -35,37 +16,70 @@ Do not reveal secrets, warehouse credentials, or saved SQL chart bodies.`,
35
16
  title: 'Content-developer dashboards playbook',
36
17
  description: 'Dashboard shell first, then dashboardSlug-scoped charts as tiles',
37
18
  file: 'dashboards.md',
19
+ useWhen: 'Creating or updating dashboard shells, tiles, or dashboardSlug-scoped charts',
20
+ priority: 0.8,
38
21
  },
39
22
  {
40
23
  id: 'dashboard-design',
41
24
  title: 'Content-developer dashboard-design playbook',
42
25
  description: 'Objective-first Design Spec, explore↔filter / tileTargets, layout, markdown, filters, tabs',
43
26
  file: 'dashboard-design.md',
27
+ useWhen: 'Design Spec, layout, markdown tiles, filters, or tileTargets planning',
28
+ priority: 0.8,
44
29
  },
45
30
  {
46
31
  id: 'chart-types',
47
32
  title: 'Content-developer chart-types playbook',
48
33
  description: 'Insight-first viz pick; cartesian encode checklist; UI intent → as-code map',
49
34
  file: 'chart-types.md',
35
+ useWhen: 'Choosing or cloning chart types / cartesian encode',
36
+ priority: 0.75,
50
37
  },
51
38
  {
52
39
  id: 'table-calculations',
53
40
  title: 'Content-developer table-calculations playbook',
54
41
  description: 'metricQuery.tableCalculations: template → formula → sql; PoP, % of total, rank, windows',
55
42
  file: 'table-calculations.md',
43
+ useWhen: 'Authoring table calculations, PoP, or window helpers',
44
+ priority: 0.7,
56
45
  },
57
46
  {
58
47
  id: 'content-move',
59
48
  title: 'Content-developer content-move playbook',
60
49
  description: 'Move content into existing spaces (no space CRUD)',
61
50
  file: 'content-move.md',
51
+ useWhen: 'Moving charts/dashboards into existing spaces',
52
+ priority: 0.7,
53
+ },
54
+ {
55
+ id: 'recovery/preview-stale',
56
+ title: 'Content-developer PREVIEW_STALE recovery',
57
+ description: 'Recover from PREVIEW_STALE (hash mismatch or baseline drift)',
58
+ file: 'recovery/preview-stale.md',
59
+ useWhen: 'After PREVIEW_STALE (hash mismatch or baseline drift)',
60
+ },
61
+ {
62
+ id: 'recovery/preview-required',
63
+ title: 'Content-developer PREVIEW_REQUIRED recovery',
64
+ description: 'Recover when preview token is missing, invalid, or expired',
65
+ file: 'recovery/preview-required.md',
66
+ useWhen: 'After PREVIEW_REQUIRED (missing, invalid, or expired token)',
67
+ },
68
+ {
69
+ id: 'recovery/dashboard-diff',
70
+ title: 'Content-developer dashboard diff recovery',
71
+ description: 'Interpret dashboard preview diff.removed noise vs real omissions',
72
+ file: 'recovery/dashboard-diff.md',
73
+ useWhen: 'When interpreting dashboard preview diff.removed noise vs omissions',
62
74
  },
63
75
  ],
64
76
  });
65
- exports.CONTENT_DEVELOPER_HARD_BANS = playbooks.HARD_BANS;
77
+ var invariants_js_1 = require("../invariants.js");
78
+ Object.defineProperty(exports, "CONTENT_DEVELOPER_HARD_BANS", { enumerable: true, get: function () { return invariants_js_1.CONTENT_DEVELOPER_HARD_BANS; } });
66
79
  exports.getAllPlaybookMarkdown = playbooks.getAllPlaybookMarkdown;
67
80
  exports.CONTENT_DEVELOPER_CORE_PLAYBOOK = playbooks.CORE_PLAYBOOK;
68
81
  exports.CONTENT_DEVELOPER_TOPIC_PLAYBOOKS = playbooks.TOPIC_PLAYBOOKS;
82
+ exports.CONTENT_DEVELOPER_TOPIC_META = playbooks.TOPIC_META;
69
83
  function registerContentDeveloperPlaybook(server) {
70
84
  playbooks.registerPlaybooks(server);
71
85
  }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Content-governance structured prompt invariants (SSOT for capsules + HARD_BANS projection).
3
+ */
4
+ export declare const CONTENT_GOVERNANCE_INVARIANTS: readonly [{
5
+ readonly id: "no-permanent-purge";
6
+ readonly short: "Do not permanently purge soft-deleted content.";
7
+ }, {
8
+ readonly id: "no-space-or-bulk-delete";
9
+ readonly short: "Do not delete spaces or perform bulk delete.";
10
+ }, {
11
+ readonly id: "elicitation-required";
12
+ readonly short: "Do not soft-delete or promote without form elicitation (never invent confirmed: true or chat-only approval).";
13
+ }, {
14
+ readonly id: "no-bypass-elicitation";
15
+ readonly short: "Do not expose deletes/promote on other profiles or bypass the elicitation gate.";
16
+ }, {
17
+ readonly id: "dashboard-first-promote";
18
+ readonly short: "Do not promote charts or SQL charts via MCP (dashboard-first only).";
19
+ }, {
20
+ readonly id: "no-restore-or-query";
21
+ readonly short: "Do not restore, author, or execute warehouse queries from this profile.";
22
+ }, {
23
+ readonly id: "no-secrets";
24
+ readonly short: "Do not reveal secrets, warehouse credentials, or hidden SQL.";
25
+ }];
26
+ export declare const CONTENT_GOVERNANCE_HARD_BANS: string;
27
+ export declare const CONTENT_GOVERNANCE_DEFAULT_INVARIANT_IDS: readonly ("no-secrets" | "no-permanent-purge" | "no-space-or-bulk-delete" | "elicitation-required" | "no-bypass-elicitation" | "dashboard-first-promote" | "no-restore-or-query")[];
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /**
3
+ * Content-governance structured prompt invariants (SSOT for capsules + HARD_BANS projection).
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CONTENT_GOVERNANCE_DEFAULT_INVARIANT_IDS = exports.CONTENT_GOVERNANCE_HARD_BANS = exports.CONTENT_GOVERNANCE_INVARIANTS = void 0;
7
+ const prompt_invariants_js_1 = require("../../lib/prompt-invariants.js");
8
+ exports.CONTENT_GOVERNANCE_INVARIANTS = [
9
+ {
10
+ id: 'no-permanent-purge',
11
+ short: 'Do not permanently purge soft-deleted content.',
12
+ },
13
+ {
14
+ id: 'no-space-or-bulk-delete',
15
+ short: 'Do not delete spaces or perform bulk delete.',
16
+ },
17
+ {
18
+ id: 'elicitation-required',
19
+ short: 'Do not soft-delete or promote without form elicitation (never invent confirmed: true or chat-only approval).',
20
+ },
21
+ {
22
+ id: 'no-bypass-elicitation',
23
+ short: 'Do not expose deletes/promote on other profiles or bypass the elicitation gate.',
24
+ },
25
+ {
26
+ id: 'dashboard-first-promote',
27
+ short: 'Do not promote charts or SQL charts via MCP (dashboard-first only).',
28
+ },
29
+ {
30
+ id: 'no-restore-or-query',
31
+ short: 'Do not restore, author, or execute warehouse queries from this profile.',
32
+ },
33
+ {
34
+ id: 'no-secrets',
35
+ short: 'Do not reveal secrets, warehouse credentials, or hidden SQL.',
36
+ },
37
+ ];
38
+ exports.CONTENT_GOVERNANCE_HARD_BANS = (0, prompt_invariants_js_1.formatHardBansProjection)(exports.CONTENT_GOVERNANCE_INVARIANTS);
39
+ exports.CONTENT_GOVERNANCE_DEFAULT_INVARIANT_IDS = (0, prompt_invariants_js_1.allInvariantIds)(exports.CONTENT_GOVERNANCE_INVARIANTS);
@@ -1,5 +1,7 @@
1
1
  /**
2
- * MCP prompts for content-governance soft-delete and dashboard promote workflows.
2
+ * MCP prompts for content-governance soft-delete and dashboard promote workflows
3
+ * (progressive-disclosure context).
3
4
  */
5
+ import type { RegisterPromptsOptions } from '../../types.js';
4
6
  import type { McpServer } from '@modelcontextprotocol/server';
5
- export declare function registerContentGovernancePrompts(server: McpServer): void;
7
+ export declare function registerContentGovernancePrompts(server: McpServer, options?: RegisterPromptsOptions): void;
@@ -1,17 +1,15 @@
1
1
  "use strict";
2
2
  /**
3
- * MCP prompts for content-governance soft-delete and dashboard promote workflows.
3
+ * MCP prompts for content-governance soft-delete and dashboard promote workflows
4
+ * (progressive-disclosure context).
4
5
  */
5
6
  Object.defineProperty(exports, "__esModule", { value: true });
6
7
  exports.registerContentGovernancePrompts = registerContentGovernancePrompts;
7
8
  /* eslint-disable @typescript-eslint/no-deprecated -- matches content-reader prompt registration pattern */
8
9
  const zod_1 = require("zod");
9
- const playbook_resources_js_1 = require("../../lib/playbook-resources.js");
10
+ const prompt_context_js_1 = require("../../lib/prompt-context.js");
11
+ const invariants_js_1 = require("./invariants.js");
10
12
  const playbooks_js_1 = require("./resources/playbooks.js");
11
- const userMessages = (0, playbook_resources_js_1.createPromptPlaybookEmbedder)({
12
- core: playbooks_js_1.CONTENT_GOVERNANCE_CORE_PLAYBOOK,
13
- topics: playbooks_js_1.CONTENT_GOVERNANCE_TOPIC_PLAYBOOKS,
14
- });
15
13
  const TOPIC_CHARTS = 'charts';
16
14
  const TOPIC_DASHBOARDS = 'dashboards';
17
15
  const REASON_NONE = '(none provided)';
@@ -25,7 +23,15 @@ first, then lightdash_promote_dashboard. The human must accept a form with decis
25
23
  and confirmationText equal to the exact dashboard name. Never invent confirmation flags.
26
24
  If the client lacks form elicitation, expect ELICITATION_REQUIRED and stop.
27
25
  If the dashboard or promoteDiff drifts after binding, expect RESOURCE_CHANGED and re-invoke.`;
28
- function registerContentGovernancePrompts(server) {
26
+ const bindPromptContext = (0, prompt_context_js_1.bindProfilePromptContext)({
27
+ invariants: invariants_js_1.CONTENT_GOVERNANCE_INVARIANTS,
28
+ core: playbooks_js_1.CONTENT_GOVERNANCE_CORE_PLAYBOOK,
29
+ topics: playbooks_js_1.CONTENT_GOVERNANCE_TOPIC_PLAYBOOKS,
30
+ topicMeta: playbooks_js_1.CONTENT_GOVERNANCE_TOPIC_META,
31
+ });
32
+ function registerContentGovernancePrompts(server, options) {
33
+ const promptContext = bindPromptContext(options === null || options === void 0 ? void 0 : options.promptContextPolicy);
34
+ const invariantIds = invariants_js_1.CONTENT_GOVERNANCE_DEFAULT_INVARIANT_IDS;
29
35
  server.registerPrompt('delete_chart', {
30
36
  title: 'Soft-delete chart',
31
37
  description: 'Soft-delete a saved chart after form elicitation (restorable from trash; no permanent purge)',
@@ -33,9 +39,8 @@ function registerContentGovernancePrompts(server) {
33
39
  chartUuidOrSlug: zod_1.z.string(),
34
40
  reason: zod_1.z.string().optional(),
35
41
  },
36
- }, ({ chartUuidOrSlug, reason }) => userMessages(`Soft-delete the Lightdash chart ${chartUuidOrSlug}.
37
-
38
- ${playbooks_js_1.CONTENT_GOVERNANCE_HARD_BANS}
42
+ }, ({ chartUuidOrSlug, reason }) => promptContext({
43
+ task: `Soft-delete the Lightdash chart ${chartUuidOrSlug}.
39
44
 
40
45
  ${DELETE_ELICITATION_RULES}
41
46
 
@@ -44,7 +49,10 @@ Resolve project scope (X-Lightdash-Project pin or projectUuid), then call
44
49
  lightdash_delete_chart with chartUuidOrSlug.
45
50
  Complete human form fields: decision (confirm_delete | do_not_delete) and confirmationText
46
51
  (exact chart name). Report the deletion receipt or that nothing was deleted if declined/cancelled.
47
- Do not permanently purge.`, TOPIC_CHARTS));
52
+ Do not permanently purge.`,
53
+ invariantIds,
54
+ requiredTopics: [TOPIC_CHARTS],
55
+ }));
48
56
  server.registerPrompt('delete_dashboard', {
49
57
  title: 'Soft-delete dashboard',
50
58
  description: 'Soft-delete a dashboard after form elicitation (restorable from trash; no permanent purge)',
@@ -52,9 +60,8 @@ Do not permanently purge.`, TOPIC_CHARTS));
52
60
  dashboardUuidOrSlug: zod_1.z.string(),
53
61
  reason: zod_1.z.string().optional(),
54
62
  },
55
- }, ({ dashboardUuidOrSlug, reason }) => userMessages(`Soft-delete the Lightdash dashboard ${dashboardUuidOrSlug}.
56
-
57
- ${playbooks_js_1.CONTENT_GOVERNANCE_HARD_BANS}
63
+ }, ({ dashboardUuidOrSlug, reason }) => promptContext({
64
+ task: `Soft-delete the Lightdash dashboard ${dashboardUuidOrSlug}.
58
65
 
59
66
  ${DELETE_ELICITATION_RULES}
60
67
 
@@ -63,7 +70,10 @@ Resolve project scope (X-Lightdash-Project pin or projectUuid), then call
63
70
  lightdash_delete_dashboard with dashboardUuidOrSlug.
64
71
  Complete human form fields: decision (confirm_delete | do_not_delete) and confirmationText
65
72
  (exact dashboard name). Report the deletion receipt or that nothing was deleted if declined/cancelled.
66
- Do not permanently purge, delete spaces, or bulk-delete.`, TOPIC_DASHBOARDS));
73
+ Do not permanently purge, delete spaces, or bulk-delete.`,
74
+ invariantIds,
75
+ requiredTopics: [TOPIC_DASHBOARDS],
76
+ }));
67
77
  server.registerPrompt('promote_dashboard', {
68
78
  title: 'Promote dashboard',
69
79
  description: 'Promote a dashboard to its configured upstream project after form elicitation (dashboard-first release)',
@@ -71,9 +81,8 @@ Do not permanently purge, delete spaces, or bulk-delete.`, TOPIC_DASHBOARDS));
71
81
  dashboardUuidOrSlug: zod_1.z.string(),
72
82
  reason: zod_1.z.string().optional(),
73
83
  },
74
- }, ({ dashboardUuidOrSlug, reason }) => userMessages(`Promote the Lightdash dashboard ${dashboardUuidOrSlug} to its configured upstream project.
75
-
76
- ${playbooks_js_1.CONTENT_GOVERNANCE_HARD_BANS}
84
+ }, ({ dashboardUuidOrSlug, reason }) => promptContext({
85
+ task: `Promote the Lightdash dashboard ${dashboardUuidOrSlug} to its configured upstream project.
77
86
 
78
87
  ${PROMOTE_ELICITATION_RULES}
79
88
 
@@ -82,6 +91,9 @@ Resolve project scope, optionally call lightdash_get_dashboard_promote_diff, the
82
91
  lightdash_promote_dashboard with dashboardUuidOrSlug.
83
92
  Complete human form fields: decision (confirm_promote | do_not_promote) and confirmationText
84
93
  (exact dashboard name). Report the promotion receipt or that nothing was promoted if declined/cancelled.
85
- Do not promote charts or SQL charts via MCP.`, TOPIC_DASHBOARDS));
94
+ Do not promote charts or SQL charts via MCP.`,
95
+ invariantIds,
96
+ requiredTopics: [TOPIC_DASHBOARDS],
97
+ }));
86
98
  }
87
99
  /* eslint-enable @typescript-eslint/no-deprecated */
@@ -3,8 +3,9 @@
3
3
  */
4
4
  import type { McpServer } from '@modelcontextprotocol/server';
5
5
  export type ContentGovernancePlaybookTopic = 'charts' | 'dashboards';
6
- export declare const CONTENT_GOVERNANCE_HARD_BANS: string;
6
+ export { CONTENT_GOVERNANCE_HARD_BANS } from '../invariants.js';
7
7
  export declare const getAllPlaybookMarkdown: () => string;
8
8
  export declare const CONTENT_GOVERNANCE_CORE_PLAYBOOK: import("../../../lib/playbook-resources.js").EmbeddedPlaybook;
9
9
  export declare const CONTENT_GOVERNANCE_TOPIC_PLAYBOOKS: Readonly<Record<ContentGovernancePlaybookTopic, import("../../../lib/playbook-resources.js").EmbeddedPlaybook>>;
10
+ export declare const CONTENT_GOVERNANCE_TOPIC_META: Readonly<Record<ContentGovernancePlaybookTopic, import("../../../lib/playbook-resources.js").PromptTopicMeta>>;
10
11
  export declare function registerContentGovernancePlaybook(server: McpServer): void;
@@ -3,19 +3,12 @@
3
3
  * Content-governance multi-playbook resources (core + topics + index).
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CONTENT_GOVERNANCE_TOPIC_PLAYBOOKS = exports.CONTENT_GOVERNANCE_CORE_PLAYBOOK = exports.getAllPlaybookMarkdown = exports.CONTENT_GOVERNANCE_HARD_BANS = void 0;
6
+ exports.CONTENT_GOVERNANCE_TOPIC_META = exports.CONTENT_GOVERNANCE_TOPIC_PLAYBOOKS = exports.CONTENT_GOVERNANCE_CORE_PLAYBOOK = exports.getAllPlaybookMarkdown = exports.CONTENT_GOVERNANCE_HARD_BANS = void 0;
7
7
  exports.registerContentGovernancePlaybook = registerContentGovernancePlaybook;
8
8
  const playbook_resources_js_1 = require("../../../lib/playbook-resources.js");
9
9
  const playbooks = (0, playbook_resources_js_1.defineProfilePlaybooks)({
10
10
  profileId: 'content-governance',
11
11
  moduleDir: __dirname,
12
- hardBans: `Do not permanently purge soft-deleted content.
13
- Do not delete spaces or perform bulk delete.
14
- Do not soft-delete or promote without form elicitation (never invent confirmed: true or chat-only approval).
15
- Do not expose deletes/promote on other profiles or bypass the elicitation gate.
16
- Do not promote charts or SQL charts via MCP (dashboard-first only).
17
- Do not restore, author, or execute warehouse queries from this profile.
18
- Do not reveal secrets, warehouse credentials, or hidden SQL.`,
19
12
  coreDescription: 'Hard bans, elicitation SOP, tools, and project scope',
20
13
  topics: [
21
14
  {
@@ -23,19 +16,25 @@ Do not reveal secrets, warehouse credentials, or hidden SQL.`,
23
16
  title: 'Content-governance charts playbook',
24
17
  description: 'Soft-delete a saved chart with form elicitation',
25
18
  file: 'charts.md',
19
+ useWhen: 'Soft-deleting a saved chart with form elicitation',
20
+ priority: 0.8,
26
21
  },
27
22
  {
28
23
  id: 'dashboards',
29
24
  title: 'Content-governance dashboards playbook',
30
25
  description: 'Soft-delete or promote a dashboard with form elicitation',
31
26
  file: 'dashboards.md',
27
+ useWhen: 'Soft-deleting or promoting a dashboard with form elicitation',
28
+ priority: 0.75,
32
29
  },
33
30
  ],
34
31
  });
35
- exports.CONTENT_GOVERNANCE_HARD_BANS = playbooks.HARD_BANS;
32
+ var invariants_js_1 = require("../invariants.js");
33
+ Object.defineProperty(exports, "CONTENT_GOVERNANCE_HARD_BANS", { enumerable: true, get: function () { return invariants_js_1.CONTENT_GOVERNANCE_HARD_BANS; } });
36
34
  exports.getAllPlaybookMarkdown = playbooks.getAllPlaybookMarkdown;
37
35
  exports.CONTENT_GOVERNANCE_CORE_PLAYBOOK = playbooks.CORE_PLAYBOOK;
38
36
  exports.CONTENT_GOVERNANCE_TOPIC_PLAYBOOKS = playbooks.TOPIC_PLAYBOOKS;
37
+ exports.CONTENT_GOVERNANCE_TOPIC_META = playbooks.TOPIC_META;
39
38
  function registerContentGovernancePlaybook(server) {
40
39
  playbooks.registerPlaybooks(server);
41
40
  }
@@ -22,6 +22,7 @@ exports.contentReaderProfile = {
22
22
  tools: [
23
23
  projects_js_1.getProjectReaderTool,
24
24
  reader_content_js_1.searchContentTool,
25
+ reader_content_js_1.listVerifiedContentTool,
25
26
  spaces_js_1.listSpacesTool,
26
27
  spaces_js_1.getSpaceTool,
27
28
  reader_content_js_1.getDashboardTool,
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Content-reader structured prompt invariants (SSOT for capsules + HARD_BANS projection).
3
+ */
4
+ export declare const CONTENT_READER_INVARIANTS: readonly [{
5
+ readonly id: "no-mutation";
6
+ readonly short: "Do not mutate Lightdash resources.";
7
+ }, {
8
+ readonly id: "no-arbitrary-query";
9
+ readonly short: "Do not execute arbitrary metric queries, raw SQL, or underlying-data queries.";
10
+ }, {
11
+ readonly id: "no-bulk-export";
12
+ readonly short: "Do not download or bulk-export results.";
13
+ }, {
14
+ readonly id: "no-sql-chart-execution";
15
+ readonly short: "Do not execute saved SQL charts (disabled by default on content-reader).";
16
+ }, {
17
+ readonly id: "no-override-semantics";
18
+ readonly short: "Do not override filter targets, operators, required-filter behavior, fields, metrics, dimensions, SQL, table calculations, or sorts.";
19
+ }, {
20
+ readonly id: "project-scope";
21
+ readonly short: "Do not execute content outside the resolved project (pass projectUuid or HTTP pin).";
22
+ }, {
23
+ readonly id: "no-overstate-coverage";
24
+ readonly short: "Do not present truncated results as complete.";
25
+ }, {
26
+ readonly id: "no-label-equivalence";
27
+ readonly short: "Do not claim metric equivalence from matching labels alone.";
28
+ }, {
29
+ readonly id: "no-secrets";
30
+ readonly short: "Do not reveal secrets, warehouse credentials, hidden SQL, or inaccessible content.";
31
+ }];
32
+ export declare const CONTENT_READER_HARD_BANS: string;
33
+ export declare const CONTENT_READER_DEFAULT_INVARIANT_IDS: readonly ("project-scope" | "no-secrets" | "no-mutation" | "no-arbitrary-query" | "no-bulk-export" | "no-sql-chart-execution" | "no-override-semantics" | "no-overstate-coverage" | "no-label-equivalence")[];
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ /**
3
+ * Content-reader structured prompt invariants (SSOT for capsules + HARD_BANS projection).
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CONTENT_READER_DEFAULT_INVARIANT_IDS = exports.CONTENT_READER_HARD_BANS = exports.CONTENT_READER_INVARIANTS = void 0;
7
+ const prompt_invariants_js_1 = require("../../lib/prompt-invariants.js");
8
+ exports.CONTENT_READER_INVARIANTS = [
9
+ {
10
+ id: 'no-mutation',
11
+ short: 'Do not mutate Lightdash resources.',
12
+ },
13
+ {
14
+ id: 'no-arbitrary-query',
15
+ short: 'Do not execute arbitrary metric queries, raw SQL, or underlying-data queries.',
16
+ },
17
+ {
18
+ id: 'no-bulk-export',
19
+ short: 'Do not download or bulk-export results.',
20
+ },
21
+ {
22
+ id: 'no-sql-chart-execution',
23
+ short: 'Do not execute saved SQL charts (disabled by default on content-reader).',
24
+ },
25
+ {
26
+ id: 'no-override-semantics',
27
+ short: 'Do not override filter targets, operators, required-filter behavior, fields, metrics, dimensions, SQL, table calculations, or sorts.',
28
+ },
29
+ {
30
+ id: 'project-scope',
31
+ short: 'Do not execute content outside the resolved project (pass projectUuid or HTTP pin).',
32
+ },
33
+ {
34
+ id: 'no-overstate-coverage',
35
+ short: 'Do not present truncated results as complete.',
36
+ },
37
+ {
38
+ id: 'no-label-equivalence',
39
+ short: 'Do not claim metric equivalence from matching labels alone.',
40
+ },
41
+ {
42
+ id: 'no-secrets',
43
+ short: 'Do not reveal secrets, warehouse credentials, hidden SQL, or inaccessible content.',
44
+ },
45
+ ];
46
+ exports.CONTENT_READER_HARD_BANS = (0, prompt_invariants_js_1.formatHardBansProjection)(exports.CONTENT_READER_INVARIANTS);
47
+ exports.CONTENT_READER_DEFAULT_INVARIANT_IDS = (0, prompt_invariants_js_1.allInvariantIds)(exports.CONTENT_READER_INVARIANTS);
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Pure PromptContextSpec builders for content-reader prompts.
3
+ * Shared by registerContentReaderPrompts and budget gates.
4
+ */
5
+ import type { ContentReaderPlaybookTopic } from './resources/playbooks.js';
6
+ import type { PromptContextSpec } from '../../lib/prompt-context.js';
7
+ export declare const TOPIC_DISCOVER: "discover";
8
+ export type FindContentPromptArgs = {
9
+ question: string;
10
+ projectUuid?: string;
11
+ contentTypes?: string;
12
+ verifiedOnly?: boolean;
13
+ spaceUuid?: string;
14
+ };
15
+ /**
16
+ * Production PromptContextSpec for `find_content` (task + discover topic).
17
+ */
18
+ export declare function buildFindContentPromptSpec(args: FindContentPromptArgs): PromptContextSpec<ContentReaderPlaybookTopic>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ /**
3
+ * Pure PromptContextSpec builders for content-reader prompts.
4
+ * Shared by registerContentReaderPrompts and budget gates.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.TOPIC_DISCOVER = void 0;
8
+ exports.buildFindContentPromptSpec = buildFindContentPromptSpec;
9
+ const schema_fields_js_1 = require("../../../tools/lib/schema-fields.js");
10
+ const invariants_js_1 = require("./invariants.js");
11
+ exports.TOPIC_DISCOVER = 'discover';
12
+ /**
13
+ * Production PromptContextSpec for `find_content` (task + discover topic).
14
+ */
15
+ function buildFindContentPromptSpec(args) {
16
+ const { projectUuid, question, contentTypes, verifiedOnly, spaceUuid } = args;
17
+ return {
18
+ task: `Find the most relevant Lightdash content for:
19
+
20
+ ${question}
21
+
22
+ ${(0, schema_fields_js_1.formatPromptProjectUuidLine)(projectUuid)}
23
+ Content types hint: ${contentTypes !== null && contentTypes !== void 0 ? contentTypes : '(any)'}.
24
+ Verified preference: ${verifiedOnly !== null && verifiedOnly !== void 0 ? verifiedOnly : false} (when true, call list_verified_content first — search_content does not filter by verification).
25
+ Space filter: ${spaceUuid !== null && spaceUuid !== void 0 ? spaceUuid : '(none)'}.
26
+
27
+ Workflow:
28
+ resolve project → verified-first when requested → search → rank → return ≤5 candidates.
29
+ Do not execute unless values were requested.`,
30
+ invariantIds: invariants_js_1.CONTENT_READER_DEFAULT_INVARIANT_IDS,
31
+ requiredTopics: [exports.TOPIC_DISCOVER],
32
+ };
33
+ }