@kubbisec/ai-linux-arm64 0.1.21 → 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 (130) hide show
  1. package/bundled/clarify/clarify-gate-state.d.ts +1 -1
  2. package/bundled/clarify/clarify-gate-state.js +3 -3
  3. package/bundled/clarify/clarify-gate.d.ts +21 -14
  4. package/bundled/clarify/clarify-gate.js +118 -111
  5. package/bundled/clarify/clarify-select-panel.d.ts +16 -9
  6. package/bundled/clarify/clarify-select-panel.js +65 -67
  7. package/bundled/clarify/clarify-ui-state.d.ts +12 -10
  8. package/bundled/clarify/clarify-ui-state.js +26 -26
  9. package/bundled/clarify/parse-clarify-answer.d.ts +29 -18
  10. package/bundled/clarify/parse-clarify-answer.js +39 -45
  11. package/bundled/clarify/question-format.d.ts +34 -23
  12. package/bundled/clarify/question-format.js +112 -119
  13. package/bundled/clarify/questionnaire-tool.d.ts +28 -17
  14. package/bundled/clarify/questionnaire-tool.js +180 -144
  15. package/bundled/clarify/scope-discovery.d.ts +8 -5
  16. package/bundled/clarify/scope-discovery.js +102 -110
  17. package/bundled/clarify/session-questionnaire.d.ts +48 -13
  18. package/bundled/clarify/session-questionnaire.js +304 -312
  19. package/bundled/clarify/session-questionnaire.types.d.ts +29 -27
  20. package/bundled/clarify/session-questionnaire.types.js +10 -10
  21. package/bundled/components/kubbisec-model-selector.d.ts +47 -34
  22. package/bundled/components/kubbisec-model-selector.js +187 -177
  23. package/bundled/config/config.d.ts +6 -6
  24. package/bundled/config/config.js +55 -55
  25. package/bundled/config/detect-local-llm-providers.d.ts +26 -16
  26. package/bundled/config/detect-local-llm-providers.js +130 -142
  27. package/bundled/config/ensure-kubbisec-project-settings.d.ts +9 -9
  28. package/bundled/config/ensure-kubbisec-project-settings.js +44 -48
  29. package/bundled/config/extended-context.d.ts +5 -6
  30. package/bundled/config/extended-context.js +23 -22
  31. package/bundled/config/feature-flags.d.ts +10 -2
  32. package/bundled/config/feature-flags.js +8 -2
  33. package/bundled/config/format-kubbisec-footer-status.d.ts +1 -1
  34. package/bundled/config/format-kubbisec-footer-status.js +26 -31
  35. package/bundled/config/kubbisec-extension-manifest.d.ts +22 -2
  36. package/bundled/config/kubbisec-extension-manifest.js +20 -20
  37. package/bundled/config/llm-config-mutations.d.ts +51 -25
  38. package/bundled/config/llm-config-mutations.js +173 -182
  39. package/bundled/config/llm-config.d.ts +54 -41
  40. package/bundled/config/llm-config.js +199 -199
  41. package/bundled/config/llm-provider-catalog.d.ts +18 -15
  42. package/bundled/config/llm-provider-catalog.js +45 -46
  43. package/bundled/config/materialize-kubbisec-pi-resources.d.ts +1 -1
  44. package/bundled/config/materialize-kubbisec-pi-resources.js +174 -183
  45. package/bundled/config/register-custom-llm-providers.d.ts +11 -5
  46. package/bundled/config/register-custom-llm-providers.js +17 -15
  47. package/bundled/config/register-kubbisec-llm-provider.d.ts +14 -10
  48. package/bundled/config/register-kubbisec-llm-provider.js +50 -42
  49. package/bundled/config/resolve-agents-context-file.d.ts +1 -1
  50. package/bundled/config/resolve-agents-context-file.js +33 -34
  51. package/bundled/config/resource-budget.d.ts +12 -12
  52. package/bundled/config/resource-budget.js +28 -28
  53. package/bundled/config/sync-kubbisec-pi-models.d.ts +6 -3
  54. package/bundled/config/sync-kubbisec-pi-models.js +58 -58
  55. package/bundled/copy/cli-reference-index.d.ts +3 -2
  56. package/bundled/copy/cli-reference-index.js +1 -1
  57. package/bundled/copy/kubbisec-shell-copy.d.ts +11 -6
  58. package/bundled/copy/kubbisec-shell-copy.js +1 -1
  59. package/bundled/extensions/cli-local-shared.d.ts +45 -26
  60. package/bundled/extensions/cli-local-shared.js +128 -118
  61. package/bundled/extensions/kubbisec-aspm-local.extension.d.ts +18 -15
  62. package/bundled/extensions/kubbisec-aspm-local.extension.js +118 -114
  63. package/bundled/extensions/kubbisec-brand.extension.d.ts +1 -1
  64. package/bundled/extensions/kubbisec-brand.extension.js +25 -25
  65. package/bundled/extensions/kubbisec-byok-provider.extension.d.ts +1 -1
  66. package/bundled/extensions/kubbisec-byok-provider.extension.js +2 -2
  67. package/bundled/extensions/kubbisec-clarify.extension.d.ts +64 -35
  68. package/bundled/extensions/kubbisec-clarify.extension.js +323 -305
  69. package/bundled/extensions/kubbisec-exit.extension.d.ts +1 -1
  70. package/bundled/extensions/kubbisec-exit.extension.js +29 -32
  71. package/bundled/extensions/kubbisec-extended-context.extension.d.ts +1 -1
  72. package/bundled/extensions/kubbisec-extended-context.extension.js +56 -43
  73. package/bundled/extensions/kubbisec-footer.extension.d.ts +14 -14
  74. package/bundled/extensions/kubbisec-footer.extension.js +205 -215
  75. package/bundled/extensions/kubbisec-github-local.extension.d.ts +26 -18
  76. package/bundled/extensions/kubbisec-github-local.extension.js +123 -116
  77. package/bundled/extensions/kubbisec-llm-config.extension.d.ts +1 -1
  78. package/bundled/extensions/kubbisec-llm-config.extension.js +200 -181
  79. package/bundled/extensions/kubbisec-memory.extension.d.ts +9 -7
  80. package/bundled/extensions/kubbisec-memory.extension.js +88 -95
  81. package/bundled/extensions/kubbisec-naus-local.extension.d.ts +18 -15
  82. package/bundled/extensions/kubbisec-naus-local.extension.js +132 -111
  83. package/bundled/extensions/kubbisec-platform-tools.extension.d.ts +31 -21
  84. package/bundled/extensions/kubbisec-platform-tools.extension.js +152 -152
  85. package/bundled/extensions/kubbisec-runtime-status.extension.d.ts +10 -8
  86. package/bundled/extensions/kubbisec-runtime-status.extension.js +15 -13
  87. package/bundled/extensions/kubbisec-scope.extension.d.ts +12 -7
  88. package/bundled/extensions/kubbisec-scope.extension.js +13 -13
  89. package/bundled/extensions/kubbisec-skill-mentions.extension.d.ts +27 -16
  90. package/bundled/extensions/kubbisec-skill-mentions.extension.js +73 -63
  91. package/bundled/extensions/kubbisec-skill-telemetry.extension.d.ts +2 -3
  92. package/bundled/extensions/kubbisec-skill-telemetry.extension.js +59 -64
  93. package/bundled/extensions/kubbisec-theme-lock.extension.d.ts +1 -1
  94. package/bundled/extensions/kubbisec-theme-lock.extension.js +33 -34
  95. package/bundled/extensions/kubbisec-ui.extension.d.ts +1 -1
  96. package/bundled/extensions/kubbisec-ui.extension.js +114 -109
  97. package/bundled/extensions/kubbisec-workflow.extension.d.ts +20 -18
  98. package/bundled/extensions/kubbisec-workflow.extension.js +138 -140
  99. package/bundled/node_modules/@aspm/shared/dist/redaction.test.d.ts +2 -0
  100. package/bundled/node_modules/@aspm/shared/dist/redaction.test.d.ts.map +1 -0
  101. package/bundled/node_modules/@aspm/shared/dist/redaction.test.js +626 -0
  102. package/bundled/node_modules/@aspm/shared/dist/redaction.test.js.map +1 -0
  103. package/bundled/resolve-bundled-dist-root.js +122 -131
  104. package/bundled/skills/at-path-mentions.d.ts +1 -1
  105. package/bundled/skills/at-path-mentions.js +146 -153
  106. package/bundled/skills/chat-mention-render.d.ts +2 -2
  107. package/bundled/skills/chat-mention-render.js +121 -126
  108. package/bundled/skills/chat-mentions.d.ts +17 -8
  109. package/bundled/skills/chat-mentions.js +76 -76
  110. package/bundled/skills/list-bundled-skills.d.ts +3 -3
  111. package/bundled/skills/list-bundled-skills.js +33 -35
  112. package/bundled/skills/skill-mention.d.ts +10 -2
  113. package/bundled/skills/skill-mention.js +10 -2
  114. package/bundled/theme/clear-terminal.d.ts +1 -1
  115. package/bundled/theme/clear-terminal.js +3 -4
  116. package/bundled/theme/footer-render-hook.d.ts +1 -1
  117. package/bundled/theme/footer-render-hook.js +3 -3
  118. package/bundled/theme/kubbisec-brand-fg.d.ts +1 -1
  119. package/bundled/theme/kubbisec-brand-fg.js +2 -2
  120. package/bundled/theme/kubbisec-menu-themes.d.ts +7 -7
  121. package/bundled/theme/kubbisec-menu-themes.js +30 -31
  122. package/bundled/theme/kubbisec-theme-name.d.ts +1 -1
  123. package/bundled/theme/kubbisec-theme-name.js +1 -1
  124. package/bundled/theme/patch-pi-settings-theme.runtime.d.ts +1 -1
  125. package/bundled/theme/patch-pi-settings-theme.runtime.js +11 -10
  126. package/bundled/theme/render-compact-header.d.ts +13 -5
  127. package/bundled/theme/render-compact-header.js +127 -129
  128. package/bundled/workflow/session-workflow-mode.d.ts +1 -1
  129. package/bundled/workflow/session-workflow-mode.js +33 -33
  130. package/package.json +1 -1
