@kubbisec/ai-linux-arm64 0.1.21 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/bundled/clarify/clarify-gate-state.d.ts +1 -1
  2. package/bundled/clarify/clarify-gate-state.js +3 -3
  3. package/bundled/clarify/clarify-gate.d.ts +21 -14
  4. package/bundled/clarify/clarify-gate.js +118 -111
  5. package/bundled/clarify/clarify-select-panel.d.ts +16 -9
  6. package/bundled/clarify/clarify-select-panel.js +65 -67
  7. package/bundled/clarify/clarify-ui-state.d.ts +12 -10
  8. package/bundled/clarify/clarify-ui-state.js +26 -26
  9. package/bundled/clarify/parse-clarify-answer.d.ts +29 -18
  10. package/bundled/clarify/parse-clarify-answer.js +39 -45
  11. package/bundled/clarify/question-format.d.ts +34 -23
  12. package/bundled/clarify/question-format.js +112 -119
  13. package/bundled/clarify/questionnaire-tool.d.ts +28 -17
  14. package/bundled/clarify/questionnaire-tool.js +180 -144
  15. package/bundled/clarify/scope-discovery.d.ts +8 -5
  16. package/bundled/clarify/scope-discovery.js +102 -110
  17. package/bundled/clarify/session-questionnaire.d.ts +48 -13
  18. package/bundled/clarify/session-questionnaire.js +304 -312
  19. package/bundled/clarify/session-questionnaire.types.d.ts +29 -27
  20. package/bundled/clarify/session-questionnaire.types.js +10 -10
  21. package/bundled/components/kubbisec-model-selector.d.ts +47 -34
  22. package/bundled/components/kubbisec-model-selector.js +187 -177
  23. package/bundled/config/config.d.ts +6 -6
  24. package/bundled/config/config.js +55 -55
  25. package/bundled/config/detect-local-llm-providers.d.ts +26 -16
  26. package/bundled/config/detect-local-llm-providers.js +130 -142
  27. package/bundled/config/ensure-kubbisec-project-settings.d.ts +9 -9
  28. package/bundled/config/ensure-kubbisec-project-settings.js +44 -48
  29. package/bundled/config/extended-context.d.ts +5 -6
  30. package/bundled/config/extended-context.js +23 -22
  31. package/bundled/config/feature-flags.d.ts +10 -2
  32. package/bundled/config/feature-flags.js +8 -2
  33. package/bundled/config/format-kubbisec-footer-status.d.ts +1 -1
  34. package/bundled/config/format-kubbisec-footer-status.js +26 -31
  35. package/bundled/config/kubbisec-extension-manifest.d.ts +22 -2
  36. package/bundled/config/kubbisec-extension-manifest.js +20 -20
  37. package/bundled/config/llm-config-mutations.d.ts +51 -25
  38. package/bundled/config/llm-config-mutations.js +173 -182
  39. package/bundled/config/llm-config.d.ts +54 -41
  40. package/bundled/config/llm-config.js +199 -199
  41. package/bundled/config/llm-provider-catalog.d.ts +18 -15
  42. package/bundled/config/llm-provider-catalog.js +45 -46
  43. package/bundled/config/materialize-kubbisec-pi-resources.d.ts +1 -1
  44. package/bundled/config/materialize-kubbisec-pi-resources.js +174 -183
  45. package/bundled/config/register-custom-llm-providers.d.ts +11 -5
  46. package/bundled/config/register-custom-llm-providers.js +17 -15
  47. package/bundled/config/register-kubbisec-llm-provider.d.ts +14 -10
  48. package/bundled/config/register-kubbisec-llm-provider.js +50 -42
  49. package/bundled/config/resolve-agents-context-file.d.ts +1 -1
  50. package/bundled/config/resolve-agents-context-file.js +33 -34
  51. package/bundled/config/resource-budget.d.ts +12 -12
  52. package/bundled/config/resource-budget.js +28 -28
  53. package/bundled/config/sync-kubbisec-pi-models.d.ts +6 -3
  54. package/bundled/config/sync-kubbisec-pi-models.js +58 -58
  55. package/bundled/copy/cli-reference-index.d.ts +3 -2
  56. package/bundled/copy/cli-reference-index.js +1 -1
  57. package/bundled/copy/kubbisec-shell-copy.d.ts +11 -6
  58. package/bundled/copy/kubbisec-shell-copy.js +1 -1
  59. package/bundled/extensions/cli-local-shared.d.ts +45 -26
  60. package/bundled/extensions/cli-local-shared.js +128 -118
  61. package/bundled/extensions/kubbisec-aspm-local.extension.d.ts +18 -15
  62. package/bundled/extensions/kubbisec-aspm-local.extension.js +118 -114
  63. package/bundled/extensions/kubbisec-brand.extension.d.ts +1 -1
  64. package/bundled/extensions/kubbisec-brand.extension.js +25 -25
  65. package/bundled/extensions/kubbisec-byok-provider.extension.d.ts +1 -1
  66. package/bundled/extensions/kubbisec-byok-provider.extension.js +2 -2
  67. package/bundled/extensions/kubbisec-clarify.extension.d.ts +64 -35
  68. package/bundled/extensions/kubbisec-clarify.extension.js +323 -305
  69. package/bundled/extensions/kubbisec-exit.extension.d.ts +1 -1
  70. package/bundled/extensions/kubbisec-exit.extension.js +29 -32
  71. package/bundled/extensions/kubbisec-extended-context.extension.d.ts +1 -1
  72. package/bundled/extensions/kubbisec-extended-context.extension.js +56 -43
  73. package/bundled/extensions/kubbisec-footer.extension.d.ts +14 -14
  74. package/bundled/extensions/kubbisec-footer.extension.js +205 -215
  75. package/bundled/extensions/kubbisec-github-local.extension.d.ts +26 -18
  76. package/bundled/extensions/kubbisec-github-local.extension.js +123 -116
  77. package/bundled/extensions/kubbisec-llm-config.extension.d.ts +1 -1
  78. package/bundled/extensions/kubbisec-llm-config.extension.js +200 -181
  79. package/bundled/extensions/kubbisec-memory.extension.d.ts +9 -7
  80. package/bundled/extensions/kubbisec-memory.extension.js +88 -95
  81. package/bundled/extensions/kubbisec-naus-local.extension.d.ts +18 -15
  82. package/bundled/extensions/kubbisec-naus-local.extension.js +132 -111
  83. package/bundled/extensions/kubbisec-platform-tools.extension.d.ts +31 -21
  84. package/bundled/extensions/kubbisec-platform-tools.extension.js +152 -152
  85. package/bundled/extensions/kubbisec-runtime-status.extension.d.ts +10 -8
  86. package/bundled/extensions/kubbisec-runtime-status.extension.js +15 -13
  87. package/bundled/extensions/kubbisec-scope.extension.d.ts +12 -7
  88. package/bundled/extensions/kubbisec-scope.extension.js +13 -13
  89. package/bundled/extensions/kubbisec-skill-mentions.extension.d.ts +27 -16
  90. package/bundled/extensions/kubbisec-skill-mentions.extension.js +73 -63
  91. package/bundled/extensions/kubbisec-skill-telemetry.extension.d.ts +2 -3
  92. package/bundled/extensions/kubbisec-skill-telemetry.extension.js +59 -64
  93. package/bundled/extensions/kubbisec-theme-lock.extension.d.ts +1 -1
  94. package/bundled/extensions/kubbisec-theme-lock.extension.js +33 -34
  95. package/bundled/extensions/kubbisec-ui.extension.d.ts +1 -1
  96. package/bundled/extensions/kubbisec-ui.extension.js +114 -109
  97. package/bundled/extensions/kubbisec-workflow.extension.d.ts +20 -18
  98. package/bundled/extensions/kubbisec-workflow.extension.js +138 -140
  99. package/bundled/node_modules/@aspm/shared/dist/redaction.test.d.ts +2 -0
  100. package/bundled/node_modules/@aspm/shared/dist/redaction.test.d.ts.map +1 -0
  101. package/bundled/node_modules/@aspm/shared/dist/redaction.test.js +626 -0
  102. package/bundled/node_modules/@aspm/shared/dist/redaction.test.js.map +1 -0
  103. package/bundled/resolve-bundled-dist-root.js +122 -131
  104. package/bundled/skills/at-path-mentions.d.ts +1 -1
  105. package/bundled/skills/at-path-mentions.js +146 -153
  106. package/bundled/skills/chat-mention-render.d.ts +2 -2
  107. package/bundled/skills/chat-mention-render.js +121 -126
  108. package/bundled/skills/chat-mentions.d.ts +17 -8
  109. package/bundled/skills/chat-mentions.js +76 -76
  110. package/bundled/skills/list-bundled-skills.d.ts +3 -3
  111. package/bundled/skills/list-bundled-skills.js +33 -35
  112. package/bundled/skills/skill-mention.d.ts +10 -2
  113. package/bundled/skills/skill-mention.js +10 -2
  114. package/bundled/theme/clear-terminal.d.ts +1 -1
  115. package/bundled/theme/clear-terminal.js +3 -4
  116. package/bundled/theme/footer-render-hook.d.ts +1 -1
  117. package/bundled/theme/footer-render-hook.js +3 -3
  118. package/bundled/theme/kubbisec-brand-fg.d.ts +1 -1
  119. package/bundled/theme/kubbisec-brand-fg.js +2 -2
  120. package/bundled/theme/kubbisec-menu-themes.d.ts +7 -7
  121. package/bundled/theme/kubbisec-menu-themes.js +30 -31
  122. package/bundled/theme/kubbisec-theme-name.d.ts +1 -1
  123. package/bundled/theme/kubbisec-theme-name.js +1 -1
  124. package/bundled/theme/patch-pi-settings-theme.runtime.d.ts +1 -1
  125. package/bundled/theme/patch-pi-settings-theme.runtime.js +11 -10
  126. package/bundled/theme/render-compact-header.d.ts +13 -5
  127. package/bundled/theme/render-compact-header.js +127 -129
  128. package/bundled/workflow/session-workflow-mode.d.ts +1 -1
  129. package/bundled/workflow/session-workflow-mode.js +33 -33
  130. package/package.json +1 -1
