@dataparade/cli 0.0.13 → 0.0.15
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/package.json +2 -2
- package/dist/src/ai-enrichment/candidate-selector.d.ts +4 -4
- package/dist/src/ai-enrichment/candidate-selector.js +37 -32
- package/dist/src/ai-enrichment/fallbacks.js +130 -3
- package/dist/src/ai-enrichment/merge-rules.d.ts +3 -3
- package/dist/src/ai-enrichment/merge-rules.js +118 -40
- package/dist/src/ai-enrichment/prompts/provider-enrichment-prompts.d.ts +2 -2
- package/dist/src/ai-enrichment/prompts/provider-enrichment-prompts.js +3 -3
- package/dist/src/ai-enrichment/property-priority.d.ts +5 -0
- package/dist/src/ai-enrichment/property-priority.js +23 -0
- package/dist/src/ai-enrichment/provider-prompt.d.ts +5 -5
- package/dist/src/ai-enrichment/provider-prompt.js +24 -19
- package/dist/src/ai-enrichment/red-flags.d.ts +46 -0
- package/dist/src/ai-enrichment/red-flags.js +365 -0
- package/dist/src/ai-enrichment/third-party-evidence.d.ts +3 -3
- package/dist/src/ai-enrichment/third-party-evidence.js +96 -93
- package/dist/src/cli.d.ts +1 -1
- package/dist/src/cli.js +236 -143
- package/dist/src/core/pipeline/orchestrator-result.d.ts +9 -1
- package/dist/src/core/pipeline/orchestrator.d.ts +2 -2
- package/dist/src/core/pipeline/scan-pipeline.d.ts +2 -2
- package/dist/src/core/pipeline/scan-pipeline.js +46 -34
- package/dist/src/core/schema/dataflow-wrapper.schema.d.ts +33 -1
- package/dist/src/core/schema/dataflow-wrapper.schema.js +19 -3
- package/dist/src/output/json.d.ts +18 -3
- package/dist/src/output/json.js +14 -5
- package/dist/src/platform-api/cli-scan-failure-report.d.ts +9 -0
- package/dist/src/platform-api/cli-scan-failure-report.js +23 -0
- package/dist/tests/schema/dataflow-wrapper.schema.spec.js +142 -21
- package/dist/tests/unit/ai-enrichment/candidate-selector.spec.js +80 -49
- package/dist/tests/unit/ai-enrichment/fallbacks.spec.js +78 -0
- package/dist/tests/unit/ai-enrichment/merge-rules.spec.js +510 -264
- package/dist/tests/unit/ai-enrichment/provider-prompt.spec.js +80 -77
- package/dist/tests/unit/ai-enrichment/red-flags.spec.js +227 -0
- package/dist/tests/unit/ai-enrichment/third-party-evidence.spec.js +38 -34
- package/dist/tests/unit/cli/scan-command-e2e-backend-lambda-orphan.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-command-e2e-backend-lambda-orphan.spec.js +60 -0
- package/dist/tests/unit/cli/scan-command-e2e-occupied-section-hubs.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-command-e2e-occupied-section-hubs.spec.js +58 -0
- package/dist/tests/unit/cli/scan-command-e2e-ruby-basic.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-command-e2e-ruby-basic.spec.js +46 -0
- package/dist/tests/unit/cli/scan-quota-flow.spec.js +57 -45
- package/dist/tests/unit/platform-api/cli-scan-failure-report.spec.d.ts +1 -0
- package/dist/tests/unit/platform-api/cli-scan-failure-report.spec.js +25 -0
- package/package.json +2 -2
- package/dist/tests/fixtures/e2e-ts-sample/db-client-import.d.ts +0 -2
- package/dist/tests/fixtures/e2e-ts-sample/db-client-import.js +0 -8
- package/dist/tests/fixtures/e2e-ts-sample/db.d.ts +0 -3
- package/dist/tests/fixtures/e2e-ts-sample/db.js +0 -7
- package/dist/tests/fixtures/e2e-ts-sample/external-api.d.ts +0 -1
- package/dist/tests/fixtures/e2e-ts-sample/external-api.js +0 -18
- package/dist/tests/fixtures/e2e-ts-sample/pg-client.d.ts +0 -3
- package/dist/tests/fixtures/e2e-ts-sample/pg-client.js +0 -7
- package/dist/tests/fixtures/e2e-ts-sample/server.d.ts +0 -14
- package/dist/tests/fixtures/e2e-ts-sample/server.js +0 -4
- package/dist/tests/fixtures/e2e-ts-sentry-route-env/server.js +0 -24
- package/dist/tests/fixtures/ingest-basic/src/index.d.ts +0 -1
- package/dist/tests/fixtures/ingest-basic/src/index.js +0 -6
- package/dist/tests/fixtures/mixed-language-basic/api.d.ts +0 -2
- package/dist/tests/fixtures/mixed-language-basic/api.js +0 -12
- package/dist/tests/fixtures/monorepo-app-plus-terraform/packages/app/app/route.d.ts +0 -1
- package/dist/tests/fixtures/monorepo-app-plus-terraform/packages/app/app/route.js +0 -6
- package/dist/tests/fixtures/monorepo-front-back-sections/backend/app/route.d.ts +0 -1
- package/dist/tests/fixtures/monorepo-front-back-sections/backend/app/route.js +0 -6
- package/dist/tests/fixtures/monorepo-front-back-sections/frontend/app/route.d.ts +0 -1
- package/dist/tests/fixtures/monorepo-front-back-sections/frontend/app/route.js +0 -7
- package/dist/tests/fixtures/typescript-basic/app/route.d.ts +0 -1
- package/dist/tests/fixtures/typescript-basic/app/route.js +0 -7
- package/dist/tests/fixtures/typescript-basic/db-client-import.d.ts +0 -2
- package/dist/tests/fixtures/typescript-basic/db-client-import.js +0 -8
- package/dist/tests/fixtures/typescript-basic/db.d.ts +0 -3
- package/dist/tests/fixtures/typescript-basic/db.js +0 -7
- package/dist/tests/fixtures/typescript-basic/external-api.d.ts +0 -1
- package/dist/tests/fixtures/typescript-basic/external-api.js +0 -18
- package/dist/tests/fixtures/typescript-basic/pg-client.d.ts +0 -3
- package/dist/tests/fixtures/typescript-basic/pg-client.js +0 -7
- package/dist/tests/fixtures/typescript-basic/server.d.ts +0 -14
- package/dist/tests/fixtures/typescript-basic/server.js +0 -4
- package/dist/tests/fixtures/typescript-dependency-manifests-basic/src/index.d.ts +0 -0
- package/dist/tests/fixtures/typescript-dependency-manifests-basic/src/index.js +0 -2
- /package/dist/tests/{fixtures/e2e-ts-sentry-route-env/server.d.ts → unit/ai-enrichment/red-flags.spec.d.ts} +0 -0
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* so each provider can compose instructions without duplicating the full contract text.
|
|
4
4
|
*/
|
|
5
5
|
/** Shared system instructions for OpenAI, Anthropic, Gemini, and local/Ollama providers. */
|
|
6
|
-
export declare const AI_PROVIDER_SYSTEM_PROMPT = "You are enriching a DataParade data-flow scan. Respond with a JSON object matching the response schema: top-level key \"proposals\" (array). No markdown fences.\n\nPrimary goal: **only** populate node properties when each value is **directly supported** by code or config text in `relevantFileContents` (when present) or by explicit paths in `detectedFrom` / `sourceLocations` for that component. If support is weak, indirect, or guessed, **omit** the property. It is always valid to return **zero** proposals
|
|
6
|
+
export declare const AI_PROVIDER_SYSTEM_PROMPT = "You are enriching a DataParade data-flow scan. Respond with a JSON object matching the response schema: top-level key \"proposals\" (array). No markdown fences.\n\nPrimary goal: **only** populate node properties when each value is **directly supported** by code or config text in `relevantFileContents` (when present) or by explicit paths in `detectedFrom` / `sourceLocations` for that component. Walk every key in `sparsePropertyKeys` and emit every key you can directly cite. If support is weak, indirect, or guessed, **omit** the property. It is always valid to return **zero** proposals when no sparse key is grounded.\n\nUse **ComponentPatch only** in the proposals array (schema may list a flow variant for compatibility; omit it).\n\nComponentPatch (property filling):\n- kind: \"component_patch\"\n- targetComponentId: string (**must exactly equal one of the componentContext object keys / canonical component IDs**)\n- candidateType: match the user payload agent/candidates (usually \"third_party\" or \"node_property\")\n- setSubType: string \u2014 **required** when componentContext.subType is empty/null; use one taxonomy token: b2b_customer, saas_service, payment_processor, cloud_provider, api_provider, ai_provider, data_provider, government_regulator, partner, ad_network, professional_services, data_processor, other (snake_case). Omit setSubType only when componentContext already has subType.\n- setDescription?: string when helpful\n- setProperties: object with snake_case keys; **only** keys you can tie to cited evidence (see propertyEvidence)\n- propertyEvidence: **required**. Object whose keys are exactly the keys you put in setProperties; each value is a **non-empty** array of evidence rows: { \"filePath\", \"startLine\", \"endLine\", \"reason\" }. Every property must cite where in the repo that value comes from; different properties may cite different files or line ranges.\n- confidence: { \"score\": number 0.72\u20130.95 when patch is well supported, \"band\": \"high\" | \"medium\" | \"low\" }\n- evidence: optional legacy field; prefer propertyEvidence only.\n\nEmit every grounded sparse key. You may split one target component across multiple ComponentPatch proposals when each patch has a different, disjoint set of property keys.\n\n**Do not emit FlowPatch proposals.** Connectivity comes from deterministic scan rules.\n\nRules:\n- Do not contradict propertiesSet unless fixing a clear error with cited proof.\n- `targetComponentId` must be a canonical component ID from componentContext keys only. Never emit file paths or folder names as targetComponentId.\n- **Anti-fabrication:** same as above \u2014 if the fact is not in the cited lines / excerpt text, omit the property.\n- Do not emit placeholder `setProperties` values (null, \"none\", empty arrays, empty strings), and do not set `inference_status`.\n\nsetProperties value shapes: use snake_case keys from sparsePropertyKeys. integration_method must be a string array (e.g. [\"api\"]), never a single string. authentication_method must be one string token (e.g. api_key, oauth_2_0), never an array. processing_purpose must be a string array of taxonomy tokens (authentication, security, analytics, service_provision, payment_processing, marketing, compliance, other, etc.)\u2014snake_case. data_action must be a string array of canonical privacy verbs (collect, generate, store, transform, use, combine, disclose, relay, display, log, delete); a node may have multiple verbs; never emit data_action for actors; propose relay only with cited corroboration. Other multi-value fields must be string arrays, not comma-joined strings.";
|
|
7
7
|
/**
|
|
8
8
|
* Anthropic has no server-side JSON schema for this path; truncated output yields invalid JSON.
|
|
9
9
|
* Reinforce brevity so the model completes a single well-formed object.
|
|
10
10
|
*/
|
|
11
|
-
export declare const ANTHROPIC_ENRICHMENT_SYSTEM_PROMPT_SUPPLEMENT = "Output discipline: Your entire reply must be one parseable JSON object (no markdown). Keep each propertyEvidence \"reason\" to one short clause. If many properties
|
|
11
|
+
export declare const ANTHROPIC_ENRICHMENT_SYSTEM_PROMPT_SUPPLEMENT = "Output discipline: Your entire reply must be one parseable JSON object (no markdown). Keep each propertyEvidence \"reason\" to one short clause. If one component has many grounded properties, chunk them into multiple ComponentPatch proposals with different key sets so the JSON always completes; do not skip grounded keys and never stop mid-string or mid-object.";
|
|
12
12
|
export declare function buildAnthropicEnrichmentSystemPrompt(): string;
|
|
@@ -9,7 +9,7 @@ exports.buildAnthropicEnrichmentSystemPrompt = buildAnthropicEnrichmentSystemPro
|
|
|
9
9
|
/** Shared system instructions for OpenAI, Anthropic, Gemini, and local/Ollama providers. */
|
|
10
10
|
exports.AI_PROVIDER_SYSTEM_PROMPT = `You are enriching a DataParade data-flow scan. Respond with a JSON object matching the response schema: top-level key "proposals" (array). No markdown fences.
|
|
11
11
|
|
|
12
|
-
Primary goal: **only** populate node properties when each value is **directly supported** by code or config text in \`relevantFileContents\` (when present) or by explicit paths in \`detectedFrom\` / \`sourceLocations\` for that component. If support is weak, indirect, or guessed, **omit** the property. It is always valid to return **zero** proposals
|
|
12
|
+
Primary goal: **only** populate node properties when each value is **directly supported** by code or config text in \`relevantFileContents\` (when present) or by explicit paths in \`detectedFrom\` / \`sourceLocations\` for that component. Walk every key in \`sparsePropertyKeys\` and emit every key you can directly cite. If support is weak, indirect, or guessed, **omit** the property. It is always valid to return **zero** proposals when no sparse key is grounded.
|
|
13
13
|
|
|
14
14
|
Use **ComponentPatch only** in the proposals array (schema may list a flow variant for compatibility; omit it).
|
|
15
15
|
|
|
@@ -24,7 +24,7 @@ ComponentPatch (property filling):
|
|
|
24
24
|
- confidence: { "score": number 0.72–0.95 when patch is well supported, "band": "high" | "medium" | "low" }
|
|
25
25
|
- evidence: optional legacy field; prefer propertyEvidence only.
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Emit every grounded sparse key. You may split one target component across multiple ComponentPatch proposals when each patch has a different, disjoint set of property keys.
|
|
28
28
|
|
|
29
29
|
**Do not emit FlowPatch proposals.** Connectivity comes from deterministic scan rules.
|
|
30
30
|
|
|
@@ -39,7 +39,7 @@ setProperties value shapes: use snake_case keys from sparsePropertyKeys. integra
|
|
|
39
39
|
* Anthropic has no server-side JSON schema for this path; truncated output yields invalid JSON.
|
|
40
40
|
* Reinforce brevity so the model completes a single well-formed object.
|
|
41
41
|
*/
|
|
42
|
-
exports.ANTHROPIC_ENRICHMENT_SYSTEM_PROMPT_SUPPLEMENT = `Output discipline: Your entire reply must be one parseable JSON object (no markdown). Keep each propertyEvidence "reason" to one short clause. If many properties
|
|
42
|
+
exports.ANTHROPIC_ENRICHMENT_SYSTEM_PROMPT_SUPPLEMENT = `Output discipline: Your entire reply must be one parseable JSON object (no markdown). Keep each propertyEvidence "reason" to one short clause. If one component has many grounded properties, chunk them into multiple ComponentPatch proposals with different key sets so the JSON always completes; do not skip grounded keys and never stop mid-string or mid-object.`;
|
|
43
43
|
function buildAnthropicEnrichmentSystemPrompt() {
|
|
44
44
|
return `${exports.AI_PROVIDER_SYSTEM_PROMPT}\n\n${exports.ANTHROPIC_ENRICHMENT_SYSTEM_PROMPT_SUPPLEMENT}`;
|
|
45
45
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sortPropertyKeysByPriority = sortPropertyKeysByPriority;
|
|
4
|
+
const TIER_1_PROPERTY_KEYS = new Set([
|
|
5
|
+
'data_action',
|
|
6
|
+
'encrypt_at_rest',
|
|
7
|
+
'encryption_at_rest',
|
|
8
|
+
'authentication_method',
|
|
9
|
+
'authentication_methods',
|
|
10
|
+
'gdpr_role',
|
|
11
|
+
]);
|
|
12
|
+
/**
|
|
13
|
+
* Keep high-value privacy and security fields at the front of bounded prompts.
|
|
14
|
+
* Remaining keys retain deterministic alphabetical order.
|
|
15
|
+
*/
|
|
16
|
+
function sortPropertyKeysByPriority(keys) {
|
|
17
|
+
return [...keys].sort((a, b) => {
|
|
18
|
+
const tierDelta = Number(TIER_1_PROPERTY_KEYS.has(b)) - Number(TIER_1_PROPERTY_KEYS.has(a));
|
|
19
|
+
if (tierDelta !== 0)
|
|
20
|
+
return tierDelta;
|
|
21
|
+
return a.localeCompare(b);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ServiceSection } from
|
|
2
|
-
import type { DetectedComponent } from
|
|
3
|
-
import type { DetectedDataFlow } from
|
|
4
|
-
import type { FileInfo } from
|
|
5
|
-
import type { AiAgentName, AiInferenceCandidate } from
|
|
1
|
+
import type { ServiceSection } from '@dataparade/scanner';
|
|
2
|
+
import type { DetectedComponent } from '../core/types/component';
|
|
3
|
+
import type { DetectedDataFlow } from '../core/types/data-flow';
|
|
4
|
+
import type { FileInfo } from '../core/types/file';
|
|
5
|
+
import type { AiAgentName, AiInferenceCandidate } from './types';
|
|
6
6
|
/**
|
|
7
7
|
* Collect repo-relative paths tied to queued candidates (components and flow endpoints).
|
|
8
8
|
*/
|
|
@@ -7,13 +7,14 @@ exports.slimComponentForLlm = slimComponentForLlm;
|
|
|
7
7
|
exports.buildProviderPromptPayload = buildProviderPromptPayload;
|
|
8
8
|
const sensitive_paths_1 = require("./sensitive-paths");
|
|
9
9
|
const scan_paths_1 = require("./scan-paths");
|
|
10
|
+
const property_priority_1 = require("./property-priority");
|
|
10
11
|
const MAX_DETECTED_FROM = 14;
|
|
11
12
|
const MAX_SOURCE_LOCS = 12;
|
|
12
13
|
/** Cap how many files we embed per provider call (token budget). */
|
|
13
14
|
const MAX_FILES_IN_PROMPT = 28;
|
|
14
15
|
const MAX_CHARS_PER_FILE = 14_000;
|
|
15
16
|
const MAX_TOTAL_EXCERPT_CHARS = 100_000;
|
|
16
|
-
const NON_ENRICHMENT_PROPERTY_KEYS = new Set([
|
|
17
|
+
const NON_ENRICHMENT_PROPERTY_KEYS = new Set(['inference_status']);
|
|
17
18
|
function truncateChars(text, max) {
|
|
18
19
|
if (text.length <= max)
|
|
19
20
|
return text;
|
|
@@ -105,8 +106,8 @@ function buildFileExcerptsForPaths(files, preferredPaths) {
|
|
|
105
106
|
function isSparseValue(value) {
|
|
106
107
|
if (value === null || value === undefined)
|
|
107
108
|
return true;
|
|
108
|
-
if (typeof value ===
|
|
109
|
-
return value.trim() ===
|
|
109
|
+
if (typeof value === 'string')
|
|
110
|
+
return value.trim() === '';
|
|
110
111
|
if (Array.isArray(value))
|
|
111
112
|
return value.length === 0;
|
|
112
113
|
return false;
|
|
@@ -129,7 +130,7 @@ function slimComponentForLlm(component) {
|
|
|
129
130
|
propertiesSet[key] = value;
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
|
-
|
|
133
|
+
const prioritizedSparseKeys = (0, property_priority_1.sortPropertyKeysByPriority)(sparseKeys);
|
|
133
134
|
return {
|
|
134
135
|
id: component.id,
|
|
135
136
|
name: component.name,
|
|
@@ -139,14 +140,18 @@ function slimComponentForLlm(component) {
|
|
|
139
140
|
confidence: component.confidence,
|
|
140
141
|
propertiesSet,
|
|
141
142
|
/** Every property key that is still null/empty/[] — LLM should try to fill these. */
|
|
142
|
-
sparsePropertyKeys:
|
|
143
|
-
detectedFrom: (component.detectedFrom ?? [])
|
|
143
|
+
sparsePropertyKeys: prioritizedSparseKeys,
|
|
144
|
+
detectedFrom: (component.detectedFrom ?? [])
|
|
145
|
+
.slice(0, MAX_DETECTED_FROM)
|
|
146
|
+
.map((ref) => ({
|
|
144
147
|
pattern: ref.pattern,
|
|
145
148
|
filePath: ref.sourceLocation?.filePath,
|
|
146
149
|
startLine: ref.sourceLocation?.startLine,
|
|
147
150
|
endLine: ref.sourceLocation?.endLine,
|
|
148
151
|
})),
|
|
149
|
-
sourceLocations: (component.sourceLocations ?? [])
|
|
152
|
+
sourceLocations: (component.sourceLocations ?? [])
|
|
153
|
+
.slice(0, MAX_SOURCE_LOCS)
|
|
154
|
+
.map((loc) => ({
|
|
150
155
|
filePath: loc.filePath,
|
|
151
156
|
startLine: loc.startLine,
|
|
152
157
|
endLine: loc.endLine,
|
|
@@ -199,18 +204,18 @@ function buildProviderPromptPayload(input) {
|
|
|
199
204
|
})) ?? [];
|
|
200
205
|
const hasExcerpts = Object.keys(excerpts).length > 0;
|
|
201
206
|
const canonicalComponentIds = Object.keys(componentContext).sort((a, b) => a.localeCompare(b));
|
|
202
|
-
const propertyShapeHints =
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
const groundedInstructions = "
|
|
207
|
+
const propertyShapeHints = ' **Property shapes (match DataParade scan/schema):** Use snake_case keys from sparsePropertyKeys. ' +
|
|
208
|
+
'`integration_method` must always be an array of lowercase tokens (e.g. ["api"], ["sdk","api"]); never a single string. ' +
|
|
209
|
+
'`authentication_method` must be a single string token (e.g. "api_key", "oauth_2_0", "openid_connect", "jwt", "saml", "mtls", "certificate", "basic_auth", "none")—not an array—so it matches product dropdowns. ' +
|
|
210
|
+
'`processing_purpose` must be a string array of **taxonomy** tokens the app lists (e.g. authentication, security, analytics, service_provision, payment_processing, marketing, compliance, other)—snake_case only, not sentences. ' +
|
|
211
|
+
'`data_action` must be a string array of **canonical privacy verbs** only: collect, generate, store, transform, use, combine, disclose, relay, display, log, delete. ' +
|
|
212
|
+
'A single asset or third_party node may carry **multiple** verbs at once (set-valued)—never collapse to one label. Actors never get `data_action` (omit for actor targets). ' +
|
|
213
|
+
'Propose `relay` only when cited code/config corroborates passthrough/proxy/gateway behavior; otherwise omit relay. ' +
|
|
214
|
+
'Cite `propertyEvidence.data_action` with filePath + line range + reason for every verb you assert. ' +
|
|
215
|
+
'Other multi-value fields such as `data_categories_received`, `supported_export_formats`, `cloud_services_used`, `regions_availability_zones` must be string arrays, not one comma-joined string. ' +
|
|
216
|
+
'Booleans must be true/false (not strings). Prefer enum-like values in lowercase snake_case (e.g. integration_status: "active"). ' +
|
|
217
|
+
'For any field that corresponds to an app dropdown or multi-select, use the product\'s option tokens (snake_case / exact strings) — e.g. legal_basis: "contractual_necessity" not "contract"; pci_scope: "saq_d" not "full"; data_transfer_mechanism: "standard_contractual_clauses" not raw "HTTPS"; risk_rating and encrypt_at_rest must match allowed values.';
|
|
218
|
+
const groundedInstructions = "Walk every key in sparsePropertyKeys and emit every key you can **ground in code/config text**. You may output multiple component_patch proposals for one target when each patch has a different, disjoint key set. Use propertiesSet as truth for fields already set and never rewrite those values. For every key in setProperties, **propertyEvidence[key]** must be a non-empty array citing filePath + startLine/endLine + reason where that key's value appears in relevantFileContents (when provided) or in the file paths listed on that component in detectedFrom/sourceLocations. If you cannot tie a property to cited text or a cited path, **omit that key**. Indirect guesses are not allowed. It is valid to return **no proposals** only when no sparse key can be cited. Never invent URLs, vendor names, analytics products, retention numbers, or compliance labels without a literal basis in the excerpts or cited lines. `targetComponentId` must be exactly one of canonicalComponentIds (componentContext keys). ";
|
|
214
219
|
return {
|
|
215
220
|
instructions: hasExcerpts
|
|
216
221
|
? `${groundedInstructions} relevantFileContents may be truncated; line ranges must fall within the excerpt for that file. confidence.score should reflect how well the patch is supported (>= 0.72 when merge thresholds apply).`.concat(propertyShapeHints)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { DetectedComponent } from '../core/types/component';
|
|
2
|
+
import type { DetectedDataFlow } from '../core/types/data-flow';
|
|
3
|
+
import { type FallbackPolicy } from './provider-topology-rules';
|
|
4
|
+
export type ScanRedFlagCode = 'missing_section_hub' | 'disconnected_handler' | 'disconnected_section_node';
|
|
5
|
+
export interface ScanRedFlag {
|
|
6
|
+
code: ScanRedFlagCode;
|
|
7
|
+
severity: 'red';
|
|
8
|
+
sectionId?: string;
|
|
9
|
+
componentId?: string;
|
|
10
|
+
message: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Serverless entrypoint assets that should be absorbed into Aws Lambda —
|
|
14
|
+
* not the managed Lambda compute node itself.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isAbsorbableServerlessHandler(component: DetectedComponent): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Absorb serverless handler assets into the section's Aws Lambda managed
|
|
19
|
+
* service (creating Lambda if needed). Evidence stays on Lambda; handlers
|
|
20
|
+
* are removed from the graph. Ensures section hub → Aws Lambda connectivity.
|
|
21
|
+
*/
|
|
22
|
+
export declare function collapseServerlessHandlersIntoManagedLambda(components: DetectedComponent[], flows: DetectedDataFlow[], policy?: FallbackPolicy): {
|
|
23
|
+
components: DetectedComponent[];
|
|
24
|
+
dataFlows: DetectedDataFlow[];
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Use {@link collapseServerlessHandlersIntoManagedLambda}.
|
|
28
|
+
* Kept as a thin alias so older imports keep compiling during the transition.
|
|
29
|
+
*/
|
|
30
|
+
export declare function repairDisconnectedHandlers(components: DetectedComponent[], flows: DetectedDataFlow[], policy?: FallbackPolicy): {
|
|
31
|
+
components: DetectedComponent[];
|
|
32
|
+
dataFlows: DetectedDataFlow[];
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Collect connectivity RED flags that remain after repair passes.
|
|
36
|
+
*/
|
|
37
|
+
export declare function collectRedFlags(components: DetectedComponent[], flows: DetectedDataFlow[], policy?: FallbackPolicy): ScanRedFlag[];
|
|
38
|
+
export declare function formatRedFlagWarning(flag: ScanRedFlag): string;
|
|
39
|
+
/**
|
|
40
|
+
* Absorb serverless handlers into Aws Lambda, then verify remaining gaps.
|
|
41
|
+
*/
|
|
42
|
+
export declare function applyConnectivityRedFlagPass(components: DetectedComponent[], flows: DetectedDataFlow[]): {
|
|
43
|
+
components: DetectedComponent[];
|
|
44
|
+
dataFlows: DetectedDataFlow[];
|
|
45
|
+
redFlags: ScanRedFlag[];
|
|
46
|
+
};
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAbsorbableServerlessHandler = isAbsorbableServerlessHandler;
|
|
4
|
+
exports.collapseServerlessHandlersIntoManagedLambda = collapseServerlessHandlersIntoManagedLambda;
|
|
5
|
+
exports.repairDisconnectedHandlers = repairDisconnectedHandlers;
|
|
6
|
+
exports.collectRedFlags = collectRedFlags;
|
|
7
|
+
exports.formatRedFlagWarning = formatRedFlagWarning;
|
|
8
|
+
exports.applyConnectivityRedFlagPass = applyConnectivityRedFlagPass;
|
|
9
|
+
const provider_topology_rules_1 = require("./provider-topology-rules");
|
|
10
|
+
const HANDLER_PATTERN_IDS = new Set([
|
|
11
|
+
'lambda_handler',
|
|
12
|
+
'aws_lambda',
|
|
13
|
+
'aws_lambda_go',
|
|
14
|
+
'serverless_handler',
|
|
15
|
+
]);
|
|
16
|
+
function flowPairKey(flow) {
|
|
17
|
+
return `${flow.sourceComponentId}::${flow.targetComponentId}`;
|
|
18
|
+
}
|
|
19
|
+
function isConcreteServiceSectionId(sectionId, policy) {
|
|
20
|
+
const sid = sectionId.trim();
|
|
21
|
+
if (!sid)
|
|
22
|
+
return false;
|
|
23
|
+
if (policy.nonConcreteSectionIds.includes(sid.toLowerCase()))
|
|
24
|
+
return false;
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
function isMainApplication(component) {
|
|
28
|
+
return (component.properties?.isMainApplication === true ||
|
|
29
|
+
component.properties?.isMainApplication === 'true');
|
|
30
|
+
}
|
|
31
|
+
function sectionIdOf(component) {
|
|
32
|
+
return String(component.properties?.section_id ?? '').trim();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Serverless entrypoint assets that should be absorbed into Aws Lambda —
|
|
36
|
+
* not the managed Lambda compute node itself.
|
|
37
|
+
*/
|
|
38
|
+
function isAbsorbableServerlessHandler(component) {
|
|
39
|
+
if (component.type !== 'asset')
|
|
40
|
+
return false;
|
|
41
|
+
if (typeof component.properties?.managed_service_key === 'string') {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
if (component.subType === 'compute_service')
|
|
45
|
+
return false;
|
|
46
|
+
if (component.properties?.handlerType === 'serverless_handler')
|
|
47
|
+
return true;
|
|
48
|
+
const fromHandlerPattern = (component.detectedFrom ?? []).some((ref) => HANDLER_PATTERN_IDS.has(String(ref.pattern ?? '').toLowerCase()));
|
|
49
|
+
if (fromHandlerPattern)
|
|
50
|
+
return true;
|
|
51
|
+
if (component.subType === 'function') {
|
|
52
|
+
const name = (component.name || '').toLowerCase();
|
|
53
|
+
return name.includes('lambda') || name.includes('handler');
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
/** @deprecated Prefer {@link isAbsorbableServerlessHandler}; kept for flag messaging. */
|
|
58
|
+
function isHandlerAsset(component) {
|
|
59
|
+
return isAbsorbableServerlessHandler(component);
|
|
60
|
+
}
|
|
61
|
+
function incidentComponentIds(flows) {
|
|
62
|
+
const ids = new Set();
|
|
63
|
+
for (const flow of flows) {
|
|
64
|
+
ids.add(flow.sourceComponentId);
|
|
65
|
+
ids.add(flow.targetComponentId);
|
|
66
|
+
}
|
|
67
|
+
return ids;
|
|
68
|
+
}
|
|
69
|
+
function findSectionHub(components, sectionId) {
|
|
70
|
+
return components.find((c) => c.type === 'asset' && sectionIdOf(c) === sectionId && isMainApplication(c));
|
|
71
|
+
}
|
|
72
|
+
function findManagedLambda(components, sectionId) {
|
|
73
|
+
return components.find((c) => {
|
|
74
|
+
if (sectionIdOf(c) !== sectionId)
|
|
75
|
+
return false;
|
|
76
|
+
if (c.properties?.managed_service_key === 'lambda')
|
|
77
|
+
return true;
|
|
78
|
+
if (c.subType === 'compute_service' && /lambda/i.test(c.name || '')) {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function findAwsProvider(components, sectionId) {
|
|
85
|
+
return components.find((c) => {
|
|
86
|
+
if (c.type !== 'third_party')
|
|
87
|
+
return false;
|
|
88
|
+
if (sectionIdOf(c) !== sectionId)
|
|
89
|
+
return false;
|
|
90
|
+
const service = String(c.properties?.serviceName ?? '').toLowerCase();
|
|
91
|
+
const name = (c.name || '').toLowerCase();
|
|
92
|
+
return service === 'aws' || name === 'aws' || name.includes('amazon');
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function nextSyntheticComponentId(components) {
|
|
96
|
+
let maxNumericId = 0;
|
|
97
|
+
for (const component of components) {
|
|
98
|
+
const match = /^cmp_(\d+)$/.exec(component.id);
|
|
99
|
+
if (match) {
|
|
100
|
+
const num = Number.parseInt(match[1], 10);
|
|
101
|
+
if (!Number.isNaN(num) && num > maxNumericId)
|
|
102
|
+
maxNumericId = num;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return `cmp_${maxNumericId + 1}`;
|
|
106
|
+
}
|
|
107
|
+
function dedupeSourceLocations(locations) {
|
|
108
|
+
const seen = new Set();
|
|
109
|
+
const out = [];
|
|
110
|
+
for (const loc of locations ?? []) {
|
|
111
|
+
const key = `${loc.filePath}:${loc.startLine}:${loc.endLine}`;
|
|
112
|
+
if (seen.has(key))
|
|
113
|
+
continue;
|
|
114
|
+
seen.add(key);
|
|
115
|
+
out.push(loc);
|
|
116
|
+
}
|
|
117
|
+
return out;
|
|
118
|
+
}
|
|
119
|
+
function ensureManagedLambda(components, sectionId, sample) {
|
|
120
|
+
const existing = findManagedLambda(components, sectionId);
|
|
121
|
+
if (existing)
|
|
122
|
+
return existing;
|
|
123
|
+
const provider = findAwsProvider(components, sectionId);
|
|
124
|
+
const label = String(sample.properties?.section_label ?? '').trim() || sectionId;
|
|
125
|
+
const role = String(sample.properties?.section_role ?? '').trim() || 'service';
|
|
126
|
+
const created = {
|
|
127
|
+
id: nextSyntheticComponentId(components),
|
|
128
|
+
name: 'Aws Lambda',
|
|
129
|
+
type: 'asset',
|
|
130
|
+
subType: 'compute_service',
|
|
131
|
+
confidence: Math.max(0.78, sample.confidence),
|
|
132
|
+
detectedFrom: [],
|
|
133
|
+
sourceLocations: [],
|
|
134
|
+
properties: {
|
|
135
|
+
section_id: sectionId,
|
|
136
|
+
section_label: label,
|
|
137
|
+
section_role: role,
|
|
138
|
+
managed_service_key: 'lambda',
|
|
139
|
+
...(provider ? { managed_by_provider: provider.id } : {}),
|
|
140
|
+
generated_by: 'handler_absorb_into_lambda',
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
components.push(created);
|
|
144
|
+
return created;
|
|
145
|
+
}
|
|
146
|
+
function mergeHandlerEvidenceIntoLambda(lambdaNode, handlers) {
|
|
147
|
+
const locations = dedupeSourceLocations([
|
|
148
|
+
...(lambdaNode.sourceLocations ?? []),
|
|
149
|
+
...handlers.flatMap((h) => h.sourceLocations ?? []),
|
|
150
|
+
]);
|
|
151
|
+
const detectedFrom = [
|
|
152
|
+
...(lambdaNode.detectedFrom ?? []),
|
|
153
|
+
...handlers.flatMap((h) => h.detectedFrom ?? []),
|
|
154
|
+
];
|
|
155
|
+
const seenPatterns = new Set();
|
|
156
|
+
const dedupedFrom = detectedFrom.filter((ref) => {
|
|
157
|
+
const key = `${ref.pattern}:${ref.sourceLocation?.filePath ?? ''}:${ref.sourceLocation?.startLine ?? ''}`;
|
|
158
|
+
if (seenPatterns.has(key))
|
|
159
|
+
return false;
|
|
160
|
+
seenPatterns.add(key);
|
|
161
|
+
return true;
|
|
162
|
+
});
|
|
163
|
+
lambdaNode.sourceLocations = locations;
|
|
164
|
+
lambdaNode.detectedFrom = dedupedFrom;
|
|
165
|
+
lambdaNode.properties = {
|
|
166
|
+
...lambdaNode.properties,
|
|
167
|
+
hosting_entrypoints: handlers.map((h) => h.name).filter(Boolean),
|
|
168
|
+
absorbed_handler_ids: handlers.map((h) => h.id),
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function rewireFlowsAwayFromHandlers(flows, handlerIds, lambdaId) {
|
|
172
|
+
const remapped = flows.map((flow) => {
|
|
173
|
+
let source = flow.sourceComponentId;
|
|
174
|
+
let target = flow.targetComponentId;
|
|
175
|
+
if (handlerIds.has(source))
|
|
176
|
+
source = lambdaId;
|
|
177
|
+
if (handlerIds.has(target))
|
|
178
|
+
target = lambdaId;
|
|
179
|
+
if (source === flow.sourceComponentId &&
|
|
180
|
+
target === flow.targetComponentId) {
|
|
181
|
+
return flow;
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
...flow,
|
|
185
|
+
sourceComponentId: source,
|
|
186
|
+
targetComponentId: target,
|
|
187
|
+
enrichmentNotes: flow.enrichmentNotes
|
|
188
|
+
? `${flow.enrichmentNotes},handler_absorbed_into_lambda`
|
|
189
|
+
: 'handler_absorbed_into_lambda',
|
|
190
|
+
};
|
|
191
|
+
});
|
|
192
|
+
const seen = new Set();
|
|
193
|
+
const out = [];
|
|
194
|
+
for (const flow of remapped) {
|
|
195
|
+
if (flow.sourceComponentId === flow.targetComponentId)
|
|
196
|
+
continue;
|
|
197
|
+
const key = `${flowPairKey(flow)}::${flow.type}`;
|
|
198
|
+
if (seen.has(key))
|
|
199
|
+
continue;
|
|
200
|
+
seen.add(key);
|
|
201
|
+
out.push(flow);
|
|
202
|
+
}
|
|
203
|
+
return out;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Absorb serverless handler assets into the section's Aws Lambda managed
|
|
207
|
+
* service (creating Lambda if needed). Evidence stays on Lambda; handlers
|
|
208
|
+
* are removed from the graph. Ensures section hub → Aws Lambda connectivity.
|
|
209
|
+
*/
|
|
210
|
+
function collapseServerlessHandlersIntoManagedLambda(components, flows, policy = (0, provider_topology_rules_1.loadProviderTopologyFallbackPolicy)()) {
|
|
211
|
+
const nextComponents = components.map((c) => ({
|
|
212
|
+
...c,
|
|
213
|
+
properties: { ...c.properties },
|
|
214
|
+
detectedFrom: [...(c.detectedFrom ?? [])],
|
|
215
|
+
sourceLocations: [...(c.sourceLocations ?? [])],
|
|
216
|
+
}));
|
|
217
|
+
let nextFlows = flows.map((f) => ({ ...f }));
|
|
218
|
+
const handlers = nextComponents
|
|
219
|
+
.filter((c) => {
|
|
220
|
+
if (!isAbsorbableServerlessHandler(c))
|
|
221
|
+
return false;
|
|
222
|
+
return isConcreteServiceSectionId(sectionIdOf(c), policy);
|
|
223
|
+
})
|
|
224
|
+
.sort((a, b) => a.id.localeCompare(b.id));
|
|
225
|
+
if (handlers.length === 0) {
|
|
226
|
+
return { components: nextComponents, dataFlows: nextFlows };
|
|
227
|
+
}
|
|
228
|
+
const bySection = new Map();
|
|
229
|
+
for (const handler of handlers) {
|
|
230
|
+
const sid = sectionIdOf(handler);
|
|
231
|
+
const list = bySection.get(sid) ?? [];
|
|
232
|
+
list.push(handler);
|
|
233
|
+
bySection.set(sid, list);
|
|
234
|
+
}
|
|
235
|
+
const absorbedIds = new Set();
|
|
236
|
+
for (const sectionId of [...bySection.keys()].sort((a, b) => a.localeCompare(b))) {
|
|
237
|
+
const sectionHandlers = bySection.get(sectionId);
|
|
238
|
+
const lambdaNode = ensureManagedLambda(nextComponents, sectionId, sectionHandlers[0]);
|
|
239
|
+
mergeHandlerEvidenceIntoLambda(lambdaNode, sectionHandlers);
|
|
240
|
+
for (const h of sectionHandlers) {
|
|
241
|
+
absorbedIds.add(h.id);
|
|
242
|
+
}
|
|
243
|
+
nextFlows = rewireFlowsAwayFromHandlers(nextFlows, new Set(sectionHandlers.map((h) => h.id)), lambdaNode.id);
|
|
244
|
+
const hub = findSectionHub(nextComponents, sectionId);
|
|
245
|
+
if (hub && hub.id !== lambdaNode.id) {
|
|
246
|
+
const pairKeys = new Set(nextFlows.map((f) => flowPairKey(f)));
|
|
247
|
+
const key = flowPairKey({
|
|
248
|
+
sourceComponentId: hub.id,
|
|
249
|
+
targetComponentId: lambdaNode.id,
|
|
250
|
+
});
|
|
251
|
+
if (!pairKeys.has(key)) {
|
|
252
|
+
nextFlows.push({
|
|
253
|
+
id: `flow_fallback_${nextFlows.length + 1}`,
|
|
254
|
+
sourceComponentId: hub.id,
|
|
255
|
+
targetComponentId: lambdaNode.id,
|
|
256
|
+
type: 'api_call',
|
|
257
|
+
confidence: 0.6,
|
|
258
|
+
description: 'Section hub hosts on Aws Lambda',
|
|
259
|
+
enrichmentNotes: 'section_hub_to_managed_lambda',
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
const providerId = lambdaNode.properties?.managed_by_provider;
|
|
264
|
+
if (typeof providerId === 'string' && providerId.trim()) {
|
|
265
|
+
const pairKeys = new Set(nextFlows.map((f) => flowPairKey(f)));
|
|
266
|
+
const key = flowPairKey({
|
|
267
|
+
sourceComponentId: providerId,
|
|
268
|
+
targetComponentId: lambdaNode.id,
|
|
269
|
+
});
|
|
270
|
+
if (!pairKeys.has(key)) {
|
|
271
|
+
nextFlows.push({
|
|
272
|
+
id: `flow_fallback_${nextFlows.length + 1}`,
|
|
273
|
+
sourceComponentId: providerId,
|
|
274
|
+
targetComponentId: lambdaNode.id,
|
|
275
|
+
type: 'api_call',
|
|
276
|
+
confidence: 0.78,
|
|
277
|
+
description: 'Aws provides Aws Lambda',
|
|
278
|
+
enrichmentNotes: 'provider_to_managed_lambda',
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
const kept = nextComponents.filter((c) => !absorbedIds.has(c.id));
|
|
284
|
+
return { components: kept, dataFlows: nextFlows };
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* @deprecated Use {@link collapseServerlessHandlersIntoManagedLambda}.
|
|
288
|
+
* Kept as a thin alias so older imports keep compiling during the transition.
|
|
289
|
+
*/
|
|
290
|
+
function repairDisconnectedHandlers(components, flows, policy = (0, provider_topology_rules_1.loadProviderTopologyFallbackPolicy)()) {
|
|
291
|
+
return collapseServerlessHandlersIntoManagedLambda(components, flows, policy);
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Collect connectivity RED flags that remain after repair passes.
|
|
295
|
+
*/
|
|
296
|
+
function collectRedFlags(components, flows, policy = (0, provider_topology_rules_1.loadProviderTopologyFallbackPolicy)()) {
|
|
297
|
+
const flags = [];
|
|
298
|
+
const degree = incidentComponentIds(flows);
|
|
299
|
+
const occupied = new Set();
|
|
300
|
+
for (const c of components) {
|
|
301
|
+
const sid = sectionIdOf(c);
|
|
302
|
+
if (isConcreteServiceSectionId(sid, policy))
|
|
303
|
+
occupied.add(sid);
|
|
304
|
+
}
|
|
305
|
+
for (const sectionId of [...occupied].sort((a, b) => a.localeCompare(b))) {
|
|
306
|
+
if (!findSectionHub(components, sectionId)) {
|
|
307
|
+
flags.push({
|
|
308
|
+
code: 'missing_section_hub',
|
|
309
|
+
severity: 'red',
|
|
310
|
+
sectionId,
|
|
311
|
+
message: `Section "${sectionId}" has components but no main-application hub.`,
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
const sectionComponents = components
|
|
316
|
+
.filter((c) => isConcreteServiceSectionId(sectionIdOf(c), policy))
|
|
317
|
+
.sort((a, b) => a.id.localeCompare(b.id));
|
|
318
|
+
for (const component of sectionComponents) {
|
|
319
|
+
if (degree.has(component.id))
|
|
320
|
+
continue;
|
|
321
|
+
if (isMainApplication(component))
|
|
322
|
+
continue;
|
|
323
|
+
const sectionId = sectionIdOf(component);
|
|
324
|
+
if (isHandlerAsset(component)) {
|
|
325
|
+
flags.push({
|
|
326
|
+
code: 'disconnected_handler',
|
|
327
|
+
severity: 'red',
|
|
328
|
+
sectionId,
|
|
329
|
+
componentId: component.id,
|
|
330
|
+
message: `Handler "${component.name}" (${component.id}) in section "${sectionId}" has no connected flows.`,
|
|
331
|
+
});
|
|
332
|
+
continue;
|
|
333
|
+
}
|
|
334
|
+
flags.push({
|
|
335
|
+
code: 'disconnected_section_node',
|
|
336
|
+
severity: 'red',
|
|
337
|
+
sectionId,
|
|
338
|
+
componentId: component.id,
|
|
339
|
+
message: `Component "${component.name}" (${component.id}) in section "${sectionId}" has no connected flows.`,
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
return flags;
|
|
343
|
+
}
|
|
344
|
+
function formatRedFlagWarning(flag) {
|
|
345
|
+
const parts = [`red-flag: ${flag.code}`];
|
|
346
|
+
if (flag.sectionId)
|
|
347
|
+
parts.push(`section=${flag.sectionId}`);
|
|
348
|
+
if (flag.componentId)
|
|
349
|
+
parts.push(`component=${flag.componentId}`);
|
|
350
|
+
parts.push(flag.message);
|
|
351
|
+
return parts.join(': ');
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Absorb serverless handlers into Aws Lambda, then verify remaining gaps.
|
|
355
|
+
*/
|
|
356
|
+
function applyConnectivityRedFlagPass(components, flows) {
|
|
357
|
+
const policy = (0, provider_topology_rules_1.loadProviderTopologyFallbackPolicy)();
|
|
358
|
+
const collapsed = collapseServerlessHandlersIntoManagedLambda(components, flows, policy);
|
|
359
|
+
const redFlags = collectRedFlags(collapsed.components, collapsed.dataFlows, policy);
|
|
360
|
+
return {
|
|
361
|
+
components: collapsed.components,
|
|
362
|
+
dataFlows: collapsed.dataFlows,
|
|
363
|
+
redFlags,
|
|
364
|
+
};
|
|
365
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { DetectedComponent } from
|
|
2
|
-
import type { FileInfo } from
|
|
3
|
-
import type { AiInferenceCandidate, AiProposal, ComponentPatch } from
|
|
1
|
+
import type { DetectedComponent } from '../core/types/component';
|
|
2
|
+
import type { FileInfo } from '../core/types/file';
|
|
3
|
+
import type { AiInferenceCandidate, AiProposal, ComponentPatch } from './types';
|
|
4
4
|
export declare function buildThirdPartyHeuristicProposal(input: {
|
|
5
5
|
candidate: AiInferenceCandidate;
|
|
6
6
|
component: DetectedComponent;
|