@bike4mind/cli 0.2.7-feat-cli-rewind-command.17128 → 0.2.7-feature-notebook-splash-redesign.17129
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/index.js +34 -233
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -79,8 +79,8 @@ import {
|
|
|
79
79
|
} from "./chunk-PDX44BCA.js";
|
|
80
80
|
|
|
81
81
|
// src/index.tsx
|
|
82
|
-
import
|
|
83
|
-
import { render, Box as
|
|
82
|
+
import React13, { useState as useState4, useEffect as useEffect3, useCallback, useRef } from "react";
|
|
83
|
+
import { render, Box as Box13, Text as Text12, useApp, useInput as useInput3 } from "ink";
|
|
84
84
|
import { v4 as uuidv49 } from "uuid";
|
|
85
85
|
|
|
86
86
|
// src/components/App.tsx
|
|
@@ -389,11 +389,6 @@ var COMMANDS = [
|
|
|
389
389
|
name: "clear",
|
|
390
390
|
description: "Start a new session",
|
|
391
391
|
aliases: ["new"]
|
|
392
|
-
},
|
|
393
|
-
{
|
|
394
|
-
name: "rewind",
|
|
395
|
-
description: "Rewind conversation to a previous point",
|
|
396
|
-
aliases: ["undo"]
|
|
397
392
|
}
|
|
398
393
|
];
|
|
399
394
|
|
|
@@ -630,26 +625,12 @@ function findAtTrigger(value) {
|
|
|
630
625
|
}
|
|
631
626
|
return null;
|
|
632
627
|
}
|
|
633
|
-
function InputPrompt({
|
|
634
|
-
onSubmit,
|
|
635
|
-
onImageDetected,
|
|
636
|
-
disabled = false,
|
|
637
|
-
history = [],
|
|
638
|
-
prefillInput,
|
|
639
|
-
onPrefillConsumed
|
|
640
|
-
}) {
|
|
628
|
+
function InputPrompt({ onSubmit, onImageDetected, disabled = false, history = [] }) {
|
|
641
629
|
const [value, setValue] = useState("");
|
|
642
630
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
643
631
|
const [historyIndex, setHistoryIndex] = useState(-1);
|
|
644
632
|
const [tempInput, setTempInput] = useState("");
|
|
645
633
|
const [inputKey, setInputKey] = useState(0);
|
|
646
|
-
useEffect(() => {
|
|
647
|
-
if (prefillInput) {
|
|
648
|
-
setValue(prefillInput);
|
|
649
|
-
setInputKey((prev) => prev + 1);
|
|
650
|
-
onPrefillConsumed?.();
|
|
651
|
-
}
|
|
652
|
-
}, [prefillInput, onPrefillConsumed]);
|
|
653
634
|
const [fileAutocomplete, setFileAutocomplete] = useState(null);
|
|
654
635
|
const [fileSelectedIndex, setFileSelectedIndex] = useState(0);
|
|
655
636
|
const shouldShowCommandAutocomplete = value.startsWith("/") && !disabled && !fileAutocomplete?.active;
|
|
@@ -1243,9 +1224,7 @@ function App({
|
|
|
1243
1224
|
commandHistory = [],
|
|
1244
1225
|
config,
|
|
1245
1226
|
availableModels = [],
|
|
1246
|
-
onSaveConfig
|
|
1247
|
-
prefillInput,
|
|
1248
|
-
onPrefillConsumed
|
|
1227
|
+
onSaveConfig
|
|
1249
1228
|
}) {
|
|
1250
1229
|
const messages = useCliStore((state) => state.session?.messages || []);
|
|
1251
1230
|
const sessionName = useCliStore((state) => state.session?.name || "New Session");
|
|
@@ -1309,9 +1288,7 @@ ${errorBlock}`;
|
|
|
1309
1288
|
onSubmit: handleSubmit,
|
|
1310
1289
|
onImageDetected,
|
|
1311
1290
|
disabled: isThinking,
|
|
1312
|
-
history: commandHistory
|
|
1313
|
-
prefillInput,
|
|
1314
|
-
onPrefillConsumed
|
|
1291
|
+
history: commandHistory
|
|
1315
1292
|
}
|
|
1316
1293
|
))));
|
|
1317
1294
|
}
|
|
@@ -1403,78 +1380,9 @@ function TrustLocationSelector({ inProject, onSelect, onCancel }) {
|
|
|
1403
1380
|
), /* @__PURE__ */ React11.createElement(Box11, { marginTop: 1 }, /* @__PURE__ */ React11.createElement(Text10, { dimColor: true }, "Use \u2191\u2193 arrows to navigate, Enter to select, Ctrl+C to cancel")));
|
|
1404
1381
|
}
|
|
1405
1382
|
|
|
1406
|
-
// src/components/RewindSelector.tsx
|
|
1407
|
-
import React12, { useState as useState3 } from "react";
|
|
1408
|
-
import { Box as Box12, Text as Text11, useInput as useInput3 } from "ink";
|
|
1409
|
-
import SelectInput3 from "ink-select-input";
|
|
1410
|
-
function RewindSelector({ messages, onSelect, onCancel }) {
|
|
1411
|
-
const [step, setStep] = useState3("selection");
|
|
1412
|
-
const [selectedMessageIndex, setSelectedMessageIndex] = useState3(null);
|
|
1413
|
-
useInput3((input, key) => {
|
|
1414
|
-
if (key.escape) {
|
|
1415
|
-
if (step === "confirmation") {
|
|
1416
|
-
setStep("selection");
|
|
1417
|
-
setSelectedMessageIndex(null);
|
|
1418
|
-
} else {
|
|
1419
|
-
onCancel();
|
|
1420
|
-
}
|
|
1421
|
-
}
|
|
1422
|
-
});
|
|
1423
|
-
const userMessages = messages.map((msg, idx) => ({ msg, originalIndex: idx })).filter(({ msg }) => msg.role === "user");
|
|
1424
|
-
const items = userMessages.map(({ msg, originalIndex }, index) => {
|
|
1425
|
-
const preview = msg.content.length > 50 ? msg.content.substring(0, 50) + "..." : msg.content;
|
|
1426
|
-
const timestamp = new Date(msg.timestamp).toLocaleString();
|
|
1427
|
-
const position = index + 1;
|
|
1428
|
-
return {
|
|
1429
|
-
label: `[${position}] ${timestamp} - ${preview}`,
|
|
1430
|
-
value: originalIndex
|
|
1431
|
-
};
|
|
1432
|
-
});
|
|
1433
|
-
const handleSelectionSelect = (item) => {
|
|
1434
|
-
setSelectedMessageIndex(item.value);
|
|
1435
|
-
setStep("confirmation");
|
|
1436
|
-
};
|
|
1437
|
-
const handleConfirmationSelect = (item) => {
|
|
1438
|
-
if (item.value === "confirm" && selectedMessageIndex !== null) {
|
|
1439
|
-
onSelect(selectedMessageIndex);
|
|
1440
|
-
} else {
|
|
1441
|
-
setStep("selection");
|
|
1442
|
-
setSelectedMessageIndex(null);
|
|
1443
|
-
}
|
|
1444
|
-
};
|
|
1445
|
-
const messagesToRemove = selectedMessageIndex !== null && selectedMessageIndex >= 0 && selectedMessageIndex < messages.length ? messages.slice(selectedMessageIndex) : [];
|
|
1446
|
-
const tokensToRemove = messagesToRemove.reduce((sum2, msg) => {
|
|
1447
|
-
return sum2 + (msg.metadata?.tokenUsage?.total || 0);
|
|
1448
|
-
}, 0);
|
|
1449
|
-
if (step === "selection") {
|
|
1450
|
-
return /* @__PURE__ */ React12.createElement(Box12, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React12.createElement(Box12, { marginBottom: 1 }, /* @__PURE__ */ React12.createElement(Text11, { bold: true }, "Select a point to rewind to:")), /* @__PURE__ */ React12.createElement(
|
|
1451
|
-
SelectInput3,
|
|
1452
|
-
{
|
|
1453
|
-
items,
|
|
1454
|
-
onSelect: handleSelectionSelect,
|
|
1455
|
-
itemComponent: ({ isSelected, label }) => /* @__PURE__ */ React12.createElement(Box12, null, /* @__PURE__ */ React12.createElement(Text11, { color: isSelected ? "cyan" : void 0 }, isSelected ? "\u276F " : " ", label))
|
|
1456
|
-
}
|
|
1457
|
-
), /* @__PURE__ */ React12.createElement(Box12, { marginTop: 1 }, /* @__PURE__ */ React12.createElement(Text11, { dimColor: true }, "Use \u2191\u2193 arrows to navigate, Enter to select, Esc to cancel")));
|
|
1458
|
-
}
|
|
1459
|
-
const confirmationItems = [
|
|
1460
|
-
{ label: "Yes, rewind to this point", value: "confirm" },
|
|
1461
|
-
{ label: "No, go back to selection", value: "cancel" }
|
|
1462
|
-
];
|
|
1463
|
-
const selectedMessage = selectedMessageIndex !== null && selectedMessageIndex >= 0 && selectedMessageIndex < messages.length ? messages[selectedMessageIndex] : null;
|
|
1464
|
-
const selectedPreview = selectedMessage ? selectedMessage.content.length > 50 ? selectedMessage.content.substring(0, 50) + "..." : selectedMessage.content : "";
|
|
1465
|
-
return /* @__PURE__ */ React12.createElement(Box12, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React12.createElement(Box12, { marginBottom: 1, flexDirection: "column" }, /* @__PURE__ */ React12.createElement(Text11, { bold: true }, "Confirm rewind operation:"), /* @__PURE__ */ React12.createElement(Text11, { dimColor: true }, "Message: ", selectedPreview), /* @__PURE__ */ React12.createElement(Text11, { color: "yellow" }, "This will remove ", messagesToRemove.length, " message(s) (", tokensToRemove.toLocaleString(), " tokens)"), /* @__PURE__ */ React12.createElement(Text11, { color: "cyan" }, "The selected message will be placed in your input for editing.")), /* @__PURE__ */ React12.createElement(
|
|
1466
|
-
SelectInput3,
|
|
1467
|
-
{
|
|
1468
|
-
items: confirmationItems,
|
|
1469
|
-
onSelect: handleConfirmationSelect,
|
|
1470
|
-
itemComponent: ({ isSelected, label }) => /* @__PURE__ */ React12.createElement(Box12, null, /* @__PURE__ */ React12.createElement(Text11, { color: isSelected ? "cyan" : void 0 }, isSelected ? "\u276F " : " ", label))
|
|
1471
|
-
}
|
|
1472
|
-
), /* @__PURE__ */ React12.createElement(Box12, { marginTop: 1 }, /* @__PURE__ */ React12.createElement(Text11, { dimColor: true }, "Use \u2191\u2193 arrows to navigate, Enter to select, Esc to go back")));
|
|
1473
|
-
}
|
|
1474
|
-
|
|
1475
1383
|
// src/components/LoginFlow.tsx
|
|
1476
|
-
import
|
|
1477
|
-
import { Box as
|
|
1384
|
+
import React12, { useState as useState3, useEffect as useEffect2 } from "react";
|
|
1385
|
+
import { Box as Box12, Text as Text11 } from "ink";
|
|
1478
1386
|
import Spinner2 from "ink-spinner";
|
|
1479
1387
|
import jwt from "jsonwebtoken";
|
|
1480
1388
|
import open from "open";
|
|
@@ -1590,10 +1498,10 @@ var OAuthClient = class {
|
|
|
1590
1498
|
|
|
1591
1499
|
// src/components/LoginFlow.tsx
|
|
1592
1500
|
function LoginFlow({ apiUrl = "http://localhost:3000", configStore, onSuccess, onError }) {
|
|
1593
|
-
const [status, setStatus] =
|
|
1594
|
-
const [deviceFlow, setDeviceFlow] =
|
|
1595
|
-
const [statusMessage, setStatusMessage] =
|
|
1596
|
-
const [error, setError] =
|
|
1501
|
+
const [status, setStatus] = useState3("initiating");
|
|
1502
|
+
const [deviceFlow, setDeviceFlow] = useState3(null);
|
|
1503
|
+
const [statusMessage, setStatusMessage] = useState3("Initiating device authorization...");
|
|
1504
|
+
const [error, setError] = useState3(null);
|
|
1597
1505
|
useEffect2(() => {
|
|
1598
1506
|
const runLoginFlow = async () => {
|
|
1599
1507
|
const oauth = new OAuthClient(apiUrl);
|
|
@@ -1637,15 +1545,15 @@ function LoginFlow({ apiUrl = "http://localhost:3000", configStore, onSuccess, o
|
|
|
1637
1545
|
}
|
|
1638
1546
|
}, [deviceFlow, status]);
|
|
1639
1547
|
if (status === "initiating") {
|
|
1640
|
-
return /* @__PURE__ */
|
|
1548
|
+
return /* @__PURE__ */ React12.createElement(Box12, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React12.createElement(Box12, null, /* @__PURE__ */ React12.createElement(Text11, { color: "cyan" }, /* @__PURE__ */ React12.createElement(Spinner2, { type: "dots" }), " Initiating device authorization...")));
|
|
1641
1549
|
}
|
|
1642
1550
|
if (status === "error") {
|
|
1643
|
-
return /* @__PURE__ */
|
|
1551
|
+
return /* @__PURE__ */ React12.createElement(Box12, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React12.createElement(Box12, { marginBottom: 1 }, /* @__PURE__ */ React12.createElement(Text11, { color: "red", bold: true }, "\u2716 Authentication Failed")), /* @__PURE__ */ React12.createElement(Box12, null, /* @__PURE__ */ React12.createElement(Text11, { color: "red" }, error)));
|
|
1644
1552
|
}
|
|
1645
1553
|
if (status === "success") {
|
|
1646
|
-
return /* @__PURE__ */
|
|
1554
|
+
return /* @__PURE__ */ React12.createElement(Box12, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React12.createElement(Box12, { marginBottom: 1 }, /* @__PURE__ */ React12.createElement(Text11, { color: "green", bold: true }, "\u2714 Successfully authenticated!")), /* @__PURE__ */ React12.createElement(Box12, null, /* @__PURE__ */ React12.createElement(Text11, { dimColor: true }, "You can now use B4M CLI with your account.")));
|
|
1647
1555
|
}
|
|
1648
|
-
return /* @__PURE__ */
|
|
1556
|
+
return /* @__PURE__ */ React12.createElement(Box12, { flexDirection: "column", padding: 1, borderStyle: "round", borderColor: "cyan" }, /* @__PURE__ */ React12.createElement(Box12, { marginBottom: 1 }, /* @__PURE__ */ React12.createElement(Text11, { color: "cyan", bold: true }, "\u{1F510} Device Authorization")), /* @__PURE__ */ React12.createElement(Box12, { marginBottom: 1 }, /* @__PURE__ */ React12.createElement(Text11, null, "Opening browser automatically... If it doesn't open, please visit:")), /* @__PURE__ */ React12.createElement(Box12, { marginBottom: 1, paddingLeft: 2 }, /* @__PURE__ */ React12.createElement(Text11, { color: "blue", bold: true }, deviceFlow?.verification_uri)), /* @__PURE__ */ React12.createElement(Box12, { marginBottom: 1 }, /* @__PURE__ */ React12.createElement(Text11, null, "And enter this code when prompted:")), /* @__PURE__ */ React12.createElement(Box12, { marginBottom: 1, paddingLeft: 2 }, /* @__PURE__ */ React12.createElement(Text11, { color: "yellow", bold: true }, deviceFlow?.user_code)), /* @__PURE__ */ React12.createElement(Box12, { marginTop: 1 }, /* @__PURE__ */ React12.createElement(Text11, { color: "cyan" }, /* @__PURE__ */ React12.createElement(Spinner2, { type: "dots" }), " ", statusMessage)), /* @__PURE__ */ React12.createElement(Box12, { marginTop: 1 }, /* @__PURE__ */ React12.createElement(Text11, { dimColor: true }, "Expires in ", deviceFlow ? Math.floor(deviceFlow.expires_in / 60) : 0, " minutes")));
|
|
1649
1557
|
}
|
|
1650
1558
|
|
|
1651
1559
|
// src/storage/SessionStore.ts
|
|
@@ -10353,7 +10261,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
|
|
|
10353
10261
|
// package.json
|
|
10354
10262
|
var package_default = {
|
|
10355
10263
|
name: "@bike4mind/cli",
|
|
10356
|
-
version: "0.2.7-
|
|
10264
|
+
version: "0.2.7-feature-notebook-splash-redesign.17129+59a337a9d",
|
|
10357
10265
|
type: "module",
|
|
10358
10266
|
description: "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
10359
10267
|
license: "UNLICENSED",
|
|
@@ -10456,11 +10364,11 @@ var package_default = {
|
|
|
10456
10364
|
},
|
|
10457
10365
|
devDependencies: {
|
|
10458
10366
|
"@bike4mind/agents": "0.1.0",
|
|
10459
|
-
"@bike4mind/common": "2.38.1-
|
|
10460
|
-
"@bike4mind/mcp": "1.20.1-
|
|
10461
|
-
"@bike4mind/services": "2.33.1-
|
|
10462
|
-
"@bike4mind/utils": "2.1.2-
|
|
10463
|
-
"@types/better-sqlite3": "^7.6.
|
|
10367
|
+
"@bike4mind/common": "2.38.1-feature-notebook-splash-redesign.17129+59a337a9d",
|
|
10368
|
+
"@bike4mind/mcp": "1.20.1-feature-notebook-splash-redesign.17129+59a337a9d",
|
|
10369
|
+
"@bike4mind/services": "2.33.1-feature-notebook-splash-redesign.17129+59a337a9d",
|
|
10370
|
+
"@bike4mind/utils": "2.1.2-feature-notebook-splash-redesign.17129+59a337a9d",
|
|
10371
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
10464
10372
|
"@types/diff": "^5.0.9",
|
|
10465
10373
|
"@types/jsonwebtoken": "^9.0.4",
|
|
10466
10374
|
"@types/node": "^22.9.0",
|
|
@@ -10472,7 +10380,7 @@ var package_default = {
|
|
|
10472
10380
|
typescript: "^5.9.3",
|
|
10473
10381
|
vitest: "^3.2.4"
|
|
10474
10382
|
},
|
|
10475
|
-
gitHead: "
|
|
10383
|
+
gitHead: "59a337a9d7a8fddb596b5903547f09463ae4a05e"
|
|
10476
10384
|
};
|
|
10477
10385
|
|
|
10478
10386
|
// src/config/constants.ts
|
|
@@ -10494,7 +10402,7 @@ var usageCache = null;
|
|
|
10494
10402
|
function CliApp() {
|
|
10495
10403
|
const { exit } = useApp();
|
|
10496
10404
|
const imageRenderer = new ImageRenderer();
|
|
10497
|
-
const [state, setState] =
|
|
10405
|
+
const [state, setState] = useState4({
|
|
10498
10406
|
session: null,
|
|
10499
10407
|
sessionStore: new SessionStore(),
|
|
10500
10408
|
configStore: new ConfigStore(),
|
|
@@ -10507,12 +10415,11 @@ function CliApp() {
|
|
|
10507
10415
|
mcpManager: null,
|
|
10508
10416
|
permissionManager: null,
|
|
10509
10417
|
permissionPrompt: null,
|
|
10510
|
-
trustLocationSelector: null
|
|
10511
|
-
rewindSelector: null
|
|
10418
|
+
trustLocationSelector: null
|
|
10512
10419
|
});
|
|
10513
|
-
const [isInitialized, setIsInitialized] =
|
|
10514
|
-
const [initError, setInitError] =
|
|
10515
|
-
const [commandHistory, setCommandHistory] =
|
|
10420
|
+
const [isInitialized, setIsInitialized] = useState4(false);
|
|
10421
|
+
const [initError, setInitError] = useState4(null);
|
|
10422
|
+
const [commandHistory, setCommandHistory] = useState4([]);
|
|
10516
10423
|
const imageStoreInitPromise = useRef(null);
|
|
10517
10424
|
const setStoreSession = useCliStore((state2) => state2.setSession);
|
|
10518
10425
|
const setPermissionPrompt = useCliStore((state2) => state2.setPermissionPrompt);
|
|
@@ -10553,7 +10460,7 @@ function CliApp() {
|
|
|
10553
10460
|
process.exit(0);
|
|
10554
10461
|
}, 100);
|
|
10555
10462
|
}, [state.session, state.sessionStore, state.mcpManager, state.agent, state.imageStore]);
|
|
10556
|
-
|
|
10463
|
+
useInput3((input, key) => {
|
|
10557
10464
|
if (key.ctrl && input === "c") {
|
|
10558
10465
|
const now = Date.now();
|
|
10559
10466
|
if (exitTimestamp && now - exitTimestamp < EXIT_TIMEOUT_MS) {
|
|
@@ -10907,30 +10814,6 @@ Remember: Use context from previous messages to understand follow-up questions.`
|
|
|
10907
10814
|
throw error;
|
|
10908
10815
|
}
|
|
10909
10816
|
};
|
|
10910
|
-
const recalculateSessionMetadata = (messages) => {
|
|
10911
|
-
let totalTokens = 0;
|
|
10912
|
-
let totalCost = 0;
|
|
10913
|
-
let toolCallCount = 0;
|
|
10914
|
-
for (const msg of messages) {
|
|
10915
|
-
if (msg.metadata) {
|
|
10916
|
-
if (msg.metadata.tokenUsage) {
|
|
10917
|
-
totalTokens += msg.metadata.tokenUsage.total || 0;
|
|
10918
|
-
}
|
|
10919
|
-
if (msg.metadata.cost) {
|
|
10920
|
-
totalCost += msg.metadata.cost;
|
|
10921
|
-
}
|
|
10922
|
-
if (msg.metadata.steps) {
|
|
10923
|
-
const observations = msg.metadata.steps.filter((s) => s.type === "observation");
|
|
10924
|
-
toolCallCount += observations.length;
|
|
10925
|
-
}
|
|
10926
|
-
}
|
|
10927
|
-
}
|
|
10928
|
-
return {
|
|
10929
|
-
totalTokens,
|
|
10930
|
-
totalCost,
|
|
10931
|
-
toolCallCount
|
|
10932
|
-
};
|
|
10933
|
-
};
|
|
10934
10817
|
const handleCommand = async (command, args) => {
|
|
10935
10818
|
switch (command) {
|
|
10936
10819
|
case "help":
|
|
@@ -10939,7 +10822,6 @@ Available commands:
|
|
|
10939
10822
|
/help - Show this help message
|
|
10940
10823
|
/exit - Exit the CLI
|
|
10941
10824
|
/clear - Start a new session
|
|
10942
|
-
/rewind - Rewind conversation to a previous point
|
|
10943
10825
|
/login - Authenticate with your B4M account
|
|
10944
10826
|
/logout - Clear authentication and sign out
|
|
10945
10827
|
/whoami - Show current authenticated user
|
|
@@ -11215,65 +11097,6 @@ Project Configuration:
|
|
|
11215
11097
|
`);
|
|
11216
11098
|
break;
|
|
11217
11099
|
}
|
|
11218
|
-
case "rewind":
|
|
11219
|
-
case "undo": {
|
|
11220
|
-
if (!state.session) {
|
|
11221
|
-
console.log("No active session to rewind");
|
|
11222
|
-
return;
|
|
11223
|
-
}
|
|
11224
|
-
if (state.session.messages.length === 0) {
|
|
11225
|
-
console.log("\u26A0\uFE0F Conversation is empty. Nothing to rewind.");
|
|
11226
|
-
return;
|
|
11227
|
-
}
|
|
11228
|
-
const userMessages = state.session.messages.filter((msg) => msg.role === "user");
|
|
11229
|
-
if (userMessages.length === 0) {
|
|
11230
|
-
console.log("\u26A0\uFE0F No user messages found. Nothing to rewind.");
|
|
11231
|
-
return;
|
|
11232
|
-
}
|
|
11233
|
-
if (userMessages.length === 1) {
|
|
11234
|
-
console.log("\u26A0\uFE0F Only one exchange in the conversation. Use /clear to start a new session instead.");
|
|
11235
|
-
return;
|
|
11236
|
-
}
|
|
11237
|
-
const handleRewindSelect = async (messageIndex) => {
|
|
11238
|
-
setState((prev) => ({ ...prev, rewindSelector: null }));
|
|
11239
|
-
if (messageIndex === null) {
|
|
11240
|
-
console.log("\u274C Rewind operation cancelled");
|
|
11241
|
-
return;
|
|
11242
|
-
}
|
|
11243
|
-
if (!state.session) {
|
|
11244
|
-
console.log("\u274C No active session");
|
|
11245
|
-
return;
|
|
11246
|
-
}
|
|
11247
|
-
const selectedMessage = state.session.messages[messageIndex];
|
|
11248
|
-
const prefillContent = selectedMessage?.content || "";
|
|
11249
|
-
const rewindedMessages = state.session.messages.slice(0, messageIndex);
|
|
11250
|
-
const newMetadata = recalculateSessionMetadata(rewindedMessages);
|
|
11251
|
-
const rewindedSession = {
|
|
11252
|
-
...state.session,
|
|
11253
|
-
messages: rewindedMessages,
|
|
11254
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11255
|
-
metadata: newMetadata
|
|
11256
|
-
};
|
|
11257
|
-
setState((prev) => ({
|
|
11258
|
-
...prev,
|
|
11259
|
-
session: rewindedSession,
|
|
11260
|
-
prefillInput: prefillContent
|
|
11261
|
-
}));
|
|
11262
|
-
setStoreSession(rewindedSession);
|
|
11263
|
-
await state.sessionStore.save(rewindedSession);
|
|
11264
|
-
console.log("\u2705 Conversation rewound successfully");
|
|
11265
|
-
console.log(`\u{1F4CA} Current state: ${rewindedMessages.length} messages, ${newMetadata.totalTokens} tokens`);
|
|
11266
|
-
console.log(`\u{1F4DD} Your message has been placed in the input. Edit and send when ready.
|
|
11267
|
-
`);
|
|
11268
|
-
};
|
|
11269
|
-
setState((prev) => ({
|
|
11270
|
-
...prev,
|
|
11271
|
-
rewindSelector: {
|
|
11272
|
-
resolve: handleRewindSelect
|
|
11273
|
-
}
|
|
11274
|
-
}));
|
|
11275
|
-
break;
|
|
11276
|
-
}
|
|
11277
11100
|
case "usage": {
|
|
11278
11101
|
const usageAuthTokens = await state.configStore.getAuthTokens();
|
|
11279
11102
|
if (!usageAuthTokens || new Date(usageAuthTokens.expiresAt) <= /* @__PURE__ */ new Date()) {
|
|
@@ -11427,12 +11250,12 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
11427
11250
|
setState((prev) => ({ ...prev, config: updatedConfig }));
|
|
11428
11251
|
};
|
|
11429
11252
|
if (initError) {
|
|
11430
|
-
return /* @__PURE__ */
|
|
11253
|
+
return /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React13.createElement(Text12, { color: "red", bold: true }, "\u274C Initialization Error"), /* @__PURE__ */ React13.createElement(Text12, null, initError), /* @__PURE__ */ React13.createElement(Text12, { dimColor: true }, "\n", "Tip: Run /config to set up your API keys"));
|
|
11431
11254
|
}
|
|
11432
11255
|
if (state.trustLocationSelector) {
|
|
11433
11256
|
const projectDir = state.configStore.getProjectConfigDir();
|
|
11434
11257
|
const inProject = projectDir !== null;
|
|
11435
|
-
return /* @__PURE__ */
|
|
11258
|
+
return /* @__PURE__ */ React13.createElement(
|
|
11436
11259
|
TrustLocationSelector,
|
|
11437
11260
|
{
|
|
11438
11261
|
inProject,
|
|
@@ -11449,27 +11272,9 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
11449
11272
|
}
|
|
11450
11273
|
);
|
|
11451
11274
|
}
|
|
11452
|
-
if (state.rewindSelector && state.session) {
|
|
11453
|
-
return /* @__PURE__ */ React14.createElement(
|
|
11454
|
-
RewindSelector,
|
|
11455
|
-
{
|
|
11456
|
-
messages: state.session.messages,
|
|
11457
|
-
onSelect: (messageIndex) => {
|
|
11458
|
-
if (state.rewindSelector) {
|
|
11459
|
-
state.rewindSelector.resolve(messageIndex);
|
|
11460
|
-
}
|
|
11461
|
-
},
|
|
11462
|
-
onCancel: () => {
|
|
11463
|
-
if (state.rewindSelector) {
|
|
11464
|
-
state.rewindSelector.resolve(null);
|
|
11465
|
-
}
|
|
11466
|
-
}
|
|
11467
|
-
}
|
|
11468
|
-
);
|
|
11469
|
-
}
|
|
11470
11275
|
if (state.showLoginFlow) {
|
|
11471
11276
|
const loginApiUrl = getApiUrl(state.config?.apiConfig);
|
|
11472
|
-
return /* @__PURE__ */
|
|
11277
|
+
return /* @__PURE__ */ React13.createElement(
|
|
11473
11278
|
LoginFlow,
|
|
11474
11279
|
{
|
|
11475
11280
|
apiUrl: loginApiUrl,
|
|
@@ -11492,9 +11297,9 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
11492
11297
|
);
|
|
11493
11298
|
}
|
|
11494
11299
|
if (!isInitialized) {
|
|
11495
|
-
return /* @__PURE__ */
|
|
11300
|
+
return /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React13.createElement(Text12, null, "\u{1F680} Initializing..."));
|
|
11496
11301
|
}
|
|
11497
|
-
return /* @__PURE__ */
|
|
11302
|
+
return /* @__PURE__ */ React13.createElement(
|
|
11498
11303
|
App,
|
|
11499
11304
|
{
|
|
11500
11305
|
onMessage: handleMessage,
|
|
@@ -11504,10 +11309,6 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
11504
11309
|
config: state.config,
|
|
11505
11310
|
availableModels: state.availableModels,
|
|
11506
11311
|
onSaveConfig: handleSaveConfig,
|
|
11507
|
-
prefillInput: state.prefillInput,
|
|
11508
|
-
onPrefillConsumed: () => {
|
|
11509
|
-
setState((prev) => ({ ...prev, prefillInput: void 0 }));
|
|
11510
|
-
},
|
|
11511
11312
|
onPermissionResponse: (response) => {
|
|
11512
11313
|
if (state.permissionPrompt) {
|
|
11513
11314
|
state.permissionPrompt.resolve({ action: response });
|
|
@@ -11533,6 +11334,6 @@ var isDevMode = import.meta.url.includes("/src/") || process.env.NODE_ENV === "d
|
|
|
11533
11334
|
if (isDevMode) {
|
|
11534
11335
|
console.log("\u{1F527} Running in development mode (using TypeScript source)\n");
|
|
11535
11336
|
}
|
|
11536
|
-
render(/* @__PURE__ */
|
|
11337
|
+
render(/* @__PURE__ */ React13.createElement(CliApp, null), {
|
|
11537
11338
|
exitOnCtrlC: false
|
|
11538
11339
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bike4mind/cli",
|
|
3
|
-
"version": "0.2.7-
|
|
3
|
+
"version": "0.2.7-feature-notebook-splash-redesign.17129+59a337a9d",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -103,11 +103,11 @@
|
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
105
|
"@bike4mind/agents": "0.1.0",
|
|
106
|
-
"@bike4mind/common": "2.38.1-
|
|
107
|
-
"@bike4mind/mcp": "1.20.1-
|
|
108
|
-
"@bike4mind/services": "2.33.1-
|
|
109
|
-
"@bike4mind/utils": "2.1.2-
|
|
110
|
-
"@types/better-sqlite3": "^7.6.
|
|
106
|
+
"@bike4mind/common": "2.38.1-feature-notebook-splash-redesign.17129+59a337a9d",
|
|
107
|
+
"@bike4mind/mcp": "1.20.1-feature-notebook-splash-redesign.17129+59a337a9d",
|
|
108
|
+
"@bike4mind/services": "2.33.1-feature-notebook-splash-redesign.17129+59a337a9d",
|
|
109
|
+
"@bike4mind/utils": "2.1.2-feature-notebook-splash-redesign.17129+59a337a9d",
|
|
110
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
111
111
|
"@types/diff": "^5.0.9",
|
|
112
112
|
"@types/jsonwebtoken": "^9.0.4",
|
|
113
113
|
"@types/node": "^22.9.0",
|
|
@@ -119,5 +119,5 @@
|
|
|
119
119
|
"typescript": "^5.9.3",
|
|
120
120
|
"vitest": "^3.2.4"
|
|
121
121
|
},
|
|
122
|
-
"gitHead": "
|
|
122
|
+
"gitHead": "59a337a9d7a8fddb596b5903547f09463ae4a05e"
|
|
123
123
|
}
|