@kubbisec/ai-linux-arm64 0.1.20 → 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/bin/kubbisec +0 -0
- 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,6 +1,5 @@
|
|
|
1
1
|
type ExtensionApi = {
|
|
2
|
-
|
|
2
|
+
on: (event: string, handler: (event: unknown, ctx: unknown) => void | Promise<void>) => void;
|
|
3
3
|
};
|
|
4
4
|
export default function kubbisecSkillTelemetry(api: ExtensionApi): void;
|
|
5
|
-
|
|
6
|
-
//# sourceMappingURL=kubbisec-skill-telemetry.extension.d.ts.map
|
|
5
|
+
//# sourceMappingURL=kubbisec-skill-telemetry.extension.d.ts.map
|
|
@@ -2,84 +2,79 @@
|
|
|
2
2
|
* KubbiSec trajectory telemetry — forwards Pi TUI events to parent adapter via JSONL file.
|
|
3
3
|
*/
|
|
4
4
|
import * as fs from "node:fs";
|
|
5
|
+
|
|
5
6
|
function isOptOut() {
|
|
6
|
-
|
|
7
|
+
return process.env.KUBBISEC_TELEMETRY_OPT_OUT === "1";
|
|
7
8
|
}
|
|
8
9
|
function eventsPath() {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return eventsFile;
|
|
10
|
+
const sessionId = process.env.KUBBISEC_TELEMETRY_SESSION_ID?.trim();
|
|
11
|
+
const eventsFile = process.env.KUBBISEC_TELEMETRY_EVENTS_PATH?.trim();
|
|
12
|
+
if (!sessionId || !eventsFile) return null;
|
|
13
|
+
return eventsFile;
|
|
14
14
|
}
|
|
15
15
|
function shouldEmit(surface) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return false;
|
|
23
|
-
return true;
|
|
16
|
+
if (isOptOut()) return false;
|
|
17
|
+
if (surface === "chat" && process.env.KUBBISEC_TELEMETRY_CHAT !== "1") {
|
|
18
|
+
return process.env.KUBBISEC_SKILL_ROUTER === "1";
|
|
19
|
+
}
|
|
20
|
+
if (surface === "fix" && process.env.KUBBISEC_TELEMETRY_FIX !== "1") return false;
|
|
21
|
+
return true;
|
|
24
22
|
}
|
|
25
23
|
function resolveSurface() {
|
|
26
|
-
|
|
24
|
+
return process.env.KUBBISEC_TELEMETRY_SURFACE === "fix" ? "fix" : "chat";
|
|
27
25
|
}
|
|
28
26
|
const SECRET_ARG_PATTERN = /KUBBISEC_API_KEY|GITHUB_TOKEN|password=/i;
|
|
29
27
|
function scrubToolArgs(args) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
const raw = typeof args === "string" ? args : JSON.stringify(args ?? "");
|
|
29
|
+
if (SECRET_ARG_PATTERN.test(raw)) {
|
|
30
|
+
return "[REDACTED]";
|
|
31
|
+
}
|
|
32
|
+
return args;
|
|
35
33
|
}
|
|
36
34
|
function appendEvent(kind, payload) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
catch {
|
|
52
|
-
/* swallow — telemetry must not block TUI */
|
|
53
|
-
}
|
|
35
|
+
const file = eventsPath();
|
|
36
|
+
if (!file) return;
|
|
37
|
+
const surface = resolveSurface();
|
|
38
|
+
if (!shouldEmit(surface)) return;
|
|
39
|
+
try {
|
|
40
|
+
const line = JSON.stringify({
|
|
41
|
+
ts: new Date().toISOString(),
|
|
42
|
+
kind,
|
|
43
|
+
payload,
|
|
44
|
+
});
|
|
45
|
+
fs.appendFileSync(file, `${line}\n`, { encoding: "utf8", mode: 0o600 });
|
|
46
|
+
} catch {
|
|
47
|
+
/* swallow — telemetry must not block TUI */
|
|
48
|
+
}
|
|
54
49
|
}
|
|
55
50
|
export default function kubbisecSkillTelemetry(api) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
args: scrubToolArgs(tool.args),
|
|
71
|
-
});
|
|
51
|
+
if (isOptOut() || !eventsPath()) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
api.on("input", async (event) => {
|
|
55
|
+
const input = event;
|
|
56
|
+
const text = typeof input.text === "string" ? input.text : "";
|
|
57
|
+
if (!text.trim()) return;
|
|
58
|
+
appendEvent("user_message", { text: text.slice(0, 4096) });
|
|
59
|
+
});
|
|
60
|
+
api.on("tool_start", async (event) => {
|
|
61
|
+
const tool = event;
|
|
62
|
+
appendEvent("tool_call", {
|
|
63
|
+
name: tool.name ?? "unknown",
|
|
64
|
+
args: scrubToolArgs(tool.args),
|
|
72
65
|
});
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
66
|
+
});
|
|
67
|
+
api.on("tool_end", async (event) => {
|
|
68
|
+
const tool = event;
|
|
69
|
+
const output =
|
|
70
|
+
typeof tool.output === "string" && tool.output.length > 2048
|
|
71
|
+
? `${tool.output.slice(0, 2048)}…`
|
|
72
|
+
: tool.output;
|
|
73
|
+
appendEvent("tool_result", {
|
|
74
|
+
name: tool.name ?? "unknown",
|
|
75
|
+
exitCode: tool.exitCode ?? null,
|
|
76
|
+
output,
|
|
83
77
|
});
|
|
78
|
+
});
|
|
84
79
|
}
|
|
85
|
-
//# sourceMappingURL=kubbisec-skill-telemetry.extension.js.map
|
|
80
|
+
//# sourceMappingURL=kubbisec-skill-telemetry.extension.js.map
|
|
@@ -1,43 +1,42 @@
|
|
|
1
1
|
import { patchGlobalThemeAccent } from "../theme/kubbisec-menu-themes.js";
|
|
2
2
|
import { KUBBISEC_THEME_NAME } from "../theme/kubbisec-theme-name.js";
|
|
3
|
+
|
|
3
4
|
const THEME_GUARD_MS = 1_500;
|
|
4
5
|
const NOTIFY_COOLDOWN_MS = 8_000;
|
|
5
|
-
const THEME_LOCKED_MESSAGE =
|
|
6
|
+
const THEME_LOCKED_MESSAGE =
|
|
7
|
+
"O tema KubbiSec é fixo. Alterações em /settings ou /reload não mudam o visual.";
|
|
6
8
|
let lastNotifyAt = 0;
|
|
7
9
|
function lockTheme(ctx, notify) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (now - lastNotifyAt < NOTIFY_COOLDOWN_MS)
|
|
17
|
-
return;
|
|
18
|
-
lastNotifyAt = now;
|
|
19
|
-
ctx.ui.notify(THEME_LOCKED_MESSAGE, "info");
|
|
10
|
+
if (!ctx.hasUI) return;
|
|
11
|
+
if (ctx.ui.theme.name === KUBBISEC_THEME_NAME) return;
|
|
12
|
+
const result = ctx.ui.setTheme(KUBBISEC_THEME_NAME);
|
|
13
|
+
if (!result.success || !notify) return;
|
|
14
|
+
const now = Date.now();
|
|
15
|
+
if (now - lastNotifyAt < NOTIFY_COOLDOWN_MS) return;
|
|
16
|
+
lastNotifyAt = now;
|
|
17
|
+
ctx.ui.notify(THEME_LOCKED_MESSAGE, "info");
|
|
20
18
|
}
|
|
21
19
|
export default function kubbisecThemeLock(api) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
20
|
+
let guardTimer;
|
|
21
|
+
const stopGuard = () => {
|
|
22
|
+
if (!guardTimer) return;
|
|
23
|
+
clearInterval(guardTimer);
|
|
24
|
+
guardTimer = undefined;
|
|
25
|
+
};
|
|
26
|
+
const startGuard = (ctx) => {
|
|
27
|
+
stopGuard();
|
|
28
|
+
guardTimer = setInterval(() => lockTheme(ctx, true), THEME_GUARD_MS);
|
|
29
|
+
};
|
|
30
|
+
api.on("session_start", async (_event, ctx) => {
|
|
31
|
+
lockTheme(ctx, false);
|
|
32
|
+
patchGlobalThemeAccent();
|
|
33
|
+
await import("../theme/patch-pi-settings-theme.runtime.js").then((mod) =>
|
|
34
|
+
mod.patchPiSettingsListTheme(),
|
|
35
|
+
);
|
|
36
|
+
startGuard(ctx);
|
|
37
|
+
});
|
|
38
|
+
api.on("session_shutdown", () => {
|
|
39
|
+
stopGuard();
|
|
40
|
+
});
|
|
42
41
|
}
|
|
43
|
-
//# sourceMappingURL=kubbisec-theme-lock.extension.js.map
|
|
42
|
+
//# sourceMappingURL=kubbisec-theme-lock.extension.js.map
|
|
@@ -1,132 +1,137 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* KubbiSec AI shell: closed cyan editor frame (┌─┐ │ │ └─┘) around the chat input.
|
|
3
3
|
*/
|
|
4
|
-
import { CustomEditor
|
|
4
|
+
import { CustomEditor } from "@earendil-works/pi-coding-agent";
|
|
5
5
|
import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
6
6
|
import { handleClarifyPanelKey } from "../clarify/clarify-select-panel.js";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
getClarifyUiSnapshot,
|
|
9
|
+
isClarifyAsking,
|
|
10
|
+
setClarifyUiSnapshot,
|
|
11
|
+
} from "../clarify/clarify-ui-state.js";
|
|
8
12
|
import { formatSelectionSubmit } from "../clarify/parse-clarify-answer.js";
|
|
9
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
KUBBISEC_EDITOR_PLACEHOLDER,
|
|
15
|
+
KUBBISEC_EXIT_SLASH_COMMAND,
|
|
16
|
+
} from "../copy/kubbisec-shell-copy.js";
|
|
10
17
|
import { renderLineWithMentionChips } from "../skills/chat-mention-render.js";
|
|
11
18
|
import { withKubbisecSelectListTheme } from "../theme/kubbisec-menu-themes.js";
|
|
19
|
+
|
|
12
20
|
/** Horizontal inset inside the cyan editor frame (per side). */
|
|
13
21
|
const EDITOR_PADDING_X = 1;
|
|
14
22
|
function buildPlaceholderContent(theme, innerWidth, rawLine) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return `${content}${" ".repeat(pad)}`;
|
|
23
|
+
if (innerWidth <= 0) return "";
|
|
24
|
+
const showCursor = rawLine.includes("\x1b[7m");
|
|
25
|
+
const dim = (text) => theme.fg("dim", text);
|
|
26
|
+
const inset = " ".repeat(EDITOR_PADDING_X);
|
|
27
|
+
if (!showCursor) {
|
|
28
|
+
const text = `${inset}${dim(KUBBISEC_EDITOR_PLACEHOLDER)}`;
|
|
29
|
+
const pad = Math.max(0, innerWidth - visibleWidth(text));
|
|
30
|
+
return `${text}${" ".repeat(pad)}`;
|
|
31
|
+
}
|
|
32
|
+
const first = KUBBISEC_EDITOR_PLACEHOLDER[0] ?? " ";
|
|
33
|
+
const rest = KUBBISEC_EDITOR_PLACEHOLDER.slice(1);
|
|
34
|
+
const cursor = `\x1b[7m${first}\x1b[0m`;
|
|
35
|
+
const content = `${inset}${cursor}${dim(rest)}`;
|
|
36
|
+
const pad = Math.max(0, innerWidth - visibleWidth(content));
|
|
37
|
+
return `${content}${" ".repeat(pad)}`;
|
|
31
38
|
}
|
|
32
39
|
function horizontalBorder(width, leftCap, rightCap, border) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const mid = Math.max(0, width - 2);
|
|
38
|
-
return `${border(leftCap)}${border("─".repeat(mid))}${border(rightCap)}`;
|
|
40
|
+
if (width <= 0) return "";
|
|
41
|
+
if (width === 1) return border(leftCap);
|
|
42
|
+
const mid = Math.max(0, width - 2);
|
|
43
|
+
return `${border(leftCap)}${border("─".repeat(mid))}${border(rightCap)}`;
|
|
39
44
|
}
|
|
40
45
|
function wrapWithVerticalBorders(content, width, border) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const pad = Math.max(0, innerWidth - visibleWidth(inner));
|
|
48
|
-
return `${border("│")}${inner}${" ".repeat(pad)}${border("│")}`;
|
|
46
|
+
if (width <= 0) return "";
|
|
47
|
+
if (width === 1) return border("│");
|
|
48
|
+
const innerWidth = Math.max(0, width - 2);
|
|
49
|
+
const inner = truncateToWidth(content, innerWidth, "");
|
|
50
|
+
const pad = Math.max(0, innerWidth - visibleWidth(inner));
|
|
51
|
+
return `${border("│")}${inner}${" ".repeat(pad)}${border("│")}`;
|
|
49
52
|
}
|
|
50
53
|
export default function kubbisecUi(pi) {
|
|
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
|
-
if (isClarifyAsking()) {
|
|
78
|
-
const snapshot = getClarifyUiSnapshot();
|
|
79
|
-
const trimmed = text.trim();
|
|
80
|
-
if (!trimmed) {
|
|
81
|
-
const fromPanel = formatSelectionSubmit(new Set(snapshot.selected), snapshot.selectionMode);
|
|
82
|
-
if (fromPanel) {
|
|
83
|
-
return handler(fromPanel);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return handler(text);
|
|
88
|
-
}
|
|
89
|
-
: undefined;
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
handleInput(data) {
|
|
94
|
-
if (isClarifyAsking()) {
|
|
54
|
+
pi.on("session_start", (_event, ctx) => {
|
|
55
|
+
if (!ctx.hasUI) return;
|
|
56
|
+
ctx.ui.setWorkingVisible(false);
|
|
57
|
+
ctx.ui.setHiddenThinkingLabel("reasoning");
|
|
58
|
+
ctx.ui.setWorkingIndicator({ frames: ["◆", "◇", "◆", "◇"], intervalMs: 120 });
|
|
59
|
+
class KubbisecBorderEditor extends CustomEditor {
|
|
60
|
+
constructor(tui, theme, keybindings) {
|
|
61
|
+
super(tui, withKubbisecSelectListTheme(theme), keybindings, {
|
|
62
|
+
paddingX: EDITOR_PADDING_X,
|
|
63
|
+
autocompleteMaxVisible: 12,
|
|
64
|
+
});
|
|
65
|
+
this.installExitSlashRedirect();
|
|
66
|
+
}
|
|
67
|
+
installExitSlashRedirect() {
|
|
68
|
+
let submitHandler;
|
|
69
|
+
Object.defineProperty(this, "onSubmit", {
|
|
70
|
+
configurable: true,
|
|
71
|
+
enumerable: true,
|
|
72
|
+
get: () => submitHandler,
|
|
73
|
+
set: (handler) => {
|
|
74
|
+
submitHandler = handler
|
|
75
|
+
? async (text) => {
|
|
76
|
+
if (text.trim() === "/quit") {
|
|
77
|
+
return handler(KUBBISEC_EXIT_SLASH_COMMAND);
|
|
78
|
+
}
|
|
79
|
+
if (isClarifyAsking()) {
|
|
95
80
|
const snapshot = getClarifyUiSnapshot();
|
|
96
|
-
const
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return;
|
|
81
|
+
const trimmed = text.trim();
|
|
82
|
+
if (!trimmed) {
|
|
83
|
+
const fromPanel = formatSelectionSubmit(
|
|
84
|
+
new Set(snapshot.selected),
|
|
85
|
+
snapshot.selectionMode,
|
|
86
|
+
);
|
|
87
|
+
if (fromPanel) {
|
|
88
|
+
return handler(fromPanel);
|
|
89
|
+
}
|
|
104
90
|
}
|
|
91
|
+
}
|
|
92
|
+
return handler(text);
|
|
105
93
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const base = isEmpty && i === 1
|
|
120
|
-
? buildPlaceholderContent(thm, innerWidth, rawLine)
|
|
121
|
-
: rawLine;
|
|
122
|
-
const content = renderLineWithMentionChips(base, thm);
|
|
123
|
-
lines[i] = wrapWithVerticalBorders(content, width, borderColor);
|
|
124
|
-
}
|
|
125
|
-
lines[lines.length - 1] = horizontalBorder(width, "└", "┘", borderColor);
|
|
126
|
-
return lines;
|
|
94
|
+
: undefined;
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
handleInput(data) {
|
|
99
|
+
if (isClarifyAsking()) {
|
|
100
|
+
const snapshot = getClarifyUiSnapshot();
|
|
101
|
+
const result = handleClarifyPanelKey(snapshot, data);
|
|
102
|
+
if (result.consumed) {
|
|
103
|
+
setClarifyUiSnapshot(result.snapshot);
|
|
104
|
+
if (result.submitText && this.onSubmit) {
|
|
105
|
+
void this.onSubmit(result.submitText);
|
|
106
|
+
return;
|
|
127
107
|
}
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
128
110
|
}
|
|
129
|
-
|
|
130
|
-
|
|
111
|
+
super.handleInput(data);
|
|
112
|
+
}
|
|
113
|
+
render(width) {
|
|
114
|
+
const lines = super.render(width);
|
|
115
|
+
if (lines.length < 2) return lines;
|
|
116
|
+
const thm = ctx.ui.theme;
|
|
117
|
+
const borderColor = (text) => thm.fg("borderAccent", text);
|
|
118
|
+
const isEmpty = this.getText().length === 0;
|
|
119
|
+
const innerWidth = Math.max(0, width - 2);
|
|
120
|
+
lines[0] = horizontalBorder(width, "┌", "┐", borderColor);
|
|
121
|
+
for (let i = 1; i < lines.length - 1; i += 1) {
|
|
122
|
+
const rawLine = lines[i] ?? "";
|
|
123
|
+
const base =
|
|
124
|
+
isEmpty && i === 1 ? buildPlaceholderContent(thm, innerWidth, rawLine) : rawLine;
|
|
125
|
+
const content = renderLineWithMentionChips(base, thm);
|
|
126
|
+
lines[i] = wrapWithVerticalBorders(content, width, borderColor);
|
|
127
|
+
}
|
|
128
|
+
lines[lines.length - 1] = horizontalBorder(width, "└", "┘", borderColor);
|
|
129
|
+
return lines;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
ctx.ui.setEditorComponent(
|
|
133
|
+
(tui, theme, keybindings) => new KubbisecBorderEditor(tui, theme, keybindings),
|
|
134
|
+
);
|
|
135
|
+
});
|
|
131
136
|
}
|
|
132
|
-
//# sourceMappingURL=kubbisec-ui.extension.js.map
|
|
137
|
+
//# sourceMappingURL=kubbisec-ui.extension.js.map
|
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
export type ChatWorkflowMode = "default" | "plan" | "review";
|
|
2
2
|
export type SessionWorkflowState = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
mode: ChatWorkflowMode;
|
|
4
|
+
specApproved: boolean;
|
|
5
|
+
specPath?: string;
|
|
6
6
|
};
|
|
7
7
|
export declare function isMutationTool(toolName: string): boolean;
|
|
8
8
|
export declare function detectModeFromPrompt(prompt: string, envMode?: string): ChatWorkflowMode;
|
|
9
9
|
export declare function parseRuntimeSpecStatus(content: string): string | null;
|
|
10
10
|
export declare function findApprovedSpec(cwd: string): {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
approved: boolean;
|
|
12
|
+
specPath?: string;
|
|
13
13
|
};
|
|
14
14
|
export declare function resolveSpecApproval(cwd: string): {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
approved: boolean;
|
|
16
|
+
specPath?: string;
|
|
17
17
|
};
|
|
18
18
|
export declare function shouldBlockMutationTool(state: SessionWorkflowState): boolean;
|
|
19
19
|
export declare function userApprovedSpecKeyword(text: string): boolean;
|
|
20
20
|
export declare function buildPlanModeContextMessage(): string;
|
|
21
21
|
export declare function buildReviewModeContextMessage(): string;
|
|
22
22
|
type ExtensionApi = {
|
|
23
|
-
|
|
23
|
+
on: (
|
|
24
|
+
event: string,
|
|
25
|
+
handler: (event: unknown, ctx: ExtensionContext) => undefined | Promise<unknown>,
|
|
26
|
+
) => void;
|
|
24
27
|
};
|
|
25
28
|
type ExtensionContext = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
29
|
+
hasUI: boolean;
|
|
30
|
+
cwd: string;
|
|
31
|
+
ui: {
|
|
32
|
+
notify: (message: string, level?: string) => void;
|
|
33
|
+
setStatus: (key: string, text: string | undefined) => void;
|
|
34
|
+
theme: {
|
|
35
|
+
fg: (role: string, text: string) => string;
|
|
34
36
|
};
|
|
37
|
+
};
|
|
35
38
|
};
|
|
36
39
|
export default function kubbisecWorkflow(api: ExtensionApi): void;
|
|
37
|
-
|
|
38
|
-
//# sourceMappingURL=kubbisec-workflow.extension.d.ts.map
|
|
40
|
+
//# sourceMappingURL=kubbisec-workflow.extension.d.ts.map
|