@bike4mind/cli 0.2.14-fix-cli-backspace-deletion.17486 → 0.2.15
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/ImageStore-MMUOUPI2.js +0 -0
- package/dist/{artifactExtractor-BRHUIR7I.js → artifactExtractor-EEX5G4EB.js} +1 -1
- package/dist/chunk-BDQBOLYG.js +0 -0
- package/dist/chunk-BPFEGDC7.js +0 -0
- package/dist/{chunk-SKGB6N3S.js → chunk-ECSELHYP.js} +2 -2
- package/dist/chunk-FFJX3FF3.js +0 -0
- package/dist/{chunk-TOMWAKIL.js → chunk-I3CPL4SJ.js} +2 -2
- package/dist/{chunk-A7POWM75.js → chunk-LL5J3SVB.js} +21 -0
- package/dist/{chunk-GFL7CMSL.js → chunk-M2CSCYOY.js} +53 -8
- package/dist/{chunk-B6HTF2IE.js → chunk-O7G3G3FD.js} +2 -2
- package/dist/chunk-OCYRD7D6.js +0 -0
- package/dist/commands/mcpCommand.js +0 -0
- package/dist/{create-UFJ2VDFP.js → create-2DJZDMFQ.js} +3 -3
- package/dist/formatConverter-5QEJDW24.js +0 -0
- package/dist/index.js +175 -71
- package/dist/{llmMarkdownGenerator-AHTZFV2T.js → llmMarkdownGenerator-SRA436DB.js} +1 -1
- package/dist/{markdownGenerator-BLXDOZWQ.js → markdownGenerator-E7F5GFPO.js} +1 -1
- package/dist/{mementoService-5E5ZJYYF.js → mementoService-2WXW5352.js} +3 -3
- package/dist/notificationDeduplicator-UTHJHMSZ.js +0 -0
- package/dist/{src-SIU2KHTA.js → src-3MJEHI5W.js} +3 -1
- package/dist/{src-ZJYA6KJ4.js → src-K45DVAW4.js} +2 -2
- package/dist/{subtractCredits-W7S7KHAY.js → subtractCredits-OHI7VBH3.js} +3 -3
- package/dist/utils-JCHWDM4Z.js +0 -0
- package/package.json +18 -19
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
CurationArtifactType
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-LL5J3SVB.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;
|
package/dist/chunk-BDQBOLYG.js
CHANGED
|
File without changes
|
package/dist/chunk-BPFEGDC7.js
CHANGED
|
File without changes
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
getSettingsByNames,
|
|
7
7
|
obfuscateApiKey,
|
|
8
8
|
secureParameters
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-M2CSCYOY.js";
|
|
10
10
|
import {
|
|
11
11
|
ApiKeyType,
|
|
12
12
|
MementoTier,
|
|
13
13
|
isSupportedEmbeddingModel
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-LL5J3SVB.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/apiKeyService/get.js
|
|
17
17
|
import { z } from "zod";
|
package/dist/chunk-FFJX3FF3.js
CHANGED
|
File without changes
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
BadRequestError,
|
|
4
4
|
secureParameters
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-M2CSCYOY.js";
|
|
6
6
|
import {
|
|
7
7
|
CompletionApiUsageTransaction,
|
|
8
8
|
GenericCreditDeductTransaction,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
RealtimeVoiceUsageTransaction,
|
|
12
12
|
TextGenerationUsageTransaction,
|
|
13
13
|
TransferCreditTransaction
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-LL5J3SVB.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/creditService/subtractCredits.js
|
|
17
17
|
import { z } from "zod";
|
|
@@ -2109,6 +2109,7 @@ var SettingKeySchema = z19.enum([
|
|
|
2109
2109
|
// MODAL AUTOMATION SETTINGS
|
|
2110
2110
|
"whatsNewAutomationEnabled",
|
|
2111
2111
|
"whatsNewConfig",
|
|
2112
|
+
"whatsNewSyncConfig",
|
|
2112
2113
|
// AGENT PROACTIVE MESSAGING SETTINGS
|
|
2113
2114
|
"enableAgentProactiveMessages",
|
|
2114
2115
|
// TIME MACHINE & NIGHT SKY SETTINGS
|
|
@@ -2331,6 +2332,14 @@ var WhatsNewConfigSchema = z19.object({
|
|
|
2331
2332
|
// Custom prompt template (optional)
|
|
2332
2333
|
promptTemplate: z19.string().min(L.promptTemplate.min, `Prompt template must be at least ${L.promptTemplate.min} characters`).max(L.promptTemplate.max, `Prompt template cannot exceed ${L.promptTemplate.max.toLocaleString()} characters`).trim().optional()
|
|
2333
2334
|
});
|
|
2335
|
+
var WhatsNewSyncConfigSchema = z19.object({
|
|
2336
|
+
autoSyncEnabled: z19.boolean().default(true),
|
|
2337
|
+
lastSyncAt: z19.string().datetime().optional(),
|
|
2338
|
+
lastSyncResult: z19.enum(["success", "skipped", "failed"]).optional(),
|
|
2339
|
+
lastSyncModalId: z19.string().optional(),
|
|
2340
|
+
/** Error message from last sync attempt (only populated when lastSyncResult is 'failed') */
|
|
2341
|
+
lastSyncError: z19.string().max(500).optional()
|
|
2342
|
+
});
|
|
2334
2343
|
var API_SERVICE_GROUPS = {
|
|
2335
2344
|
OPENAI: {
|
|
2336
2345
|
id: "openAIService",
|
|
@@ -3520,6 +3529,17 @@ var settingsMap = {
|
|
|
3520
3529
|
order: 101,
|
|
3521
3530
|
schema: WhatsNewConfigSchema
|
|
3522
3531
|
}),
|
|
3532
|
+
whatsNewSyncConfig: makeObjectSetting({
|
|
3533
|
+
key: "whatsNewSyncConfig",
|
|
3534
|
+
name: "What's New Sync Configuration",
|
|
3535
|
+
defaultValue: {
|
|
3536
|
+
autoSyncEnabled: true
|
|
3537
|
+
},
|
|
3538
|
+
description: "Configuration for What's New modal syncing from production. Used by fork/non-production environments to control automatic synchronization.",
|
|
3539
|
+
category: "Admin",
|
|
3540
|
+
order: 102,
|
|
3541
|
+
schema: WhatsNewSyncConfigSchema
|
|
3542
|
+
}),
|
|
3523
3543
|
enableAgentProactiveMessages: makeBooleanSetting({
|
|
3524
3544
|
key: "enableAgentProactiveMessages",
|
|
3525
3545
|
name: "Enable Agent Proactive Messages",
|
|
@@ -6301,6 +6321,7 @@ export {
|
|
|
6301
6321
|
RapidReplySettingsSchema,
|
|
6302
6322
|
WHATS_NEW_VALIDATION_LIMITS,
|
|
6303
6323
|
WhatsNewConfigSchema,
|
|
6324
|
+
WhatsNewSyncConfigSchema,
|
|
6304
6325
|
API_SERVICE_GROUPS,
|
|
6305
6326
|
settingsMap,
|
|
6306
6327
|
StringBooleanSchema,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
dayjsConfig_default,
|
|
14
14
|
extractSnippetMeta,
|
|
15
15
|
settingsMap
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-LL5J3SVB.js";
|
|
17
17
|
import {
|
|
18
18
|
Logger
|
|
19
19
|
} from "./chunk-OCYRD7D6.js";
|
|
@@ -7068,13 +7068,35 @@ var OpenAIEmbeddingService = class {
|
|
|
7068
7068
|
const MAX_INPUTS_PER_REQUEST = 2048;
|
|
7069
7069
|
const MAX_TOKENS_PER_REQUEST = 3e5;
|
|
7070
7070
|
const MAX_TOKENS_PER_INPUT = 8192;
|
|
7071
|
-
|
|
7071
|
+
let tokens;
|
|
7072
|
+
let needsRecalculation = false;
|
|
7073
|
+
if (!tokenCounts || tokenCounts.length !== texts.length) {
|
|
7074
|
+
needsRecalculation = true;
|
|
7075
|
+
} else {
|
|
7076
|
+
for (let i = 0; i < tokenCounts.length; i++) {
|
|
7077
|
+
if (typeof tokenCounts[i] !== "number" || !isFinite(tokenCounts[i]) || tokenCounts[i] <= 0) {
|
|
7078
|
+
needsRecalculation = true;
|
|
7079
|
+
break;
|
|
7080
|
+
}
|
|
7081
|
+
}
|
|
7082
|
+
}
|
|
7083
|
+
if (needsRecalculation) {
|
|
7084
|
+
console.debug("[OpenAI] Invalid token counts detected, recalculating with tiktoken");
|
|
7085
|
+
tokens = await this.calculateTokenCounts(texts);
|
|
7086
|
+
} else {
|
|
7087
|
+
tokens = tokenCounts;
|
|
7088
|
+
}
|
|
7089
|
+
let totalTokens = 0;
|
|
7072
7090
|
for (let i = 0; i < texts.length; i++) {
|
|
7073
|
-
|
|
7074
|
-
|
|
7091
|
+
const tokenCount = tokens[i];
|
|
7092
|
+
if (tokenCount > MAX_TOKENS_PER_INPUT) {
|
|
7093
|
+
throw new Error(`Input at index ${i} exceeds ${MAX_TOKENS_PER_INPUT} token limit (${tokenCount} tokens)`);
|
|
7075
7094
|
}
|
|
7095
|
+
totalTokens += tokenCount;
|
|
7076
7096
|
}
|
|
7097
|
+
console.debug(`[OpenAI] Batch embedding: ${texts.length} inputs, ${totalTokens} total tokens`);
|
|
7077
7098
|
const batches = this.createBatches(texts, tokens, MAX_INPUTS_PER_REQUEST, MAX_TOKENS_PER_REQUEST);
|
|
7099
|
+
console.debug(`[OpenAI] Split into ${batches.length} batch(es) to respect 300k token limit`);
|
|
7078
7100
|
if (batches.length === 1) {
|
|
7079
7101
|
return await this.processSingleBatch(batches[0].texts);
|
|
7080
7102
|
}
|
|
@@ -7136,9 +7158,32 @@ var OpenAIEmbeddingService = class {
|
|
|
7136
7158
|
return batches;
|
|
7137
7159
|
}
|
|
7138
7160
|
/**
|
|
7139
|
-
* Process a single batch
|
|
7161
|
+
* Process a single batch with safety checks.
|
|
7162
|
+
* Validates batch size using OpenAI's tiktoken and recursively splits if needed.
|
|
7163
|
+
* @param texts - Array of text strings to embed
|
|
7164
|
+
* @param preCalculatedTokens - Optional pre-calculated token counts from recursive split (avoids recalculation)
|
|
7140
7165
|
*/
|
|
7141
|
-
async processSingleBatch(texts) {
|
|
7166
|
+
async processSingleBatch(texts, preCalculatedTokens) {
|
|
7167
|
+
const tokenCounts = preCalculatedTokens || await this.calculateTokenCounts(texts);
|
|
7168
|
+
const batchTokens = tokenCounts.reduce((sum, count) => sum + count, 0);
|
|
7169
|
+
if (batchTokens > 3e5) {
|
|
7170
|
+
console.warn(`[OpenAI] Batch exceeds 300k token limit (${batchTokens} tokens), splitting recursively for safety`);
|
|
7171
|
+
const mid = Math.ceil(texts.length / 2);
|
|
7172
|
+
const firstHalf = texts.slice(0, mid);
|
|
7173
|
+
const secondHalf = texts.slice(mid);
|
|
7174
|
+
const firstTokens = tokenCounts.slice(0, mid);
|
|
7175
|
+
const secondTokens = tokenCounts.slice(mid);
|
|
7176
|
+
const [firstEmbeddings, secondEmbeddings] = await Promise.all([
|
|
7177
|
+
this.processSingleBatch(firstHalf, firstTokens),
|
|
7178
|
+
this.processSingleBatch(secondHalf, secondTokens)
|
|
7179
|
+
]);
|
|
7180
|
+
return [...firstEmbeddings, ...secondEmbeddings];
|
|
7181
|
+
}
|
|
7182
|
+
for (let i = 0; i < tokenCounts.length; i++) {
|
|
7183
|
+
if (tokenCounts[i] > 8192) {
|
|
7184
|
+
throw new Error(`Text at index ${i} exceeds OpenAI's 8192 token limit per input (${tokenCounts[i]} tokens). This indicates a data integrity issue - chunk should have been smaller. This chunk cannot be processed and the entire batch must fail.`);
|
|
7185
|
+
}
|
|
7186
|
+
}
|
|
7142
7187
|
try {
|
|
7143
7188
|
const response = await this.client.embeddings.create({
|
|
7144
7189
|
model: this.model,
|
|
@@ -7412,7 +7457,7 @@ var SmartChunker = class {
|
|
|
7412
7457
|
* @param model - The embedding model name
|
|
7413
7458
|
* @param storage - Storage instance for file content
|
|
7414
7459
|
* @param logger - Logger instance
|
|
7415
|
-
* @param bufferPercentOrValue - Optional. Buffer as a percent (0-1) or absolute value (if >= 1) to subtract from maxTokens. Default: 0.
|
|
7460
|
+
* @param bufferPercentOrValue - Optional. Buffer as a percent (0-1) or absolute value (if >= 1) to subtract from maxTokens. Default: 0.2 (20%) or 32 tokens, whichever is greater.
|
|
7416
7461
|
*/
|
|
7417
7462
|
constructor(model, storage, logger, bufferPercentOrValue) {
|
|
7418
7463
|
this.logger = logger;
|
|
@@ -7426,7 +7471,7 @@ var SmartChunker = class {
|
|
|
7426
7471
|
} else {
|
|
7427
7472
|
throw new Error(`Unsupported embedding model: ${model}`);
|
|
7428
7473
|
}
|
|
7429
|
-
this.bufferPercentOrValue = bufferPercentOrValue ?? 0.
|
|
7474
|
+
this.bufferPercentOrValue = bufferPercentOrValue ?? 0.2;
|
|
7430
7475
|
let buffer;
|
|
7431
7476
|
if (this.bufferPercentOrValue < 1) {
|
|
7432
7477
|
buffer = Math.max(Math.floor(this.maxTokens * this.bufferPercentOrValue), 32);
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
getSettingsMap,
|
|
8
8
|
getSettingsValue,
|
|
9
9
|
secureParameters
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-M2CSCYOY.js";
|
|
11
11
|
import {
|
|
12
12
|
KnowledgeType,
|
|
13
13
|
SupportedFabFileMimeTypes
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-LL5J3SVB.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/fabFileService/create.js
|
|
17
17
|
import { z } from "zod";
|
package/dist/chunk-OCYRD7D6.js
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -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-O7G3G3FD.js";
|
|
6
|
+
import "./chunk-M2CSCYOY.js";
|
|
7
|
+
import "./chunk-LL5J3SVB.js";
|
|
8
8
|
import "./chunk-OCYRD7D6.js";
|
|
9
9
|
export {
|
|
10
10
|
createFabFile,
|
|
File without changes
|
package/dist/index.js
CHANGED
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
getEffectiveApiKey,
|
|
5
5
|
getOpenWeatherKey,
|
|
6
6
|
getSerperKey
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ECSELHYP.js";
|
|
8
8
|
import {
|
|
9
9
|
ConfigStore
|
|
10
10
|
} from "./chunk-FFJX3FF3.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-I3CPL4SJ.js";
|
|
12
|
+
import "./chunk-O7G3G3FD.js";
|
|
13
13
|
import {
|
|
14
14
|
BFLImageService,
|
|
15
15
|
BaseStorage,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
OpenAIBackend,
|
|
22
22
|
OpenAIImageService,
|
|
23
23
|
XAIImageService
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-M2CSCYOY.js";
|
|
25
25
|
import {
|
|
26
26
|
AiEvents,
|
|
27
27
|
ApiKeyEvents,
|
|
@@ -75,21 +75,21 @@ import {
|
|
|
75
75
|
XAI_IMAGE_MODELS,
|
|
76
76
|
b4mLLMTools,
|
|
77
77
|
getMcpProviderMetadata
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-LL5J3SVB.js";
|
|
79
79
|
import {
|
|
80
80
|
Logger
|
|
81
81
|
} from "./chunk-OCYRD7D6.js";
|
|
82
82
|
import "./chunk-BPFEGDC7.js";
|
|
83
83
|
|
|
84
84
|
// src/index.tsx
|
|
85
|
-
import
|
|
86
|
-
import { render, Box as
|
|
85
|
+
import React19, { useState as useState8, useEffect as useEffect4, useCallback, useRef as useRef3 } from "react";
|
|
86
|
+
import { render, Box as Box18, Text as Text18, useApp, useInput as useInput7 } from "ink";
|
|
87
87
|
import { execSync } from "child_process";
|
|
88
88
|
import { v4 as uuidv49 } from "uuid";
|
|
89
89
|
|
|
90
90
|
// src/components/App.tsx
|
|
91
|
-
import
|
|
92
|
-
import { Box as
|
|
91
|
+
import React13, { useState as useState4 } from "react";
|
|
92
|
+
import { Box as Box12, Text as Text12, Static } from "ink";
|
|
93
93
|
|
|
94
94
|
// src/components/StatusBar.tsx
|
|
95
95
|
import React from "react";
|
|
@@ -1429,24 +1429,128 @@ function McpViewer({ config, mcpManager, onClose }) {
|
|
|
1429
1429
|
}
|
|
1430
1430
|
|
|
1431
1431
|
// src/components/MessageItem.tsx
|
|
1432
|
+
import React12 from "react";
|
|
1433
|
+
import { Box as Box11, Text as Text11 } from "ink";
|
|
1434
|
+
|
|
1435
|
+
// src/components/MarkdownRenderer.tsx
|
|
1432
1436
|
import React11 from "react";
|
|
1433
1437
|
import { Box as Box10, Text as Text10 } from "ink";
|
|
1438
|
+
import { marked } from "marked";
|
|
1439
|
+
import { highlight } from "cli-highlight";
|
|
1440
|
+
function MarkdownRenderer({ content }) {
|
|
1441
|
+
const tokens = marked.lexer(content);
|
|
1442
|
+
return /* @__PURE__ */ React11.createElement(Box10, { flexDirection: "column" }, tokens.map((token, idx) => renderToken(token, idx)));
|
|
1443
|
+
}
|
|
1444
|
+
function renderToken(token, idx) {
|
|
1445
|
+
switch (token.type) {
|
|
1446
|
+
case "heading":
|
|
1447
|
+
return renderHeading(token, idx);
|
|
1448
|
+
case "code":
|
|
1449
|
+
return renderCodeBlock(token, idx);
|
|
1450
|
+
case "paragraph":
|
|
1451
|
+
return renderParagraph(token, idx);
|
|
1452
|
+
case "list":
|
|
1453
|
+
return renderList(token, idx);
|
|
1454
|
+
case "blockquote":
|
|
1455
|
+
return renderBlockquote(token, idx);
|
|
1456
|
+
case "hr":
|
|
1457
|
+
return /* @__PURE__ */ React11.createElement(Text10, { key: idx, dimColor: true }, "\u2500".repeat(50));
|
|
1458
|
+
case "space":
|
|
1459
|
+
return null;
|
|
1460
|
+
default:
|
|
1461
|
+
if ("text" in token) {
|
|
1462
|
+
return /* @__PURE__ */ React11.createElement(Text10, { key: idx }, token.text);
|
|
1463
|
+
}
|
|
1464
|
+
return null;
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
function renderHeading(token, idx) {
|
|
1468
|
+
const colors = {
|
|
1469
|
+
1: "cyan",
|
|
1470
|
+
2: "cyan",
|
|
1471
|
+
3: "blue",
|
|
1472
|
+
4: "blue",
|
|
1473
|
+
5: "white",
|
|
1474
|
+
6: "white"
|
|
1475
|
+
};
|
|
1476
|
+
const color = colors[token.depth] || "white";
|
|
1477
|
+
return /* @__PURE__ */ React11.createElement(Box10, { key: idx, marginTop: idx > 0 ? 1 : 0 }, /* @__PURE__ */ React11.createElement(Text10, { bold: true, color }, parseInlineText(token.text)));
|
|
1478
|
+
}
|
|
1479
|
+
function renderCodeBlock(token, idx) {
|
|
1480
|
+
let highlightedCode;
|
|
1481
|
+
try {
|
|
1482
|
+
highlightedCode = highlight(token.text, {
|
|
1483
|
+
language: token.lang || "javascript",
|
|
1484
|
+
ignoreIllegals: true
|
|
1485
|
+
});
|
|
1486
|
+
} catch (error) {
|
|
1487
|
+
highlightedCode = token.text;
|
|
1488
|
+
}
|
|
1489
|
+
return /* @__PURE__ */ React11.createElement(Box10, { key: idx, flexDirection: "column", paddingLeft: 2 }, token.lang && /* @__PURE__ */ React11.createElement(Text10, { dimColor: true, color: "gray" }, token.lang), /* @__PURE__ */ React11.createElement(Text10, null, highlightedCode));
|
|
1490
|
+
}
|
|
1491
|
+
function renderParagraph(token, idx) {
|
|
1492
|
+
return /* @__PURE__ */ React11.createElement(Box10, { key: idx }, /* @__PURE__ */ React11.createElement(Text10, null, parseInlineText(token.text)));
|
|
1493
|
+
}
|
|
1494
|
+
function renderList(token, idx) {
|
|
1495
|
+
return /* @__PURE__ */ React11.createElement(Box10, { key: idx, flexDirection: "column" }, token.items.map((item, itemIdx) => renderListItem(item, itemIdx, token.ordered, itemIdx + 1)));
|
|
1496
|
+
}
|
|
1497
|
+
function renderListItem(item, idx, ordered, number) {
|
|
1498
|
+
const bullet = ordered ? `${number}.` : "\u2022";
|
|
1499
|
+
return /* @__PURE__ */ React11.createElement(Box10, { key: idx, paddingLeft: 2 }, /* @__PURE__ */ React11.createElement(Text10, null, bullet, " ", parseInlineText(item.text)));
|
|
1500
|
+
}
|
|
1501
|
+
function renderBlockquote(token, idx) {
|
|
1502
|
+
return /* @__PURE__ */ React11.createElement(Box10, { key: idx, paddingLeft: 2, borderStyle: "single", borderLeft: true, borderColor: "gray" }, token.tokens.map((t, i) => renderToken(t, i)));
|
|
1503
|
+
}
|
|
1504
|
+
function parseInlineText(text) {
|
|
1505
|
+
const parts = [];
|
|
1506
|
+
let lastIndex = 0;
|
|
1507
|
+
const regex = /(\*\*(.+?)\*\*)|(\*(.+?)\*)|(`(.+?)`)/g;
|
|
1508
|
+
let match;
|
|
1509
|
+
while ((match = regex.exec(text)) !== null) {
|
|
1510
|
+
if (match.index > lastIndex) {
|
|
1511
|
+
parts.push(text.slice(lastIndex, match.index));
|
|
1512
|
+
}
|
|
1513
|
+
if (match[1]) {
|
|
1514
|
+
parts.push(
|
|
1515
|
+
/* @__PURE__ */ React11.createElement(Text10, { key: match.index, bold: true }, match[2])
|
|
1516
|
+
);
|
|
1517
|
+
} else if (match[3]) {
|
|
1518
|
+
parts.push(
|
|
1519
|
+
/* @__PURE__ */ React11.createElement(Text10, { key: match.index, italic: true }, match[4])
|
|
1520
|
+
);
|
|
1521
|
+
} else if (match[5]) {
|
|
1522
|
+
parts.push(
|
|
1523
|
+
/* @__PURE__ */ React11.createElement(Text10, { key: match.index, color: "cyan" }, match[6])
|
|
1524
|
+
);
|
|
1525
|
+
}
|
|
1526
|
+
lastIndex = regex.lastIndex;
|
|
1527
|
+
}
|
|
1528
|
+
if (lastIndex < text.length) {
|
|
1529
|
+
parts.push(text.slice(lastIndex));
|
|
1530
|
+
}
|
|
1531
|
+
if (parts.length === 0) {
|
|
1532
|
+
return text;
|
|
1533
|
+
}
|
|
1534
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, parts);
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
// src/components/MessageItem.tsx
|
|
1434
1538
|
function MessageItem({ message }) {
|
|
1435
1539
|
const isUser = message.role === "user";
|
|
1436
1540
|
const isSystem = message.role === "system";
|
|
1437
|
-
return /* @__PURE__ */
|
|
1541
|
+
return /* @__PURE__ */ React12.createElement(Box11, { flexDirection: "column", marginBottom: 1 }, /* @__PURE__ */ React12.createElement(Box11, null, /* @__PURE__ */ React12.createElement(Text11, { bold: true, color: isUser ? "cyan" : isSystem ? "gray" : "green" }, isUser ? "\u{1F464} You" : isSystem ? "\u2139\uFE0F System" : "\u{1F916} Assistant"), isUser && /* @__PURE__ */ React12.createElement(Text11, { dimColor: true }, " \u2022 ", new Date(message.timestamp).toLocaleTimeString())), isUser && message.content && /* @__PURE__ */ React12.createElement(Box11, { paddingLeft: 2 }, /* @__PURE__ */ React12.createElement(Text11, { backgroundColor: "whiteBright", color: "black" }, " ", message.content, " ")), !isUser && message.metadata?.steps && message.metadata.steps.length > 0 && /* @__PURE__ */ React12.createElement(Box11, { paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React12.createElement(Text11, { dimColor: true, bold: true }, "\u{1F527} Agent Reasoning Trace (", message.metadata.steps.filter((s) => s.type === "action").length, " ", "tools used, ", message.metadata.steps.length, " total steps)", message.metadata.tokenUsage && ` \u2022 ${message.metadata.tokenUsage.total} tokens`), /* @__PURE__ */ React12.createElement(Text11, { dimColor: true }, "Step types: ", message.metadata.steps.map((s) => s.type).join(", ")), message.metadata.steps.map((step, idx) => {
|
|
1438
1542
|
if (step.type === "thought") {
|
|
1439
|
-
return /* @__PURE__ */
|
|
1543
|
+
return /* @__PURE__ */ React12.createElement(Box11, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React12.createElement(Text11, { color: "blue" }, "\u{1F4AD} Thought:"), /* @__PURE__ */ React12.createElement(Text11, { dimColor: true }, ` ${step.content}`));
|
|
1440
1544
|
}
|
|
1441
1545
|
if (step.type === "action") {
|
|
1442
1546
|
const toolName = step.metadata?.toolName || "unknown";
|
|
1443
1547
|
const toolInput = step.metadata?.toolInput;
|
|
1444
1548
|
const observationStep = message.metadata.steps[idx + 1];
|
|
1445
1549
|
const result = observationStep?.type === "observation" ? observationStep.content : null;
|
|
1446
|
-
return /* @__PURE__ */
|
|
1550
|
+
return /* @__PURE__ */ React12.createElement(Box11, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React12.createElement(Text11, { color: "yellow" }, "\u{1F527} Action: ", toolName), toolInput && /* @__PURE__ */ React12.createElement(Text11, { dimColor: true }, ` Input: ${typeof toolInput === "string" ? toolInput : JSON.stringify(toolInput).slice(0, 100)}`), result && /* @__PURE__ */ React12.createElement(Text11, { dimColor: true }, ` Result: ${typeof result === "string" ? result.slice(0, 200) : JSON.stringify(result).slice(0, 200)}${(typeof result === "string" ? result.length : JSON.stringify(result).length) > 200 ? "..." : ""}`));
|
|
1447
1551
|
}
|
|
1448
1552
|
return null;
|
|
1449
|
-
}).filter(Boolean)), !isUser && message.content !== "..." && /* @__PURE__ */
|
|
1553
|
+
}).filter(Boolean)), !isUser && message.content !== "..." && /* @__PURE__ */ React12.createElement(Box11, { paddingLeft: 2, marginTop: message.metadata?.steps?.length ? 1 : 0 }, message.metadata?.permissionDenied ? /* @__PURE__ */ React12.createElement(Text11, { color: "yellow" }, "\u26A0\uFE0F ", message.content) : /* @__PURE__ */ React12.createElement(MarkdownRenderer, { content: message.content })), message.metadata?.tokenUsage && (!message.metadata.steps || message.metadata.steps.length === 0) && /* @__PURE__ */ React12.createElement(Box11, { paddingLeft: 2 }, /* @__PURE__ */ React12.createElement(Text11, { dimColor: true }, `${message.metadata.tokenUsage.total} tokens`)));
|
|
1450
1554
|
}
|
|
1451
1555
|
|
|
1452
1556
|
// src/utils/processFileReferences.ts
|
|
@@ -1593,7 +1697,7 @@ function App({
|
|
|
1593
1697
|
const exitRequested = useCliStore((state) => state.exitRequested);
|
|
1594
1698
|
const setIsThinking = useCliStore((state) => state.setIsThinking);
|
|
1595
1699
|
const [isBashMode, setIsBashMode] = useState4(false);
|
|
1596
|
-
const handleSubmit =
|
|
1700
|
+
const handleSubmit = React13.useCallback(
|
|
1597
1701
|
async (input) => {
|
|
1598
1702
|
const trimmed = input.trim();
|
|
1599
1703
|
if (!trimmed) return;
|
|
@@ -1622,7 +1726,7 @@ ${errorBlock}`;
|
|
|
1622
1726
|
},
|
|
1623
1727
|
[onMessage, onCommand, setIsThinking]
|
|
1624
1728
|
);
|
|
1625
|
-
return /* @__PURE__ */
|
|
1729
|
+
return /* @__PURE__ */ React13.createElement(Box12, { flexDirection: "column" }, showConfigEditor && config && onSaveConfig ? /* @__PURE__ */ React13.createElement(Box12, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React13.createElement(
|
|
1626
1730
|
ConfigEditor,
|
|
1627
1731
|
{
|
|
1628
1732
|
config,
|
|
@@ -1632,8 +1736,8 @@ ${errorBlock}`;
|
|
|
1632
1736
|
}
|
|
1633
1737
|
)) : showMcpViewer && config ? (
|
|
1634
1738
|
/* MCP Viewer - full screen takeover */
|
|
1635
|
-
/* @__PURE__ */
|
|
1636
|
-
) : /* @__PURE__ */
|
|
1739
|
+
/* @__PURE__ */ React13.createElement(Box12, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React13.createElement(McpViewer, { config, mcpManager, onClose: () => setShowMcpViewer(false) }))
|
|
1740
|
+
) : /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(Static, { items: messages }, (message) => /* @__PURE__ */ React13.createElement(Box12, { key: message.id, flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React13.createElement(MessageItem, { message }))), /* @__PURE__ */ React13.createElement(Box12, { flexDirection: "column" }, pendingMessages.map((message) => /* @__PURE__ */ React13.createElement(Box12, { key: message.id, flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React13.createElement(MessageItem, { message })))), permissionPrompt && /* @__PURE__ */ React13.createElement(Box12, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React13.createElement(
|
|
1637
1741
|
PermissionPrompt,
|
|
1638
1742
|
{
|
|
1639
1743
|
toolName: permissionPrompt.toolName,
|
|
@@ -1642,7 +1746,7 @@ ${errorBlock}`;
|
|
|
1642
1746
|
canBeTrusted: permissionPrompt.canBeTrusted,
|
|
1643
1747
|
onResponse: onPermissionResponse
|
|
1644
1748
|
}
|
|
1645
|
-
)), !permissionPrompt && /* @__PURE__ */
|
|
1749
|
+
)), !permissionPrompt && /* @__PURE__ */ React13.createElement(AgentThinking, null), exitRequested && /* @__PURE__ */ React13.createElement(Box12, { paddingX: 1, marginBottom: 1 }, /* @__PURE__ */ React13.createElement(Text12, { color: "yellow", bold: true }, "Press Ctrl+C again to exit")), /* @__PURE__ */ React13.createElement(Box12, { borderStyle: "single", borderColor: isBashMode ? "yellow" : "cyan", paddingX: 1 }, /* @__PURE__ */ React13.createElement(
|
|
1646
1750
|
InputPrompt,
|
|
1647
1751
|
{
|
|
1648
1752
|
onSubmit: handleSubmit,
|
|
@@ -1655,24 +1759,24 @@ ${errorBlock}`;
|
|
|
1655
1759
|
onPrefillConsumed,
|
|
1656
1760
|
onBashModeChange: setIsBashMode
|
|
1657
1761
|
}
|
|
1658
|
-
)), /* @__PURE__ */
|
|
1762
|
+
)), /* @__PURE__ */ React13.createElement(StatusBar, { sessionName, model: currentModel, tokenUsage: totalTokens })));
|
|
1659
1763
|
}
|
|
1660
1764
|
|
|
1661
1765
|
// src/components/MessageList.tsx
|
|
1662
|
-
import
|
|
1663
|
-
import { Box as
|
|
1766
|
+
import React14 from "react";
|
|
1767
|
+
import { Box as Box13, Text as Text13 } from "ink";
|
|
1664
1768
|
function stripThinkingTags(content) {
|
|
1665
1769
|
return content.replace(/<think>[\s\S]*?<\/think>/g, "").trim();
|
|
1666
1770
|
}
|
|
1667
|
-
var MessageList =
|
|
1771
|
+
var MessageList = React14.memo(
|
|
1668
1772
|
function MessageList2({ messages }) {
|
|
1669
1773
|
if (messages.length === 0) {
|
|
1670
|
-
return /* @__PURE__ */
|
|
1774
|
+
return /* @__PURE__ */ React14.createElement(Box13, { paddingY: 1 }, /* @__PURE__ */ React14.createElement(Text13, { dimColor: true }, "No messages yet. Type a message to start!"));
|
|
1671
1775
|
}
|
|
1672
|
-
return /* @__PURE__ */
|
|
1776
|
+
return /* @__PURE__ */ React14.createElement(Box13, { flexDirection: "column", gap: 1, paddingY: 1 }, messages.map((message, index) => /* @__PURE__ */ React14.createElement(Box13, { key: index, flexDirection: "column", marginBottom: 1 }, /* @__PURE__ */ React14.createElement(Box13, null, /* @__PURE__ */ React14.createElement(Text13, { bold: true, color: message.role === "user" ? "cyan" : "green" }, message.role === "user" ? "\u{1F464} You" : "\u{1F916} Assistant"), /* @__PURE__ */ React14.createElement(Text13, { dimColor: true }, " \u2022 ", new Date(message.timestamp).toLocaleTimeString())), /* @__PURE__ */ React14.createElement(Box13, { paddingLeft: 2 }, message.metadata?.permissionDenied ? /* @__PURE__ */ React14.createElement(Text13, { color: "yellow" }, "\u26A0\uFE0F ", stripThinkingTags(message.content)) : /* @__PURE__ */ React14.createElement(Text13, null, stripThinkingTags(message.content))), message.metadata?.steps && message.metadata.steps.length > 0 && /* @__PURE__ */ React14.createElement(Box13, { paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React14.createElement(Text13, { dimColor: true, bold: true }, "\u{1F527} Agent Reasoning Trace (", message.metadata.steps.filter((s) => s.type === "action").length, " tools used,", " ", message.metadata.steps.length, " total steps)", message.metadata.tokenUsage && ` \u2022 ${message.metadata.tokenUsage.total} tokens`), /* @__PURE__ */ React14.createElement(Text13, { dimColor: true }, "Step types: ", message.metadata.steps.map((s) => s.type).join(", ")), message.metadata.steps.map((step, idx) => {
|
|
1673
1777
|
if (step.type === "thought") {
|
|
1674
|
-
return /* @__PURE__ */
|
|
1675
|
-
|
|
1778
|
+
return /* @__PURE__ */ React14.createElement(Box13, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React14.createElement(Text13, { color: "blue" }, "\u{1F4AD} Thought:"), /* @__PURE__ */ React14.createElement(
|
|
1779
|
+
Text13,
|
|
1676
1780
|
{
|
|
1677
1781
|
dimColor: true
|
|
1678
1782
|
},
|
|
@@ -1684,10 +1788,10 @@ var MessageList = React13.memo(
|
|
|
1684
1788
|
const toolInput = step.metadata?.toolInput;
|
|
1685
1789
|
const observationStep = message.metadata.steps[idx + 1];
|
|
1686
1790
|
const result = observationStep?.type === "observation" ? observationStep.content : null;
|
|
1687
|
-
return /* @__PURE__ */
|
|
1791
|
+
return /* @__PURE__ */ React14.createElement(Box13, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React14.createElement(Text13, { color: "yellow" }, "\u{1F527} Action: ", toolName), toolInput && /* @__PURE__ */ React14.createElement(Text13, { dimColor: true }, ` Input: ${typeof toolInput === "string" ? toolInput : JSON.stringify(toolInput).slice(0, 100)}`), result && /* @__PURE__ */ React14.createElement(Text13, { dimColor: true }, ` Result: ${typeof result === "string" ? result.slice(0, 200) : JSON.stringify(result).slice(0, 200)}${(typeof result === "string" ? result.length : JSON.stringify(result).length) > 200 ? "..." : ""}`));
|
|
1688
1792
|
}
|
|
1689
1793
|
return null;
|
|
1690
|
-
}).filter(Boolean)), message.metadata?.tokenUsage && (!message.metadata.steps || message.metadata.steps.length === 0) && /* @__PURE__ */
|
|
1794
|
+
}).filter(Boolean)), message.metadata?.tokenUsage && (!message.metadata.steps || message.metadata.steps.length === 0) && /* @__PURE__ */ React14.createElement(Box13, { paddingLeft: 2 }, /* @__PURE__ */ React14.createElement(Text13, { dimColor: true }, `${message.metadata.tokenUsage.total} tokens`)))));
|
|
1691
1795
|
},
|
|
1692
1796
|
(prevProps, nextProps) => {
|
|
1693
1797
|
if (prevProps.messages.length !== nextProps.messages.length) {
|
|
@@ -1698,8 +1802,8 @@ var MessageList = React13.memo(
|
|
|
1698
1802
|
);
|
|
1699
1803
|
|
|
1700
1804
|
// src/components/TrustLocationSelector.tsx
|
|
1701
|
-
import
|
|
1702
|
-
import { Box as
|
|
1805
|
+
import React15 from "react";
|
|
1806
|
+
import { Box as Box14, Text as Text14 } from "ink";
|
|
1703
1807
|
import SelectInput2 from "ink-select-input";
|
|
1704
1808
|
function TrustLocationSelector({ inProject, onSelect, onCancel }) {
|
|
1705
1809
|
const items = [];
|
|
@@ -1720,19 +1824,19 @@ function TrustLocationSelector({ inProject, onSelect, onCancel }) {
|
|
|
1720
1824
|
const handleSelect = (item) => {
|
|
1721
1825
|
onSelect(item.value);
|
|
1722
1826
|
};
|
|
1723
|
-
return /* @__PURE__ */
|
|
1827
|
+
return /* @__PURE__ */ React15.createElement(Box14, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React15.createElement(Box14, { marginBottom: 1 }, /* @__PURE__ */ React15.createElement(Text14, { bold: true }, "Where should this rule be saved?")), /* @__PURE__ */ React15.createElement(
|
|
1724
1828
|
SelectInput2,
|
|
1725
1829
|
{
|
|
1726
1830
|
items,
|
|
1727
1831
|
onSelect: handleSelect,
|
|
1728
|
-
itemComponent: ({ isSelected, label }) => /* @__PURE__ */
|
|
1832
|
+
itemComponent: ({ isSelected, label }) => /* @__PURE__ */ React15.createElement(Box14, null, /* @__PURE__ */ React15.createElement(Text14, { color: isSelected ? "cyan" : void 0 }, isSelected ? "\u276F " : " ", label))
|
|
1729
1833
|
}
|
|
1730
|
-
), /* @__PURE__ */
|
|
1834
|
+
), /* @__PURE__ */ React15.createElement(Box14, { marginTop: 1 }, /* @__PURE__ */ React15.createElement(Text14, { dimColor: true }, "Use \u2191\u2193 arrows to navigate, Enter to select, Ctrl+C to cancel")));
|
|
1731
1835
|
}
|
|
1732
1836
|
|
|
1733
1837
|
// src/components/RewindSelector.tsx
|
|
1734
|
-
import
|
|
1735
|
-
import { Box as
|
|
1838
|
+
import React16, { useState as useState5 } from "react";
|
|
1839
|
+
import { Box as Box15, Text as Text15, useInput as useInput5 } from "ink";
|
|
1736
1840
|
import SelectInput3 from "ink-select-input";
|
|
1737
1841
|
function RewindSelector({ messages, onSelect, onCancel }) {
|
|
1738
1842
|
const [step, setStep] = useState5("selection");
|
|
@@ -1774,14 +1878,14 @@ function RewindSelector({ messages, onSelect, onCancel }) {
|
|
|
1774
1878
|
return sum2 + (msg.metadata?.tokenUsage?.total || 0);
|
|
1775
1879
|
}, 0);
|
|
1776
1880
|
if (step === "selection") {
|
|
1777
|
-
return /* @__PURE__ */
|
|
1881
|
+
return /* @__PURE__ */ React16.createElement(Box15, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React16.createElement(Box15, { marginBottom: 1 }, /* @__PURE__ */ React16.createElement(Text15, { bold: true }, "Select a point to rewind to:")), /* @__PURE__ */ React16.createElement(
|
|
1778
1882
|
SelectInput3,
|
|
1779
1883
|
{
|
|
1780
1884
|
items,
|
|
1781
1885
|
onSelect: handleSelectionSelect,
|
|
1782
|
-
itemComponent: ({ isSelected, label }) => /* @__PURE__ */
|
|
1886
|
+
itemComponent: ({ isSelected, label }) => /* @__PURE__ */ React16.createElement(Box15, null, /* @__PURE__ */ React16.createElement(Text15, { color: isSelected ? "cyan" : void 0 }, isSelected ? "\u276F " : " ", label))
|
|
1783
1887
|
}
|
|
1784
|
-
), /* @__PURE__ */
|
|
1888
|
+
), /* @__PURE__ */ React16.createElement(Box15, { marginTop: 1 }, /* @__PURE__ */ React16.createElement(Text15, { dimColor: true }, "Use \u2191\u2193 arrows to navigate, Enter to select, Esc to cancel")));
|
|
1785
1889
|
}
|
|
1786
1890
|
const confirmationItems = [
|
|
1787
1891
|
{ label: "Yes, rewind to this point", value: "confirm" },
|
|
@@ -1789,19 +1893,19 @@ function RewindSelector({ messages, onSelect, onCancel }) {
|
|
|
1789
1893
|
];
|
|
1790
1894
|
const selectedMessage = selectedMessageIndex !== null && selectedMessageIndex >= 0 && selectedMessageIndex < messages.length ? messages[selectedMessageIndex] : null;
|
|
1791
1895
|
const selectedPreview = selectedMessage ? selectedMessage.content.length > 50 ? selectedMessage.content.substring(0, 50) + "..." : selectedMessage.content : "";
|
|
1792
|
-
return /* @__PURE__ */
|
|
1896
|
+
return /* @__PURE__ */ React16.createElement(Box15, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React16.createElement(Box15, { marginBottom: 1, flexDirection: "column" }, /* @__PURE__ */ React16.createElement(Text15, { bold: true }, "Confirm rewind operation:"), /* @__PURE__ */ React16.createElement(Text15, { dimColor: true }, "Message: ", selectedPreview), /* @__PURE__ */ React16.createElement(Text15, { color: "yellow" }, "This will remove ", messagesToRemove.length, " message(s) (", tokensToRemove.toLocaleString(), " tokens)"), /* @__PURE__ */ React16.createElement(Text15, { color: "cyan" }, "The selected message will be placed in your input for editing.")), /* @__PURE__ */ React16.createElement(
|
|
1793
1897
|
SelectInput3,
|
|
1794
1898
|
{
|
|
1795
1899
|
items: confirmationItems,
|
|
1796
1900
|
onSelect: handleConfirmationSelect,
|
|
1797
|
-
itemComponent: ({ isSelected, label }) => /* @__PURE__ */
|
|
1901
|
+
itemComponent: ({ isSelected, label }) => /* @__PURE__ */ React16.createElement(Box15, null, /* @__PURE__ */ React16.createElement(Text15, { color: isSelected ? "cyan" : void 0 }, isSelected ? "\u276F " : " ", label))
|
|
1798
1902
|
}
|
|
1799
|
-
), /* @__PURE__ */
|
|
1903
|
+
), /* @__PURE__ */ React16.createElement(Box15, { marginTop: 1 }, /* @__PURE__ */ React16.createElement(Text15, { dimColor: true }, "Use \u2191\u2193 arrows to navigate, Enter to select, Esc to go back")));
|
|
1800
1904
|
}
|
|
1801
1905
|
|
|
1802
1906
|
// src/components/SessionSelector.tsx
|
|
1803
|
-
import
|
|
1804
|
-
import { Box as
|
|
1907
|
+
import React17, { useState as useState6 } from "react";
|
|
1908
|
+
import { Box as Box16, Text as Text16, useInput as useInput6 } from "ink";
|
|
1805
1909
|
import SelectInput4 from "ink-select-input";
|
|
1806
1910
|
function SessionSelector({ sessions, currentSession, onSelect, onCancel }) {
|
|
1807
1911
|
const [step, setStep] = useState6("selection");
|
|
@@ -1839,32 +1943,32 @@ function SessionSelector({ sessions, currentSession, onSelect, onCancel }) {
|
|
|
1839
1943
|
}
|
|
1840
1944
|
};
|
|
1841
1945
|
if (step === "selection") {
|
|
1842
|
-
return /* @__PURE__ */
|
|
1946
|
+
return /* @__PURE__ */ React17.createElement(Box16, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React17.createElement(Box16, { marginBottom: 1 }, /* @__PURE__ */ React17.createElement(Text16, { bold: true }, "Select a session to resume:")), /* @__PURE__ */ React17.createElement(
|
|
1843
1947
|
SelectInput4,
|
|
1844
1948
|
{
|
|
1845
1949
|
items,
|
|
1846
1950
|
onSelect: handleSelectionSelect,
|
|
1847
|
-
itemComponent: ({ isSelected, label }) => /* @__PURE__ */
|
|
1951
|
+
itemComponent: ({ isSelected, label }) => /* @__PURE__ */ React17.createElement(Box16, null, /* @__PURE__ */ React17.createElement(Text16, { color: isSelected ? "cyan" : void 0 }, isSelected ? "\u276F " : " ", label))
|
|
1848
1952
|
}
|
|
1849
|
-
), /* @__PURE__ */
|
|
1953
|
+
), /* @__PURE__ */ React17.createElement(Box16, { marginTop: 1 }, /* @__PURE__ */ React17.createElement(Text16, { dimColor: true }, "Use \u2191\u2193 arrows to navigate, Enter to select, Esc to cancel")));
|
|
1850
1954
|
}
|
|
1851
1955
|
const confirmationItems = [
|
|
1852
1956
|
{ label: "Yes, resume this session", value: "confirm" },
|
|
1853
1957
|
{ label: "No, go back to selection", value: "cancel" }
|
|
1854
1958
|
];
|
|
1855
|
-
return /* @__PURE__ */
|
|
1959
|
+
return /* @__PURE__ */ React17.createElement(Box16, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React17.createElement(Box16, { marginBottom: 1, flexDirection: "column" }, /* @__PURE__ */ React17.createElement(Text16, { bold: true }, 'Resume session: "', selectedSession?.name, '"'), /* @__PURE__ */ React17.createElement(Text16, { dimColor: true }, selectedSession?.messages.length, " messages | ", selectedSession?.model, " |", " ", selectedSession?.metadata?.totalTokens?.toLocaleString() ?? 0, " tokens"), hasUnsavedWork && /* @__PURE__ */ React17.createElement(Text16, { color: "yellow" }, "Warning: Your current session has unsaved messages. Use /save first if needed.")), /* @__PURE__ */ React17.createElement(
|
|
1856
1960
|
SelectInput4,
|
|
1857
1961
|
{
|
|
1858
1962
|
items: confirmationItems,
|
|
1859
1963
|
onSelect: handleConfirmationSelect,
|
|
1860
|
-
itemComponent: ({ isSelected, label }) => /* @__PURE__ */
|
|
1964
|
+
itemComponent: ({ isSelected, label }) => /* @__PURE__ */ React17.createElement(Box16, null, /* @__PURE__ */ React17.createElement(Text16, { color: isSelected ? "cyan" : void 0 }, isSelected ? "\u276F " : " ", label))
|
|
1861
1965
|
}
|
|
1862
|
-
), /* @__PURE__ */
|
|
1966
|
+
), /* @__PURE__ */ React17.createElement(Box16, { marginTop: 1 }, /* @__PURE__ */ React17.createElement(Text16, { dimColor: true }, "Use \u2191\u2193 arrows to navigate, Enter to select, Esc to go back")));
|
|
1863
1967
|
}
|
|
1864
1968
|
|
|
1865
1969
|
// src/components/LoginFlow.tsx
|
|
1866
|
-
import
|
|
1867
|
-
import { Box as
|
|
1970
|
+
import React18, { useState as useState7, useEffect as useEffect3 } from "react";
|
|
1971
|
+
import { Box as Box17, Text as Text17 } from "ink";
|
|
1868
1972
|
import Spinner2 from "ink-spinner";
|
|
1869
1973
|
import jwt from "jsonwebtoken";
|
|
1870
1974
|
import open from "open";
|
|
@@ -2027,15 +2131,15 @@ function LoginFlow({ apiUrl = "http://localhost:3000", configStore, onSuccess, o
|
|
|
2027
2131
|
}
|
|
2028
2132
|
}, [deviceFlow, status]);
|
|
2029
2133
|
if (status === "initiating") {
|
|
2030
|
-
return /* @__PURE__ */
|
|
2134
|
+
return /* @__PURE__ */ React18.createElement(Box17, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React18.createElement(Box17, null, /* @__PURE__ */ React18.createElement(Text17, { color: "cyan" }, /* @__PURE__ */ React18.createElement(Spinner2, { type: "dots" }), " Initiating device authorization...")));
|
|
2031
2135
|
}
|
|
2032
2136
|
if (status === "error") {
|
|
2033
|
-
return /* @__PURE__ */
|
|
2137
|
+
return /* @__PURE__ */ React18.createElement(Box17, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React18.createElement(Box17, { marginBottom: 1 }, /* @__PURE__ */ React18.createElement(Text17, { color: "red", bold: true }, "\u2716 Authentication Failed")), /* @__PURE__ */ React18.createElement(Box17, null, /* @__PURE__ */ React18.createElement(Text17, { color: "red" }, error)));
|
|
2034
2138
|
}
|
|
2035
2139
|
if (status === "success") {
|
|
2036
|
-
return /* @__PURE__ */
|
|
2140
|
+
return /* @__PURE__ */ React18.createElement(Box17, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React18.createElement(Box17, { marginBottom: 1 }, /* @__PURE__ */ React18.createElement(Text17, { color: "green", bold: true }, "\u2714 Successfully authenticated!")), /* @__PURE__ */ React18.createElement(Box17, null, /* @__PURE__ */ React18.createElement(Text17, { dimColor: true }, "You can now use B4M CLI with your account.")));
|
|
2037
2141
|
}
|
|
2038
|
-
return /* @__PURE__ */
|
|
2142
|
+
return /* @__PURE__ */ React18.createElement(Box17, { flexDirection: "column", padding: 1, borderStyle: "round", borderColor: "cyan" }, /* @__PURE__ */ React18.createElement(Box17, { marginBottom: 1 }, /* @__PURE__ */ React18.createElement(Text17, { color: "cyan", bold: true }, "\u{1F510} Device Authorization")), /* @__PURE__ */ React18.createElement(Box17, { marginBottom: 1 }, /* @__PURE__ */ React18.createElement(Text17, null, "Opening browser automatically... If it doesn't open, please visit:")), /* @__PURE__ */ React18.createElement(Box17, { marginBottom: 1, paddingLeft: 2 }, /* @__PURE__ */ React18.createElement(Text17, { color: "blue", bold: true }, deviceFlow?.verification_uri)), /* @__PURE__ */ React18.createElement(Box17, { marginBottom: 1 }, /* @__PURE__ */ React18.createElement(Text17, null, "And enter this code when prompted:")), /* @__PURE__ */ React18.createElement(Box17, { marginBottom: 1, paddingLeft: 2 }, /* @__PURE__ */ React18.createElement(Text17, { color: "yellow", bold: true }, deviceFlow?.user_code)), /* @__PURE__ */ React18.createElement(Box17, { marginTop: 1 }, /* @__PURE__ */ React18.createElement(Text17, { color: "cyan" }, /* @__PURE__ */ React18.createElement(Spinner2, { type: "dots" }), " ", statusMessage)), /* @__PURE__ */ React18.createElement(Box17, { marginTop: 1 }, /* @__PURE__ */ React18.createElement(Text17, { dimColor: true }, "Expires in ", deviceFlow ? Math.floor(deviceFlow.expires_in / 60) : 0, " minutes")));
|
|
2039
2143
|
}
|
|
2040
2144
|
|
|
2041
2145
|
// src/storage/SessionStore.ts
|
|
@@ -11326,7 +11430,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
|
|
|
11326
11430
|
// package.json
|
|
11327
11431
|
var package_default = {
|
|
11328
11432
|
name: "@bike4mind/cli",
|
|
11329
|
-
version: "0.2.
|
|
11433
|
+
version: "0.2.15",
|
|
11330
11434
|
type: "module",
|
|
11331
11435
|
description: "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
11332
11436
|
license: "UNLICENSED",
|
|
@@ -11390,6 +11494,7 @@ var package_default = {
|
|
|
11390
11494
|
bcryptjs: "^2.4.3",
|
|
11391
11495
|
"better-sqlite3": "^12.5.0",
|
|
11392
11496
|
cheerio: "1.0.0-rc.12",
|
|
11497
|
+
"cli-highlight": "^2.1.11",
|
|
11393
11498
|
"csv-parse": "^5.5.6",
|
|
11394
11499
|
dayjs: "^1.11.13",
|
|
11395
11500
|
diff: "^8.0.2",
|
|
@@ -11431,11 +11536,11 @@ var package_default = {
|
|
|
11431
11536
|
zustand: "^4.5.4"
|
|
11432
11537
|
},
|
|
11433
11538
|
devDependencies: {
|
|
11434
|
-
"@bike4mind/agents": "
|
|
11435
|
-
"@bike4mind/common": "
|
|
11436
|
-
"@bike4mind/mcp": "
|
|
11437
|
-
"@bike4mind/services": "
|
|
11438
|
-
"@bike4mind/utils": "
|
|
11539
|
+
"@bike4mind/agents": "workspace:*",
|
|
11540
|
+
"@bike4mind/common": "workspace:*",
|
|
11541
|
+
"@bike4mind/mcp": "workspace:*",
|
|
11542
|
+
"@bike4mind/services": "workspace:*",
|
|
11543
|
+
"@bike4mind/utils": "workspace:*",
|
|
11439
11544
|
"@types/better-sqlite3": "^7.6.13",
|
|
11440
11545
|
"@types/diff": "^5.0.9",
|
|
11441
11546
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -11448,8 +11553,7 @@ var package_default = {
|
|
|
11448
11553
|
tsx: "^4.21.0",
|
|
11449
11554
|
typescript: "^5.9.3",
|
|
11450
11555
|
vitest: "^3.2.4"
|
|
11451
|
-
}
|
|
11452
|
-
gitHead: "fb666cf3a0f70c46307c5dbe7194894e86104b9e"
|
|
11556
|
+
}
|
|
11453
11557
|
};
|
|
11454
11558
|
|
|
11455
11559
|
// src/config/constants.ts
|
|
@@ -13405,12 +13509,12 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
13405
13509
|
}
|
|
13406
13510
|
};
|
|
13407
13511
|
if (initError) {
|
|
13408
|
-
return /* @__PURE__ */
|
|
13512
|
+
return /* @__PURE__ */ React19.createElement(Box18, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React19.createElement(Text18, { color: "red", bold: true }, "\u274C Initialization Error"), /* @__PURE__ */ React19.createElement(Text18, null, initError), /* @__PURE__ */ React19.createElement(Text18, { dimColor: true }, "\n", "Tip: Run /config to set up your API keys"));
|
|
13409
13513
|
}
|
|
13410
13514
|
if (state.trustLocationSelector) {
|
|
13411
13515
|
const projectDir = state.configStore.getProjectConfigDir();
|
|
13412
13516
|
const inProject = projectDir !== null;
|
|
13413
|
-
return /* @__PURE__ */
|
|
13517
|
+
return /* @__PURE__ */ React19.createElement(
|
|
13414
13518
|
TrustLocationSelector,
|
|
13415
13519
|
{
|
|
13416
13520
|
inProject,
|
|
@@ -13428,7 +13532,7 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
13428
13532
|
);
|
|
13429
13533
|
}
|
|
13430
13534
|
if (state.rewindSelector && state.session) {
|
|
13431
|
-
return /* @__PURE__ */
|
|
13535
|
+
return /* @__PURE__ */ React19.createElement(
|
|
13432
13536
|
RewindSelector,
|
|
13433
13537
|
{
|
|
13434
13538
|
messages: state.session.messages,
|
|
@@ -13446,7 +13550,7 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
13446
13550
|
);
|
|
13447
13551
|
}
|
|
13448
13552
|
if (state.sessionSelector) {
|
|
13449
|
-
return /* @__PURE__ */
|
|
13553
|
+
return /* @__PURE__ */ React19.createElement(
|
|
13450
13554
|
SessionSelector,
|
|
13451
13555
|
{
|
|
13452
13556
|
sessions: state.sessionSelector.sessions,
|
|
@@ -13466,7 +13570,7 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
13466
13570
|
}
|
|
13467
13571
|
if (state.showLoginFlow) {
|
|
13468
13572
|
const loginApiUrl = getApiUrl(state.config?.apiConfig);
|
|
13469
|
-
return /* @__PURE__ */
|
|
13573
|
+
return /* @__PURE__ */ React19.createElement(
|
|
13470
13574
|
LoginFlow,
|
|
13471
13575
|
{
|
|
13472
13576
|
apiUrl: loginApiUrl,
|
|
@@ -13489,10 +13593,10 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
13489
13593
|
);
|
|
13490
13594
|
}
|
|
13491
13595
|
if (!isInitialized) {
|
|
13492
|
-
return /* @__PURE__ */
|
|
13596
|
+
return /* @__PURE__ */ React19.createElement(Box18, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React19.createElement(Text18, null, "\u{1F680} Initializing..."));
|
|
13493
13597
|
}
|
|
13494
13598
|
const allCommands = mergeCommands(state.customCommandStore.getAllCommands());
|
|
13495
|
-
return /* @__PURE__ */
|
|
13599
|
+
return /* @__PURE__ */ React19.createElement(
|
|
13496
13600
|
App,
|
|
13497
13601
|
{
|
|
13498
13602
|
onMessage: handleMessage,
|
|
@@ -13534,6 +13638,6 @@ var isDevMode = import.meta.url.includes("/src/") || process.env.NODE_ENV === "d
|
|
|
13534
13638
|
if (isDevMode) {
|
|
13535
13639
|
logger.debug("\u{1F527} Running in development mode (using TypeScript source)\n");
|
|
13536
13640
|
}
|
|
13537
|
-
render(/* @__PURE__ */
|
|
13641
|
+
render(/* @__PURE__ */ React19.createElement(CliApp, null), {
|
|
13538
13642
|
exitOnCtrlC: false
|
|
13539
13643
|
});
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
findMostSimilarMemento,
|
|
4
4
|
getRelevantMementos
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-ECSELHYP.js";
|
|
6
|
+
import "./chunk-M2CSCYOY.js";
|
|
7
|
+
import "./chunk-LL5J3SVB.js";
|
|
8
8
|
import "./chunk-OCYRD7D6.js";
|
|
9
9
|
export {
|
|
10
10
|
findMostSimilarMemento,
|
|
File without changes
|
|
@@ -220,6 +220,7 @@ import {
|
|
|
220
220
|
WEBSITE_URL,
|
|
221
221
|
WHATS_NEW_VALIDATION_LIMITS,
|
|
222
222
|
WhatsNewConfigSchema,
|
|
223
|
+
WhatsNewSyncConfigSchema,
|
|
223
224
|
XAI_IMAGE_MODELS,
|
|
224
225
|
b4mLLMTools,
|
|
225
226
|
buildSSEEvent,
|
|
@@ -296,7 +297,7 @@ import {
|
|
|
296
297
|
validateReactArtifactV2,
|
|
297
298
|
validateSvgArtifactV2,
|
|
298
299
|
wikiMarkupToAdf
|
|
299
|
-
} from "./chunk-
|
|
300
|
+
} from "./chunk-LL5J3SVB.js";
|
|
300
301
|
export {
|
|
301
302
|
ALL_IMAGE_MODELS,
|
|
302
303
|
ALL_IMAGE_SIZES,
|
|
@@ -518,6 +519,7 @@ export {
|
|
|
518
519
|
WEBSITE_URL,
|
|
519
520
|
WHATS_NEW_VALIDATION_LIMITS,
|
|
520
521
|
WhatsNewConfigSchema,
|
|
522
|
+
WhatsNewSyncConfigSchema,
|
|
521
523
|
XAI_IMAGE_MODELS,
|
|
522
524
|
b4mLLMTools,
|
|
523
525
|
buildSSEEvent,
|
|
@@ -127,8 +127,8 @@ import {
|
|
|
127
127
|
validateMermaidSyntax,
|
|
128
128
|
warmUpSettingsCache,
|
|
129
129
|
withRetry
|
|
130
|
-
} from "./chunk-
|
|
131
|
-
import "./chunk-
|
|
130
|
+
} from "./chunk-M2CSCYOY.js";
|
|
131
|
+
import "./chunk-LL5J3SVB.js";
|
|
132
132
|
import {
|
|
133
133
|
Logger,
|
|
134
134
|
NotificationDeduplicator,
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
SubtractCreditsSchema,
|
|
4
4
|
subtractCredits
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-I3CPL4SJ.js";
|
|
6
|
+
import "./chunk-M2CSCYOY.js";
|
|
7
|
+
import "./chunk-LL5J3SVB.js";
|
|
8
8
|
import "./chunk-OCYRD7D6.js";
|
|
9
9
|
export {
|
|
10
10
|
SubtractCreditsSchema,
|
package/dist/utils-JCHWDM4Z.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bike4mind/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -30,16 +30,6 @@
|
|
|
30
30
|
"dist",
|
|
31
31
|
"bin"
|
|
32
32
|
],
|
|
33
|
-
"scripts": {
|
|
34
|
-
"dev": "tsx src/index.tsx",
|
|
35
|
-
"build": "tsup",
|
|
36
|
-
"typecheck": "tsc --noEmit",
|
|
37
|
-
"test": "vitest run",
|
|
38
|
-
"test:watch": "vitest",
|
|
39
|
-
"start": "node dist/index.js",
|
|
40
|
-
"prepublishOnly": "pnpm build",
|
|
41
|
-
"postinstall": "node -e \"try { require('better-sqlite3') } catch(e) { if(e.message.includes('bindings')) { console.log('\\n⚠️ Rebuilding better-sqlite3 native bindings...'); require('child_process').execSync('pnpm rebuild better-sqlite3', {stdio:'inherit'}) } }\""
|
|
42
|
-
},
|
|
43
33
|
"dependencies": {
|
|
44
34
|
"@anthropic-ai/sdk": "^0.22.0",
|
|
45
35
|
"@aws-sdk/client-apigatewaymanagementapi": "3.654.0",
|
|
@@ -64,6 +54,7 @@
|
|
|
64
54
|
"bcryptjs": "^2.4.3",
|
|
65
55
|
"better-sqlite3": "^12.5.0",
|
|
66
56
|
"cheerio": "1.0.0-rc.12",
|
|
57
|
+
"cli-highlight": "^2.1.11",
|
|
67
58
|
"csv-parse": "^5.5.6",
|
|
68
59
|
"dayjs": "^1.11.13",
|
|
69
60
|
"diff": "^8.0.2",
|
|
@@ -105,11 +96,6 @@
|
|
|
105
96
|
"zustand": "^4.5.4"
|
|
106
97
|
},
|
|
107
98
|
"devDependencies": {
|
|
108
|
-
"@bike4mind/agents": "0.1.0",
|
|
109
|
-
"@bike4mind/common": "2.42.1-fix-cli-backspace-deletion.17486+fb666cf3a",
|
|
110
|
-
"@bike4mind/mcp": "1.21.3-fix-cli-backspace-deletion.17486+fb666cf3a",
|
|
111
|
-
"@bike4mind/services": "2.37.1-fix-cli-backspace-deletion.17486+fb666cf3a",
|
|
112
|
-
"@bike4mind/utils": "2.1.8-fix-cli-backspace-deletion.17486+fb666cf3a",
|
|
113
99
|
"@types/better-sqlite3": "^7.6.13",
|
|
114
100
|
"@types/diff": "^5.0.9",
|
|
115
101
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -121,7 +107,20 @@
|
|
|
121
107
|
"tsup": "^8.5.1",
|
|
122
108
|
"tsx": "^4.21.0",
|
|
123
109
|
"typescript": "^5.9.3",
|
|
124
|
-
"vitest": "^3.2.4"
|
|
110
|
+
"vitest": "^3.2.4",
|
|
111
|
+
"@bike4mind/agents": "0.1.0",
|
|
112
|
+
"@bike4mind/common": "2.42.1",
|
|
113
|
+
"@bike4mind/mcp": "1.22.1",
|
|
114
|
+
"@bike4mind/services": "2.39.0",
|
|
115
|
+
"@bike4mind/utils": "2.1.9"
|
|
125
116
|
},
|
|
126
|
-
"
|
|
127
|
-
|
|
117
|
+
"scripts": {
|
|
118
|
+
"dev": "tsx src/index.tsx",
|
|
119
|
+
"build": "tsup",
|
|
120
|
+
"typecheck": "tsc --noEmit",
|
|
121
|
+
"test": "vitest run",
|
|
122
|
+
"test:watch": "vitest",
|
|
123
|
+
"start": "node dist/index.js",
|
|
124
|
+
"postinstall": "node -e \"try { require('better-sqlite3') } catch(e) { if(e.message.includes('bindings')) { console.log('\\n⚠️ Rebuilding better-sqlite3 native bindings...'); require('child_process').execSync('pnpm rebuild better-sqlite3', {stdio:'inherit'}) } }\""
|
|
125
|
+
}
|
|
126
|
+
}
|