@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.
- package/bundled/clarify/clarify-gate-state.d.ts +1 -1
- package/bundled/clarify/clarify-gate-state.js +3 -3
- package/bundled/clarify/clarify-gate.d.ts +21 -14
- package/bundled/clarify/clarify-gate.js +118 -111
- package/bundled/clarify/clarify-select-panel.d.ts +16 -9
- package/bundled/clarify/clarify-select-panel.js +65 -67
- package/bundled/clarify/clarify-ui-state.d.ts +12 -10
- package/bundled/clarify/clarify-ui-state.js +26 -26
- package/bundled/clarify/parse-clarify-answer.d.ts +29 -18
- package/bundled/clarify/parse-clarify-answer.js +39 -45
- package/bundled/clarify/question-format.d.ts +34 -23
- package/bundled/clarify/question-format.js +112 -119
- package/bundled/clarify/questionnaire-tool.d.ts +28 -17
- package/bundled/clarify/questionnaire-tool.js +180 -144
- package/bundled/clarify/scope-discovery.d.ts +8 -5
- package/bundled/clarify/scope-discovery.js +102 -110
- package/bundled/clarify/session-questionnaire.d.ts +48 -13
- package/bundled/clarify/session-questionnaire.js +304 -312
- package/bundled/clarify/session-questionnaire.types.d.ts +29 -27
- package/bundled/clarify/session-questionnaire.types.js +10 -10
- 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 +55 -55
- 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-kubbisec-project-settings.d.ts +9 -9
- package/bundled/config/ensure-kubbisec-project-settings.js +44 -48
- 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 +22 -2
- package/bundled/config/kubbisec-extension-manifest.js +20 -20
- 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 +174 -183
- 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 +3 -2
- 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 +45 -26
- package/bundled/extensions/cli-local-shared.js +128 -118
- package/bundled/extensions/kubbisec-aspm-local.extension.d.ts +18 -15
- package/bundled/extensions/kubbisec-aspm-local.extension.js +118 -114
- 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 +123 -116
- 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 +132 -111
- 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 +73 -63
- 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 +114 -109
- package/bundled/extensions/kubbisec-workflow.extension.d.ts +20 -18
- package/bundled/extensions/kubbisec-workflow.extension.js +138 -140
- package/bundled/node_modules/@aspm/shared/dist/redaction.test.d.ts +2 -0
- package/bundled/node_modules/@aspm/shared/dist/redaction.test.d.ts.map +1 -0
- package/bundled/node_modules/@aspm/shared/dist/redaction.test.js +626 -0
- package/bundled/node_modules/@aspm/shared/dist/redaction.test.js.map +1 -0
- package/bundled/resolve-bundled-dist-root.js +122 -131
- 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 +127 -129
- 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,184 +1,176 @@
|
|
|
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
|
-
|
|
27
|
-
|
|
24
|
+
"config",
|
|
25
|
+
"components",
|
|
26
|
+
"clarify",
|
|
27
|
+
"copy",
|
|
28
|
+
"workflow",
|
|
29
|
+
"theme",
|
|
30
|
+
"skills",
|
|
31
|
+
"assets",
|
|
28
32
|
];
|
|
29
33
|
const AGENT_ROOT_FILES = ["resolve-bundled-dist-root.js"];
|
|
30
34
|
function listKubbisecExtensionFiles(dir) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
.sort();
|
|
35
|
+
if (!fs.existsSync(dir)) return [];
|
|
36
|
+
return fs
|
|
37
|
+
.readdirSync(dir)
|
|
38
|
+
.filter((name) => name.startsWith(KUBBISEC_EXTENSION_PREFIX) && name.endsWith(".js"))
|
|
39
|
+
.sort();
|
|
37
40
|
}
|
|
38
41
|
function listExtensionSupportFiles(dir) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return EXTENSION_SUPPORT_FILES.filter((name) => fs.existsSync(path.join(dir, name)));
|
|
42
|
+
if (!fs.existsSync(dir)) return [];
|
|
43
|
+
return EXTENSION_SUPPORT_FILES.filter((name) => fs.existsSync(path.join(dir, name)));
|
|
42
44
|
}
|
|
43
45
|
function listFilesRecursive(root, prefix = "") {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
return out.sort();
|
|
46
|
+
const out = [];
|
|
47
|
+
const scanDir = prefix ? path.join(root, prefix) : root;
|
|
48
|
+
if (!fs.existsSync(scanDir)) return out;
|
|
49
|
+
for (const entry of fs.readdirSync(scanDir, { withFileTypes: true })) {
|
|
50
|
+
const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
51
|
+
if (entry.isDirectory()) {
|
|
52
|
+
out.push(...listFilesRecursive(root, rel));
|
|
53
|
+
} else {
|
|
54
|
+
out.push(rel);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return out.sort();
|
|
58
58
|
}
|
|
59
59
|
function fingerprintBundledAgentRuntime(sourceRoot, extensionNames, supportNames) {
|
|
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
|
-
}
|
|
93
|
-
return hash.digest("hex").slice(0, 16);
|
|
60
|
+
const hash = crypto.createHash("sha256");
|
|
61
|
+
const extensionsDir = path.join(sourceRoot, "extensions");
|
|
62
|
+
for (const name of extensionNames) {
|
|
63
|
+
hash.update(`extensions/${name}`);
|
|
64
|
+
hash.update(fs.readFileSync(path.join(extensionsDir, name)));
|
|
65
|
+
}
|
|
66
|
+
for (const name of supportNames) {
|
|
67
|
+
hash.update(`extensions/${name}`);
|
|
68
|
+
hash.update(fs.readFileSync(path.join(extensionsDir, name)));
|
|
69
|
+
}
|
|
70
|
+
for (const dir of AGENT_SUPPORT_DIRS) {
|
|
71
|
+
const base = path.join(sourceRoot, dir);
|
|
72
|
+
for (const rel of listFilesRecursive(base)) {
|
|
73
|
+
hash.update(`${dir}/${rel}`);
|
|
74
|
+
hash.update(fs.readFileSync(path.join(base, rel)));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
for (const file of AGENT_ROOT_FILES) {
|
|
78
|
+
const full = path.join(sourceRoot, file);
|
|
79
|
+
if (!fs.existsSync(full)) 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)) continue;
|
|
86
|
+
for (const rel of listFilesRecursive(scopeRoot)) {
|
|
87
|
+
hash.update(`node_modules/${scope}/${rel}`);
|
|
88
|
+
hash.update(fs.readFileSync(path.join(scopeRoot, rel)));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return hash.digest("hex").slice(0, 16);
|
|
94
92
|
}
|
|
95
93
|
function removeStaleKubbisecExtensions(targetDir) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
94
|
+
if (!fs.existsSync(targetDir)) return;
|
|
95
|
+
for (const name of fs.readdirSync(targetDir)) {
|
|
96
|
+
const isKubbisecEntry = name.startsWith(KUBBISEC_EXTENSION_PREFIX) && name.endsWith(".js");
|
|
97
|
+
const isSupport = EXTENSION_SUPPORT_FILES.includes(name);
|
|
98
|
+
if (isKubbisecEntry || isSupport) {
|
|
99
|
+
fs.unlinkSync(path.join(targetDir, name));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
105
102
|
}
|
|
106
103
|
function copySupportDirs(sourceRoot, agentRoot) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
fs.copyFileSync(source, path.join(agentRoot, file));
|
|
120
|
-
}
|
|
104
|
+
for (const dir of AGENT_SUPPORT_DIRS) {
|
|
105
|
+
const source = path.join(sourceRoot, dir);
|
|
106
|
+
if (!fs.existsSync(source)) continue;
|
|
107
|
+
const target = path.join(agentRoot, dir);
|
|
108
|
+
fs.rmSync(target, { recursive: true, force: true });
|
|
109
|
+
fs.cpSync(source, target, { recursive: true });
|
|
110
|
+
}
|
|
111
|
+
for (const file of AGENT_ROOT_FILES) {
|
|
112
|
+
const source = path.join(sourceRoot, file);
|
|
113
|
+
if (!fs.existsSync(source)) continue;
|
|
114
|
+
fs.copyFileSync(source, path.join(agentRoot, file));
|
|
115
|
+
}
|
|
121
116
|
}
|
|
122
117
|
function copyBundledWorkspaceModules(sourceRoot, agentRoot) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
fs.cpSync(scopeSrc, scopeDest, { recursive: true });
|
|
135
|
-
}
|
|
118
|
+
const sourceModules = path.join(sourceRoot, "node_modules");
|
|
119
|
+
if (!fs.existsSync(sourceModules)) return;
|
|
120
|
+
const targetModules = path.join(agentRoot, "node_modules");
|
|
121
|
+
for (const scope of WORKSPACE_MODULE_SCOPES) {
|
|
122
|
+
const scopeSrc = path.join(sourceModules, scope);
|
|
123
|
+
if (!fs.existsSync(scopeSrc)) continue;
|
|
124
|
+
const scopeDest = path.join(targetModules, scope);
|
|
125
|
+
fs.mkdirSync(path.dirname(scopeDest), { recursive: true, mode: 0o755 });
|
|
126
|
+
fs.rmSync(scopeDest, { recursive: true, force: true });
|
|
127
|
+
fs.cpSync(scopeSrc, scopeDest, { recursive: true });
|
|
128
|
+
}
|
|
136
129
|
}
|
|
137
130
|
function copyMonorepoWorkspaceModules(sourceRoot, agentRoot) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
131
|
+
const packagesRoot = path.join(sourceRoot, "..", "..");
|
|
132
|
+
const targetModules = path.join(agentRoot, "node_modules");
|
|
133
|
+
for (const { name, packageDir } of MONOREPO_WORKSPACE_PACKAGES) {
|
|
134
|
+
const pkgRoot = path.join(packagesRoot, packageDir);
|
|
135
|
+
const distSrc = path.join(pkgRoot, "dist");
|
|
136
|
+
const pkgJsonPath = path.join(pkgRoot, "package.json");
|
|
137
|
+
if (!fs.existsSync(distSrc) || !fs.existsSync(pkgJsonPath)) continue;
|
|
138
|
+
const dest = path.join(targetModules, name);
|
|
139
|
+
fs.mkdirSync(dest, { recursive: true, mode: 0o755 });
|
|
140
|
+
fs.copyFileSync(pkgJsonPath, path.join(dest, "package.json"));
|
|
141
|
+
fs.cpSync(distSrc, path.join(dest, "dist"), { recursive: true });
|
|
142
|
+
}
|
|
151
143
|
}
|
|
152
144
|
function copyWorkspaceModules(sourceRoot, agentRoot) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
145
|
+
const bundledModules = path.join(sourceRoot, "node_modules", "@kubbisec", "home");
|
|
146
|
+
if (fs.existsSync(bundledModules)) {
|
|
147
|
+
copyBundledWorkspaceModules(sourceRoot, agentRoot);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
copyMonorepoWorkspaceModules(sourceRoot, agentRoot);
|
|
159
151
|
}
|
|
160
152
|
function supportLayoutUpToDate(agentRoot, fingerprint) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
153
|
+
const stampPath = path.join(agentRoot, FINGERPRINT_FILE);
|
|
154
|
+
try {
|
|
155
|
+
if (fs.readFileSync(stampPath, "utf8").trim() !== fingerprint) return false;
|
|
156
|
+
} catch {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
return (
|
|
160
|
+
fs.existsSync(path.join(agentRoot, "config", "register-kubbisec-llm-provider.js")) &&
|
|
161
|
+
fs.existsSync(path.join(agentRoot, "node_modules", "@kubbisec", "home", "dist", "index.js"))
|
|
162
|
+
);
|
|
171
163
|
}
|
|
172
164
|
function resolveExtensionPathsFromRoot(root) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
165
|
+
const targetDir = path.join(root, "extensions");
|
|
166
|
+
const paths = [];
|
|
167
|
+
for (const base of KUBBISEC_EXTENSION_BASENAMES) {
|
|
168
|
+
const full = path.join(targetDir, `${base}.js`);
|
|
169
|
+
if (fs.existsSync(full)) {
|
|
170
|
+
paths.push(full);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return paths;
|
|
182
174
|
}
|
|
183
175
|
/**
|
|
184
176
|
* Copy bundled KubbiSec extensions into `<cwd>/.kubbisec/` so the runtime loads them
|
|
@@ -188,51 +180,50 @@ function resolveExtensionPathsFromRoot(root) {
|
|
|
188
180
|
* matching dist folders are mirrored under `<cwd>/.kubbisec/`.
|
|
189
181
|
*/
|
|
190
182
|
export function materializeKubbisecAgentExtensions(cwd = process.cwd()) {
|
|
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
|
-
|
|
217
|
-
|
|
183
|
+
const packaged = resolvePackagedBundledDistDir();
|
|
184
|
+
if (packaged) {
|
|
185
|
+
return resolveExtensionPathsFromRoot(packaged);
|
|
186
|
+
}
|
|
187
|
+
const sourceRoot = resolveBundledDistRoot();
|
|
188
|
+
const sourceDir = path.join(sourceRoot, "extensions");
|
|
189
|
+
const sourceNames = listKubbisecExtensionFiles(sourceDir);
|
|
190
|
+
const supportNames = listExtensionSupportFiles(sourceDir);
|
|
191
|
+
if (sourceNames.length === 0) return [];
|
|
192
|
+
const agentRoot = path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR);
|
|
193
|
+
const targetDir = path.join(agentRoot, "extensions");
|
|
194
|
+
fs.mkdirSync(targetDir, { recursive: true, mode: 0o755 });
|
|
195
|
+
const fingerprint = fingerprintBundledAgentRuntime(sourceRoot, sourceNames, supportNames);
|
|
196
|
+
const extensionsUpToDate =
|
|
197
|
+
supportLayoutUpToDate(agentRoot, fingerprint) &&
|
|
198
|
+
sourceNames.every((name) => fs.existsSync(path.join(targetDir, name))) &&
|
|
199
|
+
supportNames.every((name) => fs.existsSync(path.join(targetDir, name)));
|
|
200
|
+
if (!extensionsUpToDate) {
|
|
201
|
+
removeStaleKubbisecExtensions(targetDir);
|
|
202
|
+
for (const name of [...sourceNames, ...supportNames]) {
|
|
203
|
+
fs.copyFileSync(path.join(sourceDir, name), path.join(targetDir, name));
|
|
204
|
+
}
|
|
205
|
+
copySupportDirs(sourceRoot, agentRoot);
|
|
206
|
+
copyWorkspaceModules(sourceRoot, agentRoot);
|
|
207
|
+
fs.writeFileSync(path.join(agentRoot, FINGERPRINT_FILE), `${fingerprint}\n`, "utf8");
|
|
208
|
+
}
|
|
209
|
+
return listKubbisecExtensionFiles(targetDir).map((name) => path.join(targetDir, name));
|
|
218
210
|
}
|
|
219
211
|
/** Pin KubbiSec theme under `<cwd>/.kubbisec/themes/` for runtime project discovery. */
|
|
220
212
|
export function materializeKubbisecAgentTheme(cwd = process.cwd()) {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
fs.copyFileSync(source, path.join(targetDir, `${KUBBISEC_THEME_NAME}.json`));
|
|
213
|
+
const source = path.join(resolveBundledDistRoot(), "theme", `${KUBBISEC_THEME_NAME}.json`);
|
|
214
|
+
if (!fs.existsSync(source)) return;
|
|
215
|
+
const targetDir = path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR, "themes");
|
|
216
|
+
fs.mkdirSync(targetDir, { recursive: true, mode: 0o755 });
|
|
217
|
+
fs.copyFileSync(source, path.join(targetDir, `${KUBBISEC_THEME_NAME}.json`));
|
|
227
218
|
}
|
|
228
219
|
/** Extension paths in manifest load order (for explicit `-e` flags). */
|
|
229
220
|
export function resolveKubbisecAgentExtensionPaths(cwd = process.cwd()) {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
221
|
+
materializeKubbisecAgentExtensions(cwd);
|
|
222
|
+
const packaged = resolvePackagedBundledDistDir();
|
|
223
|
+
if (packaged) {
|
|
224
|
+
return resolveExtensionPathsFromRoot(packaged);
|
|
225
|
+
}
|
|
226
|
+
return resolveExtensionPathsFromRoot(path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR));
|
|
236
227
|
}
|
|
237
228
|
/** @deprecated Use materializeKubbisecAgentExtensions */
|
|
238
229
|
export const materializeKubbisecPiExtensions = materializeKubbisecAgentExtensions;
|
|
@@ -240,4 +231,4 @@ export const materializeKubbisecPiExtensions = materializeKubbisecAgentExtension
|
|
|
240
231
|
export const materializeKubbisecPiTheme = materializeKubbisecAgentTheme;
|
|
241
232
|
/** @deprecated Use resolveKubbisecAgentExtensionPaths */
|
|
242
233
|
export const resolveKubbisecPiExtensionPaths = resolveKubbisecAgentExtensionPaths;
|
|
243
|
-
//# sourceMappingURL=materialize-kubbisec-pi-resources.js.map
|
|
234
|
+
//# 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
|