@duckcodeailabs/dql-agent 1.13.2 → 1.13.3

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.
@@ -0,0 +1,46 @@
1
+ import type { AppBuildFrame, AppBuildRequirement, AppBuildSourcePolicy } from '@duckcodeailabs/dql-core';
2
+ import type { AppSourceCatalogRecord } from './app-source-catalog.js';
3
+ export type AppBuilderComponentRole = AppBuildRequirement['role'];
4
+ export type AppBuilderComponentView = 'kpi' | 'line' | 'bar' | 'table';
5
+ export interface AppBuilderPlannedComponent {
6
+ id: string;
7
+ title: string;
8
+ sourceId: string;
9
+ requirementIds: string[];
10
+ role: AppBuilderComponentRole;
11
+ view: AppBuilderComponentView;
12
+ rationale: string;
13
+ }
14
+ export interface AppBuilderBuildBrief {
15
+ version: 1;
16
+ planningMode: 'ai' | 'deterministic_fallback';
17
+ frame: AppBuildFrame;
18
+ requirements: AppBuildRequirement[];
19
+ components: AppBuilderPlannedComponent[];
20
+ selectedSourceIds: string[];
21
+ candidateSourceIds: string[];
22
+ warnings: string[];
23
+ }
24
+ export interface AppBuilderPlannerCompletionInput {
25
+ system: string;
26
+ user: string;
27
+ }
28
+ export type AppBuilderPlannerCompletion = (input: AppBuilderPlannerCompletionInput) => Promise<string | undefined>;
29
+ export interface PlanAppBuildBriefInput {
30
+ prompt: string;
31
+ candidates: AppSourceCatalogRecord[];
32
+ sourcePolicy: AppBuildSourcePolicy;
33
+ domain?: string;
34
+ audience?: string;
35
+ complete?: AppBuilderPlannerCompletion;
36
+ }
37
+ /**
38
+ * App-specific orchestration boundary. It shares a host provider adapter but
39
+ * owns a structured, stateful build brief rather than invoking Ask AI's answer
40
+ * state machine. At most one provider call is made and it can reference only
41
+ * the supplied candidate IDs.
42
+ *
43
+ * Acceptance: PRD-007, AGT-026.
44
+ */
45
+ export declare function planAppBuildBrief(input: PlanAppBuildBriefInput): Promise<AppBuilderBuildBrief>;
46
+ //# sourceMappingURL=app-builder-orchest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,MAAM,CAAC;IACf,UAAU,EAAE,sBAAsB,EAAE,CAAC;IACrC,YAAY,EAAE,oBAAoB,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,2BAA2B,CAAC;CACxC;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAqCpG"}
@@ -0,0 +1,361 @@
1
+ /**
2
+ * App-specific orchestration boundary. It shares a host provider adapter but
3
+ * owns a structured, stateful build brief rather than invoking Ask AI's answer
4
+ * state machine. At most one provider call is made and it can reference only
5
+ * the supplied candidate IDs.
6
+ *
7
+ * Acceptance: PRD-007, AGT-026.
8
+ */
9
+ export async function planAppBuildBrief(input) {
10
+ const prompt = input.prompt.trim();
11
+ if (!prompt)
12
+ throw new Error('App build prompt is required.');
13
+ const candidates = input.candidates.slice(0, 12);
14
+ if (!input.complete || candidates.length === 0)
15
+ return deterministicBrief(input, candidates);
16
+ let raw;
17
+ try {
18
+ raw = await input.complete({
19
+ system: appBuilderSystemPrompt(),
20
+ user: appBuilderUserPrompt(input, candidates),
21
+ });
22
+ }
23
+ catch {
24
+ return deterministicBrief(input, candidates, ['The configured App planning provider was unavailable; deterministic matching was used.']);
25
+ }
26
+ const parsed = parsePlannerJson(raw);
27
+ if (!parsed) {
28
+ return deterministicBrief(input, candidates, ['The App planning provider returned an invalid build brief; deterministic matching was used.']);
29
+ }
30
+ const allowedIds = new Set(candidates.map((candidate) => candidate.sourceId));
31
+ const requirements = normalizeRequirements(parsed.requirements);
32
+ const requirementIds = new Set(requirements.map((requirement) => requirement.id));
33
+ const components = normalizeComponents(parsed.components, allowedIds, requirementIds);
34
+ if (requirements.length === 0 || components.length === 0) {
35
+ return deterministicBrief(input, candidates, ['The App planning provider did not return grounded requirements and components; deterministic matching was used.']);
36
+ }
37
+ const frame = normalizeFrame(parsed.frame, prompt, input.audience);
38
+ return {
39
+ version: 1,
40
+ planningMode: 'ai',
41
+ frame,
42
+ requirements,
43
+ components,
44
+ selectedSourceIds: Array.from(new Set(components.map((component) => component.sourceId))),
45
+ candidateSourceIds: candidates.map((candidate) => candidate.sourceId),
46
+ warnings: [],
47
+ };
48
+ }
49
+ function deterministicBrief(input, candidates, warnings = []) {
50
+ const requirementQuestions = deterministicRequirementQuestions(input.prompt);
51
+ const requirements = requirementQuestions.map((question, index) => ({
52
+ id: `requirement-${index + 1}`,
53
+ question,
54
+ role: inferRequirementRole(question, index),
55
+ required: true,
56
+ measures: [],
57
+ dimensions: [],
58
+ filters: [],
59
+ }));
60
+ const requirementIdsBySource = new Map();
61
+ const selected = [];
62
+ const addSelection = (candidate, requirementId) => {
63
+ if (!selected.some((item) => item.sourceId === candidate.sourceId))
64
+ selected.push(candidate);
65
+ const ids = requirementIdsBySource.get(candidate.sourceId) ?? [];
66
+ if (!ids.includes(requirementId))
67
+ ids.push(requirementId);
68
+ requirementIdsBySource.set(candidate.sourceId, ids);
69
+ };
70
+ if (requirements.length === 1) {
71
+ for (const candidate of candidates.slice(0, Math.min(3, candidates.length))) {
72
+ addSelection(candidate, requirements[0].id);
73
+ }
74
+ }
75
+ else {
76
+ const used = new Set();
77
+ for (const requirement of requirements) {
78
+ const ranked = candidates
79
+ .map((candidate) => ({ candidate, score: deterministicCandidateScore(requirement.question, candidate) }))
80
+ .filter((entry) => entry.score > 0)
81
+ .sort((left, right) => right.score - left.score || left.candidate.sourceId.localeCompare(right.candidate.sourceId));
82
+ const match = ranked.find((entry) => !used.has(entry.candidate.sourceId)) ?? ranked[0];
83
+ if (!match)
84
+ continue;
85
+ used.add(match.candidate.sourceId);
86
+ addSelection(match.candidate, requirement.id);
87
+ }
88
+ }
89
+ const components = selected.map((candidate, index) => {
90
+ const requirementIds = requirementIdsBySource.get(candidate.sourceId) ?? [];
91
+ const primaryRequirement = requirements.find((requirement) => requirementIds.includes(requirement.id));
92
+ return {
93
+ id: `component-${index + 1}`,
94
+ title: candidate.title,
95
+ sourceId: candidate.sourceId,
96
+ requirementIds,
97
+ role: primaryRequirement?.role ?? inferRole(candidate, index),
98
+ view: inferView(candidate, index),
99
+ rationale: candidate.reasons[0] ?? `Matched ${candidate.title} from the App source catalog.`,
100
+ };
101
+ });
102
+ return {
103
+ version: 1,
104
+ planningMode: 'deterministic_fallback',
105
+ frame: {
106
+ goal: input.prompt.trim(),
107
+ decision: input.prompt.trim(),
108
+ audience: input.audience?.trim() || 'App users',
109
+ metrics: Array.from(new Set(selected.flatMap((candidate) => candidate.capabilities.measures))),
110
+ dimensions: Array.from(new Set(selected.flatMap((candidate) => candidate.capabilities.dimensions))),
111
+ filters: Array.from(new Set(selected.flatMap((candidate) => candidate.capabilities.filters))),
112
+ desiredOutput: 'Interactive analytical App',
113
+ },
114
+ requirements,
115
+ components,
116
+ selectedSourceIds: selected.map((candidate) => candidate.sourceId),
117
+ candidateSourceIds: candidates.map((candidate) => candidate.sourceId),
118
+ warnings,
119
+ };
120
+ }
121
+ const DETERMINISTIC_REQUIREMENT_STOP_WORDS = new Set([
122
+ 'a', 'an', 'analytics', 'and', 'app', 'application', 'available', 'block',
123
+ 'build', 'certified', 'create', 'dashboard', 'data', 'dql', 'draft', 'for',
124
+ 'from', 'governed', 'in', 'last', 'me', 'of', 'on', 'please', 'report',
125
+ 'source', 'table', 'the', 'to', 'using', 'view', 'warehouse', 'with',
126
+ ]);
127
+ function deterministicRequirementQuestions(prompt) {
128
+ const trimmed = prompt.trim().replace(/[.!?]+$/, '');
129
+ const focusMatch = trimmed.match(/\b(?:showing|including|that shows?|that tracks?|that monitors?)\b\s+(.+)$/i);
130
+ const focus = (focusMatch?.[1] ?? trimmed.replace(/^(?:please\s+)?(?:build|create|make|design)\s+(?:me\s+)?/i, '')).trim();
131
+ const parts = focus.split(/\s*(?:,|;|\band\b)\s*/i)
132
+ .map((part) => part.replace(/^(?:and\s+)?/i, '').trim())
133
+ .filter((part) => part.length > 2);
134
+ if (parts.length < 2 || parts.length > 6 || parts.some((part) => deterministicWords(part).size === 0))
135
+ return [trimmed];
136
+ return Array.from(new Set(parts.map((part) => part[0].toUpperCase() + part.slice(1))));
137
+ }
138
+ function deterministicWords(value) {
139
+ return new Set(value.toLowerCase().split(/[^a-z0-9]+/)
140
+ .map((token) => token.length > 3 && token.endsWith('s') ? token.slice(0, -1) : token)
141
+ .filter((token) => token.length > 1 && !DETERMINISTIC_REQUIREMENT_STOP_WORDS.has(token)));
142
+ }
143
+ function deterministicCandidateScore(question, candidate) {
144
+ const required = deterministicWords(question);
145
+ const title = deterministicWords(candidate.title);
146
+ const evidence = deterministicWords([
147
+ candidate.title,
148
+ candidate.description ?? '',
149
+ candidate.qualifiedIdentity,
150
+ ...candidate.tags,
151
+ ...candidate.capabilities.measures,
152
+ ...candidate.capabilities.dimensions,
153
+ ...candidate.capabilities.filters,
154
+ ].join(' '));
155
+ let score = 0;
156
+ for (const word of required) {
157
+ if (title.has(word))
158
+ score += 4;
159
+ else if (evidence.has(word))
160
+ score += 2;
161
+ }
162
+ return score;
163
+ }
164
+ function inferRequirementRole(question, index) {
165
+ const normalized = question.toLowerCase();
166
+ if (/trend|growth|change|week|month|quarter|year|over time/.test(normalized))
167
+ return 'trend';
168
+ if (/region|segment|category|channel|breakdown|rank|top/.test(normalized))
169
+ return 'breakdown';
170
+ if (/detail|customer|order|record|list/.test(normalized))
171
+ return 'detail';
172
+ return index === 0 ? 'kpi' : 'evidence';
173
+ }
174
+ function appBuilderSystemPrompt() {
175
+ return [
176
+ 'You are the DQL App Builder planner. Produce one stateful analytical App build brief, not a prose answer.',
177
+ 'Use only sourceId values present in the supplied candidate cards. Never invent a source, field, capability, or trust state.',
178
+ 'Draft and review sources may be recommended, but their trust must not be upgraded.',
179
+ 'Return JSON only with keys frame, requirements, and components.',
180
+ 'frame: {goal, decision?, audience?, metrics[], dimensions[], grain?, timeRange?, comparison?, filters[], desiredOutput?, clarificationQuestions?}.',
181
+ 'requirements: [{id, question, role, required, measures[], dimensions[], filters[], grain?}]. role is kpi, trend, breakdown, detail, narrative, or evidence.',
182
+ 'components: [{id, title, sourceId, requirementIds[], role, view, rationale}]. view is kpi, line, bar, or table.',
183
+ 'Prefer the fewest components that cover the request. Ask a clarification only when a material choice cannot be made from supplied evidence.',
184
+ ].join('\n');
185
+ }
186
+ function appBuilderUserPrompt(input, candidates) {
187
+ return JSON.stringify({
188
+ request: input.prompt,
189
+ sourcePolicy: input.sourcePolicy,
190
+ domain: input.domain,
191
+ audience: input.audience,
192
+ candidateCards: candidates.map((candidate) => ({
193
+ sourceId: candidate.sourceId,
194
+ qualifiedIdentity: candidate.qualifiedIdentity,
195
+ title: candidate.title,
196
+ description: candidate.description,
197
+ domain: candidate.domain,
198
+ lifecycle: candidate.lifecycle,
199
+ trust: candidate.trust,
200
+ eligibleForLocalPreview: candidate.eligibility.localPreview,
201
+ capabilities: candidate.capabilities,
202
+ evidence: candidate.reasons,
203
+ })),
204
+ });
205
+ }
206
+ function parsePlannerJson(raw) {
207
+ if (!raw?.trim())
208
+ return undefined;
209
+ const start = raw.indexOf('{');
210
+ const end = raw.lastIndexOf('}');
211
+ if (start < 0 || end <= start)
212
+ return undefined;
213
+ try {
214
+ const parsed = JSON.parse(raw.slice(start, end + 1));
215
+ return parsed && typeof parsed === 'object' && !Array.isArray(parsed)
216
+ ? parsed
217
+ : undefined;
218
+ }
219
+ catch {
220
+ return undefined;
221
+ }
222
+ }
223
+ function normalizeFrame(value, prompt, audience) {
224
+ const record = objectValue(value);
225
+ return {
226
+ goal: stringValue(record?.goal) ?? prompt,
227
+ ...(stringValue(record?.decision) ? { decision: stringValue(record?.decision) } : {}),
228
+ audience: stringValue(record?.audience) ?? audience ?? 'App users',
229
+ metrics: stringArray(record?.metrics),
230
+ dimensions: stringArray(record?.dimensions),
231
+ ...(stringValue(record?.grain) ? { grain: stringValue(record?.grain) } : {}),
232
+ ...(stringValue(record?.timeRange) ? { timeRange: stringValue(record?.timeRange) } : {}),
233
+ ...(stringValue(record?.comparison) ? { comparison: stringValue(record?.comparison) } : {}),
234
+ filters: stringArray(record?.filters),
235
+ ...(stringValue(record?.desiredOutput) ? { desiredOutput: stringValue(record?.desiredOutput) } : {}),
236
+ ...normalizeClarifications(record?.clarificationQuestions),
237
+ };
238
+ }
239
+ function normalizeRequirements(value) {
240
+ if (!Array.isArray(value))
241
+ return [];
242
+ const seen = new Set();
243
+ return value.slice(0, 12).flatMap((raw, index) => {
244
+ const record = objectValue(raw);
245
+ if (!record)
246
+ return [];
247
+ const id = stringValue(record.id) ?? `requirement-${index + 1}`;
248
+ const question = stringValue(record.question);
249
+ const role = appRole(record.role);
250
+ if (!question || !role || seen.has(id))
251
+ return [];
252
+ seen.add(id);
253
+ return [{
254
+ id,
255
+ question,
256
+ role,
257
+ required: record.required !== false,
258
+ measures: stringArray(record.measures),
259
+ dimensions: stringArray(record.dimensions),
260
+ filters: stringArray(record.filters),
261
+ ...(stringValue(record.grain) ? { grain: stringValue(record.grain) } : {}),
262
+ }];
263
+ });
264
+ }
265
+ function normalizeComponents(value, allowedSourceIds, requirementIds) {
266
+ if (!Array.isArray(value))
267
+ return [];
268
+ const seen = new Set();
269
+ return value.slice(0, 16).flatMap((raw, index) => {
270
+ const record = objectValue(raw);
271
+ if (!record)
272
+ return [];
273
+ const sourceId = stringValue(record.sourceId);
274
+ const role = appRole(record.role);
275
+ const view = appView(record.view);
276
+ const id = stringValue(record.id) ?? `component-${index + 1}`;
277
+ if (!sourceId || !allowedSourceIds.has(sourceId) || !role || !view || seen.has(id))
278
+ return [];
279
+ seen.add(id);
280
+ return [{
281
+ id,
282
+ title: stringValue(record.title) ?? id,
283
+ sourceId,
284
+ requirementIds: stringArray(record.requirementIds).filter((requirementId) => requirementIds.has(requirementId)),
285
+ role,
286
+ view,
287
+ rationale: stringValue(record.rationale) ?? 'Selected from the bounded App source candidate set.',
288
+ }];
289
+ });
290
+ }
291
+ function normalizeClarifications(value) {
292
+ if (!Array.isArray(value))
293
+ return {};
294
+ const questions = value.slice(0, 3).flatMap((raw, index) => {
295
+ const record = objectValue(raw);
296
+ const question = stringValue(record?.question);
297
+ if (!record || !question || !Array.isArray(record.choices))
298
+ return [];
299
+ const choices = record.choices.slice(0, 5).flatMap((choiceRaw, choiceIndex) => {
300
+ const choice = objectValue(choiceRaw);
301
+ const label = stringValue(choice?.label);
302
+ if (!choice || !label)
303
+ return [];
304
+ return [{
305
+ id: stringValue(choice.id) ?? `choice-${choiceIndex + 1}`,
306
+ label,
307
+ ...(stringValue(choice.description) ? { description: stringValue(choice.description) } : {}),
308
+ }];
309
+ });
310
+ if (choices.length < 2)
311
+ return [];
312
+ return [{
313
+ id: stringValue(record.id) ?? `clarification-${index + 1}`,
314
+ question,
315
+ choices,
316
+ required: record.required !== false,
317
+ ...(stringValue(record.answerId) ? { answerId: stringValue(record.answerId) } : {}),
318
+ }];
319
+ });
320
+ return questions.length ? { clarificationQuestions: questions } : {};
321
+ }
322
+ function inferRole(candidate, index) {
323
+ const text = `${candidate.title} ${candidate.capabilities.chartType ?? ''}`.toLowerCase();
324
+ if (index === 0 && candidate.capabilities.measures.length)
325
+ return 'kpi';
326
+ if (/trend|time|date|week|month|line/.test(text))
327
+ return 'trend';
328
+ if (/region|segment|category|channel|bar|rank/.test(text))
329
+ return 'breakdown';
330
+ return 'detail';
331
+ }
332
+ function inferView(candidate, index) {
333
+ const allowed = candidate.capabilities.allowedVisualizations ?? [];
334
+ const preferred = candidate.capabilities.chartType ?? allowed[0] ?? '';
335
+ if (/line|area/.test(preferred))
336
+ return 'line';
337
+ if (/bar|column|rank/.test(preferred))
338
+ return 'bar';
339
+ if (index === 0 && candidate.capabilities.measures.length)
340
+ return 'kpi';
341
+ return 'table';
342
+ }
343
+ function appRole(value) {
344
+ return value === 'kpi' || value === 'trend' || value === 'breakdown' || value === 'detail'
345
+ || value === 'narrative' || value === 'evidence' ? value : undefined;
346
+ }
347
+ function appView(value) {
348
+ return value === 'kpi' || value === 'line' || value === 'bar' || value === 'table' ? value : undefined;
349
+ }
350
+ function objectValue(value) {
351
+ return value && typeof value === 'object' && !Array.isArray(value) ? value : undefined;
352
+ }
353
+ function stringValue(value) {
354
+ return typeof value === 'string' && value.trim() ? value.trim() : undefined;
355
+ }
356
+ function stringArray(value) {
357
+ return Array.isArray(value)
358
+ ? Array.from(new Set(value.filter((item) => typeof item === 'string' && Boolean(item.trim())).map((item) => item.trim())))
359
+ : [];
360
+ }
361
+ //# sourceMappingURL=app-builder-orchestrator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-builder-orchestrator.js","sourceRoot":"","sources":["../src/app-builder-orchestrator.ts"],"names":[],"mappings":"AAkDA;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,KAA6B;IACnE,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACnC,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAC9D,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACjD,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,kBAAkB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAE7F,IAAI,GAAuB,CAAC;IAC5B,IAAI,CAAC;QACH,GAAG,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC;YACzB,MAAM,EAAE,sBAAsB,EAAE;YAChC,IAAI,EAAE,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC;SAC9C,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC,wFAAwF,CAAC,CAAC,CAAC;IAC3I,CAAC;IACD,MAAM,MAAM,GAAG,gBAAgB,CAAC,GAA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AAK,KAAK,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACzG,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAgC,CAAC,CAAC,CAAC,SAAS,CAAC;AACpH,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9E,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACzB,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAC1I,CAAC,CAAC,EAAE,CAAC;AACT,CAAC"}
@@ -0,0 +1,78 @@
1
+ import type { AppBuildSourceCapabilities, AppBuildSourceLifecycle, AppBuildSourcePolicy } from '@duckcodeailabs/dql-core';
2
+ export type AppSourceTrust = 'certified' | 'review_required';
3
+ export interface AppSourceEligibility {
4
+ discoverable: boolean;
5
+ localPreview: boolean;
6
+ projectPublish: boolean;
7
+ reasonCodes: string[];
8
+ }
9
+ export interface AppSourceCatalogRecord {
10
+ sourceId: string;
11
+ qualifiedIdentity: string;
12
+ sourceRevision: string;
13
+ snapshotId: string;
14
+ kind: 'block';
15
+ lifecycle: AppBuildSourceLifecycle;
16
+ trust: AppSourceTrust;
17
+ executable: boolean;
18
+ name: string;
19
+ title: string;
20
+ description?: string;
21
+ domain?: string;
22
+ owner?: string;
23
+ sourcePath: string;
24
+ executionRef: string;
25
+ tags: string[];
26
+ capabilities: AppBuildSourceCapabilities;
27
+ eligibility: AppSourceEligibility;
28
+ score?: number;
29
+ reasons: string[];
30
+ }
31
+ export interface AppSourceCatalogQuery {
32
+ query?: string;
33
+ cursor?: string;
34
+ limit?: number;
35
+ lifecycles?: AppBuildSourceLifecycle[];
36
+ domains?: string[];
37
+ kinds?: Array<'block'>;
38
+ sourcePolicy?: AppBuildSourcePolicy;
39
+ includeDeprecated?: boolean;
40
+ }
41
+ export interface AppSourceCatalogPage {
42
+ version: 1;
43
+ snapshotId: string;
44
+ items: AppSourceCatalogRecord[];
45
+ nextCursor?: string;
46
+ total: number;
47
+ pageSize: number;
48
+ facets: {
49
+ lifecycles: Record<string, number>;
50
+ domains: Record<string, number>;
51
+ kinds: Record<string, number>;
52
+ };
53
+ }
54
+ /**
55
+ * Query the immutable project snapshot used by the App Builder request. The
56
+ * caller is responsible for preparing/activating the project snapshot once;
57
+ * this function performs no source-artifact reads.
58
+ *
59
+ * Acceptance: PRD-007, AGT-026, API-014, PERF-003.
60
+ */
61
+ export declare function queryAppSourceCatalog(projectRoot: string, input?: AppSourceCatalogQuery): AppSourceCatalogPage;
62
+ /** Exact, snapshot-bound batch resolution used before server composition. */
63
+ export declare function resolveAppSourceCatalogRecords(projectRoot: string, sourceIds: string[], sourcePolicy?: AppBuildSourcePolicy): {
64
+ snapshotId: string;
65
+ items: AppSourceCatalogRecord[];
66
+ missingSourceIds: string[];
67
+ };
68
+ /** Return a bounded candidate-card set for one App-specific planning call. */
69
+ export declare function shortlistAppSources(projectRoot: string, prompt: string, options?: {
70
+ sourcePolicy?: AppBuildSourcePolicy;
71
+ limit?: number;
72
+ domains?: string[];
73
+ }): AppSourceCatalogPage;
74
+ export declare class AppSourceCatalogError extends Error {
75
+ readonly code: string;
76
+ constructor(code: string, message: string);
77
+ }
78
+ //# sourceMappingURL=app-source-catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-source-catalog.d.ts","sourceRoot":"","sources":["../src/app-source-catalog.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,0BAA0B,EAC1B,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAMlC,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,iBAAiB,CAAC;AAE7D,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,uBAAuB,CAAC;IACnC,KAAK,EAAE,cAAc,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,YAAY,EAAE,0BAA0B,CAAC;IACzC,WAAW,EAAE,oBAAoB,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB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