@hasna/oldpal 0.3.6 → 0.3.7

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 CHANGED
@@ -31256,19 +31256,69 @@ var build_default = TextInput;
31256
31256
 
31257
31257
  // packages/terminal/src/components/Input.tsx
31258
31258
  var jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
31259
- function Input({ onSubmit, isProcessing, queueLength = 0 }) {
31259
+ var COMMANDS = [
31260
+ { name: "/help", description: "show available commands" },
31261
+ { name: "/clear", description: "clear the conversation" },
31262
+ { name: "/model", description: "change the AI model" },
31263
+ { name: "/skills", description: "list available skills" },
31264
+ { name: "/tokens", description: "show token usage" },
31265
+ { name: "/new", description: "start a new conversation" },
31266
+ { name: "/exit", description: "exit oldpal" }
31267
+ ];
31268
+ function Input({ onSubmit, isProcessing, queueLength = 0, commands }) {
31260
31269
  const [value, setValue] = import_react23.useState("");
31270
+ const [selectedIndex, setSelectedIndex] = import_react23.useState(0);
31271
+ const allCommands = import_react23.useMemo(() => {
31272
+ const merged = [...COMMANDS];
31273
+ if (commands) {
31274
+ for (const cmd of commands) {
31275
+ if (!merged.find((c) => c.name === cmd.name)) {
31276
+ merged.push(cmd);
31277
+ }
31278
+ }
31279
+ }
31280
+ return merged.sort((a, b) => a.name.localeCompare(b.name));
31281
+ }, [commands]);
31282
+ const showAutocomplete = value.startsWith("/") && !value.includes(" ");
31283
+ const filteredCommands = import_react23.useMemo(() => {
31284
+ if (!showAutocomplete)
31285
+ return [];
31286
+ const search = value.toLowerCase();
31287
+ return allCommands.filter((cmd) => cmd.name.toLowerCase().startsWith(search));
31288
+ }, [value, showAutocomplete, allCommands]);
31261
31289
  use_input_default((input, key) => {
31290
+ if (key.tab && showAutocomplete && filteredCommands.length > 0) {
31291
+ const selected = filteredCommands[selectedIndex] || filteredCommands[0];
31292
+ setValue(selected.name + " ");
31293
+ setSelectedIndex(0);
31294
+ return;
31295
+ }
31296
+ if (showAutocomplete && filteredCommands.length > 0) {
31297
+ if (key.downArrow) {
31298
+ setSelectedIndex((prev) => Math.min(prev + 1, filteredCommands.length - 1));
31299
+ return;
31300
+ }
31301
+ if (key.upArrow) {
31302
+ setSelectedIndex((prev) => Math.max(prev - 1, 0));
31303
+ return;
31304
+ }
31305
+ }
31262
31306
  if (!value.trim())
31263
31307
  return;
31264
31308
  if ((key.shift || key.ctrl) && key.return) {
31265
31309
  onSubmit(value, "interrupt");
31266
31310
  setValue("");
31311
+ setSelectedIndex(0);
31267
31312
  } else if (key.meta && key.return) {
31268
31313
  onSubmit(value, "queue");
31269
31314
  setValue("");
31315
+ setSelectedIndex(0);
31270
31316
  }
31271
31317
  });
31318
+ const handleChange = (newValue) => {
31319
+ setValue(newValue);
31320
+ setSelectedIndex(0);
31321
+ };
31272
31322
  const handleSubmit = (submittedValue) => {
31273
31323
  if (!submittedValue.trim())
31274
31324
  return;
@@ -31278,6 +31328,7 @@ function Input({ onSubmit, isProcessing, queueLength = 0 }) {
31278
31328
  onSubmit(submittedValue, "normal");
31279
31329
  }
31280
31330
  setValue("");
31331
+ setSelectedIndex(0);
31281
31332
  };
31282
31333
  let prompt = "\u276F";
31283
31334
  let placeholder = "Type a message...";
@@ -31286,21 +31337,53 @@ function Input({ onSubmit, isProcessing, queueLength = 0 }) {
31286
31337
  placeholder = queueLength > 0 ? "Type to queue another..." : "Type to queue (Enter) or interrupt (Shift+Enter)...";
31287
31338
  }
31288
31339
  return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
31340
+ flexDirection: "column",
31289
31341
  marginTop: 1,
31290
31342
  children: [
31291
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
31292
- dimColor: isProcessing,
31343
+ showAutocomplete && filteredCommands.length > 0 && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
31344
+ flexDirection: "column",
31345
+ marginBottom: 1,
31346
+ marginLeft: 2,
31293
31347
  children: [
31294
- prompt,
31295
- " "
31348
+ filteredCommands.slice(0, 8).map((cmd, i) => /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
31349
+ children: [
31350
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
31351
+ color: i === selectedIndex ? "cyan" : undefined,
31352
+ children: cmd.name.padEnd(16)
31353
+ }, undefined, false, undefined, this),
31354
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
31355
+ dimColor: i !== selectedIndex,
31356
+ children: cmd.description
31357
+ }, undefined, false, undefined, this)
31358
+ ]
31359
+ }, cmd.name, true, undefined, this)),
31360
+ filteredCommands.length > 8 && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
31361
+ dimColor: true,
31362
+ children: [
31363
+ " ...and ",
31364
+ filteredCommands.length - 8,
31365
+ " more"
31366
+ ]
31367
+ }, undefined, true, undefined, this)
31296
31368
  ]
