@ridit/milo 0.1.2 → 0.1.3
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.mjs +42 -35
- package/package.json +1 -1
- package/src/components/permissions/PermissionCard.tsx +9 -2
- package/src/screens/REPL.tsx +39 -23
package/dist/index.mjs
CHANGED
|
@@ -106189,6 +106189,7 @@ import { useState as useState8 } from "react";
|
|
|
106189
106189
|
import { Box as Box12, Text as Text14, useInput as useInput3 } from "ink";
|
|
106190
106190
|
init_libesm();
|
|
106191
106191
|
import { jsxDEV as jsxDEV15 } from "react/jsx-dev-runtime";
|
|
106192
|
+
var MAX_DIFF_LINES = 10;
|
|
106192
106193
|
var OPTIONS = [
|
|
106193
106194
|
{ label: "Yes", value: "allow" },
|
|
106194
106195
|
{
|
|
@@ -106211,7 +106212,7 @@ function getFilePreview(toolName, input) {
|
|
|
106211
106212
|
if (!content)
|
|
106212
106213
|
return null;
|
|
106213
106214
|
const lines = content.split(`
|
|
106214
|
-
`).map((l) => "+" + l);
|
|
106215
|
+
`).slice(0, MAX_DIFF_LINES).map((l) => "+" + l);
|
|
106215
106216
|
return {
|
|
106216
106217
|
oldStart: 1,
|
|
106217
106218
|
oldLines: 0,
|
|
@@ -106225,7 +106226,10 @@ function getFilePreview(toolName, input) {
|
|
|
106225
106226
|
if (!patch)
|
|
106226
106227
|
return null;
|
|
106227
106228
|
const parsed = parsePatch(patch);
|
|
106228
|
-
|
|
106229
|
+
const hunk = parsed[0]?.hunks[0] ?? null;
|
|
106230
|
+
if (hunk)
|
|
106231
|
+
hunk.lines = hunk.lines.slice(0, MAX_DIFF_LINES);
|
|
106232
|
+
return hunk;
|
|
106229
106233
|
}
|
|
106230
106234
|
return null;
|
|
106231
106235
|
}
|
|
@@ -106546,39 +106550,42 @@ function REPL() {
|
|
|
106546
106550
|
color: getTheme().border,
|
|
106547
106551
|
children: line.repeat(columns)
|
|
106548
106552
|
}, undefined, false, undefined, this),
|
|
106549
|
-
|
|
106550
|
-
|
|
106551
|
-
|
|
106552
|
-
|
|
106553
|
-
|
|
106554
|
-
|
|
106555
|
-
|
|
106556
|
-
|
|
106557
|
-
|
|
106558
|
-
|
|
106559
|
-
|
|
106560
|
-
|
|
106561
|
-
|
|
106562
|
-
|
|
106563
|
-
|
|
106564
|
-
|
|
106565
|
-
|
|
106566
|
-
|
|
106567
|
-
|
|
106568
|
-
|
|
106569
|
-
|
|
106570
|
-
|
|
106571
|
-
|
|
106572
|
-
|
|
106573
|
-
|
|
106574
|
-
|
|
106575
|
-
|
|
106576
|
-
|
|
106577
|
-
|
|
106578
|
-
|
|
106579
|
-
|
|
106580
|
-
|
|
106581
|
-
|
|
106553
|
+
/* @__PURE__ */ jsxDEV16(Box13, {
|
|
106554
|
+
minHeight: pendingPermission ? 10 : pendingWizard ? 10 : 3,
|
|
106555
|
+
children: pendingPermission ? /* @__PURE__ */ jsxDEV16(PermissionCard, {
|
|
106556
|
+
permission: pendingPermission,
|
|
106557
|
+
onDecide: decide
|
|
106558
|
+
}, "permission", false, undefined, this) : pendingWizard ? /* @__PURE__ */ jsxDEV16(ProviderWizard, {
|
|
106559
|
+
mode: pendingWizard,
|
|
106560
|
+
onDone: closeWizard
|
|
106561
|
+
}, "wizard", false, undefined, this) : /* @__PURE__ */ jsxDEV16(Box13, {
|
|
106562
|
+
paddingX: 1,
|
|
106563
|
+
children: [
|
|
106564
|
+
/* @__PURE__ */ jsxDEV16(Text15, {
|
|
106565
|
+
color: getTheme().primary,
|
|
106566
|
+
children: [
|
|
106567
|
+
pointer,
|
|
106568
|
+
" "
|
|
106569
|
+
]
|
|
106570
|
+
}, undefined, true, undefined, this),
|
|
106571
|
+
/* @__PURE__ */ jsxDEV16(TextInput, {
|
|
106572
|
+
value,
|
|
106573
|
+
onChange: setValue,
|
|
106574
|
+
onSubmit,
|
|
106575
|
+
onExit: () => process.exit(0),
|
|
106576
|
+
columns: columns - 6,
|
|
106577
|
+
cursorOffset,
|
|
106578
|
+
onChangeCursorOffset: setCursorOffset,
|
|
106579
|
+
placeholder: "ask milo anything...",
|
|
106580
|
+
isDimmed: loading,
|
|
106581
|
+
focus: !loading && !pendingPermission && !pendingWizard,
|
|
106582
|
+
onHistoryUp,
|
|
106583
|
+
onHistoryDown,
|
|
106584
|
+
onHistoryReset
|
|
106585
|
+
}, undefined, false, undefined, this)
|
|
106586
|
+
]
|
|
106587
|
+
}, undefined, true, undefined, this)
|
|
106588
|
+
}, "input-area", false, undefined, this),
|
|
106582
106589
|
/* @__PURE__ */ jsxDEV16(Text15, {
|
|
106583
106590
|
color: getTheme().border,
|
|
106584
106591
|
children: line.repeat(columns)
|
package/package.json
CHANGED
|
@@ -19,6 +19,8 @@ type Props = {
|
|
|
19
19
|
onDecide: (decision: PermissionDecision) => void;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
const MAX_DIFF_LINES = 10;
|
|
23
|
+
|
|
22
24
|
const OPTIONS: { label: string; value: PermissionDecision }[] = [
|
|
23
25
|
{ label: "Yes", value: "allow" },
|
|
24
26
|
{
|
|
@@ -40,7 +42,10 @@ function getFilePreview(toolName: string, input: unknown) {
|
|
|
40
42
|
if (toolName === "FileWriteTool") {
|
|
41
43
|
const content = String(a.content ?? "");
|
|
42
44
|
if (!content) return null;
|
|
43
|
-
const lines = content
|
|
45
|
+
const lines = content
|
|
46
|
+
.split("\n")
|
|
47
|
+
.slice(0, MAX_DIFF_LINES)
|
|
48
|
+
.map((l) => "+" + l);
|
|
44
49
|
return {
|
|
45
50
|
oldStart: 1,
|
|
46
51
|
oldLines: 0,
|
|
@@ -54,7 +59,9 @@ function getFilePreview(toolName: string, input: unknown) {
|
|
|
54
59
|
const patch = String(a.patch ?? "");
|
|
55
60
|
if (!patch) return null;
|
|
56
61
|
const parsed = parsePatch(patch);
|
|
57
|
-
|
|
62
|
+
const hunk = parsed[0]?.hunks[0] ?? null;
|
|
63
|
+
if (hunk) hunk.lines = hunk.lines.slice(0, MAX_DIFF_LINES);
|
|
64
|
+
return hunk;
|
|
58
65
|
}
|
|
59
66
|
|
|
60
67
|
return null;
|
package/src/screens/REPL.tsx
CHANGED
|
@@ -228,30 +228,46 @@ export default function REPL(): JSX.Element {
|
|
|
228
228
|
|
|
229
229
|
<Box flexDirection="column">
|
|
230
230
|
<Text color={getTheme().border}>{line.repeat(columns)}</Text>
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
<
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
onExit={() => process.exit(0)}
|
|
243
|
-
columns={columns - 6}
|
|
244
|
-
cursorOffset={cursorOffset}
|
|
245
|
-
onChangeCursorOffset={setCursorOffset}
|
|
246
|
-
placeholder="ask milo anything..."
|
|
247
|
-
isDimmed={loading}
|
|
248
|
-
focus={!loading && !pendingPermission && !pendingWizard}
|
|
249
|
-
onHistoryUp={onHistoryUp}
|
|
250
|
-
onHistoryDown={onHistoryDown}
|
|
251
|
-
onHistoryReset={onHistoryReset}
|
|
231
|
+
|
|
232
|
+
{/* stable height container — prevents flicker on mount/unmount */}
|
|
233
|
+
<Box
|
|
234
|
+
key="input-area"
|
|
235
|
+
minHeight={pendingPermission ? 10 : pendingWizard ? 10 : 3}
|
|
236
|
+
>
|
|
237
|
+
{pendingPermission ? (
|
|
238
|
+
<PermissionCard
|
|
239
|
+
key="permission"
|
|
240
|
+
permission={pendingPermission}
|
|
241
|
+
onDecide={decide}
|
|
252
242
|
/>
|
|
253
|
-
|
|
254
|
-
|
|
243
|
+
) : pendingWizard ? (
|
|
244
|
+
<ProviderWizard
|
|
245
|
+
key="wizard"
|
|
246
|
+
mode={pendingWizard}
|
|
247
|
+
onDone={closeWizard}
|
|
248
|
+
/>
|
|
249
|
+
) : (
|
|
250
|
+
<Box paddingX={1}>
|
|
251
|
+
<Text color={getTheme().primary}>{pointer} </Text>
|
|
252
|
+
<TextInput
|
|
253
|
+
value={value}
|
|
254
|
+
onChange={setValue}
|
|
255
|
+
onSubmit={onSubmit}
|
|
256
|
+
onExit={() => process.exit(0)}
|
|
257
|
+
columns={columns - 6}
|
|
258
|
+
cursorOffset={cursorOffset}
|
|
259
|
+
onChangeCursorOffset={setCursorOffset}
|
|
260
|
+
placeholder="ask milo anything..."
|
|
261
|
+
isDimmed={loading}
|
|
262
|
+
focus={!loading && !pendingPermission && !pendingWizard}
|
|
263
|
+
onHistoryUp={onHistoryUp}
|
|
264
|
+
onHistoryDown={onHistoryDown}
|
|
265
|
+
onHistoryReset={onHistoryReset}
|
|
266
|
+
/>
|
|
267
|
+
</Box>
|
|
268
|
+
)}
|
|
269
|
+
</Box>
|
|
270
|
+
|
|
255
271
|
<Text color={getTheme().border}>{line.repeat(columns)}</Text>
|
|
256
272
|
<CommandSuggestions query={value} selectedIndex={selectedIndex} />
|
|
257
273
|
<StatusBar model={modelLabel} mode={mode} thinking={loading} />
|