@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
@@ -1,183 +1,175 @@
1
1
  import * as crypto from "node:crypto";
2
2
  import * as fs from "node:fs";
3
3
  import * as path from "node:path";
4
- import { resolveBundledDistRoot, resolvePackagedBundledDistDir, } from "../resolve-bundled-dist-root.js";
4
+ import {
5
+ resolveBundledDistRoot,
6
+ resolvePackagedBundledDistDir,
7
+ } from "../resolve-bundled-dist-root.js";
5
8
  import { KUBBISEC_THEME_NAME } from "../theme/kubbisec-theme-name.js";
6
9
  import { KUBBISEC_PROJECT_CONFIG_DIR } from "./ensure-kubbisec-project-settings.js";
7
10
  import { KUBBISEC_EXTENSION_BASENAMES } from "./kubbisec-extension-manifest.js";
11
+
8
12
  const KUBBISEC_EXTENSION_PREFIX = "kubbisec-";
9
13
  const FINGERPRINT_FILE = ".bundled-fingerprint";
10
14
  const WORKSPACE_MODULE_SCOPES = ["@kubbisec", "@aspm"];
11
15
  const MONOREPO_WORKSPACE_PACKAGES = [
12
- { name: "@kubbisec/home", packageDir: "kubbisec-home" },
13
- { name: "@kubbisec/chat-memory", packageDir: "kubbisec-chat-memory" },
14
- { name: "@aspm/shared", packageDir: "shared" },
16
+ { name: "@kubbisec/home", packageDir: "kubbisec-home" },
17
+ { name: "@kubbisec/chat-memory", packageDir: "kubbisec-chat-memory" },
18
+ { name: "@aspm/shared", packageDir: "shared" },
15
19
  ];
16
20
  /** Non-prefixed modules co-located with extensions (imported as `./…` from extension entrypoints). */
17
21
  const EXTENSION_SUPPORT_FILES = ["cli-local-shared.js"];
18
22
  /** Dist siblings required by `../…` imports from `.kubbisec/extensions/*.extension.js`. */
19
23
  const AGENT_SUPPORT_DIRS = [
20
- "config",
21
- "components",
22
- "copy",
23
- "workflow",
24
- "theme",
25
- "skills",
26
- "assets",
24
+ "config",
25
+ "components",
26
+ "copy",
27
+ "workflow",
28
+ "theme",
29
+ "skills",
30
+ "assets",
27
31
  ];
28
32
  const AGENT_ROOT_FILES = ["resolve-bundled-dist-root.js"];
29
33
  function listKubbisecExtensionFiles(dir) {
30
- if (!fs.existsSync(dir))
31
- return [];
32
- return fs
33
- .readdirSync(dir)
34
- .filter((name) => name.startsWith(KUBBISEC_EXTENSION_PREFIX) && name.endsWith(".js"))
35
- .sort();
34
+ if (!fs.existsSync(dir)) return [];
35
+ return fs
36
+ .readdirSync(dir)
37
+ .filter((name) => name.startsWith(KUBBISEC_EXTENSION_PREFIX) && name.endsWith(".js"))
38
+ .sort();
36
39
  }
37
40
  function listExtensionSupportFiles(dir) {
38
- if (!fs.existsSync(dir))
39
- return [];
40
- return EXTENSION_SUPPORT_FILES.filter((name) => fs.existsSync(path.join(dir, name)));
41
+ if (!fs.existsSync(dir)) return [];
42
+ return EXTENSION_SUPPORT_FILES.filter((name) => fs.existsSync(path.join(dir, name)));
41
43
  }
42
44
  function listFilesRecursive(root, prefix = "") {
43
- const out = [];
44
- const scanDir = prefix ? path.join(root, prefix) : root;
45
- if (!fs.existsSync(scanDir))
46
- return out;
47
- for (const entry of fs.readdirSync(scanDir, { withFileTypes: true })) {
48
- const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
49
- if (entry.isDirectory()) {
50
- out.push(...listFilesRecursive(root, rel));
51
- }
52
- else {
53
- out.push(rel);
54
- }
55
- }
56
- return out.sort();
45
+ const out = [];
46
+ const scanDir = prefix ? path.join(root, prefix) : root;
47
+ if (!fs.existsSync(scanDir)) return out;
48
+ for (const entry of fs.readdirSync(scanDir, { withFileTypes: true })) {
49
+ const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
50
+ if (entry.isDirectory()) {
51
+ out.push(...listFilesRecursive(root, rel));
52
+ } else {
53
+ out.push(rel);
54
+ }
55
+ }
56
+ return out.sort();
57
57
  }