31297
31369
  }, undefined, true, undefined, this),
31298
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(build_default, {
31299
- value,
31300
- onChange: setValue,
31301
- onSubmit: handleSubmit,
31302
- placeholder
31303
- }, undefined, false, undefined, this)
31370
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
31371
+ children: [
31372
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
31373
+ dimColor: isProcessing,
31374
+ children: [
31375
+ prompt,
31376
+ " "
31377
+ ]
31378
+ }, undefined, true, undefined, this),
31379
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(build_default, {
31380
+ value,
31381
+ onChange: handleChange,
31382
+ onSubmit: handleSubmit,
31383
+ placeholder
31384
+ }, undefined, false, undefined, this)
31385
+ ]
31386
+ }, undefined, true, undefined, this)
31304
31387
  ]
31305
31388
  }, undefined, true, undefined, this);
31306
31389
  }
@@ -31637,29 +31720,33 @@ function truncate(text, maxLength) {
31637
31720
  // packages/terminal/src/components/Status.tsx
31638
31721
  var jsx_dev_runtime4 = __toESM(require_jsx_dev_runtime(), 1);
31639
31722
  function Status({ isProcessing, cwd: cwd2, queueLength = 0, tokenUsage }) {
31640
- const maxCwdLength = 30;
31641
- const displayCwd = cwd2.length > maxCwdLength ? "..." + cwd2.slice(-(maxCwdLength - 3)) : cwd2;
31642
- const queueInfo = queueLength > 0 ? ` | ${queueLength} queued` : "";
31643
- let tokenInfo = "";
31644
- if (tokenUsage && tokenUsage.totalTokens > 0) {
31645
- const used = Math.round(tokenUsage.totalTokens / 1000);
31646
- const max = Math.round(tokenUsage.maxContextTokens / 1000);
31723
+ let contextInfo = "";
31724
+ if (tokenUsage && tokenUsage.maxContextTokens > 0) {
31647
31725
  const percent = Math.round(tokenUsage.totalTokens / tokenUsage.maxContextTokens * 100);
31648
- tokenInfo = ` | ${used}k/${max}k (${percent}%)`;
31726
+ contextInfo = `${percent}% context used`;
31649
31727
  }
31650
31728
  return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
31651
31729
  marginTop: 1,
31652
- children: /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
31653
- dimColor: true,
31654
- children: [
31655
- displayCwd,
31656
- tokenInfo,
31657
- queueInfo,
31658
- isProcessing && " | Esc to stop",
31659
- " | Ctrl+C to exit | /help"
31660
- ]
31661
- }, undefined, true, undefined, this)
31662
- }, undefined, false, undefined, this);
31730
+ justifyContent: "space-between",
31731
+ children: [
31732
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
31733
+ dimColor: true,
31734
+ children: "/help for commands"
31735
+ }, undefined, false, undefined, this),
31736
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
31737
+ children: [
31738
+ isProcessing && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
31739
+ dimColor: true,
31740
+ children: "esc to stop \xB7 "
31741
+ }, undefined, false, undefined, this),
31742
+ contextInfo && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
31743
+ dimColor: true,
31744
+ children: contextInfo
31745
+ }, undefined, false, undefined, this)
31746
+ ]
31747
+ }, undefined, true, undefined, this)
31748
+ ]
31749
+ }, undefined, true, undefined, this);
31663
31750
  }
31664
31751
 
