@basaltkit/ai 1.0.1 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analysis.d.ts +19 -0
- package/dist/analysis.js +24 -0
- package/dist/commands.js +3 -0
- package/dist/generate.d.ts +43 -0
- package/dist/generate.js +46 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +6 -1
- package/dist/make/diff.d.ts +10 -0
- package/dist/make/diff.js +120 -0
- package/dist/make/make.js +37 -1
- package/dist/make/openapi.js +1 -1
- package/dist/make/permissions.js +1 -1
- package/dist/make/relations.js +1 -1
- package/dist/make/repository.js +1 -1
- package/dist/make/types.d.ts +27 -1
- package/dist/make/wire.js +1 -1
- package/dist/plan/plan.d.ts +5 -0
- package/dist/plan/plan.js +18 -3
- package/dist/plan/types.d.ts +6 -0
- package/dist/provider/abort.d.ts +11 -0
- package/dist/provider/abort.js +20 -0
- package/dist/provider/anthropic.js +1 -0
- package/dist/provider/factory.d.ts +2 -0
- package/dist/provider/factory.js +11 -8
- package/dist/provider/http.d.ts +1 -0
- package/dist/provider/http.js +5 -0
- package/dist/provider/ollama.js +1 -0
- package/dist/provider/openai.js +2 -0
- package/dist/provider/sse.d.ts +1 -0
- package/dist/provider/sse.js +1 -0
- package/dist/provider/types.d.ts +3 -0
- package/dist/review/review.d.ts +5 -0
- package/dist/review/review.js +13 -4
- package/dist/schema/index.d.ts +453 -0
- package/dist/schema/index.js +228 -0
- package/dist/workflows.d.ts +19 -0
- package/dist/workflows.js +23 -0
- package/package.json +16 -3
package/dist/provider/factory.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { AnthropicProvider } from './anthropic.js';
|
|
2
2
|
import { OllamaProvider } from './ollama.js';
|
|
3
3
|
import { OpenAICompatibleProvider } from './openai.js';
|
|
4
|
-
/** Read the provider-relevant vars off
|
|
5
|
-
export function
|
|
6
|
-
const e = process.env;
|
|
4
|
+
/** Read the provider-relevant vars off an env record into a typed {@link ProviderEnv}. */
|
|
5
|
+
export function providerEnvFrom(env) {
|
|
7
6
|
return {
|
|
8
|
-
...(
|
|
9
|
-
...(
|
|
10
|
-
...(
|
|
11
|
-
...(
|
|
12
|
-
...(
|
|
7
|
+
...(env.AI_PROVIDER !== undefined ? { AI_PROVIDER: env.AI_PROVIDER } : {}),
|
|
8
|
+
...(env.AI_MODEL !== undefined ? { AI_MODEL: env.AI_MODEL } : {}),
|
|
9
|
+
...(env.AI_API_KEY !== undefined ? { AI_API_KEY: env.AI_API_KEY } : {}),
|
|
10
|
+
...(env.AI_BASE_URL !== undefined ? { AI_BASE_URL: env.AI_BASE_URL } : {}),
|
|
11
|
+
...(env.AI_STREAM !== undefined ? { AI_STREAM: env.AI_STREAM } : {}),
|
|
13
12
|
};
|
|
14
13
|
}
|
|
14
|
+
/** Read the provider-relevant vars off `process.env` into a typed {@link ProviderEnv}. */
|
|
15
|
+
export function providerEnvFromProcess() {
|
|
16
|
+
return providerEnvFrom(process.env);
|
|
17
|
+
}
|
|
15
18
|
/**
|
|
16
19
|
* Build an {@link AIProvider} from environment. `AI_PROVIDER` selects the vendor
|
|
17
20
|
* (default `anthropic`); `AI_MODEL`, `AI_API_KEY`, `AI_BASE_URL` tune it.
|
package/dist/provider/http.d.ts
CHANGED
package/dist/provider/http.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { throwIfAborted, isAbortError } from './abort.js';
|
|
1
2
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
2
3
|
/** Transient failures worth retrying: gateway/server errors and rate limits. */
|
|
3
4
|
function isRetryableStatus(status) {
|
|
@@ -16,6 +17,7 @@ export async function fetchWithRetry(fetchImpl, url, init, options = {}) {
|
|
|
16
17
|
const baseDelayMs = options.baseDelayMs ?? 300;
|
|
17
18
|
let lastError;
|
|
18
19
|
for (let attempt = 0; attempt <= retries; attempt++) {
|
|
20
|
+
throwIfAborted(init.signal);
|
|
19
21
|
try {
|
|
20
22
|
const res = await fetchImpl(url, init);
|
|
21
23
|
if (isRetryableStatus(res.status) && attempt < retries) {
|
|
@@ -25,6 +27,9 @@ export async function fetchWithRetry(fetchImpl, url, init, options = {}) {
|
|
|
25
27
|
return { ok: res.ok, status: res.status, body: await res.text() };
|
|
26
28
|
}
|
|
27
29
|
catch (error) {
|
|
30
|
+
// A cancelled request must fail immediately — never retried.
|
|
31
|
+
if (isAbortError(error) || init.signal?.aborted)
|
|
32
|
+
throw error;
|
|
28
33
|
lastError = error;
|
|
29
34
|
if (attempt >= retries)
|
|
30
35
|
throw error;
|
package/dist/provider/ollama.js
CHANGED
|
@@ -22,6 +22,7 @@ export class OllamaProvider {
|
|
|
22
22
|
const { ok, status, body } = await fetchWithRetry(this.fetchImpl, this.baseUrl + '/api/chat', {
|
|
23
23
|
method: 'POST',
|
|
24
24
|
headers: { 'content-type': 'application/json' },
|
|
25
|
+
...(options.signal ? { signal: options.signal } : {}),
|
|
25
26
|
body: JSON.stringify({
|
|
26
27
|
model: this.model,
|
|
27
28
|
stream: false,
|
package/dist/provider/openai.js
CHANGED
|
@@ -62,6 +62,7 @@ export class OpenAICompatibleProvider {
|
|
|
62
62
|
method: 'POST',
|
|
63
63
|
headers: this.headers(),
|
|
64
64
|
body: this.requestBody(options, true),
|
|
65
|
+
...(options.signal ? { signal: options.signal } : {}),
|
|
65
66
|
});
|
|
66
67
|
if (!res.ok) {
|
|
67
68
|
throw new Error(`OpenAICompatibleProvider: ${res.status} — ${safeError(await res.text())}`);
|
|
@@ -73,6 +74,7 @@ export class OpenAICompatibleProvider {
|
|
|
73
74
|
method: 'POST',
|
|
74
75
|
headers: this.headers(),
|
|
75
76
|
body: this.requestBody(options, false),
|
|
77
|
+
...(options.signal ? { signal: options.signal } : {}),
|
|
76
78
|
});
|
|
77
79
|
if (!ok) {
|
|
78
80
|
const detail = safeError(body);
|
package/dist/provider/sse.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export type SseFetch = (url: string, init: {
|
|
|
18
18
|
method?: string;
|
|
19
19
|
headers?: Record<string, string>;
|
|
20
20
|
body?: string;
|
|
21
|
+
signal?: AbortSignal;
|
|
21
22
|
}) => Promise<SseResponse>;
|
|
22
23
|
/** Default {@link SseFetch} backed by the global `fetch` + its streaming body. */
|
|
23
24
|
export declare const globalSseFetch: SseFetch;
|
package/dist/provider/sse.js
CHANGED
package/dist/provider/types.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export interface GenerateOptions {
|
|
|
15
15
|
temperature?: number;
|
|
16
16
|
/** Hard cap on output tokens. */
|
|
17
17
|
maxTokens?: number;
|
|
18
|
+
/** Abort the in-flight request. Providers forward it to the underlying fetch. */
|
|
19
|
+
signal?: AbortSignal;
|
|
18
20
|
}
|
|
19
21
|
export interface AIProvider {
|
|
20
22
|
/** Stable id, e.g. `'anthropic'`. */
|
|
@@ -35,6 +37,7 @@ export type FetchLike = (url: string, init?: {
|
|
|
35
37
|
method?: string;
|
|
36
38
|
headers?: Record<string, string>;
|
|
37
39
|
body?: string;
|
|
40
|
+
signal?: AbortSignal;
|
|
38
41
|
}) => Promise<{
|
|
39
42
|
ok: boolean;
|
|
40
43
|
status: number;
|
package/dist/review/review.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { MakeResult } from '../make/types.js';
|
|
2
2
|
import type { ArchitecturePlan } from '../plan/types.js';
|
|
3
3
|
import type { AIProvider } from '../provider/types.js';
|
|
4
|
+
import { type OnProgress } from '../generate.js';
|
|
4
5
|
import type { AgentReview } from './types.js';
|
|
5
6
|
export interface ReviewOptions {
|
|
6
7
|
temperature?: number;
|
|
7
8
|
maxTokens?: number;
|
|
9
|
+
/** Abort the request. */
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
/** Receive streamed progress. When set, a streaming provider streams. */
|
|
12
|
+
onProgress?: OnProgress;
|
|
8
13
|
}
|
|
9
14
|
/**
|
|
10
15
|
* Compact, relevant-only context for the Review agent: the request, the plan, the
|
package/dist/review/review.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { AgentReviewSchema } from '../schema/index.js';
|
|
2
|
+
import { runGeneration } from '../generate.js';
|
|
1
3
|
import { REVIEW_KNOWLEDGE } from './knowledge.js';
|
|
2
4
|
/** Files worth sending to the reviewer — the ones that carry the behaviour. */
|
|
3
5
|
const REVIEWABLE = /\.prisma$|\.(schema|routes|service|repository|permissions)\.ts$/;
|
|
@@ -31,14 +33,19 @@ export function buildReviewContext(plan, result) {
|
|
|
31
33
|
}
|
|
32
34
|
/** Ask the Review agent to critique the generated code. Read-only — it judges, it doesn't edit. */
|
|
33
35
|
export async function reviewImplementation(provider, plan, result, options = {}) {
|
|
34
|
-
const
|
|
36
|
+
const run = {};
|
|
37
|
+
if (options.signal)
|
|
38
|
+
run.signal = options.signal;
|
|
39
|
+
if (options.onProgress)
|
|
40
|
+
run.onProgress = options.onProgress;
|
|
41
|
+
const raw = await runGeneration(provider, {
|
|
35
42
|
messages: [
|
|
36
43
|
{ role: 'system', content: REVIEW_KNOWLEDGE },
|
|
37
44
|
{ role: 'user', content: `${buildReviewContext(plan, result)}\n\nReturn the verdict as a single JSON object.` },
|
|
38
45
|
],
|
|
39
46
|
temperature: options.temperature ?? 0,
|
|
40
47
|
maxTokens: options.maxTokens ?? 2048,
|
|
41
|
-
});
|
|
48
|
+
}, run);
|
|
42
49
|
return parseReview(raw);
|
|
43
50
|
}
|
|
44
51
|
/** Parse the verdict. `approved` is derived from the issues, not trusted from the model. */
|
|
@@ -52,11 +59,13 @@ export function parseReview(raw) {
|
|
|
52
59
|
throw new Error(`ai review — the model did not return valid JSON. Got: ${raw.slice(0, 160)}…`);
|
|
53
60
|
}
|
|
54
61
|
const issues = normalizeIssues(obj['issues']);
|
|
55
|
-
|
|
62
|
+
// Coerce first, then validate. `approved` is derived from the issues here, not
|
|
63
|
+
// trusted from the model.
|
|
64
|
+
return AgentReviewSchema.parse({
|
|
56
65
|
approved: !issues.some((i) => i.severity === 'error'),
|
|
57
66
|
summary: typeof obj['summary'] === 'string' ? obj['summary'] : '',
|
|
58
67
|
issues,
|
|
59
|
-
};
|
|
68
|
+
});
|
|
60
69
|
}
|
|
61
70
|
function normalizeIssues(value) {
|
|
62
71
|
if (!Array.isArray(value))
|
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime schemas for the AI layer's public data contracts. `@basaltkit/ai` is a
|
|
3
|
+
* dev-only package, so taking a `zod` dependency here is acceptable — these
|
|
4
|
+
* schemas exist so out-of-process consumers (notably the forthcoming dev-only
|
|
5
|
+
* `@basaltkit/ai-mcp` bridge) can (a) validate tool inputs/outputs and (b) derive
|
|
6
|
+
* JSON Schema to advertise as MCP `inputSchema`/`outputSchema`.
|
|
7
|
+
*
|
|
8
|
+
* The schemas mirror the exported TypeScript interfaces exactly. `parsePlan` and
|
|
9
|
+
* `parseReview` route their already-coerced output through them (validate *after*
|
|
10
|
+
* tolerant coercion — the model's raw text is never fed to `.parse()` directly).
|
|
11
|
+
*/
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
/** Bump when the serialized shape of a plan changes incompatibly. */
|
|
14
|
+
export declare const PLAN_SCHEMA_VERSION = 1;
|
|
15
|
+
/** Bump when the serialized shape of a make result changes incompatibly. */
|
|
16
|
+
export declare const MAKE_SCHEMA_VERSION = 1;
|
|
17
|
+
export declare const DetectedStackSchema: z.ZodObject<{
|
|
18
|
+
http: z.ZodNullable<z.ZodEnum<{
|
|
19
|
+
fastify: "fastify";
|
|
20
|
+
}>>;
|
|
21
|
+
orm: z.ZodNullable<z.ZodEnum<{
|
|
22
|
+
prisma: "prisma";
|
|
23
|
+
}>>;
|
|
24
|
+
database: z.ZodNullable<z.ZodEnum<{
|
|
25
|
+
mysql: "mysql";
|
|
26
|
+
postgresql: "postgresql";
|
|
27
|
+
sqlite: "sqlite";
|
|
28
|
+
}>>;
|
|
29
|
+
tenancy: z.ZodBoolean;
|
|
30
|
+
auth: z.ZodBoolean;
|
|
31
|
+
rbac: z.ZodBoolean;
|
|
32
|
+
subscriptions: z.ZodBoolean;
|
|
33
|
+
payments: z.ZodBoolean;
|
|
34
|
+
storage: z.ZodBoolean;
|
|
35
|
+
queue: z.ZodBoolean;
|
|
36
|
+
search: z.ZodBoolean;
|
|
37
|
+
audit: z.ZodBoolean;
|
|
38
|
+
events: z.ZodBoolean;
|
|
39
|
+
scheduler: z.ZodBoolean;
|
|
40
|
+
logger: z.ZodBoolean;
|
|
41
|
+
ai: z.ZodBoolean;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
export declare const PrismaModelSchema: z.ZodObject<{
|
|
44
|
+
name: z.ZodString;
|
|
45
|
+
fields: z.ZodArray<z.ZodString>;
|
|
46
|
+
tenantScoped: z.ZodBoolean;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
export declare const PrismaInfoSchema: z.ZodObject<{
|
|
49
|
+
provider: z.ZodNullable<z.ZodEnum<{
|
|
50
|
+
mysql: "mysql";
|
|
51
|
+
postgresql: "postgresql";
|
|
52
|
+
sqlite: "sqlite";
|
|
53
|
+
}>>;
|
|
54
|
+
models: z.ZodArray<z.ZodObject<{
|
|
55
|
+
name: z.ZodString;
|
|
56
|
+
fields: z.ZodArray<z.ZodString>;
|
|
57
|
+
tenantScoped: z.ZodBoolean;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
export declare const AppFileInfoSchema: z.ZodObject<{
|
|
61
|
+
path: z.ZodString;
|
|
62
|
+
plugins: z.ZodArray<z.ZodString>;
|
|
63
|
+
fastifyLoggerConfigured: z.ZodBoolean;
|
|
64
|
+
memorySources: z.ZodArray<z.ZodString>;
|
|
65
|
+
pluginCalls: z.ZodArray<z.ZodString>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
export declare const ServerFileInfoSchema: z.ZodObject<{
|
|
68
|
+
path: z.ZodString;
|
|
69
|
+
connectsAtBoot: z.ZodBoolean;
|
|
70
|
+
startsServer: z.ZodBoolean;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
export declare const EnvFileInfoSchema: z.ZodObject<{
|
|
73
|
+
path: z.ZodString;
|
|
74
|
+
appSecretDefault: z.ZodNullable<z.ZodString>;
|
|
75
|
+
redisUrlDefault: z.ZodNullable<z.ZodString>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
export declare const ProjectContextSchema: z.ZodObject<{
|
|
78
|
+
root: z.ZodString;
|
|
79
|
+
installed: z.ZodArray<z.ZodString>;
|
|
80
|
+
stack: z.ZodObject<{
|
|
81
|
+
http: z.ZodNullable<z.ZodEnum<{
|
|
82
|
+
fastify: "fastify";
|
|
83
|
+
}>>;
|
|
84
|
+
orm: z.ZodNullable<z.ZodEnum<{
|
|
85
|
+
prisma: "prisma";
|
|
86
|
+
}>>;
|
|
87
|
+
database: z.ZodNullable<z.ZodEnum<{
|
|
88
|
+
mysql: "mysql";
|
|
89
|
+
postgresql: "postgresql";
|
|
90
|
+
sqlite: "sqlite";
|
|
91
|
+
}>>;
|
|
92
|
+
tenancy: z.ZodBoolean;
|
|
93
|
+
auth: z.ZodBoolean;
|
|
94
|
+
rbac: z.ZodBoolean;
|
|
95
|
+
subscriptions: z.ZodBoolean;
|
|
96
|
+
payments: z.ZodBoolean;
|
|
97
|
+
storage: z.ZodBoolean;
|
|
98
|
+
queue: z.ZodBoolean;
|
|
99
|
+
search: z.ZodBoolean;
|
|
100
|
+
audit: z.ZodBoolean;
|
|
101
|
+
events: z.ZodBoolean;
|
|
102
|
+
scheduler: z.ZodBoolean;
|
|
103
|
+
logger: z.ZodBoolean;
|
|
104
|
+
ai: z.ZodBoolean;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
prisma: z.ZodNullable<z.ZodObject<{
|
|
107
|
+
provider: z.ZodNullable<z.ZodEnum<{
|
|
108
|
+
mysql: "mysql";
|
|
109
|
+
postgresql: "postgresql";
|
|
110
|
+
sqlite: "sqlite";
|
|
111
|
+
}>>;
|
|
112
|
+
models: z.ZodArray<z.ZodObject<{
|
|
113
|
+
name: z.ZodString;
|
|
114
|
+
fields: z.ZodArray<z.ZodString>;
|
|
115
|
+
tenantScoped: z.ZodBoolean;
|
|
116
|
+
}, z.core.$strip>>;
|
|
117
|
+
}, z.core.$strip>>;
|
|
118
|
+
app: z.ZodNullable<z.ZodObject<{
|
|
119
|
+
path: z.ZodString;
|
|
120
|
+
plugins: z.ZodArray<z.ZodString>;
|
|
121
|
+
fastifyLoggerConfigured: z.ZodBoolean;
|
|
122
|
+
memorySources: z.ZodArray<z.ZodString>;
|
|
123
|
+
pluginCalls: z.ZodArray<z.ZodString>;
|
|
124
|
+
}, z.core.$strip>>;
|
|
125
|
+
server: z.ZodNullable<z.ZodObject<{
|
|
126
|
+
path: z.ZodString;
|
|
127
|
+
connectsAtBoot: z.ZodBoolean;
|
|
128
|
+
startsServer: z.ZodBoolean;
|
|
129
|
+
}, z.core.$strip>>;
|
|
130
|
+
env: z.ZodNullable<z.ZodObject<{
|
|
131
|
+
path: z.ZodString;
|
|
132
|
+
appSecretDefault: z.ZodNullable<z.ZodString>;
|
|
133
|
+
redisUrlDefault: z.ZodNullable<z.ZodString>;
|
|
134
|
+
}, z.core.$strip>>;
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
export declare const SeveritySchema: z.ZodEnum<{
|
|
137
|
+
error: "error";
|
|
138
|
+
info: "info";
|
|
139
|
+
warning: "warning";
|
|
140
|
+
}>;
|
|
141
|
+
export declare const DiagnosticCategorySchema: z.ZodEnum<{
|
|
142
|
+
config: "config";
|
|
143
|
+
database: "database";
|
|
144
|
+
durability: "durability";
|
|
145
|
+
observability: "observability";
|
|
146
|
+
performance: "performance";
|
|
147
|
+
security: "security";
|
|
148
|
+
tenancy: "tenancy";
|
|
149
|
+
}>;
|
|
150
|
+
export declare const DiagnosticSchema: z.ZodObject<{
|
|
151
|
+
id: z.ZodString;
|
|
152
|
+
title: z.ZodString;
|
|
153
|
+
severity: z.ZodEnum<{
|
|
154
|
+
error: "error";
|
|
155
|
+
info: "info";
|
|
156
|
+
warning: "warning";
|
|
157
|
+
}>;
|
|
158
|
+
category: z.ZodEnum<{
|
|
159
|
+
config: "config";
|
|
160
|
+
database: "database";
|
|
161
|
+
durability: "durability";
|
|
162
|
+
observability: "observability";
|
|
163
|
+
performance: "performance";
|
|
164
|
+
security: "security";
|
|
165
|
+
tenancy: "tenancy";
|
|
166
|
+
}>;
|
|
167
|
+
detected: z.ZodString;
|
|
168
|
+
recommended: z.ZodString;
|
|
169
|
+
reason: z.ZodString;
|
|
170
|
+
fix: z.ZodOptional<z.ZodString>;
|
|
171
|
+
docs: z.ZodOptional<z.ZodString>;
|
|
172
|
+
}, z.core.$strip>;
|
|
173
|
+
export declare const AnalysisReportSchema: z.ZodObject<{
|
|
174
|
+
root: z.ZodString;
|
|
175
|
+
capabilities: z.ZodArray<z.ZodString>;
|
|
176
|
+
installed: z.ZodArray<z.ZodString>;
|
|
177
|
+
database: z.ZodNullable<z.ZodString>;
|
|
178
|
+
models: z.ZodArray<z.ZodString>;
|
|
179
|
+
tenantScopedModels: z.ZodArray<z.ZodString>;
|
|
180
|
+
unscopedModels: z.ZodArray<z.ZodString>;
|
|
181
|
+
diagnostics: z.ZodArray<z.ZodObject<{
|
|
182
|
+
id: z.ZodString;
|
|
183
|
+
title: z.ZodString;
|
|
184
|
+
severity: z.ZodEnum<{
|
|
185
|
+
error: "error";
|
|
186
|
+
info: "info";
|
|
187
|
+
warning: "warning";
|
|
188
|
+
}>;
|
|
189
|
+
category: z.ZodEnum<{
|
|
190
|
+
config: "config";
|
|
191
|
+
database: "database";
|
|
192
|
+
durability: "durability";
|
|
193
|
+
observability: "observability";
|
|
194
|
+
performance: "performance";
|
|
195
|
+
security: "security";
|
|
196
|
+
tenancy: "tenancy";
|
|
197
|
+
}>;
|
|
198
|
+
detected: z.ZodString;
|
|
199
|
+
recommended: z.ZodString;
|
|
200
|
+
reason: z.ZodString;
|
|
201
|
+
fix: z.ZodOptional<z.ZodString>;
|
|
202
|
+
docs: z.ZodOptional<z.ZodString>;
|
|
203
|
+
}, z.core.$strip>>;
|
|
204
|
+
}, z.core.$strip>;
|
|
205
|
+
export declare const PlanFieldSchema: z.ZodObject<{
|
|
206
|
+
name: z.ZodString;
|
|
207
|
+
type: z.ZodString;
|
|
208
|
+
enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
209
|
+
}, z.core.$strip>;
|
|
210
|
+
export declare const PlanRelationSchema: z.ZodObject<{
|
|
211
|
+
name: z.ZodString;
|
|
212
|
+
model: z.ZodString;
|
|
213
|
+
}, z.core.$strip>;
|
|
214
|
+
export declare const PlanEntitySchema: z.ZodObject<{
|
|
215
|
+
name: z.ZodString;
|
|
216
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
217
|
+
name: z.ZodString;
|
|
218
|
+
type: z.ZodString;
|
|
219
|
+
enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
220
|
+
}, z.core.$strip>>;
|
|
221
|
+
tenantScoped: z.ZodBoolean;
|
|
222
|
+
relations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
223
|
+
name: z.ZodString;
|
|
224
|
+
model: z.ZodString;
|
|
225
|
+
}, z.core.$strip>>>;
|
|
226
|
+
}, z.core.$strip>;
|
|
227
|
+
export declare const PlanStepKindSchema: z.ZodEnum<{
|
|
228
|
+
audit: "audit";
|
|
229
|
+
docs: "docs";
|
|
230
|
+
generator: "generator";
|
|
231
|
+
migration: "migration";
|
|
232
|
+
other: "other";
|
|
233
|
+
permissions: "permissions";
|
|
234
|
+
routes: "routes";
|
|
235
|
+
schema: "schema";
|
|
236
|
+
service: "service";
|
|
237
|
+
test: "test";
|
|
238
|
+
}>;
|
|
239
|
+
export declare const PlanStepSchema: z.ZodObject<{
|
|
240
|
+
order: z.ZodNumber;
|
|
241
|
+
title: z.ZodString;
|
|
242
|
+
kind: z.ZodEnum<{
|
|
243
|
+
audit: "audit";
|
|
244
|
+
docs: "docs";
|
|
245
|
+
generator: "generator";
|
|
246
|
+
migration: "migration";
|
|
247
|
+
other: "other";
|
|
248
|
+
permissions: "permissions";
|
|
249
|
+
routes: "routes";
|
|
250
|
+
schema: "schema";
|
|
251
|
+
service: "service";
|
|
252
|
+
test: "test";
|
|
253
|
+
}>;
|
|
254
|
+
detail: z.ZodString;
|
|
255
|
+
command: z.ZodOptional<z.ZodString>;
|
|
256
|
+
files: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
257
|
+
}, z.core.$strip>;
|
|
258
|
+
export declare const ArchitecturePlanSchema: z.ZodObject<{
|
|
259
|
+
schemaVersion: z.ZodDefault<z.ZodNumber>;
|
|
260
|
+
request: z.ZodString;
|
|
261
|
+
summary: z.ZodString;
|
|
262
|
+
entities: z.ZodArray<z.ZodObject<{
|
|
263
|
+
name: z.ZodString;
|
|
264
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
265
|
+
name: z.ZodString;
|
|
266
|
+
type: z.ZodString;
|
|
267
|
+
enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
268
|
+
}, z.core.$strip>>;
|
|
269
|
+
tenantScoped: z.ZodBoolean;
|
|
270
|
+
relations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
271
|
+
name: z.ZodString;
|
|
272
|
+
model: z.ZodString;
|
|
273
|
+
}, z.core.$strip>>>;
|
|
274
|
+
}, z.core.$strip>>;
|
|
275
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
276
|
+
order: z.ZodNumber;
|
|
277
|
+
title: z.ZodString;
|
|
278
|
+
kind: z.ZodEnum<{
|
|
279
|
+
audit: "audit";
|
|
280
|
+
docs: "docs";
|
|
281
|
+
generator: "generator";
|
|
282
|
+
migration: "migration";
|
|
283
|
+
other: "other";
|
|
284
|
+
permissions: "permissions";
|
|
285
|
+
routes: "routes";
|
|
286
|
+
schema: "schema";
|
|
287
|
+
service: "service";
|
|
288
|
+
test: "test";
|
|
289
|
+
}>;
|
|
290
|
+
detail: z.ZodString;
|
|
291
|
+
command: z.ZodOptional<z.ZodString>;
|
|
292
|
+
files: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
293
|
+
}, z.core.$strip>>;
|
|
294
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
295
|
+
auditEvents: z.ZodArray<z.ZodString>;
|
|
296
|
+
tenantScoped: z.ZodBoolean;
|
|
297
|
+
warnings: z.ZodArray<z.ZodString>;
|
|
298
|
+
}, z.core.$strip>;
|
|
299
|
+
export declare const GeneratedFileSchema: z.ZodObject<{
|
|
300
|
+
path: z.ZodString;
|
|
301
|
+
content: z.ZodString;
|
|
302
|
+
}, z.core.$strip>;
|
|
303
|
+
export declare const SchemaMergeSchema: z.ZodObject<{
|
|
304
|
+
path: z.ZodString;
|
|
305
|
+
found: z.ZodBoolean;
|
|
306
|
+
merged: z.ZodArray<z.ZodString>;
|
|
307
|
+
skipped: z.ZodArray<z.ZodString>;
|
|
308
|
+
written: z.ZodBoolean;
|
|
309
|
+
}, z.core.$strip>;
|
|
310
|
+
export declare const MigrationSchema: z.ZodObject<{
|
|
311
|
+
ok: z.ZodBoolean;
|
|
312
|
+
output: z.ZodString;
|
|
313
|
+
}, z.core.$strip>;
|
|
314
|
+
export declare const ResourceBuildSchema: z.ZodObject<{
|
|
315
|
+
name: z.ZodString;
|
|
316
|
+
prisma: z.ZodBoolean;
|
|
317
|
+
softDelete: z.ZodBoolean;
|
|
318
|
+
files: z.ZodArray<z.ZodObject<{
|
|
319
|
+
path: z.ZodString;
|
|
320
|
+
content: z.ZodString;
|
|
321
|
+
}, z.core.$strip>>;
|
|
322
|
+
augmented: z.ZodBoolean;
|
|
323
|
+
guarded: z.ZodBoolean;
|
|
324
|
+
audited: z.ZodBoolean;
|
|
325
|
+
written: z.ZodArray<z.ZodString>;
|
|
326
|
+
registered: z.ZodBoolean;
|
|
327
|
+
note: z.ZodOptional<z.ZodString>;
|
|
328
|
+
}, z.core.$strip>;
|
|
329
|
+
export declare const ReviewStatusSchema: z.ZodEnum<{
|
|
330
|
+
fail: "fail";
|
|
331
|
+
pass: "pass";
|
|
332
|
+
warn: "warn";
|
|
333
|
+
}>;
|
|
334
|
+
export declare const ReviewItemSchema: z.ZodObject<{
|
|
335
|
+
label: z.ZodString;
|
|
336
|
+
status: z.ZodEnum<{
|
|
337
|
+
fail: "fail";
|
|
338
|
+
pass: "pass";
|
|
339
|
+
warn: "warn";
|
|
340
|
+
}>;
|
|
341
|
+
detail: z.ZodString;
|
|
342
|
+
}, z.core.$strip>;
|
|
343
|
+
export declare const ReviewResultSchema: z.ZodObject<{
|
|
344
|
+
items: z.ZodArray<z.ZodObject<{
|
|
345
|
+
label: z.ZodString;
|
|
346
|
+
status: z.ZodEnum<{
|
|
347
|
+
fail: "fail";
|
|
348
|
+
pass: "pass";
|
|
349
|
+
warn: "warn";
|
|
350
|
+
}>;
|
|
351
|
+
detail: z.ZodString;
|
|
352
|
+
}, z.core.$strip>>;
|
|
353
|
+
ok: z.ZodBoolean;
|
|
354
|
+
}, z.core.$strip>;
|
|
355
|
+
export declare const FilePreviewSchema: z.ZodObject<{
|
|
356
|
+
path: z.ZodString;
|
|
357
|
+
action: z.ZodEnum<{
|
|
358
|
+
create: "create";
|
|
359
|
+
overwrite: "overwrite";
|
|
360
|
+
}>;
|
|
361
|
+
diff: z.ZodString;
|
|
362
|
+
}, z.core.$strip>;
|
|
363
|
+
export declare const MakePreviewSchema: z.ZodObject<{
|
|
364
|
+
perFile: z.ZodArray<z.ZodObject<{
|
|
365
|
+
path: z.ZodString;
|
|
366
|
+
action: z.ZodEnum<{
|
|
367
|
+
create: "create";
|
|
368
|
+
overwrite: "overwrite";
|
|
369
|
+
}>;
|
|
370
|
+
diff: z.ZodString;
|
|
371
|
+
}, z.core.$strip>>;
|
|
372
|
+
clashes: z.ZodArray<z.ZodString>;
|
|
373
|
+
}, z.core.$strip>;
|
|
374
|
+
export declare const MakeResultSchema: z.ZodObject<{
|
|
375
|
+
schemaVersion: z.ZodDefault<z.ZodNumber>;
|
|
376
|
+
request: z.ZodString;
|
|
377
|
+
dryRun: z.ZodBoolean;
|
|
378
|
+
resources: z.ZodArray<z.ZodObject<{
|
|
379
|
+
name: z.ZodString;
|
|
380
|
+
prisma: z.ZodBoolean;
|
|
381
|
+
softDelete: z.ZodBoolean;
|
|
382
|
+
files: z.ZodArray<z.ZodObject<{
|
|
383
|
+
path: z.ZodString;
|
|
384
|
+
content: z.ZodString;
|
|
385
|
+
}, z.core.$strip>>;
|
|
386
|
+
augmented: z.ZodBoolean;
|
|
387
|
+
guarded: z.ZodBoolean;
|
|
388
|
+
audited: z.ZodBoolean;
|
|
389
|
+
written: z.ZodArray<z.ZodString>;
|
|
390
|
+
registered: z.ZodBoolean;
|
|
391
|
+
note: z.ZodOptional<z.ZodString>;
|
|
392
|
+
}, z.core.$strip>>;
|
|
393
|
+
schema: z.ZodOptional<z.ZodObject<{
|
|
394
|
+
path: z.ZodString;
|
|
395
|
+
found: z.ZodBoolean;
|
|
396
|
+
merged: z.ZodArray<z.ZodString>;
|
|
397
|
+
skipped: z.ZodArray<z.ZodString>;
|
|
398
|
+
written: z.ZodBoolean;
|
|
399
|
+
}, z.core.$strip>>;
|
|
400
|
+
migration: z.ZodOptional<z.ZodObject<{
|
|
401
|
+
ok: z.ZodBoolean;
|
|
402
|
+
output: z.ZodString;
|
|
403
|
+
}, z.core.$strip>>;
|
|
404
|
+
followUps: z.ZodArray<z.ZodString>;
|
|
405
|
+
review: z.ZodObject<{
|
|
406
|
+
items: z.ZodArray<z.ZodObject<{
|
|
407
|
+
label: z.ZodString;
|
|
408
|
+
status: z.ZodEnum<{
|
|
409
|
+
fail: "fail";
|
|
410
|
+
pass: "pass";
|
|
411
|
+
warn: "warn";
|
|
412
|
+
}>;
|
|
413
|
+
detail: z.ZodString;
|
|
414
|
+
}, z.core.$strip>>;
|
|
415
|
+
ok: z.ZodBoolean;
|
|
416
|
+
}, z.core.$strip>;
|
|
417
|
+
preview: z.ZodOptional<z.ZodObject<{
|
|
418
|
+
perFile: z.ZodArray<z.ZodObject<{
|
|
419
|
+
path: z.ZodString;
|
|
420
|
+
action: z.ZodEnum<{
|
|
421
|
+
create: "create";
|
|
422
|
+
overwrite: "overwrite";
|
|
423
|
+
}>;
|
|
424
|
+
diff: z.ZodString;
|
|
425
|
+
}, z.core.$strip>>;
|
|
426
|
+
clashes: z.ZodArray<z.ZodString>;
|
|
427
|
+
}, z.core.$strip>>;
|
|
428
|
+
}, z.core.$strip>;
|
|
429
|
+
export declare const ReviewIssueSchema: z.ZodObject<{
|
|
430
|
+
dimension: z.ZodString;
|
|
431
|
+
severity: z.ZodEnum<{
|
|
432
|
+
error: "error";
|
|
433
|
+
warning: "warning";
|
|
434
|
+
}>;
|
|
435
|
+
message: z.ZodString;
|
|
436
|
+
}, z.core.$strip>;
|
|
437
|
+
export declare const AgentReviewSchema: z.ZodObject<{
|
|
438
|
+
approved: z.ZodBoolean;
|
|
439
|
+
summary: z.ZodString;
|
|
440
|
+
issues: z.ZodArray<z.ZodObject<{
|
|
441
|
+
dimension: z.ZodString;
|
|
442
|
+
severity: z.ZodEnum<{
|
|
443
|
+
error: "error";
|
|
444
|
+
warning: "warning";
|
|
445
|
+
}>;
|
|
446
|
+
message: z.ZodString;
|
|
447
|
+
}, z.core.$strip>>;
|
|
448
|
+
}, z.core.$strip>;
|
|
449
|
+
/**
|
|
450
|
+
* Convert one of the exported zod schemas to JSON Schema (Draft 2020-12), for an
|
|
451
|
+
* out-of-process consumer to advertise as an MCP tool `inputSchema`/`outputSchema`.
|
|
452
|
+
*/
|
|
453
|
+
export declare function toJsonSchema(schema: z.ZodType): Record<string, unknown>;
|