@kubbisec/ai-linux-arm64 0.1.21 → 0.1.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/bundled/clarify/clarify-gate-state.d.ts +1 -1
- package/bundled/clarify/clarify-gate-state.js +3 -3
- package/bundled/clarify/clarify-gate.d.ts +21 -14
- package/bundled/clarify/clarify-gate.js +118 -111
- package/bundled/clarify/clarify-select-panel.d.ts +16 -9
- package/bundled/clarify/clarify-select-panel.js +65 -67
- package/bundled/clarify/clarify-ui-state.d.ts +12 -10
- package/bundled/clarify/clarify-ui-state.js +26 -26
- package/bundled/clarify/parse-clarify-answer.d.ts +29 -18
- package/bundled/clarify/parse-clarify-answer.js +39 -45
- package/bundled/clarify/question-format.d.ts +34 -23
- package/bundled/clarify/question-format.js +112 -119
- package/bundled/clarify/questionnaire-tool.d.ts +28 -17
- package/bundled/clarify/questionnaire-tool.js +180 -144
- package/bundled/clarify/scope-discovery.d.ts +8 -5
- package/bundled/clarify/scope-discovery.js +102 -110
- package/bundled/clarify/session-questionnaire.d.ts +48 -13
- package/bundled/clarify/session-questionnaire.js +304 -312
- package/bundled/clarify/session-questionnaire.types.d.ts +29 -27
- package/bundled/clarify/session-questionnaire.types.js +10 -10
- package/bundled/components/kubbisec-model-selector.d.ts +47 -34
- package/bundled/components/kubbisec-model-selector.js +187 -177
- package/bundled/config/config.d.ts +6 -6
- package/bundled/config/config.js +55 -55
- package/bundled/config/detect-local-llm-providers.d.ts +26 -16
- package/bundled/config/detect-local-llm-providers.js +130 -142
- package/bundled/config/ensure-kubbisec-project-settings.d.ts +9 -9
- package/bundled/config/ensure-kubbisec-project-settings.js +44 -48
- package/bundled/config/extended-context.d.ts +5 -6
- package/bundled/config/extended-context.js +23 -22
- package/bundled/config/feature-flags.d.ts +10 -2
- package/bundled/config/feature-flags.js +8 -2
- package/bundled/config/format-kubbisec-footer-status.d.ts +1 -1
- package/bundled/config/format-kubbisec-footer-status.js +26 -31
- package/bundled/config/kubbisec-extension-manifest.d.ts +22 -2
- package/bundled/config/kubbisec-extension-manifest.js +20 -20
- package/bundled/config/llm-config-mutations.d.ts +51 -25
- package/bundled/config/llm-config-mutations.js +173 -182
- package/bundled/config/llm-config.d.ts +54 -41
- package/bundled/config/llm-config.js +199 -199
- package/bundled/config/llm-provider-catalog.d.ts +18 -15
- package/bundled/config/llm-provider-catalog.js +45 -46
- package/bundled/config/materialize-kubbisec-pi-resources.d.ts +1 -1
- package/bundled/config/materialize-kubbisec-pi-resources.js +174 -183
- package/bundled/config/register-custom-llm-providers.d.ts +11 -5
- package/bundled/config/register-custom-llm-providers.js +17 -15
- package/bundled/config/register-kubbisec-llm-provider.d.ts +14 -10
- package/bundled/config/register-kubbisec-llm-provider.js +50 -42
- package/bundled/config/resolve-agents-context-file.d.ts +1 -1
- package/bundled/config/resolve-agents-context-file.js +33 -34
- package/bundled/config/resource-budget.d.ts +12 -12
- package/bundled/config/resource-budget.js +28 -28
- package/bundled/config/sync-kubbisec-pi-models.d.ts +6 -3
- package/bundled/config/sync-kubbisec-pi-models.js +58 -58
- package/bundled/copy/cli-reference-index.d.ts +3 -2
- package/bundled/copy/cli-reference-index.js +1 -1
- package/bundled/copy/kubbisec-shell-copy.d.ts +11 -6
- package/bundled/copy/kubbisec-shell-copy.js +1 -1
- package/bundled/extensions/cli-local-shared.d.ts +45 -26
- package/bundled/extensions/cli-local-shared.js +128 -118
- package/bundled/extensions/kubbisec-aspm-local.extension.d.ts +18 -15
- package/bundled/extensions/kubbisec-aspm-local.extension.js +118 -114
- package/bundled/extensions/kubbisec-brand.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-brand.extension.js +25 -25
- package/bundled/extensions/kubbisec-byok-provider.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-byok-provider.extension.js +2 -2
- package/bundled/extensions/kubbisec-clarify.extension.d.ts +64 -35
- package/bundled/extensions/kubbisec-clarify.extension.js +323 -305
- package/bundled/extensions/kubbisec-exit.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-exit.extension.js +29 -32
- package/bundled/extensions/kubbisec-extended-context.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-extended-context.extension.js +56 -43
- package/bundled/extensions/kubbisec-footer.extension.d.ts +14 -14
- package/bundled/extensions/kubbisec-footer.extension.js +205 -215
- package/bundled/extensions/kubbisec-github-local.extension.d.ts +26 -18
- package/bundled/extensions/kubbisec-github-local.extension.js +123 -116
- package/bundled/extensions/kubbisec-llm-config.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-llm-config.extension.js +200 -181
- package/bundled/extensions/kubbisec-memory.extension.d.ts +9 -7
- package/bundled/extensions/kubbisec-memory.extension.js +88 -95
- package/bundled/extensions/kubbisec-naus-local.extension.d.ts +18 -15
- package/bundled/extensions/kubbisec-naus-local.extension.js +132 -111
- package/bundled/extensions/kubbisec-platform-tools.extension.d.ts +31 -21
- package/bundled/extensions/kubbisec-platform-tools.extension.js +152 -152
- package/bundled/extensions/kubbisec-runtime-status.extension.d.ts +10 -8
- package/bundled/extensions/kubbisec-runtime-status.extension.js +15 -13
- package/bundled/extensions/kubbisec-scope.extension.d.ts +12 -7
- package/bundled/extensions/kubbisec-scope.extension.js +13 -13
- package/bundled/extensions/kubbisec-skill-mentions.extension.d.ts +27 -16
- package/bundled/extensions/kubbisec-skill-mentions.extension.js +73 -63
- package/bundled/extensions/kubbisec-skill-telemetry.extension.d.ts +2 -3
- package/bundled/extensions/kubbisec-skill-telemetry.extension.js +59 -64
- package/bundled/extensions/kubbisec-theme-lock.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-theme-lock.extension.js +33 -34
- package/bundled/extensions/kubbisec-ui.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-ui.extension.js +114 -109
- package/bundled/extensions/kubbisec-workflow.extension.d.ts +20 -18
- package/bundled/extensions/kubbisec-workflow.extension.js +138 -140
- package/bundled/node_modules/@aspm/shared/dist/redaction.test.d.ts +2 -0
- package/bundled/node_modules/@aspm/shared/dist/redaction.test.d.ts.map +1 -0
- package/bundled/node_modules/@aspm/shared/dist/redaction.test.js +626 -0
- package/bundled/node_modules/@aspm/shared/dist/redaction.test.js.map +1 -0
- package/bundled/resolve-bundled-dist-root.js +122 -131
- package/bundled/skills/at-path-mentions.d.ts +1 -1
- package/bundled/skills/at-path-mentions.js +146 -153
- package/bundled/skills/chat-mention-render.d.ts +2 -2
- package/bundled/skills/chat-mention-render.js +121 -126
- package/bundled/skills/chat-mentions.d.ts +17 -8
- package/bundled/skills/chat-mentions.js +76 -76
- package/bundled/skills/list-bundled-skills.d.ts +3 -3
- package/bundled/skills/list-bundled-skills.js +33 -35
- package/bundled/skills/skill-mention.d.ts +10 -2
- package/bundled/skills/skill-mention.js +10 -2
- package/bundled/theme/clear-terminal.d.ts +1 -1
- package/bundled/theme/clear-terminal.js +3 -4
- package/bundled/theme/footer-render-hook.d.ts +1 -1
- package/bundled/theme/footer-render-hook.js +3 -3
- package/bundled/theme/kubbisec-brand-fg.d.ts +1 -1
- package/bundled/theme/kubbisec-brand-fg.js +2 -2
- package/bundled/theme/kubbisec-menu-themes.d.ts +7 -7
- package/bundled/theme/kubbisec-menu-themes.js +30 -31
- package/bundled/theme/kubbisec-theme-name.d.ts +1 -1
- package/bundled/theme/kubbisec-theme-name.js +1 -1
- package/bundled/theme/patch-pi-settings-theme.runtime.d.ts +1 -1
- package/bundled/theme/patch-pi-settings-theme.runtime.js +11 -10
- package/bundled/theme/render-compact-header.d.ts +13 -5
- package/bundled/theme/render-compact-header.js +127 -129
- package/bundled/workflow/session-workflow-mode.d.ts +1 -1
- package/bundled/workflow/session-workflow-mode.js +33 -33
- package/package.json +1 -1
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
import type { ClarifySelectionMode } from "./session-questionnaire.types.js";
|
|
2
2
|
export type ClarifyOptionId = "A" | "B" | "C" | "D" | "E";
|
|
3
|
-
export type ClarifyAnswer =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
3
|
+
export type ClarifyAnswer =
|
|
4
|
+
| {
|
|
5
|
+
kind: "option";
|
|
6
|
+
optionId: ClarifyOptionId;
|
|
7
|
+
detail?: string;
|
|
8
|
+
}
|
|
9
|
+
| {
|
|
10
|
+
kind: "multi";
|
|
11
|
+
optionIds: ClarifyOptionId[];
|
|
12
|
+
}
|
|
13
|
+
| {
|
|
14
|
+
kind: "custom";
|
|
15
|
+
text: string;
|
|
16
|
+
}
|
|
17
|
+
| {
|
|
18
|
+
kind: "ready";
|
|
19
|
+
}
|
|
20
|
+
| {
|
|
21
|
+
kind: "invalid";
|
|
22
|
+
};
|
|
18
23
|
/** Parse a user reply to a sec-clarify multiple-choice question (CLAR-004). */
|
|
19
|
-
export declare function parseClarifyAnswer(
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
export declare function parseClarifyAnswer(
|
|
25
|
+
text: string,
|
|
26
|
+
selectionMode?: ClarifySelectionMode,
|
|
27
|
+
): ClarifyAnswer;
|
|
28
|
+
export declare function formatSelectionSubmit(
|
|
29
|
+
selected: Set<ClarifyOptionId>,
|
|
30
|
+
selectionMode: ClarifySelectionMode,
|
|
31
|
+
): string | null;
|
|
32
|
+
//# sourceMappingURL=parse-clarify-answer.d.ts.map
|
|
@@ -1,57 +1,51 @@
|
|
|
1
1
|
const READY_PHRASE = /^pode\s+executar\b/i;
|
|
2
2
|
const OPTION_LETTERS = new Set(["A", "B", "C", "D", "E"]);
|
|
3
3
|
function parseMultiLetters(trimmed) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
...new Set(compact.split("").filter((c) => OPTION_LETTERS.has(c))),
|
|
9
|
-
];
|
|
10
|
-
return ids.length > 0 ? ids : null;
|
|
4
|
+
const compact = trimmed.replace(/[\s,;|]+/g, "").toUpperCase();
|
|
5
|
+
if (!compact || !/^[A-D]+$/.test(compact)) return null;
|
|
6
|
+
const ids = [...new Set(compact.split("").filter((c) => OPTION_LETTERS.has(c)))];
|
|
7
|
+
return ids.length > 0 ? ids : null;
|
|
11
8
|
}
|
|
12
9
|
/** Parse a user reply to a sec-clarify multiple-choice question (CLAR-004). */
|
|
13
10
|
export function parseClarifyAnswer(text, selectionMode = "single") {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
const trimmed = text.trim();
|
|
12
|
+
if (!trimmed) {
|
|
13
|
+
return { kind: "invalid" };
|
|
14
|
+
}
|
|
15
|
+
if (READY_PHRASE.test(trimmed)) {
|
|
16
|
+
return { kind: "ready" };
|
|
17
|
+
}
|
|
18
|
+
if (selectionMode === "multi") {
|
|
19
|
+
const multi = parseMultiLetters(trimmed);
|
|
20
|
+
if (multi && multi.length > 1) {
|
|
21
|
+
return { kind: "multi", optionIds: multi };
|
|
17
22
|
}
|
|
18
|
-
if (
|
|
19
|
-
|
|
23
|
+
if (multi?.length === 1) {
|
|
24
|
+
return { kind: "option", optionId: multi[0] };
|
|
20
25
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
26
|
+
}
|
|
27
|
+
const match = trimmed.match(/^([A-D])\b([\s\S]*)$/i);
|
|
28
|
+
if (match?.[1]) {
|
|
29
|
+
const optionId = match[1].toUpperCase();
|
|
30
|
+
const remainder = (match[2] ?? "").trim().replace(/^[\s:,\-–—]+/, "");
|
|
31
|
+
if (remainder) {
|
|
32
|
+
return { kind: "option", optionId, detail: remainder };
|
|
29
33
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const legacyOther = trimmed.match(/^E\b([\s\S]*)$/i);
|
|
41
|
-
if (legacyOther) {
|
|
42
|
-
const detail = (legacyOther[1] ?? "").trim().replace(/^[\s:,\-–—]+/, "");
|
|
43
|
-
if (detail)
|
|
44
|
-
return { kind: "custom", text: detail };
|
|
45
|
-
return { kind: "option", optionId: "D" };
|
|
46
|
-
}
|
|
47
|
-
return { kind: "custom", text: trimmed };
|
|
34
|
+
return { kind: "option", optionId };
|
|
35
|
+
}
|
|
36
|
+
// Legacy E) other
|
|
37
|
+
const legacyOther = trimmed.match(/^E\b([\s\S]*)$/i);
|
|
38
|
+
if (legacyOther) {
|
|
39
|
+
const detail = (legacyOther[1] ?? "").trim().replace(/^[\s:,\-–—]+/, "");
|
|
40
|
+
if (detail) return { kind: "custom", text: detail };
|
|
41
|
+
return { kind: "option", optionId: "D" };
|
|
42
|
+
}
|
|
43
|
+
return { kind: "custom", text: trimmed };
|
|
48
44
|
}
|
|
49
45
|
export function formatSelectionSubmit(selected, selectionMode) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return ids.join(" ");
|
|
55
|
-
return ids[0] ?? null;
|
|
46
|
+
const ids = [...selected].filter((id) => id !== "D" && id !== "E").sort();
|
|
47
|
+
if (ids.length === 0) return null;
|
|
48
|
+
if (selectionMode === "multi") return ids.join(" ");
|
|
49
|
+
return ids[0] ?? null;
|
|
56
50
|
}
|
|
57
|
-
//# sourceMappingURL=parse-clarify-answer.js.map
|
|
51
|
+
//# sourceMappingURL=parse-clarify-answer.js.map
|
|
@@ -1,39 +1,50 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
ClarifyOptionId,
|
|
3
|
+
ClarifySelectionMode,
|
|
4
|
+
QuestionnaireScenario,
|
|
5
|
+
SessionQuestionnaireFields,
|
|
6
|
+
} from "./session-questionnaire.types.js";
|
|
2
7
|
export type ClarifyQuestionOption = {
|
|
3
|
-
|
|
4
|
-
|
|
8
|
+
id: "A" | "B" | "C";
|
|
9
|
+
label: string;
|
|
5
10
|
};
|
|
6
11
|
/** Build a compact structured question (max 3 choices + Outro). */
|
|
7
12
|
export declare function formatClarifyQuestionMarkdown(input: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
question: string;
|
|
14
|
+
options: ClarifyQuestionOption[];
|
|
15
|
+
language?: "pt" | "en";
|
|
11
16
|
}): string;
|
|
12
17
|
export declare function buildOptionsFromLabels(labels: string[]): ClarifyQuestionOption[];
|
|
13
18
|
export declare function selectionModeForField(field: string): ClarifySelectionMode;
|
|
14
|
-
export declare function resolveOptionLabel(
|
|
19
|
+
export declare function resolveOptionLabel(
|
|
20
|
+
optionId: ClarifyOptionId,
|
|
21
|
+
optionLabels: string[],
|
|
22
|
+
): string | null;
|
|
15
23
|
export declare function severityFromOptionLabel(label: string): string;
|
|
16
24
|
export type ScenarioFieldHint = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
25
|
+
field: string;
|
|
26
|
+
purpose: string;
|
|
27
|
+
exampleQuestion: string;
|
|
28
|
+
exampleOptions: string[];
|
|
21
29
|
};
|
|
22
30
|
/** Scenario-aware hints — suggestions only; agent or auto-ask uses these. */
|
|
23
|
-
export declare function suggestScenarioFields(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
export declare function suggestScenarioFields(
|
|
32
|
+
scenario: QuestionnaireScenario,
|
|
33
|
+
fields: SessionQuestionnaireFields,
|
|
34
|
+
): {
|
|
35
|
+
scenario: QuestionnaireScenario;
|
|
36
|
+
missingFields: string[];
|
|
37
|
+
nextHint: ScenarioFieldHint | null;
|
|
27
38
|
};
|
|
28
39
|
export declare function inferScenarioFromMessage(message: string): QuestionnaireScenario;
|
|
29
40
|
export declare function formatQuestionFromInput(input: {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
question: string;
|
|
42
|
+
options: string[];
|
|
43
|
+
language?: "pt" | "en";
|
|
44
|
+
field?: string;
|
|
34
45
|
}): {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
46
|
+
markdown: string;
|
|
47
|
+
optionLabels: string[];
|
|
48
|
+
selectionMode: ClarifySelectionMode;
|
|
38
49
|
};
|
|
39
|
-
//# sourceMappingURL=question-format.d.ts.map
|
|
50
|
+
//# sourceMappingURL=question-format.d.ts.map
|
|
@@ -3,142 +3,135 @@ const OTHER_OPTION_ID = "D";
|
|
|
3
3
|
const MULTI_SELECT_FIELDS = new Set(["severityMin", "scanners", "findingTypes"]);
|
|
4
4
|
/** Build a compact structured question (max 3 choices + Outro). */
|
|
5
5
|
export function formatClarifyQuestionMarkdown(input) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
const lines = [input.question.trim(), ""];
|
|
7
|
+
for (const opt of input.options.slice(0, 3)) {
|
|
8
|
+
lines.push(`${opt.id}) ${opt.label}`);
|
|
9
|
+
}
|
|
10
|
+
const otherLabel = input.language === "en" ? "Other — type below" : "Outro — escreva abaixo";
|
|
11
|
+
lines.push(`${OTHER_OPTION_ID}) ${otherLabel}`);
|
|
12
|
+
return lines.join("\n");
|
|
13
13
|
}
|
|
14
14
|
export function buildOptionsFromLabels(labels) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
return labels.slice(0, 3).map((label, index) => ({
|
|
16
|
+
id: OPTION_IDS[index] ?? "C",
|
|
17
|
+
label: label.trim(),
|
|
18
|
+
}));
|
|
19
19
|
}
|
|
20
20
|
export function selectionModeForField(field) {
|
|
21
|
-
|
|
21
|
+
return MULTI_SELECT_FIELDS.has(field) ? "multi" : "single";
|
|
22
22
|
}
|
|
23
23
|
export function resolveOptionLabel(optionId, optionLabels) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return null;
|
|
29
|
-
return optionLabels[index] ?? null;
|
|
24
|
+
if (optionId === "D" || optionId === "E") return null;
|
|
25
|
+
const index = OPTION_IDS.indexOf(optionId);
|
|
26
|
+
if (index < 0 || index >= optionLabels.length) return null;
|
|
27
|
+
return optionLabels[index] ?? null;
|
|
30
28
|
}
|
|
31
29
|
export function severityFromOptionLabel(label) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return "ALL";
|
|
43
|
-
return upper;
|
|
30
|
+
const upper = label.trim().toUpperCase();
|
|
31
|
+
if (upper.includes("CRITICAL") || upper.includes("CRÍTICO") || upper.includes("CRITICO")) {
|
|
32
|
+
return "CRITICAL";
|
|
33
|
+
}
|
|
34
|
+
if (upper.includes("HIGH") || upper.includes("ALTO")) return "HIGH";
|
|
35
|
+
if (upper.includes("MEDIUM") || upper.includes("MÉDIO") || upper.includes("MEDIO")) {
|
|
36
|
+
return "MEDIUM";
|
|
37
|
+
}
|
|
38
|
+
if (upper.includes("TODAS") || upper.includes("ALL")) return "ALL";
|
|
39
|
+
return upper;
|
|
44
40
|
}
|
|
45
41
|
const SCENARIO_HINTS = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
42
|
+
remediation: [
|
|
43
|
+
{
|
|
44
|
+
field: "projectIds",
|
|
45
|
+
purpose: "Projeto/asset alvo",
|
|
46
|
+
exampleQuestion: "Qual projeto KubbiSec devemos remediar?",
|
|
47
|
+
exampleOptions: ["Projeto padrão da sessão", "Outro projeto", "Listar opções"],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
field: "severityMin",
|
|
51
|
+
purpose: "Severidade mínima no escopo",
|
|
52
|
+
exampleQuestion: "Qual severidade mínima entra no escopo?",
|
|
53
|
+
exampleOptions: ["CRITICAL", "HIGH", "MEDIUM"],
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
field: "remediationMode",
|
|
57
|
+
purpose: "Modo de remediação",
|
|
58
|
+
exampleQuestion: "Como devemos remediar?",
|
|
59
|
+
exampleOptions: ["Automático (PR/patch)", "Só sugestões", "Híbrido"],
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
plan: [
|
|
63
|
+
{
|
|
64
|
+
field: "projectIds",
|
|
65
|
+
purpose: "Projeto/asset",
|
|
66
|
+
exampleQuestion: "Para qual projeto é este plano?",
|
|
67
|
+
exampleOptions: ["Sessão atual", "Outro projeto", "Monorepo"],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
field: "customNotes",
|
|
71
|
+
purpose: "Objetivo do plano",
|
|
72
|
+
exampleQuestion: "Qual é o objetivo principal deste plano?",
|
|
73
|
+
exampleOptions: ["Correção CVE", "Pipeline NAUS", "Hardening"],
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
explore: [
|
|
77
|
+
{
|
|
78
|
+
field: "projectIds",
|
|
79
|
+
purpose: "Contexto do projeto",
|
|
80
|
+
exampleQuestion: "Sobre qual projeto quer explorar findings?",
|
|
81
|
+
exampleOptions: ["Padrão", "Outro", "Organização inteira"],
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
review: [
|
|
85
|
+
{
|
|
86
|
+
field: "projectIds",
|
|
87
|
+
purpose: "Projeto em revisão",
|
|
88
|
+
exampleQuestion: "Qual projeto estamos a rever?",
|
|
89
|
+
exampleOptions: ["Atual", "Outro", "PR específico"],
|
|
90
|
+
},
|
|
91
|
+
],
|
|
96
92
|
};
|
|
97
93
|
function isFieldFilled(fields, field) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
94
|
+
switch (field) {
|
|
95
|
+
case "projectIds":
|
|
96
|
+
return fields.projectIds.length > 0;
|
|
97
|
+
case "severityMin":
|
|
98
|
+
return Boolean(fields.severityMin);
|
|
99
|
+
case "remediationMode":
|
|
100
|
+
return Boolean(fields.remediationMode);
|
|
101
|
+
case "nausConstraints":
|
|
102
|
+
return fields.nausConstraints != null;
|
|
103
|
+
case "extendedContext":
|
|
104
|
+
return fields.extendedContext != null;
|
|
105
|
+
case "customNotes":
|
|
106
|
+
return Boolean(fields.customNotes?.trim());
|
|
107
|
+
default:
|
|
108
|
+
return Boolean(fields.extras[field]?.trim());
|
|
109
|
+
}
|
|
114
110
|
}
|
|
115
111
|
/** Scenario-aware hints — suggestions only; agent or auto-ask uses these. */
|
|
116
112
|
export function suggestScenarioFields(scenario, fields) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
113
|
+
const hints = SCENARIO_HINTS[scenario] ?? SCENARIO_HINTS.remediation;
|
|
114
|
+
const missingFields = hints.map((h) => h.field).filter((field) => !isFieldFilled(fields, field));
|
|
115
|
+
const nextHint = hints.find((h) => !isFieldFilled(fields, h.field)) ?? null;
|
|
116
|
+
return { scenario, missingFields, nextHint };
|
|
121
117
|
}
|
|
122
118
|
export function inferScenarioFromMessage(message) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (/\b(o que|explain|explor|listar|mostrar)\b/i.test(message))
|
|
128
|
-
return "explore";
|
|
129
|
-
return "remediation";
|
|
119
|
+
if (/@plan\b|\/mode:plan\b|brainstorm|spec\b/i.test(message)) return "plan";
|
|
120
|
+
if (/\b(review|revisão|revisao|code review)\b/i.test(message)) return "review";
|
|
121
|
+
if (/\b(o que|explain|explor|listar|mostrar)\b/i.test(message)) return "explore";
|
|
122
|
+
return "remediation";
|
|
130
123
|
}
|
|
131
124
|
export function formatQuestionFromInput(input) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
125
|
+
const optionLabels = input.options
|
|
126
|
+
.map((o) => o.trim())
|
|
127
|
+
.filter(Boolean)
|
|
128
|
+
.slice(0, 3);
|
|
129
|
+
const markdown = formatClarifyQuestionMarkdown({
|
|
130
|
+
question: input.question,
|
|
131
|
+
options: buildOptionsFromLabels(optionLabels),
|
|
132
|
+
language: input.language,
|
|
133
|
+
});
|
|
134
|
+
const selectionMode = input.field ? selectionModeForField(input.field) : "single";
|
|
135
|
+
return { markdown, optionLabels, selectionMode };
|
|
143
136
|
}
|
|
144
|
-
//# sourceMappingURL=question-format.js.map
|
|
137
|
+
//# sourceMappingURL=question-format.js.map
|
|
@@ -1,25 +1,36 @@
|
|
|
1
1
|
import { Type } from "@earendil-works/pi-ai";
|
|
2
2
|
import type { ClarifyAnswer } from "./parse-clarify-answer.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
QuestionnaireScenario,
|
|
5
|
+
SessionQuestionnaire,
|
|
6
|
+
SessionQuestionnaireFields,
|
|
7
|
+
} from "./session-questionnaire.types.js";
|
|
4
8
|
export type QuestionnaireToolAction = "ask" | "record" | "complete" | "status";
|
|
5
9
|
export type QuestionnaireToolInput = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
action: QuestionnaireToolAction;
|
|
11
|
+
field?: string;
|
|
12
|
+
question?: string;
|
|
13
|
+
options?: string[];
|
|
14
|
+
scenario?: QuestionnaireScenario;
|
|
15
|
+
fields?: Partial<SessionQuestionnaireFields> & Record<string, unknown>;
|
|
16
|
+
language?: "pt" | "en";
|
|
13
17
|
};
|
|
14
18
|
export type QuestionnaireToolResult = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
ok: boolean;
|
|
20
|
+
action: QuestionnaireToolAction;
|
|
21
|
+
status: SessionQuestionnaire["status"];
|
|
22
|
+
message: string;
|
|
23
|
+
formattedQuestion?: string;
|
|
24
|
+
questionnaire: SessionQuestionnaire;
|
|
21
25
|
};
|
|
22
|
-
export declare function executeQuestionnaireTool(
|
|
26
|
+
export declare function executeQuestionnaireTool(
|
|
27
|
+
questionnaire: SessionQuestionnaire,
|
|
28
|
+
input: QuestionnaireToolInput,
|
|
29
|
+
userMessage?: string,
|
|
30
|
+
): QuestionnaireToolResult;
|
|
23
31
|
export declare function questionnaireToolParametersSchema(): ReturnType<typeof Type.Object>;
|
|
24
|
-
export declare function applyParsedUserAnswerIfPending(
|
|
25
|
-
|
|
32
|
+
export declare function applyParsedUserAnswerIfPending(
|
|
33
|
+
questionnaire: SessionQuestionnaire,
|
|
34
|
+
parsed: ClarifyAnswer,
|
|
35
|
+
): SessionQuestionnaire;
|
|
36
|
+
//# sourceMappingURL=questionnaire-tool.d.ts.map
|