58
58
  function fingerprintBundledAgentRuntime(sourceRoot, extensionNames, supportNames) {
59
- const hash = crypto.createHash("sha256");
60
- const extensionsDir = path.join(sourceRoot, "extensions");
61
- for (const name of extensionNames) {
62
- hash.update(`extensions/${name}`);
63
- hash.update(fs.readFileSync(path.join(extensionsDir, name)));
64
- }
65
- for (const name of supportNames) {
66
- hash.update(`extensions/${name}`);
67
- hash.update(fs.readFileSync(path.join(extensionsDir, name)));
68
- }
69
- for (const dir of AGENT_SUPPORT_DIRS) {
70
- const base = path.join(sourceRoot, dir);
71
- for (const rel of listFilesRecursive(base)) {
72
- hash.update(`${dir}/${rel}`);
73
- hash.update(fs.readFileSync(path.join(base, rel)));
74
- }
75
- }
76
- for (const file of AGENT_ROOT_FILES) {
77
- const full = path.join(sourceRoot, file);
78
- if (!fs.existsSync(full))
79
- continue;
80
- hash.update(file);
81
- hash.update(fs.readFileSync(full));
82
- }
83
- for (const scope of WORKSPACE_MODULE_SCOPES) {
84
- const scopeRoot = path.join(sourceRoot, "node_modules", scope);
85
- if (!fs.existsSync(scopeRoot))
86
- continue;
87
- for (const rel of listFilesRecursive(scopeRoot)) {
88
- hash.update(`node_modules/${scope}/${rel}`);
89
- hash.update(fs.readFileSync(path.join(scopeRoot, rel)));
90
- }
91
- }
92
- return hash.digest("hex").slice(0, 16);
59
+ const hash = crypto.createHash("sha256");
60
+ const extensionsDir = path.join(sourceRoot, "extensions");
61
+ for (const name of extensionNames) {
62
+ hash.update(`extensions/${name}`);
63
+ hash.update(fs.readFileSync(path.join(extensionsDir, name)));
64
+ }
65
+ for (const name of supportNames) {
66
+ hash.update(`extensions/${name}`);
67
+ hash.update(fs.readFileSync(path.join(extensionsDir, name)));
68
+ }
69
+ for (const dir of AGENT_SUPPORT_DIRS) {
70
+ const base = path.join(sourceRoot, dir);
71
+ for (const rel of listFilesRecursive(base)) {
72
+ hash.update(`${dir}/${rel}`);
73
+ hash.update(fs.readFileSync(path.join(base, rel)));
74
+ }
75
+ }
76
+ for (const file of AGENT_ROOT_FILES) {
77
+ const full = path.join(sourceRoot, file);
78
+ if (!fs.existsSync(full)) continue;
79
+ hash.update(file);
80
+ hash.update(fs.readFileSync(full));
81
+ }
82
+ for (const scope of WORKSPACE_MODULE_SCOPES) {
83
+ const scopeRoot = path.join(sourceRoot, "node_modules", scope);
84
+ if (!fs.existsSync(scopeRoot)) continue;
85
+ for (const rel of listFilesRecursive(scopeRoot)) {
86
+ hash.update(`node_modules/${scope}/${rel}`);
87
+ hash.update(fs.readFileSync(path.join(scopeRoot, rel)));
88
+ }
89
+ }
90
+ return hash.digest("hex").slice(0, 16);
93
91
  }
