@kubbisec/ai-linux-arm64 0.1.21 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/clarify/clarify-gate-state.d.ts +1 -1
- package/bundled/clarify/clarify-gate-state.js +3 -3
- package/bundled/clarify/clarify-gate.d.ts +21 -14
- package/bundled/clarify/clarify-gate.js +118 -111
- package/bundled/clarify/clarify-select-panel.d.ts +16 -9
- package/bundled/clarify/clarify-select-panel.js +65 -67
- package/bundled/clarify/clarify-ui-state.d.ts +12 -10
- package/bundled/clarify/clarify-ui-state.js +26 -26
- package/bundled/clarify/parse-clarify-answer.d.ts +29 -18
- package/bundled/clarify/parse-clarify-answer.js +39 -45
- package/bundled/clarify/question-format.d.ts +34 -23
- package/bundled/clarify/question-format.js +112 -119
- package/bundled/clarify/questionnaire-tool.d.ts +28 -17
- package/bundled/clarify/questionnaire-tool.js +180 -144
- package/bundled/clarify/scope-discovery.d.ts +8 -5
- package/bundled/clarify/scope-discovery.js +102 -110
- package/bundled/clarify/session-questionnaire.d.ts +48 -13
- package/bundled/clarify/session-questionnaire.js +304 -312
- package/bundled/clarify/session-questionnaire.types.d.ts +29 -27
- package/bundled/clarify/session-questionnaire.types.js +10 -10
- package/bundled/components/kubbisec-model-selector.d.ts +47 -34
- package/bundled/components/kubbisec-model-selector.js +187 -177
- package/bundled/config/config.d.ts +6 -6
- package/bundled/config/config.js +55 -55
- package/bundled/config/detect-local-llm-providers.d.ts +26 -16
- package/bundled/config/detect-local-llm-providers.js +130 -142
- package/bundled/config/ensure-kubbisec-project-settings.d.ts +9 -9
- package/bundled/config/ensure-kubbisec-project-settings.js +44 -48
- package/bundled/config/extended-context.d.ts +5 -6
- package/bundled/config/extended-context.js +23 -22
- package/bundled/config/feature-flags.d.ts +10 -2
- package/bundled/config/feature-flags.js +8 -2
- package/bundled/config/format-kubbisec-footer-status.d.ts +1 -1
- package/bundled/config/format-kubbisec-footer-status.js +26 -31
- package/bundled/config/kubbisec-extension-manifest.d.ts +22 -2
- package/bundled/config/kubbisec-extension-manifest.js +20 -20
- package/bundled/config/llm-config-mutations.d.ts +51 -25
- package/bundled/config/llm-config-mutations.js +173 -182
- package/bundled/config/llm-config.d.ts +54 -41
- package/bundled/config/llm-config.js +199 -199
- package/bundled/config/llm-provider-catalog.d.ts +18 -15
- package/bundled/config/llm-provider-catalog.js +45 -46
- package/bundled/config/materialize-kubbisec-pi-resources.d.ts +1 -1
- package/bundled/config/materialize-kubbisec-pi-resources.js +174 -183
- package/bundled/config/register-custom-llm-providers.d.ts +11 -5
- package/bundled/config/register-custom-llm-providers.js +17 -15
- package/bundled/config/register-kubbisec-llm-provider.d.ts +14 -10
- package/bundled/config/register-kubbisec-llm-provider.js +50 -42
- package/bundled/config/resolve-agents-context-file.d.ts +1 -1
- package/bundled/config/resolve-agents-context-file.js +33 -34
- package/bundled/config/resource-budget.d.ts +12 -12
- package/bundled/config/resource-budget.js +28 -28
- package/bundled/config/sync-kubbisec-pi-models.d.ts +6 -3
- package/bundled/config/sync-kubbisec-pi-models.js +58 -58
- package/bundled/copy/cli-reference-index.d.ts +3 -2
- package/bundled/copy/cli-reference-index.js +1 -1
- package/bundled/copy/kubbisec-shell-copy.d.ts +11 -6
- package/bundled/copy/kubbisec-shell-copy.js +1 -1
- package/bundled/extensions/cli-local-shared.d.ts +45 -26
- package/bundled/extensions/cli-local-shared.js +128 -118
- package/bundled/extensions/kubbisec-aspm-local.extension.d.ts +18 -15
- package/bundled/extensions/kubbisec-aspm-local.extension.js +118 -114
- package/bundled/extensions/kubbisec-brand.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-brand.extension.js +25 -25
- package/bundled/extensions/kubbisec-byok-provider.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-byok-provider.extension.js +2 -2
- package/bundled/extensions/kubbisec-clarify.extension.d.ts +64 -35
- package/bundled/extensions/kubbisec-clarify.extension.js +323 -305
- package/bundled/extensions/kubbisec-exit.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-exit.extension.js +29 -32
- package/bundled/extensions/kubbisec-extended-context.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-extended-context.extension.js +56 -43
- package/bundled/extensions/kubbisec-footer.extension.d.ts +14 -14
- package/bundled/extensions/kubbisec-footer.extension.js +205 -215
- package/bundled/extensions/kubbisec-github-local.extension.d.ts +26 -18
- package/bundled/extensions/kubbisec-github-local.extension.js +123 -116
- package/bundled/extensions/kubbisec-llm-config.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-llm-config.extension.js +200 -181
- package/bundled/extensions/kubbisec-memory.extension.d.ts +9 -7
- package/bundled/extensions/kubbisec-memory.extension.js +88 -95
- package/bundled/extensions/kubbisec-naus-local.extension.d.ts +18 -15
- package/bundled/extensions/kubbisec-naus-local.extension.js +132 -111
- package/bundled/extensions/kubbisec-platform-tools.extension.d.ts +31 -21
- package/bundled/extensions/kubbisec-platform-tools.extension.js +152 -152
- package/bundled/extensions/kubbisec-runtime-status.extension.d.ts +10 -8
- package/bundled/extensions/kubbisec-runtime-status.extension.js +15 -13
- package/bundled/extensions/kubbisec-scope.extension.d.ts +12 -7
- package/bundled/extensions/kubbisec-scope.extension.js +13 -13
- package/bundled/extensions/kubbisec-skill-mentions.extension.d.ts +27 -16
- package/bundled/extensions/kubbisec-skill-mentions.extension.js +73 -63
- package/bundled/extensions/kubbisec-skill-telemetry.extension.d.ts +2 -3
- package/bundled/extensions/kubbisec-skill-telemetry.extension.js +59 -64
- package/bundled/extensions/kubbisec-theme-lock.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-theme-lock.extension.js +33 -34
- package/bundled/extensions/kubbisec-ui.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-ui.extension.js +114 -109
- package/bundled/extensions/kubbisec-workflow.extension.d.ts +20 -18
- package/bundled/extensions/kubbisec-workflow.extension.js +138 -140
- package/bundled/node_modules/@aspm/shared/dist/redaction.test.d.ts +2 -0
- package/bundled/node_modules/@aspm/shared/dist/redaction.test.d.ts.map +1 -0
- package/bundled/node_modules/@aspm/shared/dist/redaction.test.js +626 -0
- package/bundled/node_modules/@aspm/shared/dist/redaction.test.js.map +1 -0
- package/bundled/resolve-bundled-dist-root.js +122 -131
- package/bundled/skills/at-path-mentions.d.ts +1 -1
- package/bundled/skills/at-path-mentions.js +146 -153
- package/bundled/skills/chat-mention-render.d.ts +2 -2
- package/bundled/skills/chat-mention-render.js +121 -126
- package/bundled/skills/chat-mentions.d.ts +17 -8
- package/bundled/skills/chat-mentions.js +76 -76
- package/bundled/skills/list-bundled-skills.d.ts +3 -3
- package/bundled/skills/list-bundled-skills.js +33 -35
- package/bundled/skills/skill-mention.d.ts +10 -2
- package/bundled/skills/skill-mention.js +10 -2
- package/bundled/theme/clear-terminal.d.ts +1 -1
- package/bundled/theme/clear-terminal.js +3 -4
- package/bundled/theme/footer-render-hook.d.ts +1 -1
- package/bundled/theme/footer-render-hook.js +3 -3
- package/bundled/theme/kubbisec-brand-fg.d.ts +1 -1
- package/bundled/theme/kubbisec-brand-fg.js +2 -2
- package/bundled/theme/kubbisec-menu-themes.d.ts +7 -7
- package/bundled/theme/kubbisec-menu-themes.js +30 -31
- package/bundled/theme/kubbisec-theme-name.d.ts +1 -1
- package/bundled/theme/kubbisec-theme-name.js +1 -1
- package/bundled/theme/patch-pi-settings-theme.runtime.d.ts +1 -1
- package/bundled/theme/patch-pi-settings-theme.runtime.js +11 -10
- package/bundled/theme/render-compact-header.d.ts +13 -5
- package/bundled/theme/render-compact-header.js +127 -129
- package/bundled/workflow/session-workflow-mode.d.ts +1 -1
- package/bundled/workflow/session-workflow-mode.js +33 -33
- package/package.json +1 -1
|
@@ -1,148 +1,158 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import * as path from "node:path";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
isCliDebugMode,
|
|
5
|
+
summarizeSubprocessFailure,
|
|
6
|
+
toUserError,
|
|
7
|
+
} from "@aspm/shared/cli-user-error";
|
|
8
|
+
import {
|
|
9
|
+
EXTENDED_CONTEXT_DENY_MESSAGE,
|
|
10
|
+
extendedContextEnabled,
|
|
11
|
+
resolveExtendedWorkspace,
|
|
12
|
+
} from "../config/extended-context.js";
|
|
13
|
+
|
|
5
14
|
export { extendedContextEnabled } from "../config/extended-context.js";
|
|
6
15
|
export const CLI_LOCAL_MAX_OUTPUT_CHARS = 12_000;
|
|
7
16
|
export const NAUS_LOCAL_RUN_TIMEOUT_MS = 15 * 60 * 1000;
|
|
8
17
|
export function resolveWorkspace() {
|
|
9
|
-
|
|
18
|
+
return resolveExtendedWorkspace();
|
|
10
19
|
}
|
|
11
20
|
export function truncateCliOutput(text, max = CLI_LOCAL_MAX_OUTPUT_CHARS) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return `${text.slice(0, max)}\n\n… (output truncated at ${max} chars)`;
|
|
21
|
+
if (text.length <= max) return text;
|
|
22
|
+
return `${text.slice(0, max)}\n\n… (output truncated at ${max} chars)`;
|
|
15
23
|
}
|
|
16
24
|
export function denyExtendedContextMessage() {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
return {
|
|
26
|
+
content: [
|
|
27
|
+
{
|
|
28
|
+
type: "text",
|
|
29
|
+
text: EXTENDED_CONTEXT_DENY_MESSAGE,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
25
33
|
}
|
|
26
34
|
/** Full subprocess output for model debug (extended context + debug flag). */
|
|
27
35
|
export function formatExecResultForModel(bin, args, cwd, result) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
const combined = [result.stdout, result.stderr].filter(Boolean).join("\n");
|
|
37
|
+
return truncateCliOutput(
|
|
38
|
+
[
|
|
39
|
+
`command: ${bin} ${args.join(" ")}`,
|
|
40
|
+
`cwd: ${cwd}`,
|
|
41
|
+
`exit: ${result.code}`,
|
|
42
|
+
"",
|
|
43
|
+
combined.trim() || "(no output)",
|
|
44
|
+
].join("\n"),
|
|
45
|
+
);
|
|
36
46
|
}
|
|
37
47
|
/** @deprecated use formatExecResultForModel */
|
|
38
48
|
export const formatExecResult = formatExecResultForModel;
|
|
39
49
|
export function formatExecResultForUser(bin, result) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
const ok = result.code === 0;
|
|
51
|
+
if (ok) {
|
|
52
|
+
const hint = result.stdout
|
|
53
|
+
.trim()
|
|
54
|
+
.split(/\r?\n/)
|
|
55
|
+
.find((line) => line.trim())
|
|
56
|
+
?.trim();
|
|
57
|
+
const userMessage = hint
|
|
58
|
+
? `${bin} concluiu: ${hint.length > 160 ? `${hint.slice(0, 157)}…` : hint}`
|
|
59
|
+
: `${bin} concluiu com sucesso.`;
|
|
60
|
+
return { ok: true, exitCode: result.code, userMessage };
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
ok: false,
|
|
64
|
+
exitCode: result.code,
|
|
65
|
+
userMessage: summarizeSubprocessFailure({
|
|
66
|
+
bin,
|
|
67
|
+
code: result.code,
|
|
68
|
+
stderr: result.stderr,
|
|
69
|
+
stdout: result.stdout,
|
|
70
|
+
}),
|
|
71
|
+
};
|
|
62
72
|
}
|
|
63
73
|
export function buildCliToolResult(bin, args, cwd, result, suffix = "") {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
const details = formatExecResultForUser(bin, result);
|
|
75
|
+
const useFullDump = extendedContextEnabled() && isCliDebugMode();
|
|
76
|
+
const text =
|
|
77
|
+
(useFullDump ? formatExecResultForModel(bin, args, cwd, result) : details.userMessage) + suffix;
|
|
78
|
+
return {
|
|
79
|
+
content: [{ type: "text", text }],
|
|
80
|
+
details,
|
|
81
|
+
};
|
|
71
82
|
}
|
|
72
83
|
export function cliToolErrorContent(error) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
84
|
+
const shaped = toUserError(error, "Falha ao executar comando local");
|
|
85
|
+
return {
|
|
86
|
+
content: [{ type: "text", text: shaped.detail }],
|
|
87
|
+
details: { ok: false, exitCode: 127, userMessage: shaped.detail },
|
|
88
|
+
};
|
|
78
89
|
}
|
|
79
90
|
export function execCapture(bin, args, cwd, options) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}, options.timeoutMs)
|
|
94
|
-
: undefined;
|
|
95
|
-
const onAbort = () => {
|
|
91
|
+
return new Promise((resolve) => {
|
|
92
|
+
const child = spawn(bin, args, {
|
|
93
|
+
cwd,
|
|
94
|
+
env: process.env,
|
|
95
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
96
|
+
});
|
|
97
|
+
let stdout = "";
|
|
98
|
+
let stderr = "";
|
|
99
|
+
let timedOut = false;
|
|
100
|
+
const timer =
|
|
101
|
+
options?.timeoutMs != null
|
|
102
|
+
? setTimeout(() => {
|
|
103
|
+
timedOut = true;
|
|
96
104
|
child.kill("SIGTERM");
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
105
|
+
}, options.timeoutMs)
|
|
106
|
+
: undefined;
|
|
107
|
+
const onAbort = () => {
|
|
108
|
+
child.kill("SIGTERM");
|
|
109
|
+
};
|
|
110
|
+
options?.signal?.addEventListener("abort", onAbort);
|
|
111
|
+
child.stdout?.on("data", (c) => {
|
|
112
|
+
stdout += String(c);
|
|
113
|
+
});
|
|
114
|
+
child.stderr?.on("data", (c) => {
|
|
115
|
+
stderr += String(c);
|
|
116
|
+
});
|
|
117
|
+
child.on("error", (err) => {
|
|
118
|
+
if (timer) clearTimeout(timer);
|
|
119
|
+
options?.signal?.removeEventListener("abort", onAbort);
|
|
120
|
+
resolve({
|
|
121
|
+
code: 127,
|
|
122
|
+
stdout: "",
|
|
123
|
+
stderr: toUserError(err).detail,
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
child.on("close", (code) => {
|
|
127
|
+
if (timer) clearTimeout(timer);
|
|
128
|
+
options?.signal?.removeEventListener("abort", onAbort);
|
|
129
|
+
if (options?.signal?.aborted) {
|
|
130
|
+
resolve({
|
|
131
|
+
code: 130,
|
|
132
|
+
stdout,
|
|
133
|
+
stderr: `${stderr}\n(aborted)`.trim(),
|
|
114
134
|
});
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
stdout,
|
|
123
|
-
stderr: `${stderr}\n(aborted)`.trim(),
|
|
124
|
-
});
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
if (timedOut) {
|
|
128
|
-
resolve({
|
|
129
|
-
code: 124,
|
|
130
|
-
stdout,
|
|
131
|
-
stderr: `${stderr}\n(timed out after ${options?.timeoutMs}ms)`.trim(),
|
|
132
|
-
});
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
resolve({ code: code ?? 1, stdout, stderr });
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (timedOut) {
|
|
138
|
+
resolve({
|
|
139
|
+
code: 124,
|
|
140
|
+
stdout,
|
|
141
|
+
stderr: `${stderr}\n(timed out after ${options?.timeoutMs}ms)`.trim(),
|
|
136
142
|
});
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
resolve({ code: code ?? 1, stdout, stderr });
|
|
137
146
|
});
|
|
147
|
+
});
|
|
138
148
|
}
|
|
139
149
|
export function resolvePathInWorkspace(relativePath, workspace) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
150
|
+
const resolved = path.resolve(workspace, relativePath);
|
|
151
|
+
const ws = path.resolve(workspace);
|
|
152
|
+
const relative = path.relative(ws, resolved);
|
|
153
|
+
if (relative.startsWith("..") || path.isAbsolute(relative)) {
|
|
154
|
+
throw new Error("path must stay inside the workspace");
|
|
155
|
+
}
|
|
156
|
+
return resolved;
|
|
147
157
|
}
|
|
148
|
-
//# sourceMappingURL=cli-local-shared.js.map
|
|
158
|
+
//# 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
|
|
@@ -2,119 +2,123 @@
|
|
|
2
2
|
* Local `aspm` CLI tools — only when KUBBISEC_CHAT_EXTENDED_CONTEXT=1
|
|
3
3
|
*/
|
|
4
4
|
import { Type } from "@earendil-works/pi-ai";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
];
|
|
5
|
+
import {
|
|
6
|
+
buildCliToolResult,
|
|
7
|
+
denyExtendedContextMessage,
|
|
8
|
+
execCapture,
|
|
9
|
+
extendedContextEnabled,
|
|
10
|
+
resolvePathInWorkspace,
|
|
11
|
+
resolveWorkspace,
|
|
12
|
+
} from "./cli-local-shared.js";
|
|
13
|
+
|
|
14
|
+
const ASPM_SOURCES = ["trivy", "sonar", "semgrep", "nmap", "skipfish", "osv", "gitleaks", "syft"];
|
|
16
15
|
export default function kubbisecAspmLocal(api) {
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
16
|
+
api.registerTool({
|
|
17
|
+
name: "aspm_local_status",
|
|
18
|
+
label: "ASPM CLI status",
|
|
19
|
+
description:
|
|
20
|
+
"Checks if `aspm` is on PATH and shows version/help (requires kubbisec chat --extended-context).",
|
|
21
|
+
parameters: Type.Object({}),
|
|
22
|
+
async execute() {
|
|
23
|
+
if (!extendedContextEnabled()) return denyExtendedContextMessage();
|
|
24
|
+
const cwd = resolveWorkspace();
|
|
25
|
+
const parts = [`workspace: ${cwd}`];
|
|
26
|
+
const which = await execCapture("which", ["aspm"], cwd);
|
|
27
|
+
if (which.code !== 0) {
|
|
28
|
+
return {
|
|
29
|
+
content: [
|
|
30
|
+
{
|
|
31
|
+
type: "text",
|
|
32
|
+
text: `${parts.join("\n")}\n\naspm: not installed or not on PATH (npm install -g @kubbisec/aspm)`,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
details: { ok: false, exitCode: which.code, userMessage: "aspm não está no PATH." },
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const version = await execCapture("aspm", ["--version"], cwd);
|
|
39
|
+
const versionResult = buildCliToolResult("aspm", ["--version"], cwd, version);
|
|
40
|
+
return {
|
|
41
|
+
content: [
|
|
42
|
+
{ type: "text", text: `${parts.join("\n")}\n\n${versionResult.content[0]?.text ?? ""}` },
|
|
43
|
+
],
|
|
44
|
+
details: versionResult.details,
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
api.registerTool({
|
|
49
|
+
name: "aspm_local_doctor",
|
|
50
|
+
label: "ASPM doctor",
|
|
51
|
+
description: "Runs `aspm doctor` (config, API, git, optional scanner binaries).",
|
|
52
|
+
parameters: Type.Object({}),
|
|
53
|
+
async execute() {
|
|
54
|
+
if (!extendedContextEnabled()) return denyExtendedContextMessage();
|
|
55
|
+
const cwd = resolveWorkspace();
|
|
56
|
+
const result = await execCapture("aspm", ["doctor"], cwd);
|
|
57
|
+
return buildCliToolResult("aspm", ["doctor"], cwd, result);
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
api.registerTool({
|
|
61
|
+
name: "aspm_local_scan",
|
|
62
|
+
label: "ASPM scan (local)",
|
|
63
|
+
description: "Runs `aspm scan <file> -s <source>` without uploading to the platform.",
|
|
64
|
+
parameters: Type.Object({
|
|
65
|
+
file: Type.String({ description: "Report file path relative to workspace" }),
|
|
66
|
+
source: Type.Union(
|
|
67
|
+
ASPM_SOURCES.map((s) => Type.Literal(s)),
|
|
68
|
+
{ description: "Scanner source id" },
|
|
69
|
+
),
|
|
70
|
+
}),
|
|
71
|
+
async execute(_id, params) {
|
|
72
|
+
if (!extendedContextEnabled()) return denyExtendedContextMessage();
|
|
73
|
+
const cwd = resolveWorkspace();
|
|
74
|
+
const filePath = resolvePathInWorkspace(String(params.file), cwd);
|
|
75
|
+
const source = String(params.source);
|
|
76
|
+
const args = ["scan", filePath, "-s", source];
|
|
77
|
+
const result = await execCapture("aspm", args, cwd);
|
|
78
|
+
return buildCliToolResult("aspm", args, cwd, result);
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
api.registerTool({
|
|
82
|
+
name: "aspm_local_upload",
|
|
83
|
+
label: "ASPM upload",
|
|
84
|
+
description:
|
|
85
|
+
"Runs `aspm upload <file> -s <source> -p <projectId>` using local ~/.kubbisec config for API key.",
|
|
86
|
+
parameters: Type.Object({
|
|
87
|
+
file: Type.String({ description: "Report file path relative to workspace" }),
|
|
88
|
+
source: Type.Union(
|
|
89
|
+
ASPM_SOURCES.map((s) => Type.Literal(s)),
|
|
90
|
+
{ description: "Scanner source id" },
|
|
91
|
+
),
|
|
92
|
+
projectId: Type.String({
|
|
93
|
+
description: "KubbiSec project id (required; also KUBBISEC_CONTEXT_PROJECT_ID if omitted)",
|
|
94
|
+
}),
|
|
95
|
+
}),
|
|
96
|
+
async execute(_id, params) {
|
|
97
|
+
if (!extendedContextEnabled()) return denyExtendedContextMessage();
|
|
98
|
+
const cwd = resolveWorkspace();
|
|
99
|
+
const filePath = resolvePathInWorkspace(String(params.file), cwd);
|
|
100
|
+
const source = String(params.source);
|
|
101
|
+
const projectId =
|
|
102
|
+
String(params.projectId).trim() || process.env.KUBBISEC_CONTEXT_PROJECT_ID?.trim() || "";
|
|
103
|
+
if (!projectId) {
|
|
104
|
+
return {
|
|
105
|
+
content: [
|
|
106
|
+
{
|
|
107
|
+
type: "text",
|
|
108
|
+
text: "Indique o projectId ou configure KUBBISEC_CONTEXT_PROJECT_ID (kubbisec chat -p).",
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
details: {
|
|
112
|
+
ok: false,
|
|
113
|
+
exitCode: 1,
|
|
114
|
+
userMessage: "projectId em falta para upload ASPM.",
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
const args = ["upload", filePath, "-s", source, "-p", projectId];
|
|
119
|
+
const result = await execCapture("aspm", args, cwd);
|
|
120
|
+
return buildCliToolResult("aspm", args, cwd, result);
|
|
121
|
+
},
|
|
122
|
+
});
|
|
119
123
|
}
|
|
120
|
-
//# sourceMappingURL=kubbisec-aspm-local.extension.js.map
|
|
124
|
+
//# 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
|