@@ -2,245 +2,245 @@ import * as fs from "node:fs";
2
2
  import * as path from "node:path";
3
3
  import { KUBBISEC_PROJECT_CONFIG_DIR } from "./ensure-kubbisec-project-settings.js";
4
4
  import { KUBBISEC_LLM_PROVIDER_ID, mergeKubbisecModelCatalog } from "./llm-provider-catalog.js";
5
+
5
6
  const LLM_CONFIG_FILE = "llm.json";
6
7
  const DEFAULT_LLM_CONFIG = {
7
- defaultProvider: KUBBISEC_LLM_PROVIDER_ID,
8
- defaultThinkingLevel: "medium",
9
- temperature: 0.2,
8
+ defaultProvider: KUBBISEC_LLM_PROVIDER_ID,
9
+ defaultThinkingLevel: "medium",
10
+ temperature: 0.2,
10
11
  };
11
12
  export function resolveLlmConfigPath(cwd = process.cwd()) {
12
- return path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR, LLM_CONFIG_FILE);
13
+ return path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR, LLM_CONFIG_FILE);
13
14
  }
14
15
  function readJsonFile(filePath) {
15
- try {
16
- return JSON.parse(fs.readFileSync(filePath, "utf8"));
17
- }
18
- catch {
19
- return undefined;
20
- }
16
+ try {
17
+ return JSON.parse(fs.readFileSync(filePath, "utf8"));
18
+ } catch {
19
+ return undefined;
20
+ }
21
21
  }
