bravecode-cli 0.1.53 → 0.1.54
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/cli-main.mjs +58 -7
- package/dist/cli-main.mjs.map +3 -3
- package/package.json +1 -1
package/dist/cli-main.mjs
CHANGED
|
@@ -38280,7 +38280,7 @@ var APP_VERSION, APP_NAME;
|
|
|
38280
38280
|
var init_version = __esm({
|
|
38281
38281
|
"src/version.ts"() {
|
|
38282
38282
|
"use strict";
|
|
38283
|
-
APP_VERSION = "0.1.
|
|
38283
|
+
APP_VERSION = "0.1.54";
|
|
38284
38284
|
APP_NAME = "BraveCode";
|
|
38285
38285
|
}
|
|
38286
38286
|
});
|
|
@@ -41253,12 +41253,14 @@ IMPORTANT: Only test APIs you have authorization to test. Never attempt to acces
|
|
|
41253
41253
|
* Last-resort extractor for tool calls that the provider's parser missed.
|
|
41254
41254
|
* Handles non-standard tag formats the model emits in plain text, e.g.
|
|
41255
41255
|
* <write_file path="...">...</write_file>, <read_file path="..."/>,
|
|
41256
|
-
* <run_command>cmd</run_command>, including
|
|
41256
|
+
* <run_command>cmd</run_command>, <todowrite>...</todowrite>, including
|
|
41257
|
+
* the HTML-entity-escaped form.
|
|
41257
41258
|
*/
|
|
41258
41259
|
extractNativeToolTags(text2) {
|
|
41259
41260
|
const decoded = text2.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/"/g, '"');
|
|
41260
41261
|
const calls = [];
|
|
41261
|
-
|
|
41262
|
+
let nextId2 = 0;
|
|
41263
|
+
const idSeq = () => `native_${Date.now().toString(36)}_${nextId2++}`;
|
|
41262
41264
|
const wfRe = /<write_file\s+path="([^"]+)">([\s\S]*?)<\/write_file>/g;
|
|
41263
41265
|
let m;
|
|
41264
41266
|
while ((m = wfRe.exec(decoded)) !== null) {
|
|
@@ -41272,7 +41274,20 @@ IMPORTANT: Only test APIs you have authorization to test. Never attempt to acces
|
|
|
41272
41274
|
while ((m = rcRe.exec(decoded)) !== null) {
|
|
41273
41275
|
calls.push({ id: idSeq(), name: "bash", arguments: { command: m[1].trim() } });
|
|
41274
41276
|
}
|
|
41275
|
-
|
|
41277
|
+
const todos = [];
|
|
41278
|
+
const todosBlock = decoded.match(/#\s*Todos\s*\n([\s\S]*?)(?:\n\s*\n|$)/i);
|
|
41279
|
+
if (todosBlock) {
|
|
41280
|
+
const todoRe = /^\s*\[([ xX•\u2022\u25CF\u25CB])\]\s+(.+)$/gm;
|
|
41281
|
+
let t;
|
|
41282
|
+
while ((t = todoRe.exec(todosBlock[1])) !== null) {
|
|
41283
|
+
const mark = t[1].toLowerCase();
|
|
41284
|
+
let status = "pending";
|
|
41285
|
+
if (mark === "x") status = "completed";
|
|
41286
|
+
else if (mark === "\u2022" || mark === "\u25C9" || mark === "o") status = "in_progress";
|
|
41287
|
+
todos.push({ id: idSeq(), content: t[2].trim(), status });
|
|
41288
|
+
}
|
|
41289
|
+
}
|
|
41290
|
+
return { toolCalls: calls, todos };
|
|
41276
41291
|
}
|
|
41277
41292
|
async run(userMessage, onChunk, signal, onToolCall) {
|
|
41278
41293
|
let message = userMessage;
|
|
@@ -41318,7 +41333,11 @@ IMPORTANT: Only test APIs you have authorization to test. Never attempt to acces
|
|
|
41318
41333
|
}
|
|
41319
41334
|
}
|
|
41320
41335
|
if (toolCalls.length === 0) {
|
|
41321
|
-
toolCalls = this.extractNativeToolTags(fullResponse);
|
|
41336
|
+
const { toolCalls: native, todos: nativeTodos } = this.extractNativeToolTags(fullResponse);
|
|
41337
|
+
toolCalls = native;
|
|
41338
|
+
if (nativeTodos.length > 0) {
|
|
41339
|
+
this._lastTodos = nativeTodos;
|
|
41340
|
+
}
|
|
41322
41341
|
}
|
|
41323
41342
|
} else {
|
|
41324
41343
|
const result = await this.provider.chat({
|
|
@@ -41921,7 +41940,17 @@ function useToast() {
|
|
|
41921
41940
|
if (!ctx) throw new Error("useToast must be inside ToastProvider");
|
|
41922
41941
|
return ctx;
|
|
41923
41942
|
}
|
|
41924
|
-
|
|
41943
|
+
function TodoProvider({ children }) {
|
|
41944
|
+
const [todos, setTodos] = React2.useState([]);
|
|
41945
|
+
const value = React2.useMemo(() => ({ todos, setTodos }), [todos]);
|
|
41946
|
+
return React2.createElement(TodoContext.Provider, { value }, children);
|
|
41947
|
+
}
|
|
41948
|
+
function useTodos() {
|
|
41949
|
+
const ctx = React2.useContext(TodoContext);
|
|
41950
|
+
if (!ctx) throw new Error("useTodos must be inside TodoProvider");
|
|
41951
|
+
return ctx;
|
|
41952
|
+
}
|
|
41953
|
+
var SessionContext, msgIdCounter, nextId, AgentContext, DialogContext, ToastContext, toastCounter, TodoContext;
|
|
41925
41954
|
var init_providers = __esm({
|
|
41926
41955
|
"src/core/tui/context/providers.tsx"() {
|
|
41927
41956
|
"use strict";
|
|
@@ -41933,6 +41962,7 @@ var init_providers = __esm({
|
|
|
41933
41962
|
DialogContext = React2.createContext(null);
|
|
41934
41963
|
ToastContext = React2.createContext(null);
|
|
41935
41964
|
toastCounter = 0;
|
|
41965
|
+
TodoContext = React2.createContext(null);
|
|
41936
41966
|
}
|
|
41937
41967
|
});
|
|
41938
41968
|
|
|
@@ -41942,9 +41972,11 @@ function useAgentRunner() {
|
|
|
41942
41972
|
const { addMessage, updateMessage, addToolCall, messages } = useSession();
|
|
41943
41973
|
const { currentAgent, currentModel, setRunning } = useAgent();
|
|
41944
41974
|
const toast = useToast();
|
|
41975
|
+
const { setTodos } = useTodos();
|
|
41945
41976
|
const agentRef = React3.useRef(null);
|
|
41946
41977
|
const abortRef = React3.useRef(null);
|
|
41947
41978
|
const sendMessage = React3.useCallback(async (content) => {
|
|
41979
|
+
setTodos([]);
|
|
41948
41980
|
const userMsg = addMessage({
|
|
41949
41981
|
role: "user",
|
|
41950
41982
|
content,
|
|
@@ -41998,6 +42030,10 @@ function useAgentRunner() {
|
|
|
41998
42030
|
}
|
|
41999
42031
|
);
|
|
42000
42032
|
updateMessage(assistantMsg.id, { content: fullContent });
|
|
42033
|
+
const extractedTodos = agentRef.current?._lastTodos;
|
|
42034
|
+
if (extractedTodos && extractedTodos.length > 0) {
|
|
42035
|
+
setTodos(extractedTodos);
|
|
42036
|
+
}
|
|
42001
42037
|
} catch (err) {
|
|
42002
42038
|
const e = err;
|
|
42003
42039
|
if (e?.name === "AbortError" || e?.message?.includes("abort")) {
|
|
@@ -42035,6 +42071,7 @@ var init_use_agent_runner = __esm({
|
|
|
42035
42071
|
init_providers();
|
|
42036
42072
|
init_providers();
|
|
42037
42073
|
init_providers();
|
|
42074
|
+
init_providers();
|
|
42038
42075
|
}
|
|
42039
42076
|
});
|
|
42040
42077
|
|
|
@@ -44309,8 +44346,16 @@ function PixelLogo() {
|
|
|
44309
44346
|
function Sidebar({ compact = false }) {
|
|
44310
44347
|
const { colors: colors2 } = useTheme();
|
|
44311
44348
|
const { currentAgent, currentModel } = useAgent();
|
|
44349
|
+
const { todos } = useTodos();
|
|
44312
44350
|
const cwd = process.cwd().replace(process.env.HOME ?? "", "~");
|
|
44313
44351
|
const sessionTime = (/* @__PURE__ */ new Date()).toISOString().replace(/\.\d+Z$/, "Z").replace("T", "").slice(0, 19) + "Z";
|
|
44352
|
+
const todoPanel = todos.length > 0 ? /* @__PURE__ */ jsxs("box", { style: { flexDirection: "column", marginTop: 1 }, children: [
|
|
44353
|
+
/* @__PURE__ */ jsx("text", { fg: colors2.text, children: /* @__PURE__ */ jsx("b", { children: "\u25BC Todo" }) }),
|
|
44354
|
+
/* @__PURE__ */ jsx("box", { style: { flexDirection: "column" }, children: todos.map((t) => /* @__PURE__ */ jsxs("box", { style: { flexDirection: "row" }, children: [
|
|
44355
|
+
/* @__PURE__ */ jsx("text", { fg: t.status === "completed" ? colors2.success : t.status === "in_progress" ? colors2.warning : colors2.textMuted, children: t.status === "completed" ? "[\u2713] " : t.status === "in_progress" ? "[\u2022] " : "[ ] " }),
|
|
44356
|
+
/* @__PURE__ */ jsx("text", { fg: t.status === "completed" ? colors2.textMuted : t.status === "in_progress" ? colors2.warning : colors2.text, children: s(t.content) })
|
|
44357
|
+
] }, t.id)) })
|
|
44358
|
+
] }) : null;
|
|
44314
44359
|
if (compact) {
|
|
44315
44360
|
return /* @__PURE__ */ jsxs(
|
|
44316
44361
|
"box",
|
|
@@ -44338,6 +44383,7 @@ function Sidebar({ compact = false }) {
|
|
|
44338
44383
|
/* @__PURE__ */ jsx("text", { fg: colors2.success, children: "\u25CF" }),
|
|
44339
44384
|
/* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: " mcp connected" })
|
|
44340
44385
|
] }),
|
|
44386
|
+
todoPanel,
|
|
44341
44387
|
/* @__PURE__ */ jsx("box", { style: { flexGrow: 1 } }),
|
|
44342
44388
|
/* @__PURE__ */ jsx("box", { style: { marginTop: 1 }, children: /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: s(APP_VERSION) }) }),
|
|
44343
44389
|
/* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: "ctrl+b sidebar" })
|
|
@@ -44375,6 +44421,7 @@ function Sidebar({ compact = false }) {
|
|
|
44375
44421
|
] }),
|
|
44376
44422
|
/* @__PURE__ */ jsx("box", { style: { marginTop: 1 }, children: /* @__PURE__ */ jsx("text", { fg: colors2.text, children: /* @__PURE__ */ jsx("b", { children: "LSP" }) }) }),
|
|
44377
44423
|
/* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: "LSPs are disabled" }),
|
|
44424
|
+
todoPanel,
|
|
44378
44425
|
/* @__PURE__ */ jsx("box", { style: { flexGrow: 1 } }),
|
|
44379
44426
|
/* @__PURE__ */ jsx("box", { style: { marginTop: 1 }, children: /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: s(cwd) }) }),
|
|
44380
44427
|
/* @__PURE__ */ jsxs("box", { children: [
|
|
@@ -45261,7 +45308,11 @@ var init_tui = __esm({
|
|
|
45261
45308
|
React5.createElement(
|
|
45262
45309
|
ToastProvider,
|
|
45263
45310
|
null,
|
|
45264
|
-
React5.createElement(
|
|
45311
|
+
React5.createElement(
|
|
45312
|
+
TodoProvider,
|
|
45313
|
+
null,
|
|
45314
|
+
React5.createElement(App, null)
|
|
45315
|
+
)
|
|
45265
45316
|
)
|
|
45266
45317
|
)
|
|
45267
45318
|
)
|