@ywldan/kiro 0.2.1 → 0.2.2

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/README.md CHANGED
@@ -280,13 +280,15 @@ Exit codes: `0` success, `1` model/tool/session error, `2` usage error (includin
280
280
  | `Ctrl+W` | Delete the previous word |
281
281
  | Left / Right / Home / End | Move the cursor |
282
282
 
283
- The status bar shows the active profile and model, the working directory, the context meter (`ctx 42k/128k`), the number of queued messages, and the current state (`ready`, `thinking…`, `retrying (n/3)…`, `running <tool>…`, `approval needed`, `cancelling…`). A long profile name is shortened in the middle, so the model and directory stay readable.
283
+ The status bar shows the active profile and model, the working directory, the context meter (`ctx 42k/128k`), the number of queued messages, and the current state (`ready`, `thinking…`, `replying…`, `running <tool>…`, `approval needed`, `cancelling…`) with a spinner and the elapsed seconds for the current turn (`replying… · 12s`). A long profile name is shortened in the middle, so the model and directory stay readable.
284
284
 
285
285
  The input stays enabled while the agent works: type the next prompt and press Enter to queue it, and it runs as soon as the current turn ends. Queued prompts appear in the transcript right away, the status bar shows `N queued`, and Ctrl+C clears the queue together with the running turn. Slash commands typed while busy are queued the same way.
286
286
 
287
287
  Prompt history is stored per working directory in `~/.kiro/history/` (mode `0600`, up to 200 entries). With an empty input, `↑` recalls the most recent prompt, `↓` walks forward again, and editing the recalled text leaves history mode. Registered API-key values are redacted before a prompt is written. Set `KIRO_HISTORY_DIR` to store the files elsewhere.
288
288
 
289
- Reasoning models stream their thinking traces live as a dim `thinking…` block. Once the visible answer starts, the trace collapses to a single `reasoning (done, not saved)` line: traces are display-only and are never written to sessions or `/export`.
289
+ Reasoning models stream their thinking traces live as a dim `thinking…` block. Once the visible answer starts, the trace collapses to a single `reasoning (done, not saved)` line: traces are display-only and are never written to sessions or `/export`. While the model is producing text the status bar switches from `thinking…` to `replying…`; tool execution shows `running <tool>…`.
290
+
291
+ Each finished assistant round shows how long it took and, when the endpoint reports usage, its output throughput: `· 8.4s · 23 tok/s`. The countdown in the status bar and the per-reply timing are wall-clock (including network time), are display-only, and are not stored in saved sessions; resumed replies and replies from servers without usage simply omit them.
290
292
 
291
293
  Assistant replies are rendered as Markdown: headings, bold/italic, inline code, bullet and numbered lists, task checkboxes, blockquotes, links, and fenced code blocks. Unknown or incomplete markers fall back to their literal text, so streaming never breaks the layout.
292
294
 
@@ -415,6 +417,7 @@ If an `AGENTS.md` file exists in the working directory, its contents are appende
415
417
  - Ctrl+C aborts the HTTP stream and any running command; partial assistant text is preserved.
416
418
  - `kiro -p` runs the same agent loop without Ink, streams assistant text to stdout and diagnostics to stderr, denies tool calls unless `--yolo` is given, and saves the session like the TUI.
417
419
  - Sessions are saved atomically after each user message and completed turn, and are restored by rebuilding the visible transcript from the stored messages.
420
+ - Reply timing is measured per model round (request start to finished reply) and includes network latency. Token throughput uses the endpoint's completion-token usage; both are shown only in the live TUI and are not persisted.
418
421
  - Model discovery calls `GET {baseUrl}/models` with a 10-second timeout; the connection test sends one tiny non-tool chat completion with the same timeout. Both can be cancelled.
419
422
  - Config saves are atomic and merge into the file on disk, so fields Kiro does not know about are preserved. Invalid JSON can be backed up and replaced with a fresh template.
420
423
  - Keys are never written to `config.json`, sessions, or logs. They live in `~/.kiro/.env` (mode `0600`) or the real environment, and the config stores only `apiKeyEnv`; actual values are never printed, are stripped from `run_command`'s environment, and are redacted from tool output before it reaches the model.
package/dist/ui/App.js CHANGED
@@ -70,6 +70,8 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
70
70
  const [runtimeConfig, setRuntimeConfig] = useState(config);
71
71
  const [profileName, setProfileName] = useState(config.activeProfile);
72
72
  const [busy, setBusy] = useState(false);
73
+ const [replying, setReplying] = useState(false);
74
+ const [busySince, setBusySince] = useState(null);
73
75
  const [wizardPrompt, setWizardPrompt] = useState(null);
74
76
  const [wizardActive, setWizardActive] = useState(false);
75
77
  const [activeTool, setActiveTool] = useState(null);
@@ -81,6 +83,8 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
81
83
  const [expandedToolId, setExpandedToolId] = useState(null);
82
84
  const messagesRef = useRef((initialSession?.messages ?? []).filter((message) => message.role !== 'system'));
83
85
  const usageRef = useRef(null);
86
+ const roundStartedAtRef = useRef(0);
87
+ const roundCompletionTokensRef = useRef(null);
84
88
  const [contextTokens, setContextTokens] = useState(() => estimateMessagesTokens(messagesRef.current));
85
89
  const contextTokensRef = useRef(contextTokens);
86
90
  const sessionRef = useRef(initialSession
@@ -374,13 +378,19 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
374
378
  }, 30);
