@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 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
- return parsed[0]?.hunks[0] ?? null;
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
- pendingPermission ? /* @__PURE__ */ jsxDEV16(PermissionCard, {
106550
- permission: pendingPermission,
106551
- onDecide: decide
106552
- }, undefined, false, undefined, this) : pendingWizard ? /* @__PURE__ */ jsxDEV16(ProviderWizard, {
106553
- mode: pendingWizard,
106554
- onDone: closeWizard
106555
- }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV16(Box13, {
106556
- paddingX: 1,
106557
- children: [
106558
- /* @__PURE__ */ jsxDEV16(Text15, {
106559
- color: getTheme().primary,
106560
- children: [
106561
- pointer,
106562
- " "
106563
- ]
106564
- }, undefined, true, undefined, this),
106565
- /* @__PURE__ */ jsxDEV16(TextInput, {
106566
- value,
106567
- onChange: setValue,
106568
- onSubmit,
106569
- onExit: () => process.exit(0),
106570
- columns: columns - 6,
106571
- cursorOffset,
106572
- onChangeCursorOffset: setCursorOffset,
106573
- placeholder: "ask milo anything...",
106574
- isDimmed: loading,
106575
- focus: !loading && !pendingPermission && !pendingWizard,
106576
- onHistoryUp,
106577
- onHistoryDown,
106578
- onHistoryReset
106579
- }, undefined, false, undefined, this)
106580
- ]
106581
- }, undefined, true, undefined, this),
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ridit/milo",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Tiny cat. Big code.",
5
5
  "author": "Ridit Jangra <riditjangra09@gmail.com> (https://ridit.space)",
6
6
  "license": "MIT",
@@ -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.split("\n").map((l) => "+" + l);
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
- return parsed[0]?.hunks[0] ?? null;
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;
@@ -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
- {pendingPermission ? (
232
- <PermissionCard permission={pendingPermission} onDecide={decide} />
233
- ) : pendingWizard ? (
234
- <ProviderWizard mode={pendingWizard} onDone={closeWizard} />
235
- ) : (
236
- <Box paddingX={1}>
237
- <Text color={getTheme().primary}>{pointer} </Text>
238
- <TextInput
239
- value={value}
240
- onChange={setValue}
241
- onSubmit={onSubmit}
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
- </Box>
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} />