@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
@@ -6,180 +6,180 @@ import { isCliDebugMode } from "@aspm/shared/cli-user-error";
6
6
  import { Type } from "@earendil-works/pi-ai";
7
7
  import { getKubbisecConfigPath } from "@kubbisec/home";
8
8
  import { extendedContextEnabled, resolveExtendedWorkspace } from "../config/extended-context.js";
9
+
9
10
  const MAX_TOOL_RESULT_CHARS = 24_000;
10
11
  function resolveApiBaseUrl() {
11
- const raw = process.env.KUBBISEC_API_URL?.trim() ||
12
- process.env.KUBBISEC_AI_API_URL?.trim() ||
13
- process.env.ASPM_API_URL?.trim();
14
- return raw?.replace(/\/$/, "");
12
+ const raw =
13
+ process.env.KUBBISEC_API_URL?.trim() ||
14
+ process.env.KUBBISEC_AI_API_URL?.trim() ||
15
+ process.env.ASPM_API_URL?.trim();
16
+ return raw?.replace(/\/$/, "");
15
17
  }
16
18
  function resolveApiKey() {
17
- return (process.env.KUBBISEC_API_KEY?.trim() ||
18
- process.env.KUBBISEC_JOB_TOKEN?.trim() ||
19
- process.env.OPENAI_API_KEY?.trim());
19
+ return (
20
+ process.env.KUBBISEC_API_KEY?.trim() ||
21
+ process.env.KUBBISEC_JOB_TOKEN?.trim() ||
22
+ process.env.OPENAI_API_KEY?.trim()
23
+ );
20
24
  }
21
25
  function readDefaultProjectId() {
22
- const fromEnv = process.env.KUBBISEC_CONTEXT_PROJECT_ID?.trim();
23
- if (fromEnv)
24
- return fromEnv;
25
- try {
26
- const raw = fs.readFileSync(getKubbisecConfigPath(), "utf8");
27
- const parsed = JSON.parse(raw);
28
- return parsed.defaultProject?.trim() || undefined;
29
- }
30
- catch {
31
- return undefined;
32
- }
26
+ const fromEnv = process.env.KUBBISEC_CONTEXT_PROJECT_ID?.trim();
27
+ if (fromEnv) return fromEnv;
28
+ try {
29
+ const raw = fs.readFileSync(getKubbisecConfigPath(), "utf8");
30
+ const parsed = JSON.parse(raw);
31
+ return parsed.defaultProject?.trim() || undefined;
32
+ } catch {
33
+ return undefined;
34
+ }
33
35
  }
34
36
  export function extractVulnerabilityIdFromParams(params) {
35
- const id = (typeof params.vulnerabilityId === "string" ? params.vulnerabilityId.trim() : "") ||
36
- (typeof params.vulnerability_id === "string" ? params.vulnerability_id.trim() : "") ||
37
- "";
38
- return id || undefined;
37
+ const id =
38
+ (typeof params.vulnerabilityId === "string" ? params.vulnerabilityId.trim() : "") ||
39
+ (typeof params.vulnerability_id === "string" ? params.vulnerability_id.trim() : "") ||
40
+ "";
41
+ return id || undefined;
39
42
  }
40
43
  export function catalogParametersSchema(parameters) {
41
- if (parameters && typeof parameters === "object" && Object.keys(parameters).length > 0) {
42
- return parameters;
43
- }
44
- return Type.Object({});
44
+ if (parameters && typeof parameters === "object" && Object.keys(parameters).length > 0) {
45
+ return parameters;
46
+ }
47
+ return Type.Object({});
45
48
  }
46
49
  function truncateToolText(text) {
47
- if (text.length <= MAX_TOOL_RESULT_CHARS)
48
- return text;
49
- return `${text.slice(0, MAX_TOOL_RESULT_CHARS)}\n\n…[truncated ${text.length - MAX_TOOL_RESULT_CHARS} chars]`;
50
+ if (text.length <= MAX_TOOL_RESULT_CHARS) return text;
51
+ return `${text.slice(0, MAX_TOOL_RESULT_CHARS)}\n\n…[truncated ${text.length - MAX_TOOL_RESULT_CHARS} chars]`;
50
52
  }