31665
31752
  // node_modules/.pnpm/ink-spinner@5.0.0_ink@5.2.1_@types+react@18.3.27_react-devtools-core@4.28.5_react@18.3.1__react@18.3.1/node_modules/ink-spinner/build/index.js
@@ -31906,8 +31993,74 @@ function useToolCallExpansion() {
31906
31993
  return { isExpanded, setIsExpanded };
31907
31994
  }
31908
31995
 
31909
- // packages/terminal/src/components/App.tsx
31996
+ // packages/terminal/src/components/WelcomeBanner.tsx
31910
31997
  var jsx_dev_runtime8 = __toESM(require_jsx_dev_runtime(), 1);
31998
+ function WelcomeBanner({ version, model, directory }) {
31999
+ const homeDir = process.env.HOME || "";
32000
+ const displayDir = directory.startsWith(homeDir) ? "~" + directory.slice(homeDir.length) : directory;
32001
+ return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
32002
+ flexDirection: "column",
32003
+ marginBottom: 1,
32004
+ children: [
32005
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
32006
+ children: [
32007
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
32008
+ color: "cyan",
32009
+ bold: true,
32010
+ children: ">"
32011
+ }, undefined, false, undefined, this),
32012
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
32013
+ color: "cyan",
32014
+ bold: true,
32015
+ children: "_ "
32016
+ }, undefined, false, undefined, this),
32017
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
32018
+ bold: true,
32019
+ children: "oldpal"
32020
+ }, undefined, false, undefined, this),
32021
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
32022
+ dimColor: true,
32023
+ children: [
32024
+ " (v",
32025
+ version,
32026
+ ")"
32027
+ ]
32028
+ }, undefined, true, undefined, this)
32029
+ ]
32030
+ }, undefined, true, undefined, this),
32031
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
32032
+ marginTop: 1,
32033
+ children: [
32034
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
32035
+ dimColor: true,
32036
+ children: "model: "
32037
+ }, undefined, false, undefined, this),
32038
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
32039
+ children: model
32040
+ }, undefined, false, undefined, this),
32041
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
32042
+ dimColor: true,
32043
+ children: " /model to change"
32044
+ }, undefined, false, undefined, this)
32045
+ ]
32046
+ }, undefined, true, undefined, this),
32047
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
32048
+ children: [
32049
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
32050
+ dimColor: true,
32051
+ children: "directory: "
32052
+ }, undefined, false, undefined, this),
32053
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
32054
+ children: displayDir
32055
+ }, undefined, false, undefined, this)
32056
+ ]
32057
+ }, undefined, true, undefined, this)
32058
+ ]
32059
+ }, undefined, true, undefined, this);
32060
+ }
32061
+
32062
+ // packages/terminal/src/components/App.tsx
32063
+ var jsx_dev_runtime9 = __toESM(require_jsx_dev_runtime(), 1);
31911
32064
  function App2({ cwd: cwd2 }) {
31912
32065
  const { exit } = use_app_default();
31913
32066
  const [client, setClient] = import_react27.useState(null);
@@ -32193,10 +32346,10 @@ function App2({ cwd: cwd2 }) {
32193
32346
  await client.send(trimmedInput);
32194
32347
  }, [client, isProcessing]);
32195
32348
  if (isInitializing) {
32196
- return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
32349
+ return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
32197
32350
  flexDirection: "column",
32198
32351
  padding: 1,
32199
- children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Spinner2, {
32352
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Spinner2, {
32200
32353
  label: "Initializing..."
32201
32354
  }, undefined, false, undefined, this)
32202
32355
  }, undefined, false, undefined, this);
@@ -32206,12 +32359,18 @@ function App2({ cwd: cwd2 }) {
32206
32359
  return { toolCall: e.toolCall, result };
32207
32360
  });
32208
32361
  const isThinking = isProcessing && !currentResponse && !currentToolCall && toolCallEntries.length === 0;
32209
- return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
32362
+ const showWelcome = messages.length === 0 && !isProcessing;
32363
+ return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
32210
32364
  flexDirection: "column",
32211
32365
  padding: 1,
32212
32366
  children: [
32213
- scrollOffset > 0 && /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
32214
- children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
32367
+ showWelcome && /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(WelcomeBanner, {
32368
+ version: "0.3.7",
32369
+ model: "claude-sonnet-4-20250514",
32370
+ directory: cwd2
32371
+ }, undefined, false, undefined, this),
32372
+ scrollOffset > 0 && /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
32373
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
32215
32374
  dimColor: true,
32216
32375
  children: [
32217
32376
  "\u2191 ",
@@ -32220,7 +32379,7 @@ function App2({ cwd: cwd2 }) {
32220
32379
  ]
32221
32380
  }, undefined, true, undefined, this)