94
92
  function removeStaleKubbisecExtensions(targetDir) {
95
- if (!fs.existsSync(targetDir))
96
- return;
97
- for (const name of fs.readdirSync(targetDir)) {
98
- const isKubbisecEntry = name.startsWith(KUBBISEC_EXTENSION_PREFIX) && name.endsWith(".js");
99
- const isSupport = EXTENSION_SUPPORT_FILES.includes(name);
100
- if (isKubbisecEntry || isSupport) {
101
- fs.unlinkSync(path.join(targetDir, name));
102
- }
103
- }
93
+ if (!fs.existsSync(targetDir)) return;
94
+ for (const name of fs.readdirSync(targetDir)) {
95
+ const isKubbisecEntry = name.startsWith(KUBBISEC_EXTENSION_PREFIX) && name.endsWith(".js");
96
+ const isSupport = EXTENSION_SUPPORT_FILES.includes(name);
97
+ if (isKubbisecEntry || isSupport) {
98
+ fs.unlinkSync(path.join(targetDir, name));
99
+ }
100
+ }
104
101
  }
105
102
  function copySupportDirs(sourceRoot, agentRoot) {
106
- for (const dir of AGENT_SUPPORT_DIRS) {
107
- const source = path.join(sourceRoot, dir);
108
- if (!fs.existsSync(source))
109
- continue;
110
- const target = path.join(agentRoot, dir);
111
- fs.rmSync(target, { recursive: true, force: true });
112
- fs.cpSync(source, target, { recursive: true });
113
- }
114
- for (const file of AGENT_ROOT_FILES) {
115
- const source = path.join(sourceRoot, file);
116
- if (!fs.existsSync(source))
117
- continue;
118
- fs.copyFileSync(source, path.join(agentRoot, file));
119
- }
103
+ for (const dir of AGENT_SUPPORT_DIRS) {
104
+ const source = path.join(sourceRoot, dir);
105
+ if (!fs.existsSync(source)) continue;
106
+ const target = path.join(agentRoot, dir);
107
+ fs.rmSync(target, { recursive: true, force: true });
108
+ fs.cpSync(source, target, { recursive: true });
109
+ }
110
+ for (const file of AGENT_ROOT_FILES) {
111
+ const source = path.join(sourceRoot, file);
112
+ if (!fs.existsSync(source)) continue;
113
+ fs.copyFileSync(source, path.join(agentRoot, file));
114
+ }
120
115
  }
121
116
  function copyBundledWorkspaceModules(sourceRoot, agentRoot) {
122
- const sourceModules = path.join(sourceRoot, "node_modules");
123
- if (!fs.existsSync(sourceModules))
124
- return;
125
- const targetModules = path.join(agentRoot, "node_modules");
126
- for (const scope of WORKSPACE_MODULE_SCOPES) {
127
- const scopeSrc = path.join(sourceModules, scope);
128
- if (!fs.existsSync(scopeSrc))
129
- continue;
130
- const scopeDest = path.join(targetModules, scope);
131
- fs.mkdirSync(path.dirname(scopeDest), { recursive: true, mode: 0o755 });
132
- fs.rmSync(scopeDest, { recursive: true, force: true });
133
- fs.cpSync(scopeSrc, scopeDest, { recursive: true });
134
- }
117
+ const sourceModules = path.join(sourceRoot, "node_modules");
118
+ if (!fs.existsSync(sourceModules)) return;
119
+ const targetModules = path.join(agentRoot, "node_modules");
120
+ for (const scope of WORKSPACE_MODULE_SCOPES) {
121
+ const scopeSrc = path.join(sourceModules, scope);
122
+ if (!fs.existsSync(scopeSrc)) continue;
123
+ const scopeDest = path.join(targetModules, scope);
124
+ fs.mkdirSync(path.dirname(scopeDest), { recursive: true, mode: 0o755 });
125
+ fs.rmSync(scopeDest, { recursive: true, force: true });
126
+ fs.cpSync(scopeSrc, scopeDest, { recursive: true });
127
+ }
135
128
  }
