@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
|
@@ -6,28 +6,38 @@ export declare const LM_STUDIO_PROVIDER_NAME = "LM Studio";
|
|
|
6
6
|
export declare const OLLAMA_DEFAULT_HOST = "http://127.0.0.1:11434";
|
|
7
7
|
export declare const LM_STUDIO_DEFAULT_HOST = "http://127.0.0.1:1234";
|
|
8
8
|
export type LocalLlmDetectOptions = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
timeoutMs?: number;
|
|
10
|
+
ollamaBaseUrl?: string;
|
|
11
|
+
lmStudioBaseUrl?: string;
|
|
12
|
+
detectOllama?: boolean;
|
|
13
|
+
detectLmStudio?: boolean;
|
|
14
14
|
};
|
|
15
15
|
export type LocalLlmDetectResult = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
detected: KubbisecCustomProviderDef[];
|
|
17
|
+
ollama: KubbisecCustomProviderDef | null;
|
|
18
|
+
lmstudio: KubbisecCustomProviderDef | null;
|
|
19
|
+
removedProviderIds: string[];
|
|
20
20
|
};
|
|
21
21
|
export declare function resolveOllamaHost(config?: KubbisecLlmConfig["localLlm"]): string;
|
|
22
22
|
export declare function resolveLmStudioOpenAiBase(config?: KubbisecLlmConfig["localLlm"]): string;
|
|
23
23
|
export declare function inferLocalModelReasoning(modelId: string): boolean;
|
|
24
24
|
export declare function formatLocalModelName(modelId: string): string;
|
|
25
|
-
export declare function detectOllamaProvider(
|
|
26
|
-
|
|
25
|
+
export declare function detectOllamaProvider(
|
|
26
|
+
options?: LocalLlmDetectOptions,
|
|
27
|
+
): Promise<KubbisecCustomProviderDef | null>;
|
|
28
|
+
export declare function detectLmStudioProvider(
|
|
29
|
+
options?: LocalLlmDetectOptions,
|
|
30
|
+
): Promise<KubbisecCustomProviderDef | null>;
|
|
27
31
|
export declare function isLocalLlmAutodetectEnabled(config?: KubbisecLlmConfig): boolean;
|
|
28
|
-
export declare function detectLocalLlmProviders(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
export declare function detectLocalLlmProviders(
|
|
33
|
+
config?: KubbisecLlmConfig,
|
|
34
|
+
overrides?: LocalLlmDetectOptions,
|
|
35
|
+
): Promise<KubbisecCustomProviderDef[]>;
|
|
36
|
+
export declare function syncAutodetectedLocalProviders(
|
|
37
|
+
cwd?: string,
|
|
38
|
+
options?: LocalLlmDetectOptions,
|
|
39
|
+
): Promise<{
|
|
40
|
+
config: KubbisecLlmConfig;
|
|
41
|
+
result: LocalLlmDetectResult;
|
|
32
42
|
}>;
|
|
33
|
-
//# sourceMappingURL=detect-local-llm-providers.d.ts.map
|
|
43
|
+
//# sourceMappingURL=detect-local-llm-providers.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { applyLlmConfigToPiSettings, readLlmConfig, writeLlmConfig
|
|
1
|
+
import { applyLlmConfigToPiSettings, readLlmConfig, writeLlmConfig } from "./llm-config.js";
|
|
2
2
|
export const OLLAMA_PROVIDER_ID = "ollama";
|
|
3
3
|
export const LM_STUDIO_PROVIDER_ID = "lmstudio";
|
|
4
4
|
export const OLLAMA_PROVIDER_NAME = "Ollama";
|
|
@@ -6,167 +6,155 @@ export const LM_STUDIO_PROVIDER_NAME = "LM Studio";
|
|
|
6
6
|
export const OLLAMA_DEFAULT_HOST = "http://127.0.0.1:11434";
|
|
7
7
|
export const LM_STUDIO_DEFAULT_HOST = "http://127.0.0.1:1234";
|
|
8
8
|
export function resolveOllamaHost(config) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const fromEnv = process.env.OLLAMA_HOST?.trim();
|
|
10
|
+
const fromConfig = config?.ollama?.baseUrl?.trim();
|
|
11
|
+
const raw = fromConfig || fromEnv || OLLAMA_DEFAULT_HOST;
|
|
12
|
+
return raw.replace(/\/+$/, "");
|
|
13
13
|
}
|
|
14
14
|
export function resolveLmStudioOpenAiBase(config) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const fromEnv = process.env.LM_STUDIO_BASE_URL?.trim() || process.env.LMSTUDIO_BASE_URL?.trim();
|
|
16
|
+
const fromConfig = config?.lmstudio?.baseUrl?.trim();
|
|
17
|
+
const raw = fromConfig || fromEnv || LM_STUDIO_DEFAULT_HOST;
|
|
18
|
+
const trimmed = raw.replace(/\/+$/, "");
|
|
19
|
+
return trimmed.endsWith("/v1") ? trimmed : `${trimmed}/v1`;
|
|
20
20
|
}
|
|
21
21
|
export function inferLocalModelReasoning(modelId) {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const lower = modelId.toLowerCase();
|
|
23
|
+
return /(?:^|[-_/])(o1|o3|qwq|deepseek-r1|r1|reasoning|think)/.test(lower);
|
|
24
24
|
}
|
|
25
25
|
export function formatLocalModelName(modelId) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
const base = modelId.split(":")[0] ?? modelId;
|
|
27
|
+
return base
|
|
28
|
+
.split(/[-_/]/)
|
|
29
|
+
.filter(Boolean)
|
|
30
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
31
|
+
.join(" ");
|
|
32
32
|
}
|
|
33
33
|
async function fetchJson(url, timeoutMs) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
finally {
|
|
49
|
-
clearTimeout(timer);
|
|
50
|
-
}
|
|
34
|
+
const controller = new AbortController();
|
|
35
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
36
|
+
try {
|
|
37
|
+
const response = await fetch(url, {
|
|
38
|
+
signal: controller.signal,
|
|
39
|
+
headers: { Accept: "application/json" },
|
|
40
|
+
});
|
|
41
|
+
if (!response.ok) return null;
|
|
42
|
+
return await response.json();
|
|
43
|
+
} catch {
|
|
44
|
+
return null;
|
|
45
|
+
} finally {
|
|
46
|
+
clearTimeout(timer);
|
|
47
|
+
}
|
|
51
48
|
}
|
|
52
49
|
function toLocalModelDef(modelId) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
50
|
+
const id = modelId.trim();
|
|
51
|
+
return {
|
|
52
|
+
id,
|
|
53
|
+
name: formatLocalModelName(id),
|
|
54
|
+
reasoning: inferLocalModelReasoning(id),
|
|
55
|
+
contextWindow: 128_000,
|
|
56
|
+
maxTokens: 8_192,
|
|
57
|
+
};
|
|
61
58
|
}
|
|
62
59
|
export async function detectOllamaProvider(options = {}) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
detectSource: "ollama",
|
|
83
|
-
};
|
|
60
|
+
if (options.detectOllama === false) return null;
|
|
61
|
+
const host = (options.ollamaBaseUrl ?? resolveOllamaHost()).replace(/\/+$/, "");
|
|
62
|
+
const timeoutMs = options.timeoutMs ?? 900;
|
|
63
|
+
const tags = await fetchJson(`${host}/api/tags`, timeoutMs);
|
|
64
|
+
const models = (tags?.models ?? [])
|
|
65
|
+
.map((entry) => entry.name?.trim() || entry.model?.trim())
|
|
66
|
+
.filter((name) => Boolean(name));
|
|
67
|
+
if (models.length === 0) return null;
|
|
68
|
+
const uniqueModels = [...new Set(models)].map(toLocalModelDef);
|
|
69
|
+
return {
|
|
70
|
+
id: OLLAMA_PROVIDER_ID,
|
|
71
|
+
name: OLLAMA_PROVIDER_NAME,
|
|
72
|
+
baseUrl: `${host}/v1`,
|
|
73
|
+
apiKey: "ollama",
|
|
74
|
+
api: "openai-completions",
|
|
75
|
+
models: uniqueModels,
|
|
76
|
+
autodetected: true,
|
|
77
|
+
detectSource: "ollama",
|
|
78
|
+
};
|
|
84
79
|
}
|
|
85
80
|
export async function detectLmStudioProvider(options = {}) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
models: uniqueModels,
|
|
104
|
-
autodetected: true,
|
|
105
|
-
detectSource: "lmstudio",
|
|
106
|
-
};
|
|
81
|
+
if (options.detectLmStudio === false) return null;
|
|
82
|
+
const baseUrl = (options.lmStudioBaseUrl ?? resolveLmStudioOpenAiBase()).replace(/\/+$/, "");
|
|
83
|
+
const timeoutMs = options.timeoutMs ?? 900;
|
|
84
|
+
const listing = await fetchJson(`${baseUrl}/models`, timeoutMs);
|
|
85
|
+
const models = (listing?.data ?? []).map((entry) => entry.id?.trim()).filter((id) => Boolean(id));
|
|
86
|
+
if (models.length === 0) return null;
|
|
87
|
+
const uniqueModels = [...new Set(models)].map(toLocalModelDef);
|
|
88
|
+
return {
|
|
89
|
+
id: LM_STUDIO_PROVIDER_ID,
|
|
90
|
+
name: LM_STUDIO_PROVIDER_NAME,
|
|
91
|
+
baseUrl,
|
|
92
|
+
apiKey: "lm-studio",
|
|
93
|
+
api: "openai-completions",
|
|
94
|
+
models: uniqueModels,
|
|
95
|
+
autodetected: true,
|
|
96
|
+
detectSource: "lmstudio",
|
|
97
|
+
};
|
|
107
98
|
}
|
|
108
99
|
export function isLocalLlmAutodetectEnabled(config = readLlmConfig()) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return true;
|
|
113
|
-
return config.localLlm?.autoDetect !== false;
|
|
100
|
+
if (process.env.KUBBISEC_LLM_AUTODETECT === "0") return false;
|
|
101
|
+
if (process.env.KUBBISEC_LLM_AUTODETECT === "1") return true;
|
|
102
|
+
return config.localLlm?.autoDetect !== false;
|
|
114
103
|
}
|
|
115
104
|
export async function detectLocalLlmProviders(config = readLlmConfig(), overrides = {}) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return [ollama, lmstudio].filter((provider) => provider != null);
|
|
105
|
+
if (!isLocalLlmAutodetectEnabled(config)) return [];
|
|
106
|
+
const local = config.localLlm;
|
|
107
|
+
const timeoutMs = overrides.timeoutMs ?? 900;
|
|
108
|
+
const [ollama, lmstudio] = await Promise.all([
|
|
109
|
+
detectOllamaProvider({
|
|
110
|
+
timeoutMs,
|
|
111
|
+
ollamaBaseUrl: overrides.ollamaBaseUrl ?? local?.ollama?.baseUrl,
|
|
112
|
+
detectOllama: local?.ollama?.enabled !== false && overrides.detectOllama !== false,
|
|
113
|
+
}),
|
|
114
|
+
detectLmStudioProvider({
|
|
115
|
+
timeoutMs,
|
|
116
|
+
lmStudioBaseUrl: overrides.lmStudioBaseUrl ?? local?.lmstudio?.baseUrl,
|
|
117
|
+
detectLmStudio: local?.lmstudio?.enabled !== false && overrides.detectLmStudio !== false,
|
|
118
|
+
}),
|
|
119
|
+
]);
|
|
120
|
+
return [ollama, lmstudio].filter((provider) => provider != null);
|
|
133
121
|
}
|
|
134
122
|
function mergeDetectedProviders(current, detected) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
next.push(provider);
|
|
150
|
-
}
|
|
151
|
-
return { providers: next, removedProviderIds };
|
|
123
|
+
const manual = current.filter((provider) => !provider.autodetected);
|
|
124
|
+
const manualIds = new Set(manual.map((provider) => provider.id));
|
|
125
|
+
const detectedIds = new Set(detected.map((provider) => provider.id));
|
|
126
|
+
const removedProviderIds = current
|
|
127
|
+
.filter((provider) => provider.autodetected && !detectedIds.has(provider.id))
|
|
128
|
+
.map((provider) => provider.id);
|
|
129
|
+
const next = [...manual];
|
|
130
|
+
for (const provider of detected) {
|
|
131
|
+
if (manualIds.has(provider.id)) continue;
|
|
132
|
+
const index = next.findIndex((entry) => entry.id === provider.id && entry.autodetected);
|
|
133
|
+
if (index >= 0) next[index] = provider;
|
|
134
|
+
else next.push(provider);
|
|
135
|
+
}
|
|
136
|
+
return { providers: next, removedProviderIds };
|
|
152
137
|
}
|
|
153
138
|
export async function syncAutodetectedLocalProviders(cwd = process.cwd(), options = {}) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
139
|
+
const current = readLlmConfig(cwd);
|
|
140
|
+
const detected = await detectLocalLlmProviders(current, options);
|
|
141
|
+
const { providers, removedProviderIds } = mergeDetectedProviders(
|
|
142
|
+
current.providers ?? [],
|
|
143
|
+
detected,
|
|
144
|
+
);
|
|
145
|
+
const next = { ...current, providers };
|
|
146
|
+
writeLlmConfig(cwd, next);
|
|
147
|
+
applyLlmConfigToPiSettings(cwd, next);
|
|
148
|
+
const ollama = detected.find((provider) => provider.id === OLLAMA_PROVIDER_ID) ?? null;
|
|
149
|
+
const lmstudio = detected.find((provider) => provider.id === LM_STUDIO_PROVIDER_ID) ?? null;
|
|
150
|
+
return {
|
|
151
|
+
config: next,
|
|
152
|
+
result: {
|
|
153
|
+
detected,
|
|
154
|
+
ollama,
|
|
155
|
+
lmstudio,
|
|
156
|
+
removedProviderIds,
|
|
157
|
+
},
|
|
158
|
+
};
|
|
171
159
|
}
|
|
172
|
-
//# sourceMappingURL=detect-local-llm-providers.js.map
|
|
160
|
+
//# sourceMappingURL=detect-local-llm-providers.js.map
|
|
@@ -4,17 +4,17 @@ export declare const KBS_SPECS_DIR = "specs";
|
|
|
4
4
|
export declare const KBS_PLANS_DIR = "plans";
|
|
5
5
|
export declare const KBS_CONTEXT_DIR = "context";
|
|
6
6
|
export type KbsProjectSettings = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
quietStartup?: boolean;
|
|
8
|
+
enableSkillCommands?: boolean;
|
|
9
|
+
workflow?: {
|
|
10
|
+
lastSpecSlug?: string;
|
|
11
|
+
lastPlanSlug?: string;
|
|
12
|
+
};
|
|
13
|
+
[key: string]: unknown;
|
|
14
14
|
};
|
|
15
15
|
/** Create `.kbs/specs`, `.kbs/plans`, `.kbs/context` (ART-003). */
|
|
16
16
|
export declare function ensureKbsProjectLayout(cwd: string): void;
|
|
17
17
|
export declare function resolveKbsProjectSettingsPath(cwd: string): string;
|
|
18
18
|
/** Merge KubbiSec defaults into `<cwd>/.kbs/settings.json` without removing user keys. */
|
|
19
19
|
export declare function ensureKbsProjectSettings(cwd?: string): string;
|
|
20
|
-
//# sourceMappingURL=ensure-kbs-project-settings.d.ts.map
|
|
20
|
+
//# sourceMappingURL=ensure-kbs-project-settings.d.ts.map
|
|
@@ -7,40 +7,39 @@ export const KBS_PLANS_DIR = "plans";
|
|
|
7
7
|
export const KBS_CONTEXT_DIR = "context";
|
|
8
8
|
/** Create `.kbs/specs`, `.kbs/plans`, `.kbs/context` (ART-003). */
|
|
9
9
|
export function ensureKbsProjectLayout(cwd) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const base = path.join(cwd, KBS_PROJECT_CONFIG_DIR);
|
|
11
|
+
for (const sub of [KBS_SPECS_DIR, KBS_PLANS_DIR, KBS_CONTEXT_DIR]) {
|
|
12
|
+
fs.mkdirSync(path.join(base, sub), { recursive: true, mode: 0o755 });
|
|
13
|
+
}
|
|
14
14
|
}
|
|
15
15
|
export function resolveKbsProjectSettingsPath(cwd) {
|
|
16
|
-
|
|
16
|
+
return path.join(cwd, KBS_PROJECT_CONFIG_DIR, KBS_PROJECT_SETTINGS_FILE);
|
|
17
17
|
}
|
|
18
18
|
function readExistingSettings(filePath) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
/* missing or invalid — start fresh */
|
|
19
|
+
try {
|
|
20
|
+
const raw = fs.readFileSync(filePath, "utf8");
|
|
21
|
+
const parsed = JSON.parse(raw);
|
|
22
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
23
|
+
return parsed;
|
|
28
24
|
}
|
|
29
|
-
|
|
25
|
+
} catch {
|
|
26
|
+
/* missing or invalid — start fresh */
|
|
27
|
+
}
|
|
28
|
+
return {};
|
|
30
29
|
}
|
|
31
30
|
/** Merge KubbiSec defaults into `<cwd>/.kbs/settings.json` without removing user keys. */
|
|
32
31
|
export function ensureKbsProjectSettings(cwd = process.cwd()) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
32
|
+
const dir = path.join(cwd, KBS_PROJECT_CONFIG_DIR);
|
|
33
|
+
const filePath = resolveKbsProjectSettingsPath(cwd);
|
|
34
|
+
fs.mkdirSync(dir, { recursive: true, mode: 0o755 });
|
|
35
|
+
ensureKbsProjectLayout(cwd);
|
|
36
|
+
const existing = readExistingSettings(filePath);
|
|
37
|
+
const merged = {
|
|
38
|
+
...existing,
|
|
39
|
+
quietStartup: true,
|
|
40
|
+
enableSkillCommands: false,
|
|
41
|
+
};
|
|
42
|
+
fs.writeFileSync(filePath, `${JSON.stringify(merged, null, 2)}\n`, "utf8");
|
|
43
|
+
return filePath;
|
|
45
44
|
}
|
|
46
|
-
//# sourceMappingURL=ensure-kbs-project-settings.js.map
|
|
45
|
+
//# sourceMappingURL=ensure-kbs-project-settings.js.map
|
|
@@ -7,14 +7,14 @@ export declare const KUBBISEC_PLANS_DIR = "plans";
|
|
|
7
7
|
export declare const KUBBISEC_CONTEXT_DIR = "context";
|
|
8
8
|
export declare const KUBBISEC_WORKTREES_DIR = "worktrees";
|
|
9
9
|
export type KubbisecProjectSettings = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
theme?: string;
|
|
11
|
+
quietStartup?: boolean;
|
|
12
|
+
enableSkillCommands?: boolean;
|
|
13
|
+
workflow?: {
|
|
14
|
+
lastSpecSlug?: string;
|
|
15
|
+
lastPlanSlug?: string;
|
|
16
|
+
};
|
|
17
|
+
[key: string]: unknown;
|
|
18
18
|
};
|
|
19
19
|
/** Create `.kubbisec/specs`, `.kubbisec/plans`, `.kubbisec/context` (ART-003). */
|
|
20
20
|
export declare function ensureKubbisecProjectLayout(cwd: string): void;
|
|
@@ -28,4 +28,4 @@ export declare function ensurePiProjectSettings(cwd?: string): string;
|
|
|
28
28
|
export declare function ensurePiProjectTheme(cwd?: string): string;
|
|
29
29
|
/** KubbiSec project settings used when starting the chat runtime. */
|
|
30
30
|
export declare function ensureKubbisecChatProjectSettings(cwd?: string): void;
|
|
31
|
-
//# sourceMappingURL=ensure-kubbisec-project-settings.d.ts.map
|
|
31
|
+
//# sourceMappingURL=ensure-kubbisec-project-settings.d.ts.map
|
|
@@ -11,97 +11,92 @@ export const KUBBISEC_PLANS_DIR = "plans";
|
|
|
11
11
|
export const KUBBISEC_CONTEXT_DIR = "context";
|
|
12
12
|
export const KUBBISEC_WORKTREES_DIR = "worktrees";
|
|
13
13
|
function migrateLegacyProjectConfigDir(cwd) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return;
|
|
20
|
-
fs.renameSync(legacy, next);
|
|
14
|
+
const legacy = path.join(cwd, ".kubbisec");
|
|
15
|
+
const next = path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR);
|
|
16
|
+
if (!pathExists(legacy)) return;
|
|
17
|
+
if (pathExists(next)) return;
|
|
18
|
+
fs.renameSync(legacy, next);
|
|
21
19
|
}
|
|
22
20
|
function pathExists(p) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
21
|
+
try {
|
|
22
|
+
fs.accessSync(p);
|
|
23
|
+
return true;
|
|
24
|
+
} catch {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
30
27
|
}
|
|
31
28
|
/** Create `.kubbisec/specs`, `.kubbisec/plans`, `.kubbisec/context` (ART-003). */
|
|
32
29
|
export function ensureKubbisecProjectLayout(cwd) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
const base = path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR);
|
|
31
|
+
for (const sub of [
|
|
32
|
+
KUBBISEC_SPECS_DIR,
|
|
33
|
+
KUBBISEC_PLANS_DIR,
|
|
34
|
+
KUBBISEC_CONTEXT_DIR,
|
|
35
|
+
KUBBISEC_WORKTREES_DIR,
|
|
36
|
+
]) {
|
|
37
|
+
fs.mkdirSync(path.join(base, sub), { recursive: true, mode: 0o755 });
|
|
38
|
+
}
|
|
42
39
|
}
|
|
43
40
|
export function resolveKubbisecProjectSettingsPath(cwd) {
|
|
44
|
-
|
|
41
|
+
return path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR, KUBBISEC_PROJECT_SETTINGS_FILE);
|
|
45
42
|
}
|
|
46
43
|
function readExistingSettings(filePath) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
catch {
|
|
55
|
-
/* missing or invalid — start fresh */
|
|
44
|
+
try {
|
|
45
|
+
const raw = fs.readFileSync(filePath, "utf8");
|
|
46
|
+
const parsed = JSON.parse(raw);
|
|
47
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
48
|
+
return parsed;
|
|
56
49
|
}
|
|
57
|
-
|
|
50
|
+
} catch {
|
|
51
|
+
/* missing or invalid — start fresh */
|
|
52
|
+
}
|
|
53
|
+
return {};
|
|
58
54
|
}
|
|
59
55
|
/** Merge KubbiSec defaults into `<cwd>/.kubbisec/settings.json` without removing user keys. */
|
|
60
56
|
export function ensureKubbisecProjectSettings(cwd = process.cwd()) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
57
|
+
migrateLegacyProjectConfigDir(cwd);
|
|
58
|
+
const dir = path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR);
|
|
59
|
+
const filePath = resolveKubbisecProjectSettingsPath(cwd);
|
|
60
|
+
fs.mkdirSync(dir, { recursive: true, mode: 0o755 });
|
|
61
|
+
ensureKubbisecProjectLayout(cwd);
|
|
62
|
+
const existing = readExistingSettings(filePath);
|
|
63
|
+
const merged = {
|
|
64
|
+
...existing,
|
|
65
|
+
theme: KUBBISEC_THEME_NAME,
|
|
66
|
+
quietStartup: true,
|
|
67
|
+
enableSkillCommands: false,
|
|
68
|
+
};
|
|
69
|
+
fs.writeFileSync(filePath, `${JSON.stringify(merged, null, 2)}\n`, "utf8");
|
|
70
|
+
ensureKubbisecGitignore(cwd);
|
|
71
|
+
return filePath;
|
|
76
72
|
}
|
|
77
73
|
export function ensureKubbisecGitignore(cwd) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
if (!content.includes(pattern)) {
|
|
86
|
-
const separator = content.length > 0 && !content.endsWith("\n") ? "\n" : "";
|
|
87
|
-
fs.appendFileSync(gitignorePath, `${separator}${pattern}\n`, "utf8");
|
|
88
|
-
}
|
|
74
|
+
const gitignorePath = path.join(cwd, ".gitignore");
|
|
75
|
+
const pattern = ".kubbisec/worktrees/";
|
|
76
|
+
try {
|
|
77
|
+
let content = "";
|
|
78
|
+
if (fs.existsSync(gitignorePath)) {
|
|
79
|
+
content = fs.readFileSync(gitignorePath, "utf8");
|
|
89
80
|
}
|
|
90
|
-
|
|
91
|
-
|
|
81
|
+
if (!content.includes(pattern)) {
|
|
82
|
+
const separator = content.length > 0 && !content.endsWith("\n") ? "\n" : "";
|
|
83
|
+
fs.appendFileSync(gitignorePath, `${separator}${pattern}\n`, "utf8");
|
|
92
84
|
}
|
|
85
|
+
} catch {
|
|
86
|
+
// ignore if gitignore cannot be updated
|
|
87
|
+
}
|
|
93
88
|
}
|
|
94
89
|
/** @deprecated Use ensureKubbisecProjectSettings */
|
|
95
90
|
export function ensurePiProjectSettings(cwd = process.cwd()) {
|
|
96
|
-
|
|
91
|
+
return ensureKubbisecProjectSettings(cwd);
|
|
97
92
|
}
|
|
98
93
|
/** @deprecated Use ensureKubbisecProjectSettings */
|
|
99
94
|
export function ensurePiProjectTheme(cwd = process.cwd()) {
|
|
100
|
-
|
|
95
|
+
return ensureKubbisecProjectSettings(cwd);
|
|
101
96
|
}
|
|
102
97
|
/** KubbiSec project settings used when starting the chat runtime. */
|
|
103
98
|
export function ensureKubbisecChatProjectSettings(cwd = process.cwd()) {
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
ensureKubbisecProjectSettings(cwd);
|
|
100
|
+
applyLlmConfigToAgentSettings(cwd);
|
|
106
101
|
}
|
|
107
|
-
//# sourceMappingURL=ensure-kubbisec-project-settings.js.map
|
|
102
|
+
//# sourceMappingURL=ensure-kubbisec-project-settings.js.map
|