22
22
  export function parseLlmConfig(raw) {
23
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
24
- return { ...DEFAULT_LLM_CONFIG };
25
- }
26
- const input = raw;
27
- const next = { ...DEFAULT_LLM_CONFIG };
28
- if (typeof input.defaultProvider === "string" && input.defaultProvider.trim()) {
29
- next.defaultProvider = input.defaultProvider.trim();
30
- }
31
- if (typeof input.defaultModel === "string" && input.defaultModel.trim()) {
32
- next.defaultModel = input.defaultModel.trim();
33
- }
34
- if (input.defaultThinkingLevel === "off" ||
35
- input.defaultThinkingLevel === "minimal" ||
36
- input.defaultThinkingLevel === "low" ||
37
- input.defaultThinkingLevel === "medium" ||
38
- input.defaultThinkingLevel === "high" ||
39
- input.defaultThinkingLevel === "xhigh") {
40
- next.defaultThinkingLevel = input.defaultThinkingLevel;
41
- }
42
- if (typeof input.temperature === "number" && Number.isFinite(input.temperature)) {
43
- next.temperature = Math.min(2, Math.max(0, input.temperature));
44
- }
45
- if (input.localLlm && typeof input.localLlm === "object" && !Array.isArray(input.localLlm)) {
46
- const local = input.localLlm;
47
- next.localLlm = {
48
- ...(typeof local?.autoDetect === "boolean" ? { autoDetect: local.autoDetect } : {}),
49
- ...(local?.ollama && typeof local.ollama === "object"
50
- ? {
51
- ollama: {
52
- ...(local.ollama.enabled !== undefined
53
- ? { enabled: local.ollama.enabled === true }
54
- : {}),
55
- ...(typeof local.ollama.baseUrl === "string" && local.ollama.baseUrl.trim()
56
- ? { baseUrl: local.ollama.baseUrl.trim() }
57
- : {}),
58
- },
59
- }
23
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
24
+ return { ...DEFAULT_LLM_CONFIG };
25
+ }
26
+ const input = raw;
27
+ const next = { ...DEFAULT_LLM_CONFIG };
28
+ if (typeof input.defaultProvider === "string" && input.defaultProvider.trim()) {
29
+ next.defaultProvider = input.defaultProvider.trim();
30
+ }
31
+ if (typeof input.defaultModel === "string" && input.defaultModel.trim()) {
32
+ next.defaultModel = input.defaultModel.trim();
33
+ }
34
+ if (
35
+ input.defaultThinkingLevel === "off" ||
36
+ input.defaultThinkingLevel === "minimal" ||
37
+ input.defaultThinkingLevel === "low" ||
38
+ input.defaultThinkingLevel === "medium" ||
39
+ input.defaultThinkingLevel === "high" ||
40
+ input.defaultThinkingLevel === "xhigh"
41
+ ) {
42
+ next.defaultThinkingLevel = input.defaultThinkingLevel;
43
+ }
44
+ if (typeof input.temperature === "number" && Number.isFinite(input.temperature)) {
45
+ next.temperature = Math.min(2, Math.max(0, input.temperature));
46
+ }
47
+ if (input.localLlm && typeof input.localLlm === "object" && !Array.isArray(input.localLlm)) {
48
+ const local = input.localLlm;
49
+ next.localLlm = {
50
+ ...(typeof local?.autoDetect === "boolean" ? { autoDetect: local.autoDetect } : {}),
51
+ ...(local?.ollama && typeof local.ollama === "object"
52
+ ? {
53
+ ollama: {
54
+ ...(local.ollama.enabled !== undefined
55
+ ? { enabled: local.ollama.enabled === true }
60
56
  : {}),
61
- ...(local?.lmstudio && typeof local.lmstudio === "object"
62
- ? {
63
- lmstudio: {
64
- ...(local.lmstudio.enabled !== undefined
65
- ? { enabled: local.lmstudio.enabled === true }
66
- : {}),
67
- ...(typeof local.lmstudio.baseUrl === "string" && local.lmstudio.baseUrl.trim()
68
- ? { baseUrl: local.lmstudio.baseUrl.trim() }
69
- : {}),
70
- },
71
- }
57
+ ...(typeof local.ollama.baseUrl === "string" && local.ollama.baseUrl.trim()
58
+ ? { baseUrl: local.ollama.baseUrl.trim() }
72
59
  : {}),
73
- };
74
- }
75
- if (input.kubbisec && typeof input.kubbisec === "object" && !Array.isArray(input.kubbisec)) {
76
- const kub = input.kubbisec;
77
- if (Array.isArray(kub.models)) {
78
- next.kubbisec = {
79
- models: kub.models
80
- .filter((m) => Boolean(m && typeof m === "object" && typeof m.id === "string"))
81
- .map((m) => ({ ...m, id: m.id.trim() }))
82
- .filter((m) => m.id.length > 0),
83
- };
84
- }
85
- }
86
- if (Array.isArray(input.providers)) {
87
- next.providers = input.providers
88
- .filter((p) => {
89
- return Boolean(p &&
90
- typeof p === "object" &&
91
- typeof p.id === "string" &&
92
- typeof p.baseUrl === "string" &&
93
- Array.isArray(p.models));
94
- })
95
- .map((p) => ({
96
- ...p,
97
- id: p.id.trim(),
98
- baseUrl: p.baseUrl.trim(),
99
- ...(p.autodetected === true ? { autodetected: true } : {}),
100
- ...(p.detectSource === "ollama" || p.detectSource === "lmstudio"
101
- ? { detectSource: p.detectSource }
60
+ },
61
+ }
62
+ : {}),
63
+ ...(local?.lmstudio && typeof local.lmstudio === "object"
64
+ ? {
65
+ lmstudio: {
66
+ ...(local.lmstudio.enabled !== undefined
67
+ ? { enabled: local.lmstudio.enabled === true }
102
68
  : {}),
103
- models: p.models.filter((m) => m.id?.trim()).map((m) => ({ ...m, id: m.id.trim() })),
104
- }))
105
- .filter((p) => p.id.length > 0 && p.baseUrl.length > 0 && p.models.length > 0);
106
- }
107
- return next;
69
+ ...(typeof local.lmstudio.baseUrl === "string" && local.lmstudio.baseUrl.trim()
70
+ ? { baseUrl: local.lmstudio.baseUrl.trim() }
71
+ : {}),
72
+ },
73
+ }
74
+ : {}),
75
+ };
76
+ }
77
+ if (input.kubbisec && typeof input.kubbisec === "object" && !Array.isArray(input.kubbisec)) {
78
+ const kub = input.kubbisec;
79
+ if (Array.isArray(kub.models)) {
80
+ next.kubbisec = {
81
+ models: kub.models
82
+ .filter((m) => Boolean(m && typeof m === "object" && typeof m.id === "string"))
83
+ .map((m) => ({ ...m, id: m.id.trim() }))
84
+ .filter((m) => m.id.length > 0),
85
+ };
86
+ }
87
+ }
88
+ if (Array.isArray(input.providers)) {
89
+ next.providers = input.providers
90
+ .filter((p) => {
91
+ return Boolean(
92
+ p &&
93
+ typeof p === "object" &&
94
+ typeof p.id === "string" &&
95
+ typeof p.baseUrl === "string" &&
96
+ Array.isArray(p.models),
97
+ );
98
+ })
99
+ .map((p) => ({
100
+ ...p,
101
+ id: p.id.trim(),
102
+ baseUrl: p.baseUrl.trim(),
103
+ ...(p.autodetected === true ? { autodetected: true } : {}),
104
+ ...(p.detectSource === "ollama" || p.detectSource === "lmstudio"
105
+ ? { detectSource: p.detectSource }
106
+ : {}),
107
+ models: p.models.filter((m) => m.id?.trim()).map((m) => ({ ...m, id: m.id.trim() })),
108
+ }))
109
+ .filter((p) => p.id.length > 0 && p.baseUrl.length > 0 && p.models.length > 0);
110
+ }
111
+ return next;
108
112
  }
109
113
  export function readLlmConfig(cwd = process.cwd()) {
110
- const filePath = resolveLlmConfigPath(cwd);
111
- const parsed = parseLlmConfig(readJsonFile(filePath));
112
- return parsed;
114
+ const filePath = resolveLlmConfigPath(cwd);
115
+ const parsed = parseLlmConfig(readJsonFile(filePath));
116
+ return parsed;
113
117
  }
114
118
  export function writeLlmConfig(cwd, config) {
115
- const filePath = resolveLlmConfigPath(cwd);
116
- fs.mkdirSync(path.dirname(filePath), { recursive: true, mode: 0o755 });
117
- fs.writeFileSync(filePath, `${JSON.stringify(config, null, 2)}\n`, {
118
- encoding: "utf8",
119
- mode: 0o600,
120
- });
119
+ const filePath = resolveLlmConfigPath(cwd);
120
+ fs.mkdirSync(path.dirname(filePath), { recursive: true, mode: 0o755 });
121
+ fs.writeFileSync(filePath, `${JSON.stringify(config, null, 2)}\n`, {
122
+ encoding: "utf8",
123
+ mode: 0o600,
124
+ });
121
125
  }
122
126
  export function ensureLlmConfigFromOrg(cwd, options) {
123
- const current = readLlmConfig(cwd);
124
- const orgModel = options.model?.trim();
125
- const merged = {
126
- ...current,
127
- defaultProvider: KUBBISEC_LLM_PROVIDER_ID,
128
- ...(orgModel ? { defaultModel: orgModel } : {}),
129
- kubbisec: {
130
- models: mergeKubbisecModelCatalog(orgModel, current.kubbisec?.models),
131
- },
132
- };
133
- writeLlmConfig(cwd, merged);
134
- return merged;
127
+ const current = readLlmConfig(cwd);
128
+ const orgModel = options.model?.trim();
129
+ const merged = {
130
+ ...current,
131
+ defaultProvider: KUBBISEC_LLM_PROVIDER_ID,
132
+ ...(orgModel ? { defaultModel: orgModel } : {}),
133
+ kubbisec: {
134
+ models: mergeKubbisecModelCatalog(orgModel, current.kubbisec?.models),
135
+ },
136
+ };
137
+ writeLlmConfig(cwd, merged);
138
+ return merged;
135
139
  }
136
140
  function resolveAgentProjectSettingsPath(cwd) {
137
- return path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR, "settings.json");
141
+ return path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR, "settings.json");
138
142
  }
