@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.
Files changed (131) hide show
  1. package/bin/kubbisec +0 -0
  2. package/bundled/clarify/clarify-gate-state.d.ts +1 -1
  3. package/bundled/clarify/clarify-gate-state.js +3 -3
  4. package/bundled/clarify/clarify-gate.d.ts +21 -14
  5. package/bundled/clarify/clarify-gate.js +118 -111
  6. package/bundled/clarify/clarify-select-panel.d.ts +16 -9
  7. package/bundled/clarify/clarify-select-panel.js +65 -67
  8. package/bundled/clarify/clarify-ui-state.d.ts +12 -10
  9. package/bundled/clarify/clarify-ui-state.js +26 -26
  10. package/bundled/clarify/parse-clarify-answer.d.ts +29 -18
  11. package/bundled/clarify/parse-clarify-answer.js +39 -45
  12. package/bundled/clarify/question-format.d.ts +34 -23
  13. package/bundled/clarify/question-format.js +112 -119
  14. package/bundled/clarify/questionnaire-tool.d.ts +28 -17
  15. package/bundled/clarify/questionnaire-tool.js +180 -144
  16. package/bundled/clarify/scope-discovery.d.ts +8 -5
  17. package/bundled/clarify/scope-discovery.js +102 -110
  18. package/bundled/clarify/session-questionnaire.d.ts +48 -13
  19. package/bundled/clarify/session-questionnaire.js +304 -312
  20. package/bundled/clarify/session-questionnaire.types.d.ts +29 -27
  21. package/bundled/clarify/session-questionnaire.types.js +10 -10
  22. package/bundled/components/kubbisec-model-selector.d.ts +47 -34
  23. package/bundled/components/kubbisec-model-selector.js +187 -177
  24. package/bundled/config/config.d.ts +6 -6
  25. package/bundled/config/config.js +55 -55
  26. package/bundled/config/detect-local-llm-providers.d.ts +26 -16
  27. package/bundled/config/detect-local-llm-providers.js +130 -142
  28. package/bundled/config/ensure-kubbisec-project-settings.d.ts +9 -9
  29. package/bundled/config/ensure-kubbisec-project-settings.js +44 -48
  30. package/bundled/config/extended-context.d.ts +5 -6
  31. package/bundled/config/extended-context.js +23 -22
  32. package/bundled/config/feature-flags.d.ts +10 -2
  33. package/bundled/config/feature-flags.js +8 -2
  34. package/bundled/config/format-kubbisec-footer-status.d.ts +1 -1
  35. package/bundled/config/format-kubbisec-footer-status.js +26 -31
  36. package/bundled/config/kubbisec-extension-manifest.d.ts +22 -2
  37. package/bundled/config/kubbisec-extension-manifest.js +20 -20
  38. package/bundled/config/llm-config-mutations.d.ts +51 -25
  39. package/bundled/config/llm-config-mutations.js +173 -182
  40. package/bundled/config/llm-config.d.ts +54 -41
  41. package/bundled/config/llm-config.js +199 -199
  42. package/bundled/config/llm-provider-catalog.d.ts +18 -15
  43. package/bundled/config/llm-provider-catalog.js +45 -46
  44. package/bundled/config/materialize-kubbisec-pi-resources.d.ts +1 -1
  45. package/bundled/config/materialize-kubbisec-pi-resources.js +174 -183
  46. package/bundled/config/register-custom-llm-providers.d.ts +11 -5
  47. package/bundled/config/register-custom-llm-providers.js +17 -15
  48. package/bundled/config/register-kubbisec-llm-provider.d.ts +14 -10
  49. package/bundled/config/register-kubbisec-llm-provider.js +50 -42
  50. package/bundled/config/resolve-agents-context-file.d.ts +1 -1
  51. package/bundled/config/resolve-agents-context-file.js +33 -34
  52. package/bundled/config/resource-budget.d.ts +12 -12
  53. package/bundled/config/resource-budget.js +28 -28
  54. package/bundled/config/sync-kubbisec-pi-models.d.ts +6 -3
  55. package/bundled/config/sync-kubbisec-pi-models.js +58 -58
  56. package/bundled/copy/cli-reference-index.d.ts +3 -2
  57. package/bundled/copy/cli-reference-index.js +1 -1
  58. package/bundled/copy/kubbisec-shell-copy.d.ts +11 -6
  59. package/bundled/copy/kubbisec-shell-copy.js +1 -1
  60. package/bundled/extensions/cli-local-shared.d.ts +45 -26
  61. package/bundled/extensions/cli-local-shared.js +128 -118
  62. package/bundled/extensions/kubbisec-aspm-local.extension.d.ts +18 -15
  63. package/bundled/extensions/kubbisec-aspm-local.extension.js +118 -114
  64. package/bundled/extensions/kubbisec-brand.extension.d.ts +1 -1
  65. package/bundled/extensions/kubbisec-brand.extension.js +25 -25
  66. package/bundled/extensions/kubbisec-byok-provider.extension.d.ts +1 -1
  67. package/bundled/extensions/kubbisec-byok-provider.extension.js +2 -2
  68. package/bundled/extensions/kubbisec-clarify.extension.d.ts +64 -35
  69. package/bundled/extensions/kubbisec-clarify.extension.js +323 -305
  70. package/bundled/extensions/kubbisec-exit.extension.d.ts +1 -1
  71. package/bundled/extensions/kubbisec-exit.extension.js +29 -32
  72. package/bundled/extensions/kubbisec-extended-context.extension.d.ts +1 -1
  73. package/bundled/extensions/kubbisec-extended-context.extension.js +56 -43
  74. package/bundled/extensions/kubbisec-footer.extension.d.ts +14 -14
  75. package/bundled/extensions/kubbisec-footer.extension.js +205 -215
  76. package/bundled/extensions/kubbisec-github-local.extension.d.ts +26 -18
  77. package/bundled/extensions/kubbisec-github-local.extension.js +123 -116
  78. package/bundled/extensions/kubbisec-llm-config.extension.d.ts +1 -1
  79. package/bundled/extensions/kubbisec-llm-config.extension.js +200 -181
  80. package/bundled/extensions/kubbisec-memory.extension.d.ts +9 -7
  81. package/bundled/extensions/kubbisec-memory.extension.js +88 -95
  82. package/bundled/extensions/kubbisec-naus-local.extension.d.ts +18 -15
  83. package/bundled/extensions/kubbisec-naus-local.extension.js +132 -111
  84. package/bundled/extensions/kubbisec-platform-tools.extension.d.ts +31 -21
  85. package/bundled/extensions/kubbisec-platform-tools.extension.js +152 -152
  86. package/bundled/extensions/kubbisec-runtime-status.extension.d.ts +10 -8
  87. package/bundled/extensions/kubbisec-runtime-status.extension.js +15 -13
  88. package/bundled/extensions/kubbisec-scope.extension.d.ts +12 -7
  89. package/bundled/extensions/kubbisec-scope.extension.js +13 -13
  90. package/bundled/extensions/kubbisec-skill-mentions.extension.d.ts +27 -16
  91. package/bundled/extensions/kubbisec-skill-mentions.extension.js +73 -63
  92. package/bundled/extensions/kubbisec-skill-telemetry.extension.d.ts +2 -3
  93. package/bundled/extensions/kubbisec-skill-telemetry.extension.js +59 -64
  94. package/bundled/extensions/kubbisec-theme-lock.extension.d.ts +1 -1
  95. package/bundled/extensions/kubbisec-theme-lock.extension.js +33 -34
  96. package/bundled/extensions/kubbisec-ui.extension.d.ts +1 -1
  97. package/bundled/extensions/kubbisec-ui.extension.js +114 -109
  98. package/bundled/extensions/kubbisec-workflow.extension.d.ts +20 -18
  99. package/bundled/extensions/kubbisec-workflow.extension.js +138 -140
  100. package/bundled/node_modules/@aspm/shared/dist/redaction.test.d.ts +2 -0
  101. package/bundled/node_modules/@aspm/shared/dist/redaction.test.d.ts.map +1 -0
  102. package/bundled/node_modules/@aspm/shared/dist/redaction.test.js +626 -0
  103. package/bundled/node_modules/@aspm/shared/dist/redaction.test.js.map +1 -0
  104. package/bundled/resolve-bundled-dist-root.js +122 -131
  105. package/bundled/skills/at-path-mentions.d.ts +1 -1
  106. package/bundled/skills/at-path-mentions.js +146 -153
  107. package/bundled/skills/chat-mention-render.d.ts +2 -2
  108. package/bundled/skills/chat-mention-render.js +121 -126
  109. package/bundled/skills/chat-mentions.d.ts +17 -8
  110. package/bundled/skills/chat-mentions.js +76 -76
  111. package/bundled/skills/list-bundled-skills.d.ts +3 -3
  112. package/bundled/skills/list-bundled-skills.js +33 -35
  113. package/bundled/skills/skill-mention.d.ts +10 -2
  114. package/bundled/skills/skill-mention.js +10 -2
  115. package/bundled/theme/clear-terminal.d.ts +1 -1
  116. package/bundled/theme/clear-terminal.js +3 -4
  117. package/bundled/theme/footer-render-hook.d.ts +1 -1
  118. package/bundled/theme/footer-render-hook.js +3 -3
  119. package/bundled/theme/kubbisec-brand-fg.d.ts +1 -1
  120. package/bundled/theme/kubbisec-brand-fg.js +2 -2
  121. package/bundled/theme/kubbisec-menu-themes.d.ts +7 -7
  122. package/bundled/theme/kubbisec-menu-themes.js +30 -31
  123. package/bundled/theme/kubbisec-theme-name.d.ts +1 -1
  124. package/bundled/theme/kubbisec-theme-name.js +1 -1
  125. package/bundled/theme/patch-pi-settings-theme.runtime.d.ts +1 -1
  126. package/bundled/theme/patch-pi-settings-theme.runtime.js +11 -10
  127. package/bundled/theme/render-compact-header.d.ts +13 -5
  128. package/bundled/theme/render-compact-header.js +127 -129
  129. package/bundled/workflow/session-workflow-mode.d.ts +1 -1
  130. package/bundled/workflow/session-workflow-mode.js +33 -33
  131. package/package.json +1 -1
