@lightdash-tools/mcp 0.7.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.
- package/README.md +113 -170
- package/dist/audit/server-persona.d.ts +10 -0
- package/dist/audit/server-persona.js +19 -0
- package/dist/auth/oauth-broker/pending-store.d.ts +69 -19
- package/dist/auth/oauth-broker/pending-store.js +52 -26
- package/dist/auth/oauth-broker/pending-store.test.d.ts +5 -0
- package/dist/auth/oauth-broker/pending-store.test.js +109 -0
- package/dist/auth/oauth-broker/routes.d.ts +6 -2
- package/dist/auth/oauth-broker/routes.js +25 -20
- package/dist/auth/oauth-broker/routes.test.js +33 -28
- package/dist/auth/request-state-key.d.ts +19 -0
- package/dist/auth/request-state-key.js +49 -0
- package/dist/auth/resource-server/lightdash-oauth-middleware.d.ts +0 -2
- package/dist/auth/resource-server/lightdash-oauth-middleware.js +0 -19
- package/dist/auth/resource-server/www-authenticate.test.js +12 -8
- package/dist/bin.js +30 -2
- package/dist/config/env.d.ts +5 -8
- package/dist/config/env.js +6 -9
- package/dist/config/load-mcp-config.d.ts +0 -4
- package/dist/config/load-mcp-config.js +8 -5
- package/dist/config/load-mcp-config.test.js +7 -0
- package/dist/config/normalize-url.test.js +16 -7
- package/dist/config/runtime.d.ts +3 -3
- package/dist/config/runtime.js +19 -23
- package/dist/config/runtime.test.js +23 -9
- package/dist/config/test-mcp-http-config.js +1 -1
- package/dist/destructive/capability.d.ts +13 -0
- package/dist/destructive/capability.js +37 -0
- package/dist/destructive/capability.test.js +46 -0
- package/dist/destructive/confirmation.d.ts +58 -0
- package/dist/destructive/confirmation.js +99 -0
- package/dist/destructive/confirmation.test.d.ts +1 -0
- package/dist/destructive/confirmation.test.js +75 -0
- package/dist/destructive/content-promote.d.ts +8 -0
- package/dist/destructive/content-promote.js +150 -0
- package/dist/destructive/content-soft-delete.d.ts +7 -0
- package/dist/destructive/content-soft-delete.js +106 -0
- package/dist/destructive/destructive-contract.test.d.ts +1 -0
- package/dist/destructive/destructive-contract.test.js +269 -0
- package/dist/destructive/precondition.d.ts +14 -0
- package/dist/destructive/precondition.js +31 -0
- package/dist/destructive/precondition.test.d.ts +1 -0
- package/dist/destructive/precondition.test.js +72 -0
- package/dist/destructive/promote-contract.test.d.ts +1 -0
- package/dist/destructive/promote-contract.test.js +398 -0
- package/dist/destructive/register-destructive-tool.d.ts +54 -0
- package/dist/destructive/register-destructive-tool.js +283 -0
- package/dist/destructive/request-state.d.ts +12 -0
- package/dist/destructive/request-state.js +41 -0
- package/dist/destructive/types.d.ts +65 -0
- package/dist/destructive/types.js +10 -0
- package/dist/governance/available-projects.d.ts +37 -0
- package/dist/governance/available-projects.js +132 -0
- package/dist/governance/available-projects.test.d.ts +4 -0
- package/dist/governance/available-projects.test.js +107 -0
- package/dist/governance/client-capabilities-cache.d.ts +44 -0
- package/dist/governance/client-capabilities-cache.js +142 -0
- package/dist/governance/client-capabilities-cache.test.d.ts +1 -0
- package/dist/governance/client-capabilities-cache.test.js +148 -0
- package/dist/governance/mcp-client-session.d.ts +10 -0
- package/dist/governance/mcp-client-session.js +31 -0
- package/dist/governance/mcp-client-session.test.d.ts +1 -0
- package/dist/governance/mcp-client-session.test.js +31 -0
- package/dist/governance/project-scope.d.ts +24 -0
- package/dist/governance/project-scope.js +71 -0
- package/dist/governance/project-scope.test.d.ts +4 -0
- package/dist/governance/project-scope.test.js +80 -0
- package/dist/governance/promote-allowlist.d.ts +18 -0
- package/dist/governance/promote-allowlist.js +66 -0
- package/dist/governance/promote-allowlist.test.d.ts +4 -0
- package/dist/governance/promote-allowlist.test.js +87 -0
- package/dist/http.integration.test.js +151 -262
- package/dist/http.test.js +0 -12
- package/dist/index.integration.test.js +0 -4
- package/dist/index.js +3 -1
- package/dist/personas/ai-agent-ops/v1/index.d.ts +8 -0
- package/dist/personas/ai-agent-ops/v1/index.js +41 -0
- package/dist/personas/ai-agent-ops/v1/prompts.d.ts +5 -0
- package/dist/personas/ai-agent-ops/v1/prompts.js +141 -0
- package/dist/personas/ai-agent-ops/v1/prompts.test.d.ts +4 -0
- package/dist/personas/ai-agent-ops/v1/prompts.test.js +26 -0
- package/dist/personas/ai-agent-ops/v1/resources/playbooks/core.md +39 -0
- package/dist/personas/ai-agent-ops/v1/resources/playbooks/evaluation.md +25 -0
- package/dist/personas/ai-agent-ops/v1/resources/playbooks/index.md +14 -0
- package/dist/personas/ai-agent-ops/v1/resources/playbooks/loop-engineering.md +28 -0
- package/dist/personas/ai-agent-ops/v1/resources/playbooks/release-gate.md +22 -0
- package/dist/personas/ai-agent-ops/v1/resources/playbooks.d.ts +10 -0
- package/dist/personas/ai-agent-ops/v1/resources/playbooks.js +41 -0
- package/dist/personas/content-developer/v1/index.d.ts +10 -0
- package/dist/personas/content-developer/v1/index.js +52 -0
- package/dist/personas/content-developer/v1/prompts.d.ts +8 -0
- package/dist/personas/content-developer/v1/prompts.js +157 -0
- package/dist/personas/content-developer/v1/prompts.test.d.ts +4 -0
- package/dist/personas/content-developer/v1/prompts.test.js +231 -0
- package/dist/personas/content-developer/v1/resources/playbooks/chart-types.md +123 -0
- package/dist/personas/content-developer/v1/resources/playbooks/content-move.md +22 -0
- package/dist/personas/content-developer/v1/resources/playbooks/core.md +105 -0
- package/dist/personas/content-developer/v1/resources/playbooks/dashboard-design.md +153 -0
- package/dist/personas/content-developer/v1/resources/playbooks/dashboards.md +103 -0
- package/dist/personas/content-developer/v1/resources/playbooks/index.md +15 -0
- package/dist/personas/content-developer/v1/resources/playbooks.d.ts +10 -0
- package/dist/personas/content-developer/v1/resources/playbooks.js +63 -0
- package/dist/personas/content-governance/v1/index.d.ts +9 -0
- package/dist/personas/content-governance/v1/index.js +29 -0
- package/dist/personas/content-governance/v1/prompts.d.ts +5 -0
- package/dist/personas/content-governance/v1/prompts.js +87 -0
- package/dist/personas/content-governance/v1/prompts.test.d.ts +4 -0
- package/dist/personas/content-governance/v1/prompts.test.js +75 -0
- package/dist/personas/content-governance/v1/resources/playbooks/charts.md +29 -0
- package/dist/personas/content-governance/v1/resources/playbooks/core.md +52 -0
- package/dist/personas/content-governance/v1/resources/playbooks/dashboards.md +48 -0
- package/dist/personas/content-governance/v1/resources/playbooks/index.md +13 -0
- package/dist/personas/content-governance/v1/resources/playbooks.d.ts +10 -0
- package/dist/personas/content-governance/v1/resources/playbooks.js +41 -0
- package/dist/personas/content-reader/v1/index.d.ts +8 -0
- package/dist/personas/content-reader/v1/index.js +38 -0
- package/dist/personas/content-reader/v1/prompts.d.ts +5 -0
- package/dist/personas/content-reader/v1/prompts.js +162 -0
- package/dist/personas/content-reader/v1/prompts.test.d.ts +4 -0
- package/dist/personas/content-reader/v1/prompts.test.js +25 -0
- package/dist/personas/content-reader/v1/resources/playbooks/compare.md +36 -0
- package/dist/personas/content-reader/v1/resources/playbooks/core.md +67 -0
- package/dist/personas/content-reader/v1/resources/playbooks/discover.md +35 -0
- package/dist/personas/content-reader/v1/resources/playbooks/explain-run.md +49 -0
- package/dist/personas/content-reader/v1/resources/playbooks/index.md +14 -0
- package/dist/personas/content-reader/v1/resources/playbooks.d.ts +10 -0
- package/dist/personas/content-reader/v1/resources/playbooks.js +49 -0
- package/dist/personas/index.d.ts +4 -0
- package/dist/personas/index.js +31 -10
- package/dist/personas/index.test.js +92 -26
- package/dist/personas/lib/playbook-resources.d.ts +80 -0
- package/dist/personas/lib/playbook-resources.js +169 -0
- package/dist/personas/organization-audit/v1/index.js +2 -2
- package/dist/personas/organization-audit/v1/prompts.js +79 -66
- package/dist/personas/organization-audit/v1/prompts.test.js +4 -4
- package/dist/personas/organization-audit/v1/resources/playbooks/access.md +21 -0
- package/dist/personas/organization-audit/v1/resources/playbooks/content.md +19 -0
- package/dist/personas/organization-audit/v1/resources/playbooks/core.md +69 -0
- package/dist/personas/organization-audit/v1/resources/playbooks/deliveries.md +14 -0
- package/dist/personas/organization-audit/v1/resources/playbooks/index.md +14 -0
- package/dist/personas/organization-audit/v1/resources/playbooks.d.ts +10 -0
- package/dist/personas/organization-audit/v1/resources/playbooks.js +41 -0
- package/dist/personas/persona.parity.test.d.ts +1 -0
- package/dist/personas/persona.parity.test.js +30 -0
- package/dist/personas/semantic-layer/v1/index.js +2 -2
- package/dist/personas/semantic-layer/v1/prompts.js +56 -67
- package/dist/personas/semantic-layer/v1/prompts.test.d.ts +4 -0
- package/dist/personas/semantic-layer/v1/prompts.test.js +19 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks/compose-compile.md +60 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks/core.md +71 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks/explore.md +79 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks/index.md +13 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks.d.ts +13 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks.js +39 -0
- package/dist/personas/types.d.ts +1 -1
- package/dist/policy/content-developer.d.ts +35 -0
- package/dist/policy/content-developer.js +91 -0
- package/dist/policy/content-developer.test.d.ts +4 -0
- package/dist/policy/content-developer.test.js +54 -0
- package/dist/policy/content-reader.d.ts +28 -0
- package/dist/policy/content-reader.js +67 -0
- package/dist/policy/content-reader.test.d.ts +4 -0
- package/dist/policy/content-reader.test.js +23 -0
- package/dist/policy/envelope.d.ts +31 -0
- package/dist/policy/envelope.js +24 -0
- package/dist/policy/preview-ledger-fault.test.d.ts +1 -0
- package/dist/policy/preview-ledger-fault.test.js +202 -0
- package/dist/policy/preview-ledger.d.ts +82 -0
- package/dist/policy/preview-ledger.js +165 -0
- package/dist/policy/preview-ledger.test.d.ts +1 -0
- package/dist/policy/preview-ledger.test.js +393 -0
- package/dist/policy/result-limits.d.ts +32 -0
- package/dist/policy/result-limits.js +106 -0
- package/dist/policy/result-limits.test.d.ts +4 -0
- package/dist/policy/result-limits.test.js +37 -0
- package/dist/server/capabilities.js +3 -1
- package/dist/server/capabilities.test.js +5 -1
- package/dist/server/server.js +16 -1
- package/dist/server/upstream-errors.d.ts +17 -0
- package/dist/server/upstream-errors.js +60 -0
- package/dist/server/upstream-errors.test.d.ts +1 -0
- package/dist/server/upstream-errors.test.js +50 -0
- package/dist/stdio.process.test.js +150 -0
- package/dist/tools/ai-agents/agents.d.ts +7 -0
- package/dist/tools/ai-agents/agents.js +32 -0
- package/dist/tools/ai-agents/agents.test.d.ts +1 -0
- package/dist/tools/ai-agents/agents.test.js +176 -0
- package/dist/tools/ai-agents/discovery.d.ts +9 -0
- package/dist/tools/ai-agents/discovery.js +73 -0
- package/dist/tools/ai-agents/evaluations.d.ts +14 -0
- package/dist/tools/ai-agents/evaluations.js +177 -0
- package/dist/tools/ai-agents/helpers.d.ts +64 -0
- package/dist/tools/ai-agents/helpers.js +323 -0
- package/dist/tools/ai-agents/threads.d.ts +7 -0
- package/dist/tools/ai-agents/threads.js +40 -0
- package/dist/tools/composition/explain-content.d.ts +6 -0
- package/dist/tools/composition/explain-content.js +108 -0
- package/dist/tools/lib/api-errors.d.ts +2 -0
- package/dist/tools/lib/api-errors.js +5 -0
- package/dist/tools/lib/stable-stringify.d.ts +9 -0
- package/dist/tools/lib/stable-stringify.js +35 -0
- package/dist/tools/organization/inventory.js +2 -1
- package/dist/tools/project/content.js +5 -1
- package/dist/tools/project/delete-chart.d.ts +4 -0
- package/dist/tools/project/delete-chart.js +8 -0
- package/dist/tools/project/delete-dashboard.d.ts +4 -0
- package/dist/tools/project/delete-dashboard.js +8 -0
- package/dist/tools/project/developer-content-preview.d.ts +13 -0
- package/dist/tools/project/developer-content-preview.js +291 -0
- package/dist/tools/project/developer-content-shared.d.ts +24 -0
- package/dist/tools/project/developer-content-shared.js +50 -0
- package/dist/tools/project/developer-content-shared.test.d.ts +1 -0
- package/dist/tools/project/developer-content-shared.test.js +25 -0
- package/dist/tools/project/developer-content.d.ts +38 -0
- package/dist/tools/project/developer-content.js +589 -0
- package/dist/tools/project/developer-get-chart-as-code.d.ts +9 -0
- package/dist/tools/project/developer-get-chart-as-code.js +39 -0
- package/dist/tools/project/developer-get-chart-as-code.test.d.ts +4 -0
- package/dist/tools/project/developer-get-chart-as-code.test.js +70 -0
- package/dist/tools/project/developer-helpers.d.ts +180 -0
- package/dist/tools/project/developer-helpers.js +484 -0
- package/dist/tools/project/developer-helpers.test.d.ts +1 -0
- package/dist/tools/project/developer-helpers.test.js +509 -0
- package/dist/tools/project/get-dashboard-promote-diff.d.ts +6 -0
- package/dist/tools/project/get-dashboard-promote-diff.js +52 -0
- package/dist/tools/project/invariants.test.d.ts +4 -0
- package/dist/tools/project/invariants.test.js +44 -0
- package/dist/tools/project/parameters.d.ts +7 -0
- package/dist/tools/project/parameters.js +74 -0
- package/dist/tools/project/projects.d.ts +4 -1
- package/dist/tools/project/projects.js +68 -6
- package/dist/tools/project/projects.test.js +77 -1
- package/dist/tools/project/promote-dashboard.d.ts +4 -0
- package/dist/tools/project/promote-dashboard.js +8 -0
- package/dist/tools/project/reader-content.d.ts +9 -0
- package/dist/tools/project/reader-content.js +208 -0
- package/dist/tools/project/reader-execution.d.ts +7 -0
- package/dist/tools/project/reader-execution.js +214 -0
- package/dist/tools/project/reader-export-chart-image.d.ts +6 -0
- package/dist/tools/project/reader-export-chart-image.js +78 -0
- package/dist/tools/project/reader-export-chart-image.test.d.ts +4 -0
- package/dist/tools/project/reader-export-chart-image.test.js +149 -0
- package/dist/tools/project/schemas/chart-upsert.d.ts +33 -0
- package/dist/tools/project/schemas/chart-upsert.js +66 -0
- package/dist/tools/project/schemas/dashboard-tile.d.ts +29 -0
- package/dist/tools/project/schemas/dashboard-tile.js +57 -0
- package/dist/tools/project/schemas/dashboard.d.ts +70 -0
- package/dist/tools/project/schemas/dashboard.js +101 -0
- package/dist/tools/project/schemas/duplicate.d.ts +30 -0
- package/dist/tools/project/schemas/duplicate.js +86 -0
- package/dist/tools/project/schemas/index.d.ts +7 -0
- package/dist/tools/project/schemas/index.js +26 -0
- package/dist/tools/project/schemas/parse-helpers.d.ts +14 -0
- package/dist/tools/project/schemas/parse-helpers.js +34 -0
- package/dist/tools/project/schemas/payload-schemas.test.d.ts +1 -0
- package/dist/tools/project/schemas/payload-schemas.test.js +204 -0
- package/dist/tools/project/spaces.d.ts +7 -0
- package/dist/tools/project/spaces.js +101 -0
- package/dist/tools/query/bounded-saved-query.d.ts +37 -0
- package/dist/tools/query/bounded-saved-query.js +80 -0
- package/dist/tools/query/bounded-saved-query.test.d.ts +4 -0
- package/dist/tools/query/bounded-saved-query.test.js +82 -0
- package/dist/tools/query/chart-source.d.ts +10 -0
- package/dist/tools/query/chart-source.js +36 -0
- package/dist/tools/query/chart-source.test.d.ts +1 -0
- package/dist/tools/query/chart-source.test.js +62 -0
- package/dist/tools/query/filter-overrides.d.ts +34 -0
- package/dist/tools/query/filter-overrides.js +75 -0
- package/dist/tools/query/filter-overrides.test.d.ts +1 -0
- package/dist/tools/query/filter-overrides.test.js +21 -0
- package/dist/tools/query/lifecycle.d.ts +7 -0
- package/dist/tools/query/lifecycle.js +104 -0
- package/dist/tools/query/query-ledger.d.ts +41 -0
- package/dist/tools/query/query-ledger.js +92 -0
- package/dist/tools/query/query-ledger.test.d.ts +1 -0
- package/dist/tools/query/query-ledger.test.js +75 -0
- package/dist/tools/query/reader-tool-helpers.d.ts +12 -0
- package/dist/tools/query/reader-tool-helpers.js +57 -0
- package/dist/tools/query/reader-tool-helpers.test.d.ts +1 -0
- package/dist/tools/query/reader-tool-helpers.test.js +53 -0
- package/dist/tools/query/result-normalizer.d.ts +27 -0
- package/dist/tools/query/result-normalizer.js +133 -0
- package/dist/tools/query/result-normalizer.test.d.ts +1 -0
- package/dist/tools/query/result-normalizer.test.js +41 -0
- package/dist/tools/query/wait-for-async.d.ts +10 -0
- package/dist/tools/query/wait-for-async.js +46 -0
- package/dist/tools/query/wait-for-async.test.d.ts +1 -0
- package/dist/tools/query/wait-for-async.test.js +45 -0
- package/dist/tools/registry.d.ts +187 -3
- package/dist/tools/registry.js +89 -7
- package/dist/tools/shared.d.ts +52 -10
- package/dist/tools/shared.js +127 -41
- package/dist/tools/shared.test.js +103 -3
- package/dist/transports/streamable-http.js +47 -198
- package/dist/transports/streamable-http.test.js +21 -9
- package/package.json +5 -5
- package/dist/personas/organization-audit/v1/resources/playbook.d.ts +0 -11
- package/dist/personas/organization-audit/v1/resources/playbook.js +0 -40
- package/dist/personas/organization-audit/v1/resources/playbook.md +0 -52
- package/dist/personas/semantic-layer/v1/resources/playbook.d.ts +0 -12
- package/dist/personas/semantic-layer/v1/resources/playbook.js +0 -42
- package/dist/personas/semantic-layer/v1/resources/playbook.md +0 -153
- package/dist/transports/http-request-utils.d.ts +0 -2
- package/dist/transports/http-request-utils.js +0 -13
- package/dist/transports/session-store.d.ts +0 -40
- package/dist/transports/session-store.js +0 -88
- package/dist/transports/session-store.test.js +0 -111
- /package/dist/{transports/session-store.test.d.ts → destructive/capability.test.d.ts} +0 -0
|
@@ -3,46 +3,112 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const vitest_1 = require("vitest");
|
|
4
4
|
const registry_js_1 = require("../tools/registry.js");
|
|
5
5
|
const shared_js_1 = require("../tools/shared.js");
|
|
6
|
-
const index_js_1 = require("./
|
|
7
|
-
const index_js_2 = require("./index.js");
|
|
6
|
+
const index_js_1 = require("./ai-agent-ops/v1/index.js");
|
|
7
|
+
const index_js_2 = require("./content-developer/v1/index.js");
|
|
8
|
+
const index_js_3 = require("./content-governance/v1/index.js");
|
|
9
|
+
const index_js_4 = require("./content-reader/v1/index.js");
|
|
10
|
+
const index_js_5 = require("./organization-audit/v1/index.js");
|
|
11
|
+
const index_js_6 = require("./index.js");
|
|
8
12
|
(0, vitest_1.describe)('personas', () => {
|
|
9
|
-
(0, vitest_1.it)('ships
|
|
10
|
-
var _a, _b;
|
|
11
|
-
(0, vitest_1.expect)(Object.keys(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
(0, vitest_1.it)('ships six personas with fixed paths', () => {
|
|
14
|
+
var _a, _b, _c, _d, _e, _f;
|
|
15
|
+
(0, vitest_1.expect)(Object.keys(index_js_6.PERSONAS).sort()).toEqual([
|
|
16
|
+
'ai-agent-ops',
|
|
17
|
+
'content-developer',
|
|
18
|
+
'content-governance',
|
|
19
|
+
'content-reader',
|
|
20
|
+
'organization-audit',
|
|
21
|
+
'semantic-layer',
|
|
22
|
+
]);
|
|
23
|
+
(0, vitest_1.expect)(index_js_6.DEFAULT_PERSONA_ID).toBe('semantic-layer');
|
|
24
|
+
(0, vitest_1.expect)((0, index_js_6.listPersonaPaths)().sort()).toEqual([
|
|
25
|
+
index_js_6.AI_AGENT_OPS_PERSONA_PATH,
|
|
26
|
+
index_js_6.CONTENT_DEVELOPER_PERSONA_PATH,
|
|
27
|
+
index_js_6.CONTENT_GOVERNANCE_PERSONA_PATH,
|
|
28
|
+
index_js_6.CONTENT_READER_PERSONA_PATH,
|
|
29
|
+
index_js_6.ORGANIZATION_AUDIT_PERSONA_PATH,
|
|
30
|
+
index_js_6.SEMANTIC_LAYER_PERSONA_PATH,
|
|
31
|
+
].sort());
|
|
32
|
+
(0, vitest_1.expect)((_a = (0, index_js_6.getPersonaByPath)(index_js_6.SEMANTIC_LAYER_PERSONA_PATH)) === null || _a === void 0 ? void 0 : _a.id).toBe('semantic-layer');
|
|
33
|
+
(0, vitest_1.expect)((_b = (0, index_js_6.getPersonaByPath)(index_js_6.ORGANIZATION_AUDIT_PERSONA_PATH)) === null || _b === void 0 ? void 0 : _b.id).toBe('organization-audit');
|
|
34
|
+
(0, vitest_1.expect)((_c = (0, index_js_6.getPersonaByPath)(index_js_6.CONTENT_READER_PERSONA_PATH)) === null || _c === void 0 ? void 0 : _c.id).toBe('content-reader');
|
|
35
|
+
(0, vitest_1.expect)((_d = (0, index_js_6.getPersonaByPath)(index_js_6.CONTENT_DEVELOPER_PERSONA_PATH)) === null || _d === void 0 ? void 0 : _d.id).toBe('content-developer');
|
|
36
|
+
(0, vitest_1.expect)((_e = (0, index_js_6.getPersonaByPath)(index_js_6.CONTENT_GOVERNANCE_PERSONA_PATH)) === null || _e === void 0 ? void 0 : _e.id).toBe('content-governance');
|
|
37
|
+
(0, vitest_1.expect)((_f = (0, index_js_6.getPersonaByPath)(index_js_6.AI_AGENT_OPS_PERSONA_PATH)) === null || _f === void 0 ? void 0 : _f.id).toBe('ai-agent-ops');
|
|
38
|
+
(0, vitest_1.expect)((0, index_js_6.getPersonaByPath)('/mcp')).toBeUndefined();
|
|
17
39
|
});
|
|
18
40
|
(0, vitest_1.it)('normalizes trailing slashes when resolving path', () => {
|
|
19
|
-
var _a, _b;
|
|
20
|
-
(0, vitest_1.expect)((_a = (0,
|
|
21
|
-
(0, vitest_1.expect)((_b = (0,
|
|
41
|
+
var _a, _b, _c, _d, _e, _f;
|
|
42
|
+
(0, vitest_1.expect)((_a = (0, index_js_6.getPersonaByPath)(`${index_js_6.SEMANTIC_LAYER_PERSONA_PATH}/`)) === null || _a === void 0 ? void 0 : _a.id).toBe('semantic-layer');
|
|
43
|
+
(0, vitest_1.expect)((_b = (0, index_js_6.getPersonaByPath)(`${index_js_6.ORGANIZATION_AUDIT_PERSONA_PATH}/`)) === null || _b === void 0 ? void 0 : _b.id).toBe('organization-audit');
|
|
44
|
+
(0, vitest_1.expect)((_c = (0, index_js_6.getPersonaByPath)(`${index_js_6.CONTENT_READER_PERSONA_PATH}/`)) === null || _c === void 0 ? void 0 : _c.id).toBe('content-reader');
|
|
45
|
+
(0, vitest_1.expect)((_d = (0, index_js_6.getPersonaByPath)(`${index_js_6.CONTENT_DEVELOPER_PERSONA_PATH}/`)) === null || _d === void 0 ? void 0 : _d.id).toBe('content-developer');
|
|
46
|
+
(0, vitest_1.expect)((_e = (0, index_js_6.getPersonaByPath)(`${index_js_6.CONTENT_GOVERNANCE_PERSONA_PATH}/`)) === null || _e === void 0 ? void 0 : _e.id).toBe('content-governance');
|
|
47
|
+
(0, vitest_1.expect)((_f = (0, index_js_6.getPersonaByPath)(`${index_js_6.AI_AGENT_OPS_PERSONA_PATH}/`)) === null || _f === void 0 ? void 0 : _f.id).toBe('ai-agent-ops');
|
|
22
48
|
});
|
|
23
49
|
(0, vitest_1.it)('semantic-layer allowlists exactly nine tools', () => {
|
|
24
|
-
const persona = (0,
|
|
50
|
+
const persona = (0, index_js_6.getPersona)('semantic-layer');
|
|
25
51
|
(0, vitest_1.expect)(persona.toolIds).toHaveLength(9);
|
|
26
|
-
(0, vitest_1.expect)((0,
|
|
52
|
+
(0, vitest_1.expect)((0, index_js_6.getDefaultPersona)().toolIds).toEqual(persona.toolIds);
|
|
27
53
|
});
|
|
28
54
|
(0, vitest_1.it)('organization-audit allowlists 18 tools and short server name', () => {
|
|
29
|
-
const persona = (0,
|
|
55
|
+
const persona = (0, index_js_6.getPersona)('organization-audit');
|
|
30
56
|
(0, vitest_1.expect)(persona.toolIds).toHaveLength(18);
|
|
31
|
-
(0, vitest_1.expect)(persona.toolIds).toEqual([...
|
|
32
|
-
(0, vitest_1.expect)((0,
|
|
57
|
+
(0, vitest_1.expect)(persona.toolIds).toEqual([...index_js_5.ORGANIZATION_AUDIT_TOOL_IDS]);
|
|
58
|
+
(0, vitest_1.expect)((0, index_js_6.getPersonaServerName)(persona)).toBe('lightdash-mcp-org-audit');
|
|
59
|
+
});
|
|
60
|
+
(0, vitest_1.it)('content-reader allowlists 14 tools and server name', () => {
|
|
61
|
+
const persona = (0, index_js_6.getPersona)('content-reader');
|
|
62
|
+
(0, vitest_1.expect)(persona.toolIds).toHaveLength(14);
|
|
63
|
+
(0, vitest_1.expect)(persona.toolIds).toEqual([...index_js_4.CONTENT_READER_TOOL_IDS]);
|
|
64
|
+
(0, vitest_1.expect)(persona.toolIds).toContain('export_chart_image');
|
|
65
|
+
(0, vitest_1.expect)((0, index_js_6.getPersonaServerName)(persona)).toBe('lightdash-mcp-content');
|
|
66
|
+
});
|
|
67
|
+
(0, vitest_1.it)('content-developer allowlists tools and short server name', () => {
|
|
68
|
+
const persona = (0, index_js_6.getPersona)('content-developer');
|
|
69
|
+
(0, vitest_1.expect)(persona.toolIds).toEqual([...index_js_2.CONTENT_DEVELOPER_TOOL_IDS]);
|
|
70
|
+
(0, vitest_1.expect)(persona.toolIds).toContain('get_chart_as_code');
|
|
71
|
+
(0, vitest_1.expect)(persona.toolIds).not.toContain('create_space');
|
|
72
|
+
(0, vitest_1.expect)(persona.toolIds).not.toContain('update_space');
|
|
73
|
+
(0, vitest_1.expect)((0, index_js_6.getPersonaServerName)(persona)).toBe('lightdash-mcp-cdev');
|
|
74
|
+
});
|
|
75
|
+
(0, vitest_1.it)('content-governance allowlists soft-delete + promote tools and short server name', () => {
|
|
76
|
+
const persona = (0, index_js_6.getPersona)('content-governance');
|
|
77
|
+
(0, vitest_1.expect)(persona.toolIds).toHaveLength(4);
|
|
78
|
+
(0, vitest_1.expect)(persona.toolIds).toEqual([...index_js_3.CONTENT_GOVERNANCE_TOOL_IDS]);
|
|
79
|
+
(0, vitest_1.expect)(persona.toolIds).toEqual([
|
|
80
|
+
'delete_chart',
|
|
81
|
+
'delete_dashboard',
|
|
82
|
+
'get_dashboard_promote_diff',
|
|
83
|
+
'promote_dashboard',
|
|
84
|
+
]);
|
|
85
|
+
(0, vitest_1.expect)((0, index_js_6.getPersonaServerName)(persona)).toBe('lightdash-mcp-gov');
|
|
86
|
+
});
|
|
87
|
+
(0, vitest_1.it)('ai-agent-ops allowlists 17 thin API tools and short server name', () => {
|
|
88
|
+
const persona = (0, index_js_6.getPersona)('ai-agent-ops');
|
|
89
|
+
(0, vitest_1.expect)(persona.toolIds).toHaveLength(17);
|
|
90
|
+
(0, vitest_1.expect)(persona.toolIds).toEqual([...index_js_1.AI_AGENT_OPS_TOOL_IDS]);
|
|
91
|
+
(0, vitest_1.expect)(persona.toolIds).not.toContain('create_project_agent');
|
|
92
|
+
(0, vitest_1.expect)(persona.toolIds).not.toContain('generate_agent_message');
|
|
93
|
+
(0, vitest_1.expect)((0, index_js_6.getPersonaServerName)(persona)).toBe('lightdash-mcp-aops');
|
|
33
94
|
});
|
|
34
95
|
(0, vitest_1.it)('keeps combined server+tool wire names under 60 characters', () => {
|
|
35
|
-
const persona
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
96
|
+
for (const persona of Object.values(index_js_6.PERSONAS)) {
|
|
97
|
+
const serverName = (0, index_js_6.getPersonaServerName)(persona);
|
|
98
|
+
for (const id of persona.toolIds) {
|
|
99
|
+
const combined = serverName.length + (shared_js_1.TOOL_PREFIX + id).length;
|
|
100
|
+
(0, vitest_1.expect)(combined, `${serverName}+${shared_js_1.TOOL_PREFIX}${id}`).toBeLessThanOrEqual(60);
|
|
101
|
+
}
|
|
40
102
|
}
|
|
41
103
|
});
|
|
42
104
|
(0, vitest_1.it)('parsePersonaId validates known ids only', () => {
|
|
43
|
-
(0, vitest_1.expect)((0,
|
|
44
|
-
(0, vitest_1.expect)((0,
|
|
45
|
-
(0, vitest_1.expect)((0,
|
|
105
|
+
(0, vitest_1.expect)((0, index_js_6.parsePersonaId)('semantic-layer')).toBe('semantic-layer');
|
|
106
|
+
(0, vitest_1.expect)((0, index_js_6.parsePersonaId)('organization-audit')).toBe('organization-audit');
|
|
107
|
+
(0, vitest_1.expect)((0, index_js_6.parsePersonaId)('content-reader')).toBe('content-reader');
|
|
108
|
+
(0, vitest_1.expect)((0, index_js_6.parsePersonaId)('content-developer')).toBe('content-developer');
|
|
109
|
+
(0, vitest_1.expect)((0, index_js_6.parsePersonaId)('content-governance')).toBe('content-governance');
|
|
110
|
+
(0, vitest_1.expect)((0, index_js_6.parsePersonaId)('ai-agent-ops')).toBe('ai-agent-ops');
|
|
111
|
+
(0, vitest_1.expect)((0, index_js_6.parsePersonaId)('nope')).toBeUndefined();
|
|
46
112
|
});
|
|
47
113
|
(0, vitest_1.it)('registerToolsByIds registers only allowlisted ids', () => {
|
|
48
114
|
const registered = [];
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers for registering markdown playbook MCP resources and
|
|
3
|
+
* embedding core + topic playbooks into prompt messages.
|
|
4
|
+
*/
|
|
5
|
+
import type { McpServer } from '@modelcontextprotocol/server';
|
|
6
|
+
export declare const PLAYBOOK_MIME: "text/markdown";
|
|
7
|
+
export type PlaybookResourceSpec = {
|
|
8
|
+
/** MCP resource name (stable id for resources/list). */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Canonical URI, e.g. lightdash://playbooks/content-developer/core */
|
|
11
|
+
uri: string;
|
|
12
|
+
title: string;
|
|
13
|
+
description: string;
|
|
14
|
+
getMarkdown: () => string;
|
|
15
|
+
};
|
|
16
|
+
export type EmbeddedPlaybook = {
|
|
17
|
+
uri: string;
|
|
18
|
+
mimeType?: string;
|
|
19
|
+
getMarkdown: () => string;
|
|
20
|
+
};
|
|
21
|
+
declare function embedResource(playbook: EmbeddedPlaybook): {
|
|
22
|
+
type: "resource";
|
|
23
|
+
resource: {
|
|
24
|
+
uri: string;
|
|
25
|
+
mimeType: string;
|
|
26
|
+
text: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
type PromptUserMessage = {
|
|
30
|
+
role: 'user';
|
|
31
|
+
content: ReturnType<typeof embedResource> | {
|
|
32
|
+
type: 'text';
|
|
33
|
+
text: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Build prompt message helpers that embed core, and optionally one or more topic
|
|
38
|
+
* playbooks, after the user text message. When `topicId` is omitted, only core is
|
|
39
|
+
* embedded.
|
|
40
|
+
*/
|
|
41
|
+
export declare function createPromptPlaybookEmbedder<TopicId extends string>(options: {
|
|
42
|
+
core: EmbeddedPlaybook;
|
|
43
|
+
topics: Readonly<Record<TopicId, EmbeddedPlaybook>>;
|
|
44
|
+
}): (text: string, topicId?: TopicId | readonly TopicId[]) => {
|
|
45
|
+
messages: PromptUserMessage[];
|
|
46
|
+
};
|
|
47
|
+
export type PersonaPlaybookTopicDef<TopicId extends string = string> = {
|
|
48
|
+
id: TopicId;
|
|
49
|
+
title: string;
|
|
50
|
+
description: string;
|
|
51
|
+
/** Filename under `playbooks/`, e.g. `dashboards.md`. */
|
|
52
|
+
file: string;
|
|
53
|
+
};
|
|
54
|
+
export type DefinePersonaPlaybooksOptions<TopicId extends string> = {
|
|
55
|
+
personaId: string;
|
|
56
|
+
moduleDir: string;
|
|
57
|
+
hardBans: string;
|
|
58
|
+
topics: readonly PersonaPlaybookTopicDef<TopicId>[];
|
|
59
|
+
indexTitle?: string;
|
|
60
|
+
indexDescription?: string;
|
|
61
|
+
coreTitle?: string;
|
|
62
|
+
coreDescription?: string;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Factory for persona multi-playbook resources (index + core + topics).
|
|
66
|
+
* Callers re-export the returned fields under persona-specific names.
|
|
67
|
+
*/
|
|
68
|
+
export declare function definePersonaPlaybooks<TopicId extends string>(options: DefinePersonaPlaybooksOptions<TopicId>): {
|
|
69
|
+
URIs: {
|
|
70
|
+
index: string;
|
|
71
|
+
core: string;
|
|
72
|
+
topics: Readonly<Record<TopicId, string>>;
|
|
73
|
+
};
|
|
74
|
+
HARD_BANS: string;
|
|
75
|
+
getAllPlaybookMarkdown: () => string;
|
|
76
|
+
CORE_PLAYBOOK: EmbeddedPlaybook;
|
|
77
|
+
TOPIC_PLAYBOOKS: Readonly<Record<TopicId, EmbeddedPlaybook>>;
|
|
78
|
+
registerPlaybooks: (server: McpServer) => void;
|
|
79
|
+
};
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared helpers for registering markdown playbook MCP resources and
|
|
4
|
+
* embedding core + topic playbooks into prompt messages.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.PLAYBOOK_MIME = void 0;
|
|
8
|
+
exports.createPromptPlaybookEmbedder = createPromptPlaybookEmbedder;
|
|
9
|
+
exports.definePersonaPlaybooks = definePersonaPlaybooks;
|
|
10
|
+
const node_fs_1 = require("node:fs");
|
|
11
|
+
const node_path_1 = require("node:path");
|
|
12
|
+
exports.PLAYBOOK_MIME = 'text/markdown';
|
|
13
|
+
const markdownCache = new Map();
|
|
14
|
+
/**
|
|
15
|
+
* Load a playbook markdown file from a directory adjacent to the compiled module.
|
|
16
|
+
* `moduleDir` should be `__dirname` of the persona's `resources/` folder.
|
|
17
|
+
*/
|
|
18
|
+
function loadPlaybookMarkdown(moduleDir, relativePath) {
|
|
19
|
+
const key = `${moduleDir}::${relativePath}`;
|
|
20
|
+
const cached = markdownCache.get(key);
|
|
21
|
+
if (cached !== undefined) {
|
|
22
|
+
return cached;
|
|
23
|
+
}
|
|
24
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename -- moduleDir + relativePath from persona constants
|
|
25
|
+
const text = (0, node_fs_1.readFileSync)((0, node_path_1.join)(moduleDir, relativePath), 'utf8');
|
|
26
|
+
markdownCache.set(key, text);
|
|
27
|
+
return text;
|
|
28
|
+
}
|
|
29
|
+
function registerMarkdownPlaybooks(server, specs) {
|
|
30
|
+
for (const spec of specs) {
|
|
31
|
+
const markdown = spec.getMarkdown();
|
|
32
|
+
server.registerResource(spec.name, spec.uri, {
|
|
33
|
+
title: spec.title,
|
|
34
|
+
description: spec.description,
|
|
35
|
+
mimeType: exports.PLAYBOOK_MIME,
|
|
36
|
+
}, async (uri) => ({
|
|
37
|
+
contents: [
|
|
38
|
+
{
|
|
39
|
+
uri: typeof uri === 'string' ? uri : uri.href,
|
|
40
|
+
mimeType: exports.PLAYBOOK_MIME,
|
|
41
|
+
text: markdown,
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function embedResource(playbook) {
|
|
48
|
+
var _a;
|
|
49
|
+
return {
|
|
50
|
+
type: 'resource',
|
|
51
|
+
resource: {
|
|
52
|
+
uri: playbook.uri,
|
|
53
|
+
mimeType: (_a = playbook.mimeType) !== null && _a !== void 0 ? _a : exports.PLAYBOOK_MIME,
|
|
54
|
+
text: playbook.getMarkdown(),
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Build prompt message helpers that embed core, and optionally one or more topic
|
|
60
|
+
* playbooks, after the user text message. When `topicId` is omitted, only core is
|
|
61
|
+
* embedded.
|
|
62
|
+
*/
|
|
63
|
+
function createPromptPlaybookEmbedder(options) {
|
|
64
|
+
const { core, topics } = options;
|
|
65
|
+
return (text, topicId) => {
|
|
66
|
+
const messages = [
|
|
67
|
+
{
|
|
68
|
+
role: 'user',
|
|
69
|
+
content: { type: 'text', text },
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
role: 'user',
|
|
73
|
+
content: embedResource(core),
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
if (topicId === undefined) {
|
|
77
|
+
return { messages };
|
|
78
|
+
}
|
|
79
|
+
const topicIds = typeof topicId === 'string' ? [topicId] : topicId;
|
|
80
|
+
for (const id of topicIds) {
|
|
81
|
+
// eslint-disable-next-line security/detect-object-injection -- topic ids from persona prompt constants
|
|
82
|
+
const topic = topics[id];
|
|
83
|
+
if (!topic) {
|
|
84
|
+
throw new Error(`Unknown playbook topic '${id}'`);
|
|
85
|
+
}
|
|
86
|
+
messages.push({
|
|
87
|
+
role: 'user',
|
|
88
|
+
content: embedResource(topic),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return { messages };
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/** Title-case the first segment only: `content-developer` → `Content-developer`. */
|
|
95
|
+
function titleCasePersona(personaId) {
|
|
96
|
+
const [first = '', ...rest] = personaId.split('-');
|
|
97
|
+
if (first.length === 0) {
|
|
98
|
+
return personaId;
|
|
99
|
+
}
|
|
100
|
+
return [first[0].toUpperCase() + first.slice(1), ...rest].join('-');
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Factory for persona multi-playbook resources (index + core + topics).
|
|
104
|
+
* Callers re-export the returned fields under persona-specific names.
|
|
105
|
+
*/
|
|
106
|
+
function definePersonaPlaybooks(options) {
|
|
107
|
+
const { personaId, moduleDir, hardBans, topics, indexTitle = `${titleCasePersona(personaId)} playbooks`, indexDescription = `Index of ${personaId} workflow playbooks (core + topics)`, coreTitle = `${titleCasePersona(personaId)} core playbook`, coreDescription = 'Hard bans, tools, and operating rules', } = options;
|
|
108
|
+
const indexUri = `lightdash://playbooks/${personaId}`;
|
|
109
|
+
const coreUri = `lightdash://playbooks/${personaId}/core`;
|
|
110
|
+
const namePrefix = personaId.split('-').join('_');
|
|
111
|
+
const load = (relativePath) => loadPlaybookMarkdown(moduleDir, relativePath);
|
|
112
|
+
const getIndexPlaybookMarkdown = () => load('playbooks/index.md');
|
|
113
|
+
const getCorePlaybookMarkdown = () => load('playbooks/core.md');
|
|
114
|
+
const topicUris = {};
|
|
115
|
+
const topicPlaybooks = {};
|
|
116
|
+
const topicMarkdownGetters = [];
|
|
117
|
+
for (const topic of topics) {
|
|
118
|
+
const uri = `lightdash://playbooks/${personaId}/${topic.id}`;
|
|
119
|
+
topicUris[topic.id] = uri;
|
|
120
|
+
const getMarkdown = () => load(`playbooks/${topic.file}`);
|
|
121
|
+
topicMarkdownGetters.push(getMarkdown);
|
|
122
|
+
topicPlaybooks[topic.id] = {
|
|
123
|
+
uri,
|
|
124
|
+
getMarkdown,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
const CORE_PLAYBOOK = {
|
|
128
|
+
uri: coreUri,
|
|
129
|
+
getMarkdown: getCorePlaybookMarkdown,
|
|
130
|
+
};
|
|
131
|
+
const getAllPlaybookMarkdown = () => [
|
|
132
|
+
getIndexPlaybookMarkdown(),
|
|
133
|
+
getCorePlaybookMarkdown(),
|
|
134
|
+
...topicMarkdownGetters.map((g) => g()),
|
|
135
|
+
].join('\n');
|
|
136
|
+
const registerPlaybooks = (server) => {
|
|
137
|
+
registerMarkdownPlaybooks(server, [
|
|
138
|
+
{
|
|
139
|
+
name: `${namePrefix}_playbook_index`,
|
|
140
|
+
uri: indexUri,
|
|
141
|
+
title: indexTitle,
|
|
142
|
+
description: indexDescription,
|
|
143
|
+
getMarkdown: getIndexPlaybookMarkdown,
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: `${namePrefix}_playbook_core`,
|
|
147
|
+
uri: coreUri,
|
|
148
|
+
title: coreTitle,
|
|
149
|
+
description: coreDescription,
|
|
150
|
+
getMarkdown: getCorePlaybookMarkdown,
|
|
151
|
+
},
|
|
152
|
+
...topics.map((topic) => ({
|
|
153
|
+
name: `${namePrefix}_playbook_${String(topic.id).split('-').join('_')}`,
|
|
154
|
+
uri: topicUris[topic.id],
|
|
155
|
+
title: topic.title,
|
|
156
|
+
description: topic.description,
|
|
157
|
+
getMarkdown: topicPlaybooks[topic.id].getMarkdown,
|
|
158
|
+
})),
|
|
159
|
+
]);
|
|
160
|
+
};
|
|
161
|
+
return {
|
|
162
|
+
URIs: { index: indexUri, core: coreUri, topics: topicUris },
|
|
163
|
+
HARD_BANS: hardBans,
|
|
164
|
+
getAllPlaybookMarkdown,
|
|
165
|
+
CORE_PLAYBOOK,
|
|
166
|
+
TOPIC_PLAYBOOKS: topicPlaybooks,
|
|
167
|
+
registerPlaybooks,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.organizationAuditPersona = exports.ORGANIZATION_AUDIT_TOOL_IDS = exports.ORGANIZATION_AUDIT_PERSONA_PATH = void 0;
|
|
7
7
|
const prompts_js_1 = require("./prompts.js");
|
|
8
|
-
const
|
|
8
|
+
const playbooks_js_1 = require("./resources/playbooks.js");
|
|
9
9
|
exports.ORGANIZATION_AUDIT_PERSONA_PATH = '/organization-audit/v1/mcp';
|
|
10
10
|
/** Explicit allowlist — must stay a deliberate subset of the shared registry. */
|
|
11
11
|
exports.ORGANIZATION_AUDIT_TOOL_IDS = [
|
|
@@ -37,6 +37,6 @@ exports.organizationAuditPersona = {
|
|
|
37
37
|
(0, prompts_js_1.registerOrganizationAuditPrompts)(server);
|
|
38
38
|
},
|
|
39
39
|
registerResources: (server) => {
|
|
40
|
-
(0,
|
|
40
|
+
(0, playbooks_js_1.registerOrganizationAuditPlaybook)(server);
|
|
41
41
|
},
|
|
42
42
|
};
|
|
@@ -6,106 +6,119 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.registerOrganizationAuditPrompts = registerOrganizationAuditPrompts;
|
|
7
7
|
/* eslint-disable @typescript-eslint/no-deprecated -- matches semantic-layer prompt registration pattern */
|
|
8
8
|
const zod_1 = require("zod");
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
mimeType: playbook_js_1.ORGANIZATION_AUDIT_PLAYBOOK_MIME,
|
|
16
|
-
text: (0, playbook_js_1.getPlaybookMarkdown)(),
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function userMessages(text) {
|
|
21
|
-
return {
|
|
22
|
-
messages: [
|
|
23
|
-
{
|
|
24
|
-
role: 'user',
|
|
25
|
-
content: { type: 'text', text },
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
role: 'user',
|
|
29
|
-
content: playbookEmbeddedResource(),
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
};
|
|
33
|
-
}
|
|
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.ORGANIZATION_AUDIT_CORE_PLAYBOOK,
|
|
13
|
+
topics: playbooks_js_1.ORGANIZATION_AUDIT_TOPIC_PLAYBOOKS,
|
|
14
|
+
});
|
|
34
15
|
function registerOrganizationAuditPrompts(server) {
|
|
35
16
|
server.registerPrompt('audit_organization', {
|
|
36
17
|
title: 'Audit organization',
|
|
37
|
-
description: '
|
|
18
|
+
description: 'Bounded, evidence-backed read-only org audit via primitive lightdash_* tools (no audit_* mega-tools)',
|
|
38
19
|
argsSchema: {
|
|
39
|
-
projectUuids: zod_1.z
|
|
20
|
+
projectUuids: zod_1.z
|
|
21
|
+
.string()
|
|
22
|
+
.optional()
|
|
23
|
+
.describe('Comma-separated project UUIDs to deep-dive (default: up to 3 non-preview projects, or HTTP pin)'),
|
|
40
24
|
allowedEmailDomains: zod_1.z
|
|
41
25
|
.string()
|
|
42
26
|
.optional()
|
|
43
|
-
.describe('Comma-separated
|
|
27
|
+
.describe('Comma-separated internal email domains; convert to a string[] for tool args'),
|
|
44
28
|
},
|
|
45
|
-
}, ({ projectUuids, allowedEmailDomains }) => userMessages(`Perform
|
|
29
|
+
}, ({ projectUuids, allowedEmailDomains }) => userMessages(`Perform a bounded, evidence-backed, read-only audit of the current Lightdash organization.
|
|
46
30
|
|
|
47
|
-
${
|
|
31
|
+
${playbooks_js_1.ORGANIZATION_AUDIT_HARD_BANS}
|
|
48
32
|
|
|
49
|
-
Scope:
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
- Allowed email domains for delivery review: ${allowedEmailDomains !== null && allowedEmailDomains !== void 0 ? allowedEmailDomains : '(none — treat unknown domains carefully)'}.
|
|
33
|
+
Scope inputs:
|
|
34
|
+
- Optional project filter: ${projectUuids !== null && projectUuids !== void 0 ? projectUuids : '(none — sample ≤3 DEFAULT non-preview projects; honor X-Lightdash-Project pin if set)'}.
|
|
35
|
+
- Allowed email domains: ${allowedEmailDomains !== null && allowedEmailDomains !== void 0 ? allowedEmailDomains : '(none — convert to [] ; treat unknown domains carefully)'}.
|
|
36
|
+
- Split comma-separated args into arrays before calling tools.
|
|
54
37
|
|
|
55
38
|
Procedure (primitives only — there are no lightdash_audit_* tools):
|
|
56
|
-
1.
|
|
57
|
-
2.
|
|
58
|
-
3.
|
|
59
|
-
4.
|
|
60
|
-
5.
|
|
61
|
-
6.
|
|
39
|
+
1. Phase 0 (core): get_org_profile → list_org_projects → choose projects under budgets.
|
|
40
|
+
2. Access (access playbook): members/groups sample → per project: list_project_roles → list_project_direct_access → list_space_access → resolve_effective_access (bounded). Empty direct_access is normal with group/org grants.
|
|
41
|
+
3. Content (content playbook): per project list_content + list_validation_results + get_project_user_activity (summarize; do not dump weekly series).
|
|
42
|
+
4. Deliveries (deliveries playbook): list_project_schedulers; get_scheduler only as needed.
|
|
43
|
+
5. Phase 5 report: use the core finding template; cite tools + UUIDs; separate facts vs inferences; list budget/pagination/redaction gaps.
|
|
44
|
+
6. Never claim formal compliance certification or exhaustive inventory when pagination/budgets stopped early.`));
|
|
62
45
|
server.registerPrompt('review_access_governance', {
|
|
63
46
|
title: 'Review access governance',
|
|
64
|
-
description: 'Build
|
|
65
|
-
argsSchema: {
|
|
66
|
-
|
|
47
|
+
description: 'Build a bounded effective-access picture from identity + project/space primitives',
|
|
48
|
+
argsSchema: {
|
|
49
|
+
projectUuids: zod_1.z
|
|
50
|
+
.string()
|
|
51
|
+
.optional()
|
|
52
|
+
.describe('Comma-separated project UUIDs (default: ≤3 sampled projects)'),
|
|
53
|
+
allowedEmailDomains: zod_1.z
|
|
54
|
+
.string()
|
|
55
|
+
.optional()
|
|
56
|
+
.describe('Comma-separated domains → string[] for tools'),
|
|
57
|
+
},
|
|
58
|
+
}, ({ projectUuids, allowedEmailDomains }) => userMessages(`Review Lightdash identity and access governance with core budgets.
|
|
67
59
|
|
|
68
|
-
${
|
|
60
|
+
${playbooks_js_1.ORGANIZATION_AUDIT_HARD_BANS}
|
|
69
61
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
Projects: ${projectUuids !== null && projectUuids !== void 0 ? projectUuids : '(sample ≤3)'}.
|
|
63
|
+
Domains: ${allowedEmailDomains !== null && allowedEmailDomains !== void 0 ? allowedEmailDomains : '(none)'}.
|
|
64
|
+
|
|
65
|
+
Mandatory tool order per project: lightdash_list_project_roles → lightdash_list_project_direct_access → lightdash_list_space_access → lightdash_resolve_effective_access.
|
|
66
|
+
Also use lightdash_list_org_members, lightdash_list_org_groups, lightdash_list_org_role_assignments, lightdash_list_custom_roles as needed.
|
|
67
|
+
Empty direct_access ≠ no access. Truncation / INCOMPLETE_EFFECTIVE_ACCESS warnings must appear in the report.`, 'access'));
|
|
73
68
|
server.registerPrompt('review_content_governance', {
|
|
74
69
|
title: 'Review content governance',
|
|
75
|
-
description: 'Inventory content health
|
|
76
|
-
argsSchema: {
|
|
77
|
-
|
|
70
|
+
description: 'Inventory content health via list_content, validation, and user-activity evidence',
|
|
71
|
+
argsSchema: {
|
|
72
|
+
projectUuids: zod_1.z
|
|
73
|
+
.string()
|
|
74
|
+
.optional()
|
|
75
|
+
.describe('Comma-separated project UUIDs (required for useful inventory; else sample ≤3)'),
|
|
76
|
+
},
|
|
77
|
+
}, ({ projectUuids }) => userMessages(`Inventory charts, dashboards, and spaces; evaluate validation, ownership, and usage.
|
|
78
|
+
|
|
79
|
+
${playbooks_js_1.ORGANIZATION_AUDIT_HARD_BANS}
|
|
78
80
|
|
|
79
|
-
${
|
|
81
|
+
Projects: ${projectUuids !== null && projectUuids !== void 0 ? projectUuids : '(sample ≤3; always pass projectUuids into list_content)'}.
|
|
80
82
|
|
|
81
|
-
Use lightdash_list_content, lightdash_list_validation_results, and lightdash_get_project_user_activity (
|
|
82
|
-
Join
|
|
83
|
-
Do not recommend deletion solely because content is unused.`));
|
|
83
|
+
Use lightdash_list_content (sortBy views or last_updated_at), lightdash_list_validation_results, and lightdash_get_project_user_activity (summarize role counts + top views only). Optional lightdash_get_dashboard_meta.
|
|
84
|
+
Join in the conversation — no server-side audit crawler. Do not recommend deletion for low/zero views.`, 'content'));
|
|
84
85
|
server.registerPrompt('review_scheduled_deliveries', {
|
|
85
86
|
title: 'Review scheduled deliveries',
|
|
86
|
-
description: 'Inspect schedulers without executing them',
|
|
87
|
+
description: 'Inspect schedulers without executing or mutating them',
|
|
87
88
|
argsSchema: {
|
|
88
|
-
|
|
89
|
+
projectUuids: zod_1.z
|
|
90
|
+
.string()
|
|
91
|
+
.optional()
|
|
92
|
+
.describe('Comma-separated project UUIDs (default: ≤3 sampled)'),
|
|
93
|
+
allowedEmailDomains: zod_1.z.string().optional().describe('Comma-separated domains → string[]'),
|
|
89
94
|
},
|
|
90
|
-
}, ({ allowedEmailDomains }) => userMessages(`Inspect scheduled deliveries without creating, editing, executing, enabling, disabling, or deleting schedules.
|
|
95
|
+
}, ({ projectUuids, allowedEmailDomains }) => userMessages(`Inspect scheduled deliveries without creating, editing, executing, enabling, disabling, or deleting schedules.
|
|
96
|
+
|
|
97
|
+
${playbooks_js_1.ORGANIZATION_AUDIT_HARD_BANS}
|
|
91
98
|
|
|
92
|
-
${
|
|
99
|
+
Projects: ${projectUuids !== null && projectUuids !== void 0 ? projectUuids : '(sample ≤3)'}.
|
|
100
|
+
Allowed email domains: ${allowedEmailDomains !== null && allowedEmailDomains !== void 0 ? allowedEmailDomains : '(none)'}.
|
|
93
101
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
Redact destinations by default. External destinations are review signals, not automatic violations.`));
|
|
102
|
+
Use lightdash_list_project_schedulers (destinations redacted by default) and lightdash_get_scheduler when needed.
|
|
103
|
+
Report enabled and disabled schedules. External destinations (if revealed) are review signals, not automatic violations.`, 'deliveries'));
|
|
97
104
|
server.registerPrompt('investigate_audit_finding', {
|
|
98
105
|
title: 'Investigate audit finding',
|
|
99
|
-
description: 'Validate or refute one previously reported finding',
|
|
106
|
+
description: 'Validate or refute one previously reported finding with minimum extra metadata',
|
|
100
107
|
argsSchema: {
|
|
101
108
|
findingSummary: zod_1.z.string().describe('The finding claim to investigate'),
|
|
109
|
+
projectUuid: zod_1.z
|
|
110
|
+
.string()
|
|
111
|
+
.optional()
|
|
112
|
+
.describe('Project UUID when the finding is project-scoped'),
|
|
102
113
|
},
|
|
103
|
-
}, ({ findingSummary }) => userMessages(`Investigate this organization-audit finding with minimum additional metadata:
|
|
114
|
+
}, ({ findingSummary, projectUuid }) => userMessages(`Investigate this organization-audit finding with minimum additional metadata:
|
|
104
115
|
|
|
105
116
|
${findingSummary}
|
|
106
117
|
|
|
107
|
-
${
|
|
118
|
+
Project context: ${projectUuid !== null && projectUuid !== void 0 ? projectUuid : '(org-level or unspecified — ask only if needed)'}.
|
|
119
|
+
|
|
120
|
+
${playbooks_js_1.ORGANIZATION_AUDIT_HARD_BANS}
|
|
108
121
|
|
|
109
|
-
Use only primitive list/get tools. Report supporting evidence, contradictory evidence, remaining uncertainty, and whether severity/confidence changed.`));
|
|
122
|
+
Use only primitive list/get tools under core budgets. Report supporting evidence, contradictory evidence, remaining uncertainty, and whether severity/confidence changed. Prefer targeted get_* / single-project lists over org-wide crawls.`));
|
|
110
123
|
}
|
|
111
124
|
/* eslint-enable @typescript-eslint/no-deprecated */
|
|
@@ -4,20 +4,20 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const vitest_1 = require("vitest");
|
|
7
|
-
const
|
|
7
|
+
const playbooks_js_1 = require("./resources/playbooks.js");
|
|
8
8
|
const index_js_1 = require("./index.js");
|
|
9
9
|
(0, vitest_1.describe)('organization-audit prompts/playbook', () => {
|
|
10
10
|
(0, vitest_1.it)('playbook references only registered tool short ids', () => {
|
|
11
|
-
const md = (0,
|
|
11
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)();
|
|
12
12
|
for (const id of index_js_1.ORGANIZATION_AUDIT_TOOL_IDS) {
|
|
13
13
|
(0, vitest_1.expect)(md.includes(id) || md.includes(`lightdash_${id}`)).toBe(true);
|
|
14
14
|
}
|
|
15
15
|
(0, vitest_1.expect)(md).not.toMatch(/\bldt__/);
|
|
16
16
|
(0, vitest_1.expect)(md.toLowerCase()).toContain('hard bans');
|
|
17
|
-
(0, vitest_1.expect)(
|
|
17
|
+
(0, vitest_1.expect)(playbooks_js_1.ORGANIZATION_AUDIT_HARD_BANS.toLowerCase()).toContain('compliance');
|
|
18
18
|
});
|
|
19
19
|
(0, vitest_1.it)('playbook forbids mutation and warehouse queries', () => {
|
|
20
|
-
const md = (0,
|
|
20
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
|
|
21
21
|
(0, vitest_1.expect)(md).toContain('do not mutate');
|
|
22
22
|
(0, vitest_1.expect)(md).toContain('warehouse');
|
|
23
23
|
(0, vitest_1.expect)(md).toContain('deletion');
|