139
143
  export function applyLlmConfigToAgentSettings(cwd = process.cwd(), config = readLlmConfig(cwd)) {
140
- const settingsPath = resolveAgentProjectSettingsPath(cwd);
141
- fs.mkdirSync(path.dirname(settingsPath), { recursive: true, mode: 0o755 });
142
- let existing = {};
143
- try {
144
- const raw = readJsonFile(settingsPath);
145
- if (raw && typeof raw === "object" && !Array.isArray(raw)) {
146
- existing = raw;
147
- }
148
- }
149
- catch {
150
- /* fresh */
151
- }
152
- const merged = {
153
- ...existing,
154
- defaultProvider: config.defaultProvider ?? KUBBISEC_LLM_PROVIDER_ID,
155
- ...(config.defaultModel ? { defaultModel: config.defaultModel } : {}),
156
- ...(config.defaultThinkingLevel ? { defaultThinkingLevel: config.defaultThinkingLevel } : {}),
157
- };
158
- fs.writeFileSync(settingsPath, `${JSON.stringify(merged, null, 2)}\n`, {
159
- encoding: "utf8",
160
- mode: 0o600,
161
- });
144
+ const settingsPath = resolveAgentProjectSettingsPath(cwd);
145
+ fs.mkdirSync(path.dirname(settingsPath), { recursive: true, mode: 0o755 });
146
+ let existing = {};
147
+ try {
148
+ const raw = readJsonFile(settingsPath);
149
+ if (raw && typeof raw === "object" && !Array.isArray(raw)) {
150
+ existing = raw;
151
+ }
152
+ } catch {
153
+ /* fresh */
154
+ }
155
+ const merged = {
156
+ ...existing,
157
+ defaultProvider: config.defaultProvider ?? KUBBISEC_LLM_PROVIDER_ID,
158
+ ...(config.defaultModel ? { defaultModel: config.defaultModel } : {}),
159
+ ...(config.defaultThinkingLevel ? { defaultThinkingLevel: config.defaultThinkingLevel } : {}),
160
+ };
161
+ fs.writeFileSync(settingsPath, `${JSON.stringify(merged, null, 2)}\n`, {
162
+ encoding: "utf8",
163
+ mode: 0o600,
164
+ });
162
165
  }