375
379
  }
376
380
  }, [flushText]);
377
- const finalizeAssistant = useCallback((content) => {
381
+ const finalizeAssistant = useCallback((content, durationMs, tokensPerSecond) => {
378
382
  setItems((current) => {
379
383
  const last = current[current.length - 1];
380
384
  if (last?.kind === 'assistant' && last.draft) {
381
- return [...current.slice(0, -1), { ...last, text: content, draft: false }];
385
+ return [
386
+ ...current.slice(0, -1),
387
+ { ...last, text: content, draft: false, durationMs, tokensPerSecond },
388
+ ];
382
389
  }
383
- return [...current, { kind: 'assistant', id: nextItemIdRef.current++, text: content }];
390
+ return [
391
+ ...current,
392
+ { kind: 'assistant', id: nextItemIdRef.current++, text: content, durationMs, tokensPerSecond },
393
+ ];
384
394
  });
385
395
  }, []);
386
396
  /** Marks live "thinking…" items finished; reasoning is display-only and not saved. */
@@ -430,6 +440,11 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
430
440
  busyRef.current = true;
431
441
  cancelRequestedRef.current = false;
432
442
  setBusy(true);
443
+ setReplying(false);
444
+ const startedAt = Date.now();
445
+ setBusySince(startedAt);
446
+ roundStartedAtRef.current = startedAt;
447
+ roundCompletionTokensRef.current = null;
433
448
  setCancelling(false);
434
449
  setActiveTool(null);
435
450
  if (!alreadyDisplayed) {
@@ -468,6 +483,7 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
468
483
  case 'text':
469
484
  flushText();
470
485
  finalizeReasoning();
486
+ setReplying(true);
471
487
  queueText(event.text);
472
488
  break;
473
489
  case 'reasoning': {
@@ -490,15 +506,24 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
490
506
  });
491
507
  break;
492
508
  }
493
- case 'assistant':
509
+ case 'assistant': {
494
510
  flushText();
495
511
  finalizeReasoning();
496
- finalizeAssistant(event.content);
512
+ const durationMs = Math.max(0, Date.now() - roundStartedAtRef.current);
513
+ const completionTokens = roundCompletionTokensRef.current;
514
+ const tokensPerSecond = completionTokens !== null && completionTokens > 0 && durationMs > 0
515
+ ? Math.round(completionTokens / (durationMs / 1_000))
516
+ : undefined;
517
+ finalizeAssistant(event.content, durationMs, tokensPerSecond);
518
+ roundCompletionTokensRef.current = null;
519
+ setReplying(false);
497
520
  recomputeContext();
498
521
  break;
522
+ }
499
523
  case 'tool-start':
500
524
  flushText();
501
525
  finalizeReasoning();
526
+ setReplying(false);
502
527
  setActiveTool(event.toolCall.function.name);
503
528
  setItems((current) => [
504
529
  ...current,
@@ -532,6 +557,9 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
532
557
  return next;
533
558
  });
534
559
  recomputeContext();
560
+ // The next model round starts once the tools for this one finish.
561
+ roundStartedAtRef.current = Date.now();
562
+ roundCompletionTokensRef.current = null;
535
563
  break;
536
564
  case 'usage':
537
565
  usageRef.current = {
@@ -540,6 +568,7 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
540
568
  // stream ends and is already counted in totalTokens.
541
569
  messageCount: messagesRef.current.length + 1,
542
570
  };
571
+ roundCompletionTokensRef.current = event.usage.completionTokens;
543
572
  recomputeContext();
544
573
  break;
545
574
  case 'notice':
@@ -568,6 +597,8 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
568
597
  abortRef.current = null;
569
598
  busyRef.current = false;
570
599
  setBusy(false);
600
+ setReplying(false);
601
+ setBusySince(null);
571
602
  setActiveTool(null);
572
603
  setCancelling(false);
573
604
  if (pendingApprovalRef.current)
@@ -1169,7 +1200,9 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
1169
1200
  : busy
1170
1201
  ? activeTool
1171
1202
  ? 'running'
1172
- : 'thinking'
1203
+ : replying
1204
+ ? 'replying'
1205
+ : 'thinking'
1173
1206
  : null;
1174
1207
  const activeProfile = runtimeConfig.profiles[profileName];
1175
1208
  const contextWindow = contextWindowFor(activeProfile);
@@ -1183,6 +1216,6 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
1183
1216
  ? 'Kiro is working… type ahead, or Ctrl+C to cancel'
1184
1217
  : wizardActive
1185
1218
  ? 'Working… Esc to cancel'
1186
- : 'Ask Kiro to build or change something…', slashMenu: !wizardActive && !wizardPrompt, onMenuRowsChange: handleMenuRowsChange, onSubmit: handleSubmit, onCancel: wizardActive ? cancelWizard : undefined }, wizardPrompt?.id ?? 0)), _jsx(StatusBar, { width: width, profile: profileName, model: activeProfile?.model ?? 'unknown', cwd: cwd, activity: activity, toolName: activeTool ?? undefined, queued: queuedCount > 0 ? queuedCount : undefined, yolo: yolo, autoAllowed: autoAllowed, contextTokens: contextTokens, contextWindow: contextWindow })] }));
1219
+ : 'Ask Kiro to build or change something…', slashMenu: !wizardActive && !wizardPrompt, onMenuRowsChange: handleMenuRowsChange, onSubmit: handleSubmit, onCancel: wizardActive ? cancelWizard : undefined }, wizardPrompt?.id ?? 0)), _jsx(StatusBar, { width: width, profile: profileName, model: activeProfile?.model ?? 'unknown', cwd: cwd, activity: activity, toolName: activeTool ?? undefined, busySince: busySince ?? undefined, queued: queuedCount > 0 ? queuedCount : undefined, yolo: yolo, autoAllowed: autoAllowed, contextTokens: contextTokens, contextWindow: contextWindow })] }));
1187
1220
  }