32222
32381
  }, undefined, false, undefined, this),
32223
- /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Messages4, {
32382
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Messages4, {
32224
32383
  messages,
32225
32384
  currentResponse: isProcessing ? currentResponse : undefined,
32226
32385
  currentToolCall: undefined,
@@ -32229,14 +32388,14 @@ function App2({ cwd: cwd2 }) {
32229
32388
  scrollOffset,
32230
32389
  maxVisible: maxVisibleMessages
32231
32390
  }, undefined, false, undefined, this),
32232
- isProcessing && toolCallEntries.length > 0 && /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ToolCallBox, {
32391
+ isProcessing && toolCallEntries.length > 0 && /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ToolCallBox, {
32233
32392
  entries: toolCallEntries,
32234
32393
  maxVisible: 3,
32235
32394
  isExpanded: toolsExpanded
32236
32395
  }, undefined, false, undefined, this),
32237
- messageQueue.length > 0 && /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
32396
+ messageQueue.length > 0 && /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
32238
32397
  marginY: 1,
32239
- children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
32398
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
32240
32399
  dimColor: true,
32241
32400
  children: [
32242
32401
  messageQueue.length,
@@ -32246,9 +32405,9 @@ function App2({ cwd: cwd2 }) {
32246
32405
  ]
32247
32406
  }, undefined, true, undefined, this)
32248
32407
  }, undefined, false, undefined, this),
32249
- error && /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
32408
+ error && /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
32250
32409
  marginY: 1,
32251
- children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
32410
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
32252
32411
  color: "red",
32253
32412
  children: [
32254
32413
  "Error: ",
@@ -32256,18 +32415,18 @@ function App2({ cwd: cwd2 }) {
32256
32415
  ]
32257
32416
  }, undefined, true, undefined, this)
32258
32417
  }, undefined, false, undefined, this),
32259
- /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ProcessingIndicator, {
32418
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ProcessingIndicator, {
32260
32419
  isProcessing,
32261
32420
  startTime: processingStartTime,
32262
32421
  tokenCount: currentTurnTokens,
32263
32422
  isThinking
32264
32423
  }, undefined, false, undefined, this),
32265
- /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Input, {
32424
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Input, {
32266
32425
  onSubmit: handleSubmit,
32267
32426
  isProcessing,
32268
32427
  queueLength: messageQueue.length
32269
32428
  }, undefined, false, undefined, this),
32270
- /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Status, {
32429
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Status, {
32271
32430
  isProcessing,
32272
32431
  cwd: cwd2,
32273
32432
  queueLength: messageQueue.length,
@@ -32278,7 +32437,7 @@ function App2({ cwd: cwd2 }) {
32278
32437
  }
32279
32438
 
32280
32439
  // packages/terminal/src/index.tsx
32281
- var jsx_dev_runtime9 = __toESM(require_jsx_dev_runtime(), 1);
32440
+ var jsx_dev_runtime10 = __toESM(require_jsx_dev_runtime(), 1);
32282
32441
  var args = process.argv.slice(2);
32283
32442
  var options = {
32284
32443
  cwd: process.cwd(),
@@ -32286,7 +32445,7 @@ var options = {
32286
32445
  help: args.includes("--help") || args.includes("-h")
32287
32446
  };
32288
32447
  if (options.version) {
32289
- console.log("oldpal v0.3.6");
32448
+ console.log("oldpal v0.3.7");
32290
32449
  process.exit(0);
32291
32450
  }
32292
32451
  if (options.help) {
@@ -32310,11 +32469,11 @@ In interactive mode:
32310
32469
  `);
32311
32470
  process.exit(0);
32312
32471
  }
32313
- var { waitUntilExit } = render_default(/* @__PURE__ */ jsx_dev_runtime9.jsxDEV(App2, {
32472
+ var { waitUntilExit } = render_default(/* @__PURE__ */ jsx_dev_runtime10.jsxDEV(App2, {
32314
32473
  cwd: options.cwd
32315
32474
  }, undefined, false, undefined, this));
32316
32475
  waitUntilExit().then(() => {
32317
32476
  process.exit(0);
32318
32477
  });
32319
32478
 
32320
- //# debugId=883DD49707B1DC4164756E2164756E21
32479
+ //# debugId=19B04C4EDDB63EDD64756E2164756E21