163
166
  /** @deprecated Use applyLlmConfigToAgentSettings */
164
167
  export const applyLlmConfigToPiSettings = applyLlmConfigToAgentSettings;
165
168
  export function resolveApiKeyValue(apiKey) {
166
- const raw = apiKey?.trim();
167
- if (!raw)
168
- return undefined;
169
- if (/^[A-Z][A-Z0-9_]*$/.test(raw)) {
170
- const fromEnv = process.env[raw]?.trim();
171
- return fromEnv || undefined;
172
- }
173
- return raw;
169
+ const raw = apiKey?.trim();
170
+ if (!raw) return undefined;
171
+ if (/^[A-Z][A-Z0-9_]*$/.test(raw)) {
172
+ const fromEnv = process.env[raw]?.trim();
173
+ return fromEnv || undefined;
174
+ }
175
+ return raw;
174
176
  }
175
177
  let runtimeTemperature;
176
178
  export function getRuntimeTemperature(config = readLlmConfig()) {
177
- return runtimeTemperature ?? config.temperature;
179
+ return runtimeTemperature ?? config.temperature;
178
180
  }
179
181
  export function setRuntimeTemperature(value, cwd = process.cwd()) {
180
- if (value == null || !Number.isFinite(value)) {
181
- runtimeTemperature = undefined;
182
- return;
183
- }
184
- runtimeTemperature = Math.min(2, Math.max(0, value));
185
- const config = readLlmConfig(cwd);
186
- writeLlmConfig(cwd, { ...config, temperature: runtimeTemperature });
182
+ if (value == null || !Number.isFinite(value)) {
183
+ runtimeTemperature = undefined;
184
+ return;
185
+ }
186
+ runtimeTemperature = Math.min(2, Math.max(0, value));
187
+ const config = readLlmConfig(cwd);
188
+ writeLlmConfig(cwd, { ...config, temperature: runtimeTemperature });
187
189
  }
