@kubbisec/ai-linux-x64 0.1.22 → 0.1.23
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/bin/kubbisec +0 -0
- 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 +54 -52
- 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-kbs-project-settings.d.ts +8 -8
- package/bundled/config/ensure-kbs-project-settings.js +27 -28
- package/bundled/config/ensure-kubbisec-project-settings.d.ts +9 -9
- package/bundled/config/ensure-kubbisec-project-settings.js +62 -67
- 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 +21 -2
- package/bundled/config/kubbisec-extension-manifest.js +19 -19
- 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 +173 -182
- 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 +1 -1
- 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 +56 -32
- package/bundled/extensions/cli-local-shared.js +135 -125
- package/bundled/extensions/kubbisec-aspm-local.extension.d.ts +18 -15
- package/bundled/extensions/kubbisec-aspm-local.extension.js +109 -106
- 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 +430 -417
- 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 +123 -103
- 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 +74 -64
- 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 +90 -92
- package/bundled/extensions/kubbisec-workflow.extension.d.ts +20 -18
- package/bundled/extensions/kubbisec-workflow.extension.js +138 -140
- package/bundled/resolve-bundled-dist-root.js +121 -130
- 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 +126 -128
- 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,159 +1,169 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import * as path from "node:path";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import {
|
|
4
|
+
isCliDebugMode,
|
|
5
|
+
summarizeSubprocessFailure,
|
|
6
|
+
toUserError,
|
|
7
|
+
} from "@aspm/shared/cli-user-error";
|
|
8
|
+
import { ensureDelegatedCliInstalled } from "@kubbisec/remediation";
|
|
9
|
+
import {
|
|
10
|
+
EXTENDED_CONTEXT_DENY_MESSAGE,
|
|
11
|
+
extendedContextEnabled,
|
|
12
|
+
resolveExtendedWorkspace,
|
|
13
|
+
} from "../config/extended-context.js";
|
|
14
|
+
|
|
6
15
|
export { extendedContextEnabled } from "../config/extended-context.js";
|
|
7
16
|
export const CLI_LOCAL_MAX_OUTPUT_CHARS = 12_000;
|
|
8
17
|
export const NAUS_LOCAL_RUN_TIMEOUT_MS = 15 * 60 * 1000;
|
|
9
18
|
export function resolveWorkspace() {
|
|
10
|
-
|
|
19
|
+
return resolveExtendedWorkspace();
|
|
11
20
|
}
|
|
12
21
|
export function truncateCliOutput(text, max = CLI_LOCAL_MAX_OUTPUT_CHARS) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return `${text.slice(0, max)}\n\n… (output truncated at ${max} chars)`;
|
|
22
|
+
if (text.length <= max) return text;
|
|
23
|
+
return `${text.slice(0, max)}\n\n… (output truncated at ${max} chars)`;
|
|
16
24
|
}
|
|
17
25
|
export function denyExtendedContextMessage() {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
return {
|
|
27
|
+
content: [
|
|
28
|
+
{
|
|
29
|
+
type: "text",
|
|
30
|
+
text: EXTENDED_CONTEXT_DENY_MESSAGE,
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
};
|
|
26
34
|
}
|
|
27
35
|
export function ensureLocalCliOrInstall(name) {
|
|
28
|
-
|
|
36
|
+
return ensureDelegatedCliInstalled(name);
|
|
29
37
|
}
|
|
30
38
|
export function buildCliEnsureFailureResult(bin, cwd, message) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
const text = `workspace: ${cwd}\n\n${message}`;
|
|
40
|
+
return {
|
|
41
|
+
content: [{ type: "text", text }],
|
|
42
|
+
details: { ok: false, exitCode: 127, userMessage: `${bin} nao esta disponivel localmente.` },
|
|
43
|
+
};
|
|
36
44
|
}
|
|
37
45
|
/** Full subprocess output for model debug (extended context + debug flag). */
|
|
38
46
|
export function formatExecResultForModel(bin, args, cwd, result) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
const combined = [result.stdout, result.stderr].filter(Boolean).join("\n");
|
|
48
|
+
return truncateCliOutput(
|
|
49
|
+
[
|
|
50
|
+
`command: ${bin} ${args.join(" ")}`,
|
|
51
|
+
`cwd: ${cwd}`,
|
|
52
|
+
`exit: ${result.code}`,
|
|
53
|
+
"",
|
|
54
|
+
combined.trim() || "(no output)",
|
|
55
|
+
].join("\n"),
|
|
56
|
+
);
|
|
47
57
|
}
|
|
48
58
|
/** @deprecated use formatExecResultForModel */
|
|
49
59
|
export const formatExecResult = formatExecResultForModel;
|
|
50
60
|
export function formatExecResultForUser(bin, result) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
61
|
+
const ok = result.code === 0;
|
|
62
|
+
if (ok) {
|
|
63
|
+
const hint = result.stdout
|
|
64
|
+
.trim()
|
|
65
|
+
.split(/\r?\n/)
|
|
66
|
+
.find((line) => line.trim())
|
|
67
|
+
?.trim();
|
|
68
|
+
const userMessage = hint
|
|
69
|
+
? `${bin} concluiu: ${hint.length > 160 ? `${hint.slice(0, 157)}…` : hint}`
|
|
70
|
+
: `${bin} concluiu com sucesso.`;
|
|
71
|
+
return { ok: true, exitCode: result.code, userMessage };
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
ok: false,
|
|
75
|
+
exitCode: result.code,
|
|
76
|
+
userMessage: summarizeSubprocessFailure({
|
|
77
|
+
bin,
|
|
78
|
+
code: result.code,
|
|
79
|
+
stderr: result.stderr,
|
|
80
|
+
stdout: result.stdout,
|
|
81
|
+
}),
|
|
82
|
+
};
|
|
73
83
|
}
|
|
74
84
|
export function buildCliToolResult(bin, args, cwd, result, suffix = "") {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
const details = formatExecResultForUser(bin, result);
|
|
86
|
+
const useFullDump = extendedContextEnabled() && isCliDebugMode();
|
|
87
|
+
const text =
|
|
88
|
+
(useFullDump ? formatExecResultForModel(bin, args, cwd, result) : details.userMessage) + suffix;
|
|
89
|
+
return {
|
|
90
|
+
content: [{ type: "text", text }],
|
|
91
|
+
details,
|
|
92
|
+
};
|
|
82
93
|
}
|
|
83
94
|
export function cliToolErrorContent(error) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
95
|
+
const shaped = toUserError(error, "Falha ao executar comando local");
|
|
96
|
+
return {
|
|
97
|
+
content: [{ type: "text", text: shaped.detail }],
|
|
98
|
+
details: { ok: false, exitCode: 127, userMessage: shaped.detail },
|
|
99
|
+
};
|
|
89
100
|
}
|
|
90
101
|
export function execCapture(bin, args, cwd, options) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}, options.timeoutMs)
|
|
105
|
-
: undefined;
|
|
106
|
-
const onAbort = () => {
|
|
102
|
+
return new Promise((resolve) => {
|
|
103
|
+
const child = spawn(bin, args, {
|
|
104
|
+
cwd,
|
|
105
|
+
env: process.env,
|
|
106
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
107
|
+
});
|
|
108
|
+
let stdout = "";
|
|
109
|
+
let stderr = "";
|
|
110
|
+
let timedOut = false;
|
|
111
|
+
const timer =
|
|
112
|
+
options?.timeoutMs != null
|
|
113
|
+
? setTimeout(() => {
|
|
114
|
+
timedOut = true;
|
|
107
115
|
child.kill("SIGTERM");
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
116
|
+
}, options.timeoutMs)
|
|
117
|
+
: undefined;
|
|
118
|
+
const onAbort = () => {
|
|
119
|
+
child.kill("SIGTERM");
|
|
120
|
+
};
|
|
121
|
+
options?.signal?.addEventListener("abort", onAbort);
|
|
122
|
+
child.stdout?.on("data", (c) => {
|
|
123
|
+
stdout += String(c);
|
|
124
|
+
});
|
|
125
|
+
child.stderr?.on("data", (c) => {
|
|
126
|
+
stderr += String(c);
|
|
127
|
+
});
|
|
128
|
+
child.on("error", (err) => {
|
|
129
|
+
if (timer) clearTimeout(timer);
|
|
130
|
+
options?.signal?.removeEventListener("abort", onAbort);
|
|
131
|
+
resolve({
|
|
132
|
+
code: 127,
|
|
133
|
+
stdout: "",
|
|
134
|
+
stderr: toUserError(err).detail,
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
child.on("close", (code) => {
|
|
138
|
+
if (timer) clearTimeout(timer);
|
|
139
|
+
options?.signal?.removeEventListener("abort", onAbort);
|
|
140
|
+
if (options?.signal?.aborted) {
|
|
141
|
+
resolve({
|
|
142
|
+
code: 130,
|
|
143
|
+
stdout,
|
|
144
|
+
stderr: `${stderr}\n(aborted)`.trim(),
|
|
125
145
|
});
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
stdout,
|
|
134
|
-
stderr: `${stderr}\n(aborted)`.trim(),
|
|
135
|
-
});
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
if (timedOut) {
|
|
139
|
-
resolve({
|
|
140
|
-
code: 124,
|
|
141
|
-
stdout,
|
|
142
|
-
stderr: `${stderr}\n(timed out after ${options?.timeoutMs}ms)`.trim(),
|
|
143
|
-
});
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
resolve({ code: code ?? 1, stdout, stderr });
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (timedOut) {
|
|
149
|
+
resolve({
|
|
150
|
+
code: 124,
|
|
151
|
+
stdout,
|
|
152
|
+
stderr: `${stderr}\n(timed out after ${options?.timeoutMs}ms)`.trim(),
|
|
147
153
|
});
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
resolve({ code: code ?? 1, stdout, stderr });
|
|
148
157
|
});
|
|
158
|
+
});
|
|
149
159
|
}
|
|
150
160
|
export function resolvePathInWorkspace(relativePath, workspace) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
161
|
+
const resolved = path.resolve(workspace, relativePath);
|
|
162
|
+
const ws = path.resolve(workspace);
|
|
163
|
+
const relative = path.relative(ws, resolved);
|
|
164
|
+
if (relative.startsWith("..") || path.isAbsolute(relative)) {
|
|
165
|
+
throw new Error("path must stay inside the workspace");
|
|
166
|
+
}
|
|
167
|
+
return resolved;
|
|
158
168
|
}
|
|
159
|
-
//# sourceMappingURL=cli-local-shared.js.map
|
|
169
|
+
//# sourceMappingURL=cli-local-shared.js.map
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
type ExtensionApi = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
registerTool: (def: {
|
|
3
|
+
name: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description: string;
|
|
6
|
+
parameters: unknown;
|
|
7
|
+
execute: (
|
|
8
|
+
toolCallId: string,
|
|
9
|
+
params: Record<string, unknown>,
|
|
10
|
+
signal: AbortSignal,
|
|
11
|
+
) => Promise<{
|
|
12
|
+
content: Array<{
|
|
13
|
+
type: "text";
|
|
14
|
+
text: string;
|
|
15
|
+
}>;
|
|
16
|
+
details?: unknown;
|
|
17
|
+
}>;
|
|
18
|
+
}) => void;
|
|
15
19
|
};
|
|
16
20
|
export default function kubbisecAspmLocal(api: ExtensionApi): void;
|
|
17
|
-
|
|
18
|
-
//# sourceMappingURL=kubbisec-aspm-local.extension.d.ts.map
|
|
21
|
+
//# sourceMappingURL=kubbisec-aspm-local.extension.d.ts.map
|
|
@@ -1,109 +1,112 @@
|
|
|
1
1
|
import { Type } from "@earendil-works/pi-ai";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
];
|
|
2
|
+
import {
|
|
3
|
+
buildCliEnsureFailureResult,
|
|
4
|
+
buildCliToolResult,
|
|
5
|
+
ensureLocalCliOrInstall,
|
|
6
|
+
execCapture,
|
|
7
|
+
resolvePathInWorkspace,
|
|
8
|
+
resolveWorkspace,
|
|
9
|
+
} from "./cli-local-shared.js";
|
|
10
|
+
|
|
11
|
+
const ASPM_SOURCES = ["trivy", "sonar", "semgrep", "nmap", "skipfish", "osv", "gitleaks", "syft"];
|
|
13
12
|
export default function kubbisecAspmLocal(api) {
|
|
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
|
-
|
|
45
|
-
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
13
|
+
api.registerTool({
|
|
14
|
+
name: "aspm_local_status",
|
|
15
|
+
label: "ASPM CLI status",
|
|
16
|
+
description: "Checks local `aspm` availability and shows version output.",
|
|
17
|
+
parameters: Type.Object({}),
|
|
18
|
+
async execute() {
|
|
19
|
+
const cwd = resolveWorkspace();
|
|
20
|
+
const parts = [`workspace: ${cwd}`];
|
|
21
|
+
const ensured = ensureLocalCliOrInstall("aspm");
|
|
22
|
+
if (!ensured.ok) return buildCliEnsureFailureResult("aspm", cwd, ensured.message);
|
|
23
|
+
const version = await execCapture("aspm", ["--version"], cwd);
|
|
24
|
+
const versionResult = buildCliToolResult("aspm", ["--version"], cwd, version);
|
|
25
|
+
return {
|
|
26
|
+
content: [
|
|
27
|
+
{ type: "text", text: `${parts.join("\n")}\n\n${versionResult.content[0]?.text ?? ""}` },
|
|
28
|
+
],
|
|
29
|
+
details: versionResult.details,
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
api.registerTool({
|
|
34
|
+
name: "aspm_local_doctor",
|
|
35
|
+
label: "ASPM doctor",
|
|
36
|
+
description: "Runs `aspm doctor` (config, API, git, optional scanner binaries).",
|
|
37
|
+
parameters: Type.Object({}),
|
|
38
|
+
async execute() {
|
|
39
|
+
const cwd = resolveWorkspace();
|
|
40
|
+
const ensured = ensureLocalCliOrInstall("aspm");
|
|
41
|
+
if (!ensured.ok) return buildCliEnsureFailureResult("aspm", cwd, ensured.message);
|
|
42
|
+
const result = await execCapture("aspm", ["doctor"], cwd);
|
|
43
|
+
return buildCliToolResult("aspm", ["doctor"], cwd, result);
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
api.registerTool({
|
|
47
|
+
name: "aspm_local_scan",
|
|
48
|
+
label: "ASPM scan (local)",
|
|
49
|
+
description: "Runs `aspm scan <file> -s <source>` without uploading to the platform.",
|
|
50
|
+
parameters: Type.Object({
|
|
51
|
+
file: Type.String({ description: "Report file path relative to workspace" }),
|
|
52
|
+
source: Type.Union(
|
|
53
|
+
ASPM_SOURCES.map((s) => Type.Literal(s)),
|
|
54
|
+
{ description: "Scanner source id" },
|
|
55
|
+
),
|
|
56
|
+
}),
|
|
57
|
+
async execute(_id, params) {
|
|
58
|
+
const cwd = resolveWorkspace();
|
|
59
|
+
const ensured = ensureLocalCliOrInstall("aspm");
|
|
60
|
+
if (!ensured.ok) return buildCliEnsureFailureResult("aspm", cwd, ensured.message);
|
|
61
|
+
const filePath = resolvePathInWorkspace(String(params.file), cwd);
|
|
62
|
+
const source = String(params.source);
|
|
63
|
+
const args = ["scan", filePath, "-s", source];
|
|
64
|
+
const result = await execCapture("aspm", args, cwd);
|
|
65
|
+
return buildCliToolResult("aspm", args, cwd, result);
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
api.registerTool({
|
|
69
|
+
name: "aspm_local_upload",
|
|
70
|
+
label: "ASPM upload",
|
|
71
|
+
description:
|
|
72
|
+
"Runs `aspm upload <file> -s <source> -p <projectId>` using local ~/.kubbisec config for API key.",
|
|
73
|
+
parameters: Type.Object({
|
|
74
|
+
file: Type.String({ description: "Report file path relative to workspace" }),
|
|
75
|
+
source: Type.Union(
|
|
76
|
+
ASPM_SOURCES.map((s) => Type.Literal(s)),
|
|
77
|
+
{ description: "Scanner source id" },
|
|
78
|
+
),
|
|
79
|
+
projectId: Type.String({
|
|
80
|
+
description: "KubbiSec project id (required; also KUBBISEC_CONTEXT_PROJECT_ID if omitted)",
|
|
81
|
+
}),
|
|
82
|
+
}),
|
|
83
|
+
async execute(_id, params) {
|
|
84
|
+
const cwd = resolveWorkspace();
|
|
85
|
+
const ensured = ensureLocalCliOrInstall("aspm");
|
|
86
|
+
if (!ensured.ok) return buildCliEnsureFailureResult("aspm", cwd, ensured.message);
|
|
87
|
+
const filePath = resolvePathInWorkspace(String(params.file), cwd);
|
|
88
|
+
const source = String(params.source);
|
|
89
|
+
const projectId =
|
|
90
|
+
String(params.projectId).trim() || process.env.KUBBISEC_CONTEXT_PROJECT_ID?.trim() || "";
|
|
91
|
+
if (!projectId) {
|
|
92
|
+
return {
|
|
93
|
+
content: [
|
|
94
|
+
{
|
|
95
|
+
type: "text",
|
|
96
|
+
text: "Indique o projectId ou configure KUBBISEC_CONTEXT_PROJECT_ID (kubbisec chat -p).",
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
details: {
|
|
100
|
+
ok: false,
|
|
101
|
+
exitCode: 1,
|
|
102
|
+
userMessage: "projectId em falta para upload ASPM.",
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
const args = ["upload", filePath, "-s", source, "-p", projectId];
|
|
107
|
+
const result = await execCapture("aspm", args, cwd);
|
|
108
|
+
return buildCliToolResult("aspm", args, cwd, result);
|
|
109
|
+
},
|
|
110
|
+
});
|
|
108
111
|
}
|
|
109
|
-
//# sourceMappingURL=kubbisec-aspm-local.extension.js.map
|
|
112
|
+
//# sourceMappingURL=kubbisec-aspm-local.extension.js.map
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import * as path from "node:path";
|
|
2
2
|
import { KUBBISEC_PRODUCT_NAME } from "../copy/kubbisec-shell-copy.js";
|
|
3
3
|
import { renderChatHeaderLines } from "../theme/render-compact-header.js";
|
|
4
|
+
|
|
4
5
|
function buildBrandHeaderComponent(theme, version) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
let cachedWidth = 0;
|
|
7
|
+
let cachedLines = renderChatHeaderLines(theme, version, 80);
|
|
8
|
+
return {
|
|
9
|
+
render(width) {
|
|
10
|
+
if (width !== cachedWidth) {
|
|
11
|
+
cachedWidth = width;
|
|
12
|
+
cachedLines = renderChatHeaderLines(theme, version, width);
|
|
13
|
+
}
|
|
14
|
+
return cachedLines;
|
|
15
|
+
},
|
|
16
|
+
invalidate() {
|
|
17
|
+
cachedWidth = 0;
|
|
18
|
+
},
|
|
19
|
+
};
|
|
19
20
|
}
|
|
20
21
|
export default function kubbisecBrand(api) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
22
|
+
const version = process.env.KUBBISEC_AI_VERSION?.trim() || "0.1.0";
|
|
23
|
+
api.on("session_start", (_event, ctx) => {
|
|
24
|
+
if (!ctx.hasUI) return;
|
|
25
|
+
// Header sits above the chat log so messages never render above KubbiSec chrome.
|
|
26
|
+
ctx.ui.setHeader((_tui, theme) => buildBrandHeaderComponent(theme, version));
|
|
27
|
+
const cwd = process.cwd();
|
|
28
|
+
const base = path.basename(cwd) || cwd;
|
|
29
|
+
ctx.ui.setTitle(`${KUBBISEC_PRODUCT_NAME} — ${base}`);
|
|
30
|
+
});
|
|
31
31
|
}
|
|
32
|
-
//# sourceMappingURL=kubbisec-brand.extension.js.map
|
|
32
|
+
//# sourceMappingURL=kubbisec-brand.extension.js.map
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
5
5
|
export default function kubbisecByokProvider(api: ExtensionAPI): void;
|
|
6
|
-
//# sourceMappingURL=kubbisec-byok-provider.extension.d.ts.map
|
|
6
|
+
//# sourceMappingURL=kubbisec-byok-provider.extension.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { registerKubbisecLlmProvider } from "../config/register-kubbisec-llm-provider.js";
|
|
2
2
|
export default function kubbisecByokProvider(api) {
|
|
3
|
-
|
|
3
|
+
registerKubbisecLlmProvider(api.registerProvider.bind(api));
|
|
4
4
|
}
|
|
5
|
-
//# sourceMappingURL=kubbisec-byok-provider.extension.js.map
|
|
5
|
+
//# sourceMappingURL=kubbisec-byok-provider.extension.js.map
|