code-ollama 0.22.0 → 0.23.0
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/assets/{tui-CzkVRFXf.js → tui-iewVFcZW.js} +75 -51
- package/dist/cli.js +89 -47
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as NAME, A as loadConfig, B as ASSISTANT, C as checkHealth, D as pullModel, E as listModels, F as withSystemMessage, G as BACK, H as USER, I as HEADER_PREFIX, J as LABEL, K as CATALOG, L as WARNING, M as removeClipboardImage, N as saveClipboardImage, O as sanitizeAssistantContent, P as resetSystemMessage, Q as REJECT, R as LIST$1, S as TOOL_INTENT_CORRECTION, T as hasUncalledToolIntent, U as PLAN_GENERATION_INSTRUCTION, V as SYSTEM, W as PLAN_INSTRUCTION, X as SAFE, Y as PLAN, Z as APPROVE, _ as loadSession, a as normalizeToolCall, b as reset, c as WRITE_TOOLS, d as write, et as VERSION, f as appendMessage, g as listSessions, h as deleteSessionIfEmpty, i as formatToolResultContent, j as saveConfig, k as streamChat, l as tick, m as deleteSession, n as executeTool, o as READ_TOOLS, p as createSession, q as AUTO, r as executeToolCall, s as TOOLS, t as checkForUpdate, tt as LIST, u as color, v as updateSessionModel, w as deleteModel, x as setClearHandler, y as clear, z as getTheme } from "../cli.js";
|
|
2
2
|
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { basename, extname, isAbsolute, join, relative, resolve } from "node:path";
|
|
@@ -533,29 +533,26 @@ function Message({ message, isStreaming = false, theme }) {
|
|
|
533
533
|
//#endregion
|
|
534
534
|
//#region src/components/Messages/Messages.tsx
|
|
535
535
|
function Messages({ messages, isLoading, sessionId, streamingMessage, theme = getTheme() }) {
|
|
536
|
-
return /* @__PURE__ */ jsxs(
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
/* @__PURE__ */ jsx(
|
|
540
|
-
|
|
541
|
-
children: (message, index) => /* @__PURE__ */ jsx(Message, {
|
|
542
|
-
message,
|
|
543
|
-
theme
|
|
544
|
-
}, index)
|
|
545
|
-
}, sessionId),
|
|
546
|
-
streamingMessage && /* @__PURE__ */ jsx(Message, {
|
|
547
|
-
isStreaming: true,
|
|
548
|
-
message: streamingMessage,
|
|
536
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
537
|
+
/* @__PURE__ */ jsx(Static, {
|
|
538
|
+
items: messages.filter(({ content }) => content !== TURN_ABORTED_MESSAGE),
|
|
539
|
+
children: (message, index) => /* @__PURE__ */ jsx(Message, {
|
|
540
|
+
message,
|
|
549
541
|
theme
|
|
550
|
-
})
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
542
|
+
}, index)
|
|
543
|
+
}, sessionId),
|
|
544
|
+
streamingMessage && /* @__PURE__ */ jsx(Message, {
|
|
545
|
+
isStreaming: true,
|
|
546
|
+
message: streamingMessage,
|
|
547
|
+
theme
|
|
548
|
+
}),
|
|
549
|
+
isLoading && streamingMessage && !streamingMessage.content && /* @__PURE__ */ jsx(Box, {
|
|
550
|
+
marginTop: -1,
|
|
551
|
+
marginBottom: 1,
|
|
552
|
+
marginX: 2,
|
|
553
|
+
children: /* @__PURE__ */ jsx(Spinner, { label: "Thinking..." })
|
|
554
|
+
})
|
|
555
|
+
] });
|
|
559
556
|
}
|
|
560
557
|
//#endregion
|
|
561
558
|
//#region src/components/SelectPrompt/SelectPrompt.tsx
|
|
@@ -637,22 +634,22 @@ function SelectPromptHint({ message = "Select option", escapeLabel = "cancel" })
|
|
|
637
634
|
});
|
|
638
635
|
}
|
|
639
636
|
//#endregion
|
|
640
|
-
//#region src/components/
|
|
637
|
+
//#region src/components/PlanReview/PlanReview.tsx
|
|
641
638
|
var options$1 = [
|
|
642
639
|
{
|
|
643
|
-
label: "
|
|
640
|
+
label: "Approve in auto mode",
|
|
644
641
|
value: AUTO
|
|
645
642
|
},
|
|
646
643
|
{
|
|
647
|
-
label: "
|
|
644
|
+
label: "Approve in safe mode",
|
|
648
645
|
value: SAFE
|
|
649
646
|
},
|
|
650
647
|
{
|
|
651
|
-
label: "
|
|
648
|
+
label: "Continue planning",
|
|
652
649
|
value: PLAN
|
|
653
650
|
}
|
|
654
651
|
];
|
|
655
|
-
function
|
|
652
|
+
function PlanReview({ planContent, onModeChange, theme = getTheme() }) {
|
|
656
653
|
return /* @__PURE__ */ jsx(Box, {
|
|
657
654
|
marginX: 2,
|
|
658
655
|
children: /* @__PURE__ */ jsx(SelectPrompt, {
|
|
@@ -670,13 +667,16 @@ function PlanApproval({ planContent, onModeChange, theme = getTheme() }) {
|
|
|
670
667
|
/* @__PURE__ */ jsx(Text, {
|
|
671
668
|
bold: true,
|
|
672
669
|
color: theme.colors.accent,
|
|
673
|
-
children: "Plan
|
|
670
|
+
children: "Plan Review - Choose next step:"
|
|
674
671
|
}),
|
|
675
672
|
/* @__PURE__ */ jsx(Box, {
|
|
676
673
|
marginY: 1,
|
|
677
|
-
children: /* @__PURE__ */ jsx(
|
|
674
|
+
children: /* @__PURE__ */ jsx(Markdown, {
|
|
675
|
+
content: planContent,
|
|
676
|
+
theme
|
|
677
|
+
})
|
|
678
678
|
}),
|
|
679
|
-
/* @__PURE__ */ jsx(SelectPromptHint, { message: "Select
|
|
679
|
+
/* @__PURE__ */ jsx(SelectPromptHint, { message: "Select review action" })
|
|
680
680
|
]
|
|
681
681
|
})
|
|
682
682
|
})
|
|
@@ -1387,7 +1387,7 @@ function ChatInput({ history: sessionHistory, isDisabled = false, onInterrupt, o
|
|
|
1387
1387
|
//#endregion
|
|
1388
1388
|
//#region src/components/Chat/constants.ts
|
|
1389
1389
|
var ACTION_NOT_PERFORMED = "The requested action was NOT performed";
|
|
1390
|
-
var PLAN_CHECKLIST_REMINDER = "Then display the
|
|
1390
|
+
var PLAN_CHECKLIST_REMINDER = "Then display the plan using either the Plan Needs Input or Proposed Plan Markdown template";
|
|
1391
1391
|
var PLAN_EXECUTION_REMINDER = `Do not claim success and do not call ${Array.from(WRITE_TOOLS).join(", ")} until the user approves execution`;
|
|
1392
1392
|
var InterruptReason = /* @__PURE__ */ function(InterruptReason) {
|
|
1393
1393
|
InterruptReason["Interrupted"] = "interrupted";
|
|
@@ -1397,10 +1397,13 @@ var InterruptReason = /* @__PURE__ */ function(InterruptReason) {
|
|
|
1397
1397
|
//#endregion
|
|
1398
1398
|
//#region src/components/Chat/plan.ts
|
|
1399
1399
|
function hasExecutablePlan(content) {
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1400
|
+
const lines = content.split("\n");
|
|
1401
|
+
const proposedPlanIndex = lines.findIndex((line) => line.trim().toLowerCase() === "## proposed plan");
|
|
1402
|
+
if (proposedPlanIndex === -1) return false;
|
|
1403
|
+
const executionStepsIndex = lines.findIndex((line, index) => index > proposedPlanIndex && line.trim().toLowerCase() === "### execution steps");
|
|
1404
|
+
if (executionStepsIndex === -1) return false;
|
|
1405
|
+
const nextSectionIndex = lines.findIndex((line, index) => index > executionStepsIndex && /^#{1,6}\s+\S/.test(line.trim()));
|
|
1406
|
+
return lines.slice(executionStepsIndex + 1, nextSectionIndex === -1 ? void 0 : nextSectionIndex).some((line) => /^(?:[-*]|\d+[.)])\s+\S/.test(line.trim()));
|
|
1404
1407
|
}
|
|
1405
1408
|
//#endregion
|
|
1406
1409
|
//#region src/components/Chat/Chat.tsx
|
|
@@ -1610,18 +1613,23 @@ function Chat({ initialMessages, model, onCommand, onMessagesChange, mode, onMod
|
|
|
1610
1613
|
role: ASSISTANT,
|
|
1611
1614
|
content: ""
|
|
1612
1615
|
};
|
|
1616
|
+
const emptyAssistantMessage = {
|
|
1617
|
+
role: ASSISTANT,
|
|
1618
|
+
content: ""
|
|
1619
|
+
};
|
|
1613
1620
|
let committedMessages = currentMessages;
|
|
1614
1621
|
let assistantCommitted = false;
|
|
1615
1622
|
const commitAssistantMessage = () => {
|
|
1616
1623
|
assistantMessage.content = sanitizeAssistantContent(assistantMessage.content);
|
|
1624
|
+
/* v8 ignore start */
|
|
1617
1625
|
if (assistantCommitted) {
|
|
1618
|
-
// v8 ignore next
|
|
1619
1626
|
if (committedMessages.at(-1)?.role === "assistant") {
|
|
1620
1627
|
committedMessages = [...committedMessages.slice(0, -1), { ...assistantMessage }];
|
|
1621
1628
|
setMessages(committedMessages);
|
|
1622
1629
|
}
|
|
1623
1630
|
return committedMessages;
|
|
1624
1631
|
}
|
|
1632
|
+
/* v8 ignore stop */
|
|
1625
1633
|
assistantCommitted = true;
|
|
1626
1634
|
setStreamingMessage(null);
|
|
1627
1635
|
if (!assistantMessage.content) {
|
|
@@ -1632,17 +1640,32 @@ function Chat({ initialMessages, model, onCommand, onMessagesChange, mode, onMod
|
|
|
1632
1640
|
setMessages(committedMessages);
|
|
1633
1641
|
return committedMessages;
|
|
1634
1642
|
};
|
|
1635
|
-
setStreamingMessage(
|
|
1643
|
+
setStreamingMessage(emptyAssistantMessage);
|
|
1636
1644
|
try {
|
|
1637
1645
|
const readOnlyTools = TOOLS.filter((tool) => READ_TOOLS.has(tool.function.name));
|
|
1638
|
-
|
|
1646
|
+
const planResearchMessages = [...currentMessages, {
|
|
1647
|
+
role: SYSTEM,
|
|
1648
|
+
content: PLAN_INSTRUCTION
|
|
1649
|
+
}];
|
|
1650
|
+
for await (const chunk of streamChat(withSystemMessage(planResearchMessages), modelName, readOnlyTools, controller.signal)) {
|
|
1639
1651
|
// v8 ignore next 3
|
|
1640
1652
|
if (controller.signal.aborted) return;
|
|
1641
1653
|
if (chunk.type === "content") {
|
|
1642
1654
|
assistantMessage.content = sanitizeAssistantContent(assistantMessage.content + chunk.content);
|
|
1643
1655
|
setStreamingMessage({ ...assistantMessage });
|
|
1644
1656
|
} else if (chunk.type === "tool_calls") for (const toolCall of chunk.tool_calls) {
|
|
1645
|
-
const
|
|
1657
|
+
const toolName = toolCall.function.name;
|
|
1658
|
+
if (!READ_TOOLS.has(toolName)) {
|
|
1659
|
+
const correctionMessage = buildPlanModeCorrectionMessage(toolName);
|
|
1660
|
+
setStreamingMessage(null);
|
|
1661
|
+
const newMessages = [...committedMessages, correctionMessage];
|
|
1662
|
+
setMessages(newMessages);
|
|
1663
|
+
await processStreamReadOnly(newMessages);
|
|
1664
|
+
return;
|
|
1665
|
+
}
|
|
1666
|
+
setStreamingMessage(emptyAssistantMessage);
|
|
1667
|
+
assistantMessage.content = "";
|
|
1668
|
+
const updatedMessages = committedMessages;
|
|
1646
1669
|
let normalized;
|
|
1647
1670
|
try {
|
|
1648
1671
|
normalized = normalizeToolCall(toolCall);
|
|
@@ -1657,13 +1680,6 @@ function Chat({ initialMessages, model, onCommand, onMessagesChange, mode, onMod
|
|
|
1657
1680
|
await processStreamReadOnly(newMessages);
|
|
1658
1681
|
return;
|
|
1659
1682
|
}
|
|
1660
|
-
if (!READ_TOOLS.has(normalized.name)) {
|
|
1661
|
-
const correctionMessage = buildPlanModeCorrectionMessage(normalized.name);
|
|
1662
|
-
const newMessages = [...updatedMessages, correctionMessage];
|
|
1663
|
-
setMessages(newMessages);
|
|
1664
|
-
await processStreamReadOnly(newMessages);
|
|
1665
|
-
return;
|
|
1666
|
-
}
|
|
1667
1683
|
const result = await executeTool(normalized.name, normalized.arguments, { allowedTools: READ_TOOLS });
|
|
1668
1684
|
const toolResultMessage = buildToolResultMessage(normalized.name, result, normalized.arguments);
|
|
1669
1685
|
const newMessages = [...updatedMessages, toolResultMessage];
|
|
@@ -1674,6 +1690,14 @@ function Chat({ initialMessages, model, onCommand, onMessagesChange, mode, onMod
|
|
|
1674
1690
|
}
|
|
1675
1691
|
await prewarmCodeBlocks(assistantMessage.content, theme);
|
|
1676
1692
|
const researchMessages = commitAssistantMessage();
|
|
1693
|
+
if (hasExecutablePlan(assistantMessage.content)) {
|
|
1694
|
+
setPendingPlan({
|
|
1695
|
+
planContent: assistantMessage.content,
|
|
1696
|
+
messages: researchMessages
|
|
1697
|
+
});
|
|
1698
|
+
setIsLoading(false);
|
|
1699
|
+
return;
|
|
1700
|
+
}
|
|
1677
1701
|
const planInstruction = {
|
|
1678
1702
|
role: SYSTEM,
|
|
1679
1703
|
content: PLAN_GENERATION_INSTRUCTION
|
|
@@ -1683,7 +1707,7 @@ function Chat({ initialMessages, model, onCommand, onMessagesChange, mode, onMod
|
|
|
1683
1707
|
role: ASSISTANT,
|
|
1684
1708
|
content: ""
|
|
1685
1709
|
};
|
|
1686
|
-
setStreamingMessage(
|
|
1710
|
+
setStreamingMessage(emptyAssistantMessage);
|
|
1687
1711
|
try {
|
|
1688
1712
|
for await (const chunk of streamChat(withSystemMessage(planMessages), modelName, [], controller.signal)) {
|
|
1689
1713
|
// v8 ignore next 3
|
|
@@ -1726,7 +1750,7 @@ function Chat({ initialMessages, model, onCommand, onMessagesChange, mode, onMod
|
|
|
1726
1750
|
model,
|
|
1727
1751
|
theme
|
|
1728
1752
|
]);
|
|
1729
|
-
const
|
|
1753
|
+
const handlePlanReview = useCallback(async (mode) => {
|
|
1730
1754
|
// v8 ignore next
|
|
1731
1755
|
if (!pendingPlan) return;
|
|
1732
1756
|
const { messages: planMessages } = pendingPlan;
|
|
@@ -1822,9 +1846,9 @@ function Chat({ initialMessages, model, onCommand, onMessagesChange, mode, onMod
|
|
|
1822
1846
|
streamingMessage,
|
|
1823
1847
|
theme
|
|
1824
1848
|
}),
|
|
1825
|
-
pendingPlan && /* @__PURE__ */ jsx(
|
|
1849
|
+
pendingPlan && /* @__PURE__ */ jsx(PlanReview, {
|
|
1826
1850
|
planContent: pendingPlan.planContent,
|
|
1827
|
-
onModeChange:
|
|
1851
|
+
onModeChange: handlePlanReview,
|
|
1828
1852
|
theme
|
|
1829
1853
|
}),
|
|
1830
1854
|
!pendingPlan && pendingToolCall && /* @__PURE__ */ jsx(ToolApproval, {
|
package/dist/cli.js
CHANGED
|
@@ -50,7 +50,7 @@ var LIST$1 = [
|
|
|
50
50
|
//#endregion
|
|
51
51
|
//#region package.json
|
|
52
52
|
var name = "code-ollama";
|
|
53
|
-
var version = "0.
|
|
53
|
+
var version = "0.23.0";
|
|
54
54
|
//#endregion
|
|
55
55
|
//#region src/constants/package.ts
|
|
56
56
|
var NAME = name;
|
|
@@ -105,7 +105,46 @@ var BACK = {
|
|
|
105
105
|
value: "back"
|
|
106
106
|
};
|
|
107
107
|
//#endregion
|
|
108
|
+
//#region src/constants/tool.ts
|
|
109
|
+
var tool_exports = /* @__PURE__ */ __exportAll({
|
|
110
|
+
EDIT_FILE: () => EDIT_FILE,
|
|
111
|
+
GREP_SEARCH: () => GREP_SEARCH,
|
|
112
|
+
LIST_DIR: () => LIST_DIR,
|
|
113
|
+
READ_FILE: () => READ_FILE,
|
|
114
|
+
READ_TOOL_NAMES: () => READ_TOOL_NAMES,
|
|
115
|
+
RUN_SHELL: () => RUN_SHELL,
|
|
116
|
+
VIEW_RANGE: () => VIEW_RANGE,
|
|
117
|
+
WEB_FETCH: () => WEB_FETCH,
|
|
118
|
+
WEB_SEARCH: () => WEB_SEARCH,
|
|
119
|
+
WRITE_FILE: () => WRITE_FILE,
|
|
120
|
+
WRITE_TOOL_NAMES: () => WRITE_TOOL_NAMES
|
|
121
|
+
});
|
|
122
|
+
var READ_FILE = "read_file";
|
|
123
|
+
var WRITE_FILE = "write_file";
|
|
124
|
+
var EDIT_FILE = "edit_file";
|
|
125
|
+
var RUN_SHELL = "run_shell";
|
|
126
|
+
var LIST_DIR = "list_dir";
|
|
127
|
+
var GREP_SEARCH = "grep_search";
|
|
128
|
+
var VIEW_RANGE = "view_range";
|
|
129
|
+
var WEB_SEARCH = "web_search";
|
|
130
|
+
var WEB_FETCH = "web_fetch";
|
|
131
|
+
var READ_TOOL_NAMES = [
|
|
132
|
+
READ_FILE,
|
|
133
|
+
LIST_DIR,
|
|
134
|
+
GREP_SEARCH,
|
|
135
|
+
VIEW_RANGE,
|
|
136
|
+
WEB_SEARCH,
|
|
137
|
+
WEB_FETCH
|
|
138
|
+
];
|
|
139
|
+
var WRITE_TOOL_NAMES = [
|
|
140
|
+
WRITE_FILE,
|
|
141
|
+
EDIT_FILE,
|
|
142
|
+
RUN_SHELL
|
|
143
|
+
];
|
|
144
|
+
//#endregion
|
|
108
145
|
//#region src/constants/prompt.ts
|
|
146
|
+
var PLAN_READ_TOOLS = READ_TOOL_NAMES.join(", ");
|
|
147
|
+
var PLAN_WRITE_TOOLS = WRITE_TOOL_NAMES.join(", ");
|
|
109
148
|
var BASE_SYSTEM_PROMPT = `You are a coding assistant that helps users write, edit, and understand code. You have access to tools for reading files, writing files, running shell commands, searching code, and searching the web
|
|
110
149
|
|
|
111
150
|
Follow these rules:
|
|
@@ -137,19 +176,55 @@ Path rules:
|
|
|
137
176
|
- Paths are relative to the project root unless absolute
|
|
138
177
|
- Preserve parent directories from listings; if list_dir("src") returns [d] utils, use src/utils
|
|
139
178
|
- If a path fails, inspect the parent directory or search before retrying`;
|
|
140
|
-
var
|
|
179
|
+
var PLAN_RESPONSE_TEMPLATE = `If important product, implementation, or safety details are missing, respond with this Markdown template:
|
|
180
|
+
|
|
181
|
+
## Plan Needs Input
|
|
182
|
+
|
|
183
|
+
### Questions
|
|
184
|
+
- ...
|
|
185
|
+
|
|
186
|
+
### What I Found
|
|
187
|
+
- ...
|
|
188
|
+
|
|
189
|
+
### Draft Plan
|
|
190
|
+
- ...
|
|
191
|
+
|
|
192
|
+
If the request is ready for execution, respond with this Markdown template:
|
|
193
|
+
|
|
194
|
+
## Proposed Plan
|
|
195
|
+
|
|
196
|
+
### Summary
|
|
197
|
+
...
|
|
198
|
+
|
|
199
|
+
### Changes
|
|
200
|
+
- ...
|
|
201
|
+
|
|
202
|
+
### Test Plan
|
|
203
|
+
- ...
|
|
204
|
+
|
|
205
|
+
### Execution Steps
|
|
206
|
+
- ...
|
|
207
|
+
|
|
208
|
+
Keep Execution Steps as human-readable bullets for mutating work that needs approval, not preliminary read-only research
|
|
209
|
+
Do not add extra wrapper text before or after the template
|
|
210
|
+
If no execution is needed, answer normally`;
|
|
211
|
+
var PLAN_GENERATION_INSTRUCTION = `Based on the research above, decide whether the user request is ready for execution
|
|
141
212
|
|
|
142
|
-
If the request needs changes or commands, respond with a plan checklist only
|
|
143
213
|
Do not execute any tools
|
|
144
214
|
Do not claim any action was performed
|
|
145
|
-
|
|
215
|
+
Use the exact headings shown below
|
|
146
216
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
- [ ] run_shell("command") - Brief description
|
|
217
|
+
${PLAN_RESPONSE_TEMPLATE}`;
|
|
218
|
+
var PLAN_INSTRUCTION = `Plan mode is active
|
|
150
219
|
|
|
151
|
-
Only
|
|
152
|
-
|
|
220
|
+
Only use read-only tools: ${PLAN_READ_TOOLS}
|
|
221
|
+
Do not call ${PLAN_WRITE_TOOLS} during Plan mode
|
|
222
|
+
Use read-only tools to resolve discoverable facts before asking questions
|
|
223
|
+
If the user asks to search, inspect, find, read, or locate something, use read-only tools immediately
|
|
224
|
+
Only ask questions for user preferences or product decisions that cannot be discovered from available tools
|
|
225
|
+
When enough context is available, stop calling tools and produce either Plan Needs Input or Proposed Plan using the required template
|
|
226
|
+
|
|
227
|
+
${PLAN_RESPONSE_TEMPLATE}`;
|
|
153
228
|
//#endregion
|
|
154
229
|
//#region src/constants/role.ts
|
|
155
230
|
var USER = "user";
|
|
@@ -296,28 +371,6 @@ function getTheme(themeId = DEFAULT_THEME_ID) {
|
|
|
296
371
|
return LIST.find(({ id }) => id === themeId) ?? LIST[0];
|
|
297
372
|
}
|
|
298
373
|
//#endregion
|
|
299
|
-
//#region src/constants/tool.ts
|
|
300
|
-
var tool_exports = /* @__PURE__ */ __exportAll({
|
|
301
|
-
EDIT_FILE: () => EDIT_FILE,
|
|
302
|
-
GREP_SEARCH: () => GREP_SEARCH,
|
|
303
|
-
LIST_DIR: () => LIST_DIR,
|
|
304
|
-
READ_FILE: () => READ_FILE,
|
|
305
|
-
RUN_SHELL: () => RUN_SHELL,
|
|
306
|
-
VIEW_RANGE: () => VIEW_RANGE,
|
|
307
|
-
WEB_FETCH: () => WEB_FETCH,
|
|
308
|
-
WEB_SEARCH: () => WEB_SEARCH,
|
|
309
|
-
WRITE_FILE: () => WRITE_FILE
|
|
310
|
-
});
|
|
311
|
-
var READ_FILE = "read_file";
|
|
312
|
-
var WRITE_FILE = "write_file";
|
|
313
|
-
var EDIT_FILE = "edit_file";
|
|
314
|
-
var RUN_SHELL = "run_shell";
|
|
315
|
-
var LIST_DIR = "list_dir";
|
|
316
|
-
var GREP_SEARCH = "grep_search";
|
|
317
|
-
var VIEW_RANGE = "view_range";
|
|
318
|
-
var WEB_SEARCH = "web_search";
|
|
319
|
-
var WEB_FETCH = "web_fetch";
|
|
320
|
-
//#endregion
|
|
321
374
|
//#region src/constants/ui.ts
|
|
322
375
|
var HEADER_PREFIX = "🦙 ";
|
|
323
376
|
var WARNING = "⚠️";
|
|
@@ -839,19 +892,8 @@ var TOOLS = [
|
|
|
839
892
|
description: "The full URL of the page to fetch"
|
|
840
893
|
} }, ["url"])
|
|
841
894
|
];
|
|
842
|
-
var READ_TOOLS = new Set(
|
|
843
|
-
|
|
844
|
-
LIST_DIR,
|
|
845
|
-
GREP_SEARCH,
|
|
846
|
-
VIEW_RANGE,
|
|
847
|
-
WEB_SEARCH,
|
|
848
|
-
WEB_FETCH
|
|
849
|
-
]);
|
|
850
|
-
var WRITE_TOOLS = new Set([
|
|
851
|
-
WRITE_FILE,
|
|
852
|
-
EDIT_FILE,
|
|
853
|
-
RUN_SHELL
|
|
854
|
-
]);
|
|
895
|
+
var READ_TOOLS = new Set(READ_TOOL_NAMES);
|
|
896
|
+
var WRITE_TOOLS = new Set(WRITE_TOOL_NAMES);
|
|
855
897
|
//#endregion
|
|
856
898
|
//#region src/utils/tools/shell.ts
|
|
857
899
|
var execAsync = promisify(exec);
|
|
@@ -1294,7 +1336,7 @@ var REQUIRED_STRING_ARGS = {
|
|
|
1294
1336
|
[WEB_SEARCH]: ["query"],
|
|
1295
1337
|
[WEB_FETCH]: ["url"]
|
|
1296
1338
|
};
|
|
1297
|
-
var TOOL_NAMES = new Set(Object.values(tool_exports));
|
|
1339
|
+
var TOOL_NAMES = new Set(Object.values(tool_exports).filter((value) => typeof value === "string"));
|
|
1298
1340
|
function isToolName(name) {
|
|
1299
1341
|
return TOOL_NAMES.has(name);
|
|
1300
1342
|
}
|
|
@@ -1536,7 +1578,7 @@ async function main(args = process.argv.slice(2)) {
|
|
|
1536
1578
|
else await launchTui();
|
|
1537
1579
|
}
|
|
1538
1580
|
async function launchTui(sessionId) {
|
|
1539
|
-
const { renderApp } = await import("./assets/tui-
|
|
1581
|
+
const { renderApp } = await import("./assets/tui-iewVFcZW.js");
|
|
1540
1582
|
reset();
|
|
1541
1583
|
renderApp(sessionId);
|
|
1542
1584
|
}
|
|
@@ -1552,4 +1594,4 @@ function isEntrypoint(argv1 = process.argv[1]) {
|
|
|
1552
1594
|
if (isEntrypoint()) main();
|
|
1553
1595
|
// v8 ignore stop
|
|
1554
1596
|
//#endregion
|
|
1555
|
-
export {
|
|
1597
|
+
export { NAME as $, loadConfig as A, ASSISTANT as B, checkHealth as C, pullModel as D, listModels as E, withSystemMessage as F, BACK as G, USER as H, HEADER_PREFIX as I, LABEL as J, CATALOG as K, WARNING as L, removeClipboardImage as M, saveClipboardImage as N, sanitizeAssistantContent as O, resetSystemMessage as P, REJECT as Q, LIST as R, TOOL_INTENT_CORRECTION as S, hasUncalledToolIntent as T, PLAN_GENERATION_INSTRUCTION as U, SYSTEM as V, PLAN_INSTRUCTION as W, SAFE as X, PLAN as Y, APPROVE as Z, loadSession as _, normalizeToolCall as a, reset as b, WRITE_TOOLS as c, write as d, VERSION as et, appendMessage as f, listSessions as g, deleteSessionIfEmpty as h, formatToolResultContent as i, saveConfig as j, streamChat as k, tick as l, deleteSession as m, main, executeTool as n, READ_TOOLS as o, createSession as p, AUTO as q, executeToolCall as r, TOOLS as s, checkForUpdate as t, LIST$1 as tt, color as u, updateSessionModel as v, deleteModel as w, setClearHandler as x, clear as y, getTheme as z };
|