@@ -1,207 +1,198 @@
1
- import { applyLlmConfigToPiSettings, readLlmConfig, resolveApiKeyValue, resolveLlmConfigPath, writeLlmConfig, } from "./llm-config.js";
2
- import { KUBBISEC_LLM_PROVIDER_ID, KUBBISEC_LLM_PROVIDER_NAME, mergeKubbisecModelCatalog, } from "./llm-provider-catalog.js";
3
- const THINKING_LEVELS = new Set([
4
- "off",
5
- "minimal",
6
- "low",
7
- "medium",
8
- "high",
9
- "xhigh",
10
- ]);
1
+ import {
2
+ applyLlmConfigToPiSettings,
3
+ readLlmConfig,
4
+ resolveApiKeyValue,
5
+ resolveLlmConfigPath,
6
+ writeLlmConfig,
7
+ } from "./llm-config.js";
8
+ import {
9
+ KUBBISEC_LLM_PROVIDER_ID,
10
+ KUBBISEC_LLM_PROVIDER_NAME,
11
+ mergeKubbisecModelCatalog,
12
+ } from "./llm-provider-catalog.js";
13
+
14
+ const THINKING_LEVELS = new Set(["off", "minimal", "low", "medium", "high", "xhigh"]);
11
15
  export function isKubbisecThinkingLevel(value) {
12
- return THINKING_LEVELS.has(value);
16
+ return THINKING_LEVELS.has(value);
13
17
  }
