@lightdash-tools/mcp 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/README.md +108 -237
  2. package/dist/audit/server-persona.d.ts +10 -0
  3. package/dist/audit/server-persona.js +19 -0
  4. package/dist/auth/oauth-broker/pending-store.d.ts +6 -7
  5. package/dist/auth/oauth-broker/pending-store.js +3 -4
  6. package/dist/auth/oauth-broker/pending-store.test.d.ts +2 -3
  7. package/dist/auth/oauth-broker/pending-store.test.js +2 -39
  8. package/dist/auth/oauth-broker/routes.d.ts +1 -1
  9. package/dist/auth/oauth-broker/routes.js +3 -3
  10. package/dist/auth/oauth-broker/routes.test.js +1 -1
  11. package/dist/auth/request-state-key.d.ts +19 -0
  12. package/dist/auth/request-state-key.js +49 -0
  13. package/dist/auth/resource-server/lightdash-oauth-middleware.d.ts +0 -2
  14. package/dist/auth/resource-server/lightdash-oauth-middleware.js +0 -19
  15. package/dist/auth/resource-server/www-authenticate.test.js +0 -2
  16. package/dist/bin.js +9 -2
  17. package/dist/config/env.d.ts +5 -15
  18. package/dist/config/env.js +6 -16
  19. package/dist/config/load-mcp-config.d.ts +0 -4
  20. package/dist/config/load-mcp-config.js +8 -9
  21. package/dist/config/normalize-url.test.js +14 -11
  22. package/dist/config/runtime.d.ts +3 -3
  23. package/dist/config/runtime.js +19 -23
  24. package/dist/config/runtime.test.js +23 -9
  25. package/dist/config/test-mcp-http-config.js +1 -1
  26. package/dist/destructive/content-promote.js +7 -1
  27. package/dist/destructive/promote-contract.test.js +106 -47
  28. package/dist/destructive/register-destructive-tool.js +6 -24
  29. package/dist/destructive/request-state.d.ts +2 -6
  30. package/dist/destructive/request-state.js +3 -38
  31. package/dist/destructive/types.d.ts +2 -1
  32. package/dist/governance/available-projects.d.ts +37 -0
  33. package/dist/governance/available-projects.js +132 -0
  34. package/dist/governance/available-projects.test.d.ts +4 -0
  35. package/dist/governance/available-projects.test.js +107 -0
  36. package/dist/governance/client-capabilities-cache.d.ts +44 -0
  37. package/dist/governance/client-capabilities-cache.js +142 -0
  38. package/dist/governance/client-capabilities-cache.test.js +148 -0
  39. package/dist/governance/mcp-client-session.d.ts +3 -2
  40. package/dist/governance/mcp-client-session.js +3 -2
  41. package/dist/governance/project-scope.d.ts +8 -22
  42. package/dist/governance/project-scope.js +36 -44
  43. package/dist/governance/project-scope.test.d.ts +1 -1
  44. package/dist/governance/project-scope.test.js +21 -44
  45. package/dist/governance/promote-allowlist.d.ts +18 -0
  46. package/dist/governance/promote-allowlist.js +66 -0
  47. package/dist/governance/promote-allowlist.test.d.ts +4 -0
  48. package/dist/governance/promote-allowlist.test.js +87 -0
  49. package/dist/http.integration.test.js +117 -262
  50. package/dist/http.test.js +0 -12
  51. package/dist/index.integration.test.js +0 -4
  52. package/dist/index.js +3 -1
  53. package/dist/personas/ai-agent-ops/v1/index.d.ts +8 -0
  54. package/dist/personas/ai-agent-ops/v1/index.js +41 -0
  55. package/dist/personas/ai-agent-ops/v1/prompts.d.ts +5 -0
  56. package/dist/personas/ai-agent-ops/v1/prompts.js +141 -0
  57. package/dist/personas/ai-agent-ops/v1/prompts.test.d.ts +4 -0
  58. package/dist/personas/ai-agent-ops/v1/prompts.test.js +26 -0
  59. package/dist/personas/ai-agent-ops/v1/resources/playbooks/core.md +39 -0
  60. package/dist/personas/ai-agent-ops/v1/resources/playbooks/evaluation.md +25 -0
  61. package/dist/personas/ai-agent-ops/v1/resources/playbooks/index.md +14 -0
  62. package/dist/personas/ai-agent-ops/v1/resources/playbooks/loop-engineering.md +28 -0
  63. package/dist/personas/ai-agent-ops/v1/resources/playbooks/release-gate.md +22 -0
  64. package/dist/personas/ai-agent-ops/v1/resources/playbooks.d.ts +10 -0
  65. package/dist/personas/ai-agent-ops/v1/resources/playbooks.js +41 -0
  66. package/dist/personas/content-developer/v1/index.d.ts +1 -1
  67. package/dist/personas/content-developer/v1/index.js +1 -0
  68. package/dist/personas/content-developer/v1/prompts.d.ts +3 -0
  69. package/dist/personas/content-developer/v1/prompts.js +80 -61
  70. package/dist/personas/content-developer/v1/prompts.test.js +159 -3
  71. package/dist/personas/content-developer/v1/resources/playbooks/chart-types.md +123 -0
  72. package/dist/personas/content-developer/v1/resources/playbooks/content-move.md +13 -6
  73. package/dist/personas/content-developer/v1/resources/playbooks/core.md +91 -49
  74. package/dist/personas/content-developer/v1/resources/playbooks/dashboard-design.md +153 -0
  75. package/dist/personas/content-developer/v1/resources/playbooks/dashboards.md +82 -34
  76. package/dist/personas/content-developer/v1/resources/playbooks/index.md +9 -7
  77. package/dist/personas/content-developer/v1/resources/playbooks.d.ts +1 -1
  78. package/dist/personas/content-developer/v1/resources/playbooks.js +29 -10
  79. package/dist/personas/content-governance/v1/resources/playbooks/core.md +1 -1
  80. package/dist/personas/content-governance/v1/resources/playbooks/dashboards.md +1 -1
  81. package/dist/personas/content-reader/v1/index.d.ts +1 -1
  82. package/dist/personas/content-reader/v1/index.js +1 -0
  83. package/dist/personas/content-reader/v1/prompts.js +64 -30
  84. package/dist/personas/content-reader/v1/resources/playbooks/compare.md +24 -9
  85. package/dist/personas/content-reader/v1/resources/playbooks/core.md +56 -29
  86. package/dist/personas/content-reader/v1/resources/playbooks/discover.md +27 -5
  87. package/dist/personas/content-reader/v1/resources/playbooks/explain-run.md +38 -8
  88. package/dist/personas/content-reader/v1/resources/playbooks/index.md +8 -8
  89. package/dist/personas/content-reader/v1/resources/playbooks.js +2 -2
  90. package/dist/personas/index.d.ts +1 -0
  91. package/dist/personas/index.js +27 -22
  92. package/dist/personas/index.test.js +68 -53
  93. package/dist/personas/lib/playbook-resources.d.ts +4 -3
  94. package/dist/personas/lib/playbook-resources.js +14 -10
  95. package/dist/personas/organization-audit/v1/prompts.js +68 -36
  96. package/dist/personas/organization-audit/v1/resources/playbooks/access.md +12 -4
  97. package/dist/personas/organization-audit/v1/resources/playbooks/content.md +13 -3
  98. package/dist/personas/organization-audit/v1/resources/playbooks/core.md +49 -16
  99. package/dist/personas/organization-audit/v1/resources/playbooks/deliveries.md +8 -3
  100. package/dist/personas/organization-audit/v1/resources/playbooks/index.md +8 -8
  101. package/dist/personas/organization-audit/v1/resources/playbooks.js +1 -1
  102. package/dist/personas/persona.parity.test.js +14 -10
  103. package/dist/personas/semantic-layer/v1/prompts.js +50 -39
  104. package/dist/personas/semantic-layer/v1/resources/playbooks/compose-compile.md +36 -31
  105. package/dist/personas/semantic-layer/v1/resources/playbooks/core.md +53 -21
  106. package/dist/personas/semantic-layer/v1/resources/playbooks/explore.md +42 -39
  107. package/dist/personas/semantic-layer/v1/resources/playbooks/index.md +6 -6
  108. package/dist/personas/semantic-layer/v1/resources/playbooks.js +2 -2
  109. package/dist/personas/types.d.ts +1 -1
  110. package/dist/policy/content-developer.d.ts +3 -3
  111. package/dist/policy/content-developer.js +3 -3
  112. package/dist/policy/content-developer.test.js +10 -4
  113. package/dist/policy/content-reader.d.ts +5 -1
  114. package/dist/policy/content-reader.js +18 -3
  115. package/dist/policy/content-reader.test.js +2 -1
  116. package/dist/policy/preview-ledger-fault.test.js +101 -426
  117. package/dist/policy/preview-ledger.d.ts +38 -74
  118. package/dist/policy/preview-ledger.js +108 -186
  119. package/dist/policy/preview-ledger.test.js +237 -111
  120. package/dist/policy/result-limits.d.ts +6 -1
  121. package/dist/policy/result-limits.js +28 -29
  122. package/dist/policy/result-limits.test.js +10 -1
  123. package/dist/server/capabilities.js +2 -0
  124. package/dist/server/capabilities.test.js +2 -0
  125. package/dist/server/server.js +12 -8
  126. package/dist/server/upstream-errors.d.ts +17 -0
  127. package/dist/server/upstream-errors.js +60 -0
  128. package/dist/server/upstream-errors.test.js +50 -0
  129. package/dist/stdio.process.test.js +4 -2
  130. package/dist/tools/ai-agents/agents.d.ts +7 -0
  131. package/dist/tools/ai-agents/agents.js +32 -0
  132. package/dist/tools/ai-agents/agents.test.js +176 -0
  133. package/dist/tools/ai-agents/discovery.d.ts +9 -0
  134. package/dist/tools/ai-agents/discovery.js +73 -0
  135. package/dist/tools/ai-agents/evaluations.d.ts +14 -0
  136. package/dist/tools/ai-agents/evaluations.js +177 -0
  137. package/dist/tools/ai-agents/helpers.d.ts +64 -0
  138. package/dist/tools/ai-agents/helpers.js +323 -0
  139. package/dist/tools/ai-agents/threads.d.ts +7 -0
  140. package/dist/tools/ai-agents/threads.js +40 -0
  141. package/dist/tools/organization/inventory.js +2 -1
  142. package/dist/tools/project/content.js +5 -1
  143. package/dist/tools/project/developer-content-preview.d.ts +2 -1
  144. package/dist/tools/project/developer-content-preview.js +40 -35
  145. package/dist/tools/project/developer-content-shared.d.ts +8 -2
  146. package/dist/tools/project/developer-content-shared.js +7 -3
  147. package/dist/tools/project/developer-content.d.ts +7 -8
  148. package/dist/tools/project/developer-content.js +72 -67
  149. package/dist/tools/project/developer-get-chart-as-code.d.ts +9 -0
  150. package/dist/tools/project/developer-get-chart-as-code.js +39 -0
  151. package/dist/tools/project/developer-get-chart-as-code.test.d.ts +4 -0
  152. package/dist/tools/project/developer-get-chart-as-code.test.js +70 -0
  153. package/dist/tools/project/developer-helpers.d.ts +1 -1
  154. package/dist/tools/project/developer-helpers.js +1 -1
  155. package/dist/tools/project/get-dashboard-promote-diff.js +12 -2
  156. package/dist/tools/project/invariants.test.js +5 -3
  157. package/dist/tools/project/projects.js +6 -4
  158. package/dist/tools/project/projects.test.js +44 -5
  159. package/dist/tools/project/reader-export-chart-image.d.ts +6 -0
  160. package/dist/tools/project/reader-export-chart-image.js +78 -0
  161. package/dist/tools/project/reader-export-chart-image.test.d.ts +4 -0
  162. package/dist/tools/project/reader-export-chart-image.test.js +149 -0
  163. package/dist/tools/query/bounded-saved-query.js +1 -1
  164. package/dist/tools/query/lifecycle.d.ts +1 -1
  165. package/dist/tools/query/lifecycle.js +17 -25
  166. package/dist/tools/query/query-ledger.d.ts +15 -8
  167. package/dist/tools/query/query-ledger.js +21 -15
  168. package/dist/tools/query/query-ledger.test.js +13 -11
  169. package/dist/tools/query/reader-tool-helpers.js +4 -6
  170. package/dist/tools/query/reader-tool-helpers.test.js +8 -4
  171. package/dist/tools/registry.d.ts +63 -0
  172. package/dist/tools/registry.js +26 -0
  173. package/dist/tools/shared.d.ts +27 -8
  174. package/dist/tools/shared.js +61 -28
  175. package/dist/tools/shared.test.js +100 -4
  176. package/dist/transports/streamable-http.js +48 -206
  177. package/dist/transports/streamable-http.test.js +10 -3
  178. package/package.json +5 -6
  179. package/dist/destructive/confirmation-claim.d.ts +0 -21
  180. package/dist/destructive/confirmation-claim.js +0 -87
  181. package/dist/destructive/confirmation-claim.test.js +0 -50
  182. package/dist/store/config.d.ts +0 -11
  183. package/dist/store/config.js +0 -50
  184. package/dist/store/config.test.js +0 -56
  185. package/dist/store/create-oauth-broker-store.d.ts +0 -6
  186. package/dist/store/create-oauth-broker-store.js +0 -16
  187. package/dist/store/create-preview-store.d.ts +0 -10
  188. package/dist/store/create-preview-store.js +0 -30
  189. package/dist/store/create-session-store.d.ts +0 -19
  190. package/dist/store/create-session-store.js +0 -24
  191. package/dist/store/in-memory-preview-store.d.ts +0 -17
  192. package/dist/store/in-memory-preview-store.js +0 -72
  193. package/dist/store/redis-client.d.ts +0 -11
  194. package/dist/store/redis-client.js +0 -48
  195. package/dist/store/redis-oauth-broker-store.d.ts +0 -42
  196. package/dist/store/redis-oauth-broker-store.js +0 -167
  197. package/dist/store/redis-oauth-broker-store.test.js +0 -80
  198. package/dist/store/redis-preview-store.d.ts +0 -23
  199. package/dist/store/redis-preview-store.js +0 -94
  200. package/dist/store/redis-preview-store.test.d.ts +0 -1
  201. package/dist/store/redis-preview-store.test.js +0 -39
  202. package/dist/store/redis-session-index.d.ts +0 -33
  203. package/dist/store/redis-session-index.js +0 -49
  204. package/dist/store/types.d.ts +0 -13
  205. package/dist/store/types.js +0 -8
  206. package/dist/transports/http-request-utils.d.ts +0 -2
  207. package/dist/transports/http-request-utils.js +0 -13
  208. package/dist/transports/session-store.d.ts +0 -72
  209. package/dist/transports/session-store.js +0 -143
  210. package/dist/transports/session-store.test.d.ts +0 -1
  211. package/dist/transports/session-store.test.js +0 -111
  212. /package/dist/{destructive/confirmation-claim.test.d.ts → governance/client-capabilities-cache.test.d.ts} +0 -0
  213. /package/dist/{store/config.test.d.ts → server/upstream-errors.test.d.ts} +0 -0
  214. /package/dist/{store/redis-oauth-broker-store.test.d.ts → tools/ai-agents/agents.test.d.ts} +0 -0
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ /**
3
+ * MCP prompts for ai-agent-ops workflows (ADR-0018).
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.registerAiAgentOpsPrompts = registerAiAgentOpsPrompts;
7
+ /* eslint-disable @typescript-eslint/no-deprecated -- matches other persona prompt registration */
8
+ const zod_1 = require("zod");
9
+ const playbook_resources_js_1 = require("../../lib/playbook-resources.js");
10
+ const playbooks_js_1 = require("./resources/playbooks.js");
11
+ const userMessages = (0, playbook_resources_js_1.createPromptPlaybookEmbedder)({
12
+ core: playbooks_js_1.AI_AGENT_OPS_CORE_PLAYBOOK,
13
+ topics: playbooks_js_1.AI_AGENT_OPS_TOPIC_PLAYBOOKS,
14
+ });
15
+ function registerAiAgentOpsPrompts(server) {
16
+ server.registerPrompt('audit_project_ai_agent', {
17
+ title: 'Audit project AI agent',
18
+ description: 'Inspect agent config, readiness API, and evaluation coverage via primitives',
19
+ argsSchema: {
20
+ agentUuid: zod_1.z.string().optional().describe('Agent UUID (or select after list)'),
21
+ },
22
+ }, ({ agentUuid }) => userMessages(`Audit the selected project-level Lightdash AI agent.
23
+
24
+ ${playbooks_js_1.AI_AGENT_OPS_HARD_BANS}
25
+
26
+ Agent: ${agentUuid !== null && agentUuid !== void 0 ? agentUuid : '(list_project_agents then select)'}
27
+
28
+ Procedure (primitives only):
29
+ 1. Resolve project scope.
30
+ 2. list/get the agent; review instruction, tags, access flags, integrations, self-improvement.
31
+ 3. Optionally evaluate_agent_readiness — label as readiness API, not e2e.
32
+ 4. List evaluations and recent runs; note coverage gaps.
33
+ 5. Distinguish API facts, readiness signals, evaluation evidence, assumptions, and unknowns.
34
+ 6. Do not mutate the agent or claim compliance.`));
35
+ server.registerPrompt('build_agent_evaluation_suite', {
36
+ title: 'Build agent evaluation suite',
37
+ description: 'Design or update a Lightdash evaluation suite via MCP eval APIs',
38
+ argsSchema: {
39
+ agentUuid: zod_1.z.string().optional(),
40
+ },
41
+ }, ({ agentUuid }) => userMessages(`Design or update an offline evaluation suite for agent ${agentUuid !== null && agentUuid !== void 0 ? agentUuid : '(select after list)'}.
42
+
43
+ ${playbooks_js_1.AI_AGENT_OPS_HARD_BANS}
44
+
45
+ Inspect agent configuration first. Prefer create/update/append_agent_evaluation tools.
46
+ Include common questions, ambiguity, access/refusal, and must-pass cases.
47
+ Prefer deterministic expected responses. Do not invent local Git dataset MCP tools.`, 'evaluation'));
48
+ server.registerPrompt('run_agent_baseline', {
49
+ title: 'Run agent baseline evaluation',
50
+ description: 'Run a Lightdash evaluation suite and fetch results',
51
+ argsSchema: {
52
+ agentUuid: zod_1.z.string().optional(),
53
+ evalUuid: zod_1.z.string().optional(),
54
+ },
55
+ }, ({ agentUuid, evalUuid }) => userMessages(`Run a baseline evaluation for agent ${agentUuid !== null && agentUuid !== void 0 ? agentUuid : '(select)'} suite ${evalUuid !== null && evalUuid !== void 0 ? evalUuid : '(select)'}.
56
+
57
+ ${playbooks_js_1.AI_AGENT_OPS_HARD_BANS}
58
+
59
+ Use run_agent_evaluation then poll list_agent_evaluation_runs and get_agent_eval_run_results.
60
+ Never silently substitute evaluate_agent_readiness for an evaluation run.
61
+ Report run UUID, status, limitations, and hard failures from the product results.`, 'evaluation'));
62
+ server.registerPrompt('investigate_agent_failures', {
63
+ title: 'Investigate agent evaluation failures',
64
+ description: 'Cluster failures in the host from run results (no analyze_* tool)',
65
+ argsSchema: {
66
+ runUuid: zod_1.z.string().optional(),
67
+ },
68
+ }, ({ runUuid }) => userMessages(`Investigate evaluation failures for run ${runUuid !== null && runUuid !== void 0 ? runUuid : '(from get_agent_eval_run_results)'}.
69
+
70
+ ${playbooks_js_1.AI_AGENT_OPS_HARD_BANS}
71
+
72
+ There is no lightdash_analyze_* tool. Fetch run results, cluster by root cause in the conversation,
73
+ cite evidence, separate confirmed causes from hypotheses, and recommend the narrowest intervention.
74
+ Prefer metadata fixes before instruction patches.`, 'loop-engineering'));
75
+ server.registerPrompt('improve_agent_with_loop_engineering', {
76
+ title: 'Improve agent with loop engineering',
77
+ description: 'Bounded host+CLI+MCP improvement loop',
78
+ argsSchema: {
79
+ agentUuid: zod_1.z.string().optional(),
80
+ maxIterations: zod_1.z.string().optional().describe('Default 3'),
81
+ },
82
+ }, ({ agentUuid, maxIterations }) => userMessages(`Guide a bounded loop-engineering workflow for agent ${agentUuid !== null && agentUuid !== void 0 ? agentUuid : '(select)'}.
83
+
84
+ ${playbooks_js_1.AI_AGENT_OPS_HARD_BANS}
85
+
86
+ Max iterations: ${maxIterations !== null && maxIterations !== void 0 ? maxIterations : '3'}.
87
+ Use MCP for inspect/eval runs; CLI agentops for bundle apply and gates; other personas for semantic/content when available.
88
+ Implementation changes happen outside agent CRUD on this server.
89
+ Stop when gates pass, no safe intervention remains, or the budget is exhausted.`, 'loop-engineering'));
90
+ server.registerPrompt('review_agent_access_and_scope', {
91
+ title: 'Review agent access and scope',
92
+ description: 'Review tags, data access, and explore reachability',
93
+ argsSchema: {
94
+ agentUuid: zod_1.z.string().optional(),
95
+ },
96
+ }, ({ agentUuid }) => userMessages(`Review access and scope for agent ${agentUuid !== null && agentUuid !== void 0 ? agentUuid : '(select)'}.
97
+
98
+ ${playbooks_js_1.AI_AGENT_OPS_HARD_BANS}
99
+
100
+ Use get_project_agent and get_explore_access_summary. Note unexpectedly broad/narrow tags,
101
+ data-access inconsistencies, and self-improvement risk. Do not mutate access.`));
102
+ server.registerPrompt('review_agent_self_improvement', {
103
+ title: 'Review agent self-improvement',
104
+ description: 'Assess whether self-improvement is appropriately configured',
105
+ argsSchema: {
106
+ agentUuid: zod_1.z.string().optional(),
107
+ },
108
+ }, ({ agentUuid }) => userMessages(`Assess self-improvement configuration for agent ${agentUuid !== null && agentUuid !== void 0 ? agentUuid : '(select)'}.
109
+
110
+ ${playbooks_js_1.AI_AGENT_OPS_HARD_BANS}
111
+
112
+ Consider access breadth, data access, evaluation coverage, release gates, and rollback readiness.
113
+ Do not approve or apply proposals.`));
114
+ server.registerPrompt('compare_agent_candidates', {
115
+ title: 'Compare agent evaluation candidates',
116
+ description: 'Compare two evaluation runs for comparability then rank',
117
+ argsSchema: {
118
+ baselineRunUuid: zod_1.z.string().optional(),
119
+ candidateRunUuid: zod_1.z.string().optional(),
120
+ },
121
+ }, ({ baselineRunUuid, candidateRunUuid }) => userMessages(`Compare baseline run ${baselineRunUuid !== null && baselineRunUuid !== void 0 ? baselineRunUuid : '(uuid)'} vs candidate ${candidateRunUuid !== null && candidateRunUuid !== void 0 ? candidateRunUuid : '(uuid)'}.
122
+
123
+ ${playbooks_js_1.AI_AGENT_OPS_HARD_BANS}
124
+
125
+ Fetch both via get_agent_eval_run_results. Check suite/agent/mode comparability before ranking.
126
+ Hard failures beat average scores. Never prefer a candidate with a critical regression.`, 'evaluation'));
127
+ server.registerPrompt('prepare_agent_release', {
128
+ title: 'Prepare agent release recommendation',
129
+ description: 'Host release judgment using MCP results + CLI agentops gate',
130
+ argsSchema: {
131
+ agentUuid: zod_1.z.string().optional(),
132
+ runUuid: zod_1.z.string().optional(),
133
+ },
134
+ }, ({ agentUuid, runUuid }) => userMessages(`Prepare a release recommendation for agent ${agentUuid !== null && agentUuid !== void 0 ? agentUuid : '(select)'} using run ${runUuid !== null && runUuid !== void 0 ? runUuid : '(select)'}.
135
+
136
+ ${playbooks_js_1.AI_AGENT_OPS_HARD_BANS}
137
+
138
+ Require MCP run results plus CLI agentops evaluate-gate evidence when available.
139
+ Return PASS, CONDITIONAL, or FAIL with risks and rollback notes. Do not deploy.`, 'release-gate'));
140
+ }
141
+ /* eslint-enable @typescript-eslint/no-deprecated */
@@ -0,0 +1,4 @@
1
+ /**
2
+ * AI agent-ops prompt/playbook invariants.
3
+ */
4
+ export {};
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /**
3
+ * AI agent-ops prompt/playbook invariants.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const vitest_1 = require("vitest");
7
+ const playbooks_js_1 = require("./resources/playbooks.js");
8
+ const index_js_1 = require("./index.js");
9
+ (0, vitest_1.describe)('ai-agent-ops prompts/playbook', () => {
10
+ (0, vitest_1.it)('playbook references only registered tool short ids', () => {
11
+ const md = (0, playbooks_js_1.getAllPlaybookMarkdown)();
12
+ for (const id of index_js_1.AI_AGENT_OPS_TOOL_IDS) {
13
+ (0, vitest_1.expect)(md.includes(id) || md.includes(`lightdash_${id}`)).toBe(true);
14
+ }
15
+ (0, vitest_1.expect)(md).not.toMatch(/\bldt__/);
16
+ (0, vitest_1.expect)(md.toLowerCase()).toContain('hard bans');
17
+ (0, vitest_1.expect)(playbooks_js_1.AI_AGENT_OPS_HARD_BANS.toLowerCase()).toContain('recommend');
18
+ });
19
+ (0, vitest_1.it)('playbook forbids offline mega-tools and agent CRUD on MCP', () => {
20
+ const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
21
+ (0, vitest_1.expect)(md).toContain('no offline scorers');
22
+ (0, vitest_1.expect)(md).toContain('agentops');
23
+ (0, vitest_1.expect)(md).toContain('evaluate_agent_readiness');
24
+ (0, vitest_1.expect)(md).toContain('run_agent_evaluation');
25
+ });
26
+ });
@@ -0,0 +1,39 @@
1
+ # AI agent-ops — core
2
+
3
+ URI: `lightdash://playbooks/ai-agent-ops/core`
4
+
5
+ ## Hard bans
6
+
7
+ Do not create/update/delete agents on this server, start or continue threads, mutate users/roles/semantic models/charts, run local offline scorers, write Git eval artifact stores via MCP, or claim a CLI promotion gate passed from MCP run results alone.
8
+
9
+ ## Tool catalog (primitives only)
10
+
11
+ There are no `recommend_*`, `analyze_*`, or offline dataset MCP tools (no offline scorers). Chain:
12
+
13
+ - Inventory: `list_project_agents`, `get_project_agent`
14
+ - Readiness API: `evaluate_agent_readiness` (not an eval run)
15
+ - Scope helpers: `get_agent_suggestions`, `get_agent_models`, `get_explore_access_summary`
16
+ - Threads (read): `list_agent_threads`, `get_agent_thread` (`includeMessageText=true` to reveal bodies / firstMessage)
17
+ - Evaluations: `list_agent_evaluations`, `get_agent_evaluation`, `create_agent_evaluation`, `update_agent_evaluation`, `append_agent_evaluation_prompts`, `delete_agent_evaluation`, `run_agent_evaluation`, `list_agent_evaluation_runs`, `get_agent_eval_run_results` (`includePromptText=true` to reveal prompt text)
18
+
19
+ ## Project scope
20
+
21
+ Resolve via `X-Lightdash-Project` or tool `projectUuid`. Otherwise `PROJECT_SCOPE_REQUIRED`. Optional ceiling: `LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS`.
22
+
23
+ ## Truth labels
24
+
25
+ | Signal | Tool | Means |
26
+ | -------------------- | ------------------------------------ | ---------------------------- |
27
+ | Readiness API | `evaluate_agent_readiness` | Product readiness score only |
28
+ | Evaluation run | `run_agent_evaluation` + run getters | Product e2e suite |
29
+ | Promotion gate | CLI `agentops evaluate-gate` | Policy against run results |
30
+ | Static config review | Host over `get_project_agent` | No MCP static scorer |
31
+
32
+ Never silently substitute readiness for an evaluation run.
33
+
34
+ ## Distributed loop
35
+
36
+ 1. MCP for Lightdash API evidence and product eval runs.
37
+ 2. Host synthesizes failures and chooses interventions.
38
+ 3. CLI `agentops` for bundles, drift, and gates.
39
+ 4. Optional other MCP personas (`semantic-layer`, `content-reader`) for metadata/content fixes.
@@ -0,0 +1,25 @@
1
+ # AI agent-ops — evaluation
2
+
3
+ URI: `lightdash://playbooks/ai-agent-ops/evaluation`
4
+
5
+ ## Phase 1 — Inspect agent
6
+
7
+ 1. `list_project_agents` / `get_project_agent`
8
+ 2. Optionally `get_agent_models`, `get_agent_suggestions`, `get_explore_access_summary`
9
+ 3. Optionally `evaluate_agent_readiness` — label as readiness API, not e2e
10
+
11
+ ## Phase 2 — Ensure suite
12
+
13
+ 1. `list_agent_evaluations` / `get_agent_evaluation`
14
+ 2. Create or update via `create_agent_evaluation` / `update_agent_evaluation` / `append_agent_evaluation_prompts` when needed
15
+ 3. Prefer deterministic expected responses when the product supports them
16
+
17
+ ## Phase 3 — Run
18
+
19
+ 1. `run_agent_evaluation` — open-world; budget runs
20
+ 2. Poll `list_agent_evaluation_runs` until terminal
21
+ 3. `get_agent_eval_run_results` for per-prompt evidence
22
+
23
+ ## Phase 4 — Do not invent scores on the server
24
+
25
+ Cluster failures and score in the host conversation. Promotion policy is CLI `agentops evaluate-gate` (see release-gate topic).
@@ -0,0 +1,14 @@
1
+ # AI agent-ops playbooks
2
+
3
+ URI: `lightdash://playbooks/ai-agent-ops`
4
+
5
+ Workflow-scoped playbooks. Prompts always embed **core**; topic prompts also embed one topic:
6
+
7
+ | Topic | URI |
8
+ | -------------------------- | ----------------------------------------------------- |
9
+ | Core (bans & truth labels) | `lightdash://playbooks/ai-agent-ops/core` |
10
+ | Evaluation | `lightdash://playbooks/ai-agent-ops/evaluation` |
11
+ | Loop engineering | `lightdash://playbooks/ai-agent-ops/loop-engineering` |
12
+ | Release gate | `lightdash://playbooks/ai-agent-ops/release-gate` |
13
+
14
+ Thin Lightdash AI-agent API surface. Loop engineering is distributed across MCP primitives, the host agent, and CLI `agentops` — there are no offline scorer or `recommend_*` MCP tools.
@@ -0,0 +1,28 @@
1
+ # AI agent-ops — loop engineering
2
+
3
+ URI: `lightdash://playbooks/ai-agent-ops/loop-engineering`
4
+
5
+ ## Loop (host-owned)
6
+
7
+ 1. Snapshot intent: record agent UUID + version from `get_project_agent`
8
+ 2. Baseline: product evaluation run via MCP
9
+ 3. Analyze failures in the host (instruction vs tags vs semantic metadata vs access)
10
+ 4. Intervene outside this persona:
11
+ - Semantic / AI hints → optional `semantic-layer` MCP or out-of-band
12
+ - Content → optional `content-reader` / developer workflows
13
+ - Agent config / eval suites as Git → CLI `agentops plan|apply`
14
+ 5. Regress with focused then full evaluation runs
15
+ 6. Gate with CLI `agentops evaluate-gate`
16
+ 7. Stop after gates pass, no safe intervention remains, or 3 iterations
17
+
18
+ ## Priority of interventions
19
+
20
+ ```text
21
+ correct semantic fact
22
+ → improve metadata/AI hints
23
+ → adjust tags/scope
24
+ → curate knowledge/verified examples
25
+ → revise instruction via agentops/CLI
26
+ ```
27
+
28
+ Do not recommend prompt patches when semantic metadata is demonstrably wrong.
@@ -0,0 +1,22 @@
1
+ # AI agent-ops — release gate
2
+
3
+ URI: `lightdash://playbooks/ai-agent-ops/release-gate`
4
+
5
+ ## MCP role
6
+
7
+ Fetch run results with `get_agent_eval_run_results`. Do **not** treat aggregate scores from conversation synthesis as a release decision.
8
+
9
+ ## CLI role
10
+
11
+ Use `lightdash-tools agentops evaluate-gate` with a `LightdashAiEvaluationGate` document against a completed run. Bundle drift/plan/apply remain CLI/`agentops`.
12
+
13
+ ## Decision outputs (host)
14
+
15
+ Return `PASS`, `CONDITIONAL`, or `FAIL` with:
16
+
17
+ - hard-gate failures
18
+ - new regressions vs baseline run
19
+ - unresolved risks
20
+ - rollback notes
21
+
22
+ Never deploy or mutate the agent from this MCP persona.
@@ -0,0 +1,10 @@
1
+ /**
2
+ * AI agent-ops multi-playbook resources (core + topics + index).
3
+ */
4
+ import type { McpServer } from '@modelcontextprotocol/server';
5
+ export type AiAgentOpsPlaybookTopic = 'evaluation' | 'loop-engineering' | 'release-gate';
6
+ export declare const AI_AGENT_OPS_HARD_BANS: string;
7
+ export declare const getAllPlaybookMarkdown: () => string;
8
+ export declare const AI_AGENT_OPS_CORE_PLAYBOOK: import("../../../lib/playbook-resources.js").EmbeddedPlaybook;
9
+ export declare const AI_AGENT_OPS_TOPIC_PLAYBOOKS: Readonly<Record<AiAgentOpsPlaybookTopic, import("../../../lib/playbook-resources.js").EmbeddedPlaybook>>;
10
+ export declare function registerAiAgentOpsPlaybook(server: McpServer): void;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ /**
3
+ * AI agent-ops multi-playbook resources (core + topics + index).
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AI_AGENT_OPS_TOPIC_PLAYBOOKS = exports.AI_AGENT_OPS_CORE_PLAYBOOK = exports.getAllPlaybookMarkdown = exports.AI_AGENT_OPS_HARD_BANS = void 0;
7
+ exports.registerAiAgentOpsPlaybook = registerAiAgentOpsPlaybook;
8
+ const playbook_resources_js_1 = require("../../../lib/playbook-resources.js");
9
+ const playbooks = (0, playbook_resources_js_1.definePersonaPlaybooks)({
10
+ personaId: 'ai-agent-ops',
11
+ moduleDir: __dirname,
12
+ hardBans: 'Do not create/update/delete agents on this server, start or continue threads, mutate users/roles/semantic models/charts, run local offline scorers, write Git eval artifact stores via MCP, invent recommend_* or analyze_* mega-tools, or claim a CLI promotion gate passed from MCP run results alone. Those capabilities are not available as MCP mega-tools here — use CLI agentops / other personas / the host.',
13
+ coreDescription: 'Hard bans, tool catalog, truth labels, and distributed loop rules',
14
+ topics: [
15
+ {
16
+ id: 'evaluation',
17
+ title: 'AI agent-ops evaluation playbook',
18
+ description: 'Product evaluation suites and readiness API usage',
19
+ file: 'evaluation.md',
20
+ },
21
+ {
22
+ id: 'loop-engineering',
23
+ title: 'AI agent-ops loop-engineering playbook',
24
+ description: 'Host-driven improve loop across MCP, CLI, and other personas',
25
+ file: 'loop-engineering.md',
26
+ },
27
+ {
28
+ id: 'release-gate',
29
+ title: 'AI agent-ops release-gate playbook',
30
+ description: 'Promotion decisions via CLI agentops evaluate-gate',
31
+ file: 'release-gate.md',
32
+ },
33
+ ],
34
+ });
35
+ exports.AI_AGENT_OPS_HARD_BANS = playbooks.HARD_BANS;
36
+ exports.getAllPlaybookMarkdown = playbooks.getAllPlaybookMarkdown;
37
+ exports.AI_AGENT_OPS_CORE_PLAYBOOK = playbooks.CORE_PLAYBOOK;
38
+ exports.AI_AGENT_OPS_TOPIC_PLAYBOOKS = playbooks.TOPIC_PLAYBOOKS;
39
+ function registerAiAgentOpsPlaybook(server) {
40
+ playbooks.registerPlaybooks(server);
41
+ }
@@ -6,5 +6,5 @@
6
6
  import type { PersonaDefinition } from '../../types.js';
7
7
  export declare const CONTENT_DEVELOPER_PERSONA_PATH: "/content-developer/v1/mcp";
8
8
  /** Explicit allowlist — must stay a deliberate subset of the shared registry. */