188
190
  export function applyTemperatureToProviderPayload(payload, temperature) {
189
- if (temperature == null || !Number.isFinite(temperature))
190
- return payload;
191
- if (!payload || typeof payload !== "object")
192
- return payload;
193
- const body = payload;
194
- if ("temperature" in body) {
195
- return { ...body, temperature };
196
- }
197
- if (typeof body.body === "string") {
198
- try {
199
- const parsed = JSON.parse(body.body);
200
- return { ...body, body: JSON.stringify({ ...parsed, temperature }) };
201
- }
202
- catch {
203
- return payload;
204
- }
205
- }
206
- if (body.body && typeof body.body === "object" && !Array.isArray(body.body)) {
207
- return {
208
- ...body,
209
- body: { ...body.body, temperature },
210
- };
211
- }
191
+ if (temperature == null || !Number.isFinite(temperature)) return payload;
192
+ if (!payload || typeof payload !== "object") return payload;
193
+ const body = payload;
194
+ if ("temperature" in body) {
212
195
  return { ...body, temperature };
196
+ }
197
+ if (typeof body.body === "string") {
198
+ try {
199
+ const parsed = JSON.parse(body.body);
200
+ return { ...body, body: JSON.stringify({ ...parsed, temperature }) };
201
+ } catch {
202
+ return payload;
203
+ }
204
+ }
205
+ if (body.body && typeof body.body === "object" && !Array.isArray(body.body)) {
206
+ return {
207
+ ...body,
208
+ body: { ...body.body, temperature },
209
+ };
210
+ }
211
+ return { ...body, temperature };
213
212
  }