14
18
  export function maskApiKeyHint(apiKey) {
15
- const raw = apiKey?.trim();
16
- if (!raw)
17
- return undefined;
18
- if (/^[A-Z][A-Z0-9_]*$/.test(raw))
19
- return `env:${raw}`;
20
- if (raw.length <= 8)
21
- return "••••";
22
- return `${raw.slice(0, 4)}…${raw.slice(-4)}`;
19
+ const raw = apiKey?.trim();
20
+ if (!raw) return undefined;
21
+ if (/^[A-Z][A-Z0-9_]*$/.test(raw)) return `env:${raw}`;
22
+ if (raw.length <= 8) return "••••";
23
+ return `${raw.slice(0, 4)}…${raw.slice(-4)}`;
23
24
  }
24
25
  export function parseModelSpec(spec) {
25
- const trimmed = spec.trim();
26
- if (!trimmed)
27
- throw new Error("Model spec cannot be empty");
28
- const [idPart, namePart, flag] = trimmed.split(":").map((part) => part.trim());
29
- const id = idPart?.trim();
30
- if (!id)
31
- throw new Error(`Invalid model spec: ${spec}`);
32
- const reasoning = flag === "reasoning" || flag === "true";
33
- return {
34
- id,
35
- ...(namePart ? { name: namePart } : {}),
36
- ...(reasoning ? { reasoning: true } : {}),
37
- };
26
+ const trimmed = spec.trim();
27
+ if (!trimmed) throw new Error("Model spec cannot be empty");
28
+ const [idPart, namePart, flag] = trimmed.split(":").map((part) => part.trim());
29
+ const id = idPart?.trim();
30
+ if (!id) throw new Error(`Invalid model spec: ${spec}`);
31
+ const reasoning = flag === "reasoning" || flag === "true";
32
+ return {
33
+ id,
34
+ ...(namePart ? { name: namePart } : {}),
35
+ ...(reasoning ? { reasoning: true } : {}),
36
+ };
38
37
  }