136
129
  function copyMonorepoWorkspaceModules(sourceRoot, agentRoot) {
137
- const packagesRoot = path.join(sourceRoot, "..", "..");
138
- const targetModules = path.join(agentRoot, "node_modules");
139
- for (const { name, packageDir } of MONOREPO_WORKSPACE_PACKAGES) {
140
- const pkgRoot = path.join(packagesRoot, packageDir);
141
- const distSrc = path.join(pkgRoot, "dist");
142
- const pkgJsonPath = path.join(pkgRoot, "package.json");
143
- if (!fs.existsSync(distSrc) || !fs.existsSync(pkgJsonPath))
144
- continue;
145
- const dest = path.join(targetModules, name);
146
- fs.mkdirSync(dest, { recursive: true, mode: 0o755 });
147
- fs.copyFileSync(pkgJsonPath, path.join(dest, "package.json"));
148
- fs.cpSync(distSrc, path.join(dest, "dist"), { recursive: true });
149
- }
130
+ const packagesRoot = path.join(sourceRoot, "..", "..");
131
+ const targetModules = path.join(agentRoot, "node_modules");
132
+ for (const { name, packageDir } of MONOREPO_WORKSPACE_PACKAGES) {
133
+ const pkgRoot = path.join(packagesRoot, packageDir);
134
+ const distSrc = path.join(pkgRoot, "dist");
135
+ const pkgJsonPath = path.join(pkgRoot, "package.json");
136
+ if (!fs.existsSync(distSrc) || !fs.existsSync(pkgJsonPath)) continue;
137
+ const dest = path.join(targetModules, name);
138
+ fs.mkdirSync(dest, { recursive: true, mode: 0o755 });
139
+ fs.copyFileSync(pkgJsonPath, path.join(dest, "package.json"));
140
+ fs.cpSync(distSrc, path.join(dest, "dist"), { recursive: true });
141
+ }
150
142
  }
151
143
  function copyWorkspaceModules(sourceRoot, agentRoot) {
152
- const bundledModules = path.join(sourceRoot, "node_modules", "@kubbisec", "home");
153
- if (fs.existsSync(bundledModules)) {
154
- copyBundledWorkspaceModules(sourceRoot, agentRoot);
155
- return;
156
- }
157
- copyMonorepoWorkspaceModules(sourceRoot, agentRoot);
144
+ const bundledModules = path.join(sourceRoot, "node_modules", "@kubbisec", "home");
145
+ if (fs.existsSync(bundledModules)) {
146
+ copyBundledWorkspaceModules(sourceRoot, agentRoot);
147
+ return;
148
+ }
149
+ copyMonorepoWorkspaceModules(sourceRoot, agentRoot);
158
150
  }
159
151
  function supportLayoutUpToDate(agentRoot, fingerprint) {
160
- const stampPath = path.join(agentRoot, FINGERPRINT_FILE);
161
- try {
162
- if (fs.readFileSync(stampPath, "utf8").trim() !== fingerprint)
163
- return false;
164
- }
165
- catch {
166
- return false;
167
- }
168
- return (fs.existsSync(path.join(agentRoot, "config", "register-kubbisec-llm-provider.js")) &&
169
- fs.existsSync(path.join(agentRoot, "node_modules", "@kubbisec", "home", "dist", "index.js")));
152
+ const stampPath = path.join(agentRoot, FINGERPRINT_FILE);
153
+ try {
154
+ if (fs.readFileSync(stampPath, "utf8").trim() !== fingerprint) return false;
155
+ } catch {
156
+ return false;
157
+ }
158
+ return (
159
+ fs.existsSync(path.join(agentRoot, "config", "register-kubbisec-llm-provider.js")) &&
160
+ fs.existsSync(path.join(agentRoot, "node_modules", "@kubbisec", "home", "dist", "index.js"))
161
+ );
170
162
  }
171
163
  function resolveExtensionPathsFromRoot(root) {
172
- const targetDir = path.join(root, "extensions");
173
- const paths = [];
174
- for (const base of KUBBISEC_EXTENSION_BASENAMES) {
175
- const full = path.join(targetDir, `${base}.js`);
176
- if (fs.existsSync(full)) {
177
- paths.push(full);
178
- }
179
- }
180
- return paths;
164
+ const targetDir = path.join(root, "extensions");
165
+ const paths = [];
166
+ for (const base of KUBBISEC_EXTENSION_BASENAMES) {
167
+ const full = path.join(targetDir, `${base}.js`);
168
+ if (fs.existsSync(full)) {
169
+ paths.push(full);
170
+ }
171
+ }
172
+ return paths;
181
173
  }
182
174
  /**
183
175
  * Copy bundled KubbiSec extensions into `<cwd>/.kubbisec/` so the runtime loads them
@@ -187,51 +179,50 @@ function resolveExtensionPathsFromRoot(root) {
187
179
  * matching dist folders are mirrored under `<cwd>/.kubbisec/`.
188
180
  */