51
53
  function catalogHeaders(apiKey) {
52
- const headers = {
53
- "x-api-key": apiKey,
54
- "Content-Type": "application/json",
55
- };
56
- const orgId = process.env.KUBBISEC_ORG_ID?.trim();
57
- if (orgId)
58
- headers["x-organization-id"] = orgId;
59
- return headers;
54
+ const headers = {
55
+ "x-api-key": apiKey,
56
+ "Content-Type": "application/json",
57
+ };
58
+ const orgId = process.env.KUBBISEC_ORG_ID?.trim();
59
+ if (orgId) headers["x-organization-id"] = orgId;
60
+ return headers;
60
61
  }
61
62
  async function fetchCatalog(baseUrl, apiKey) {
62
- const res = await fetch(`${baseUrl}/v1/ai/assistant/tools/catalog`, {
63
- headers: catalogHeaders(apiKey),
63
+ const res = await fetch(`${baseUrl}/v1/ai/assistant/tools/catalog`, {
64
+ headers: catalogHeaders(apiKey),
65
+ });
66
+ if (!res.ok) {
67
+ throw new Error(`catalog HTTP ${res.status}`);
68
+ }
69
+ const body = await res.json();
70
+ return (body.tools ?? []).filter((t) => t.available);
71
+ }
72
+ export default function kubbisecPlatformTools(api) {
73
+ let activeVulnerabilityId;
74
+ function buildToolContext() {
75
+ const projectId = readDefaultProjectId();
76
+ const ctx = projectId ? { projectId, mode: "draft" } : {};
77
+ if (extendedContextEnabled()) {
78
+ ctx.allowExtendedLocalContext = true;
79
+ ctx.localWorkspacePath = resolveExtendedWorkspace();
80
+ }
81
+ if (activeVulnerabilityId) {
82
+ ctx.vulnerabilityId = activeVulnerabilityId;
83
+ ctx.finding = { vulnerabilityId: activeVulnerabilityId };
84
+ }
85
+ return ctx;
86
+ }
87
+ async function executeRemoteTool(baseUrl, apiKey, name, args) {
88
+ const remembered = extractVulnerabilityIdFromParams(args);
89
+ if (remembered) activeVulnerabilityId = remembered;
90
+ const res = await fetch(`${baseUrl}/v1/ai/assistant/tools/execute`, {
91
+ method: "POST",
92
+ headers: catalogHeaders(apiKey),
93
+ body: JSON.stringify({
94
+ name,
95
+ arguments: args,
96
+ context: buildToolContext(),
97
+ }),
64
98
  });
65
99
  if (!res.ok) {
66
- throw new Error(`catalog HTTP ${res.status}`);
100
+ return {
101
+ ok: false,
102
+ result: { error: "Não foi possível contactar a API KubbiSec." },
103
+ userMessage: "Não foi possível contactar a API KubbiSec.",
104
+ };
67
105
  }
68
- const body = (await res.json());
69
- return (body.tools ?? []).filter((t) => t.available);
70
- }
71
- export default function kubbisecPlatformTools(api) {
72
- let activeVulnerabilityId;
73
- function buildToolContext() {
74
- const projectId = readDefaultProjectId();
75
- const ctx = projectId ? { projectId, mode: "draft" } : {};
76
- if (extendedContextEnabled()) {
77
- ctx.allowExtendedLocalContext = true;
78
- ctx.localWorkspacePath = resolveExtendedWorkspace();
79
- }
80
- if (activeVulnerabilityId) {
81
- ctx.vulnerabilityId = activeVulnerabilityId;
82
- ctx.finding = { vulnerabilityId: activeVulnerabilityId };
83
- }
84
- return ctx;
106
+ return await res.json();
107
+ }
108
+ function formatRemoteToolText(remote) {
109
+ if (!remote.ok) {
110
+ return remote.userMessage ?? "A operação na plataforma KubbiSec falhou.";
85
111
  }
86
- async function executeRemoteTool(baseUrl, apiKey, name, args) {
87
- const remembered = extractVulnerabilityIdFromParams(args);
88
- if (remembered)
89
- activeVulnerabilityId = remembered;
90
- const res = await fetch(`${baseUrl}/v1/ai/assistant/tools/execute`, {
91
- method: "POST",
92
- headers: catalogHeaders(apiKey),
93
- body: JSON.stringify({
94
- name,
95
- arguments: args,
96
- context: buildToolContext(),
97
- }),
98
- });
99
- if (!res.ok) {
100
- return {
101
- ok: false,
102
- result: { error: "Não foi possível contactar a API KubbiSec." },
103
- userMessage: "Não foi possível contactar a API KubbiSec.",
104
- };
105
- }
106
- return (await res.json());
112
+ if (isCliDebugMode()) {
113
+ return truncateToolText(JSON.stringify(remote.result, null, 2));
114
+ }
115
+ if (remote.result && typeof remote.result === "object" && !Array.isArray(remote.result)) {
116
+ const record = remote.result;
117
+ const safe = {};
118
+ for (const [key, value] of Object.entries(record)) {
119
+ if (key === "stack" || key === "traceId" || key === "trace") continue;
120
+ safe[key] = value;
121
+ }
122
+ return truncateToolText(JSON.stringify(safe, null, 2));
123
+ }
124
+ return truncateToolText(JSON.stringify(remote.result, null, 2));
125
+ }
126
+ api.on("session_start", async (_event, ctx) => {
127
+ activeVulnerabilityId = undefined;
128
+ const baseUrl = resolveApiBaseUrl();
129
+ const apiKey = resolveApiKey();
130
+ if (!baseUrl || !apiKey) {
131
+ ctx.ui?.setStatus("kubbisec-tools", "tools skipped");
132
+ ctx.ui?.notify(
133
+ "KubbiSec platform tools skipped (set KUBBISEC_API_URL + KUBBISEC_API_KEY)",
134
+ "warning",
135
+ );
136
+ return;
107
137
  }
108
- function formatRemoteToolText(remote) {
109
- if (!remote.ok) {
110
- return remote.userMessage ?? "A operação na plataforma KubbiSec falhou.";
111
- }
112
- if (isCliDebugMode()) {
113
- return truncateToolText(JSON.stringify(remote.result, null, 2));
114
- }
115
- if (remote.result && typeof remote.result === "object" && !Array.isArray(remote.result)) {
116
- const record = remote.result;
117
- const safe = {};
118
- for (const [key, value] of Object.entries(record)) {
119
- if (key === "stack" || key === "traceId" || key === "trace")
120
- continue;
121
- safe[key] = value;
122
- }
123
- return truncateToolText(JSON.stringify(safe, null, 2));
124
- }
125
- return truncateToolText(JSON.stringify(remote.result, null, 2));
138
+ let tools;
139
+ try {
140
+ tools = await fetchCatalog(baseUrl, apiKey);
141
+ } catch {
142
+ ctx.ui?.setStatus("kubbisec-tools", "tools unavailable");
143
+ ctx.ui?.notify("Não foi possível carregar as ferramentas da plataforma KubbiSec.", "warning");
144
+ return;
126
145
  }
127
- api.on("session_start", async (_event, ctx) => {
128
- activeVulnerabilityId = undefined;
129
- const baseUrl = resolveApiBaseUrl();
130
- const apiKey = resolveApiKey();
131
- if (!baseUrl || !apiKey) {
132
- ctx.ui?.setStatus("kubbisec-tools", "tools skipped");
133
- ctx.ui?.notify("KubbiSec platform tools skipped (set KUBBISEC_API_URL + KUBBISEC_API_KEY)", "warning");
134
- return;
135
- }
136
- let tools;
137
- try {
138
- tools = await fetchCatalog(baseUrl, apiKey);
139
- }
140
- catch {
141
- ctx.ui?.setStatus("kubbisec-tools", "tools unavailable");
142
- ctx.ui?.notify("Não foi possível carregar as ferramentas da plataforma KubbiSec.", "warning");
143
- return;
144
- }
145
- for (const tool of tools) {
146
- api.registerTool({
146
+ for (const tool of tools) {
147
+ api.registerTool({
148
+ name: tool.name,
149
+ label: tool.name,
150
+ description: tool.description,
151
+ parameters: catalogParametersSchema(tool.parameters),
152
+ async execute(_toolCallId, params) {
153
+ try {
154
+ const remote = await executeRemoteTool(baseUrl, apiKey, tool.name, params);
155
+ const text = formatRemoteToolText(remote);
156
+ return {
157
+ content: [{ type: "text", text }],
158
+ details: {
159
+ ok: remote.ok,
147
160
  name: tool.name,
148
- label: tool.name,
149
- description: tool.description,
150
- parameters: catalogParametersSchema(tool.parameters),
151
- async execute(_toolCallId, params) {
152
- try {
153
- const remote = await executeRemoteTool(baseUrl, apiKey, tool.name, params);
154
- const text = formatRemoteToolText(remote);
155
- return {
156
- content: [{ type: "text", text }],
157
- details: {
158
- ok: remote.ok,
159
- name: tool.name,
160
- userMessage: remote.userMessage,
161
- },
162
- };
163
- }
164
- catch {
165
- return {
166
- content: [
167
- {
168
- type: "text",
169
- text: "Não foi possível executar a ferramenta na plataforma KubbiSec.",
170
- },
171
- ],
172
- details: {
173
- ok: false,
174
- name: tool.name,
175
- userMessage: "Não foi possível executar a ferramenta na plataforma KubbiSec.",
176
- },
177
- };
178
- }
161
+ userMessage: remote.userMessage,
162
+ },
163
+ };
164
+ } catch {
165
+ return {
166
+ content: [
167
+ {
168
+ type: "text",
169
+ text: "Não foi possível executar a ferramenta na plataforma KubbiSec.",
179
170
  },
180
- });
181
- }
182
- ctx.ui?.setStatus("kubbisec-tools", `${tools.length} tools`);
183
- });
171
+ ],
172
+ details: {
173
+ ok: false,
174
+ name: tool.name,
175
+ userMessage: "Não foi possível executar a ferramenta na plataforma KubbiSec.",
176
+ },
177
+ };
178
+ }
179
+ },
180
+ });
181
+ }
182
+ ctx.ui?.setStatus("kubbisec-tools", `${tools.length} tools`);
183
+ });
184
184
  }
185
- //# sourceMappingURL=kubbisec-platform-tools.extension.js.map
185
+ //# sourceMappingURL=kubbisec-platform-tools.extension.js.map
@@ -1,13 +1,15 @@
1
1
  type ExtensionApi = {
2
- on: (event: string, handler: (event: unknown, ctx: ExtensionContext) => void | Promise<void>) => void;
2
+ on: (
3
+ event: string,
4
+ handler: (event: unknown, ctx: ExtensionContext) => void | Promise<void>,
5
+ ) => void;
3
6
  };
4
7
  type ExtensionContext = {
5
- hasUI: boolean;
6
- cwd: string;
7
- ui: {
8
- setStatus: (key: string, text: string | undefined) => void;
9
- };
8
+ hasUI: boolean;
9
+ cwd: string;
10
+ ui: {
11
+ setStatus: (key: string, text: string | undefined) => void;
12
+ };
10
13
  };
11
14
  export default function kubbisecRuntimeStatus(api: ExtensionApi): void;
12
- export {};
13
- //# sourceMappingURL=kubbisec-runtime-status.extension.d.ts.map
15
+ //# sourceMappingURL=kubbisec-runtime-status.extension.d.ts.map
@@ -1,18 +1,20 @@
1
1
  /**
2
2
  * Footer status for loaded context file (AGENTS.md / CLAUDE.md) — not shown in chat startup listing.
3
3
  */
4
- import { findAgentsContextFile, formatKubbisecContextStatus, } from "../config/resolve-agents-context-file.js";
4
+ import {
5
+ findAgentsContextFile,
6
+ formatKubbisecContextStatus,
7
+ } from "../config/resolve-agents-context-file.js";
5
8
  export default function kubbisecRuntimeStatus(api) {
6
- api.on("session_start", async (_event, ctx) => {
7
- if (!ctx.hasUI)
8
- return;
9
- const agentsFile = findAgentsContextFile(ctx.cwd);
10
- if (!agentsFile) {
11
- ctx.ui.setStatus("kubbisec-ctx", undefined);
12
- return;
13
- }
14
- const home = process.env.HOME || process.env.USERPROFILE;
15
- ctx.ui.setStatus("kubbisec-ctx", formatKubbisecContextStatus(agentsFile, home));
16
- });
9
+ api.on("session_start", async (_event, ctx) => {
10
+ if (!ctx.hasUI) return;
11
+ const agentsFile = findAgentsContextFile(ctx.cwd);
12
+ if (!agentsFile) {
13
+ ctx.ui.setStatus("kubbisec-ctx", undefined);
14
+ return;
15
+ }
16
+ const home = process.env.HOME || process.env.USERPROFILE;
17
+ ctx.ui.setStatus("kubbisec-ctx", formatKubbisecContextStatus(agentsFile, home));
18
+ });
17
19
  }
18
- //# sourceMappingURL=kubbisec-runtime-status.extension.js.map
20
+ //# sourceMappingURL=kubbisec-runtime-status.extension.js.map
@@ -1,14 +1,19 @@
1
1
  type ExtensionApi = {
2
- on: (event: string, handler: (event: {
2
+ on: (
3
+ event: string,
4
+ handler: (
5
+ event: {
3
6
  type?: string;
4
7
  content?: string;
5
- }, ctx: ExtensionContext) => void | Promise<void>) => void;
8
+ },
9
+ ctx: ExtensionContext,
10
+ ) => void | Promise<void>,
11
+ ) => void;
6
12
  };
7
13
  type ExtensionContext = {
8
- ui?: {
9
- notify: (message: string, level: string) => void;
10
- };
14
+ ui?: {
15
+ notify: (message: string, level: string) => void;
16
+ };
11
17
  };
12
18
  export default function kubbisecScope(api: ExtensionApi): void;
13
- export {};
14
- //# sourceMappingURL=kubbisec-scope.extension.d.ts.map
19
+ //# sourceMappingURL=kubbisec-scope.extension.d.ts.map
@@ -1,18 +1,18 @@
1
1
  /** Soft guard: only nudge on clearly non-technical chit-chat; platform/NAUS questions use tools. */
2
- const OFF_TOPIC_HINT = "This looks like general chat. For KubbiSec product or pipeline help, ask about ASPM, NAUS, findings, or CI — tools can fetch real docs and data.";
2
+ const OFF_TOPIC_HINT =
3
+ "This looks like general chat. For KubbiSec product or pipeline help, ask about ASPM, NAUS, findings, or CI — tools can fetch real docs and data.";
3
4
  const OFF_TOPIC_PATTERNS = [
4
- /\bwrite (me )?a poem\b/i,
5
- /\btell (me )?a joke\b/i,
6
- /\bplay a game\b/i,
5
+ /\bwrite (me )?a poem\b/i,
6
+ /\btell (me )?a joke\b/i,
7
+ /\bplay a game\b/i,
7
8
  ];
8
9
  export default function kubbisecScope(api) {
9
- api.on("before_user_message", async (event, ctx) => {
10
- const text = typeof event.content === "string" ? event.content.trim() : "";
11
- if (!text || text.startsWith("/"))
12
- return;
13
- if (OFF_TOPIC_PATTERNS.some((p) => p.test(text)) && text.length < 80) {
14
- ctx.ui?.notify(OFF_TOPIC_HINT, "info");
15
- }
16
- });
10
+ api.on("before_user_message", async (event, ctx) => {
11
+ const text = typeof event.content === "string" ? event.content.trim() : "";
12
+ if (!text || text.startsWith("/")) return;
13
+ if (OFF_TOPIC_PATTERNS.some((p) => p.test(text)) && text.length < 80) {
14
+ ctx.ui?.notify(OFF_TOPIC_HINT, "info");
15
+ }
16
+ });
17
17
  }
18
- //# sourceMappingURL=kubbisec-scope.extension.js.map
18
+ //# sourceMappingURL=kubbisec-scope.extension.js.map
@@ -2,24 +2,35 @@
2
2
  * KubbiSec skills: invoke with `@skill <name>` (autocomplete) instead of `/skill:name` in the slash menu.
3
3
  */
4
4
  import type { AutocompleteProvider } from "@earendil-works/pi-tui";
5
+
5
6
  type ExtensionApi = {
6
- on: (event: string, handler: (event: unknown, ctx: ExtensionContext) => void | Promise<void | InputEventResult>) => void;
7
+ on: (
8
+ event: string,
9
+ handler: (
10
+ event: unknown,
11
+ ctx: ExtensionContext,
12
+ ) => undefined | Promise<undefined | InputEventResult>,
13
+ ) => void;
7
14
  };
8
15
  type ExtensionContext = {
9
- hasUI: boolean;
10
- cwd: string;
11
- ui: {
12
- addAutocompleteProvider: (factory: (current: AutocompleteProvider) => AutocompleteProvider) => void;
13
- };
14
- };
15
- type InputEventResult = {
16
- action: "continue";
17
- } | {
18
- action: "transform";
19
- text: string;
20
- } | {
21
- action: "handled";
16
+ hasUI: boolean;
17
+ cwd: string;
18
+ ui: {
19
+ addAutocompleteProvider: (
20
+ factory: (current: AutocompleteProvider) => AutocompleteProvider,
21
+ ) => void;
22
+ };
22
23
  };
24
+ type InputEventResult =
25
+ | {
26
+ action: "continue";
27
+ }
28
+ | {
29
+ action: "transform";
30
+ text: string;
31
+ }
32
+ | {
33
+ action: "handled";
34
+ };
23
35
  export default function kubbisecSkillMentions(api: ExtensionApi): void;
24
- export {};
25
- //# sourceMappingURL=kubbisec-skill-mentions.extension.d.ts.map
36
+ //# sourceMappingURL=kubbisec-skill-mentions.extension.d.ts.map
@@ -1,70 +1,80 @@
1
1
  import { extractAtFilePrefix, getAtPathFileSuggestions } from "../skills/at-path-mentions.js";
2
- import { applySkillMentionCompletion, extractAtPrefix, extractSkillMentionPrefix, filterSkillSuggestions, messageActivatesPlanMode, parsePlanMentionPrefix, parseSkillMentionPrefix, transformAtSkillMentions, } from "../skills/chat-mentions.js";
2
+ import {
3
+ applySkillMentionCompletion,
4
+ extractAtPrefix,
5
+ extractSkillMentionPrefix,
6
+ filterSkillSuggestions,
7
+ messageActivatesPlanMode,
8
+ parsePlanMentionPrefix,
9
+ parseSkillMentionPrefix,
10
+ transformAtSkillMentions,
11
+ } from "../skills/chat-mentions.js";
3
12
  import { listBundledKubbisecSkills } from "../skills/list-bundled-skills.js";
4
13
  import { setSessionWorkflowMode } from "../workflow/session-workflow-mode.js";
14
+
5
15
  function wrapAutocompleteProvider(current, skills, sessionCwd) {
6
- return {
7
- async getSuggestions(lines, cursorLine, cursorCol, options) {
8
- const textBeforeCursor = (lines[cursorLine] ?? "").slice(0, cursorCol);
9
- const atPrefix = extractSkillMentionPrefix(textBeforeCursor);
10
- const skillMention = parseSkillMentionPrefix(atPrefix);
11
- if (skillMention && atPrefix) {
12
- const items = filterSkillSuggestions(skills, skillMention.query);
13
- if (items.length === 0)
14
- return null;
15
- return { items, prefix: atPrefix };
16
- }
17
- const fileAtPrefix = extractAtFilePrefix(textBeforeCursor);
18
- if (fileAtPrefix) {
19
- const cwdItems = getAtPathFileSuggestions(sessionCwd, fileAtPrefix);
20
- if (cwdItems.length > 0) {
21
- return { items: cwdItems, prefix: fileAtPrefix };
22
- }
23
- return current.getSuggestions(lines, cursorLine, cursorCol, options);
24
- }
25
- return current.getSuggestions(lines, cursorLine, cursorCol, options);
26
- },
27
- applyCompletion(lines, cursorLine, cursorCol, item, prefix) {
28
- if (prefix.startsWith("@skill")) {
29
- return applySkillMentionCompletion(lines, cursorLine, cursorCol, item, prefix);
30
- }
31
- return current.applyCompletion(lines, cursorLine, cursorCol, item, prefix);
32
- },
33
- shouldTriggerFileCompletion(lines, cursorLine, cursorCol) {
34
- const textBeforeCursor = (lines[cursorLine] ?? "").slice(0, cursorCol);
35
- const atPrefix = extractAtPrefix(textBeforeCursor);
36
- if (parseSkillMentionPrefix(atPrefix) || parsePlanMentionPrefix(atPrefix)) {
37
- return false;
38
- }
39
- if (extractAtFilePrefix(textBeforeCursor)) {
40
- return true;
41
- }
42
- return current.shouldTriggerFileCompletion?.(lines, cursorLine, cursorCol) ?? true;
43
- },
44
- };
16
+ return {
17
+ async getSuggestions(lines, cursorLine, cursorCol, options) {
18
+ const textBeforeCursor = (lines[cursorLine] ?? "").slice(0, cursorCol);
19
+ const atPrefix = extractSkillMentionPrefix(textBeforeCursor);
20
+ const skillMention = parseSkillMentionPrefix(atPrefix);
21
+ if (skillMention && atPrefix) {
22
+ const items = filterSkillSuggestions(skills, skillMention.query);
23
+ if (items.length === 0) return null;
24
+ return { items, prefix: atPrefix };
25
+ }
26
+ const fileAtPrefix = extractAtFilePrefix(textBeforeCursor);
27
+ if (fileAtPrefix) {
28
+ const cwdItems = getAtPathFileSuggestions(sessionCwd, fileAtPrefix);
29
+ if (cwdItems.length > 0) {
30
+ return { items: cwdItems, prefix: fileAtPrefix };
31
+ }
32
+ return current.getSuggestions(lines, cursorLine, cursorCol, options);
33
+ }
34
+ return current.getSuggestions(lines, cursorLine, cursorCol, options);
35
+ },
36
+ applyCompletion(lines, cursorLine, cursorCol, item, prefix) {
37
+ if (prefix.startsWith("@skill")) {
38
+ return applySkillMentionCompletion(lines, cursorLine, cursorCol, item, prefix);
39
+ }
40
+ return current.applyCompletion(lines, cursorLine, cursorCol, item, prefix);
41
+ },
42
+ shouldTriggerFileCompletion(lines, cursorLine, cursorCol) {
43
+ const textBeforeCursor = (lines[cursorLine] ?? "").slice(0, cursorCol);
44
+ const atPrefix = extractAtPrefix(textBeforeCursor);
45
+ if (parseSkillMentionPrefix(atPrefix) || parsePlanMentionPrefix(atPrefix)) {
46
+ return false;
47
+ }
48
+ if (extractAtFilePrefix(textBeforeCursor)) {
49
+ return true;
50
+ }
51
+ return current.shouldTriggerFileCompletion?.(lines, cursorLine, cursorCol) ?? true;
52
+ },
53
+ };
45
54
  }
46
55
  export default function kubbisecSkillMentions(api) {
47
- const skills = listBundledKubbisecSkills();
48
- api.on("session_start", async (_event, ctx) => {
49
- if (!ctx.hasUI)
50
- return;
51
- const sessionCwd = ctx.cwd;
52
- ctx.ui.addAutocompleteProvider((current) => wrapAutocompleteProvider(current, skills, sessionCwd));
53
- });
54
- api.on("input", async (event, _ctx) => {
55
- const input = event;
56
- const text = typeof input.text === "string" ? input.text : "";
57
- if (messageActivatesPlanMode(text)) {
58
- setSessionWorkflowMode("plan");
59
- }
60
- if (!text.includes("@skill")) {
61
- return { action: "continue" };
62
- }
63
- const transformed = transformAtSkillMentions(text);
64
- if (transformed === text) {
65
- return { action: "continue" };
66
- }
67
- return { action: "transform", text: transformed };
68
- });
56
+ const skills = listBundledKubbisecSkills();
57
+ api.on("session_start", async (_event, ctx) => {
58
+ if (!ctx.hasUI) return;
59
+ const sessionCwd = ctx.cwd;
60
+ ctx.ui.addAutocompleteProvider((current) =>
61
+ wrapAutocompleteProvider(current, skills, sessionCwd),
62
+ );
63
+ });
64
+ api.on("input", async (event, _ctx) => {
65
+ const input = event;
66
+ const text = typeof input.text === "string" ? input.text : "";
67
+ if (messageActivatesPlanMode(text)) {
68
+ setSessionWorkflowMode("plan");
69
+ }
70
+ if (!text.includes("@skill")) {
71
+ return { action: "continue" };
72
+ }
73
+ const transformed = transformAtSkillMentions(text);
74
+ if (transformed === text) {
75
+ return { action: "continue" };
76
+ }
77
+ return { action: "transform", text: transformed };
78
+ });
69
79
  }
70
- //# sourceMappingURL=kubbisec-skill-mentions.extension.js.map
80
+ //# sourceMappingURL=kubbisec-skill-mentions.extension.js.map