39
38
  function findCustomProvider(config, providerId) {
40
- return config.providers?.find((provider) => provider.id === providerId);
39
+ return config.providers?.find((provider) => provider.id === providerId);
41
40
  }
42
41
  function persistLlmConfig(cwd, config) {
43
- writeLlmConfig(cwd, config);
44
- applyLlmConfigToPiSettings(cwd, config);
45
- return config;
42
+ writeLlmConfig(cwd, config);
43
+ applyLlmConfigToPiSettings(cwd, config);
44
+ return config;
46
45
  }
47
46
  export function setLlmDefaults(cwd, options) {
48
- const current = readLlmConfig(cwd);
49
- const next = { ...current };
50
- if (options.provider?.trim())
51
- next.defaultProvider = options.provider.trim();
52
- if (options.model?.trim())
53
- next.defaultModel = options.model.trim();
54
- if (options.thinking)
55
- next.defaultThinkingLevel = options.thinking;
56
- if (options.temperature != null && Number.isFinite(options.temperature)) {
57
- next.temperature = Math.min(2, Math.max(0, options.temperature));
58
- }
59
- return persistLlmConfig(cwd, next);
47
+ const current = readLlmConfig(cwd);
48
+ const next = { ...current };
49
+ if (options.provider?.trim()) next.defaultProvider = options.provider.trim();
50
+ if (options.model?.trim()) next.defaultModel = options.model.trim();
51
+ if (options.thinking) next.defaultThinkingLevel = options.thinking;
52
+ if (options.temperature != null && Number.isFinite(options.temperature)) {
53
+ next.temperature = Math.min(2, Math.max(0, options.temperature));
54
+ }
55
+ return persistLlmConfig(cwd, next);
60
56
  }
61
57
  export function addCustomProvider(cwd, input) {
62
- const id = input.id.trim();
63
- if (!id)
64
- throw new Error("Provider id is required");
65
- if (id === KUBBISEC_LLM_PROVIDER_ID) {
66
- throw new Error(`Provider "${KUBBISEC_LLM_PROVIDER_ID}" is managed by KubbiSec BYOK. Use "kubbisec llm model add --provider kubbisec".`);
67
- }
68
- if (!input.baseUrl.trim())
69
- throw new Error("Provider baseUrl is required");
70
- if (!input.models.length)
71
- throw new Error("At least one model is required");
72
- const current = readLlmConfig(cwd);
73
- const providers = [...(current.providers ?? [])];
74
- const existingIndex = providers.findIndex((provider) => provider.id === id);
75
- const normalized = {
76
- ...input,
77
- id,
78
- baseUrl: input.baseUrl.trim(),
79
- models: input.models.map((model) => ({ ...model, id: model.id.trim() })),
80
- };
81
- if (existingIndex >= 0) {
82
- providers[existingIndex] = { ...providers[existingIndex], ...normalized };
83
- }
84
- else {
85
- providers.push(normalized);
86
- }
87
- return persistLlmConfig(cwd, { ...current, providers });
58
+ const id = input.id.trim();
59
+ if (!id) throw new Error("Provider id is required");
60
+ if (id === KUBBISEC_LLM_PROVIDER_ID) {
61
+ throw new Error(
62
+ `Provider "${KUBBISEC_LLM_PROVIDER_ID}" is managed by KubbiSec BYOK. Use "kubbisec llm model add --provider kubbisec".`,
63
+ );
64
+ }
65
+ if (!input.baseUrl.trim()) throw new Error("Provider baseUrl is required");
66
+ if (!input.models.length) throw new Error("At least one model is required");
67
+ const current = readLlmConfig(cwd);
68
+ const providers = [...(current.providers ?? [])];
69
+ const existingIndex = providers.findIndex((provider) => provider.id === id);
70
+ const normalized = {
71
+ ...input,
72
+ id,
73
+ baseUrl: input.baseUrl.trim(),
74
+ models: input.models.map((model) => ({ ...model, id: model.id.trim() })),
75
+ };
76
+ if (existingIndex >= 0) {
77
+ providers[existingIndex] = { ...providers[existingIndex], ...normalized };
78
+ } else {
79
+ providers.push(normalized);
80
+ }
81
+ return persistLlmConfig(cwd, { ...current, providers });
88
82
  }