189
181
  export function materializeKubbisecAgentExtensions(cwd = process.cwd()) {
190
- const packaged = resolvePackagedBundledDistDir();
191
- if (packaged) {
192
- return resolveExtensionPathsFromRoot(packaged);
193
- }
194
- const sourceRoot = resolveBundledDistRoot();
195
- const sourceDir = path.join(sourceRoot, "extensions");
196
- const sourceNames = listKubbisecExtensionFiles(sourceDir);
197
- const supportNames = listExtensionSupportFiles(sourceDir);
198
- if (sourceNames.length === 0)
199
- return [];
200
- const agentRoot = path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR);
201
- const targetDir = path.join(agentRoot, "extensions");
202
- fs.mkdirSync(targetDir, { recursive: true, mode: 0o755 });
203
- const fingerprint = fingerprintBundledAgentRuntime(sourceRoot, sourceNames, supportNames);
204
- const extensionsUpToDate = supportLayoutUpToDate(agentRoot, fingerprint) &&
205
- sourceNames.every((name) => fs.existsSync(path.join(targetDir, name))) &&
206
- supportNames.every((name) => fs.existsSync(path.join(targetDir, name)));
207
- if (!extensionsUpToDate) {
208
- removeStaleKubbisecExtensions(targetDir);
209
- for (const name of [...sourceNames, ...supportNames]) {
210
- fs.copyFileSync(path.join(sourceDir, name), path.join(targetDir, name));
211
- }
212
- copySupportDirs(sourceRoot, agentRoot);
213
- copyWorkspaceModules(sourceRoot, agentRoot);
214
- fs.writeFileSync(path.join(agentRoot, FINGERPRINT_FILE), `${fingerprint}\n`, "utf8");
215
- }
216
- return listKubbisecExtensionFiles(targetDir).map((name) => path.join(targetDir, name));
182
+ const packaged = resolvePackagedBundledDistDir();
183
+ if (packaged) {
184
+ return resolveExtensionPathsFromRoot(packaged);
185
+ }
186
+ const sourceRoot = resolveBundledDistRoot();
187
+ const sourceDir = path.join(sourceRoot, "extensions");
188
+ const sourceNames = listKubbisecExtensionFiles(sourceDir);
189
+ const supportNames = listExtensionSupportFiles(sourceDir);
190
+ if (sourceNames.length === 0) return [];
191
+ const agentRoot = path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR);
192
+ const targetDir = path.join(agentRoot, "extensions");
193
+ fs.mkdirSync(targetDir, { recursive: true, mode: 0o755 });
194
+ const fingerprint = fingerprintBundledAgentRuntime(sourceRoot, sourceNames, supportNames);
195
+ const extensionsUpToDate =
196
+ supportLayoutUpToDate(agentRoot, fingerprint) &&
197
+ sourceNames.every((name) => fs.existsSync(path.join(targetDir, name))) &&
198
+ supportNames.every((name) => fs.existsSync(path.join(targetDir, name)));
199
+ if (!extensionsUpToDate) {
200
+ removeStaleKubbisecExtensions(targetDir);
201
+ for (const name of [...sourceNames, ...supportNames]) {
202
+ fs.copyFileSync(path.join(sourceDir, name), path.join(targetDir, name));
203
+ }
204
+ copySupportDirs(sourceRoot, agentRoot);
205
+ copyWorkspaceModules(sourceRoot, agentRoot);
206
+ fs.writeFileSync(path.join(agentRoot, FINGERPRINT_FILE), `${fingerprint}\n`, "utf8");
207
+ }
208
+ return listKubbisecExtensionFiles(targetDir).map((name) => path.join(targetDir, name));
217
209
  }
218
210
  /** Pin KubbiSec theme under `<cwd>/.kubbisec/themes/` for runtime project discovery. */
