@lightdash-tools/mcp 0.20.0 → 0.21.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 +5 -5
- package/dist/auth/request-state-key.d.ts +2 -2
- package/dist/auth/request-state-key.js +2 -2
- package/dist/config/enabled-profiles.d.ts +1 -1
- package/dist/config/enabled-profiles.js +3 -2
- package/dist/config/enabled-profiles.test.js +1 -0
- package/dist/policy/create-agent-preview.d.ts +65 -0
- package/dist/policy/create-agent-preview.js +126 -0
- package/dist/policy/create-agent-preview.test.d.ts +4 -0
- package/dist/policy/create-agent-preview.test.js +162 -0
- package/dist/profiles/ai-agent-ops/v1/index.js +10 -0
- package/dist/profiles/ai-agent-ops/v1/invariants.d.ts +6 -3
- package/dist/profiles/ai-agent-ops/v1/invariants.js +6 -2
- package/dist/profiles/ai-agent-ops/v1/prompts.js +24 -3
- package/dist/profiles/ai-agent-ops/v1/prompts.test.js +10 -1
- package/dist/profiles/ai-agent-ops/v1/resources/playbooks/core.md +34 -2
- package/dist/profiles/ai-agent-ops/v1/resources/playbooks/loop-engineering.md +9 -4
- package/dist/profiles/index.test.js +7 -2
- package/dist/server/server.js +16 -4
- package/dist/tools/ai-agents/agents.d.ts +8 -0
- package/dist/tools/ai-agents/agents.js +283 -1
- package/dist/tools/ai-agents/agents.test.js +25 -0
- package/dist/tools/ai-agents/create-elicitation.d.ts +52 -0
- package/dist/tools/ai-agents/create-elicitation.js +206 -0
- package/dist/tools/ai-agents/create-elicitation.test.d.ts +4 -0
- package/dist/tools/ai-agents/create-elicitation.test.js +363 -0
- package/dist/tools/ai-agents/create-request-state.d.ts +18 -0
- package/dist/tools/ai-agents/create-request-state.js +43 -0
- package/dist/tools/ai-agents/documents.d.ts +15 -0
- package/dist/tools/ai-agents/documents.js +212 -0
- package/dist/tools/ai-agents/documents.test.d.ts +1 -0
- package/dist/tools/ai-agents/documents.test.js +129 -0
- package/dist/tools/ai-agents/gate-create-project-agent.d.ts +28 -0
- package/dist/tools/ai-agents/gate-create-project-agent.js +71 -0
- package/dist/tools/ai-agents/helpers.d.ts +11 -0
- package/dist/tools/ai-agents/helpers.js +29 -1
- package/dist/tools/ai-agents/knowledge-warnings.d.ts +11 -0
- package/dist/tools/ai-agents/knowledge-warnings.js +21 -0
- package/dist/tools/ai-agents/space-warnings.d.ts +36 -0
- package/dist/tools/ai-agents/space-warnings.js +101 -0
- package/dist/tools/ai-agents/space-warnings.test.d.ts +1 -0
- package/dist/tools/ai-agents/space-warnings.test.js +78 -0
- package/dist/tools/ai-agents/tag-warnings.d.ts +31 -0
- package/dist/tools/ai-agents/tag-warnings.js +70 -0
- package/dist/tools/ai-agents/test-support.d.ts +4 -1
- package/dist/tools/ai-agents/test-support.js +7 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -117,9 +117,9 @@ On those Hosts, leave the client Resource URL empty. Do not point `@modelcontext
|
|
|
117
117
|
|
|
118
118
|
### Content-developer / content-governance signing
|
|
119
119
|
|
|
120
|
-
| Required (non-test) | Notes
|
|
121
|
-
| :-------------------------------------- |
|
|
122
|
-
| `LIGHTDASH_TOOLS_MCP_REQUEST_STATE_KEY` | ≥32-byte secret for HMAC `previewToken` / `requestState` (fail closed if unset; not encryption). Required
|
|
120
|
+
| Required (non-test) | Notes |
|
|
121
|
+
| :-------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
122
|
+
| `LIGHTDASH_TOOLS_MCP_REQUEST_STATE_KEY` | ≥32-byte secret for HMAC `previewToken` / `requestState` (fail closed if unset; not encryption). Required when `content-developer`, `content-governance`, or `ai-agent-ops` is mounted (including unrestricted HTTP). |
|
|
123
123
|
|
|
124
124
|
Governance soft-delete needs client form elicitation; missing capability → `ELICITATION_REQUIRED`.
|
|
125
125
|
|
|
@@ -220,7 +220,7 @@ Soft-delete charts/dashboards and elicitation-gated dashboard promote. Permanent
|
|
|
220
220
|
|
|
221
221
|
### `ai-agent-ops`
|
|
222
222
|
|
|
223
|
-
Thin AI-agent inventory, readiness, thread reads, and product evaluation suite/run APIs.
|
|
223
|
+
Thin AI-agent inventory, **create/update**, **knowledge documents**, readiness, thread reads, and product evaluation suite/run APIs. Agent delete and thread generate stay off MCP. **`create_project_agent`** uses secure-by-default permissions and dual-gate confirmation: MCP form elicitation when supported, otherwise `preview_create_agent` → `confirm_create_agent` → create with `createConfirmToken` (ADR-0034). Knowledge documents: `create_agent_document` and related tools (ADR-0035). Server name: `lightdash-mcp-aops`. Loop engineering: [docs/profiles/ai-agent-ops/loop.md](../../docs/profiles/ai-agent-ops/loop.md).
|
|
224
224
|
|
|
225
225
|
### `ai-agent-chat`
|
|
226
226
|
|
|
@@ -233,7 +233,7 @@ Unsaved Explore-style metric queries (`run_metric_query`) with explore discovery
|
|
|
233
233
|
## Safety
|
|
234
234
|
|
|
235
235
|
- **Off MCP:** irrecoverable admin deletes, permanent content purge, broad org mutations — use `@lightdash-tools/client` or the CLI ([ADR-0004](../../docs/adr/0004-agent-safe-exposure-mcp-cli-vs-client-only.md)).
|
|
236
|
-
- **Writes:** `content-developer` (preview gate). Soft-delete / promote: `content-governance` (form elicitation). `ai-agent-chat` creates threads/messages and triggers open-world managed-agent generation (nested agent tools stay Lightdash-governed).
|
|
236
|
+
- **Writes:** `content-developer` (preview gate). Soft-delete / promote: `content-governance` (form elicitation). `ai-agent-ops` creates/updates project agents (`WRITE_NONDESTRUCTIVE`). `ai-agent-chat` creates threads/messages and triggers open-world managed-agent generation (nested agent tools stay Lightdash-governed).
|
|
237
237
|
- **Redaction:** emails masked unless `includeEmail=true`; scheduler destinations redacted unless `revealDestinations=true`; warehouse/dbt connection secrets never on MCP ([ADR-0011](../../docs/adr/0011-mcp-tool-response-sensitivity-classes.md)).
|
|
238
238
|
- **Project scope:** optional HTTP pin `X-Lightdash-Project`, else tool `projectUuid`; optional ceiling [`LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS`](#project-allowlist).
|
|
239
239
|
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import { ENV_LIGHTDASH_TOOLS_MCP_REQUEST_STATE_KEY } from '../config/env.js';
|
|
6
6
|
export declare const PREVIEW_TOKEN_KEY_PURPOSE = "content-developer preview tokens are enabled";
|
|
7
7
|
export declare const DESTRUCTIVE_REQUEST_STATE_KEY_PURPOSE = "content-governance destructive tools are enabled";
|
|
8
|
-
/** Preview + destructive elicitation share one signing key when
|
|
9
|
-
export declare const HTTP_SIGNED_STATE_KEY_PURPOSE = "HTTP MCP exposes content-developer preview tokens
|
|
8
|
+
/** Preview + destructive + create-agent elicitation share one signing key when those profiles are mounted. */
|
|
9
|
+
export declare const HTTP_SIGNED_STATE_KEY_PURPOSE = "HTTP MCP exposes content-developer preview tokens, content-governance destructive tools, and/or ai-agent-ops create confirmation";
|
|
10
10
|
/** Resolve the HMAC signing key (configured env or test fallback). */
|
|
11
11
|
export declare function resolveRequestStateKey(purpose: string): string;
|
|
12
12
|
/**
|
|
@@ -13,8 +13,8 @@ Object.defineProperty(exports, "ENV_LIGHTDASH_TOOLS_MCP_REQUEST_STATE_KEY", { en
|
|
|
13
13
|
const TEST_FALLBACK_KEY = 'lightdash-tools-dev-request-state-key!!';
|
|
14
14
|
exports.PREVIEW_TOKEN_KEY_PURPOSE = 'content-developer preview tokens are enabled';
|
|
15
15
|
exports.DESTRUCTIVE_REQUEST_STATE_KEY_PURPOSE = 'content-governance destructive tools are enabled';
|
|
16
|
-
/** Preview + destructive elicitation share one signing key when
|
|
17
|
-
exports.HTTP_SIGNED_STATE_KEY_PURPOSE = 'HTTP MCP exposes content-developer preview tokens
|
|
16
|
+
/** Preview + destructive + create-agent elicitation share one signing key when those profiles are mounted. */
|
|
17
|
+
exports.HTTP_SIGNED_STATE_KEY_PURPOSE = 'HTTP MCP exposes content-developer preview tokens, content-governance destructive tools, and/or ai-agent-ops create confirmation';
|
|
18
18
|
function isTestRuntime() {
|
|
19
19
|
return process.env.VITEST === 'true' || process.env.NODE_ENV === 'test';
|
|
20
20
|
}
|
|
@@ -15,7 +15,7 @@ export type EnabledProfilesPolicy = {
|
|
|
15
15
|
export declare const UNRESTRICTED_ENABLED_PROFILES: EnabledProfilesPolicy;
|
|
16
16
|
export declare function parseEnabledProfiles(raw: string | undefined): EnabledProfilesPolicy;
|
|
17
17
|
export declare function isProfileEnabled(policy: EnabledProfilesPolicy, id: ProfileId): boolean;
|
|
18
|
-
/** Preview/destructive HMAC key is required when
|
|
18
|
+
/** Preview/destructive/create-agent HMAC key is required when those profiles are mounted. */
|
|
19
19
|
export declare function requiresSignedStateKey(policy: EnabledProfilesPolicy): boolean;
|
|
20
20
|
/** Enabled HTTP mount paths in `PROFILE_IDS` order. */
|
|
21
21
|
export declare function listEnabledProfilePaths(policy: EnabledProfilesPolicy): string[];
|
|
@@ -38,11 +38,12 @@ function parseEnabledProfiles(raw) {
|
|
|
38
38
|
function isProfileEnabled(policy, id) {
|
|
39
39
|
return !policy.restricted || policy.ids.has(id);
|
|
40
40
|
}
|
|
41
|
-
/** Preview/destructive HMAC key is required when
|
|
41
|
+
/** Preview/destructive/create-agent HMAC key is required when those profiles are mounted. */
|
|
42
42
|
function requiresSignedStateKey(policy) {
|
|
43
43
|
return (!policy.restricted ||
|
|
44
44
|
policy.ids.has('content-developer') ||
|
|
45
|
-
policy.ids.has('content-governance')
|
|
45
|
+
policy.ids.has('content-governance') ||
|
|
46
|
+
policy.ids.has('ai-agent-ops'));
|
|
46
47
|
}
|
|
47
48
|
/** Enabled HTTP mount paths in `PROFILE_IDS` order. */
|
|
48
49
|
function listEnabledProfilePaths(policy) {
|
|
@@ -45,6 +45,7 @@ const env_js_1 = require("./env.js");
|
|
|
45
45
|
(0, vitest_1.expect)((0, enabled_profiles_js_1.requiresSignedStateKey)((0, enabled_profiles_js_1.parseEnabledProfiles)('content-governance'))).toBe(true);
|
|
46
46
|
(0, vitest_1.expect)((0, enabled_profiles_js_1.requiresSignedStateKey)((0, enabled_profiles_js_1.parseEnabledProfiles)('content-reader,content-developer'))).toBe(true);
|
|
47
47
|
(0, vitest_1.expect)((0, enabled_profiles_js_1.requiresSignedStateKey)((0, enabled_profiles_js_1.parseEnabledProfiles)('ai-agent-chat'))).toBe(false);
|
|
48
|
+
(0, vitest_1.expect)((0, enabled_profiles_js_1.requiresSignedStateKey)((0, enabled_profiles_js_1.parseEnabledProfiles)('ai-agent-ops'))).toBe(true);
|
|
48
49
|
});
|
|
49
50
|
(0, vitest_1.it)('uses semantic-layer mcpPath when unrestricted or when that id is listed', () => {
|
|
50
51
|
(0, vitest_1.expect)((0, enabled_profiles_js_1.resolveRootMcpPath)(enabled_profiles_js_1.UNRESTRICTED_ENABLED_PROFILES)).toBe(index_js_1.SEMANTIC_LAYER_PROFILE_PATH);
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HMAC-signed preview tokens for create_project_agent (ADR-0034 / ADR-0019).
|
|
3
|
+
*
|
|
4
|
+
* Client-carried draft → confirm → apply when the host lacks MCP form elicitation.
|
|
5
|
+
*/
|
|
6
|
+
import type { RequestStateCodec, ServerContext } from '@modelcontextprotocol/server';
|
|
7
|
+
export declare const CREATE_AGENT_PREVIEW_KEY_PURPOSE = "ai-agent-ops create preview tokens are enabled";
|
|
8
|
+
export type CreateAgentPreviewStatus = 'draft' | 'validated';
|
|
9
|
+
/** Claims embedded in createPreviewToken / createConfirmToken (no full payload body). */
|
|
10
|
+
export type CreateAgentPreviewClaims = {
|
|
11
|
+
previewId: string;
|
|
12
|
+
subject: string;
|
|
13
|
+
projectUuid: string;
|
|
14
|
+
agentName: string;
|
|
15
|
+
payloadDigest: string;
|
|
16
|
+
status: CreateAgentPreviewStatus;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
expiresAt: string;
|
|
19
|
+
};
|
|
20
|
+
export declare class CreateAgentPreviewError extends Error {
|
|
21
|
+
readonly code: 'CREATE_PREVIEW_NOT_OWNED' | 'CREATE_PREVIEW_NOT_VALIDATED' | 'CREATE_PREVIEW_REQUIRED' | 'CREATE_PREVIEW_STALE';
|
|
22
|
+
constructor(code: CreateAgentPreviewError['code'], message: string);
|
|
23
|
+
}
|
|
24
|
+
/** Default preview lifetime; short enough to discourage stale multi-step drift. */
|
|
25
|
+
export declare const DEFAULT_CREATE_AGENT_PREVIEW_TTL_MS: number;
|
|
26
|
+
/** Minimal ServerContext for unit tests that mint/verify without a live MCP request. */
|
|
27
|
+
export declare const EMPTY_CREATE_AGENT_SERVER_CONTEXT: ServerContext;
|
|
28
|
+
declare function getCreateAgentPreviewCodec(): RequestStateCodec<CreateAgentPreviewClaims>;
|
|
29
|
+
/** Reset codec (tests only). */
|
|
30
|
+
export declare function resetCreateAgentPreviewCodecForTests(): void;
|
|
31
|
+
export { getCreateAgentPreviewCodec };
|
|
32
|
+
/** Mint a draft createPreviewToken. Does not store payload on the server. */
|
|
33
|
+
export declare function mintDraftCreateAgentPreviewToken(input: {
|
|
34
|
+
subject: string;
|
|
35
|
+
projectUuid: string;
|
|
36
|
+
agentName: string;
|
|
37
|
+
payloadDigest: string;
|
|
38
|
+
serverContext?: ServerContext;
|
|
39
|
+
}): Promise<{
|
|
40
|
+
createPreviewToken: string;
|
|
41
|
+
claims: CreateAgentPreviewClaims;
|
|
42
|
+
}>;
|
|
43
|
+
/** Confirm a draft token: verify bindings and mint a validated createConfirmToken (no write). */
|
|
44
|
+
export declare function confirmCreateAgentPreviewToken(input: {
|
|
45
|
+
createPreviewToken: string;
|
|
46
|
+
subject: string;
|
|
47
|
+
projectUuid: string;
|
|
48
|
+
agentName: string;
|
|
49
|
+
serverContext?: ServerContext;
|
|
50
|
+
}): Promise<{
|
|
51
|
+
createConfirmToken: string;
|
|
52
|
+
claims: CreateAgentPreviewClaims;
|
|
53
|
+
}>;
|
|
54
|
+
export type ApplyCreateAgentPreviewInput = {
|
|
55
|
+
createConfirmToken: string;
|
|
56
|
+
subject: string;
|
|
57
|
+
projectUuid: string;
|
|
58
|
+
agentName: string;
|
|
59
|
+
payloadDigest: string;
|
|
60
|
+
serverContext?: ServerContext;
|
|
61
|
+
};
|
|
62
|
+
/** Verify validated token before create (no upstream write). */
|
|
63
|
+
export declare function verifyValidatedCreateConfirmToken(input: ApplyCreateAgentPreviewInput): Promise<CreateAgentPreviewClaims>;
|
|
64
|
+
/** Verify validated token then run create mutation (ADR-0019: no server-side claim store). */
|
|
65
|
+
export declare function withValidatedCreateAgentApply<T>(input: ApplyCreateAgentPreviewInput, fn: (claims: CreateAgentPreviewClaims) => Promise<T>): Promise<T>;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* HMAC-signed preview tokens for create_project_agent (ADR-0034 / ADR-0019).
|
|
4
|
+
*
|
|
5
|
+
* Client-carried draft → confirm → apply when the host lacks MCP form elicitation.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.EMPTY_CREATE_AGENT_SERVER_CONTEXT = exports.DEFAULT_CREATE_AGENT_PREVIEW_TTL_MS = exports.CreateAgentPreviewError = exports.CREATE_AGENT_PREVIEW_KEY_PURPOSE = void 0;
|
|
9
|
+
exports.resetCreateAgentPreviewCodecForTests = resetCreateAgentPreviewCodecForTests;
|
|
10
|
+
exports.getCreateAgentPreviewCodec = getCreateAgentPreviewCodec;
|
|
11
|
+
exports.mintDraftCreateAgentPreviewToken = mintDraftCreateAgentPreviewToken;
|
|
12
|
+
exports.confirmCreateAgentPreviewToken = confirmCreateAgentPreviewToken;
|
|
13
|
+
exports.verifyValidatedCreateConfirmToken = verifyValidatedCreateConfirmToken;
|
|
14
|
+
exports.withValidatedCreateAgentApply = withValidatedCreateAgentApply;
|
|
15
|
+
const node_crypto_1 = require("node:crypto");
|
|
16
|
+
const server_1 = require("@modelcontextprotocol/server");
|
|
17
|
+
const request_state_key_js_1 = require("../auth/request-state-key.js");
|
|
18
|
+
exports.CREATE_AGENT_PREVIEW_KEY_PURPOSE = 'ai-agent-ops create preview tokens are enabled';
|
|
19
|
+
class CreateAgentPreviewError extends Error {
|
|
20
|
+
constructor(code, message) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = 'CreateAgentPreviewError';
|
|
23
|
+
this.code = code;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.CreateAgentPreviewError = CreateAgentPreviewError;
|
|
27
|
+
/** Default preview lifetime; short enough to discourage stale multi-step drift. */
|
|
28
|
+
exports.DEFAULT_CREATE_AGENT_PREVIEW_TTL_MS = 10 * 60000;
|
|
29
|
+
const TTL_SECONDS = exports.DEFAULT_CREATE_AGENT_PREVIEW_TTL_MS / 1000;
|
|
30
|
+
/** Minimal ServerContext for unit tests that mint/verify without a live MCP request. */
|
|
31
|
+
exports.EMPTY_CREATE_AGENT_SERVER_CONTEXT = { mcpReq: {} };
|
|
32
|
+
let codec;
|
|
33
|
+
function getCreateAgentPreviewCodec() {
|
|
34
|
+
if (!codec) {
|
|
35
|
+
codec = (0, server_1.createRequestStateCodec)({
|
|
36
|
+
key: (0, request_state_key_js_1.resolveRequestStateKey)(exports.CREATE_AGENT_PREVIEW_KEY_PURPOSE),
|
|
37
|
+
ttlSeconds: TTL_SECONDS,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return codec;
|
|
41
|
+
}
|
|
42
|
+
/** Reset codec (tests only). */
|
|
43
|
+
function resetCreateAgentPreviewCodecForTests() {
|
|
44
|
+
codec = undefined;
|
|
45
|
+
}
|
|
46
|
+
function resolveServerContext(serverContext) {
|
|
47
|
+
return serverContext !== null && serverContext !== void 0 ? serverContext : exports.EMPTY_CREATE_AGENT_SERVER_CONTEXT;
|
|
48
|
+
}
|
|
49
|
+
async function mintClaims(claims, serverContext) {
|
|
50
|
+
return getCreateAgentPreviewCodec().mint(claims, resolveServerContext(serverContext));
|
|
51
|
+
}
|
|
52
|
+
async function verifyClaims(token, serverContext) {
|
|
53
|
+
if (token.length === 0) {
|
|
54
|
+
throw new CreateAgentPreviewError('CREATE_PREVIEW_REQUIRED', 'createPreviewToken is required; call preview_create_agent first');
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
const claims = await getCreateAgentPreviewCodec().verify(token, resolveServerContext(serverContext));
|
|
58
|
+
if (Date.parse(claims.expiresAt) < Date.now()) {
|
|
59
|
+
throw new CreateAgentPreviewError('CREATE_PREVIEW_REQUIRED', 'createPreviewToken is invalid or expired; call preview_create_agent first');
|
|
60
|
+
}
|
|
61
|
+
return claims;
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
if (err instanceof CreateAgentPreviewError) {
|
|
65
|
+
throw err;
|
|
66
|
+
}
|
|
67
|
+
throw new CreateAgentPreviewError('CREATE_PREVIEW_REQUIRED', 'createPreviewToken is invalid or expired; call preview_create_agent first');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function assertSubjectAndProject(claims, subject, projectUuid) {
|
|
71
|
+
if (claims.subject !== subject || claims.projectUuid !== projectUuid) {
|
|
72
|
+
throw new CreateAgentPreviewError('CREATE_PREVIEW_NOT_OWNED', `Preview '${claims.previewId}' is not owned by this subject/project`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function assertAgentName(claims, agentName) {
|
|
76
|
+
if (claims.agentName !== agentName) {
|
|
77
|
+
throw new CreateAgentPreviewError('CREATE_PREVIEW_STALE', `Preview '${claims.previewId}' was created for agent name '${claims.agentName}', not '${agentName}'`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/** Mint a draft createPreviewToken. Does not store payload on the server. */
|
|
81
|
+
async function mintDraftCreateAgentPreviewToken(input) {
|
|
82
|
+
const now = Date.now();
|
|
83
|
+
const claims = {
|
|
84
|
+
previewId: (0, node_crypto_1.randomUUID)(),
|
|
85
|
+
subject: input.subject,
|
|
86
|
+
projectUuid: input.projectUuid,
|
|
87
|
+
agentName: input.agentName,
|
|
88
|
+
payloadDigest: input.payloadDigest,
|
|
89
|
+
status: 'draft',
|
|
90
|
+
createdAt: new Date(now).toISOString(),
|
|
91
|
+
expiresAt: new Date(now + exports.DEFAULT_CREATE_AGENT_PREVIEW_TTL_MS).toISOString(),
|
|
92
|
+
};
|
|
93
|
+
const createPreviewToken = await mintClaims(claims, input.serverContext);
|
|
94
|
+
return { createPreviewToken, claims };
|
|
95
|
+
}
|
|
96
|
+
/** Confirm a draft token: verify bindings and mint a validated createConfirmToken (no write). */
|
|
97
|
+
async function confirmCreateAgentPreviewToken(input) {
|
|
98
|
+
const claims = await verifyClaims(input.createPreviewToken, input.serverContext);
|
|
99
|
+
assertSubjectAndProject(claims, input.subject, input.projectUuid);
|
|
100
|
+
assertAgentName(claims, input.agentName);
|
|
101
|
+
if (claims.status !== 'draft') {
|
|
102
|
+
throw new CreateAgentPreviewError('CREATE_PREVIEW_NOT_VALIDATED', `Preview '${claims.previewId}' cannot be confirmed from status '${claims.status}'`);
|
|
103
|
+
}
|
|
104
|
+
const now = Date.now();
|
|
105
|
+
const validated = Object.assign(Object.assign({}, claims), { status: 'validated', createdAt: new Date(now).toISOString(), expiresAt: new Date(now + exports.DEFAULT_CREATE_AGENT_PREVIEW_TTL_MS).toISOString() });
|
|
106
|
+
const createConfirmToken = await mintClaims(validated, input.serverContext);
|
|
107
|
+
return { createConfirmToken, claims: validated };
|
|
108
|
+
}
|
|
109
|
+
/** Verify validated token before create (no upstream write). */
|
|
110
|
+
async function verifyValidatedCreateConfirmToken(input) {
|
|
111
|
+
const claims = await verifyClaims(input.createConfirmToken, input.serverContext);
|
|
112
|
+
assertSubjectAndProject(claims, input.subject, input.projectUuid);
|
|
113
|
+
assertAgentName(claims, input.agentName);
|
|
114
|
+
if (claims.status !== 'validated') {
|
|
115
|
+
throw new CreateAgentPreviewError('CREATE_PREVIEW_NOT_VALIDATED', `Preview '${claims.previewId}' has not been validated; call confirm_create_agent first`);
|
|
116
|
+
}
|
|
117
|
+
if (claims.payloadDigest !== input.payloadDigest) {
|
|
118
|
+
throw new CreateAgentPreviewError('CREATE_PREVIEW_STALE', `Preview '${claims.previewId}' payload digest does not match; re-run preview_create_agent -> confirm_create_agent`);
|
|
119
|
+
}
|
|
120
|
+
return claims;
|
|
121
|
+
}
|
|
122
|
+
/** Verify validated token then run create mutation (ADR-0019: no server-side claim store). */
|
|
123
|
+
async function withValidatedCreateAgentApply(input, fn) {
|
|
124
|
+
const claims = await verifyValidatedCreateConfirmToken(input);
|
|
125
|
+
return fn(claims);
|
|
126
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Fault tests for create_project_agent preview tokens (ADR-0034).
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const common_1 = require("@lightdash-tools/common");
|
|
7
|
+
const vitest_1 = require("vitest");
|
|
8
|
+
const create_agent_preview_js_1 = require("./create-agent-preview.js");
|
|
9
|
+
const PROJECT = '11111111-1111-1111-1111-111111111111';
|
|
10
|
+
const SUBJECT = 'anonymous';
|
|
11
|
+
const PAYLOAD = { name: 'Analyst', enableDataAccess: true };
|
|
12
|
+
function digest() {
|
|
13
|
+
return (0, common_1.digestCreateAgentPayload)(PAYLOAD);
|
|
14
|
+
}
|
|
15
|
+
(0, vitest_1.describe)('create-agent preview tokens', () => {
|
|
16
|
+
(0, vitest_1.afterEach)(() => {
|
|
17
|
+
(0, create_agent_preview_js_1.resetCreateAgentPreviewCodecForTests)();
|
|
18
|
+
});
|
|
19
|
+
(0, vitest_1.it)('rejects invalid createPreviewToken at confirm → CREATE_PREVIEW_REQUIRED', async () => {
|
|
20
|
+
await (0, vitest_1.expect)((0, create_agent_preview_js_1.confirmCreateAgentPreviewToken)({
|
|
21
|
+
createPreviewToken: 'not-a-valid-token',
|
|
22
|
+
subject: SUBJECT,
|
|
23
|
+
projectUuid: PROJECT,
|
|
24
|
+
agentName: PAYLOAD.name,
|
|
25
|
+
})).rejects.toMatchObject({ code: 'CREATE_PREVIEW_REQUIRED' });
|
|
26
|
+
});
|
|
27
|
+
(0, vitest_1.it)('rejects empty createPreviewToken at confirm → CREATE_PREVIEW_REQUIRED', async () => {
|
|
28
|
+
await (0, vitest_1.expect)((0, create_agent_preview_js_1.confirmCreateAgentPreviewToken)({
|
|
29
|
+
createPreviewToken: '',
|
|
30
|
+
subject: SUBJECT,
|
|
31
|
+
projectUuid: PROJECT,
|
|
32
|
+
agentName: PAYLOAD.name,
|
|
33
|
+
})).rejects.toMatchObject({ code: 'CREATE_PREVIEW_REQUIRED' });
|
|
34
|
+
});
|
|
35
|
+
(0, vitest_1.it)('rejects wrong subject at confirm → CREATE_PREVIEW_NOT_OWNED', async () => {
|
|
36
|
+
const { createPreviewToken } = await (0, create_agent_preview_js_1.mintDraftCreateAgentPreviewToken)({
|
|
37
|
+
subject: SUBJECT,
|
|
38
|
+
projectUuid: PROJECT,
|
|
39
|
+
agentName: PAYLOAD.name,
|
|
40
|
+
payloadDigest: digest(),
|
|
41
|
+
});
|
|
42
|
+
await (0, vitest_1.expect)((0, create_agent_preview_js_1.confirmCreateAgentPreviewToken)({
|
|
43
|
+
createPreviewToken,
|
|
44
|
+
subject: 'other-subject',
|
|
45
|
+
projectUuid: PROJECT,
|
|
46
|
+
agentName: PAYLOAD.name,
|
|
47
|
+
})).rejects.toMatchObject({ code: 'CREATE_PREVIEW_NOT_OWNED' });
|
|
48
|
+
});
|
|
49
|
+
(0, vitest_1.it)('rejects wrong project at confirm → CREATE_PREVIEW_NOT_OWNED', async () => {
|
|
50
|
+
const { createPreviewToken } = await (0, create_agent_preview_js_1.mintDraftCreateAgentPreviewToken)({
|
|
51
|
+
subject: SUBJECT,
|
|
52
|
+
projectUuid: PROJECT,
|
|
53
|
+
agentName: PAYLOAD.name,
|
|
54
|
+
payloadDigest: digest(),
|
|
55
|
+
});
|
|
56
|
+
await (0, vitest_1.expect)((0, create_agent_preview_js_1.confirmCreateAgentPreviewToken)({
|
|
57
|
+
createPreviewToken,
|
|
58
|
+
subject: SUBJECT,
|
|
59
|
+
projectUuid: '22222222-2222-2222-2222-222222222222',
|
|
60
|
+
agentName: PAYLOAD.name,
|
|
61
|
+
})).rejects.toMatchObject({ code: 'CREATE_PREVIEW_NOT_OWNED' });
|
|
62
|
+
});
|
|
63
|
+
(0, vitest_1.it)('rejects wrong agent name at confirm → CREATE_PREVIEW_STALE', async () => {
|
|
64
|
+
const { createPreviewToken } = await (0, create_agent_preview_js_1.mintDraftCreateAgentPreviewToken)({
|
|
65
|
+
subject: SUBJECT,
|
|
66
|
+
projectUuid: PROJECT,
|
|
67
|
+
agentName: PAYLOAD.name,
|
|
68
|
+
payloadDigest: digest(),
|
|
69
|
+
});
|
|
70
|
+
await (0, vitest_1.expect)((0, create_agent_preview_js_1.confirmCreateAgentPreviewToken)({
|
|
71
|
+
createPreviewToken,
|
|
72
|
+
subject: SUBJECT,
|
|
73
|
+
projectUuid: PROJECT,
|
|
74
|
+
agentName: 'Renamed',
|
|
75
|
+
})).rejects.toMatchObject({ code: 'CREATE_PREVIEW_STALE' });
|
|
76
|
+
});
|
|
77
|
+
(0, vitest_1.it)('digest mismatch at apply → CREATE_PREVIEW_STALE', async () => {
|
|
78
|
+
const { createPreviewToken } = await (0, create_agent_preview_js_1.mintDraftCreateAgentPreviewToken)({
|
|
79
|
+
subject: SUBJECT,
|
|
80
|
+
projectUuid: PROJECT,
|
|
81
|
+
agentName: PAYLOAD.name,
|
|
82
|
+
payloadDigest: digest(),
|
|
83
|
+
});
|
|
84
|
+
const { createConfirmToken } = await (0, create_agent_preview_js_1.confirmCreateAgentPreviewToken)({
|
|
85
|
+
createPreviewToken,
|
|
86
|
+
subject: SUBJECT,
|
|
87
|
+
projectUuid: PROJECT,
|
|
88
|
+
agentName: PAYLOAD.name,
|
|
89
|
+
});
|
|
90
|
+
await (0, vitest_1.expect)((0, create_agent_preview_js_1.withValidatedCreateAgentApply)({
|
|
91
|
+
createConfirmToken,
|
|
92
|
+
subject: SUBJECT,
|
|
93
|
+
projectUuid: PROJECT,
|
|
94
|
+
agentName: PAYLOAD.name,
|
|
95
|
+
payloadDigest: (0, common_1.digestCreateAgentPayload)({ name: PAYLOAD.name, enableDataAccess: false }),
|
|
96
|
+
}, async () => 'ok')).rejects.toMatchObject({ code: 'CREATE_PREVIEW_STALE' });
|
|
97
|
+
});
|
|
98
|
+
(0, vitest_1.it)('draft token at apply → CREATE_PREVIEW_NOT_VALIDATED', async () => {
|
|
99
|
+
const { createPreviewToken } = await (0, create_agent_preview_js_1.mintDraftCreateAgentPreviewToken)({
|
|
100
|
+
subject: SUBJECT,
|
|
101
|
+
projectUuid: PROJECT,
|
|
102
|
+
agentName: PAYLOAD.name,
|
|
103
|
+
payloadDigest: digest(),
|
|
104
|
+
});
|
|
105
|
+
await (0, vitest_1.expect)((0, create_agent_preview_js_1.withValidatedCreateAgentApply)({
|
|
106
|
+
createConfirmToken: createPreviewToken,
|
|
107
|
+
subject: SUBJECT,
|
|
108
|
+
projectUuid: PROJECT,
|
|
109
|
+
agentName: PAYLOAD.name,
|
|
110
|
+
payloadDigest: digest(),
|
|
111
|
+
}, async () => 'ok')).rejects.toMatchObject({ code: 'CREATE_PREVIEW_NOT_VALIDATED' });
|
|
112
|
+
});
|
|
113
|
+
(0, vitest_1.it)('confirm then apply succeeds', async () => {
|
|
114
|
+
const { createPreviewToken } = await (0, create_agent_preview_js_1.mintDraftCreateAgentPreviewToken)({
|
|
115
|
+
subject: SUBJECT,
|
|
116
|
+
projectUuid: PROJECT,
|
|
117
|
+
agentName: PAYLOAD.name,
|
|
118
|
+
payloadDigest: digest(),
|
|
119
|
+
serverContext: { mcpReq: {} },
|
|
120
|
+
});
|
|
121
|
+
const { createConfirmToken } = await (0, create_agent_preview_js_1.confirmCreateAgentPreviewToken)({
|
|
122
|
+
createPreviewToken,
|
|
123
|
+
subject: SUBJECT,
|
|
124
|
+
projectUuid: PROJECT,
|
|
125
|
+
agentName: PAYLOAD.name,
|
|
126
|
+
serverContext: { mcpReq: {} },
|
|
127
|
+
});
|
|
128
|
+
const result = await (0, create_agent_preview_js_1.withValidatedCreateAgentApply)({
|
|
129
|
+
createConfirmToken,
|
|
130
|
+
subject: SUBJECT,
|
|
131
|
+
projectUuid: PROJECT,
|
|
132
|
+
agentName: PAYLOAD.name,
|
|
133
|
+
payloadDigest: digest(),
|
|
134
|
+
serverContext: { mcpReq: {} },
|
|
135
|
+
}, async (claims) => claims.previewId);
|
|
136
|
+
(0, vitest_1.expect)(result).toEqual(vitest_1.expect.any(String));
|
|
137
|
+
});
|
|
138
|
+
(0, vitest_1.it)('validated createConfirmToken can be applied multiple times (no server-side single-use)', async () => {
|
|
139
|
+
// HMAC tokens are client-carried and stateless (ADR-0019); single-use would require server-side claim store.
|
|
140
|
+
const { createPreviewToken } = await (0, create_agent_preview_js_1.mintDraftCreateAgentPreviewToken)({
|
|
141
|
+
subject: SUBJECT,
|
|
142
|
+
projectUuid: PROJECT,
|
|
143
|
+
agentName: PAYLOAD.name,
|
|
144
|
+
payloadDigest: digest(),
|
|
145
|
+
});
|
|
146
|
+
const { createConfirmToken } = await (0, create_agent_preview_js_1.confirmCreateAgentPreviewToken)({
|
|
147
|
+
createPreviewToken,
|
|
148
|
+
subject: SUBJECT,
|
|
149
|
+
projectUuid: PROJECT,
|
|
150
|
+
agentName: PAYLOAD.name,
|
|
151
|
+
});
|
|
152
|
+
const applyInput = {
|
|
153
|
+
createConfirmToken,
|
|
154
|
+
subject: SUBJECT,
|
|
155
|
+
projectUuid: PROJECT,
|
|
156
|
+
agentName: PAYLOAD.name,
|
|
157
|
+
payloadDigest: digest(),
|
|
158
|
+
};
|
|
159
|
+
await (0, vitest_1.expect)((0, create_agent_preview_js_1.withValidatedCreateAgentApply)(applyInput, async () => 1)).resolves.toBe(1);
|
|
160
|
+
await (0, vitest_1.expect)((0, create_agent_preview_js_1.withValidatedCreateAgentApply)(applyInput, async () => 2)).resolves.toBe(2);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.aiAgentOpsProfile = exports.AI_AGENT_OPS_PROFILE_PATH = void 0;
|
|
7
7
|
const agents_js_1 = require("../../../tools/ai-agents/agents.js");
|
|
8
8
|
const discovery_js_1 = require("../../../tools/ai-agents/discovery.js");
|
|
9
|
+
const documents_js_1 = require("../../../tools/ai-agents/documents.js");
|
|
9
10
|
const evaluations_js_1 = require("../../../tools/ai-agents/evaluations.js");
|
|
10
11
|
const threads_js_1 = require("../../../tools/ai-agents/threads.js");
|
|
11
12
|
const prompts_js_1 = require("./prompts.js");
|
|
@@ -18,6 +19,10 @@ exports.aiAgentOpsProfile = {
|
|
|
18
19
|
tools: [
|
|
19
20
|
agents_js_1.listProjectAgentsTool,
|
|
20
21
|
agents_js_1.getProjectAgentTool,
|
|
22
|
+
agents_js_1.previewCreateAgentTool,
|
|
23
|
+
agents_js_1.confirmCreateAgentTool,
|
|
24
|
+
agents_js_1.createProjectAgentTool,
|
|
25
|
+
agents_js_1.updateProjectAgentTool,
|
|
21
26
|
discovery_js_1.evaluateAgentReadinessTool,
|
|
22
27
|
discovery_js_1.getAgentSuggestionsTool,
|
|
23
28
|
discovery_js_1.getAgentModelsTool,
|
|
@@ -33,6 +38,11 @@ exports.aiAgentOpsProfile = {
|
|
|
33
38
|
evaluations_js_1.runAgentEvaluationTool,
|
|
34
39
|
evaluations_js_1.listAgentEvaluationRunsTool,
|
|
35
40
|
evaluations_js_1.getAgentEvalRunResultsTool,
|
|
41
|
+
documents_js_1.listAgentDocumentsTool,
|
|
42
|
+
documents_js_1.getAgentDocumentTool,
|
|
43
|
+
documents_js_1.createAgentDocumentTool,
|
|
44
|
+
documents_js_1.updateAgentDocumentTool,
|
|
45
|
+
documents_js_1.deleteAgentDocumentTool,
|
|
36
46
|
],
|
|
37
47
|
registerPrompts: prompts_js_1.registerAiAgentOpsPrompts,
|
|
38
48
|
registerResources: playbooks_js_1.registerAiAgentOpsPlaybook,
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* AI agent-ops structured prompt invariants (SSOT for capsules + HARD_BANS projection).
|
|
3
3
|
*/
|
|
4
4
|
export declare const AI_AGENT_OPS_INVARIANTS: readonly [{
|
|
5
|
-
readonly id: "no-agent-
|
|
6
|
-
readonly short: "Do not
|
|
5
|
+
readonly id: "no-agent-delete";
|
|
6
|
+
readonly short: "Do not delete agents on this server.";
|
|
7
7
|
}, {
|
|
8
8
|
readonly id: "no-thread-mutation";
|
|
9
9
|
readonly short: "Do not start or continue threads.";
|
|
@@ -22,6 +22,9 @@ export declare const AI_AGENT_OPS_INVARIANTS: readonly [{
|
|
|
22
22
|
}, {
|
|
23
23
|
readonly id: "no-mcp-only-gate-claim";
|
|
24
24
|
readonly short: "Do not claim a CLI promotion gate passed from MCP run results alone.";
|
|
25
|
+
}, {
|
|
26
|
+
readonly id: "secure-agent-defaults";
|
|
27
|
+
readonly short: "Do not enable data/content/SQL/user context or public visibility on create unless the user explicitly requested elevation — governed defaults apply.";
|
|
25
28
|
}];
|
|
26
29
|
export declare const AI_AGENT_OPS_HARD_BANS: string;
|
|
27
|
-
export declare const AI_AGENT_OPS_DEFAULT_INVARIANT_IDS: readonly ("no-agent-
|
|
30
|
+
export declare const AI_AGENT_OPS_DEFAULT_INVARIANT_IDS: readonly ("no-agent-delete" | "no-thread-mutation" | "no-resource-mutation" | "no-offline-scorers" | "no-git-eval-stores" | "no-invent-mega-tools" | "no-mcp-only-gate-claim" | "secure-agent-defaults")[];
|
|
@@ -7,8 +7,8 @@ exports.AI_AGENT_OPS_DEFAULT_INVARIANT_IDS = exports.AI_AGENT_OPS_HARD_BANS = ex
|
|
|
7
7
|
const prompt_invariants_js_1 = require("../../lib/prompt-invariants.js");
|
|
8
8
|
exports.AI_AGENT_OPS_INVARIANTS = [
|
|
9
9
|
{
|
|
10
|
-
id: 'no-agent-
|
|
11
|
-
short: 'Do not
|
|
10
|
+
id: 'no-agent-delete',
|
|
11
|
+
short: 'Do not delete agents on this server.',
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
id: 'no-thread-mutation',
|
|
@@ -34,6 +34,10 @@ exports.AI_AGENT_OPS_INVARIANTS = [
|
|
|
34
34
|
id: 'no-mcp-only-gate-claim',
|
|
35
35
|
short: 'Do not claim a CLI promotion gate passed from MCP run results alone.',
|
|
36
36
|
},
|
|
37
|
+
{
|
|
38
|
+
id: 'secure-agent-defaults',
|
|
39
|
+
short: 'Do not enable data/content/SQL/user context or public visibility on create unless the user explicitly requested elevation — governed defaults apply.',
|
|
40
|
+
},
|
|
37
41
|
];
|
|
38
42
|
exports.AI_AGENT_OPS_HARD_BANS = (0, prompt_invariants_js_1.formatHardBansProjection)(exports.AI_AGENT_OPS_INVARIANTS);
|
|
39
43
|
exports.AI_AGENT_OPS_DEFAULT_INVARIANT_IDS = (0, prompt_invariants_js_1.allInvariantIds)(exports.AI_AGENT_OPS_INVARIANTS);
|
|
@@ -38,7 +38,7 @@ Procedure (primitives only):
|
|
|
38
38
|
3. Optionally evaluate_agent_readiness — label as readiness API, not e2e.
|
|
39
39
|
4. List evaluations and recent runs; note coverage gaps.
|
|
40
40
|
5. Distinguish API facts, readiness signals, evaluation evidence, assumptions, and unknowns.
|
|
41
|
-
6. Do not
|
|
41
|
+
6. Do not delete agents or start threads unless the user explicitly requests a separate chat profile flow.`,
|
|
42
42
|
invariantIds,
|
|
43
43
|
requiredTopics: [],
|
|
44
44
|
}));
|
|
@@ -105,6 +105,24 @@ Stop when gates pass, no safe intervention remains, or the budget is exhausted.`
|
|
|
105
105
|
invariantIds,
|
|
106
106
|
requiredTopics: [TOPIC_LOOP_ENGINEERING],
|
|
107
107
|
}));
|
|
108
|
+
server.registerPrompt('create_governed_project_agent', {
|
|
109
|
+
title: 'Create governed project AI agent',
|
|
110
|
+
description: 'Create an agent with secure defaults (capabilities off, admin-only visibility)',
|
|
111
|
+
argsSchema: {
|
|
112
|
+
name: zod_1.z.string().optional().describe('Agent display name'),
|
|
113
|
+
instruction: zod_1.z.string().optional().describe('System instruction'),
|
|
114
|
+
},
|
|
115
|
+
}, ({ name, instruction }) => promptContext({
|
|
116
|
+
task: `Create a governed Lightdash AI agent${name ? ` named "${name}"` : ''}.
|
|
117
|
+
|
|
118
|
+
Use create_project_agent with secure defaults only (omit capability flags — data/content/SQL/user context stay off, adminOnly stays on).
|
|
119
|
+
${instruction ? `Instruction draft: ${instruction}` : 'Draft a minimal instruction after listing explores if needed.'}
|
|
120
|
+
Verify tags with get_explore_access_summary before setting any tag allowlist (explore names are not tags).
|
|
121
|
+
Human must accept create confirmation: form elicitation when supported; otherwise preview_create_agent → confirm_create_agent → create with createConfirmToken.
|
|
122
|
+
Do not elevate permissions unless the user explicitly asks.`,
|
|
123
|
+
invariantIds,
|
|
124
|
+
requiredTopics: [],
|
|
125
|
+
}));
|
|
108
126
|
server.registerPrompt('review_agent_access_and_scope', {
|
|
109
127
|
title: 'Review agent access and scope',
|
|
110
128
|
description: 'Review tags, data access, and explore reachability',
|
|
@@ -114,8 +132,11 @@ Stop when gates pass, no safe intervention remains, or the budget is exhausted.`
|
|
|
114
132
|
}, ({ agentUuid }) => promptContext({
|
|
115
133
|
task: `Review access and scope for agent ${agentUuid !== null && agentUuid !== void 0 ? agentUuid : '(select)'}.
|
|
116
134
|
|
|
117
|
-
Use get_project_agent and get_explore_access_summary
|
|
118
|
-
|
|
135
|
+
Use get_project_agent and get_explore_access_summary (pass the agent's tags). Review enableDataAccess, enableContentTools, enableSqlMode, enableUserContext, and adminOnly against the secure baseline.
|
|
136
|
+
Note unexpectedly broad/narrow tags,
|
|
137
|
+
invented tags that match zero explores (TAGS_MATCH_NO_EXPLORES), data-access inconsistencies, and self-improvement risk.
|
|
138
|
+
Prefer update_project_agent over create_project_agent when adjusting scope. Do not mutate access unless the user asks.
|
|
139
|
+
create_project_agent requires human confirmation (form elicitation or preview_create_agent → confirm_create_agent).`,
|
|
119
140
|
invariantIds,
|
|
120
141
|
requiredTopics: [],
|
|
121
142
|
}));
|
|
@@ -13,11 +13,20 @@ const playbooks_js_1 = require("./resources/playbooks.js");
|
|
|
13
13
|
(0, vitest_1.expect)(md.toLowerCase()).toContain('hard bans');
|
|
14
14
|
(0, vitest_1.expect)(playbooks_js_1.AI_AGENT_OPS_HARD_BANS.toLowerCase()).toContain('recommend');
|
|
15
15
|
});
|
|
16
|
-
(0, vitest_1.it)('playbook
|
|
16
|
+
(0, vitest_1.it)('playbook allows agent create/update and forbids delete on MCP', () => {
|
|
17
17
|
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
|
|
18
|
+
(0, vitest_1.expect)(md).toContain('create_project_agent');
|
|
19
|
+
(0, vitest_1.expect)(md).toContain('update_project_agent');
|
|
20
|
+
(0, vitest_1.expect)(md).toContain('preview_create_agent');
|
|
21
|
+
(0, vitest_1.expect)(md).toContain('confirm_create_agent');
|
|
22
|
+
(0, vitest_1.expect)(md).toContain('tags_match_no_explores');
|
|
23
|
+
(0, vitest_1.expect)(md).toContain('do not delete agents');
|
|
18
24
|
(0, vitest_1.expect)(md).toContain('no offline scorers');
|
|
19
25
|
(0, vitest_1.expect)(md).toContain('agentops');
|
|
20
26
|
(0, vitest_1.expect)(md).toContain('evaluate_agent_readiness');
|
|
21
27
|
(0, vitest_1.expect)(md).toContain('run_agent_evaluation');
|
|
28
|
+
(0, vitest_1.expect)(md).toContain('create_agent_document');
|
|
29
|
+
(0, vitest_1.expect)(md).toContain('secure agent defaults');
|
|
30
|
+
(0, vitest_1.expect)(md).toContain('elevated_');
|
|
22
31
|
});
|
|
23
32
|
});
|