@shiftleftpt/sbd-toe-mcp 0.20.0-beta.20 → 0.20.0-beta.22
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/assets/agent-guide.md +33 -1
- package/dist/index.js +64 -18
- package/dist/index.js.map +1 -1
- package/dist/serving/activation-vocabulary.d.ts +99 -0
- package/dist/serving/activation-vocabulary.js +165 -0
- package/dist/serving/activation-vocabulary.js.map +1 -0
- package/dist/serving/selection.d.ts +71 -2
- package/dist/serving/selection.js +237 -15
- package/dist/serving/selection.js.map +1 -1
- package/dist/tools/map-review-scope.d.ts +6 -0
- package/dist/tools/map-review-scope.js +1 -1
- package/dist/tools/map-review-scope.js.map +1 -1
- package/dist/tools/prepare-codegen-context.d.ts +40 -4
- package/dist/tools/prepare-codegen-context.js +194 -119
- package/dist/tools/prepare-codegen-context.js.map +1 -1
- package/dist/tools/select-requirements.d.ts +22 -0
- package/dist/tools/select-requirements.js +57 -5
- package/dist/tools/select-requirements.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { type Concern } from "../tools/prepare-codegen-context.js";
|
|
2
|
+
export interface ConcernVocabularyEntry {
|
|
3
|
+
value: Concern;
|
|
4
|
+
activates_categories: string[];
|
|
5
|
+
activates_chapters: string[];
|
|
6
|
+
requirements_at: Record<"L1" | "L2" | "L3", number>;
|
|
7
|
+
}
|
|
8
|
+
export interface ActivatorVocabularyEntry {
|
|
9
|
+
value: string;
|
|
10
|
+
activates_concerns: string[];
|
|
11
|
+
/** P1-A/item 2: valor válido que NÃO activa nada — publicado como tal, nunca omitido. */
|
|
12
|
+
inert?: true;
|
|
13
|
+
note: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ActivationVocabulary {
|
|
16
|
+
provenance: {
|
|
17
|
+
kg: string;
|
|
18
|
+
content_type: "derived";
|
|
19
|
+
produced_by: "activation_vocabulary_builder";
|
|
20
|
+
source_data: string;
|
|
21
|
+
note: string;
|
|
22
|
+
};
|
|
23
|
+
contract: {
|
|
24
|
+
serving_semantics: "declarative-first";
|
|
25
|
+
version: string;
|
|
26
|
+
note: string;
|
|
27
|
+
};
|
|
28
|
+
how_to_use: string[];
|
|
29
|
+
risk_level: {
|
|
30
|
+
values: string[];
|
|
31
|
+
baseline_requirements: Record<string, number>;
|
|
32
|
+
note: string;
|
|
33
|
+
};
|
|
34
|
+
concerns: {
|
|
35
|
+
closed_set: true;
|
|
36
|
+
note: string;
|
|
37
|
+
values: ConcernVocabularyEntry[];
|
|
38
|
+
};
|
|
39
|
+
exposure: {
|
|
40
|
+
closed_set: true;
|
|
41
|
+
note: string;
|
|
42
|
+
values: ActivatorVocabularyEntry[];
|
|
43
|
+
};
|
|
44
|
+
data_sensitivity: {
|
|
45
|
+
closed_set: true;
|
|
46
|
+
note: string;
|
|
47
|
+
values: ActivatorVocabularyEntry[];
|
|
48
|
+
};
|
|
49
|
+
technologies: {
|
|
50
|
+
closed_set: true;
|
|
51
|
+
note: string;
|
|
52
|
+
values: {
|
|
53
|
+
value: string;
|
|
54
|
+
activates_chapters: string[];
|
|
55
|
+
named_rule?: string;
|
|
56
|
+
note?: string;
|
|
57
|
+
}[];
|
|
58
|
+
};
|
|
59
|
+
changed_files: {
|
|
60
|
+
closed_set: false;
|
|
61
|
+
note: string;
|
|
62
|
+
patterns: {
|
|
63
|
+
pattern: string;
|
|
64
|
+
activates_chapters: string[];
|
|
65
|
+
}[];
|
|
66
|
+
};
|
|
67
|
+
roles: {
|
|
68
|
+
closed_set: true;
|
|
69
|
+
note: string;
|
|
70
|
+
values: {
|
|
71
|
+
value: string;
|
|
72
|
+
aliases: string[];
|
|
73
|
+
}[];
|
|
74
|
+
};
|
|
75
|
+
phases: {
|
|
76
|
+
closed_set: true;
|
|
77
|
+
note: string;
|
|
78
|
+
values: {
|
|
79
|
+
value: string;
|
|
80
|
+
label: string;
|
|
81
|
+
aliases: string[];
|
|
82
|
+
}[];
|
|
83
|
+
};
|
|
84
|
+
not_activators: {
|
|
85
|
+
field: string;
|
|
86
|
+
role: string;
|
|
87
|
+
note: string;
|
|
88
|
+
}[];
|
|
89
|
+
}
|
|
90
|
+
/** Categorias v0 que um concern activa — pela mesma via do motor (loader ⊕ suplemento). */
|
|
91
|
+
export declare function categoriesForConcernPublished(concern: Concern): string[];
|
|
92
|
+
/**
|
|
93
|
+
* Os enums PUBLICADOS dos activadores — a fonte única do que as tools aceitam
|
|
94
|
+
* (P1-C: o schema é gerado daqui) e do que o vocabulário publica (P1-A/item 2:
|
|
95
|
+
* incluindo os valores válidos mas INERTES, que antes eram omitidos).
|
|
96
|
+
*/
|
|
97
|
+
export declare const EXPOSURE_VALUES: readonly ["local", "internal", "authenticated", "public"];
|
|
98
|
+
export declare const SENSITIVITY_VALUES: readonly ["low", "personal", "regulated", "secrets"];
|
|
99
|
+
export declare function buildActivationVocabulary(): ActivationVocabulary;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 0.20.0-beta.21 — «declarativo primeiro»: o vocabulário publicado.
|
|
3
|
+
*
|
|
4
|
+
* O servidor deixou de adivinhar palavras: PUBLICA a lista fechada de valores que
|
|
5
|
+
* aceita e, para cada valor, o que ele activa. O LLM — que tem o contexto — lê,
|
|
6
|
+
* mapeia e DECLARA; o servidor responde ao declarado, de forma reproduzível.
|
|
7
|
+
*
|
|
8
|
+
* Regra da casa: nada aqui é escrito à mão. Cada entrada é DERIVADA das mesmas
|
|
9
|
+
* tabelas/dados que o motor usa (loader do bundle, mapas de concern→categoria/
|
|
10
|
+
* capítulo, tabela de tecnologias, tabela de padrões de path, activadores
|
|
11
|
+
* declarados de exposure/data_sensitivity, papéis e fases canónicos do bundle) —
|
|
12
|
+
* se o motor mudar, o vocabulário muda com ele, ou o teste parte.
|
|
13
|
+
*/
|
|
14
|
+
import { getOntologyData } from "../tools/ontology-loader.js";
|
|
15
|
+
import { VALID_CONCERNS, CONCERN_TO_V0_CATEGORIES_SUPPLEMENT, EXPOSURE_CONCERNS, SENSITIVITY_CONCERNS } from "../tools/prepare-codegen-context.js";
|
|
16
|
+
import { CONCERN_TO_DOMAIN_CHAPTERS, TECHNOLOGY_TO_CHAPTERS, SES008_TECHNOLOGY } from "./selection.js";
|
|
17
|
+
import { PATTERN_RULES } from "../tools/map-review-scope.js";
|
|
18
|
+
import { servedKgReleaseTag } from "../version-info.js";
|
|
19
|
+
/** Categorias v0 que um concern activa — pela mesma via do motor (loader ⊕ suplemento). */
|
|
20
|
+
export function categoriesForConcernPublished(concern) {
|
|
21
|
+
const ontology = getOntologyData();
|
|
22
|
+
const set = new Set();
|
|
23
|
+
for (const c of ontology.concernsMap[concern] ?? [])
|
|
24
|
+
set.add(c);
|
|
25
|
+
for (const c of CONCERN_TO_V0_CATEGORIES_SUPPLEMENT[concern] ?? [])
|
|
26
|
+
set.add(c);
|
|
27
|
+
return [...set].sort();
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Os enums PUBLICADOS dos activadores — a fonte única do que as tools aceitam
|
|
31
|
+
* (P1-C: o schema é gerado daqui) e do que o vocabulário publica (P1-A/item 2:
|
|
32
|
+
* incluindo os valores válidos mas INERTES, que antes eram omitidos).
|
|
33
|
+
*/
|
|
34
|
+
export const EXPOSURE_VALUES = ["local", "internal", "authenticated", "public"];
|
|
35
|
+
export const SENSITIVITY_VALUES = ["low", "personal", "regulated", "secrets"];
|
|
36
|
+
export function buildActivationVocabulary() {
|
|
37
|
+
const ontology = getOntologyData();
|
|
38
|
+
const levels = ["L1", "L2", "L3"];
|
|
39
|
+
const baseline = {};
|
|
40
|
+
for (const level of levels)
|
|
41
|
+
baseline[level] = ontology.requirements.filter((r) => r.type === "base" && r.applicable_levels?.[level] === true).length;
|
|
42
|
+
const concerns = VALID_CONCERNS.map((concern) => {
|
|
43
|
+
const categories = categoriesForConcernPublished(concern);
|
|
44
|
+
const counts = {};
|
|
45
|
+
for (const level of levels)
|
|
46
|
+
counts[level] = ontology.requirements.filter((r) => categories.includes(r.category) && r.applicable_levels?.[level] === true).length;
|
|
47
|
+
return {
|
|
48
|
+
value: concern,
|
|
49
|
+
activates_categories: categories,
|
|
50
|
+
activates_chapters: [...(CONCERN_TO_DOMAIN_CHAPTERS[concern] ?? [])],
|
|
51
|
+
requirements_at: counts
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
const roles = ontology.roles
|
|
55
|
+
.filter((r) => r.canonical)
|
|
56
|
+
.map((r) => ({ value: r.role_id, aliases: [...r.aliases].sort() }))
|
|
57
|
+
.sort((a, b) => a.value.localeCompare(b.value));
|
|
58
|
+
const phases = (ontology.phases ?? [])
|
|
59
|
+
.filter((p) => p.canonical)
|
|
60
|
+
.map((p) => ({ value: p.phase_id, label: p.label, aliases: [...p.aliases].sort() }))
|
|
61
|
+
.sort((a, b) => a.value.localeCompare(b.value));
|
|
62
|
+
return {
|
|
63
|
+
provenance: {
|
|
64
|
+
kg: servedKgReleaseTag(),
|
|
65
|
+
content_type: "derived",
|
|
66
|
+
produced_by: "activation_vocabulary_builder",
|
|
67
|
+
source_data: "data/publish/runtime/{requirements,assignments,roles}.json + ontology concernsMap + tabelas de activação do motor (concern→categoria/capítulo, tecnologia→capítulo, path→capítulo, exposure/data_sensitivity→concern)",
|
|
68
|
+
note: "Derivado, nunca escrito à mão: o mesmo mapa que o motor usa para seleccionar é o que aqui se publica. Contagens por nível vêm do bundle pinado."
|
|
69
|
+
},
|
|
70
|
+
contract: {
|
|
71
|
+
serving_semantics: "declarative-first",
|
|
72
|
+
version: "v1.18-beta",
|
|
73
|
+
note: "Nesta linha (0.20-beta, experiência autorizada pelo lead 2026-09-05) a selecção é função do que o chamador DECLARA. O servidor normaliza o declarado; não decide o que quiseram dizer."
|
|
74
|
+
},
|
|
75
|
+
how_to_use: [
|
|
76
|
+
"1. Tu (LLM) lês o pedido, o código e a conversa — tens o contexto que o servidor nunca terá.",
|
|
77
|
+
"2. Mapeias o que interpretaste para ESTES valores e DECLARAS: risk_level, concerns, exposure, data_sensitivity, technologies, changed_files.",
|
|
78
|
+
"3. Chamas select_sbd_toe_requirements com as declarações; o `task` podes enviá-lo à mesma — fica registado para auditoria e NÃO influencia o resultado.",
|
|
79
|
+
"4. Sem nenhuma declaração o servidor responde needs_input (com este vocabulário e candidatos A CONFIRMAR) — nunca adivinha, nunca devolve zero em silêncio.",
|
|
80
|
+
"5. Queres a baseline do nível, sem contexto? Pede-a explicitamente: mode='baseline'.",
|
|
81
|
+
"6. Queres o comportamento inferencial antigo (investigação/estudo de paráfrase)? mode='discover' — exploratório, marcado como tal na resposta."
|
|
82
|
+
],
|
|
83
|
+
risk_level: {
|
|
84
|
+
values: [...levels],
|
|
85
|
+
baseline_requirements: baseline,
|
|
86
|
+
note: "Filtro de nível sobre os requisitos publicados (applicable_levels). Um capítulo nunca se exclui por nível — a exigência escala."
|
|
87
|
+
},
|
|
88
|
+
concerns: {
|
|
89
|
+
closed_set: true,
|
|
90
|
+
note: "Conjunto fechado. Cada concern activa categorias v0 (baseline cap. 02) e/ou capítulos de domínio. Declara os que a tua leitura do pedido justifica — somam activação, não restringem.",
|
|
91
|
+
values: concerns
|
|
92
|
+
},
|
|
93
|
+
exposure: {
|
|
94
|
+
closed_set: true,
|
|
95
|
+
note: "Activador declarado: a superfície exposta impõe concerns por regra publicada.",
|
|
96
|
+
values: EXPOSURE_VALUES.map((value) => {
|
|
97
|
+
const list = [...(EXPOSURE_CONCERNS[value] ?? [])];
|
|
98
|
+
return list.length > 0
|
|
99
|
+
? { value, activates_concerns: list, note: `exposure='${value}' activa ${list.join(", ")} por regra declarada.` }
|
|
100
|
+
: {
|
|
101
|
+
value,
|
|
102
|
+
activates_concerns: [],
|
|
103
|
+
inert: true,
|
|
104
|
+
note: `exposure='${value}' é um valor VÁLIDO e INERTE: não activa nada. Declarado sozinho não produz selecção — a resposta será needs_input, nunca zero em silêncio.`
|
|
105
|
+
};
|
|
106
|
+
})
|
|
107
|
+
},
|
|
108
|
+
data_sensitivity: {
|
|
109
|
+
closed_set: true,
|
|
110
|
+
note: "Activador declarado: a natureza dos dados impõe concerns por regra publicada.",
|
|
111
|
+
values: SENSITIVITY_VALUES.map((value) => {
|
|
112
|
+
const list = [...(SENSITIVITY_CONCERNS[value] ?? [])];
|
|
113
|
+
return list.length > 0
|
|
114
|
+
? { value, activates_concerns: list, note: `data_sensitivity='${value}' activa ${list.join(", ")} por regra declarada.` }
|
|
115
|
+
: {
|
|
116
|
+
value,
|
|
117
|
+
activates_concerns: [],
|
|
118
|
+
inert: true,
|
|
119
|
+
note: `data_sensitivity='${value}' é um valor VÁLIDO e INERTE: não activa nada. Declarado sozinho não produz selecção — a resposta será needs_input, nunca zero em silêncio.`
|
|
120
|
+
};
|
|
121
|
+
})
|
|
122
|
+
},
|
|
123
|
+
technologies: {
|
|
124
|
+
closed_set: true,
|
|
125
|
+
note: "Conjunto fechado de tecnologias que activam capítulos por TABELA (não por semelhança de texto). O campo livre `stack` só conta quando um destes valores aparece nele como token exacto.",
|
|
126
|
+
values: [
|
|
127
|
+
...Object.entries(TECHNOLOGY_TO_CHAPTERS).map(([value, chapters]) => ({ value, activates_chapters: [...chapters] })),
|
|
128
|
+
{
|
|
129
|
+
value: SES008_TECHNOLOGY,
|
|
130
|
+
activates_chapters: [],
|
|
131
|
+
named_rule: "SES-008-por-tecnologia",
|
|
132
|
+
note: "Não activa capítulos: aciona a regra NOMEADA SES-008 (scope/TTL/revogação de tokens) a qualquer nível — decisão do Author 2026-08-31, agora por tecnologia DECLARADA em vez de casamento de palavras na tarefa."
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
changed_files: {
|
|
137
|
+
closed_set: false,
|
|
138
|
+
note: "Caminhos reais do repositório. A activação é por TABELA de padrões de path publicada abaixo — não há interpretação do conteúdo nem do nome.",
|
|
139
|
+
patterns: PATTERN_RULES.map((r) => ({ pattern: r.pattern, activates_chapters: [...r.bundles] }))
|
|
140
|
+
},
|
|
141
|
+
roles: {
|
|
142
|
+
closed_set: true,
|
|
143
|
+
note: "Papéis canónicos do bundle; os aliases publicados são normalização legítima (ex.: sre → devops-sre).",
|
|
144
|
+
values: roles
|
|
145
|
+
},
|
|
146
|
+
phases: {
|
|
147
|
+
closed_set: true,
|
|
148
|
+
note: "Fases canónicas do bundle; aliases publicados idem (ex.: implement → develop).",
|
|
149
|
+
values: phases
|
|
150
|
+
},
|
|
151
|
+
not_activators: [
|
|
152
|
+
{
|
|
153
|
+
field: "task",
|
|
154
|
+
role: "recorded_context",
|
|
155
|
+
note: "Texto livre. Fica no registo para auditoria e NÃO influencia a selecção no modo declarativo (só em mode='discover', exploratório)."
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
field: "stack",
|
|
159
|
+
role: "recorded_context_with_exact_normalisation",
|
|
160
|
+
note: "Texto livre. Só activa quando contém, como token exacto, um valor de `technologies` — normalizar o declarado é legítimo, adivinhar prosa não."
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=activation-vocabulary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activation-vocabulary.js","sourceRoot":"","sources":["../../src/serving/activation-vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EACL,cAAc,EACd,mCAAmC,EACnC,iBAAiB,EACjB,oBAAoB,EAErB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACvG,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AA0CxD,2FAA2F;AAC3F,MAAM,UAAU,6BAA6B,CAAC,OAAgB;IAC5D,MAAM,QAAQ,GAAG,eAAe,E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AE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,kBAAkB,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;SACjG;QACD,KAAK,EAAE;YACL,UAAU,EAAE,IAAI;YAChB,IAAI,EAAE,sGAAsG;YAC5G,MAAM,EAAE,KAAK;SACd;QACD,MAAM,EAAE;YACN,UAAU,EAAE,IAAI;YAChB,IAAI,EAAE,gFAAgF;YACtF,MAAM,EAAE,MAAM;SACf;QACD,cAAc,EAAE;YACd;gBACE,KAAK,EAAE,MAAM;gBACb,IAAI,EAAE,kBAAkB;gBACxB,IAAI,EACF,oIAAoI;aACvI;YACD;gBACE,KAAK,EAAE,OAAO;gBACd,IAAI,EAAE,2CAA2C;gBACjD,IAAI,EACF,+IAA+I;aAClJ;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,10 +1,33 @@
|
|
|
1
|
-
import { type ActivationResult, type ActivationTraceEntry, type NormalizedInput } from "../tools/prepare-codegen-context.js";
|
|
1
|
+
import { type ActivationResult, type ActivationTraceEntry, type Concern, type NormalizedInput } from "../tools/prepare-codegen-context.js";
|
|
2
2
|
export type SelectionRiskLevel = "L1" | "L2" | "L3";
|
|
3
|
+
/** Concern → the domain chapter(s) whose catalogue it activates (aligned with the
|
|
4
|
+
* ontology's `activation_examples` and the applicability model; audited table). */
|
|
5
|
+
export declare const CONCERN_TO_DOMAIN_CHAPTERS: Readonly<Partial<Record<Concern, readonly string[]>>>;
|
|
3
6
|
/** Technology vocabulary → chapters (mirrors map_sbd_toe_applicability). */
|
|
4
7
|
export declare const TECHNOLOGY_TO_CHAPTERS: Readonly<Record<string, readonly string[]>>;
|
|
8
|
+
/**
|
|
9
|
+
* 0.20.0-beta.21: a regra do Author sobrevive à mudança de fronteira — passa a ser
|
|
10
|
+
* accionada pela TECNOLOGIA DECLARADA (`technologies: ["jwt"]`, valor publicado no
|
|
11
|
+
* vocabulário) em vez de por regex sobre a prosa da tarefa. Em `discover` o gatilho
|
|
12
|
+
* lexical histórico continua a valer.
|
|
13
|
+
*/
|
|
14
|
+
export declare const SES008_TECHNOLOGY = "jwt";
|
|
5
15
|
/** 0.19.0 (ronda 3): estabilidade da origem — lexical = casamento de termos da
|
|
6
16
|
* redacção (revogável por reescrever a frase); declared = concern explícito, regra
|
|
7
17
|
* nomeada, sinal de contexto declarado ou dado do bundle. */
|
|
18
|
+
/**
|
|
19
|
+
* 0.20.0-beta.21 — modos de selecção («declarativo primeiro», experiência da linha beta
|
|
20
|
+
* autorizada pelo lead 2026-09-05).
|
|
21
|
+
*
|
|
22
|
+
* - `declarative` (DEFAULT): a selecção é função APENAS do que o chamador declarou —
|
|
23
|
+
* risk_level, concerns, exposure, data_sensitivity, changed_files, technologies. O
|
|
24
|
+
* `task` fica registado para auditoria e não influencia o resultado. Sem nenhuma
|
|
25
|
+
* declaração ⇒ `needs_input` (nunca zero, nunca adivinhar).
|
|
26
|
+
* - `baseline`: devolve a baseline do nível por PEDIDO EXPLÍCITO (nunca como fallback).
|
|
27
|
+
* - `discover`: comportamento inferencial histórico, COM os avisos todos, marcado
|
|
28
|
+
* exploratório — instrumento do oráculo histórico e do estudo de paráfrase.
|
|
29
|
+
*/
|
|
30
|
+
export type SelectionMode = "declarative" | "baseline" | "discover";
|
|
8
31
|
export type SelectionBasis = "declared" | "lexical";
|
|
9
32
|
export declare function basisOfSource(source: string): SelectionBasis;
|
|
10
33
|
export interface SelectionTraceEntry {
|
|
@@ -37,6 +60,36 @@ export interface ActivatedChapter {
|
|
|
37
60
|
source: "changed_file" | "technology" | "concern" | "stack";
|
|
38
61
|
trigger: string;
|
|
39
62
|
}
|
|
63
|
+
/** Declarações que a selecção aceita — o vocabulário está em sbd://toe/activation-vocabulary. */
|
|
64
|
+
export interface DeclaredActivators {
|
|
65
|
+
concerns: string[];
|
|
66
|
+
exposure?: string;
|
|
67
|
+
data_sensitivity?: string;
|
|
68
|
+
technologies: string[];
|
|
69
|
+
changed_files: string[];
|
|
70
|
+
}
|
|
71
|
+
/** Resposta a uma chamada sem declarações: pedido de declaração, não resultado. */
|
|
72
|
+
export interface NeedsInput {
|
|
73
|
+
reason: string;
|
|
74
|
+
/** P1-A: declarações válidas que não activaram nada (ex.: exposure=local, data_sensitivity=low). */
|
|
75
|
+
inert_declarations?: string[];
|
|
76
|
+
declared: DeclaredActivators;
|
|
77
|
+
vocabulary_resource: string;
|
|
78
|
+
candidates_to_confirm: {
|
|
79
|
+
note: string;
|
|
80
|
+
from_task_text: string[];
|
|
81
|
+
};
|
|
82
|
+
example: {
|
|
83
|
+
tool: string;
|
|
84
|
+
with: string;
|
|
85
|
+
note: string;
|
|
86
|
+
};
|
|
87
|
+
baseline_escape_hatch: {
|
|
88
|
+
tool: string;
|
|
89
|
+
with: string;
|
|
90
|
+
note: string;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
40
93
|
export interface SelectionResult {
|
|
41
94
|
risk_level: SelectionRiskLevel;
|
|
42
95
|
eligible_count: number;
|
|
@@ -69,6 +122,16 @@ export interface SelectionResult {
|
|
|
69
122
|
activation: ActivationResult;
|
|
70
123
|
input: NormalizedInput;
|
|
71
124
|
notes: string[];
|
|
125
|
+
/** Modo efectivo desta selecção (0.20.0-beta.21). */
|
|
126
|
+
mode: SelectionMode;
|
|
127
|
+
/** Presente quando nada foi declarado no modo declarativo: pedido de declaração + aula. */
|
|
128
|
+
needs_input?: NeedsInput;
|
|
129
|
+
/** O `task` é contexto registado, não motor (excepto em discover). */
|
|
130
|
+
task_record: {
|
|
131
|
+
text: string;
|
|
132
|
+
role: "recorded_context";
|
|
133
|
+
affects_selection: boolean;
|
|
134
|
+
};
|
|
72
135
|
}
|
|
73
136
|
export interface SelectionContextInput {
|
|
74
137
|
task?: string;
|
|
@@ -78,6 +141,8 @@ export interface SelectionContextInput {
|
|
|
78
141
|
data_sensitivity?: string;
|
|
79
142
|
concerns?: string[];
|
|
80
143
|
changed_files?: string[];
|
|
144
|
+
/** 0.20.0-beta.21 — default `declarative`. */
|
|
145
|
+
mode?: SelectionMode;
|
|
81
146
|
technologies?: string[];
|
|
82
147
|
}
|
|
83
148
|
/**
|
|
@@ -85,5 +150,9 @@ export interface SelectionContextInput {
|
|
|
85
150
|
* eligible exclusion is listed with a reason.
|
|
86
151
|
*/
|
|
87
152
|
export declare function runSelection(context: SelectionContextInput): SelectionResult;
|
|
153
|
+
/** Tecnologias declaradas normalizadas: valor do vocabulário fechado, ou token exacto dentro do `stack`. */
|
|
154
|
+
/** Tokens do vocabulário FECHADO presentes no `stack` declarado (P1-D: dão rasto). */
|
|
155
|
+
export declare function stackTokensFromVocabulary(stack: string | undefined): string[];
|
|
156
|
+
export declare function normalizeDeclaredTechnologies(technologies: readonly string[], stack: string | undefined): string[];
|
|
88
157
|
/** Variant for callers that already ran the activation engine (prepare). */
|
|
89
|
-
export declare function runSelectionWithActivation(input: NormalizedInput, activation: ActivationResult,
|
|
158
|
+
export declare function runSelectionWithActivation(input: NormalizedInput, activation: ActivationResult, technologiesRaw?: readonly string[], mode?: SelectionMode): SelectionResult;
|