219
211
  export function materializeKubbisecAgentTheme(cwd = process.cwd()) {
220
- const source = path.join(resolveBundledDistRoot(), "theme", `${KUBBISEC_THEME_NAME}.json`);
221
- if (!fs.existsSync(source))
222
- return;
223
- const targetDir = path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR, "themes");
224
- fs.mkdirSync(targetDir, { recursive: true, mode: 0o755 });
225
- fs.copyFileSync(source, path.join(targetDir, `${KUBBISEC_THEME_NAME}.json`));
212
+ const source = path.join(resolveBundledDistRoot(), "theme", `${KUBBISEC_THEME_NAME}.json`);
213
+ if (!fs.existsSync(source)) return;
214
+ const targetDir = path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR, "themes");
215
+ fs.mkdirSync(targetDir, { recursive: true, mode: 0o755 });
216
+ fs.copyFileSync(source, path.join(targetDir, `${KUBBISEC_THEME_NAME}.json`));
226
217
  }
227
218
  /** Extension paths in manifest load order (for explicit `-e` flags). */
228
219
  export function resolveKubbisecAgentExtensionPaths(cwd = process.cwd()) {
229
- materializeKubbisecAgentExtensions(cwd);
230
- const packaged = resolvePackagedBundledDistDir();
231
- if (packaged) {
232
- return resolveExtensionPathsFromRoot(packaged);
233
- }
234
- return resolveExtensionPathsFromRoot(path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR));
220
+ materializeKubbisecAgentExtensions(cwd);
221
+ const packaged = resolvePackagedBundledDistDir();
222
+ if (packaged) {
223
+ return resolveExtensionPathsFromRoot(packaged);
224
+ }
225
+ return resolveExtensionPathsFromRoot(path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR));
235
226
  }
236
227
  /** @deprecated Use materializeKubbisecAgentExtensions */
237
228
  export const materializeKubbisecPiExtensions = materializeKubbisecAgentExtensions;
@@ -239,4 +230,4 @@ export const materializeKubbisecPiExtensions = materializeKubbisecAgentExtension
239
230
  export const materializeKubbisecPiTheme = materializeKubbisecAgentTheme;
240
231
  /** @deprecated Use resolveKubbisecAgentExtensionPaths */
241
232
  export const resolveKubbisecPiExtensionPaths = resolveKubbisecAgentExtensionPaths;
242
- //# sourceMappingURL=materialize-kubbisec-pi-resources.js.map
233
+ //# sourceMappingURL=materialize-kubbisec-pi-resources.js.map
@@ -1,13 +1,19 @@
1
1
  import type { KubbisecLlmConfig } from "./llm-config.js";
2
2
  import { toProviderModelConfig } from "./llm-provider-catalog.js";
3
- type ProviderRegistrar = (id: string, config: {
3
+
4
+ type ProviderRegistrar = (
5
+ id: string,
6
+ config: {
4
7
  name?: string;
5
8
  baseUrl?: string;
6
9
  headers?: Record<string, string>;
7
10
  apiKey?: string;
8
11
  api?: string;
9
12
  models?: ReturnType<typeof toProviderModelConfig>[];
10
- }) => void;
11
- export declare function registerCustomLlmProviders(register: ProviderRegistrar, config: KubbisecLlmConfig): void;
12
- export {};
13
- //# sourceMappingURL=register-custom-llm-providers.d.ts.map
13
+ },
14
+ ) => void;
15
+ export declare function registerCustomLlmProviders(
16
+ register: ProviderRegistrar,
17
+ config: KubbisecLlmConfig,
18
+ ): void;
19
+ //# sourceMappingURL=register-custom-llm-providers.d.ts.map
@@ -1,21 +1,23 @@
1
1
  import { resolveApiKeyValue } from "./llm-config.js";
2
2
  import { toProviderModelConfig } from "./llm-provider-catalog.js";
3
+
3
4
  function registerOneProvider(register, provider) {
4
- const apiKey = resolveApiKeyValue(provider.apiKey) ?? (provider.autodetected ? provider.apiKey : undefined);
5
- register(provider.id, {
6
- name: provider.name?.trim() || provider.id,
7
- baseUrl: provider.baseUrl,
8
- ...(apiKey ? { apiKey } : {}),
9
- api: provider.api ?? "openai-completions",
10
- ...(provider.headers && Object.keys(provider.headers).length > 0
11
- ? { headers: provider.headers }
12
- : {}),
13
- models: provider.models.map(toProviderModelConfig),
14
- });
5
+ const apiKey =
6
+ resolveApiKeyValue(provider.apiKey) ?? (provider.autodetected ? provider.apiKey : undefined);
7
+ register(provider.id, {
8
+ name: provider.name?.trim() || provider.id,
9
+ baseUrl: provider.baseUrl,
10
+ ...(apiKey ? { apiKey } : {}),
11
+ api: provider.api ?? "openai-completions",
12
+ ...(provider.headers && Object.keys(provider.headers).length > 0
13
+ ? { headers: provider.headers }
14
+ : {}),
15
+ models: provider.models.map(toProviderModelConfig),
16
+ });
15
17
  }