89
83
  export function updateCustomProvider(cwd, providerId, patch) {
90
- const id = providerId.trim();
91
- if (id === KUBBISEC_LLM_PROVIDER_ID) {
92
- throw new Error(`Provider "${KUBBISEC_LLM_PROVIDER_ID}" cannot be updated via CLI.`);
93
- }
94
- const current = readLlmConfig(cwd);
95
- const providers = [...(current.providers ?? [])];
96
- const index = providers.findIndex((provider) => provider.id === id);
97
- if (index < 0)
98
- throw new Error(`Provider not found: ${id}`);
99
- const existing = providers[index];
100
- providers[index] = {
101
- ...existing,
102
- ...(patch.name !== undefined ? { name: patch.name } : {}),
103
- ...(patch.baseUrl !== undefined ? { baseUrl: patch.baseUrl.trim() } : {}),
104
- ...(patch.apiKey !== undefined ? { apiKey: patch.apiKey } : {}),
105
- ...(patch.api !== undefined ? { api: patch.api } : {}),
106
- ...(patch.headers !== undefined ? { headers: patch.headers } : {}),
107
- ...(patch.models !== undefined ? { models: patch.models } : {}),
108
- };
109
- return persistLlmConfig(cwd, { ...current, providers });
84
+ const id = providerId.trim();
85
+ if (id === KUBBISEC_LLM_PROVIDER_ID) {
86
+ throw new Error(`Provider "${KUBBISEC_LLM_PROVIDER_ID}" cannot be updated via CLI.`);
87
+ }
88
+ const current = readLlmConfig(cwd);
89
+ const providers = [...(current.providers ?? [])];
90
+ const index = providers.findIndex((provider) => provider.id === id);
91
+ if (index < 0) throw new Error(`Provider not found: ${id}`);
92
+ const existing = providers[index];
93
+ providers[index] = {
94
+ ...existing,
95
+ ...(patch.name !== undefined ? { name: patch.name } : {}),
96
+ ...(patch.baseUrl !== undefined ? { baseUrl: patch.baseUrl.trim() } : {}),
97
+ ...(patch.apiKey !== undefined ? { apiKey: patch.apiKey } : {}),
98
+ ...(patch.api !== undefined ? { api: patch.api } : {}),
99
+ ...(patch.headers !== undefined ? { headers: patch.headers } : {}),
100
+ ...(patch.models !== undefined ? { models: patch.models } : {}),
101
+ };
102
+ return persistLlmConfig(cwd, { ...current, providers });
110
103
  }
111
104
  export function removeCustomProvider(cwd, providerId) {
112
- const id = providerId.trim();
113
- if (id === KUBBISEC_LLM_PROVIDER_ID) {
114
- throw new Error(`Provider "${KUBBISEC_LLM_PROVIDER_ID}" cannot be removed.`);
115
- }
116
- const current = readLlmConfig(cwd);
117
- const providers = (current.providers ?? []).filter((provider) => provider.id !== id);
118
- if (providers.length === (current.providers ?? []).length) {
119
- throw new Error(`Provider not found: ${id}`);
120
- }
121
- const next = { ...current, providers };
122
- if (current.defaultProvider === id) {
123
- next.defaultProvider = KUBBISEC_LLM_PROVIDER_ID;
124
- }
125
- return persistLlmConfig(cwd, next);
105
+ const id = providerId.trim();
106
+ if (id === KUBBISEC_LLM_PROVIDER_ID) {
107
+ throw new Error(`Provider "${KUBBISEC_LLM_PROVIDER_ID}" cannot be removed.`);
108
+ }
109
+ const current = readLlmConfig(cwd);
110
+ const providers = (current.providers ?? []).filter((provider) => provider.id !== id);
111
+ if (providers.length === (current.providers ?? []).length) {
112
+ throw new Error(`Provider not found: ${id}`);
113
+ }
114
+ const next = { ...current, providers };
115
+ if (current.defaultProvider === id) {
116
+ next.defaultProvider = KUBBISEC_LLM_PROVIDER_ID;
117
+ }
118
+ return persistLlmConfig(cwd, next);
126
119
  }
