@bike4mind/cli 0.8.1 → 0.9.1
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/{ConfigStore-Bj1IOvWn.mjs → ConfigStore-CAKSUXCi.mjs} +95 -20
- package/dist/commands/doctorCommand.mjs +1 -1
- package/dist/commands/headlessCommand.mjs +2 -2
- package/dist/commands/mcpCommand.mjs +1 -1
- package/dist/commands/updateCommand.mjs +1 -1
- package/dist/index.mjs +429 -240
- package/dist/{store-B0ImnWR4.mjs → store-DLduYYGR.mjs} +14 -0
- package/dist/store-YhSkjsW4.mjs +3 -0
- package/dist/{tools-DDoiKdgk.mjs → tools-ICW0xW8W.mjs} +79 -144
- package/dist/{updateChecker-BVKr0OXs.mjs → updateChecker-Dproz7j-.mjs} +1 -1
- package/package.json +11 -8
- package/dist/store-44C_Fvdb.mjs +0 -3
|
@@ -48,6 +48,18 @@ const useCliStore = create((set) => ({
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
}),
|
|
51
|
+
messageQueue: [],
|
|
52
|
+
enqueueMessage: (message) => set((state) => ({ messageQueue: [...state.messageQueue, message] })),
|
|
53
|
+
dequeueAllMessages: () => {
|
|
54
|
+
let all = [];
|
|
55
|
+
set((state) => {
|
|
56
|
+
if (state.messageQueue.length === 0) return state;
|
|
57
|
+
all = state.messageQueue;
|
|
58
|
+
return { messageQueue: [] };
|
|
59
|
+
});
|
|
60
|
+
return all;
|
|
61
|
+
},
|
|
62
|
+
clearMessageQueue: () => set({ messageQueue: [] }),
|
|
51
63
|
isThinking: false,
|
|
52
64
|
setIsThinking: (thinking) => set({ isThinking: thinking }),
|
|
53
65
|
inputValue: "",
|
|
@@ -126,6 +138,8 @@ const useCliStore = create((set) => ({
|
|
|
126
138
|
reviewGateQueue: rest
|
|
127
139
|
};
|
|
128
140
|
}),
|
|
141
|
+
exitHandoffPrompt: null,
|
|
142
|
+
setExitHandoffPrompt: (prompt) => set({ exitHandoffPrompt: prompt }),
|
|
129
143
|
showConfigEditor: false,
|
|
130
144
|
setShowConfigEditor: (show) => set({ showConfigEditor: show }),
|
|
131
145
|
showMcpViewer: false,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as
|
|
2
|
+
import { $ as ReceivedCreditTransaction, A as ImageGenerationUsageTransaction, At as resolveNavigationIntents, B as NotFoundError, C as FileEvents, Ct as getAccessibleDataLakes, D as GenericCreditAddTransaction, Dt as isGPTImage2Model, E as GenerateImageToolCallSchema, Et as getViewById, F as KnowledgeType, Ft as CollectionType, G as ProfileEvents, H as OpenAIImageGenerationInput, I as LLMEvents, J as PromptMetaZodSchema, K as ProjectEvents, L as MiscEvents, M as InboxEvents, Mt as secureParameters, N as InviteEvents, O as GenericCreditDeductTransaction, Ot as isGPTImageModel, P as InviteType, Q as RealtimeVoiceUsageTransaction, R as ModalEvents, S as FeedbackEvents, St as b4mLLMTools, T as GEMINI_IMAGE_MODELS, Tt as getMcpProviderMetadata, U as Permission, V as OpenAIEmbeddingModel, W as PermissionDeniedError, X as QuestMasterParamsSchema, Y as PurchaseTransaction, Z as REASONING_SUPPORTED_MODELS, _ as CompletionApiUsageTransaction, _t as VIDEO_SIZE_CONSTRAINTS, a as ApiKeyEvents, at as ResearchTaskType, b as FIXED_TEMPERATURE_MODELS, bt as VoyageAIEmbeddingModel, c as AppFileEvents, ct as SpeechToTextUsageTransaction, d as BFL_IMAGE_MODELS, dt as TagType, et as RechartsChartTypeList, f as BFL_SAFETY_TOLERANCE, ft as TaskScheduleHandler, g as ChatModels, gt as UiNavigationEvents, h as ChatCompletionCreateInputSchema, ht as TransferCreditTransaction, i as AiEvents, it as ResearchTaskPeriodicFrequencyType, j as ImageModels, jt as sanitizeTelemetryError, k as ImageEditUsageTransaction, kt as obfuscateApiKey, l as ArtifactTypeSchema, lt as SubscriptionCreditTransaction, mt as ToolUsageTransaction, n as logger, nt as ResearchModeParamsSchema, o as ApiKeyScope, ot as SessionEvents, p as BedrockEmbeddingModel, pt as TextGenerationUsageTransaction, q as PromptIntentSchema, r as ALERT_THRESHOLDS, rt as ResearchTaskExecutionType, s as ApiKeyType, st as SpeechToTextModels, t as ConfigStore, tt as RegInviteEvents, u as AuthEvents, ut as SupportedFabFileMimeTypes, v as DashboardParamsSchema, vt as VideoGenerationUsageTransaction, w as FriendshipEvents, wt as getDataLakeTags, x as FavoriteDocumentType, xt as XAI_IMAGE_MODELS, y as ElabsEvents, yt as VideoModels, z as ModelBackend } from "./ConfigStore-CAKSUXCi.mjs";
|
|
3
3
|
import { n as isPathAllowed, t as assertPathAllowed } from "./pathValidation-CIytuhr3-Dt5dntLx.mjs";
|
|
4
4
|
import { execFile, execFileSync, spawn } from "child_process";
|
|
5
5
|
import { createHash, randomBytes } from "crypto";
|
|
@@ -47,6 +47,8 @@ import "mammoth";
|
|
|
47
47
|
import "unpdf";
|
|
48
48
|
import "@aws-sdk/client-apigatewaymanagementapi";
|
|
49
49
|
import { InvokeCommand, LambdaClient } from "@aws-sdk/client-lambda";
|
|
50
|
+
import "speakeasy";
|
|
51
|
+
import "qrcode";
|
|
50
52
|
import FirecrawlApp, { FirecrawlError } from "@mendable/firecrawl-js";
|
|
51
53
|
import * as Diff from "diff";
|
|
52
54
|
import { diffLines } from "diff";
|
|
@@ -56,8 +58,6 @@ import times from "lodash/times.js";
|
|
|
56
58
|
import { all, create } from "mathjs";
|
|
57
59
|
import ExcelJS from "exceljs";
|
|
58
60
|
import { Chess } from "chess.js";
|
|
59
|
-
import "speakeasy";
|
|
60
|
-
import "qrcode";
|
|
61
61
|
import "lodash/throttle.js";
|
|
62
62
|
import "lodash/range.js";
|
|
63
63
|
import "bcryptjs";
|
|
@@ -523,17 +523,26 @@ const COMMANDS = [
|
|
|
523
523
|
name: "dirs",
|
|
524
524
|
description: "List all accessible directories"
|
|
525
525
|
},
|
|
526
|
+
{
|
|
527
|
+
name: "workflow",
|
|
528
|
+
description: "Show workflow overview or a specific section (decisions, blockers, handoff, review-gates; `gates` alias accepted)",
|
|
529
|
+
args: "[decisions|blockers|handoff|review-gates]"
|
|
530
|
+
},
|
|
526
531
|
{
|
|
527
532
|
name: "decisions",
|
|
528
|
-
description: "Show decision log for current session"
|
|
533
|
+
description: "Show decision log for current session (alias for /workflow decisions)"
|
|
529
534
|
},
|
|
530
535
|
{
|
|
531
536
|
name: "blockers",
|
|
532
|
-
description: "Show tracked blockers for current session"
|
|
537
|
+
description: "Show tracked blockers for current session (alias for /workflow blockers)"
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
name: "review-gates",
|
|
541
|
+
description: "Show review gates for current session (alias for /workflow review-gates)"
|
|
533
542
|
},
|
|
534
543
|
{
|
|
535
544
|
name: "handoff",
|
|
536
|
-
description: "Show or generate the session handoff for cross-session continuity"
|
|
545
|
+
description: "Show or generate the session handoff for cross-session continuity (alias for /workflow handoff)"
|
|
537
546
|
}
|
|
538
547
|
];
|
|
539
548
|
/**
|
|
@@ -3149,6 +3158,17 @@ CORE BEHAVIOR:
|
|
|
3149
3158
|
- Use conversation history: Reference previous exchanges to understand context
|
|
3150
3159
|
- Complete tasks fully: Don't just show what to do - actually do it
|
|
3151
3160
|
|
|
3161
|
+
ABSOLUTE RULE — NEVER FABRICATE TOOL RESULTS:
|
|
3162
|
+
You MUST NOT claim that a file was created, edited, deleted, written, moved, or that a shell command, test, build, lint, or any other side-effecting operation ran, unless you actually invoked the corresponding tool in this turn AND received an observation back. The model's belief about what *would* happen is not a substitute for what *did* happen.
|
|
3163
|
+
|
|
3164
|
+
- ❌ NEVER write phrases like "File successfully edited", "I've updated the file", "I ran the command", "Done", "Fixed it", "The change is in place", or any equivalent past-tense success claim, unless a tool call in THIS turn produced an observation that confirms it.
|
|
3165
|
+
- ❌ NEVER summarize hypothetical changes as if they happened. If you describe a diff, the change must already be on disk.
|
|
3166
|
+
- ✅ If you have decided to act, the very next thing you produce MUST be a tool call (e.g. \`${TOOL_EDIT_LOCAL_FILE}\`, \`${TOOL_CREATE_FILE}\`, \`${TOOL_BASH_EXECUTE}\`), not a status message.
|
|
3167
|
+
- ✅ If the user said "yes please" / "go ahead" / "do it", that is authorization to call the tool — it is NOT permission to skip the tool call and narrate the outcome.
|
|
3168
|
+
- ✅ When you genuinely have not yet acted, use future tense ("I will edit X", "next I'll run Y") and then immediately call the tool.
|
|
3169
|
+
|
|
3170
|
+
This rule overrides every other instruction. Confabulating a successful side effect is the single worst failure mode you can produce; it leaves the user trusting work that does not exist.
|
|
3171
|
+
|
|
3152
3172
|
FOR SOFTWARE ENGINEERING TASKS:
|
|
3153
3173
|
When requested to perform tasks like fixing bugs, adding features, refactoring, or explaining code, follow this sequence:
|
|
3154
3174
|
1. **Understand:** Think about the user's request and the relevant codebase context. Use '${TOOL_GREP_SEARCH}' and '${TOOL_GLOB_FILES}' search tools extensively (in parallel if independent) to understand file structures, existing code patterns, and conventions. Use '${TOOL_FILE_READ}' to understand context and validate any assumptions you may have.
|
|
@@ -3242,7 +3262,11 @@ You have tools for tracking decisions, blockers, and human review gates during y
|
|
|
3242
3262
|
|
|
3243
3263
|
- request_review_gate: Pause for explicit human approval before crossing a significant decision point — one that affects interpretation, evidence, cost, credentials, platform, or public commitment (e.g., narrowing research scope after synthesis, hard-to-reverse refactors, architectural pivots, dependency swaps). Do NOT use for routine operations or actions already covered by the standard permission system (file edits, bash commands). Treat a rejection as a hard stop — re-plan, do not retry.
|
|
3244
3264
|
|
|
3245
|
-
These tools are lightweight — use them naturally as part of your work, not as a ceremony
|
|
3265
|
+
These tools are lightweight — use them naturally as part of your work, not as a ceremony.
|
|
3266
|
+
|
|
3267
|
+
## Working Directory
|
|
3268
|
+
|
|
3269
|
+
The current working directory is \`${process.cwd()}\`. All relative paths in tool calls resolve from here. When using \`${TOOL_GLOB_FILES}\` or \`${TOOL_GREP_SEARCH}\` without an explicit \`dir_path\`, they search from this directory.${directoriesSection}${projectContextSection}${skillsSection}${featureModulesSection}${planModeSection}`;
|
|
3246
3270
|
}
|
|
3247
3271
|
/**
|
|
3248
3272
|
* Build the minimal-variant system prompt. Reuses the project context,
|
|
@@ -3266,7 +3290,11 @@ function buildMinimalSystemPrompt(config = {}) {
|
|
|
3266
3290
|
Guidelines:
|
|
3267
3291
|
- Be concise in your responses.
|
|
3268
3292
|
- Show file paths clearly when working with files.
|
|
3269
|
-
- When the task is done, give the user a direct answer — no recap of steps already visible in the tool history
|
|
3293
|
+
- When the task is done, give the user a direct answer — no recap of steps already visible in the tool history.
|
|
3294
|
+
|
|
3295
|
+
## Working Directory
|
|
3296
|
+
|
|
3297
|
+
The current working directory is \`${process.cwd()}\`. All relative paths in tool calls resolve from here. When using \`${TOOL_GLOB_FILES}\` or \`${TOOL_GREP_SEARCH}\` without an explicit \`dir_path\`, they search from this directory.${directoriesSection}${projectContextSection}${skillsSection}${featureModulesSection}${planModeSection}`;
|
|
3270
3298
|
}
|
|
3271
3299
|
/**
|
|
3272
3300
|
* Pick a system prompt by variant. The dispatch point for the
|
|
@@ -5100,6 +5128,18 @@ var OpenAIBackend = class {
|
|
|
5100
5128
|
if (options.tool_choice) parameters.tool_choice = options.tool_choice;
|
|
5101
5129
|
if (options.parallel_tool_calls !== void 0) parameters.parallel_tool_calls = options.parallel_tool_calls;
|
|
5102
5130
|
}
|
|
5131
|
+
if (options.responseFormat?.type === "json_schema") {
|
|
5132
|
+
const rf = options.responseFormat;
|
|
5133
|
+
parameters.response_format = {
|
|
5134
|
+
type: "json_schema",
|
|
5135
|
+
json_schema: {
|
|
5136
|
+
name: rf.json_schema.name,
|
|
5137
|
+
...rf.json_schema.description ? { description: rf.json_schema.description } : {},
|
|
5138
|
+
schema: rf.json_schema.schema,
|
|
5139
|
+
...rf.json_schema.strict !== void 0 ? { strict: rf.json_schema.strict } : { strict: true }
|
|
5140
|
+
}
|
|
5141
|
+
};
|
|
5142
|
+
} else if (options.responseFormat?.type === "text") parameters.response_format = { type: "text" };
|
|
5103
5143
|
const response = await withRetry(() => this._api.chat.completions.create(parameters, { signal: options.abortSignal }), {
|
|
5104
5144
|
maxRetries: 3,
|
|
5105
5145
|
initialDelayMs: 500,
|
|
@@ -5251,7 +5291,8 @@ var OpenAIBackend = class {
|
|
|
5251
5291
|
inputTokens: accumInputTokens + (response.usage?.prompt_tokens || 0),
|
|
5252
5292
|
outputTokens: accumOutputTokens + (response.usage?.completion_tokens || 0),
|
|
5253
5293
|
toolsUsed: toolsUsed.length > 0 ? toolsUsed : void 0,
|
|
5254
|
-
cacheStats
|
|
5294
|
+
cacheStats,
|
|
5295
|
+
...options.responseFormat?.type === "json_schema" ? { responseFormatMode: "native" } : {}
|
|
5255
5296
|
});
|
|
5256
5297
|
return;
|
|
5257
5298
|
}
|
|
@@ -5316,6 +5357,13 @@ var OpenAIBackend = class {
|
|
|
5316
5357
|
cacheStats = adapter.extractCacheStats(mockResponse, model);
|
|
5317
5358
|
if (cacheStats) logCacheStats(this.logger, cacheStats, { streaming: true });
|
|
5318
5359
|
}
|
|
5360
|
+
if ((isO1Model || func.length === 0) && options.responseFormat?.type === "json_schema") await callback([], {
|
|
5361
|
+
inputTokens: accumInputTokens + inputTokens,
|
|
5362
|
+
outputTokens: accumOutputTokens + outputTokens,
|
|
5363
|
+
toolsUsed: toolsUsed.length > 0 ? toolsUsed : void 0,
|
|
5364
|
+
cacheStats,
|
|
5365
|
+
responseFormatMode: "native"
|
|
5366
|
+
});
|
|
5319
5367
|
if (!isO1Model && func.length > 0) {
|
|
5320
5368
|
for (const tool of func) if (tool.name && tool.parameters) toolsUsed.push({
|
|
5321
5369
|
name: tool.name,
|
|
@@ -5493,129 +5541,6 @@ var OpenAIBackend = class {
|
|
|
5493
5541
|
}));
|
|
5494
5542
|
}
|
|
5495
5543
|
};
|
|
5496
|
-
var NotificationDeduplicator = class {
|
|
5497
|
-
errorGroups = /* @__PURE__ */ new Map();
|
|
5498
|
-
lowCreditTiers = {};
|
|
5499
|
-
ERROR_GROUPING_WINDOW_MS = 300 * 1e3;
|
|
5500
|
-
CLEANUP_INTERVAL_MS = 3600 * 1e3;
|
|
5501
|
-
LOW_CREDIT_RESET_INTERVAL_MS = 1440 * 60 * 1e3;
|
|
5502
|
-
constructor() {
|
|
5503
|
-
setInterval(() => this.cleanupOldEntries(), this.CLEANUP_INTERVAL_MS);
|
|
5504
|
-
}
|
|
5505
|
-
/**
|
|
5506
|
-
* Handle low credit notifications with tiered thresholds
|
|
5507
|
-
*/
|
|
5508
|
-
async handleLowCreditNotification(userId, username, email, currentCredits, organization, slackWebhookUrl) {
|
|
5509
|
-
if (!slackWebhookUrl) return;
|
|
5510
|
-
if (!this.lowCreditTiers[userId]) this.lowCreditTiers[userId] = {
|
|
5511
|
-
tier1000: false,
|
|
5512
|
-
tier300: false,
|
|
5513
|
-
tier0: false
|
|
5514
|
-
};
|
|
5515
|
-
const userTiers = this.lowCreditTiers[userId];
|
|
5516
|
-
let shouldNotify = false;
|
|
5517
|
-
let tierMessage = "";
|
|
5518
|
-
if (currentCredits <= 0 && !userTiers.tier0) {
|
|
5519
|
-
userTiers.tier0 = true;
|
|
5520
|
-
shouldNotify = true;
|
|
5521
|
-
tierMessage = "🚨 *CRITICAL* - User has run out of credits!";
|
|
5522
|
-
} else if (currentCredits <= 300 && !userTiers.tier300) {
|
|
5523
|
-
userTiers.tier300 = true;
|
|
5524
|
-
shouldNotify = true;
|
|
5525
|
-
tierMessage = "⚠️ *WARNING* - User credits critically low (≤300)";
|
|
5526
|
-
} else if (currentCredits <= 1e3 && !userTiers.tier1000) {
|
|
5527
|
-
userTiers.tier1000 = true;
|
|
5528
|
-
shouldNotify = true;
|
|
5529
|
-
tierMessage = "⚠️ *Low Credits Alert* - User credits below 1000";
|
|
5530
|
-
}
|
|
5531
|
-
if (shouldNotify) {
|
|
5532
|
-
await postMessageToSlack(slackWebhookUrl, `${tierMessage}\n*User:* ${username} (${email})\n*User ID:* ${userId}\n*Current Credits:* ${currentCredits}${organization ? `\n*Organization:* ${organization.name} (${organization.id})` : ""}`);
|
|
5533
|
-
Logger.info(`Sent tiered low credit notification for user ${userId} at ${currentCredits} credits`);
|
|
5534
|
-
}
|
|
5535
|
-
if (currentCredits > 1e3) {
|
|
5536
|
-
userTiers.tier1000 = false;
|
|
5537
|
-
userTiers.tier300 = false;
|
|
5538
|
-
userTiers.tier0 = false;
|
|
5539
|
-
} else if (currentCredits > 300) {
|
|
5540
|
-
userTiers.tier300 = false;
|
|
5541
|
-
userTiers.tier0 = false;
|
|
5542
|
-
} else if (currentCredits > 0) userTiers.tier0 = false;
|
|
5543
|
-
}
|
|
5544
|
-
/**
|
|
5545
|
-
* Handle error notifications with deduplication and grouping
|
|
5546
|
-
*/
|
|
5547
|
-
async handleErrorNotification(errorMessage, severity, metadata, logData, logEvent, stage, slackUrl) {
|
|
5548
|
-
const groupKey = `${severity}:${this.normalizeErrorMessage(errorMessage)}`;
|
|
5549
|
-
const now = /* @__PURE__ */ new Date();
|
|
5550
|
-
const existingEntry = this.errorGroups.get(groupKey);
|
|
5551
|
-
if (!existingEntry) {
|
|
5552
|
-
this.errorGroups.set(groupKey, {
|
|
5553
|
-
count: 1,
|
|
5554
|
-
firstOccurrence: now,
|
|
5555
|
-
lastOccurrence: now,
|
|
5556
|
-
lastNotificationSent: now
|
|
5557
|
-
});
|
|
5558
|
-
await this.sendErrorNotification(errorMessage, severity, metadata, logData, logEvent, stage, slackUrl, 1);
|
|
5559
|
-
} else {
|
|
5560
|
-
existingEntry.count++;
|
|
5561
|
-
existingEntry.lastOccurrence = now;
|
|
5562
|
-
if (now.getTime() - (existingEntry.lastNotificationSent?.getTime() || 0) >= this.ERROR_GROUPING_WINDOW_MS) {
|
|
5563
|
-
await this.sendErrorNotification(errorMessage, severity, metadata, logData, logEvent, stage, slackUrl, existingEntry.count, existingEntry.firstOccurrence, existingEntry.lastOccurrence);
|
|
5564
|
-
existingEntry.lastNotificationSent = now;
|
|
5565
|
-
}
|
|
5566
|
-
}
|
|
5567
|
-
}
|
|
5568
|
-
async sendErrorNotification(message, severity, metadata, logData, logEvent, stage, slackUrl, count, firstOccurrence, lastOccurrence) {
|
|
5569
|
-
const tags = Object.entries(metadata).map(([key, value]) => `\`${key}: ${value}\``).join(" ");
|
|
5570
|
-
const group = encodeURIComponent(logData.logGroup);
|
|
5571
|
-
const stream = encodeURIComponent(logData.logStream);
|
|
5572
|
-
const url = `https://console.aws.amazon.com/cloudwatch/home?region=${process.env.AWS_REGION}#logEventViewer:group=${group};stream=${stream};start=${logEvent.timestamp};end=${logEvent.timestamp}`;
|
|
5573
|
-
let slackMessage;
|
|
5574
|
-
if (count === 1) slackMessage = `*${severity.toUpperCase()}* - ${message}\n\`env: ${stage}\` ${tags} [AWS](${url})`;
|
|
5575
|
-
else {
|
|
5576
|
-
const duration = lastOccurrence && firstOccurrence ? this.formatDuration(lastOccurrence.getTime() - firstOccurrence.getTime()) : "";
|
|
5577
|
-
slackMessage = `*${severity.toUpperCase()}* - ${message}\n\`count: ${count}\` \`duration: ${duration}\` \`env: ${stage}\` ${tags} [AWS](${url})`;
|
|
5578
|
-
}
|
|
5579
|
-
await postMessageToSlack(slackUrl, slackMessage);
|
|
5580
|
-
}
|
|
5581
|
-
normalizeErrorMessage(message) {
|
|
5582
|
-
return message.replace(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/g, "[TIMESTAMP]").replace(/Request failed with status code \d+/g, "Request failed with status code [CODE]").replace(/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/g, "[UUID]").replace(/\b\d+\.\d+\.\d+\.\d+\b/g, "[IP]").substring(0, 200);
|
|
5583
|
-
}
|
|
5584
|
-
formatDuration(ms) {
|
|
5585
|
-
const seconds = Math.floor(ms / 1e3);
|
|
5586
|
-
const minutes = Math.floor(seconds / 60);
|
|
5587
|
-
const hours = Math.floor(minutes / 60);
|
|
5588
|
-
if (hours > 0) return `${hours}h ${minutes % 60}m`;
|
|
5589
|
-
if (minutes > 0) return `${minutes}m ${seconds % 60}s`;
|
|
5590
|
-
return `${seconds}s`;
|
|
5591
|
-
}
|
|
5592
|
-
cleanupOldEntries() {
|
|
5593
|
-
const cutoffTime = (/* @__PURE__ */ new Date()).getTime() - this.CLEANUP_INTERVAL_MS;
|
|
5594
|
-
for (const [key, entry] of Array.from(this.errorGroups.entries())) if (entry.lastOccurrence.getTime() < cutoffTime) this.errorGroups.delete(key);
|
|
5595
|
-
Logger.info(`Cleaned up old notification entries: ${this.errorGroups.size} error groups remaining`);
|
|
5596
|
-
}
|
|
5597
|
-
/**
|
|
5598
|
-
* Get current deduplication status (for monitoring)
|
|
5599
|
-
*/
|
|
5600
|
-
getStatus() {
|
|
5601
|
-
return {
|
|
5602
|
-
errorGroupsCount: this.errorGroups.size,
|
|
5603
|
-
lowCreditUsersTracked: Object.keys(this.lowCreditTiers).length
|
|
5604
|
-
};
|
|
5605
|
-
}
|
|
5606
|
-
};
|
|
5607
|
-
new NotificationDeduplicator();
|
|
5608
|
-
async function postMessageToSlack(slackWebhookUrl, message) {
|
|
5609
|
-
try {
|
|
5610
|
-
if (!slackWebhookUrl) {
|
|
5611
|
-
Logger.error("postMessageToSlack: Error posting message to Slack: slackWebhookUrl is not set");
|
|
5612
|
-
return;
|
|
5613
|
-
}
|
|
5614
|
-
await axios.post(slackWebhookUrl, { text: message }, { headers: { "Content-Type": "application/json" } });
|
|
5615
|
-
} catch (error) {
|
|
5616
|
-
Logger.error("Error posting message to Slack:", error);
|
|
5617
|
-
}
|
|
5618
|
-
}
|
|
5619
5544
|
BedrockEmbeddingModel.TITAN_TEXT_EMBEDDINGS_V2, BedrockEmbeddingModel.TITAN_TEXT_EMBEDDINGS_V2;
|
|
5620
5545
|
const OPENAI_EMBEDDING_MODEL_MAP = {
|
|
5621
5546
|
[OpenAIEmbeddingModel.TEXT_EMBEDDING_3_SMALL]: {
|
|
@@ -6732,6 +6657,10 @@ z.discriminatedUnion("type", [
|
|
|
6732
6657
|
createdAt: true,
|
|
6733
6658
|
updatedAt: true
|
|
6734
6659
|
}),
|
|
6660
|
+
SpeechToTextUsageTransaction.omit({
|
|
6661
|
+
createdAt: true,
|
|
6662
|
+
updatedAt: true
|
|
6663
|
+
}),
|
|
6735
6664
|
TransferCreditTransaction.omit({
|
|
6736
6665
|
createdAt: true,
|
|
6737
6666
|
updatedAt: true
|
|
@@ -6769,7 +6698,8 @@ z.object({
|
|
|
6769
6698
|
description: z.string().optional(),
|
|
6770
6699
|
billingContact: z.string().optional(),
|
|
6771
6700
|
currentCredits: z.coerce.number().optional(),
|
|
6772
|
-
systemPrompt: z.string().max(1e4).optional()
|
|
6701
|
+
systemPrompt: z.string().max(1e4).optional(),
|
|
6702
|
+
maxCreditsPerMember: z.number().positive().nullable().optional()
|
|
6773
6703
|
});
|
|
6774
6704
|
z.object({
|
|
6775
6705
|
id: z.string(),
|
|
@@ -6865,6 +6795,14 @@ z.object({
|
|
|
6865
6795
|
relativePath: z.string().optional()
|
|
6866
6796
|
});
|
|
6867
6797
|
//#endregion
|
|
6798
|
+
//#region ../../b4m-core/services/dist/mfaService/utils.mjs
|
|
6799
|
+
const originalEmitWarning = process.emitWarning;
|
|
6800
|
+
process.emitWarning = (warning, name) => {
|
|
6801
|
+
if (name === "DeprecationWarning" && warning?.toString().includes("Buffer")) return;
|
|
6802
|
+
return originalEmitWarning.call(process, warning, name);
|
|
6803
|
+
};
|
|
6804
|
+
process.emitWarning = originalEmitWarning;
|
|
6805
|
+
//#endregion
|
|
6868
6806
|
//#region ../../b4m-core/services/dist/llm/tools/implementation/websearch/index.mjs
|
|
6869
6807
|
async function serpApiSearch(adapters, query, num_results) {
|
|
6870
6808
|
const apiKey = await getSerperKey(adapters);
|
|
@@ -15069,14 +15007,6 @@ const generateMcpToolsFromCache = (serverName, cachedTools, callTool) => {
|
|
|
15069
15007
|
return result;
|
|
15070
15008
|
};
|
|
15071
15009
|
//#endregion
|
|
15072
|
-
//#region ../../b4m-core/services/dist/mfaService/utils.mjs
|
|
15073
|
-
const originalEmitWarning = process.emitWarning;
|
|
15074
|
-
process.emitWarning = (warning, name) => {
|
|
15075
|
-
if (name === "DeprecationWarning" && warning?.toString().includes("Buffer")) return;
|
|
15076
|
-
return originalEmitWarning.call(process, warning, name);
|
|
15077
|
-
};
|
|
15078
|
-
process.emitWarning = originalEmitWarning;
|
|
15079
|
-
//#endregion
|
|
15080
15010
|
//#region ../../b4m-core/services/dist/askUserQuestion-DyEMPAlD.mjs
|
|
15081
15011
|
let _showUserQuestion = null;
|
|
15082
15012
|
/**
|
|
@@ -15805,7 +15735,10 @@ z.object({
|
|
|
15805
15735
|
});
|
|
15806
15736
|
z.object({ userId: z.string() });
|
|
15807
15737
|
z.object({ userId: z.string() });
|
|
15808
|
-
z.object({
|
|
15738
|
+
z.object({
|
|
15739
|
+
targetUserId: z.string(),
|
|
15740
|
+
mfaToken: z.string()
|
|
15741
|
+
});
|
|
15809
15742
|
z.object({ key: z.string() });
|
|
15810
15743
|
z.object({
|
|
15811
15744
|
key: z.string(),
|
|
@@ -17036,7 +16969,9 @@ OpenAIImageGenerationInput.extend({
|
|
|
17036
16969
|
width: z.number().optional(),
|
|
17037
16970
|
height: z.number().optional(),
|
|
17038
16971
|
aspect_ratio: z.string().optional(),
|
|
17039
|
-
fabFileIds: z.array(z.string()).optional()
|
|
16972
|
+
fabFileIds: z.array(z.string()).optional(),
|
|
16973
|
+
/** Resolved by the API route. Defaults to 'fresh' if absent. */
|
|
16974
|
+
intent: PromptIntentSchema.optional()
|
|
17040
16975
|
});
|
|
17041
16976
|
z.object({
|
|
17042
16977
|
sessionId: z.string(),
|
|
@@ -19098,7 +19033,7 @@ function wrapToolWithPermission(tool, permissionManager, showPermissionPrompt, a
|
|
|
19098
19033
|
});
|
|
19099
19034
|
return result;
|
|
19100
19035
|
}
|
|
19101
|
-
const { useCliStore } = await import("./store-
|
|
19036
|
+
const { useCliStore } = await import("./store-YhSkjsW4.mjs");
|
|
19102
19037
|
const interactionMode = useCliStore.getState().interactionMode;
|
|
19103
19038
|
if (interactionMode === "plan" && !isReadOnlyTool(toolName) && !isWriteTargetingPlanFile(toolName, args)) {
|
|
19104
19039
|
const result = `Tool "${toolName}" is blocked while plan mode is active. Plan mode is read-only — research the codebase, then write your plan to a file under ${getPlanModeFileDir()}/. The user will press Shift+Tab to exit plan mode and authorize execution.`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bike4mind/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -30,6 +30,9 @@
|
|
|
30
30
|
"dist",
|
|
31
31
|
"bin"
|
|
32
32
|
],
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=24.0.0"
|
|
35
|
+
},
|
|
33
36
|
"dependencies": {
|
|
34
37
|
"@anthropic-ai/sdk": "^0.79.0",
|
|
35
38
|
"@aws-sdk/client-apigatewaymanagementapi": "^3.1041.0",
|
|
@@ -103,12 +106,12 @@
|
|
|
103
106
|
"yauzl": "^3.3.0",
|
|
104
107
|
"zod": "^4.3.6",
|
|
105
108
|
"zod-validation-error": "^5.0.0",
|
|
106
|
-
"zustand": "^
|
|
109
|
+
"zustand": "^5.0.13"
|
|
107
110
|
},
|
|
108
111
|
"devDependencies": {
|
|
109
112
|
"@types/better-sqlite3": "^7.6.13",
|
|
110
113
|
"@types/jsonwebtoken": "^9.0.4",
|
|
111
|
-
"@types/node": "^
|
|
114
|
+
"@types/node": "^24.0.0",
|
|
112
115
|
"@types/picomatch": "^4.0.3",
|
|
113
116
|
"@types/react": "^19.2.14",
|
|
114
117
|
"@types/ws": "^8.18.1",
|
|
@@ -118,11 +121,11 @@
|
|
|
118
121
|
"tsx": "^4.21.0",
|
|
119
122
|
"typescript": "^5.9.3",
|
|
120
123
|
"vitest": "^4.1.2",
|
|
121
|
-
"@bike4mind/agents": "0.8.
|
|
122
|
-
"@bike4mind/common": "2.
|
|
123
|
-
"@bike4mind/mcp": "1.37.
|
|
124
|
-
"@bike4mind/
|
|
125
|
-
"@bike4mind/
|
|
124
|
+
"@bike4mind/agents": "0.8.3",
|
|
125
|
+
"@bike4mind/common": "2.94.0",
|
|
126
|
+
"@bike4mind/mcp": "1.37.7",
|
|
127
|
+
"@bike4mind/services": "2.82.0",
|
|
128
|
+
"@bike4mind/utils": "2.20.0"
|
|
126
129
|
},
|
|
127
130
|
"optionalDependencies": {
|
|
128
131
|
"@vscode/ripgrep": "^1.17.1"
|
package/dist/store-44C_Fvdb.mjs
DELETED