@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,197 +1,195 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as path from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
KUBBISEC_HEADER_HINTS_COMMANDS,
|
|
6
|
+
KUBBISEC_HEADER_HINTS_SKILL,
|
|
7
|
+
KUBBISEC_SUBTITLE_LINE,
|
|
8
|
+
KUBBISEC_WORDMARK,
|
|
9
|
+
} from "../copy/kubbisec-shell-copy.js";
|
|
5
10
|
import { kubbisecBrandFg } from "./kubbisec-brand-fg.js";
|
|
11
|
+
|
|
6
12
|
const FALLBACK_MARK = "◆";
|
|
7
13
|
const EMBEDDED_WORDMARK = /\s+K\s+U\s+B\s+B\s+I\s+S\s+E\s+C\s*$/i;
|
|
8
14
|
/** Works from `dist/theme/` and from materialized `<cwd>/.pi/theme/`. */
|
|
9
15
|
export function resolveTerminalAssetsDir(moduleUrl = import.meta.url) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
16
|
+
const here = path.dirname(fileURLToPath(moduleUrl));
|
|
17
|
+
const candidates = [
|
|
18
|
+
path.join(here, "../assets/terminal"),
|
|
19
|
+
path.join(here, "../../assets/terminal"),
|
|
20
|
+
];
|
|
21
|
+
for (const candidate of candidates) {
|
|
22
|
+
if (fs.existsSync(candidate)) {
|
|
23
|
+
return candidate;
|
|
19
24
|
}
|
|
20
|
-
|
|
25
|
+
}
|
|
26
|
+
return candidates[0];
|
|
21
27
|
}
|
|
22
28
|
function readAnsiFile(name) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
.filter((l) => l.length > 0);
|
|
29
|
+
const file = path.join(resolveTerminalAssetsDir(), name);
|
|
30
|
+
if (!fs.existsSync(file)) return null;
|
|
31
|
+
return fs
|
|
32
|
+
.readFileSync(file, "utf8")
|
|
33
|
+
.split("\n")
|
|
34
|
+
.map((l) => l.replace(/\r$/, ""))
|
|
35
|
+
.filter((l) => l.length > 0);
|
|
31
36
|
}
|
|
32
37
|
function isVerboseBrand() {
|
|
33
|
-
|
|
38
|
+
return process.env.KUBBISEC_TUI_VERBOSE === "1";
|
|
34
39
|
}
|
|
35
40
|
export function stripAnsi(value) {
|
|
36
|
-
|
|
41
|
+
return value.replace(/\x1b\[[0-9;]*m/g, "");
|
|
37
42
|
}
|
|
38
43
|
export function visibleWidth(text) {
|
|
39
|
-
|
|
44
|
+
return stripAnsi(text).length;
|
|
40
45
|
}
|
|
41
46
|
export function centerLine(text, width) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const pad = Math.floor((width - lineWidth) / 2);
|
|
48
|
-
return `${" ".repeat(pad)}${text}`;
|
|
47
|
+
if (width <= 0) return text;
|
|
48
|
+
const lineWidth = visibleWidth(text);
|
|
49
|
+
if (lineWidth >= width) return text;
|
|
50
|
+
const pad = Math.floor((width - lineWidth) / 2);
|
|
51
|
+
return `${" ".repeat(pad)}${text}`;
|
|
49
52
|
}
|
|
50
53
|
function _centerLines(lines, width) {
|
|
51
|
-
|
|
54
|
+
return lines.map((line) => centerLine(line, width));
|
|
52
55
|
}
|
|
53
56
|
/** Center a multi-line ANSI block with uniform left padding (preserves row alignment). */
|
|
54
57
|
export function centerLinesAsBlock(lines, width) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return lines.map((line) => `${prefix}${line}`);
|
|
58
|
+
if (lines.length === 0) return [];
|
|
59
|
+
const blockWidth = Math.max(...lines.map(visibleWidth));
|
|
60
|
+
const pad = width > blockWidth ? Math.floor((width - blockWidth) / 2) : 0;
|
|
61
|
+
const prefix = " ".repeat(pad);
|
|
62
|
+
return lines.map((line) => `${prefix}${line}`);
|
|
61
63
|
}
|
|
62
64
|
/** Remove inline "K U B B I S E C" suffix from generated logo rows. */
|
|
63
65
|
export function stripEmbeddedWordmark(line) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
i = end + 1;
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
out += line[i];
|
|
82
|
-
visible += 1;
|
|
83
|
-
i += 1;
|
|
66
|
+
const plain = stripAnsi(line);
|
|
67
|
+
const match = plain.match(EMBEDDED_WORDMARK);
|
|
68
|
+
if (!match || match.index === undefined) return line.trimEnd();
|
|
69
|
+
const cutPlainLen = match.index;
|
|
70
|
+
let visible = 0;
|
|
71
|
+
let i = 0;
|
|
72
|
+
let out = "";
|
|
73
|
+
while (i < line.length && visible < cutPlainLen) {
|
|
74
|
+
if (line[i] === "\x1b") {
|
|
75
|
+
const end = line.indexOf("m", i);
|
|
76
|
+
if (end === -1) break;
|
|
77
|
+
out += line.slice(i, end + 1);
|
|
78
|
+
i = end + 1;
|
|
79
|
+
continue;
|
|
84
80
|
}
|
|
85
|
-
|
|
81
|
+
out += line[i];
|
|
82
|
+
visible += 1;
|
|
83
|
+
i += 1;
|
|
84
|
+
}
|
|
85
|
+
return out.trimEnd();
|
|
86
86
|
}
|
|
87
87
|
function symbolOnlyLines(logo) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
return logo
|
|
89
|
+
.map((line) => stripEmbeddedWordmark(line))
|
|
90
|
+
.filter((line) => stripAnsi(line).length > 0);
|
|
91
91
|
}
|
|
92
92
|
/** Read once at module load — avoids sync I/O on every TUI frame. */
|
|
93
93
|
const CACHED_MARK_LINES = readAnsiFile("mark.ansi") ?? [];
|
|
94
94
|
const CACHED_WORDMARK_INLINE = readAnsiFile("wordmark-inline.ansi");
|
|
95
95
|
/** Pi TUI widgets do not render iTerm 1337 inline PNGs — opt-in only. */
|
|
96
96
|
function isInlineWordmarkEnabled() {
|
|
97
|
-
|
|
97
|
+
return process.env.KUBBISEC_TUI_INLINE_IMAGES === "1";
|
|
98
98
|
}
|
|
99
99
|
/** Brand cyan — same RGB as footer branch (`#28DCF9`). */
|
|
100
100
|
function brandText(_theme, text) {
|
|
101
|
-
|
|
101
|
+
return kubbisecBrandFg(text);
|
|
102
102
|
}
|
|
103
103
|
function renderSpacedWordmarkFallback(theme) {
|
|
104
|
-
|
|
104
|
+
return brandText(theme, KUBBISEC_WORDMARK.split("").join(" "));
|
|
105
105
|
}
|
|
106
106
|
/** Centered hex mark only — never inline logotipo with embedded wordmark. */
|
|
107
107
|
function loadSymbolBlock(verbose) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return symbolOnlyLines(logo);
|
|
113
|
-
}
|
|
108
|
+
if (verbose) {
|
|
109
|
+
for (const name of ["logotipo-wide-fallback.ansi", "mark.ansi"]) {
|
|
110
|
+
const logo = readAnsiFile(name);
|
|
111
|
+
if (logo?.length) return symbolOnlyLines(logo);
|
|
114
112
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
}
|
|
114
|
+
const mark = readAnsiFile("mark.ansi");
|
|
115
|
+
if (mark?.length) return mark;
|
|
116
|
+
return null;
|
|
119
117
|
}
|
|
120
118
|
function renderWordmarkLine(theme, width) {
|
|
121
|
-
|
|
119
|
+
return centerLine(theme.bold(theme.fg("accent", KUBBISEC_WORDMARK)), width);
|
|
122
120
|
}
|
|
123
121
|
function renderVersionLine(theme, version) {
|
|
124
|
-
|
|
122
|
+
return theme.fg("dim", `v${version}`);
|
|
125
123
|
}
|
|
126
124
|
/** Hints row with brand cyan on `@skill` and dim example + commands. */
|
|
127
125
|
export function renderHeaderHintsLine(theme) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
126
|
+
const [skillToken, ...exampleParts] = KUBBISEC_HEADER_HINTS_SKILL.split(/\s+/);
|
|
127
|
+
const example = exampleParts.join(" ");
|
|
128
|
+
const skill = brandText(theme, skillToken ?? "@skill");
|
|
129
|
+
const exampleLabel = example ? theme.fg("dim", ` ${example}`) : "";
|
|
130
|
+
const separator = theme.fg("dim", " · ");
|
|
131
|
+
const commands = theme.fg("dim", KUBBISEC_HEADER_HINTS_COMMANDS);
|
|
132
|
+
return `${skill}${exampleLabel}${separator}${commands}`;
|
|
135
133
|
}
|
|
136
134
|
function appendSubtitleAndHints(theme, lines, width) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
135
|
+
return [
|
|
136
|
+
...lines,
|
|
137
|
+
centerLine(brandText(theme, KUBBISEC_SUBTITLE_LINE), width),
|
|
138
|
+
centerLine(renderHeaderHintsLine(theme), width),
|
|
139
|
+
];
|
|
142
140
|
}
|
|
143
141
|
function renderStackedBrandBlock(theme, version, width, verbose) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
return appendSubtitleAndHints(theme, lines, width);
|
|
142
|
+
const symbol = loadSymbolBlock(verbose);
|
|
143
|
+
const lines = [];
|
|
144
|
+
if (symbol?.length) {
|
|
145
|
+
lines.push(...centerLinesAsBlock(symbol, width));
|
|
146
|
+
} else {
|
|
147
|
+
lines.push(centerLine(theme.fg("accent", FALLBACK_MARK), width));
|
|
148
|
+
}
|
|
149
|
+
lines.push("");
|
|
150
|
+
lines.push(renderWordmarkLine(theme, width));
|
|
151
|
+
lines.push(centerLine(renderVersionLine(theme, version), width));
|
|
152
|
+
lines.push("");
|
|
153
|
+
return appendSubtitleAndHints(theme, lines, width);
|
|
157
154
|
}
|
|
158
155
|
/** Single-line brand row: mark + wordmark + version + subtitle. */
|
|
159
156
|
export function renderCompactHeaderLine(theme, version) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
157
|
+
const mark = theme.fg("accent", FALLBACK_MARK);
|
|
158
|
+
const subtitle = theme.fg("dim", ` · ${KUBBISEC_SUBTITLE_LINE}`);
|
|
159
|
+
return `${mark} ${theme.bold(theme.fg("accent", KUBBISEC_WORDMARK))} ${renderVersionLine(theme, version)}${subtitle}`;
|
|
163
160
|
}
|
|
164
161
|
function renderWordmarkBlock(theme, version, width) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
162
|
+
const wordmark =
|
|
163
|
+
isInlineWordmarkEnabled() && CACHED_WORDMARK_INLINE?.[0]
|
|
164
|
+
? CACHED_WORDMARK_INLINE[0]
|
|
165
|
+
: renderSpacedWordmarkFallback(theme);
|
|
166
|
+
return [centerLine(wordmark, width), centerLine(renderVersionLine(theme, version), width)];
|
|
169
167
|
}
|
|
170
168
|
/** Default chat chrome: hex block, wordmark, version, spacer, subtitle, hints. */
|
|
171
169
|
export function renderCompactHeaderLines(theme, version, width = 80) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
return [
|
|
176
|
-
centerLine(renderCompactHeaderLine(theme, version), width),
|
|
177
|
-
"",
|
|
178
|
-
subtitleLine,
|
|
179
|
-
hintsLine,
|
|
180
|
-
];
|
|
181
|
-
}
|
|
170
|
+
const hintsLine = centerLine(renderHeaderHintsLine(theme), width);
|
|
171
|
+
const subtitleLine = centerLine(brandText(theme, KUBBISEC_SUBTITLE_LINE), width);
|
|
172
|
+
if (CACHED_MARK_LINES.length === 0) {
|
|
182
173
|
return [
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
subtitleLine,
|
|
188
|
-
hintsLine,
|
|
174
|
+
centerLine(renderCompactHeaderLine(theme, version), width),
|
|
175
|
+
"",
|
|
176
|
+
subtitleLine,
|
|
177
|
+
hintsLine,
|
|
189
178
|
];
|
|
179
|
+
}
|
|
180
|
+
return [
|
|
181
|
+
...centerLinesAsBlock(CACHED_MARK_LINES, width),
|
|
182
|
+
"",
|
|
183
|
+
...renderWordmarkBlock(theme, version, width),
|
|
184
|
+
"",
|
|
185
|
+
subtitleLine,
|
|
186
|
+
hintsLine,
|
|
187
|
+
];
|
|
190
188
|
}
|
|
191
189
|
export function renderChatHeaderLines(theme, version, width) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
190
|
+
if (isVerboseBrand()) {
|
|
191
|
+
return renderStackedBrandBlock(theme, version, width, true);
|
|
192
|
+
}
|
|
193
|
+
return renderCompactHeaderLines(theme, version, width);
|
|
196
194
|
}
|
|
197
|
-
//# sourceMappingURL=render-compact-header.js.map
|
|
195
|
+
//# sourceMappingURL=render-compact-header.js.map
|
|
@@ -7,4 +7,4 @@ export declare function resetSessionWorkflowMode(): void;
|
|
|
7
7
|
/** Plain footer badge (no ANSI); null when default mode. */
|
|
8
8
|
export declare function getSessionWorkflowFooterBadge(): string | null;
|
|
9
9
|
export declare function onSessionWorkflowStatusChange(listener: () => void): () => void;
|
|
10
|
-
//# sourceMappingURL=session-workflow-mode.d.ts.map
|
|
10
|
+
//# sourceMappingURL=session-workflow-mode.d.ts.map
|
|
@@ -2,50 +2,50 @@ let sessionMode = "default";
|
|
|
2
2
|
let specApproved = false;
|
|
3
3
|
let statusChangeListener;
|
|
4
4
|
export function getSessionWorkflowMode() {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return sessionMode;
|
|
5
|
+
const env = process.env.KUBBISEC_CHAT_MODE?.trim().toLowerCase();
|
|
6
|
+
if (env === "plan" || env === "review") return env;
|
|
7
|
+
return sessionMode;
|
|
9
8
|
}
|
|
10
9
|
export function isSessionSpecApproved() {
|
|
11
|
-
|
|
10
|
+
return specApproved;
|
|
12
11
|
}
|
|
13
12
|
export function setSessionWorkflowMode(mode) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
sessionMode = mode;
|
|
14
|
+
if (mode === "plan" || mode === "review") {
|
|
15
|
+
process.env.KUBBISEC_CHAT_MODE = mode;
|
|
16
|
+
} else if (
|
|
17
|
+
process.env.KUBBISEC_CHAT_MODE === "plan" ||
|
|
18
|
+
process.env.KUBBISEC_CHAT_MODE === "review"
|
|
19
|
+
) {
|
|
20
|
+
delete process.env.KUBBISEC_CHAT_MODE;
|
|
21
|
+
}
|
|
22
|
+
statusChangeListener?.();
|
|
23
23
|
}
|
|
24
24
|
export function setSessionSpecApproved(approved) {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
specApproved = approved;
|
|
26
|
+
statusChangeListener?.();
|
|
27
27
|
}
|
|
28
28
|
export function resetSessionWorkflowMode() {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
sessionMode = "default";
|
|
30
|
+
specApproved = false;
|
|
31
31
|
}
|
|
32
32
|
/** Plain footer badge (no ANSI); null when default mode. */
|
|
33
33
|
export function getSessionWorkflowFooterBadge() {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
const mode = getSessionWorkflowMode();
|
|
35
|
+
if (mode === "plan") {
|
|
36
|
+
return specApproved ? "@plan" : "@plan · gate";
|
|
37
|
+
}
|
|
38
|
+
if (mode === "review") {
|
|
39
|
+
return "review";
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
42
|
}
|
|
43
43
|
export function onSessionWorkflowStatusChange(listener) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
statusChangeListener = listener;
|
|
45
|
+
return () => {
|
|
46
|
+
if (statusChangeListener === listener) {
|
|
47
|
+
statusChangeListener = undefined;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
50
|
}
|
|
51
|
-
//# sourceMappingURL=session-workflow-mode.js.map
|
|
51
|
+
//# sourceMappingURL=session-workflow-mode.js.map
|