@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.
Files changed (109) hide show
  1. package/bin/kubbisec +0 -0
  2. package/bundled/components/kubbisec-model-selector.d.ts +47 -34
  3. package/bundled/components/kubbisec-model-selector.js +187 -177
  4. package/bundled/config/config.d.ts +6 -6
  5. package/bundled/config/config.js +54 -52
  6. package/bundled/config/detect-local-llm-providers.d.ts +26 -16
  7. package/bundled/config/detect-local-llm-providers.js +130 -142
  8. package/bundled/config/ensure-kbs-project-settings.d.ts +8 -8
  9. package/bundled/config/ensure-kbs-project-settings.js +27 -28
  10. package/bundled/config/ensure-kubbisec-project-settings.d.ts +9 -9
  11. package/bundled/config/ensure-kubbisec-project-settings.js +62 -67
  12. package/bundled/config/extended-context.d.ts +5 -6
  13. package/bundled/config/extended-context.js +23 -22
  14. package/bundled/config/feature-flags.d.ts +10 -2
  15. package/bundled/config/feature-flags.js +8 -2
  16. package/bundled/config/format-kubbisec-footer-status.d.ts +1 -1
  17. package/bundled/config/format-kubbisec-footer-status.js +26 -31
  18. package/bundled/config/kubbisec-extension-manifest.d.ts +21 -2
  19. package/bundled/config/kubbisec-extension-manifest.js +19 -19
  20. package/bundled/config/llm-config-mutations.d.ts +51 -25
  21. package/bundled/config/llm-config-mutations.js +173 -182
  22. package/bundled/config/llm-config.d.ts +54 -41
  23. package/bundled/config/llm-config.js +199 -199
  24. package/bundled/config/llm-provider-catalog.d.ts +18 -15
  25. package/bundled/config/llm-provider-catalog.js +45 -46
  26. package/bundled/config/materialize-kubbisec-pi-resources.d.ts +1 -1
  27. package/bundled/config/materialize-kubbisec-pi-resources.js +173 -182
  28. package/bundled/config/register-custom-llm-providers.d.ts +11 -5
  29. package/bundled/config/register-custom-llm-providers.js +17 -15
  30. package/bundled/config/register-kubbisec-llm-provider.d.ts +14 -10
  31. package/bundled/config/register-kubbisec-llm-provider.js +50 -42
  32. package/bundled/config/resolve-agents-context-file.d.ts +1 -1
  33. package/bundled/config/resolve-agents-context-file.js +33 -34
  34. package/bundled/config/resource-budget.d.ts +12 -12
  35. package/bundled/config/resource-budget.js +28 -28
  36. package/bundled/config/sync-kubbisec-pi-models.d.ts +6 -3
  37. package/bundled/config/sync-kubbisec-pi-models.js +58 -58
  38. package/bundled/copy/cli-reference-index.d.ts +1 -1
  39. package/bundled/copy/cli-reference-index.js +1 -1
  40. package/bundled/copy/kubbisec-shell-copy.d.ts +11 -6
  41. package/bundled/copy/kubbisec-shell-copy.js +1 -1
  42. package/bundled/extensions/cli-local-shared.d.ts +56 -32
  43. package/bundled/extensions/cli-local-shared.js +135 -125
  44. package/bundled/extensions/kubbisec-aspm-local.extension.d.ts +18 -15
  45. package/bundled/extensions/kubbisec-aspm-local.extension.js +109 -106
  46. package/bundled/extensions/kubbisec-brand.extension.d.ts +1 -1
  47. package/bundled/extensions/kubbisec-brand.extension.js +25 -25
  48. package/bundled/extensions/kubbisec-byok-provider.extension.d.ts +1 -1
  49. package/bundled/extensions/kubbisec-byok-provider.extension.js +2 -2
  50. package/bundled/extensions/kubbisec-clarify.extension.d.ts +64 -35
  51. package/bundled/extensions/kubbisec-clarify.extension.js +323 -305
  52. package/bundled/extensions/kubbisec-exit.extension.d.ts +1 -1
  53. package/bundled/extensions/kubbisec-exit.extension.js +29 -32
  54. package/bundled/extensions/kubbisec-extended-context.extension.d.ts +1 -1
  55. package/bundled/extensions/kubbisec-extended-context.extension.js +56 -43
  56. package/bundled/extensions/kubbisec-footer.extension.d.ts +14 -14
  57. package/bundled/extensions/kubbisec-footer.extension.js +205 -215
  58. package/bundled/extensions/kubbisec-github-local.extension.d.ts +26 -18
  59. package/bundled/extensions/kubbisec-github-local.extension.js +430 -417
  60. package/bundled/extensions/kubbisec-llm-config.extension.d.ts +1 -1
  61. package/bundled/extensions/kubbisec-llm-config.extension.js +200 -181
  62. package/bundled/extensions/kubbisec-memory.extension.d.ts +9 -7
  63. package/bundled/extensions/kubbisec-memory.extension.js +88 -95
  64. package/bundled/extensions/kubbisec-naus-local.extension.d.ts +18 -15
  65. package/bundled/extensions/kubbisec-naus-local.extension.js +123 -103
  66. package/bundled/extensions/kubbisec-platform-tools.extension.d.ts +31 -21
  67. package/bundled/extensions/kubbisec-platform-tools.extension.js +152 -152
  68. package/bundled/extensions/kubbisec-runtime-status.extension.d.ts +10 -8
  69. package/bundled/extensions/kubbisec-runtime-status.extension.js +15 -13
  70. package/bundled/extensions/kubbisec-scope.extension.d.ts +12 -7
  71. package/bundled/extensions/kubbisec-scope.extension.js +13 -13
  72. package/bundled/extensions/kubbisec-skill-mentions.extension.d.ts +27 -16
  73. package/bundled/extensions/kubbisec-skill-mentions.extension.js +74 -64
  74. package/bundled/extensions/kubbisec-skill-telemetry.extension.d.ts +2 -3
  75. package/bundled/extensions/kubbisec-skill-telemetry.extension.js +59 -64
  76. package/bundled/extensions/kubbisec-theme-lock.extension.d.ts +1 -1
  77. package/bundled/extensions/kubbisec-theme-lock.extension.js +33 -34
  78. package/bundled/extensions/kubbisec-ui.extension.d.ts +1 -1
  79. package/bundled/extensions/kubbisec-ui.extension.js +90 -92
  80. package/bundled/extensions/kubbisec-workflow.extension.d.ts +20 -18
  81. package/bundled/extensions/kubbisec-workflow.extension.js +138 -140
  82. package/bundled/resolve-bundled-dist-root.js +121 -130
  83. package/bundled/skills/at-path-mentions.d.ts +1 -1
  84. package/bundled/skills/at-path-mentions.js +146 -153
  85. package/bundled/skills/chat-mention-render.d.ts +2 -2
  86. package/bundled/skills/chat-mention-render.js +121 -126
  87. package/bundled/skills/chat-mentions.d.ts +17 -8
  88. package/bundled/skills/chat-mentions.js +76 -76
  89. package/bundled/skills/list-bundled-skills.d.ts +3 -3
  90. package/bundled/skills/list-bundled-skills.js +33 -35
  91. package/bundled/skills/skill-mention.d.ts +10 -2
  92. package/bundled/skills/skill-mention.js +10 -2
  93. package/bundled/theme/clear-terminal.d.ts +1 -1
  94. package/bundled/theme/clear-terminal.js +3 -4
  95. package/bundled/theme/footer-render-hook.d.ts +1 -1
  96. package/bundled/theme/footer-render-hook.js +3 -3
  97. package/bundled/theme/kubbisec-brand-fg.d.ts +1 -1
  98. package/bundled/theme/kubbisec-brand-fg.js +2 -2
  99. package/bundled/theme/kubbisec-menu-themes.d.ts +7 -7
  100. package/bundled/theme/kubbisec-menu-themes.js +30 -31
  101. package/bundled/theme/kubbisec-theme-name.d.ts +1 -1
  102. package/bundled/theme/kubbisec-theme-name.js +1 -1
  103. package/bundled/theme/patch-pi-settings-theme.runtime.d.ts +1 -1
  104. package/bundled/theme/patch-pi-settings-theme.runtime.js +11 -10
  105. package/bundled/theme/render-compact-header.d.ts +13 -5
  106. package/bundled/theme/render-compact-header.js +126 -128
  107. package/bundled/workflow/session-workflow-mode.d.ts +1 -1
  108. package/bundled/workflow/session-workflow-mode.js +33 -33
  109. 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