16
18
  export function registerCustomLlmProviders(register, config) {
17
- for (const provider of config.providers ?? []) {
18
- registerOneProvider(register, provider);
19
- }
19
+ for (const provider of config.providers ?? []) {
20
+ registerOneProvider(register, provider);
21
+ }
20
22
  }
21
- //# sourceMappingURL=register-custom-llm-providers.js.map
23
+ //# sourceMappingURL=register-custom-llm-providers.js.map
@@ -1,14 +1,18 @@
1
1
  import { toProviderModelConfig } from "./llm-provider-catalog.js";
2
2
  export type KubbisecLlmProviderPiConfig = {
3
- name?: string;
4
- baseUrl?: string;
5
- headers?: Record<string, string>;
6
- apiKey?: string;
7
- api?: string;
8
- models?: ReturnType<typeof toProviderModelConfig>[];
3
+ name?: string;
4
+ baseUrl?: string;
5
+ headers?: Record<string, string>;
6
+ apiKey?: string;
7
+ api?: string;
8
+ models?: ReturnType<typeof toProviderModelConfig>[];
9
9
  };
10
10
  type ProviderRegistrar = (id: string, config: KubbisecLlmProviderPiConfig) => void;
11
- export declare function buildKubbisecLlmProviderConfig(cwd?: string): KubbisecLlmProviderPiConfig | null;
12
- export declare function registerKubbisecLlmProvider(register: ProviderRegistrar, cwd?: string): boolean;
13
- export {};
14
- //# sourceMappingURL=register-kubbisec-llm-provider.d.ts.map
11
+ export declare function buildKubbisecLlmProviderConfig(
12
+ cwd?: string,
13
+ ): KubbisecLlmProviderPiConfig | null;
14
+ export declare function registerKubbisecLlmProvider(
15
+ register: ProviderRegistrar,
16
+ cwd?: string,
17
+ ): boolean;
18
+ //# sourceMappingURL=register-kubbisec-llm-provider.d.ts.map
@@ -1,53 +1,61 @@
1
1
  import { readLlmConfig } from "./llm-config.js";
2
- import { KUBBISEC_LLM_PROVIDER_ID, KUBBISEC_LLM_PROVIDER_NAME, mergeKubbisecModelCatalog, toProviderModelConfig, } from "./llm-provider-catalog.js";
2
+ import {
3
+ KUBBISEC_LLM_PROVIDER_ID,
4
+ KUBBISEC_LLM_PROVIDER_NAME,
5
+ mergeKubbisecModelCatalog,
6
+ toProviderModelConfig,
7
+ } from "./llm-provider-catalog.js";
8
+
3
9
  function resolveLlmBaseUrl() {
4
- return (process.env.KUBBISEC_AI_LLM_BASE_URL?.trim() ||
5
- process.env.KUBBISEC_PI_LLM_BASE_URL?.trim() ||
6
- process.env.OPENAI_BASE_URL?.trim());
10
+ return (
11
+ process.env.KUBBISEC_AI_LLM_BASE_URL?.trim() ||
12
+ process.env.KUBBISEC_PI_LLM_BASE_URL?.trim() ||
13
+ process.env.OPENAI_BASE_URL?.trim()
14
+ );
7
15
  }
8
16
  function resolveModelId(config = readLlmConfig()) {
9
- return (config.defaultModel?.trim() ||
10
- process.env.KUBBISEC_AI_MODEL_ID?.trim() ||
11
- process.env.KUBBISEC_AI_MODEL?.trim() ||
12
- process.env.KUBBISEC_PI_MODEL?.trim() ||
13
- process.env.NAUS_PI_MODEL?.trim() ||
14
- "gpt-4o");
17
+ return (
18
+ config.defaultModel?.trim() ||
19
+ process.env.KUBBISEC_AI_MODEL_ID?.trim() ||
20
+ process.env.KUBBISEC_AI_MODEL?.trim() ||
21
+ process.env.KUBBISEC_PI_MODEL?.trim() ||
22
+ process.env.NAUS_PI_MODEL?.trim() ||
23
+ "gpt-4o"
24
+ );
15
25
  }