@@ -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 { 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
- "clarify",
23
- "copy",
24
- "workflow",
25
- "theme",
26
- "skills",
27
- "assets",
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
- if (!fs.existsSync(dir))
32
- return [];
33
- return fs
34
- .readdirSync(dir)
35
- .filter((name) => name.startsWith(KUBBISEC_EXTENSION_PREFIX) && name.endsWith(".js"))
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
- if (!fs.existsSync(dir))
40
- return [];
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
- const out = [];
45
- const scanDir = prefix ? path.join(root, prefix) : root;
46
- if (!fs.existsSync(scanDir))
47
- 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
- }
53
- else {
54
- out.push(rel);
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
- 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))
80
- continue;
81
- hash.update(file);
82
- hash.update(fs.readFileSync(full));
83
- }
84
- for (const scope of WORKSPACE_MODULE_SCOPES) {
85
- const scopeRoot = path.join(sourceRoot, "node_modules", scope);
86
- if (!fs.existsSync(scopeRoot))
87
- continue;
88
- for (const rel of listFilesRecursive(scopeRoot)) {
89
- hash.update(`node_modules/${scope}/${rel}`);
90
- hash.update(fs.readFileSync(path.join(scopeRoot, rel)));
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
- if (!fs.existsSync(targetDir))
97
- return;
98
- for (const name of fs.readdirSync(targetDir)) {
99
- const isKubbisecEntry = name.startsWith(KUBBISEC_EXTENSION_PREFIX) && name.endsWith(".js");
100
- const isSupport = EXTENSION_SUPPORT_FILES.includes(name);
101
- if (isKubbisecEntry || isSupport) {
102
- fs.unlinkSync(path.join(targetDir, name));
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
- for (const dir of AGENT_SUPPORT_DIRS) {
108
- const source = path.join(sourceRoot, dir);
109
- if (!fs.existsSync(source))
110
- continue;
111
- const target = path.join(agentRoot, dir);
112
- fs.rmSync(target, { recursive: true, force: true });
113
- fs.cpSync(source, target, { recursive: true });
114
- }
115
- for (const file of AGENT_ROOT_FILES) {
116
- const source = path.join(sourceRoot, file);
117
- if (!fs.existsSync(source))
118
- continue;
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
- const sourceModules = path.join(sourceRoot, "node_modules");
124
- if (!fs.existsSync(sourceModules))
125
- return;
126
- const targetModules = path.join(agentRoot, "node_modules");
127
- for (const scope of WORKSPACE_MODULE_SCOPES) {
128
- const scopeSrc = path.join(sourceModules, scope);
129
- if (!fs.existsSync(scopeSrc))
130
- continue;
131
- const scopeDest = path.join(targetModules, scope);
132
- fs.mkdirSync(path.dirname(scopeDest), { recursive: true, mode: 0o755 });
133
- fs.rmSync(scopeDest, { recursive: true, force: true });
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
- const packagesRoot = path.join(sourceRoot, "..", "..");
139
- const targetModules = path.join(agentRoot, "node_modules");
140
- for (const { name, packageDir } of MONOREPO_WORKSPACE_PACKAGES) {
141
- const pkgRoot = path.join(packagesRoot, packageDir);
142
- const distSrc = path.join(pkgRoot, "dist");
143
- const pkgJsonPath = path.join(pkgRoot, "package.json");
144
- if (!fs.existsSync(distSrc) || !fs.existsSync(pkgJsonPath))
145
- continue;
146
- const dest = path.join(targetModules, name);
147
- fs.mkdirSync(dest, { recursive: true, mode: 0o755 });
148
- fs.copyFileSync(pkgJsonPath, path.join(dest, "package.json"));
149
- fs.cpSync(distSrc, path.join(dest, "dist"), { recursive: true });
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
- const bundledModules = path.join(sourceRoot, "node_modules", "@kubbisec", "home");
154
- if (fs.existsSync(bundledModules)) {
155
- copyBundledWorkspaceModules(sourceRoot, agentRoot);
156
- return;
157
- }
158
- copyMonorepoWorkspaceModules(sourceRoot, agentRoot);
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
- const stampPath = path.join(agentRoot, FINGERPRINT_FILE);
162
- try {
163
- if (fs.readFileSync(stampPath, "utf8").trim() !== fingerprint)
164
- return false;
165
- }
166
- catch {
167
- return false;
168
- }
169
- return (fs.existsSync(path.join(agentRoot, "config", "register-kubbisec-llm-provider.js")) &&
170
- fs.existsSync(path.join(agentRoot, "node_modules", "@kubbisec", "home", "dist", "index.js")));
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
- const targetDir = path.join(root, "extensions");
174
- const paths = [];
175
- for (const base of KUBBISEC_EXTENSION_BASENAMES) {
176
- const full = path.join(targetDir, `${base}.js`);
177
- if (fs.existsSync(full)) {
178
- paths.push(full);
179
- }
180
- }
181
- return paths;
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
- const packaged = resolvePackagedBundledDistDir();
192
- if (packaged) {
193
- return resolveExtensionPathsFromRoot(packaged);
194
- }
195
- const sourceRoot = resolveBundledDistRoot();
196
- const sourceDir = path.join(sourceRoot, "extensions");
197
- const sourceNames = listKubbisecExtensionFiles(sourceDir);
198
- const supportNames = listExtensionSupportFiles(sourceDir);
199
- if (sourceNames.length === 0)
200
- return [];
201
- const agentRoot = path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR);
202
- const targetDir = path.join(agentRoot, "extensions");
203
- fs.mkdirSync(targetDir, { recursive: true, mode: 0o755 });
204
- const fingerprint = fingerprintBundledAgentRuntime(sourceRoot, sourceNames, supportNames);
205
- const extensionsUpToDate = supportLayoutUpToDate(agentRoot, fingerprint) &&
206
- sourceNames.every((name) => fs.existsSync(path.join(targetDir, name))) &&
207
- supportNames.every((name) => fs.existsSync(path.join(targetDir, name)));
208
- if (!extensionsUpToDate) {
209
- removeStaleKubbisecExtensions(targetDir);
210
- for (const name of [...sourceNames, ...supportNames]) {
211
- fs.copyFileSync(path.join(sourceDir, name), path.join(targetDir, name));
212
- }
213
- copySupportDirs(sourceRoot, agentRoot);
214
- copyWorkspaceModules(sourceRoot, agentRoot);
215
- fs.writeFileSync(path.join(agentRoot, FINGERPRINT_FILE), `${fingerprint}\n`, "utf8");
216
- }
217
- return listKubbisecExtensionFiles(targetDir).map((name) => path.join(targetDir, name));
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
- const source = path.join(resolveBundledDistRoot(), "theme", `${KUBBISEC_THEME_NAME}.json`);
222
- if (!fs.existsSync(source))
223
- return;
224
- const targetDir = path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR, "themes");
225
- fs.mkdirSync(targetDir, { recursive: true, mode: 0o755 });
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
- materializeKubbisecAgentExtensions(cwd);
231
- const packaged = resolvePackagedBundledDistDir();
232
- if (packaged) {
233
- return resolveExtensionPathsFromRoot(packaged);
234
- }
235
- return resolveExtensionPathsFromRoot(path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR));
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
- 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