koneck 2.119.1 → 2.120.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/ink-chat.js CHANGED
@@ -5514,14 +5514,41 @@ export function App({ config: initialConfig, clearFrame }) {
5514
5514
  return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: CYAN, paddingX: 1, marginTop: 1, width: barWidth, children: [_jsx(Text, { color: CYAN, bold: true, children: "Declare a provider" }), _jsxs(Text, { color: MUTED, children: [ask.hint, " \u00B7 esc to cancel"] }), addProv.name !== '' && (_jsxs(Text, { color: DIM, children: [addProv.name, addProv.url ? ' ' + addProv.url : ''] })), addProv.error && _jsx(Text, { color: CRIMSON, children: addProv.error }), _jsxs(Box, { marginTop: 1, children: [_jsxs(Text, { color: MUTED, children: [ask.label, ": "] }), _jsx(Text, { color: INK, children: addProv.value }), _jsx(Text, { color: CYAN, children: "\u2588" })] })] }));
5515
5515
  })(), keyPrompt && (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: AMBER, paddingX: 1, marginTop: 1, width: barWidth, children: [_jsxs(Text, { color: AMBER, bold: true, children: ["API key for ", keyPrompt.provider] }), _jsx(Text, { color: MUTED, children: "Paste it and press enter, or ctrl+v to read the clipboard. Held in memory for this session only; esc to cancel." }), keyPrompt.note && _jsx(Text, { color: CYAN, children: keyPrompt.note }), _jsxs(Box, { marginTop: 1, children: [_jsxs(Text, { color: MUTED, children: [keyPrompt.env, ": "] }), _jsx(Text, { color: INK, children: '*'.repeat(Math.min(keyPrompt.value.length, 48)) }), _jsx(Text, { color: CYAN, children: "\u2588" }), keyPrompt.value.length > 0 && (_jsxs(Text, { color: DIM, children: [" ", keyPrompt.value.length, " characters"] }))] })] })), ask && (() => {
5516
5516
  let detail = '';
5517
+ let isCommand = false;
5517
5518
  try {
5518
5519
  const parsed = JSON.parse(ask.args);
5519
- detail = String(parsed['command'] ?? parsed['path'] ?? parsed['source'] ?? '');
5520
+ if (parsed['command'] !== undefined) {
5521
+ detail = String(parsed['command']);
5522
+ isCommand = true;
5523
+ }
5524
+ else
5525
+ detail = String(parsed['path'] ?? parsed['source'] ?? '');
5520
5526
  }
5521
5527
  catch { /* show the tool alone */ }
5522
5528
  const options = askOptions(ask.tool, ask.prefix);
5529
+ /*
5530
+ * The whole command, wrapped onto its own lines.
5531
+ *
5532
+ * It was `detail.slice(0, 200)` on the same line as the tool name, so a real command — a cd
5533
+ * into a directory, an artisan call with a quoted PHP expression — arrived cut off mid-flight
5534
+ * with nothing saying it had been cut. A command you cannot read is one you cannot honestly
5535
+ * approve, and that is the whole point of asking. So it wraps instead of truncating, sits
5536
+ * indented under a line that says what is about to happen, and if it is genuinely enormous
5537
+ * the remainder is counted out loud rather than dropped in silence.
5538
+ */
5539
+ const room = Math.max(24, Math.min(barWidth, 100) - 8);
5540
+ const SHOW_AT_MOST = 1200;
5541
+ const shown = detail.slice(0, SHOW_AT_MOST);
5542
+ const cut = detail.length - shown.length;
5543
+ const detailLines = shown
5544
+ ? wrapPreserving(shown, room).map(l => ' ' + l)
5545
+ : [];
5523
5546
  const lines = [
5524
- `**${ask.tool}**${detail ? ' ' + detail.slice(0, 200) : ''}`,
5547
+ detail
5548
+ ? `**${ask.tool}** wants to ${isCommand ? 'run' : 'touch'}:`
5549
+ : `**${ask.tool}** wants to run.`,
5550
+ ...(detailLines.length ? ['', ...detailLines] : []),
5551
+ ...(cut > 0 ? [` *… and ${cut} more characters*`] : []),
5525
5552
  '',
5526
5553
  ...options.map((o, i) => `${i === ask.choice ? `**${G.caret} ${o.key}**` : ` ${o.key}`} ${o.label}`),
5527
5554
  '',