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