@bike4mind/cli 0.2.29-cli-minimal-ui.18783 → 0.2.29-faster-filesearch.18869
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/dist/{artifactExtractor-7Z2TM2RR.js → artifactExtractor-EE753J4D.js} +1 -1
- package/dist/{chunk-ODYASVT6.js → chunk-5GSDPBTM.js} +9 -2
- package/dist/{chunk-4XFX3V4G.js → chunk-BCOGDPUB.js} +15 -15
- package/dist/{chunk-MDG22DS7.js → chunk-ELTTBWAQ.js} +2 -2
- package/dist/{chunk-G7PAI2YH.js → chunk-PKKJ44C5.js} +2 -2
- package/dist/{chunk-HDIXO6H3.js → chunk-S7BPPS33.js} +90 -3
- package/dist/{create-45ZV3EJT.js → create-O3PVSKFE.js} +3 -3
- package/dist/index.js +277 -133
- package/dist/{llmMarkdownGenerator-4HLWASZ4.js → llmMarkdownGenerator-IJKJYJ3U.js} +1 -1
- package/dist/{markdownGenerator-2Y3GWJYH.js → markdownGenerator-SJT7AXLT.js} +1 -1
- package/dist/{mementoService-OVWA5PPV.js → mementoService-PKCNMN4V.js} +3 -3
- package/dist/{src-V6E375BJ.js → src-C5CZFXVM.js} +4 -2
- package/dist/{src-Z6YUBFWA.js → src-GRO5NIC3.js} +3 -1
- package/dist/{subtractCredits-KGQCY6KQ.js → subtractCredits-WZZAP57N.js} +3 -3
- package/dist/treeSitterEngine-4SGFQDY3.js +330 -0
- package/package.json +13 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
CurationArtifactType
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-5GSDPBTM.js";
|
|
5
5
|
|
|
6
6
|
// ../../b4m-core/packages/services/dist/src/notebookCurationService/artifactExtractor.js
|
|
7
7
|
var ARTIFACT_TAG_REGEX = /<artifact\s+(.*?)>([\s\S]*?)<\/artifact>/gi;
|
|
@@ -165,6 +165,7 @@ var ChatModels;
|
|
|
165
165
|
ChatModels2["GROK_3_MINI_FAST"] = "grok-3-mini-fast";
|
|
166
166
|
ChatModels2["GROK_2"] = "grok-2-1212";
|
|
167
167
|
ChatModels2["GROK_2_VISION"] = "grok-2-vision-1212";
|
|
168
|
+
ChatModels2["GROK_4"] = "grok-4-0709";
|
|
168
169
|
ChatModels2["GROK_BETA"] = "grok-beta";
|
|
169
170
|
ChatModels2["GROK_VISION_BETA"] = "grok-vision-beta";
|
|
170
171
|
})(ChatModels || (ChatModels = {}));
|
|
@@ -1982,9 +1983,13 @@ var OPENAI_IMAGE_QUALITIES = ["standard", "hd", "low", "medium", "high"];
|
|
|
1982
1983
|
var OpenAIImageQualitySchema = z16.enum(OPENAI_IMAGE_QUALITIES);
|
|
1983
1984
|
var OPENAI_IMAGE_STYLES = ["vivid", "natural"];
|
|
1984
1985
|
var OpenAIImageStyleSchema = z16.enum(OPENAI_IMAGE_STYLES);
|
|
1986
|
+
var LEGACY_IMAGE_MODEL_MAP = {
|
|
1987
|
+
"dall-e-3": ImageModels.GPT_IMAGE_1,
|
|
1988
|
+
"dall-e-2": ImageModels.GPT_IMAGE_1
|
|
1989
|
+
};
|
|
1985
1990
|
var OpenAIImageGenerationInput = z16.object({
|
|
1986
1991
|
prompt: z16.string(),
|
|
1987
|
-
model: z16.enum(ALL_IMAGE_MODELS),
|
|
1992
|
+
model: z16.preprocess((val) => typeof val === "string" && Object.prototype.hasOwnProperty.call(LEGACY_IMAGE_MODEL_MAP, val) ? LEGACY_IMAGE_MODEL_MAP[val] : val, z16.enum(ALL_IMAGE_MODELS)),
|
|
1988
1993
|
n: z16.number().min(1).max(10).optional(),
|
|
1989
1994
|
quality: OpenAIImageQualitySchema.optional(),
|
|
1990
1995
|
response_format: z16.enum(["b64_json", "url"]).optional(),
|
|
@@ -4041,7 +4046,8 @@ var PromptMetaPerformanceSchema = z23.object({
|
|
|
4041
4046
|
charsPerSecond: z23.number().optional()
|
|
4042
4047
|
}).optional(),
|
|
4043
4048
|
featureExecutionTimes: z23.union([z23.record(z23.string(), z23.number()), z23.map(z23.string(), z23.number())]).optional(),
|
|
4044
|
-
databaseOperationTimes: z23.union([z23.record(z23.string(), z23.number()), z23.map(z23.string(), z23.number())]).optional()
|
|
4049
|
+
databaseOperationTimes: z23.union([z23.record(z23.string(), z23.number()), z23.map(z23.string(), z23.number())]).optional(),
|
|
4050
|
+
phases: z23.record(z23.string(), z23.number()).optional()
|
|
4045
4051
|
});
|
|
4046
4052
|
var PromptMetaSessionSchema = z23.object({
|
|
4047
4053
|
id: z23.string(),
|
|
@@ -7970,6 +7976,7 @@ export {
|
|
|
7970
7976
|
OpenAIImageQualitySchema,
|
|
7971
7977
|
OPENAI_IMAGE_STYLES,
|
|
7972
7978
|
OpenAIImageStyleSchema,
|
|
7979
|
+
LEGACY_IMAGE_MODEL_MAP,
|
|
7973
7980
|
OpenAIImageGenerationInput,
|
|
7974
7981
|
PASSWORD_RULES,
|
|
7975
7982
|
PASSWORD_ERROR_MESSAGES,
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
getSettingsByNames,
|
|
7
7
|
obfuscateApiKey,
|
|
8
8
|
secureParameters
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-S7BPPS33.js";
|
|
10
10
|
import {
|
|
11
11
|
ApiKeyType,
|
|
12
12
|
MementoTier,
|
|
13
13
|
isSupportedEmbeddingModel
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-5GSDPBTM.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/apiKeyService/get.js
|
|
17
17
|
import { z } from "zod";
|
|
@@ -79,15 +79,6 @@ var getEffectiveLLMApiKeys = async (userId, adapters, options) => {
|
|
|
79
79
|
const { db } = adapters;
|
|
80
80
|
const logger = options?.logger;
|
|
81
81
|
const apiKeyFetchStartTime = Date.now();
|
|
82
|
-
const userApiKeys = await getMultipleApiKeys(userId, [ApiKeyType.openai, ApiKeyType.anthropic, ApiKeyType.gemini, ApiKeyType.bfl, ApiKeyType.xai, ApiKeyType.voyageai], adapters);
|
|
83
|
-
const userKeyMap = /* @__PURE__ */ new Map();
|
|
84
|
-
userApiKeys.forEach((key) => userKeyMap.set(key.type, key));
|
|
85
|
-
const openaiUserKey = userKeyMap.get(ApiKeyType.openai) || null;
|
|
86
|
-
const anthropicUserKey = userKeyMap.get(ApiKeyType.anthropic) || null;
|
|
87
|
-
const geminiUserKey = userKeyMap.get(ApiKeyType.gemini) || null;
|
|
88
|
-
const bflUserKey = userKeyMap.get(ApiKeyType.bfl) || null;
|
|
89
|
-
const xaiUserKey = userKeyMap.get(ApiKeyType.xai) || null;
|
|
90
|
-
const voyageaiUserKey = userKeyMap.get(ApiKeyType.voyageai) || null;
|
|
91
82
|
const adminSettingNames = [
|
|
92
83
|
"openaiDemoKey",
|
|
93
84
|
"anthropicDemoKey",
|
|
@@ -98,8 +89,18 @@ var getEffectiveLLMApiKeys = async (userId, adapters, options) => {
|
|
|
98
89
|
"ollamaBackend",
|
|
99
90
|
"EnableOllama"
|
|
100
91
|
];
|
|
101
|
-
const
|
|
102
|
-
|
|
92
|
+
const [userApiKeys, adminSettings] = await Promise.all([
|
|
93
|
+
getMultipleApiKeys(userId, [ApiKeyType.openai, ApiKeyType.anthropic, ApiKeyType.gemini, ApiKeyType.bfl, ApiKeyType.xai, ApiKeyType.voyageai], adapters),
|
|
94
|
+
getSettingsByNames(adminSettingNames, { adminSettings: db.adminSettings }, { logger })
|
|
95
|
+
]);
|
|
96
|
+
const userKeyMap = /* @__PURE__ */ new Map();
|
|
97
|
+
userApiKeys.forEach((key) => userKeyMap.set(key.type, key));
|
|
98
|
+
const openaiUserKey = userKeyMap.get(ApiKeyType.openai) || null;
|
|
99
|
+
const anthropicUserKey = userKeyMap.get(ApiKeyType.anthropic) || null;
|
|
100
|
+
const geminiUserKey = userKeyMap.get(ApiKeyType.gemini) || null;
|
|
101
|
+
const bflUserKey = userKeyMap.get(ApiKeyType.bfl) || null;
|
|
102
|
+
const xaiUserKey = userKeyMap.get(ApiKeyType.xai) || null;
|
|
103
|
+
const voyageaiUserKey = userKeyMap.get(ApiKeyType.voyageai) || null;
|
|
103
104
|
const openaiDemoKey = adminSettings["openaiDemoKey"];
|
|
104
105
|
const anthropicDemoKey = adminSettings["anthropicDemoKey"];
|
|
105
106
|
const geminiDemoKey = adminSettings["geminiDemoKey"];
|
|
@@ -108,10 +109,9 @@ var getEffectiveLLMApiKeys = async (userId, adapters, options) => {
|
|
|
108
109
|
const voyageaiDemoKey = adminSettings["voyageApiKey"];
|
|
109
110
|
const ollamaBackend = adminSettings["ollamaBackend"];
|
|
110
111
|
const enableOllama = adminSettings["EnableOllama"];
|
|
111
|
-
const adminSettingsTime = Date.now() - adminSettingsStartTime;
|
|
112
112
|
const totalTime = Date.now() - apiKeyFetchStartTime;
|
|
113
113
|
if (logger) {
|
|
114
|
-
logger.info(`\u{1F4E6}
|
|
114
|
+
logger.info(`\u{1F4E6} API key + admin settings parallel fetch completed in ${totalTime}ms`);
|
|
115
115
|
}
|
|
116
116
|
const ollamaEnabled = enableOllama === "true" || enableOllama === true;
|
|
117
117
|
const keyOrExpired = (apiKey) => {
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
getSettingsMap,
|
|
8
8
|
getSettingsValue,
|
|
9
9
|
secureParameters
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-S7BPPS33.js";
|
|
11
11
|
import {
|
|
12
12
|
KnowledgeType,
|
|
13
13
|
SupportedFabFileMimeTypes
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-5GSDPBTM.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/fabFileService/create.js
|
|
17
17
|
import { z } from "zod";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
BadRequestError,
|
|
4
4
|
secureParameters
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-S7BPPS33.js";
|
|
6
6
|
import {
|
|
7
7
|
CompletionApiUsageTransaction,
|
|
8
8
|
GenericCreditDeductTransaction,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
TextGenerationUsageTransaction,
|
|
13
13
|
TransferCreditTransaction,
|
|
14
14
|
VideoGenerationUsageTransaction
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-5GSDPBTM.js";
|
|
16
16
|
|
|
17
17
|
// ../../b4m-core/packages/services/dist/src/creditService/subtractCredits.js
|
|
18
18
|
import { z } from "zod";
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
dayjsConfig_default,
|
|
16
16
|
extractSnippetMeta,
|
|
17
17
|
settingsMap
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-5GSDPBTM.js";
|
|
19
19
|
import {
|
|
20
20
|
Logger
|
|
21
21
|
} from "./chunk-OCYRD7D6.js";
|
|
@@ -1285,11 +1285,14 @@ async function processFabFilesServer(embeddingFactory, fabFiles, userPrompt, max
|
|
|
1285
1285
|
}
|
|
1286
1286
|
switch (modelInfo?.backend) {
|
|
1287
1287
|
case ModelBackend.OpenAI:
|
|
1288
|
-
case ModelBackend.XAI:
|
|
1288
|
+
case ModelBackend.XAI: {
|
|
1289
|
+
const openaiImageBuffer = await storage.download(file.filePath);
|
|
1290
|
+
const { mime: openaiMimeType } = await getFileType(openaiImageBuffer, file.fileName, file.mimeType);
|
|
1291
|
+
const openaiBase64 = openaiImageBuffer.toString("base64");
|
|
1289
1292
|
imageContent.push({
|
|
1290
1293
|
type: "image_url",
|
|
1291
1294
|
image_url: {
|
|
1292
|
-
url:
|
|
1295
|
+
url: `data:${openaiMimeType};base64,${openaiBase64}`
|
|
1293
1296
|
}
|
|
1294
1297
|
});
|
|
1295
1298
|
imageContent.push({
|
|
@@ -1297,6 +1300,7 @@ async function processFabFilesServer(embeddingFactory, fabFiles, userPrompt, max
|
|
|
1297
1300
|
text: `Image URL: ${fileUrl}`
|
|
1298
1301
|
});
|
|
1299
1302
|
break;
|
|
1303
|
+
}
|
|
1300
1304
|
case ModelBackend.Anthropic:
|
|
1301
1305
|
case ModelBackend.Gemini:
|
|
1302
1306
|
case ModelBackend.Bedrock:
|
|
@@ -6889,6 +6893,24 @@ var XAIBackend = class {
|
|
|
6889
6893
|
}
|
|
6890
6894
|
async getModelInfo() {
|
|
6891
6895
|
return [
|
|
6896
|
+
{
|
|
6897
|
+
id: ChatModels.GROK_4,
|
|
6898
|
+
type: "text",
|
|
6899
|
+
name: "Grok 4",
|
|
6900
|
+
backend: ModelBackend.XAI,
|
|
6901
|
+
contextWindow: 256e3,
|
|
6902
|
+
max_tokens: 16384,
|
|
6903
|
+
can_stream: true,
|
|
6904
|
+
pricing: {
|
|
6905
|
+
// $3.00 / 1M Input tokens, $15.00 / 1M Output tokens. @see https://docs.x.ai/developers/models
|
|
6906
|
+
256e3: { input: 3 / 1e6, output: 15 / 1e6 }
|
|
6907
|
+
},
|
|
6908
|
+
can_think: true,
|
|
6909
|
+
supportsVision: true,
|
|
6910
|
+
supportsTools: true,
|
|
6911
|
+
supportsImageVariation: false,
|
|
6912
|
+
description: "xAI's most capable reasoning model. Excels at complex problem-solving, coding, math, and multimodal understanding with 256K context window."
|
|
6913
|
+
},
|
|
6892
6914
|
{
|
|
6893
6915
|
id: ChatModels.GROK_3,
|
|
6894
6916
|
type: "text",
|
|
@@ -7392,6 +7414,58 @@ var XAIBackend = class {
|
|
|
7392
7414
|
}
|
|
7393
7415
|
};
|
|
7394
7416
|
|
|
7417
|
+
// ../../b4m-core/packages/utils/dist/src/llm/PipelineTimer.js
|
|
7418
|
+
var PipelineTimer = class {
|
|
7419
|
+
start = Date.now();
|
|
7420
|
+
phases = [];
|
|
7421
|
+
/** End the current phase (if any) and start a new one. */
|
|
7422
|
+
phase(name) {
|
|
7423
|
+
const now = Date.now();
|
|
7424
|
+
const active = this.phases[this.phases.length - 1];
|
|
7425
|
+
if (active && active.end === void 0) {
|
|
7426
|
+
active.end = now;
|
|
7427
|
+
}
|
|
7428
|
+
this.phases.push({ name, start: now });
|
|
7429
|
+
}
|
|
7430
|
+
/** End the current phase without starting a new one. */
|
|
7431
|
+
end() {
|
|
7432
|
+
const active = this.phases[this.phases.length - 1];
|
|
7433
|
+
if (active && active.end === void 0) {
|
|
7434
|
+
active.end = Date.now();
|
|
7435
|
+
}
|
|
7436
|
+
}
|
|
7437
|
+
/** Return a record of phase name → duration in ms. */
|
|
7438
|
+
toRecord() {
|
|
7439
|
+
const record = {};
|
|
7440
|
+
for (const p of this.phases) {
|
|
7441
|
+
record[p.name] = (p.end ?? Date.now()) - p.start;
|
|
7442
|
+
}
|
|
7443
|
+
return record;
|
|
7444
|
+
}
|
|
7445
|
+
/** Total elapsed time since timer creation. */
|
|
7446
|
+
totalMs() {
|
|
7447
|
+
return Date.now() - this.start;
|
|
7448
|
+
}
|
|
7449
|
+
/** Formatted multi-line summary table suitable for logging. */
|
|
7450
|
+
summary() {
|
|
7451
|
+
const total = this.totalMs();
|
|
7452
|
+
const lines = [];
|
|
7453
|
+
lines.push("Phase Duration % of Total");
|
|
7454
|
+
lines.push("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
|
|
7455
|
+
for (const p of this.phases) {
|
|
7456
|
+
const dur = (p.end ?? Date.now()) - p.start;
|
|
7457
|
+
const pct = total > 0 ? (dur / total * 100).toFixed(1) : "0.0";
|
|
7458
|
+
const name = p.name.padEnd(23);
|
|
7459
|
+
const durStr = `${dur}ms`.padStart(9);
|
|
7460
|
+
const pctStr = `${pct}%`.padStart(10);
|
|
7461
|
+
lines.push(`${name} ${durStr} ${pctStr}`);
|
|
7462
|
+
}
|
|
7463
|
+
lines.push("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
|
|
7464
|
+
lines.push(`${"TOTAL".padEnd(23)} ${`${total}ms`.padStart(9)}`);
|
|
7465
|
+
return lines.join("\n");
|
|
7466
|
+
}
|
|
7467
|
+
};
|
|
7468
|
+
|
|
7395
7469
|
// ../../b4m-core/packages/utils/dist/src/llm/index.js
|
|
7396
7470
|
function getLlmByModel(apiKeyTable, options) {
|
|
7397
7471
|
const { modelInfo } = options;
|
|
@@ -7476,7 +7550,18 @@ function getLlmByModel(apiKeyTable, options) {
|
|
|
7476
7550
|
}
|
|
7477
7551
|
return backend;
|
|
7478
7552
|
}
|
|
7553
|
+
var MODEL_CACHE_TTL_MS = 6e4;
|
|
7554
|
+
var _modelCache = null;
|
|
7555
|
+
function getModelCacheKey(apiKeys) {
|
|
7556
|
+
if (!apiKeys)
|
|
7557
|
+
return "null";
|
|
7558
|
+
return Object.keys(apiKeys).sort().map((k) => `${k}:${apiKeys[k] ? "1" : "0"}`).join(",");
|
|
7559
|
+
}
|
|
7479
7560
|
var getAvailableModels = async (apiKeys) => {
|
|
7561
|
+
const cacheKey = getModelCacheKey(apiKeys);
|
|
7562
|
+
if (_modelCache && _modelCache.key === cacheKey && Date.now() < _modelCache.expiresAt) {
|
|
7563
|
+
return _modelCache.models;
|
|
7564
|
+
}
|
|
7480
7565
|
const backends = {
|
|
7481
7566
|
[ModelBackend.OpenAI]: apiKeys?.openai ? new OpenAIBackend(apiKeys.openai) : null,
|
|
7482
7567
|
[ModelBackend.Anthropic]: apiKeys?.anthropic ? new AnthropicBackend(apiKeys.anthropic) : null,
|
|
@@ -7530,6 +7615,7 @@ var getAvailableModels = async (apiKeys) => {
|
|
|
7530
7615
|
const cutoff = /* @__PURE__ */ new Date(m.deprecationDate + "T00:00:00Z");
|
|
7531
7616
|
return today.getTime() < cutoff.getTime();
|
|
7532
7617
|
});
|
|
7618
|
+
_modelCache = { key: cacheKey, models: filtered, expiresAt: Date.now() + MODEL_CACHE_TTL_MS };
|
|
7533
7619
|
return filtered;
|
|
7534
7620
|
};
|
|
7535
7621
|
|
|
@@ -11969,6 +12055,7 @@ export {
|
|
|
11969
12055
|
OllamaBackend,
|
|
11970
12056
|
OpenAIBackend,
|
|
11971
12057
|
XAIBackend,
|
|
12058
|
+
PipelineTimer,
|
|
11972
12059
|
getLlmByModel,
|
|
11973
12060
|
getAvailableModels,
|
|
11974
12061
|
secureParameters,
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createFabFile,
|
|
4
4
|
createFabFileSchema
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-ELTTBWAQ.js";
|
|
6
|
+
import "./chunk-S7BPPS33.js";
|
|
7
|
+
import "./chunk-5GSDPBTM.js";
|
|
8
8
|
import "./chunk-OCYRD7D6.js";
|
|
9
9
|
export {
|
|
10
10
|
createFabFile,
|