@kubbisec/ai-linux-x64 0.1.22 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/kubbisec +0 -0
- package/bundled/components/kubbisec-model-selector.d.ts +47 -34
- package/bundled/components/kubbisec-model-selector.js +187 -177
- package/bundled/config/config.d.ts +6 -6
- package/bundled/config/config.js +54 -52
- package/bundled/config/detect-local-llm-providers.d.ts +26 -16
- package/bundled/config/detect-local-llm-providers.js +130 -142
- package/bundled/config/ensure-kbs-project-settings.d.ts +8 -8
- package/bundled/config/ensure-kbs-project-settings.js +27 -28
- package/bundled/config/ensure-kubbisec-project-settings.d.ts +9 -9
- package/bundled/config/ensure-kubbisec-project-settings.js +62 -67
- package/bundled/config/extended-context.d.ts +5 -6
- package/bundled/config/extended-context.js +23 -22
- package/bundled/config/feature-flags.d.ts +10 -2
- package/bundled/config/feature-flags.js +8 -2
- package/bundled/config/format-kubbisec-footer-status.d.ts +1 -1
- package/bundled/config/format-kubbisec-footer-status.js +26 -31
- package/bundled/config/kubbisec-extension-manifest.d.ts +21 -2
- package/bundled/config/kubbisec-extension-manifest.js +19 -19
- package/bundled/config/llm-config-mutations.d.ts +51 -25
- package/bundled/config/llm-config-mutations.js +173 -182
- package/bundled/config/llm-config.d.ts +54 -41
- package/bundled/config/llm-config.js +199 -199
- package/bundled/config/llm-provider-catalog.d.ts +18 -15
- package/bundled/config/llm-provider-catalog.js +45 -46
- package/bundled/config/materialize-kubbisec-pi-resources.d.ts +1 -1
- package/bundled/config/materialize-kubbisec-pi-resources.js +173 -182
- package/bundled/config/register-custom-llm-providers.d.ts +11 -5
- package/bundled/config/register-custom-llm-providers.js +17 -15
- package/bundled/config/register-kubbisec-llm-provider.d.ts +14 -10
- package/bundled/config/register-kubbisec-llm-provider.js +50 -42
- package/bundled/config/resolve-agents-context-file.d.ts +1 -1
- package/bundled/config/resolve-agents-context-file.js +33 -34
- package/bundled/config/resource-budget.d.ts +12 -12
- package/bundled/config/resource-budget.js +28 -28
- package/bundled/config/sync-kubbisec-pi-models.d.ts +6 -3
- package/bundled/config/sync-kubbisec-pi-models.js +58 -58
- package/bundled/copy/cli-reference-index.d.ts +1 -1
- package/bundled/copy/cli-reference-index.js +1 -1
- package/bundled/copy/kubbisec-shell-copy.d.ts +11 -6
- package/bundled/copy/kubbisec-shell-copy.js +1 -1
- package/bundled/extensions/cli-local-shared.d.ts +56 -32
- package/bundled/extensions/cli-local-shared.js +135 -125
- package/bundled/extensions/kubbisec-aspm-local.extension.d.ts +18 -15
- package/bundled/extensions/kubbisec-aspm-local.extension.js +109 -106
- package/bundled/extensions/kubbisec-brand.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-brand.extension.js +25 -25
- package/bundled/extensions/kubbisec-byok-provider.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-byok-provider.extension.js +2 -2
- package/bundled/extensions/kubbisec-clarify.extension.d.ts +64 -35
- package/bundled/extensions/kubbisec-clarify.extension.js +323 -305
- package/bundled/extensions/kubbisec-exit.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-exit.extension.js +29 -32
- package/bundled/extensions/kubbisec-extended-context.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-extended-context.extension.js +56 -43
- package/bundled/extensions/kubbisec-footer.extension.d.ts +14 -14
- package/bundled/extensions/kubbisec-footer.extension.js +205 -215
- package/bundled/extensions/kubbisec-github-local.extension.d.ts +26 -18
- package/bundled/extensions/kubbisec-github-local.extension.js +430 -417
- package/bundled/extensions/kubbisec-llm-config.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-llm-config.extension.js +200 -181
- package/bundled/extensions/kubbisec-memory.extension.d.ts +9 -7
- package/bundled/extensions/kubbisec-memory.extension.js +88 -95
- package/bundled/extensions/kubbisec-naus-local.extension.d.ts +18 -15
- package/bundled/extensions/kubbisec-naus-local.extension.js +123 -103
- package/bundled/extensions/kubbisec-platform-tools.extension.d.ts +31 -21
- package/bundled/extensions/kubbisec-platform-tools.extension.js +152 -152
- package/bundled/extensions/kubbisec-runtime-status.extension.d.ts +10 -8
- package/bundled/extensions/kubbisec-runtime-status.extension.js +15 -13
- package/bundled/extensions/kubbisec-scope.extension.d.ts +12 -7
- package/bundled/extensions/kubbisec-scope.extension.js +13 -13
- package/bundled/extensions/kubbisec-skill-mentions.extension.d.ts +27 -16
- package/bundled/extensions/kubbisec-skill-mentions.extension.js +74 -64
- package/bundled/extensions/kubbisec-skill-telemetry.extension.d.ts +2 -3
- package/bundled/extensions/kubbisec-skill-telemetry.extension.js +59 -64
- package/bundled/extensions/kubbisec-theme-lock.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-theme-lock.extension.js +33 -34
- package/bundled/extensions/kubbisec-ui.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-ui.extension.js +90 -92
- package/bundled/extensions/kubbisec-workflow.extension.d.ts +20 -18
- package/bundled/extensions/kubbisec-workflow.extension.js +138 -140
- package/bundled/resolve-bundled-dist-root.js +121 -130
- package/bundled/skills/at-path-mentions.d.ts +1 -1
- package/bundled/skills/at-path-mentions.js +146 -153
- package/bundled/skills/chat-mention-render.d.ts +2 -2
- package/bundled/skills/chat-mention-render.js +121 -126
- package/bundled/skills/chat-mentions.d.ts +17 -8
- package/bundled/skills/chat-mentions.js +76 -76
- package/bundled/skills/list-bundled-skills.d.ts +3 -3
- package/bundled/skills/list-bundled-skills.js +33 -35
- package/bundled/skills/skill-mention.d.ts +10 -2
- package/bundled/skills/skill-mention.js +10 -2
- package/bundled/theme/clear-terminal.d.ts +1 -1
- package/bundled/theme/clear-terminal.js +3 -4
- package/bundled/theme/footer-render-hook.d.ts +1 -1
- package/bundled/theme/footer-render-hook.js +3 -3
- package/bundled/theme/kubbisec-brand-fg.d.ts +1 -1
- package/bundled/theme/kubbisec-brand-fg.js +2 -2
- package/bundled/theme/kubbisec-menu-themes.d.ts +7 -7
- package/bundled/theme/kubbisec-menu-themes.js +30 -31
- package/bundled/theme/kubbisec-theme-name.d.ts +1 -1
- package/bundled/theme/kubbisec-theme-name.js +1 -1
- package/bundled/theme/patch-pi-settings-theme.runtime.d.ts +1 -1
- package/bundled/theme/patch-pi-settings-theme.runtime.js +11 -10
- package/bundled/theme/render-compact-header.d.ts +13 -5
- package/bundled/theme/render-compact-header.js +126 -128
- package/bundled/workflow/session-workflow-mode.d.ts +1 -1
- package/bundled/workflow/session-workflow-mode.js +33 -33
- package/package.json +1 -1
|
@@ -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 {
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
39
|
-
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
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
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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
|
-
|
|
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
|
-
}
|
|
11
|
-
|
|
12
|
-
export
|
|
13
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
18
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 {
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|