127
120
  export function addLlmModel(cwd, providerId, model) {
128
- const id = providerId.trim();
129
- const modelId = model.id.trim();
130
- if (!modelId)
131
- throw new Error("Model id is required");
132
- const current = readLlmConfig(cwd);
133
- if (id === KUBBISEC_LLM_PROVIDER_ID) {
134
- const models = mergeKubbisecModelCatalog(current.defaultModel, [
135
- ...(current.kubbisec?.models ?? []),
136
- model,
137
- ]);
138
- return persistLlmConfig(cwd, {
139
- ...current,
140
- kubbisec: { models },
141
- });
142
- }
143
- const provider = findCustomProvider(current, id);
144
- if (!provider)
145
- throw new Error(`Provider not found: ${id}`);
146
- const models = [...provider.models.filter((entry) => entry.id !== modelId), model];
147
- return updateCustomProvider(cwd, id, { models });
121
+ const id = providerId.trim();
122
+ const modelId = model.id.trim();
123
+ if (!modelId) throw new Error("Model id is required");
124
+ const current = readLlmConfig(cwd);
125
+ if (id === KUBBISEC_LLM_PROVIDER_ID) {
126
+ const models = mergeKubbisecModelCatalog(current.defaultModel, [
127
+ ...(current.kubbisec?.models ?? []),
128
+ model,
129
+ ]);
130
+ return persistLlmConfig(cwd, {
131
+ ...current,
132
+ kubbisec: { models },
133
+ });
134
+ }
135
+ const provider = findCustomProvider(current, id);
136
+ if (!provider) throw new Error(`Provider not found: ${id}`);
137
+ const models = [...provider.models.filter((entry) => entry.id !== modelId), model];
138
+ return updateCustomProvider(cwd, id, { models });
148
139
  }