9
- export declare const CONTENT_DEVELOPER_TOOL_IDS: readonly ["get_project", "search_content", "list_spaces", "get_space", "get_dashboard", "get_chart", "preview_chart_changes", "preview_dashboard_changes", "preview_content_move", "validate_chart", "validate_dashboard", "confirm_preview", "compare_chart_versions", "compare_dashboard_versions", "create_chart", "update_chart", "duplicate_chart", "create_dashboard", "update_dashboard", "duplicate_dashboard", "add_dashboard_tile", "move_dashboard_tile", "remove_dashboard_tile", "resize_dashboard_tile", "move_content"];
9
+ export declare const CONTENT_DEVELOPER_TOOL_IDS: readonly ["get_project", "search_content", "list_spaces", "get_space", "get_dashboard", "get_chart", "get_chart_as_code", "preview_chart_changes", "preview_dashboard_changes", "preview_content_move", "validate_chart", "validate_dashboard", "confirm_preview", "compare_chart_versions", "compare_dashboard_versions", "create_chart", "update_chart", "duplicate_chart", "create_dashboard", "update_dashboard", "duplicate_dashboard", "add_dashboard_tile", "move_dashboard_tile", "remove_dashboard_tile", "resize_dashboard_tile", "move_content"];
10
10
  export declare const contentDeveloperPersona: PersonaDefinition;
