@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
|
@@ -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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
48
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
63
|
-
|
|
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
|
-
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2
|
+
on: (
|
|
3
|
+
event: string,
|
|
4
|
+
handler: (event: unknown, ctx: ExtensionContext) => void | Promise<void>,
|
|
5
|
+
) => void;
|
|
3
6
|
};
|
|
4
7
|
type ExtensionContext = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
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 {
|
|
4
|
+
import {
|
|
5
|
+
findAgentsContextFile,
|
|
6
|
+
formatKubbisecContextStatus,
|
|
7
|
+
} from "../config/resolve-agents-context-file.js";
|
|
5
8
|
export default function kubbisecRuntimeStatus(api) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
2
|
+
on: (
|
|
3
|
+
event: string,
|
|
4
|
+
handler: (
|
|
5
|
+
event: {
|
|
3
6
|
type?: string;
|
|
4
7
|
content?: string;
|
|
5
|
-
|
|
8
|
+
},
|
|
9
|
+
ctx: ExtensionContext,
|
|
10
|
+
) => void | Promise<void>,
|
|
11
|
+
) => void;
|
|
6
12
|
};
|
|
7
13
|
type ExtensionContext = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
14
|
+
ui?: {
|
|
15
|
+
notify: (message: string, level: string) => void;
|
|
16
|
+
};
|
|
11
17
|
};
|
|
12
18
|
export default function kubbisecScope(api: ExtensionApi): void;
|
|
13
|
-
|
|
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 =
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|