214
213
  export function resolveChatModelId(cwd = process.cwd(), orgModel) {
215
- const config = readLlmConfig(cwd);
216
- return (config.defaultModel?.trim() ||
217
- process.env.KUBBISEC_AI_MODEL_ID?.trim() ||
218
- process.env.KUBBISEC_AI_MODEL?.trim() ||
219
- process.env.KUBBISEC_PI_MODEL?.trim() ||
220
- process.env.NAUS_PI_MODEL?.trim() ||
221
- orgModel?.trim() ||
222
- "gpt-4o");
214
+ const config = readLlmConfig(cwd);
215
+ return (
216
+ config.defaultModel?.trim() ||
217
+ process.env.KUBBISEC_AI_MODEL_ID?.trim() ||
218
+ process.env.KUBBISEC_AI_MODEL?.trim() ||
219
+ process.env.KUBBISEC_PI_MODEL?.trim() ||
220
+ process.env.NAUS_PI_MODEL?.trim() ||
221
+ orgModel?.trim() ||
222
+ "gpt-4o"
223
+ );
223
224
  }
224
225
  export function resolveChatProviderId(cwd = process.cwd()) {
225
- const config = readLlmConfig(cwd);
226
- return config.defaultProvider?.trim() || KUBBISEC_LLM_PROVIDER_ID;
226
+ const config = readLlmConfig(cwd);
227
+ return config.defaultProvider?.trim() || KUBBISEC_LLM_PROVIDER_ID;
227
228
  }
228
229
  export const FOOTER_INFERENCE_UNSET = "—";
229
230
  /** Footer model ref: `provider/id` (no provider display name or KubbiSec branding). */
230
231
  export function formatModelFooterLabel(provider, modelId) {
231
- const id = modelId.trim();
232
- if (!id)
233
- return "no-model";
234
- if (id.includes("/"))
235
- return id;
236
- const providerId = provider.trim() || KUBBISEC_LLM_PROVIDER_ID;
237
- return `${providerId}/${id}`;
232
+ const id = modelId.trim();
233
+ if (!id) return "no-model";
234
+ if (id.includes("/")) return id;
235
+ const providerId = provider.trim() || KUBBISEC_LLM_PROVIDER_ID;
236
+ return `${providerId}/${id}`;
238
237
  }
239
238
  export function formatModelFooterWithInferenceSettings(modelRef, thinkingLevel, temperature) {
240
- const thinking = thinkingLevel?.trim() || FOOTER_INFERENCE_UNSET;
241
- const temp = temperature != null && Number.isFinite(temperature)
242
- ? String(temperature)
243
- : FOOTER_INFERENCE_UNSET;
244
- return `${modelRef} · ${thinking} · ${temp}`;
245
- }
246
- //# sourceMappingURL=llm-config.js.map
239
+ const thinking = thinkingLevel?.trim() || FOOTER_INFERENCE_UNSET;
240
+ const temp =
241
+ temperature != null && Number.isFinite(temperature)
242
+ ? String(temperature)
243
+ : FOOTER_INFERENCE_UNSET;
244
+ return `${modelRef} · ${thinking} · ${temp}`;
245
+ }
246
+ //# sourceMappingURL=llm-config.js.map
@@ -3,20 +3,23 @@ export declare const KUBBISEC_LLM_PROVIDER_ID = "kubbisec";
3
3
  export declare const KUBBISEC_LLM_PROVIDER_NAME = "KubbiSec";
4
4
  export declare const KUBBISEC_BUILTIN_MODELS: KubbisecLlmModelDef[];
5
5
  export type ProviderModelConfigShape = {
6
- id: string;
7
- name: string;
8
- api: "openai-completions";
9
- reasoning: boolean;
10
- input: ("text" | "image")[];
11
- cost: {
12
- input: number;
13
- output: number;
14
- cacheRead: number;
15
- cacheWrite: number;
16
- };
17
- contextWindow: number;
18
- maxTokens: number;
6
+ id: string;
7
+ name: string;
8
+ api: "openai-completions";
9
+ reasoning: boolean;
10
+ input: ("text" | "image")[];
11
+ cost: {
12
+ input: number;
13
+ output: number;
14
+ cacheRead: number;
15
+ cacheWrite: number;
16
+ };
17
+ contextWindow: number;
18
+ maxTokens: number;
19
19
  };
20
20
  export declare function toProviderModelConfig(def: KubbisecLlmModelDef): ProviderModelConfigShape;
21
- export declare function mergeKubbisecModelCatalog(orgModel?: string | null, extra?: KubbisecLlmModelDef[]): KubbisecLlmModelDef[];
22
- //# sourceMappingURL=llm-provider-catalog.d.ts.map
21
+ export declare function mergeKubbisecModelCatalog(
22
+ orgModel?: string | null,
23
+ extra?: KubbisecLlmModelDef[],
24
+ ): KubbisecLlmModelDef[];
25
+ //# sourceMappingURL=llm-provider-catalog.d.ts.map
@@ -1,54 +1,53 @@
1
1
  export const KUBBISEC_LLM_PROVIDER_ID = "kubbisec";