@@ -17,6 +17,7 @@ exports.CONTENT_DEVELOPER_TOOL_IDS = [
17
17
  'get_space',
18
18
  'get_dashboard',
19
19
  'get_chart',
20
+ 'get_chart_as_code',
20
21
  'preview_chart_changes',
21
22
  'preview_dashboard_changes',
22
23
  'preview_content_move',
@@ -1,5 +1,8 @@
1
1
  /**
2
2
  * MCP prompts for content-developer workflows.
3
+ *
4
+ * Procedure detail lives in playbooks (embedded via createPromptPlaybookEmbedder).
5
+ * Prompt bodies stay goal/input-specific — do not restate entire SOPs here.
3
6
  */
4
7
  import type { McpServer } from '@modelcontextprotocol/server';
5
8
  export declare function registerContentDeveloperPrompts(server: McpServer): void;
@@ -1,138 +1,157 @@
1
1
  "use strict";
2
2
  /**
3
3
  * MCP prompts for content-developer workflows.
4
+ *
5
+ * Procedure detail lives in playbooks (embedded via createPromptPlaybookEmbedder).
6
+ * Prompt bodies stay goal/input-specific — do not restate entire SOPs here.
4
7
  */
5
8
  Object.defineProperty(exports, "__esModule", { value: true });
6
9
  exports.registerContentDeveloperPrompts = registerContentDeveloperPrompts;
7
10
  /* eslint-disable @typescript-eslint/no-deprecated -- matches content-reader prompt registration pattern */
8
11
  const zod_1 = require("zod");
12
+ const schema_fields_js_1 = require("../../../tools/lib/schema-fields.js");
9
13
  const playbook_resources_js_1 = require("../../lib/playbook-resources.js");
10
14
  const playbooks_js_1 = require("./resources/playbooks.js");
11
15
  const userMessages = (0, playbook_resources_js_1.createPromptPlaybookEmbedder)({
12
16
  core: playbooks_js_1.CONTENT_DEVELOPER_CORE_PLAYBOOK,
13
17
  topics: playbooks_js_1.CONTENT_DEVELOPER_TOPIC_PLAYBOOKS,
14
18
  });
15
- const PREVIEW_VALIDATE_APPLY = `Hard rule: preview -> confirm_preview -> apply. Call the matching lightdash_preview_* tool first,
16
- record the previewId and resourceKey. Unlock every write (create, update, duplicate, tile ops, content moves)
17
- with lightdash_confirm_preview using that previewId and the exact resourceKind/resourceKey the preview was
18
- created with. Then apply with the write tool using that previewId. Never call a write tool without a fresh,
19
- confirmed previewId bound to that exact resource. lightdash_validate_chart / lightdash_validate_dashboard are
20
- optional health checks on a saved UUID only — they do not unlock apply.`;
21
- const DASHBOARD_FIRST = `Dashboard-first: the dashboard is the authoring and promotion unit. Create/update charts only as
22
- tile prerequisites in this workflow; every new chart must be added as a dashboard tile before treating work as done.
23
- Do not create or update spaces (Terraform / out-of-band) — place content in an existing spaceUuid from list_spaces/get_space.
24
- Promote via the content-governance persona (form elicitation), not this persona.`;
19
+ const optionalProjectUuid = (0, schema_fields_js_1.projectUuidField)().optional();
20
+ const PROJECT_UUID_HINT = '(pass on every tool, or use HTTP pin — else PROJECT_SCOPE_REQUIRED)';
21
+ const TOPIC_DASHBOARDS = 'dashboards';
22
+ const TOPIC_DASHBOARD_DESIGN = 'dashboard-design';
23
+ const TOPIC_CHART_TYPES = 'chart-types';
24
+ const DASHBOARD_CHART_TOPIC_IDS = [
25
+ TOPIC_DASHBOARDS,
26
+ TOPIC_DASHBOARD_DESIGN,
27
+ TOPIC_CHART_TYPES,
28
+ ];
29
+ const DASHBOARD_TOPIC_IDS = [TOPIC_DASHBOARDS, TOPIC_DASHBOARD_DESIGN];
30
+ const DASHBOARD_PUBLISH_TOPIC_IDS = [TOPIC_DASHBOARDS, TOPIC_CHART_TYPES];
31
+ /** Thin stop gate — Phase Design / Objective detail lives in dashboard-design playbook. */
32
+ const DESIGN_SPEC_STOP = 'Emit a Design Spec (dashboard-design Phase Design: Objective + tiles with tableName citing insights + filter apply/exclude plan), then **stop until the user proceeds / approves / amends** before any preview_* or write. If the user already gave an explicit all-chart-types (or multi-viz) checklist + goal + projectUuid, a one-line Objective restatement is enough — treat that as approval after restating once. Always pass projectUuid on confirm_preview and apply when there is no HTTP pin.';
25
33
  function registerContentDeveloperPrompts(server) {
26
34
  server.registerPrompt('create_dashboard', {
27
35
  title: 'Create dashboard',
28
- description: 'Create a dashboard in an existing space, authoring charts only as tiles on that dashboard',
36
+ description: 'Clarify Objective → Design Spec (await approval) → shell → dashboardSlug charts → tiles / filters',
29
37
  argsSchema: {
30
38
  goal: zod_1.z.string(),
39
+ projectUuid: optionalProjectUuid,
31
40
  spaceUuid: zod_1.z.string().optional(),
32
41
  chartReferences: zod_1.z.string().optional(),
33
42
  },
34
- }, ({ goal, spaceUuid, chartReferences }) => userMessages(`Create a new dashboard for this goal:
43
+ }, ({ goal, projectUuid, spaceUuid, chartReferences }) => userMessages(`Create a new dashboard for this goal:
35
44
 
36
45
  ${goal}
37
46
 
38
- ${playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS}
39
-
40
- ${PREVIEW_VALIDATE_APPLY}
47
+ Project UUID: ${projectUuid !== null && projectUuid !== void 0 ? projectUuid : PROJECT_UUID_HINT}.
41
48
 
42
- ${DASHBOARD_FIRST}
49
+ ${playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS}
43
50
 
44
51
  Target existing space: ${spaceUuid !== null && spaceUuid !== void 0 ? spaceUuid : '(resolve with lightdash_list_spaces / lightdash_get_space — never create a space)'}.
45
- Chart hints: ${chartReferences !== null && chartReferences !== void 0 ? chartReferences : '(none provided)'}.
46
- Discover reusable charts with lightdash_search_content / lightdash_get_chart.
47
- If a new semantic chart is required, preview_chart_changes → confirm_preview → create_chart, then immediately
48
- preview_dashboard_changes / add_dashboard_tile so the chart is on this dashboard.
49
- Preview dashboard create with lightdash_preview_dashboard_changes (resourceKey 'new'), confirm with
50
- lightdash_confirm_preview (resourceKind 'dashboard', resourceKey 'new'), apply with lightdash_create_dashboard.
51
- For each tile, preview the tile array, confirm_preview, then lightdash_add_dashboard_tile.
52
- Report dashboard UUID/slug, tiles, and chart UUIDs — do not stop at orphan charts.`, 'dashboards'));
52
+ Chart hints: ${chartReferences !== null && chartReferences !== void 0 ? chartReferences : '(none provided — discover seeds via get_space / short search_content, then get_chart_as_code)'}.
53
+
54
+ 1. If the goal is vague on audience / decisions / what to understand: ask **2–4 clarifying questions** before a Spec (do not invent a viz-type checklist).
55
+ 2. Read-only discovery only (project/space/seeds).
56
+ 3. ${DESIGN_SPEC_STOP} Multi-viz / all chart types only if the user explicitly asked (see dashboards + chart-types playbooks).
57
+ 4. After approval: follow embedded playbooks (preview→confirm→apply).
58
+ 5. Report dashboard UUID/slug, tiles, filters, chart UUIDs — reject space-only orphans or untiled dashboard-owned charts.`, DASHBOARD_CHART_TOPIC_IDS));
53
59
  server.registerPrompt('improve_dashboard', {
54
60
  title: 'Improve dashboard',
55
- description: 'Improve an existing dashboard (layout, filters, or tile set)',
61
+ description: 'Clarify Objective if needed → Design Spec delta (await approval) → layout / filters / tiles',
56
62
  argsSchema: {
57
63
  dashboardUuidOrSlug: zod_1.z.string(),
58
64
  improvementGoal: zod_1.z.string(),
65
+ projectUuid: optionalProjectUuid,
59
66
  },
60
- }, ({ dashboardUuidOrSlug, improvementGoal }) => userMessages(`Improve dashboard ${dashboardUuidOrSlug} for this goal:
67
+ }, ({ dashboardUuidOrSlug, improvementGoal, projectUuid }) => userMessages(`Improve dashboard ${dashboardUuidOrSlug} for this goal:
61
68
 
62
69
  ${improvementGoal}
63
70
 
64
- ${playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS}
65
-
66
- ${PREVIEW_VALIDATE_APPLY}
71
+ Project UUID: ${projectUuid !== null && projectUuid !== void 0 ? projectUuid : PROJECT_UUID_HINT}.
67
72
 
68
- ${DASHBOARD_FIRST}
73
+ ${playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS}
69
74
 
70
- Inspect current structure with lightdash_get_dashboard first.
71
- If new charts are needed, author them as tile prerequisites then add tiles — never as a standalone publish.
72
- Preview with lightdash_preview_dashboard_changes, unlock with lightdash_confirm_preview,
73
- then apply with lightdash_update_dashboard and/or the tile tools (lightdash_add_dashboard_tile,
74
- lightdash_move_dashboard_tile, lightdash_remove_dashboard_tile, lightdash_resize_dashboard_tile).
75
- Optionally run lightdash_validate_dashboard afterward as a saved-resource health check.
76
- Report what changed and any remaining validation warnings.`, 'dashboards'));
75
+ 1. Inspect with lightdash_get_dashboard first (tile x/y/w/h may be missing — rebuild layout intentionally).
76
+ 2. If the improvement goal is vague on decisions / insights: ask **2–4 clarifying questions** before a Spec delta.
77
+ 3. For material layout/tile/filter changes (including professionalize): ${DESIGN_SPEC_STOP} Use the **Improve / professionalize Spec delta** (keep / drop / rename + cull) in dashboard-design. Trivial one-shot renames the user already specified may skip the stop. Multi-viz / all chart types only if the user explicitly asked.
78
+ 4. After approval: follow embedded playbooks. New charts: get_chart_as_code + dashboardSlug, then tile. Rename tile titles and chart names when stripping demo prefixes.
79
+ Report what changed (tiles, filters, chart UUIDs), any untiled dashboard-owned leftovers (content-governance for soft-delete), and validation warnings.`, DASHBOARD_CHART_TOPIC_IDS));
77
80
  server.registerPrompt('refactor_dashboard', {
78
81
  title: 'Refactor dashboard',
79
- description: 'Refactor a dashboard by comparing versions and reconciling drift',
82
+ description: 'Compare versions; Design Spec delta for material changes (await approval), then reconcile',
80
83
  argsSchema: {
81
84
  dashboardUuidOrSlug: zod_1.z.string(),
82
85
  concern: zod_1.z.string().optional(),
86
+ projectUuid: optionalProjectUuid,
83
87
  },
84
- }, ({ dashboardUuidOrSlug, concern }) => userMessages(`Refactor dashboard ${dashboardUuidOrSlug}.
88
+ }, ({ dashboardUuidOrSlug, concern, projectUuid }) => userMessages(`Refactor dashboard ${dashboardUuidOrSlug}.
89
+
90
+ Project UUID: ${projectUuid !== null && projectUuid !== void 0 ? projectUuid : PROJECT_UUID_HINT}.
85
91
 
86
92
  ${playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS}
87
93
 
88
- ${PREVIEW_VALIDATE_APPLY}
94
+ Concern: ${concern !== null && concern !== void 0 ? concern : '(general cleanup)'}.
95
+ 1. Use lightdash_compare_dashboard_versions before proposing changes.
96
+ 2. For material layout/tile/filter changes: ${DESIGN_SPEC_STOP} Trivial one-shot renames may skip the stop.
97
+ 3. After approval: follow embedded dashboards + dashboard-design. Do not remove tiles unless the approved Spec or user request allows it.`, DASHBOARD_TOPIC_IDS));
98
+ server.registerPrompt('author_chart', {
99
+ title: 'Author chart',
100
+ description: 'Clone a working seed chart (cartesian encode intact); optional dashboardSlug scoping',
101
+ argsSchema: {
102
+ goal: zod_1.z.string(),
103
+ projectUuid: optionalProjectUuid,
104
+ seedChartUuidOrSlug: zod_1.z.string().optional(),
105
+ dashboardSlug: zod_1.z.string().optional(),
106
+ },
107
+ }, ({ goal, projectUuid, seedChartUuidOrSlug, dashboardSlug }) => userMessages(`Author a semantic chart for this goal:
89
108
 
90
- ${DASHBOARD_FIRST}
109
+ ${goal}
91
110
 
92
- Concern: ${concern !== null && concern !== void 0 ? concern : '(general cleanup)'}.
93
- Use lightdash_compare_dashboard_versions to understand recent drift before proposing changes.
94
- Preview with lightdash_preview_dashboard_changes, confirm_preview, then apply with lightdash_update_dashboard
95
- and the tile tools as needed. Do not remove tiles unless explicitly requested.`, 'dashboards'));
111
+ Project UUID: ${projectUuid !== null && projectUuid !== void 0 ? projectUuid : PROJECT_UUID_HINT}.
112
+ Seed chart: ${seedChartUuidOrSlug !== null && seedChartUuidOrSlug !== void 0 ? seedChartUuidOrSlug : '(find a rendering seed on the same tableName via search_content / get_space)'}.
113
+ Dashboard slug: ${dashboardSlug !== null && dashboardSlug !== void 0 ? dashboardSlug : '(omit only for intentional space-owned charts; for dashboard work set dashboardSlug to an existing dashboard shell)'}.
114
+
115
+ ${playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS}
116
+
117
+ Follow core + chart-types (clone via get_chart_as_code; preview with top-level slug; keep customDimensions when needed; tile if dashboardSlug set).
118
+ When dashboardSlug is set, the chart must serve a **board insight** from the approved Design Spec — do not invent a viz type for its own sake.
119
+ Report UUID/slug from charts[0].data; note this persona cannot run_chart / prove UI render.`, TOPIC_CHART_TYPES));
96
120
  server.registerPrompt('move_content', {
97
121
  title: 'Move content',
98
122
  description: 'Move charts/dashboards into an existing space (no space create/update)',
99
123
  argsSchema: {
100
124
  goal: zod_1.z.string(),
125
+ projectUuid: optionalProjectUuid,
101
126
  spaceReferences: zod_1.z.string().optional(),
102
127
  },
103
- }, ({ goal, spaceReferences }) => userMessages(`Move content between existing spaces for this goal:
128
+ }, ({ goal, projectUuid, spaceReferences }) => userMessages(`Move content between existing spaces for this goal:
104
129
 
105
130
  ${goal}
106
131
 
107
- ${playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS}
132
+ Project UUID: ${projectUuid !== null && projectUuid !== void 0 ? projectUuid : PROJECT_UUID_HINT}.
108
133
 
109
- ${PREVIEW_VALIDATE_APPLY}
134
+ ${playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS}
110
135
 
111
136
  Space hints: ${spaceReferences !== null && spaceReferences !== void 0 ? spaceReferences : '(discover with lightdash_list_spaces)'}.
112
- Inspect with lightdash_list_spaces / lightdash_get_space. Target spaces must already exist —
113
- do not call create_space or update_space (not available; Terraform / out-of-band).
114
- Preview with lightdash_preview_content_move using itemUuids + targetSpaceUuid + contentTypes,
115
- confirm with lightdash_confirm_preview (resourceKind 'content-move'), then apply with lightdash_move_content.
137
+ Follow core + content-move playbooks. Target spaces must already exist.
116
138
  Report moved items and target space.`, 'content-move'));
117
139
  server.registerPrompt('publish_content', {
118
140
  title: 'Publish content',
119
141
  description: 'Validate dashboard-scoped authored content before treating it as done',
120
142
  argsSchema: {
121
143
  contentReferences: zod_1.z.string(),
144
+ projectUuid: optionalProjectUuid,
122
145
  },
123
- }, ({ contentReferences }) => userMessages(`Finalize and validate this authored Lightdash content before considering it done:
146
+ }, ({ contentReferences, projectUuid }) => userMessages(`Finalize this authored Lightdash content before considering it done:
124
147
 
125
148
  ${contentReferences}
126
149
 
127
- ${playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS}
150
+ Project UUID: ${projectUuid !== null && projectUuid !== void 0 ? projectUuid : PROJECT_UUID_HINT}.
128
151
 
129
- ${DASHBOARD_FIRST}
152
+ ${playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS}
130
153
 
131
- Run lightdash_validate_chart / lightdash_validate_dashboard on every touched chart and dashboard.
132
- Every new/updated chart must appear on a dashboard tile — reject orphan chart-only done states.
133
- Do not report success while validation errors remain outstanding.
134
- Summarize validation results, remaining warnings, dashboard and chart UUIDs/slugs touched.
135
- This persona cannot promote, publish permissions, or perform org-level release actions;
136
- operators should use content-governance (lightdash_promote_dashboard) when promoting across projects.`, 'dashboards'));
154
+ Done checklist: markdown/description states the **Objective**; tiles map to approved insight questions; every saved filter matches each tile explore or has explicit tileTargets exclude/remap; dashboardSlug on new charts + tiles present; cartesian encode intact; no invented fieldIds. Report untiled dashboard-owned leftovers (soft-delete via content-governance). Follow embedded playbooks for encode/map/filter detail. UI runtime not verified on this persona.
155
+ Optionally validate_* (schema/health only). Promote is content-governance, not this persona.`, DASHBOARD_PUBLISH_TOPIC_IDS));
137
156
  }
138
157
  /* eslint-enable @typescript-eslint/no-deprecated */