149
140
  export function removeLlmModel(cwd, providerId, modelId) {
150
- const provider = providerId.trim();
151
- const id = modelId.trim();
152
- const current = readLlmConfig(cwd);
153
- if (provider === KUBBISEC_LLM_PROVIDER_ID) {
154
- const models = (current.kubbisec?.models ?? []).filter((entry) => entry.id !== id);
155
- if (models.length === (current.kubbisec?.models ?? []).length) {
156
- throw new Error(`Model not found: ${KUBBISEC_LLM_PROVIDER_ID}/${id}`);
157
- }
158
- return persistLlmConfig(cwd, {
159
- ...current,
160
- kubbisec: { models },
161
- });
162
- }
163
- const custom = findCustomProvider(current, provider);
164
- if (!custom)
165
- throw new Error(`Provider not found: ${provider}`);
166
- const models = custom.models.filter((entry) => entry.id !== id);
167
- if (models.length === custom.models.length) {
168
- throw new Error(`Model not found: ${provider}/${id}`);
169
- }
170
- if (models.length === 0) {
171
- throw new Error("Cannot remove the last model. Remove the provider instead.");
141
+ const provider = providerId.trim();
142
+ const id = modelId.trim();
143
+ const current = readLlmConfig(cwd);
144
+ if (provider === KUBBISEC_LLM_PROVIDER_ID) {
145
+ const models = (current.kubbisec?.models ?? []).filter((entry) => entry.id !== id);
146
+ if (models.length === (current.kubbisec?.models ?? []).length) {
147
+ throw new Error(`Model not found: ${KUBBISEC_LLM_PROVIDER_ID}/${id}`);
172
148
  }
173
- return updateCustomProvider(cwd, provider, { models });
149
+ return persistLlmConfig(cwd, {
150
+ ...current,
151
+ kubbisec: { models },
152
+ });
153
+ }
154
+ const custom = findCustomProvider(current, provider);
155
+ if (!custom) throw new Error(`Provider not found: ${provider}`);
156
+ const models = custom.models.filter((entry) => entry.id !== id);
157
+ if (models.length === custom.models.length) {
158
+ throw new Error(`Model not found: ${provider}/${id}`);
159
+ }
160
+ if (models.length === 0) {
161
+ throw new Error("Cannot remove the last model. Remove the provider instead.");
162
+ }
163
+ return updateCustomProvider(cwd, provider, { models });
174
164
  }
175
165
  export function summarizeLlmConfig(cwd = process.cwd(), config = readLlmConfig(cwd)) {
176
- const kubbisecModels = mergeKubbisecModelCatalog(config.defaultModel, config.kubbisec?.models);
177
- const providers = [
178
- {
179
- id: KUBBISEC_LLM_PROVIDER_ID,
180
- name: KUBBISEC_LLM_PROVIDER_NAME,
181
- apiKeyConfigured: true,
182
- apiKeyHint: "org BYOK proxy",
183
- models: kubbisecModels,
184
- builtin: true,
185
- },
186
- ...(config.providers ?? []).map((provider) => ({
187
- id: provider.id,
188
- name: provider.name?.trim() || provider.id,
189
- baseUrl: provider.baseUrl,
190
- api: provider.api,
191
- apiKeyConfigured: provider.autodetected === true || Boolean(resolveApiKeyValue(provider.apiKey)),
192
- apiKeyHint: provider.autodetected ? "local server" : maskApiKeyHint(provider.apiKey),
193
- models: provider.models,
194
- builtin: false,
195
- autodetected: provider.autodetected === true,
196
- })),
197
- ];
198
- return {
199
- path: resolveLlmConfigPath(cwd),
200
- defaultProvider: config.defaultProvider ?? KUBBISEC_LLM_PROVIDER_ID,
201
- defaultModel: config.defaultModel,
202
- defaultThinkingLevel: config.defaultThinkingLevel,
203
- temperature: config.temperature,
204
- providers,
205
- };
166
+ const kubbisecModels = mergeKubbisecModelCatalog(config.defaultModel, config.kubbisec?.models);
167
+ const providers = [
168
+ {
169
+ id: KUBBISEC_LLM_PROVIDER_ID,
170
+ name: KUBBISEC_LLM_PROVIDER_NAME,
171
+ apiKeyConfigured: true,
172
+ apiKeyHint: "org BYOK proxy",
173
+ models: kubbisecModels,
174
+ builtin: true,
175
+ },
176
+ ...(config.providers ?? []).map((provider) => ({
177
+ id: provider.id,
178
+ name: provider.name?.trim() || provider.id,
179
+ baseUrl: provider.baseUrl,
180
+ api: provider.api,
181
+ apiKeyConfigured:
182
+ provider.autodetected === true || Boolean(resolveApiKeyValue(provider.apiKey)),
183
+ apiKeyHint: provider.autodetected ? "local server" : maskApiKeyHint(provider.apiKey),
184
+ models: provider.models,
185
+ builtin: false,
186
+ autodetected: provider.autodetected === true,
187
+ })),
188
+ ];
189
+ return {
190
+ path: resolveLlmConfigPath(cwd),
191
+ defaultProvider: config.defaultProvider ?? KUBBISEC_LLM_PROVIDER_ID,
192
+ defaultModel: config.defaultModel,
193
+ defaultThinkingLevel: config.defaultThinkingLevel,
194
+ temperature: config.temperature,
195
+ providers,
196
+ };
206
197
  }
207
- //# sourceMappingURL=llm-config-mutations.js.map
198
+ //# sourceMappingURL=llm-config-mutations.js.map
@@ -1,66 +1,79 @@
1
1
  export type KubbisecThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh";
2
2
  export type KubbisecLlmModelDef = {
3
- id: string;
4
- name?: string;
5
- reasoning?: boolean;
6
- contextWindow?: number;
7
- maxTokens?: number;
3
+ id: string;
4
+ name?: string;
5
+ reasoning?: boolean;
6
+ contextWindow?: number;
7
+ maxTokens?: number;
8
8
  };
9
9
  export type KubbisecLocalLlmDetectConfig = {
10
- /** Default true — set false to skip Ollama / LM Studio probing. */
11
- autoDetect?: boolean;
12
- ollama?: {
13
- enabled?: boolean;
14
- baseUrl?: string;
15
- };
16
- lmstudio?: {
17
- enabled?: boolean;
18
- baseUrl?: string;
19
- };
10
+ /** Default true — set false to skip Ollama / LM Studio probing. */
11
+ autoDetect?: boolean;
12
+ ollama?: {
13
+ enabled?: boolean;
14
+ baseUrl?: string;
15
+ };
16
+ lmstudio?: {
17
+ enabled?: boolean;
18
+ baseUrl?: string;
19
+ };
20
20
  };
21
21
  export type KubbisecCustomProviderDef = {
22
- id: string;
23
- name?: string;
24
- baseUrl: string;
25
- /** Literal key or env var name (e.g. OPENROUTER_API_KEY). */
26
- apiKey?: string;
27
- api?: "openai-completions" | "openai-responses" | "anthropic-messages";
28
- models: KubbisecLlmModelDef[];
29
- headers?: Record<string, string>;
30
- /** Set when discovered via local server autodetect. */
31
- autodetected?: boolean;
32
- detectSource?: "ollama" | "lmstudio";
22
+ id: string;
23
+ name?: string;
24
+ baseUrl: string;
25
+ /** Literal key or env var name (e.g. OPENROUTER_API_KEY). */
26
+ apiKey?: string;
27
+ api?: "openai-completions" | "openai-responses" | "anthropic-messages";
28
+ models: KubbisecLlmModelDef[];
29
+ headers?: Record<string, string>;
30
+ /** Set when discovered via local server autodetect. */
31
+ autodetected?: boolean;
32
+ detectSource?: "ollama" | "lmstudio";
33
33
  };
34
34
  export type KubbisecLlmConfig = {
35
- defaultProvider?: string;
36
- defaultModel?: string;
37
- defaultThinkingLevel?: KubbisecThinkingLevel;
38
- temperature?: number;
39
- localLlm?: KubbisecLocalLlmDetectConfig;
40
- kubbisec?: {
41
- models?: KubbisecLlmModelDef[];
42
- };
43
- providers?: KubbisecCustomProviderDef[];
35
+ defaultProvider?: string;
36
+ defaultModel?: string;
37
+ defaultThinkingLevel?: KubbisecThinkingLevel;
38
+ temperature?: number;
39
+ localLlm?: KubbisecLocalLlmDetectConfig;
40
+ kubbisec?: {
41
+ models?: KubbisecLlmModelDef[];
42
+ };
43
+ providers?: KubbisecCustomProviderDef[];
44
44
  };
45
45
  export declare function resolveLlmConfigPath(cwd?: string): string;
46
46
  export declare function parseLlmConfig(raw: unknown): KubbisecLlmConfig;
47
47
  export declare function readLlmConfig(cwd?: string): KubbisecLlmConfig;
48
48
  export declare function writeLlmConfig(cwd: string, config: KubbisecLlmConfig): void;
49
- export declare function ensureLlmConfigFromOrg(cwd: string, options: {
49
+ export declare function ensureLlmConfigFromOrg(
50
+ cwd: string,
51
+ options: {
50
52
  model?: string | null;
51
53
  provider?: string | null;
52
- }): KubbisecLlmConfig;
53
- export declare function applyLlmConfigToAgentSettings(cwd?: string, config?: KubbisecLlmConfig): void;
54
+ },
55
+ ): KubbisecLlmConfig;
56
+ export declare function applyLlmConfigToAgentSettings(
57
+ cwd?: string,
58
+ config?: KubbisecLlmConfig,
59
+ ): void;
54
60
  /** @deprecated Use applyLlmConfigToAgentSettings */
55
61
  export declare const applyLlmConfigToPiSettings: typeof applyLlmConfigToAgentSettings;
56
62
  export declare function resolveApiKeyValue(apiKey?: string): string | undefined;
57
63
  export declare function getRuntimeTemperature(config?: KubbisecLlmConfig): number | undefined;
58
64
  export declare function setRuntimeTemperature(value: number | undefined, cwd?: string): void;
59
- export declare function applyTemperatureToProviderPayload(payload: unknown, temperature: number | undefined): unknown;
65
+ export declare function applyTemperatureToProviderPayload(
66
+ payload: unknown,
67
+ temperature: number | undefined,
68
+ ): unknown;
60
69
  export declare function resolveChatModelId(cwd?: string, orgModel?: string | null): string;
61
70
  export declare function resolveChatProviderId(cwd?: string): string;
62
71
  export declare const FOOTER_INFERENCE_UNSET = "\u2014";
63
72
  /** Footer model ref: `provider/id` (no provider display name or KubbiSec branding). */
64
73
  export declare function formatModelFooterLabel(provider: string, modelId: string): string;
65
- export declare function formatModelFooterWithInferenceSettings(modelRef: string, thinkingLevel?: string | null, temperature?: number | null): string;
66
- //# sourceMappingURL=llm-config.d.ts.map
74
+ export declare function formatModelFooterWithInferenceSettings(
75
+ modelRef: string,
76
+ thinkingLevel?: string | null,
77
+ temperature?: number | null,
78
+ ): string;
79
+ //# sourceMappingURL=llm-config.d.ts.map