16
26
  function resolveProxyHeaders(token) {
17
- const headers = {
18
- Authorization: `Bearer ${token}`,
19
- "x-api-key": token,
20
- };
21
- const orgId = process.env.KUBBISEC_ORG_ID?.trim();
22
- if (orgId)
23
- headers["x-organization-id"] = orgId;
24
- return headers;
27
+ const headers = {
28
+ Authorization: `Bearer ${token}`,
29
+ "x-api-key": token,
30
+ };
31
+ const orgId = process.env.KUBBISEC_ORG_ID?.trim();
32
+ if (orgId) headers["x-organization-id"] = orgId;
33
+ return headers;
25
34
  }
26
35
  export function buildKubbisecLlmProviderConfig(cwd = process.cwd()) {
27
- const baseUrl = resolveLlmBaseUrl();
28
- if (!baseUrl)
29
- return null;
30
- const token = process.env.KUBBISEC_JOB_TOKEN?.trim() ||
31
- process.env.KUBBISEC_API_KEY?.trim() ||
32
- process.env.OPENAI_API_KEY?.trim();
33
- const headers = token ? resolveProxyHeaders(token) : {};
34
- const llmConfig = readLlmConfig(cwd);
35
- const defaultModelId = resolveModelId(llmConfig);
36
- const catalog = mergeKubbisecModelCatalog(defaultModelId, llmConfig.kubbisec?.models);
37
- return {
38
- name: KUBBISEC_LLM_PROVIDER_NAME,
39
- baseUrl,
40
- ...(token ? { apiKey: token } : {}),
41
- api: "openai-completions",
42
- ...(Object.keys(headers).length > 0 ? { headers } : {}),
43
- models: catalog.map(toProviderModelConfig),
44
- };
36
+ const baseUrl = resolveLlmBaseUrl();
37
+ if (!baseUrl) return null;
38
+ const token =
39
+ process.env.KUBBISEC_JOB_TOKEN?.trim() ||
40
+ process.env.KUBBISEC_API_KEY?.trim() ||
41
+ process.env.OPENAI_API_KEY?.trim();
42
+ const headers = token ? resolveProxyHeaders(token) : {};
43
+ const llmConfig = readLlmConfig(cwd);
44
+ const defaultModelId = resolveModelId(llmConfig);
45
+ const catalog = mergeKubbisecModelCatalog(defaultModelId, llmConfig.kubbisec?.models);
46
+ return {
47
+ name: KUBBISEC_LLM_PROVIDER_NAME,
48
+ baseUrl,
49
+ ...(token ? { apiKey: token } : {}),
50
+ api: "openai-completions",
51
+ ...(Object.keys(headers).length > 0 ? { headers } : {}),
52
+ models: catalog.map(toProviderModelConfig),
53
+ };
45
54
  }
46
55
  export function registerKubbisecLlmProvider(register, cwd = process.cwd()) {
47
- const config = buildKubbisecLlmProviderConfig(cwd);
48
- if (!config)
49
- return false;
50
- register(KUBBISEC_LLM_PROVIDER_ID, config);
51
- return true;
56
+ const config = buildKubbisecLlmProviderConfig(cwd);
57
+ if (!config) return false;
58
+ register(KUBBISEC_LLM_PROVIDER_ID, config);
59
+ return true;
52
60
  }
53
- //# sourceMappingURL=register-kubbisec-llm-provider.js.map
61
+ //# sourceMappingURL=register-kubbisec-llm-provider.js.map
@@ -1,4 +1,4 @@
1
1
  export declare function findAgentsContextFile(startDir: string): string | undefined;
2
2
  export declare function formatAgentsContextLabel(filePath: string, home?: string): string;
3
3
  export declare function formatKubbisecContextStatus(filePath: string, home?: string): string;
4
- //# sourceMappingURL=resolve-agents-context-file.d.ts.map
4
+ //# sourceMappingURL=resolve-agents-context-file.d.ts.map