1188
1221
  //# sourceMappingURL=App.js.map
@@ -132,6 +132,14 @@ function itemLines(item, width, expandedToolId) {
132
132
  text: '',
133
133
  segments: line.segments,
134
134
  }));
135
+ if (!item.draft && item.durationMs !== undefined) {
136
+ const speed = item.tokensPerSecond !== undefined ? ` · ${item.tokensPerSecond} tok/s` : '';
137
+ lines.push({
138
+ prefix: ' ',
139
+ text: `· ${formatDuration(item.durationMs)}${speed}`,
140
+ dim: true,
141
+ });
142
+ }
135
143
  lines.push(blankLine());
136
144
  return lines;
137
145
  }
@@ -14,7 +14,7 @@ function prettyCwd(cwd) {
14
14
  }
15
15
  return cwd;
16
16
  }
17
- export function StatusBar({ width, profile, model, cwd, activity, toolName, queued, yolo = false, autoAllowed = [], contextTokens, contextWindow, }) {
17
+ export function StatusBar({ width, profile, model, cwd, activity, toolName, busySince, queued, yolo = false, autoAllowed = [], contextTokens, contextWindow, }) {
18
18
  const busy = activity !== null;
19
19
  const [frame, setFrame] = useState(0);
20
20
  useEffect(() => {
@@ -29,11 +29,16 @@ export function StatusBar({ width, profile, model, cwd, activity, toolName, queu
29
29
  ? 'cancelling…'
30
30
  : activity === 'running'
31
31
  ? `running ${toolName ?? 'tool'}…`
32
- : activity === 'thinking'
33
- ? 'thinking…'
34
- : 'ready';
32
+ : activity === 'replying'
33
+ ? 'replying…'
34
+ : activity === 'thinking'
35
+ ? 'thinking…'
36
+ : 'ready';
35
37
  const stateColor = activity === 'cancelling' ? 'red' : activity === null ? 'green' : 'yellow';
36
38
  const spinner = busy ? `${SPINNER[frame] ?? '⠋'} ` : '';
39
+ const elapsedMs = busy && busySince !== undefined ? Math.max(0, Date.now() - busySince) : 0;
40
+ // Whole seconds keep the re-rendering spinner from making the timer flicker.
41
+ const elapsedNote = elapsedMs >= 1_000 ? ` · ${Math.floor(elapsedMs / 1_000)}s` : '';
37
42
  const queueNote = queued ? `${queued} queued · ` : '';
38
43
  const badge = yolo
39
44
  ? 'YOLO'
@@ -43,7 +48,7 @@ export function StatusBar({ width, profile, model, cwd, activity, toolName, queu
43
48
  const badgeWidth = badge === '' ? 0 : displayWidth(badge) + 2;
44
49
  // The bar is indented to line up with the chat text, so budgets use the inner width.
45
50
  const innerWidth = Math.max(10, width - 2);
46
- const state = `${spinner}${queueNote}${stateText}`;
51
+ const state = `${spinner}${queueNote}${stateText}${elapsedNote}`;
47
52
  const stateBudget = Math.max(4, Math.max(10, Math.floor(innerWidth / 2)) - badgeWidth);
48
53
  const stateShown = truncateToWidth(state, stateBudget);
49
54
  const restBudget = Math.max(0, innerWidth - badgeWidth - displayWidth(stateShown) - 2 - 6);
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.2.1';
1
+ export const VERSION = '0.2.2';
2
2
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ywldan/kiro",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "A small terminal coding agent with your own OpenAI-compatible endpoint",
5
5
  "keywords": [
6
6
  "ai",