2
2
  export const KUBBISEC_LLM_PROVIDER_NAME = "KubbiSec";
3
3
  export const KUBBISEC_BUILTIN_MODELS = [
4
- { id: "gpt-4o", name: "GPT-4o", reasoning: false, contextWindow: 128_000, maxTokens: 16_384 },
5
- {
6
- id: "gpt-4o-mini",
7
- name: "GPT-4o Mini",
8
- reasoning: false,
9
- contextWindow: 128_000,
10
- maxTokens: 16_384,
11
- },
12
- { id: "o3-mini", name: "O3 Mini", reasoning: true, contextWindow: 200_000, maxTokens: 100_000 },
13
- {
14
- id: "claude-sonnet-4-20250514",
15
- name: "Claude Sonnet 4",
16
- reasoning: true,
17
- contextWindow: 200_000,
18
- maxTokens: 16_384,
19
- },
4
+ { id: "gpt-4o", name: "GPT-4o", reasoning: false, contextWindow: 128_000, maxTokens: 16_384 },
5
+ {
6
+ id: "gpt-4o-mini",
7
+ name: "GPT-4o Mini",
8
+ reasoning: false,
9
+ contextWindow: 128_000,
10
+ maxTokens: 16_384,
11
+ },
12
+ { id: "o3-mini", name: "O3 Mini", reasoning: true, contextWindow: 200_000, maxTokens: 100_000 },
13
+ {
14
+ id: "claude-sonnet-4-20250514",
15
+ name: "Claude Sonnet 4",
16
+ reasoning: true,
17
+ contextWindow: 200_000,
18
+ maxTokens: 16_384,
19
+ },
20
20
  ];
21
21
  export function toProviderModelConfig(def) {
22
- return {
23
- id: def.id,
24
- name: def.name?.trim() || def.id,
25
- api: "openai-completions",
26
- reasoning: def.reasoning === true,
27
- input: ["text"],
28
- cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
29
- contextWindow: def.contextWindow ?? 128_000,
30
- maxTokens: def.maxTokens ?? 8_192,
31
- };
22
+ return {
23
+ id: def.id,
24
+ name: def.name?.trim() || def.id,
25
+ api: "openai-completions",
26
+ reasoning: def.reasoning === true,
27
+ input: ["text"],
28
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
29
+ contextWindow: def.contextWindow ?? 128_000,
30
+ maxTokens: def.maxTokens ?? 8_192,
31
+ };
32
32
  }
33
33
  export function mergeKubbisecModelCatalog(orgModel, extra) {
34
- const byId = new Map();
35
- for (const model of KUBBISEC_BUILTIN_MODELS) {
36
- byId.set(model.id, model);
37
- }
38
- for (const model of extra ?? []) {
39
- if (model.id?.trim())
40
- byId.set(model.id.trim(), { ...model, id: model.id.trim() });
41
- }
42
- const org = orgModel?.trim();
43
- if (org && !byId.has(org)) {
44
- byId.set(org, { id: org, name: org, reasoning: org.startsWith("o") });
45
- }
46
- const ordered = [];
47
- if (org && byId.has(org)) {
48
- ordered.push(byId.get(org));
49
- byId.delete(org);
50
- }
51
- ordered.push(...byId.values());
52
- return ordered;
34
+ const byId = new Map();
35
+ for (const model of KUBBISEC_BUILTIN_MODELS) {
36
+ byId.set(model.id, model);
37
+ }
38
+ for (const model of extra ?? []) {
39
+ if (model.id?.trim()) byId.set(model.id.trim(), { ...model, id: model.id.trim() });
40
+ }
41
+ const org = orgModel?.trim();
42
+ if (org && !byId.has(org)) {
43
+ byId.set(org, { id: org, name: org, reasoning: org.startsWith("o") });
44
+ }
45
+ const ordered = [];
46
+ if (org && byId.has(org)) {
47
+ ordered.push(byId.get(org));
48
+ byId.delete(org);
49
+ }
50
+ ordered.push(...byId.values());
51
+ return ordered;
53
52
  }
54
- //# sourceMappingURL=llm-provider-catalog.js.map
53
+ //# sourceMappingURL=llm-provider-catalog.js.map
@@ -16,4 +16,4 @@ export declare const materializeKubbisecPiExtensions: typeof materializeKubbisec
16
16
  export declare const materializeKubbisecPiTheme: typeof materializeKubbisecAgentTheme;
17
17
  /** @deprecated Use resolveKubbisecAgentExtensionPaths */
18
18
  export declare const resolveKubbisecPiExtensionPaths: typeof resolveKubbisecAgentExtensionPaths;
19
- //# sourceMappingURL=materialize-kubbisec-pi-resources.d.ts.map
19
+ //# sourceMappingURL=materialize-kubbisec-pi-resources.d.ts.map