koneck 2.25.15 → 2.25.16

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
@@ -2,7 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import React, { useState, useEffect, useRef } from 'react';
3
3
  import { Box, Static, Text, render, useApp, useInput, useStdin } from 'ink';
4
4
  import { execa } from 'execa';
5
- import { createAgentSession, buildClient } from './engine.js';
5
+ import { createAgentSession, buildClient, resolveAgentConcurrency } from './engine.js';
6
6
  import { estimateCost, formatCost } from './pricing.js';
7
7
  import { generateSessionId, saveSession, listSessions, loadSession } from './session.js';
8
8
  import { loadMemory } from './memory.js';
@@ -500,6 +500,14 @@ function App({ config: initialConfig }) {
500
500
  const lastActivityRef = useRef(Date.now());
501
501
  /** Frames received before any content — proof the provider has the request and is working. */
502
502
  const [providerFrames, setProviderFrames] = useState(0);
503
+ /**
504
+ * Reasoning characters this turn, and when the last one arrived.
505
+ *
506
+ * A reasoning model can think for a long time before writing anything; saying so is the
507
+ * difference between a visible wait and an apparent stall. Kept in a ref because it updates per
508
+ * token — the animation tick is what paints it, not a re-render per delta.
509
+ */
510
+ const thinkingRef = useRef({ chars: 0, at: 0 });
503
511
  /**
504
512
  * Text pasted into the composer, held aside so the prompt stays readable.
505
513
  *
@@ -657,6 +665,10 @@ function App({ config: initialConfig }) {
657
665
  liveToolRef.current.output = line;
658
666
  },
659
667
  onStreamActivity: (frames) => setProviderFrames(frames),
668
+ onThinking: (_text, totalChars) => {
669
+ thinkingRef.current = { chars: totalChars, at: Date.now() };
670
+ lastActivityRef.current = Date.now();
671
+ },
660
672
  onAgentProgress: (list) => { agentsRef.current = list; setAgents(list); },
661
673
  onTokens: (s) => {
662
674
  realTokRef.current = Math.max(0, s.completionTokens - tokBaseRef.current);
@@ -1477,6 +1489,14 @@ function App({ config: initialConfig }) {
1477
1489
  const n = Number(val);
1478
1490
  setConfigMaxWidth(Number.isFinite(n) && n >= 40 ? n : undefined);
1479
1491
  }
1492
+ if (key === 'agentConcurrency') {
1493
+ // Takes effect on the next spawn_agents call — the session keeps running.
1494
+ const n = Number(val);
1495
+ const next = { ...cfg, agentConcurrency: Number.isFinite(n) ? n : undefined };
1496
+ setCfg(next);
1497
+ await resetSession(next);
1498
+ addSystem(`Sub-agent concurrency is now ${resolveAgentConcurrency(next.agentConcurrency)}.`);
1499
+ }
1480
1500
  return;
1481
1501
  }
1482
1502
  if (key) {
@@ -1491,6 +1511,7 @@ function App({ config: initialConfig }) {
1491
1511
  provider: cfg.provider, model: cfg.model, effort, requireApproval: cfg.requireApproval,
1492
1512
  maxTurns: cfg.maxTurns, budget: cfg.budget, baseURL: cfg.baseURL,
1493
1513
  maxWidth: configMaxWidth ?? `(not set - filling ${termCols} columns)`,
1514
+ agentConcurrency: resolveAgentConcurrency(cfg.agentConcurrency),
1494
1515
  };
1495
1516
  const lines2 = Object.entries(descs).map(([k, desc]) => {
1496
1517
  const v = live[k] ?? stored[k];
@@ -1637,6 +1658,7 @@ function App({ config: initialConfig }) {
1637
1658
  '\n' +
1638
1659
  ` provider ${cfg.provider} / ${modelShort} (sub-agents inherit this)\n` +
1639
1660
  ` max turns ${cfg.maxTurns} per sub-agent\n` +
1661
+ ` at once ${resolveAgentConcurrency(cfg.agentConcurrency)} (/config agentConcurrency <1-8>)\n` +
1640
1662
  ` approval ${cfg.requireApproval ? 'on' : 'off'}\n` +
1641
1663
  '\n' +
1642
1664
  'To force parallel work, ask for it: "review these four files in parallel".\n' +
@@ -2119,6 +2141,7 @@ function App({ config: initialConfig }) {
2119
2141
  sayRef.current = '';
2120
2142
  streamedRef.current = '';
2121
2143
  replyStartedRef.current = false;
2144
+ thinkingRef.current = { chars: 0, at: 0 };
2122
2145
  lastActivityRef.current = Date.now();
2123
2146
  setProviderFrames(0);
2124
2147
  liveToolRef.current = null;
@@ -2333,7 +2356,9 @@ function App({ config: initialConfig }) {
2333
2356
  // hang, when in fact the request was accepted and is being worked on.
2334
2357
  : providerFrames > 0 ? `${cfg.provider} is holding the line, no output yet`
2335
2358
  : elapsedMs > 8_000 ? `no response from ${cfg.provider} yet`
2336
- : 'starting', ")"] })] }) }), _jsx(Box, { paddingLeft: 2, children: _jsx(Text, { color: DIM, children: "esc to cancel and keep your input \u00B7 ctrl+c to exit" }) })] })) }), usagePane && (() => {
2359
+ : 'starting', thinkingRef.current.chars > 0 && Date.now() - thinkingRef.current.at < 2_000
2360
+ ? ` | thinking, ${fmtTokens(Math.round(thinkingRef.current.chars / 4))} reasoning tokens`
2361
+ : '', ")"] })] }) }), _jsx(Box, { paddingLeft: 2, children: _jsx(Text, { color: DIM, children: "esc to cancel and keep your input \u00B7 ctrl+c to exit" }) })] })) }), usagePane && (() => {
2337
2362
  const width = Math.min(barWidth, 66);
2338
2363
  const inner = width - 4;
2339
2364
  const BAR_W = Math.max(12, inner - 14);