- timeoutMs?: number;
10
- ollamaBaseUrl?: string;
11
- lmStudioBaseUrl?: string;
12
- detectOllama?: boolean;
13
- detectLmStudio?: boolean;
9
+ timeoutMs?: number;
10
+ ollamaBaseUrl?: string;
11
+ lmStudioBaseUrl?: string;
12
+ detectOllama?: boolean;
13
+ detectLmStudio?: boolean;
14
14
  };
15
15
  export type LocalLlmDetectResult = {
16
- detected: KubbisecCustomProviderDef[];
17
- ollama: KubbisecCustomProviderDef | null;
18
- lmstudio: KubbisecCustomProviderDef | null;
19
- removedProviderIds: string[];
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(options?: LocalLlmDetectOptions): Promise<KubbisecCustomProviderDef | null>;
26
- export declare function detectLmStudioProvider(options?: LocalLlmDetectOptions): Promise<KubbisecCustomProviderDef | null>;
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(config?: KubbisecLlmConfig, overrides?: LocalLlmDetectOptions): Promise<KubbisecCustomProviderDef[]>;
29
- export declare function syncAutodetectedLocalProviders(cwd?: string, options?: LocalLlmDetectOptions): Promise<{
30
- config: KubbisecLlmConfig;
31
- result: LocalLlmDetectResult;
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, } from "./llm-config.js";
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
- 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(/\/+$/, "");
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
- 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`;
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
- const lower = modelId.toLowerCase();
23
- return /(?:^|[-_/])(o1|o3|qwq|deepseek-r1|r1|reasoning|think)/.test(lower);
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
- 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(" ");
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
- 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)
42
- return null;
43
- return (await response.json());
44
- }
45
- catch {
46
- return null;
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
- const id = modelId.trim();
54
- return {
55
- id,
56
- name: formatLocalModelName(id),
57
- reasoning: inferLocalModelReasoning(id),
58
- contextWindow: 128_000,
59
- maxTokens: 8_192,
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
- if (options.detectOllama === false)
64
- return null;
65
- const host = (options.ollamaBaseUrl ?? resolveOllamaHost()).replace(/\/+$/, "");
66
- const timeoutMs = options.timeoutMs ?? 900;
67
- const tags = await fetchJson(`${host}/api/tags`, timeoutMs);
68
- const models = (tags?.models ?? [])
69
- .map((entry) => entry.name?.trim() || entry.model?.trim())
70
- .filter((name) => Boolean(name));
71
- if (models.length === 0)
72
- return null;
73
- const uniqueModels = [...new Set(models)].map(toLocalModelDef);
74
- return {
75
- id: OLLAMA_PROVIDER_ID,
76
- name: OLLAMA_PROVIDER_NAME,
77
- baseUrl: `${host}/v1`,
78
- apiKey: "ollama",
79
- api: "openai-completions",
80
- models: uniqueModels,
81
- autodetected: true,
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
- if (options.detectLmStudio === false)
87
- return null;
88
- const baseUrl = (options.lmStudioBaseUrl ?? resolveLmStudioOpenAiBase()).replace(/\/+$/, "");
89
- const timeoutMs = options.timeoutMs ?? 900;
90
- const listing = await fetchJson(`${baseUrl}/models`, timeoutMs);
91
- const models = (listing?.data ?? [])
92
- .map((entry) => entry.id?.trim())
93
- .filter((id) => Boolean(id));
94
- if (models.length === 0)
95
- return null;
96
- const uniqueModels = [...new Set(models)].map(toLocalModelDef);
97
- return {
98
- id: LM_STUDIO_PROVIDER_ID,
99
- name: LM_STUDIO_PROVIDER_NAME,
100
- baseUrl,
101
- apiKey: "lm-studio",
102
- api: "openai-completions",
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
- if (process.env.KUBBISEC_LLM_AUTODETECT === "0")
110
- return false;
111
- if (process.env.KUBBISEC_LLM_AUTODETECT === "1")
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
- if (!isLocalLlmAutodetectEnabled(config))
117
- return [];
118
- const local = config.localLlm;
119
- const timeoutMs = overrides.timeoutMs ?? 900;
120
- const [ollama, lmstudio] = await Promise.all([
121
- detectOllamaProvider({
122
- timeoutMs,
123
- ollamaBaseUrl: overrides.ollamaBaseUrl ?? local?.ollama?.baseUrl,
124
- detectOllama: local?.ollama?.enabled !== false && overrides.detectOllama !== false,
125
- }),
126
- detectLmStudioProvider({
127
- timeoutMs,
128
- lmStudioBaseUrl: overrides.lmStudioBaseUrl ?? local?.lmstudio?.baseUrl,
129
- detectLmStudio: local?.lmstudio?.enabled !== false && overrides.detectLmStudio !== false,
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
- const manual = current.filter((provider) => !provider.autodetected);
136
- const manualIds = new Set(manual.map((provider) => provider.id));
137
- const detectedIds = new Set(detected.map((provider) => provider.id));
138
- const removedProviderIds = current
139
- .filter((provider) => provider.autodetected && !detectedIds.has(provider.id))
140
- .map((provider) => provider.id);
141
- const next = [...manual];
142
- for (const provider of detected) {
143
- if (manualIds.has(provider.id))
144
- continue;
145
- const index = next.findIndex((entry) => entry.id === provider.id && entry.autodetected);
146
- if (index >= 0)
147
- next[index] = provider;
148
- else
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
- const current = readLlmConfig(cwd);
155
- const detected = await detectLocalLlmProviders(current, options);
156
- const { providers, removedProviderIds } = mergeDetectedProviders(current.providers ?? [], detected);
157
- const next = { ...current, providers };
158
- writeLlmConfig(cwd, next);
159
- applyLlmConfigToPiSettings(cwd, next);
160
- const ollama = detected.find((provider) => provider.id === OLLAMA_PROVIDER_ID) ?? null;
161
- const lmstudio = detected.find((provider) => provider.id === LM_STUDIO_PROVIDER_ID) ?? null;
162
- return {
163
- config: next,
164
- result: {
165
- detected,
166
- ollama,
167
- lmstudio,
168
- removedProviderIds,
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
- quietStartup?: boolean;
8
- enableSkillCommands?: boolean;
9
- workflow?: {
10
- lastSpecSlug?: string;
11
- lastPlanSlug?: string;
12
- };
13
- [key: string]: unknown;
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
- 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
- }
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
- return path.join(cwd, KBS_PROJECT_CONFIG_DIR, KBS_PROJECT_SETTINGS_FILE);
16
+ return path.join(cwd, KBS_PROJECT_CONFIG_DIR, KBS_PROJECT_SETTINGS_FILE);
17
17
  }
18
18
  function readExistingSettings(filePath) {
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;
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
- return {};
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
- const dir = path.join(cwd, KBS_PROJECT_CONFIG_DIR);
34
- const filePath = resolveKbsProjectSettingsPath(cwd);
35
- fs.mkdirSync(dir, { recursive: true, mode: 0o755 });
36
- ensureKbsProjectLayout(cwd);
37
- const existing = readExistingSettings(filePath);
38
- const merged = {
39
- ...existing,
40
- quietStartup: true,
41
- enableSkillCommands: false,
42
- };
43
- fs.writeFileSync(filePath, `${JSON.stringify(merged, null, 2)}\n`, "utf8");
44
- return filePath;
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
- theme?: string;
11
- quietStartup?: boolean;
12
- enableSkillCommands?: boolean;
13
- workflow?: {
14
- lastSpecSlug?: string;
15
- lastPlanSlug?: string;
16
- };
17
- [key: string]: unknown;
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
- const legacy = path.join(cwd, ".kubbisec");
15
- const next = path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR);
16
- if (!pathExists(legacy))
17
- return;
18
- if (pathExists(next))
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
- try {
24
- fs.accessSync(p);
25
- return true;
26
- }
27
- catch {
28
- return false;
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
- const base = path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR);
34
- for (const sub of [
35
- KUBBISEC_SPECS_DIR,
36
- KUBBISEC_PLANS_DIR,
37
- KUBBISEC_CONTEXT_DIR,
38
- KUBBISEC_WORKTREES_DIR,
39
- ]) {
40
- fs.mkdirSync(path.join(base, sub), { recursive: true, mode: 0o755 });
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
- return path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR, KUBBISEC_PROJECT_SETTINGS_FILE);
41
+ return path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR, KUBBISEC_PROJECT_SETTINGS_FILE);
45
42
  }
46
43
  function readExistingSettings(filePath) {
47
- try {
48
- const raw = fs.readFileSync(filePath, "utf8");
49
- const parsed = JSON.parse(raw);
50
- if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
51
- return parsed;
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
- return {};
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
- migrateLegacyProjectConfigDir(cwd);
62
- const dir = path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR);
63
- const filePath = resolveKubbisecProjectSettingsPath(cwd);
64
- fs.mkdirSync(dir, { recursive: true, mode: 0o755 });
65
- ensureKubbisecProjectLayout(cwd);
66
- const existing = readExistingSettings(filePath);
67
- const merged = {
68
- ...existing,
69
- theme: KUBBISEC_THEME_NAME,
70
- quietStartup: true,
71
- enableSkillCommands: false,
72
- };
73
- fs.writeFileSync(filePath, `${JSON.stringify(merged, null, 2)}\n`, "utf8");
74
- ensureKubbisecGitignore(cwd);
75
- return filePath;
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
- const gitignorePath = path.join(cwd, ".gitignore");
79
- const pattern = ".kubbisec/worktrees/";
80
- try {
81
- let content = "";
82
- if (fs.existsSync(gitignorePath)) {
83
- content = fs.readFileSync(gitignorePath, "utf8");
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
- catch {
91
- // ignore if gitignore cannot be updated
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
- return ensureKubbisecProjectSettings(cwd);
91
+ return ensureKubbisecProjectSettings(cwd);
97
92
  }
98
93
  /** @deprecated Use ensureKubbisecProjectSettings */
99
94
  export function ensurePiProjectTheme(cwd = process.cwd()) {
100
- return ensureKubbisecProjectSettings(cwd);
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
- ensureKubbisecProjectSettings(cwd);
105
- applyLlmConfigToAgentSettings(cwd);
99
+ ensureKubbisecProjectSettings(cwd);
100
+ applyLlmConfigToAgentSettings(cwd);
106
101
  }
107
- //# sourceMappingURL=ensure-kubbisec-project-settings.js.map
102
+ //# sourceMappingURL=ensure-kubbisec-project-settings.js.map