@ywldan/kiro 0.3.1 → 0.4.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/README.md CHANGED
@@ -366,7 +366,7 @@ kiro --continue # most recent session for this directory
366
366
  kiro --resume <id> # a specific session
367
367
  ```
368
368
 
369
- `/sessions` and `/resume <n|id>` do the same from inside the TUI. `/resume` without arguments opens a picker with two tabs: `This directory` and `Other directories`, grouped by folder. Use `←`/`→` to switch tabs, `↑`/`↓` to move, type to filter by title, id, or path, `Enter` to resume, and `Esc` to close. Sessions from other directories are listed with their folder; selecting one shows where to start Kiro to resume it, because tool calls always run in the current working directory. `/clear` starts a new session without deleting the old one. Kiro does not auto-resume; without a flag it starts fresh.
369
+ `/sessions` and `/resume <n|id>` do the same from inside the TUI. `/resume` without arguments opens a picker with two tabs: `This directory` and `Other directories`, grouped by folder. Use `←`/`→` to switch tabs, `↑`/`↓` to move, type to filter by title, id, or path, `Enter` to resume, and `Esc` to close. Resuming a session from another directory switches Kiro's working directory to that folder, rebuilds the system prompt, skills, and prompt history for it, and saves the session there from then on. `/clear` starts a new session without deleting the old one. Kiro does not auto-resume; without a flag it starts fresh.
370
370
 
371
371
  Session files are plaintext and contain prompts, code from tools, and command output. They never contain API keys, but treat them like shell history.
372
372
 
@@ -397,9 +397,12 @@ Compaction shows a notice and is written to the session, so a resumed conversati
397
397
  | `multi_edit(path, edits[])` | Several exact replacements in one file, validated together and written once | always (except `--yolo`) |
398
398
  | `apply_patch(patch)` | Applies a unified diff to one or more files after validating every hunk | always (except `--yolo`) |
399
399
  | `run_command(command, timeout_seconds?)` | Runs a shell command in the working directory | always (except `--yolo`) |
400
+ | `ask_user(question, options, header?, multi_select?, allow_other?)` | Asks the user to pick from 1 to 4 short options and waits for the answer. `Other` accepts typed text | never |
400
401
 
401
402
  `grep` and `glob` keep large repositories manageable, and `read_file` pages through long files. Use `multi_edit` for several changes in one file and `apply_patch` for coordinated changes across files; `apply_patch` validates the whole patch before writing and rejects deletions and renames.
402
403
 
404
+ `ask_user` shows a centered prompt when the model needs a decision that belongs to you, such as a design direction or a choice between conflicting requirements. Use `↑/↓` to move, `Enter` to choose, `Space` to toggle when several answers are allowed, and `Esc` to dismiss. Dismissing returns a refusal to the model and the turn continues. Headless runs have no terminal, so the tool returns an error and the model is told to ask in plain text instead.
405
+
403
406
  Approvals show a diff, or the exact command, and offer:
404
407
 
405
408
  - `[y]` allow once
@@ -504,7 +507,7 @@ test/
504
507
  - `@` lists files only and stops at 50,000 paths; directories and ignored files are not offered.
505
508
  - Removing a profile leaves its key in `~/.kiro/.env`; there is no command that deletes stored secrets.
506
509
  - No sub-agents, MCP, plugins, web search, image input, themes, or git integration.
507
- - Sessions are single-process and stored as plaintext JSON. There is no delete or rename command. The `/resume` picker lists other directories, but a session can only be resumed from its own directory; `/export` writes a Markdown transcript you can keep.
510
+ - Sessions are single-process and stored as plaintext JSON. There is no delete or rename command. The `/resume` picker can load a session from another directory and switches the working directory to it; `/export` writes a Markdown transcript you can keep.
508
511
  - `/undo` covers `write_file`, `edit_file`, `multi_edit`, and `apply_patch` only. It keeps the last 30 calls, and `run_command` changes are outside its reach; use Git for a complete safety net.
509
512
  - Prompt history is plaintext, capped at 200 entries per directory, and only recalled in the TUI (not in `-p` mode).
510
513
  - Only contiguous read-only tool calls run in parallel; writes, edits, patches, and commands stay sequential.
@@ -48,10 +48,11 @@ export async function buildSystemPrompt(cwd) {
48
48
  '- Tool output may be truncated. Use read_file offsets, narrower grep patterns/globs, or smaller result limits if you need more detail.',
49
49
  '- If a tool returns an error, read it carefully and adjust; edit_file/multi_edit errors include a hint about the closest line or whitespace mismatch.',
50
50
  '- The user must approve write_file, edit_file, multi_edit, apply_patch, and run_command. If they deny a call, respect the decision and explain alternatives instead of retrying the same action.',
51
+ '- Use ask_user when a choice belongs to the user: design direction, mutually exclusive options, or a requirement only they can settle. Ask once with short labels and wait; do not print numbered questions as text. Do not use it to ask permission for a tool call.',
51
52
  '- Do not invent file contents or command output. Keep final answers concise: say what changed and include relevant verification results.',
52
53
  '- A turn is limited to 25 tool-call rounds. Keep work focused and finish when the task is done.',
53
54
  '',
54
- 'You have these tools: read_file, write_file, edit_file, multi_edit, apply_patch, list_dir, glob, grep, run_command.',
55
+ 'You have these tools: read_file, write_file, edit_file, multi_edit, apply_patch, list_dir, glob, grep, run_command, ask_user.',
55
56
  ].join('\n');
56
57
  const [agents, inventory] = await Promise.all([readAgentsSection(cwd), loadSkills(cwd)]);
57
58
  const sections = [base, agents, formatSkillIndex(inventory.skills)].filter(Boolean);
@@ -0,0 +1,136 @@
1
+ import { booleanArg, stringArg } from './paths.js';
2
+ import { denied, ok, toolError } from './types.js';
3
+ const MAX_OPTIONS = 4;
4
+ const MAX_OPTION_LABEL_CHARS = 40;
5
+ const MAX_OPTION_DESCRIPTION_CHARS = 120;
6
+ const MAX_QUESTION_CHARS = 400;
7
+ const MAX_HEADER_CHARS = 12;
8
+ function optionList(input) {
9
+ const raw = input.options;
10
+ if (!Array.isArray(raw))
11
+ throw new Error('Argument "options" must be an array.');
12
+ if (raw.length < 1 || raw.length > MAX_OPTIONS) {
13
+ throw new Error(`Argument "options" must contain 1 to ${MAX_OPTIONS} entries.`);
14
+ }
15
+ const seen = new Set();
16
+ return raw.map((entry, index) => {
17
+ if (typeof entry !== 'object' || entry === null || Array.isArray(entry)) {
18
+ throw new Error(`Option ${index + 1} must be an object with a "label" and optional "description".`);
19
+ }
20
+ const item = entry;
21
+ const label = typeof item.label === 'string' ? item.label.trim() : '';
22
+ if (!label)
23
+ throw new Error(`Option ${index + 1} needs a non-empty "label".`);
24
+ if (label.length > MAX_OPTION_LABEL_CHARS) {
25
+ throw new Error(`Option ${index + 1} label is longer than ${MAX_OPTION_LABEL_CHARS} characters; shorten it.`);
26
+ }
27
+ if (seen.has(label.toLowerCase())) {
28
+ throw new Error(`Option ${index + 1} repeats the label "${label}". Use distinct labels.`);
29
+ }
30
+ seen.add(label.toLowerCase());
31
+ if (item.description === undefined || item.description === null)
32
+ return { label };
33
+ if (typeof item.description !== 'string') {
34
+ throw new Error(`Option ${index + 1} "description" must be a string.`);
35
+ }
36
+ const description = item.description.trim();
37
+ if (!description)
38
+ return { label };
39
+ if (description.length > MAX_OPTION_DESCRIPTION_CHARS) {
40
+ throw new Error(`Option ${index + 1} description is longer than ${MAX_OPTION_DESCRIPTION_CHARS} characters; shorten it.`);
41
+ }
42
+ return { label, description };
43
+ });
44
+ }
45
+ function answerText(request, selected, other) {
46
+ const lines = [`The user answered: ${request.question}`];
47
+ if (selected.length > 0)
48
+ lines.push(`Selected: ${selected.join('; ')}`);
49
+ if (other)
50
+ lines.push(`Other: ${other}`);
51
+ return lines.join('\n');
52
+ }
53
+ const askUserTool = {
54
+ definition: {
55
+ type: 'function',
56
+ function: {
57
+ name: 'ask_user',
58
+ description: 'Ask the user a question with a short list of choices when the decision is genuinely theirs and guessing would waste work. ' +
59
+ 'This blocks until they answer and returns the selection. Use it instead of printing numbered questions as text. ' +
60
+ 'Do not use it to request permission for a tool call; approvals already cover that.',
61
+ parameters: {
62
+ type: 'object',
63
+ properties: {
64
+ question: {
65
+ type: 'string',
66
+ description: `What to ask, one or two sentences (max ${MAX_QUESTION_CHARS} characters).`,
67
+ },
68
+ header: {
69
+ type: 'string',
70
+ description: `Short title for the prompt, at most ${MAX_HEADER_CHARS} characters, e.g. "Design".`,
71
+ },
72
+ options: {
73
+ type: 'array',
74
+ minItems: 1,
75
+ maxItems: MAX_OPTIONS,
76
+ description: `One to ${MAX_OPTIONS} distinct choices.`,
77
+ items: {
78
+ type: 'object',
79
+ properties: {
80
+ label: { type: 'string', description: `Choice text (max ${MAX_OPTION_LABEL_CHARS} characters).` },
81
+ description: {
82
+ type: 'string',
83
+ description: `Optional one-line detail (max ${MAX_OPTION_DESCRIPTION_CHARS} characters).`,
84
+ },
85
+ },
86
+ required: ['label'],
87
+ additionalProperties: false,
88
+ },
89
+ },
90
+ multi_select: {
91
+ type: 'boolean',
92
+ description: 'Allow more than one choice. Default false.',
93
+ },
94
+ allow_other: {
95
+ type: 'boolean',
96
+ description: 'Offer a free-form answer next to the listed choices. Default true.',
97
+ },
98
+ },
99
+ required: ['question', 'options'],
100
+ additionalProperties: false,
101
+ },
102
+ },
103
+ },
104
+ async run(input, ctx) {
105
+ const question = stringArg(input, 'question').trim();
106
+ if (question.length > MAX_QUESTION_CHARS) {
107
+ return toolError(`The question is longer than ${MAX_QUESTION_CHARS} characters. Shorten it and put details in the option descriptions.`);
108
+ }
109
+ const header = (stringArg(input, 'header', true) ?? '').trim().slice(0, MAX_HEADER_CHARS) || undefined;
110
+ const options = optionList(input);
111
+ const multiSelect = booleanArg(input, 'multi_select', false);
112
+ const allowOther = booleanArg(input, 'allow_other', true);
113
+ const request = { question, header, options, multiSelect, allowOther };
114
+ if (!ctx.askUser) {
115
+ return toolError('ask_user needs an interactive terminal, and this run has none. ' +
116
+ 'Ask the question in plain text and stop, so the user can answer in their next message.');
117
+ }
118
+ if (ctx.signal.aborted)
119
+ return denied('Cancelled before the user answered.');
120
+ const answer = await ctx.askUser(request);
121
+ if (answer.cancelled) {
122
+ return denied('The user dismissed the question without answering. Do not ask it again; continue with a sensible ' +
123
+ 'default, or ask in plain text if the answer is still required.');
124
+ }
125
+ const selected = request.options
126
+ .map((option) => option.label)
127
+ .filter((label) => answer.selected.includes(label));
128
+ const other = answer.other?.trim();
129
+ if (selected.length === 0 && !other) {
130
+ return denied('The user submitted no answer.');
131
+ }
132
+ return ok(answerText(request, selected, other), `ask_user: ${[...selected, ...(other ? [`Other: ${other}`] : [])].join(', ')}`);
133
+ },
134
+ };
135
+ export const askTools = [askUserTool];
136
+ //# sourceMappingURL=ask.js.map
@@ -1,4 +1,5 @@
1
1
  import { redactSecrets } from '../secrets.js';
2
+ import { askTools } from './ask.js';
2
3
  import { fsTools } from './fs.js';
3
4
  import { patchTools } from './patch.js';
4
5
  import { searchTools } from './search.js';
@@ -6,7 +7,14 @@ import { runCommandTool } from './shell.js';
6
7
  import { skillTools } from './skill.js';
7
8
  import { toolError } from './types.js';
8
9
  export const MAX_TOOL_RESULT_CHARS = 60_000;
9
- export const tools = [...fsTools, ...searchTools, ...patchTools, runCommandTool, ...skillTools];
10
+ export const tools = [
11
+ ...fsTools,
12
+ ...searchTools,
13
+ ...patchTools,
14
+ runCommandTool,
15
+ ...askTools,
16
+ ...skillTools,
17
+ ];
10
18
  export const toolDefinitions = tools.map((tool) => tool.definition);
11
19
  const byName = new Map(tools.map((tool) => [tool.definition.function.name, tool]));
12
20
  export function isReadOnlyTool(name) {
package/dist/ui/App.js CHANGED
@@ -14,6 +14,7 @@ import { runAddFlow, runEditFlow, runRemoveFlow, } from '../model/wizard.js';
14
14
  import { createProvider } from '../providers/index.js';
15
15
  import { dropIncompleteToolCalls, formatSessionTime, isSessionId, listAllSessions, listSessions, loadSession, newSessionId, projectSessionsDir, saveSession, titleFromMessages, } from '../sessions.js';
16
16
  import { ApprovalPrompt } from './ApprovalPrompt.js';
17
+ import { AskUserPrompt } from './AskUserPrompt.js';
17
18
  import { ApprovalPolicy } from './approval-policy.js';
18
19
  import { builtinCommandNames, buildSkillCommands, SLASH_COMMANDS, slashHelpLines, } from './commands.js';
19
20
  import { defaultExportPath, renderTranscriptMarkdown } from './export.js';
@@ -36,6 +37,8 @@ import { undoLastCheckpoint } from '../tools/checkpoint.js';
36
37
  import { MAX_EXPANDED_TOOL_CHARS, MAX_REASONING_CHARS, } from './types.js';
37
38
  /** Idle Ctrl+C must be pressed again within this window to exit. */
38
39
  const QUIT_CONFIRM_MS = 2_000;
40
+ /** Tallest inline question block: title, three question lines, four options, other, footer, borders. */
41
+ const ASK_INLINE_ROWS = 12;
39
42
  function useTerminalSize() {
40
43
  const { stdout } = useStdout();
41
44
  const read = useCallback(() => ({
@@ -52,11 +55,13 @@ function useTerminalSize() {
52
55
  }, [stdout, read]);
53
56
  return size;
54
57
  }
55
- export function App({ config, baseConfig, overrides, configPath, configCreated, cwd, version, yolo, mouseEnabled, initialSession, startupNotices, }) {
58
+ export function App({ config, baseConfig, overrides, configPath, configCreated, cwd: initialCwd, version, yolo, mouseEnabled, initialSession, startupNotices, }) {
56
59
  const { exit } = useApp();
57
60
  const { stdout } = useStdout();
58
61
  const { columns, rows } = useTerminalSize();
59
62
  const width = Math.max(20, columns - 2);
63
+ /** Changes when a session from another directory is resumed. */
64
+ const [cwd, setCwd] = useState(initialCwd);
60
65
  const initialViewRef = useRef(null);
61
66
  if (initialViewRef.current === null) {
62
67
  const view = initialSession
@@ -85,6 +90,7 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
85
90
  const [activeTool, setActiveTool] = useState(null);
86
91
  const [cancelling, setCancelling] = useState(false);
87
92
  const [pendingApproval, setPendingApproval] = useState(null);
93
+ const [pendingQuestion, setPendingQuestion] = useState(null);
88
94
  const [pickerOpen, setPickerOpen] = useState(false);
89
95
  const [sessionPicker, setSessionPicker] = useState(null);
90
96
  const [quitArmed, setQuitArmed] = useState(false);
@@ -144,6 +150,8 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
144
150
  const [autoAllowed, setAutoAllowed] = useState([]);
145
151
  const pendingApprovalRef = useRef(null);
146
152
  const pendingResolverRef = useRef(null);
153
+ const pendingQuestionRef = useRef(null);
154
+ const questionResolverRef = useRef(null);
147
155
  const textBufferRef = useRef('');
148
156
  const queuedRef = useRef([]);
149
157
  const [queuedCount, setQueuedCount] = useState(0);
@@ -483,6 +491,29 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
483
491
  setPendingApproval(request);
484
492
  });
485
493
  }, [approvalPolicy]);
494
+ const resolveQuestion = useCallback((answer) => {
495
+ const resolver = questionResolverRef.current;
496
+ pendingQuestionRef.current = null;
497
+ questionResolverRef.current = null;
498
+ setPendingQuestion(null);
499
+ resolver?.(answer);
500
+ }, []);
501
+ const askUser = useCallback((request) => {
502
+ const signal = abortRef.current?.signal;
503
+ if (signal?.aborted)
504
+ return Promise.resolve({ selected: [], cancelled: true });
505
+ return new Promise((resolve) => {
506
+ // Cancelling the turn must release the tool, even if Ctrl+C skipped the prompt.
507
+ const onAbort = () => resolveQuestion({ selected: [], cancelled: true });
508
+ signal?.addEventListener('abort', onAbort, { once: true });
509
+ pendingQuestionRef.current = request;
510
+ questionResolverRef.current = (answer) => {
511
+ signal?.removeEventListener('abort', onAbort);
512
+ resolve(answer);
513
+ };
514
+ setPendingQuestion(request);
515
+ });
516
+ }, [resolveQuestion]);
486
517
  const resetAutoAllowed = useCallback(() => {
487
518
  approvalPolicy.clear();
488
519
  setAutoAllowed([]);
@@ -564,6 +595,7 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
564
595
  cwd,
565
596
  signal: controller.signal,
566
597
  approve,
598
+ askUser,
567
599
  };
568
600
  for await (const event of runAgentTurn({
569
601
  provider,
@@ -706,6 +738,8 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
706
738
  setCancelling(false);
707
739
  if (pendingApprovalRef.current)
708
740
  resolveApproval('deny');
741
+ if (pendingQuestionRef.current)
742
+ resolveQuestion({ selected: [], cancelled: true });
709
743
  recomputeContext();
710
744
  void persistSession();
711
745
  void refreshSkillCommands();
@@ -722,6 +756,7 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
722
756
  }, [
723
757
  addNotice,
724
758
  approve,
759
+ askUser,
725
760
  autoCompact,
726
761
  cwd,
727
762
  finalizeAssistant,
@@ -733,6 +768,7 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
733
768
  queueText,
734
769
  recomputeContext,
735
770
  resolveApproval,
771
+ resolveQuestion,
736
772
  ]);
737
773
  const runProfileTest = useCallback(async (requested) => {
738
774
  if (busyRef.current || transitioningRef.current || wizardActiveRef.current) {
@@ -816,6 +852,43 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
816
852
  }
817
853
  addNotice('muted', 'No finished tool output to expand yet.');
818
854
  }, [addNotice, expandedToolId, items]);
855
+ /** Loads a session record into the UI, switching the working directory when needed. */
856
+ const applySessionRecord = useCallback(async (record) => {
857
+ await persistSession();
858
+ await saveChainRef.current;
859
+ const directory = path.resolve(record.cwd);
860
+ messagesRef.current = record.messages.filter((message) => message.role !== 'system');
861
+ usageRef.current = null;
862
+ const restoredUsage = record.usage ?? EMPTY_USAGE;
863
+ sessionUsageRef.current = restoredUsage;
864
+ setSessionUsage(restoredUsage);
865
+ setLastReply(null);
866
+ recomputeContext();
867
+ sessionRef.current = {
868
+ id: record.id,
869
+ createdAt: record.createdAt,
870
+ title: record.title,
871
+ };
872
+ const view = buildResumedView(messagesRef.current, {
873
+ cwd: directory,
874
+ version,
875
+ sessionId: record.id,
876
+ });
877
+ setItems(view.items);
878
+ nextItemIdRef.current = view.nextId;
879
+ setResetSignal((current) => current + 1);
880
+ setExpandedToolId(null);
881
+ resetAutoAllowed();
882
+ listedSessionsRef.current = null;
883
+ if (directory !== path.resolve(cwd)) {
884
+ setCwd(directory);
885
+ addNotice('info', `Resumed session ${record.id} from ${shortCwd(directory, initialCwd)}. ` +
886
+ `Working directory is now ${shortCwd(directory, initialCwd)}.`);
887
+ }
888
+ if (record.profile && record.profile !== profileName) {
889
+ addNotice('muted', `Session was saved with profile "${record.profile}"; staying on "${profileName}". Use /model ${record.profile} to switch.`);
890
+ }
891
+ }, [addNotice, cwd, initialCwd, persistSession, profileName, recomputeContext, resetAutoAllowed, version]);
819
892
  const handleCommand = useCallback(async (input) => {
820
893
  if (busyRef.current || transitioningRef.current)
821
894
  return;
@@ -1075,6 +1148,26 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
1075
1148
  target = matches[0];
1076
1149
  }
1077
1150
  }
1151
+ if (!target && !numeric && isSessionId(argument)) {
1152
+ // Search the other project directories before giving up.
1153
+ const all = await listAllSessions(cwd, 20);
1154
+ const candidates = all.others
1155
+ .flatMap((group) => group.sessions)
1156
+ .filter((session) => session.id === argument || session.id.startsWith(argument));
1157
+ if (candidates.length > 1) {
1158
+ addNotice('error', `Session id "${argument}" is ambiguous; use more characters.`);
1159
+ return;
1160
+ }
1161
+ const foreign = candidates[0];
1162
+ if (foreign) {
1163
+ if (foreign.id === sessionRef.current?.id) {
1164
+ addNotice('info', `Session ${foreign.id} is already active.`);
1165
+ return;
1166
+ }
1167
+ await applySessionRecord(await loadSession(foreign.cwd, foreign.id));
1168
+ return;
1169
+ }
1170
+ }
1078
1171
  if (!target && (numeric || !isSessionId(argument))) {
1079
1172
  addNotice('error', `No saved session matches "${argument}". Use /sessions to list them.`);
1080
1173
  return;
@@ -1084,34 +1177,7 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
1084
1177
  addNotice('info', `Session ${targetId} is already active.`);
1085
1178
  return;
1086
1179
  }
1087
- await persistSession();
1088
- await saveChainRef.current;
1089
- const record = await loadSession(cwd, targetId);
1090
- messagesRef.current = record.messages.filter((message) => message.role !== 'system');
1091
- usageRef.current = null;
1092
- const restoredUsage = record.usage ?? EMPTY_USAGE;
1093
- sessionUsageRef.current = restoredUsage;
1094
- setSessionUsage(restoredUsage);
1095
- setLastReply(null);
1096
- recomputeContext();
1097
- sessionRef.current = {
1098
- id: record.id,
1099
- createdAt: record.createdAt,
1100
- title: record.title,
1101
- };
1102
- const view = buildResumedView(messagesRef.current, {
1103
- cwd,
1104
- version,
1105
- sessionId: record.id,
1106
- });
1107
- setItems(view.items);
1108
- nextItemIdRef.current = view.nextId;
1109
- setResetSignal((current) => current + 1);
1110
- setExpandedToolId(null);
1111
- resetAutoAllowed();
1112
- if (record.profile && record.profile !== profileName) {
1113
- addNotice('muted', `Session was saved with profile "${record.profile}"; staying on "${profileName}". Use /model ${record.profile} to switch.`);
1114
- }
1180
+ await applySessionRecord(await loadSession(cwd, targetId));
1115
1181
  }
1116
1182
  catch (error) {
1117
1183
  addNotice('error', error instanceof Error ? error.message : String(error));
@@ -1250,6 +1316,7 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
1250
1316
  }
1251
1317
  }, [
1252
1318
  addNotice,
1319
+ applySessionRecord,
1253
1320
  autoAllowed,
1254
1321
  cwd,
1255
1322
  listRemoteModels,
@@ -1268,14 +1335,25 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
1268
1335
  version,
1269
1336
  yolo,
1270
1337
  ]);
1271
- /** Resumes a picker selection only when it belongs to the current directory. */
1338
+ /** Resumes a picker selection, switching directories when the session came from elsewhere. */
1272
1339
  const handleSessionPick = (session) => {
1273
1340
  setSessionPicker(null);
1274
- if (path.resolve(session.cwd) !== path.resolve(cwd)) {
1275
- addNotice('info', `Session ${session.id} belongs to ${shortCwd(session.cwd, cwd)}. Start kiro in that directory to resume it.`);
1341
+ if (session.id === sessionRef.current?.id) {
1342
+ addNotice('info', `Session ${session.id} is already active.`);
1276
1343
  return;
1277
1344
  }
1278
- void handleCommand(`/resume ${session.id}`);
1345
+ transitioningRef.current = true;
1346
+ void (async () => {
1347
+ try {
1348
+ await applySessionRecord(await loadSession(session.cwd, session.id));
1349
+ }
1350
+ catch (error) {
1351
+ addNotice('error', error instanceof Error ? error.message : String(error));
1352
+ }
1353
+ finally {
1354
+ transitioningRef.current = false;
1355
+ }
1356
+ })();
1279
1357
  };
1280
1358
  /** Runs the next queued item once the app is idle, including queued slash commands. */
1281
1359
  const drainQueue = useCallback(() => {
@@ -1333,7 +1411,6 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
1333
1411
  if (configCreated) {
1334
1412
  addNotice('info', `Created config template at ${configPath}. Set your endpoint, model, and API key.`);
1335
1413
  }
1336
- void loadPromptHistory(cwd).then(setPromptHistory);
1337
1414
  const active = config.profiles[config.activeProfile];
1338
1415
  if (active) {
1339
1416
  if (active.type !== 'openai') {
@@ -1351,6 +1428,10 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
1351
1428
  // Startup notices only.
1352
1429
  // eslint-disable-next-line react-hooks/exhaustive-deps
1353
1430
  }, []);
1431
+ /** History is per directory, so a resumed session reloads it. */
1432
+ useEffect(() => {
1433
+ void loadPromptHistory(cwd).then(setPromptHistory);
1434
+ }, [cwd]);
1354
1435
  useEffect(() => {
1355
1436
  if (!stdout.isTTY)
1356
1437
  return;
@@ -1362,8 +1443,12 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
1362
1443
  }, [stdout, mouseOn]);
1363
1444
  useInput((input, key) => {
1364
1445
  if (key.ctrl && input === 'o') {
1365
- if (wizardActiveRef.current || wizardPromptRef.current || pendingApprovalRef.current)
1446
+ if (wizardActiveRef.current ||
1447
+ wizardPromptRef.current ||
1448
+ pendingApprovalRef.current ||
1449
+ pendingQuestionRef.current) {
1366
1450
  return;
1451
+ }
1367
1452
  if (pickerOpen || sessionPicker !== null)
1368
1453
  return;
1369
1454
  expandLastToolOutput();
@@ -1386,11 +1471,12 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
1386
1471
  cancelWizard();
1387
1472
  return;
1388
1473
  }
1389
- if (pendingApprovalRef.current) {
1474
+ if (pendingApprovalRef.current || pendingQuestionRef.current) {
1390
1475
  disarmQuit();
1391
1476
  cancelRequestedRef.current = true;
1392
1477
  setCancelling(true);
1393
1478
  resolveApproval('deny');
1479
+ resolveQuestion({ selected: [], cancelled: true });
1394
1480
  abortRef.current?.abort();
1395
1481
  return;
1396
1482
  }
@@ -1411,45 +1497,59 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
1411
1497
  }
1412
1498
  armQuit();
1413
1499
  });
1414
- const activity = pendingApproval
1415
- ? 'approval'
1416
- : cancelling
1417
- ? 'cancelling'
1418
- : busy
1419
- ? activeTool
1420
- ? 'running'
1421
- : replying
1422
- ? 'replying'
1423
- : 'thinking'
1424
- : null;
1500
+ const activity = pendingQuestion
1501
+ ? 'question'
1502
+ : pendingApproval
1503
+ ? 'approval'
1504
+ : cancelling
1505
+ ? 'cancelling'
1506
+ : busy
1507
+ ? activeTool
1508
+ ? 'running'
1509
+ : replying
1510
+ ? 'replying'
1511
+ : 'thinking'
1512
+ : null;
1425
1513
  const activeProfile = runtimeConfig.profiles[profileName];
1426
1514
  const contextWindow = contextWindowFor(activeProfile);
1515
+ const questionPopup = pendingQuestion !== null && !pendingApproval ? pickerPopupRect(columns, rows) : null;
1516
+ const questionInline = pendingQuestion !== null && !pendingApproval && questionPopup === null;
1427
1517
  const pickerPopup = (pickerOpen || sessionPicker !== null) && !pendingApproval
1428
1518
  ? pickerPopupRect(columns, rows)
1429
1519
  : null;
1430
1520
  const pickerInline = pickerOpen && !pendingApproval && pickerPopup === null;
1431
1521
  const sessionInline = sessionPicker !== null && !pendingApproval && pickerPopup === null && !pickerOpen;
1432
- const extraInputRows = pendingApproval || pickerInline || sessionInline ? 0 : Math.max(0, inputRows - 1);
1522
+ const extraInputRows = pendingApproval || questionInline || pickerInline || sessionInline
1523
+ ? 0
1524
+ : Math.max(0, inputRows - 1);
1433
1525
  const viewportHeight = Math.max(3, rows -
1434
1526
  5 -
1435
1527
  extraInputRows -
1436
1528
  (pendingApproval ? 12 : 0) -
1529
+ (questionInline ? ASK_INLINE_ROWS : 0) -
1437
1530
  (pickerInline ? PICKER_INLINE_ROWS : 0) -
1438
1531
  (sessionInline ? SESSION_INLINE_ROWS : 0));
1439
1532
  const showUsageCard = usageCardEnabled && shouldShowUsageCard(columns, viewportHeight);
1440
1533
  const chatWidth = showUsageCard ? Math.max(40, width - USAGE_CARD_WIDTH - USAGE_CARD_GAP) : width;
1441
- return (_jsxs(Box, { flexDirection: "column", width: columns, paddingX: 1, children: [_jsxs(Box, { flexDirection: "row", alignItems: "flex-end", width: width, children: [_jsx(MessageList, { items: items, width: chatWidth, height: viewportHeight, resetSignal: resetSignal, expandedToolId: expandedToolId, palette: palette, interactive: !pendingApproval && !pickerOpen && sessionPicker === null && !wizardActive && wizardPrompt === null }), showUsageCard ? (_jsx(Box, { marginLeft: USAGE_CARD_GAP, flexShrink: 0, children: _jsx(UsageCard, { usage: sessionUsage, contextTokens: contextTokens, contextWindow: contextWindow, contextEstimated: usageRef.current === null, lastReply: lastReply, busy: busy }) })) : null] }), pendingApproval ? (_jsx(ApprovalPrompt, { request: pendingApproval, width: width, onDecision: resolveApproval })) : pickerInline ? (_jsx(ModelPicker, { config: runtimeConfig, activeProfile: profileName, width: width, onSelect: (name, model) => void selectModel(name, model), onRefresh: refreshProfileModels, onCancel: () => setPickerOpen(false) })) : sessionInline && sessionPicker ? (_jsx(SessionPicker, { cwd: cwd, data: sessionPicker, activeSessionId: sessionRef.current?.id ?? null, width: width, onSelect: handleSessionPick, onCancel: () => setSessionPicker(null) })) : (_jsx(Input, { disabled: pickerOpen || sessionPicker !== null, width: width, mask: wizardPrompt?.mask, allowEmpty: wizardPrompt?.allowEmpty, fileMenu: !wizardActive && !wizardPrompt, loadFiles: loadFileIndex, maxRows: Math.max(1, Math.min(6, rows - 9)), history: wizardPrompt || wizardActive ? undefined : promptHistory, slashCommands: [...SLASH_COMMANDS, ...skillCommands], onPaletteChange: setPalette, onHeightChange: setInputRows, placeholder: pickerOpen
1534
+ return (_jsxs(Box, { flexDirection: "column", width: columns, paddingX: 1, children: [_jsxs(Box, { flexDirection: "row", alignItems: "flex-end", width: width, children: [_jsx(MessageList, { items: items, width: chatWidth, height: viewportHeight, resetSignal: resetSignal, expandedToolId: expandedToolId, palette: palette, interactive: !pendingApproval &&
1535
+ pendingQuestion === null &&
1536
+ !pickerOpen &&
1537
+ sessionPicker === null &&
1538
+ !wizardActive &&
1539
+ wizardPrompt === null }), showUsageCard ? (_jsx(Box, { marginLeft: USAGE_CARD_GAP, flexShrink: 0, children: _jsx(UsageCard, { usage: sessionUsage, contextTokens: contextTokens, contextWindow: contextWindow, contextEstimated: usageRef.current === null, lastReply: lastReply, busy: busy }) })) : null] }), pendingApproval ? (_jsx(ApprovalPrompt, { request: pendingApproval, width: width, onDecision: resolveApproval })) : questionInline && pendingQuestion ? (_jsx(AskUserPrompt, { request: pendingQuestion, width: width, onAnswer: resolveQuestion, onCancel: () => resolveQuestion({ selected: [], cancelled: true }) })) : pickerInline ? (_jsx(ModelPicker, { config: runtimeConfig, activeProfile: profileName, width: width, onSelect: (name, model) => void selectModel(name, model), onRefresh: refreshProfileModels, onCancel: () => setPickerOpen(false) })) : sessionInline && sessionPicker ? (_jsx(SessionPicker, { cwd: cwd, data: sessionPicker, activeSessionId: sessionRef.current?.id ?? null, width: width, onSelect: handleSessionPick, onCancel: () => setSessionPicker(null) })) : (_jsx(Input, { disabled: pickerOpen || sessionPicker !== null || pendingQuestion !== null, width: width, mask: wizardPrompt?.mask, allowEmpty: wizardPrompt?.allowEmpty, fileMenu: !wizardActive && !wizardPrompt, loadFiles: loadFileIndex, maxRows: Math.max(1, Math.min(6, rows - 9)), history: wizardPrompt || wizardActive ? undefined : promptHistory, slashCommands: [...SLASH_COMMANDS, ...skillCommands], onPaletteChange: setPalette, onHeightChange: setInputRows, placeholder: pickerOpen
1442
1540
  ? 'Model picker open · Esc to close'
1443
1541
  : sessionPicker
1444
1542
  ? 'Session picker open · Esc to close'
1445
- : wizardPrompt
1446
- ? wizardPrompt.defaultValue && !wizardPrompt.mask
1447
- ? `${wizardPrompt.label} [${wizardPrompt.defaultValue}]`
1448
- : wizardPrompt.label
1449
- : busy
1450
- ? 'Kiro is working… type ahead, or Ctrl+C to cancel'
1451
- : wizardActive
1452
- ? 'Working… Esc to cancel'
1453
- : 'Ask Kiro to build or change something…', slashMenu: !wizardActive && !wizardPrompt, 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, quitHint: quitArmed, contextTokens: showUsageCard ? undefined : contextTokens, contextWindow: showUsageCard ? undefined : contextWindow }), pickerOpen && pickerPopup ? (_jsx(Box, { position: "absolute", marginTop: pickerPopup.top, marginLeft: pickerPopup.left, children: _jsx(ModelPicker, { config: runtimeConfig, activeProfile: profileName, width: pickerPopup.width, height: pickerPopup.height, onSelect: (name, model) => void selectModel(name, model), onRefresh: refreshProfileModels, onCancel: () => setPickerOpen(false) }) })) : sessionPicker && pickerPopup ? (_jsx(Box, { position: "absolute", marginTop: pickerPopup.top, marginLeft: pickerPopup.left, children: _jsx(SessionPicker, { cwd: cwd, data: sessionPicker, activeSessionId: sessionRef.current?.id ?? null, width: pickerPopup.width, height: pickerPopup.height, onSelect: handleSessionPick, onCancel: () => setSessionPicker(null) }) })) : null] }));
1543
+ : pendingQuestion
1544
+ ? 'Answer the question above · Esc to cancel'
1545
+ : wizardPrompt
1546
+ ? wizardPrompt.defaultValue && !wizardPrompt.mask
1547
+ ? `${wizardPrompt.label} [${wizardPrompt.defaultValue}]`
1548
+ : wizardPrompt.label
1549
+ : busy
1550
+ ? 'Kiro is working… type ahead, or Ctrl+C to cancel'
1551
+ : wizardActive
1552
+ ? 'Working… Esc to cancel'
1553
+ : 'Ask Kiro to build or change something…', slashMenu: !wizardActive && !wizardPrompt, 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, quitHint: quitArmed, contextTokens: showUsageCard ? undefined : contextTokens, contextWindow: showUsageCard ? undefined : contextWindow }), pendingQuestion && questionPopup ? (_jsx(Box, { position: "absolute", marginTop: questionPopup.top, marginLeft: questionPopup.left, children: _jsx(AskUserPrompt, { request: pendingQuestion, width: questionPopup.width, height: questionPopup.height, onAnswer: resolveQuestion, onCancel: () => resolveQuestion({ selected: [], cancelled: true }) }) })) : pickerOpen && pickerPopup ? (_jsx(Box, { position: "absolute", marginTop: pickerPopup.top, marginLeft: pickerPopup.left, children: _jsx(ModelPicker, { config: runtimeConfig, activeProfile: profileName, width: pickerPopup.width, height: pickerPopup.height, onSelect: (name, model) => void selectModel(name, model), onRefresh: refreshProfileModels, onCancel: () => setPickerOpen(false) }) })) : sessionPicker && pickerPopup ? (_jsx(Box, { position: "absolute", marginTop: pickerPopup.top, marginLeft: pickerPopup.left, children: _jsx(SessionPicker, { cwd: cwd, data: sessionPicker, activeSessionId: sessionRef.current?.id ?? null, width: pickerPopup.width, height: pickerPopup.height, onSelect: handleSessionPick, onCancel: () => setSessionPicker(null) }) })) : null] }));
1454
1554
  }
1455
1555
  //# sourceMappingURL=App.js.map
@@ -0,0 +1,130 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { Box, Text, useInput } from 'ink';
4
+ import { sanitizeText, truncateToWidth, wrapPlain } from './text.js';
5
+ /** Keys are highlighted so the hint reads at a glance; the rest stays dim. */
6
+ const KEY_COLOR = '#ff9e64';
7
+ const MAX_QUESTION_LINES = 3;
8
+ function Key({ children }) {
9
+ return _jsx(Text, { color: KEY_COLOR, children: children });
10
+ }
11
+ function Said({ children }) {
12
+ return _jsx(Text, { dimColor: true, children: children });
13
+ }
14
+ /**
15
+ * Blocking question with a short choice list. Enter picks (or submits the
16
+ * checked set), Space toggles in multi-select mode, and typing jumps to the
17
+ * free-form "Other" row when the request allows it.
18
+ */
19
+ export function AskUserPrompt({ request, width, height, onAnswer, onCancel, }) {
20
+ const [index, setIndex] = useState(0);
21
+ const [checked, setChecked] = useState(new Set());
22
+ const [editing, setEditing] = useState(false);
23
+ const [draft, setDraft] = useState('');
24
+ const rows = request.options.length + (request.allowOther ? 1 : 0);
25
+ const selected = Math.min(index, Math.max(0, rows - 1));
26
+ const otherIndex = request.allowOther ? request.options.length : -1;
27
+ const popup = height !== undefined;
28
+ const base = popup ? 'white' : undefined;
29
+ const submit = (labels, other) => {
30
+ if (labels.length === 0 && !other?.trim())
31
+ return;
32
+ onAnswer({ selected: labels, other: other?.trim() || undefined, cancelled: false });
33
+ };
34
+ useInput((input, key) => {
35
+ if (editing) {
36
+ if (key.escape) {
37
+ setEditing(false);
38
+ setDraft('');
39
+ return;
40
+ }
41
+ if (key.return) {
42
+ submit([...checked], draft);
43
+ return;
44
+ }
45
+ if (key.backspace || key.delete) {
46
+ setDraft(draft.slice(0, -1));
47
+ return;
48
+ }
49
+ if (key.ctrl || key.meta || key.tab || key.upArrow || key.downArrow || key.pageUp || key.pageDown) {
50
+ return;
51
+ }
52
+ const typed = input.replace(/[\u0000-\u001f\u007f]/g, '');
53
+ if (typed)
54
+ setDraft(draft + typed);
55
+ return;
56
+ }
57
+ if (key.escape) {
58
+ onCancel();
59
+ return;
60
+ }
61
+ if (key.upArrow || key.downArrow) {
62
+ if (rows === 0)
63
+ return;
64
+ const delta = key.upArrow ? -1 : 1;
65
+ setIndex(Math.min(rows - 1, Math.max(0, selected + delta)));
66
+ return;
67
+ }
68
+ if (key.home) {
69
+ setIndex(0);
70
+ return;
71
+ }
72
+ if (key.end) {
73
+ setIndex(Math.max(0, rows - 1));
74
+ return;
75
+ }
76
+ if (input === ' ' && request.multiSelect && selected !== otherIndex) {
77
+ const label = request.options[selected]?.label;
78
+ if (!label)
79
+ return;
80
+ const next = new Set(checked);
81
+ if (next.has(label))
82
+ next.delete(label);
83
+ else
84
+ next.add(label);
85
+ setChecked(next);
86
+ return;
87
+ }
88
+ if (!key.return) {
89
+ if (!request.allowOther || key.ctrl || key.meta || key.tab)
90
+ return;
91
+ const typed = input.replace(/[\u0000-\u001f\u007f]/g, '');
92
+ if (!typed)
93
+ return;
94
+ setIndex(otherIndex);
95
+ setEditing(true);
96
+ setDraft(typed);
97
+ return;
98
+ }
99
+ if (selected === otherIndex) {
100
+ setEditing(true);
101
+ return;
102
+ }
103
+ const option = request.options[selected];
104
+ if (!option)
105
+ return;
106
+ if (!request.multiSelect) {
107
+ submit([option.label]);
108
+ return;
109
+ }
110
+ const labels = new Set(checked);
111
+ if (labels.size === 0)
112
+ labels.add(option.label);
113
+ submit([...labels]);
114
+ });
115
+ const innerWidth = Math.max(10, width - 4);
116
+ const questionLines = wrapPlain(sanitizeText(request.question), innerWidth);
117
+ const clipped = questionLines.slice(0, MAX_QUESTION_LINES);
118
+ if (questionLines.length > MAX_QUESTION_LINES) {
119
+ const last = clipped.length - 1;
120
+ clipped[last] = `${truncateToWidth(clipped[last] ?? '', innerWidth - 2)} …`;
121
+ }
122
+ const title = `? ${request.header ?? 'Question'}`;
123
+ return (_jsxs(Box, { flexDirection: "column", width: width, height: height, borderStyle: "round", borderColor: "magenta", paddingX: 1, flexShrink: 0, backgroundColor: popup ? 'black' : undefined, overflow: height === undefined ? undefined : 'hidden', children: [_jsx(Text, { bold: true, color: "magenta", wrap: "truncate-end", children: title }), clipped.map((line, lineIndex) => (_jsx(Text, { color: base, wrap: "truncate-end", children: line || ' ' }, `q${lineIndex}`))), request.options.map((option, optionIndex) => {
124
+ const focused = optionIndex === selected;
125
+ const mark = request.multiSelect ? (checked.has(option.label) ? '[x]' : '[ ]') : ' ';
126
+ return (_jsxs(Text, { color: focused ? 'magenta' : base, bold: focused, wrap: "truncate-end", children: [`${focused ? '>' : ' '} ${mark} ${optionIndex + 1}. ${option.label}`, option.description ? _jsx(Said, { children: ` ${option.description}` }) : null] }, `o${optionIndex}`));
127
+ }), request.allowOther ? (_jsxs(Text, { color: selected === otherIndex ? 'magenta' : base, bold: selected === otherIndex, children: [`${selected === otherIndex ? '>' : ' '}${request.multiSelect ? ' ' : ' '}` +
128
+ `${request.options.length + 1}. Other: `, editing ? (_jsx(Text, { color: base, children: `${draft || ''}▌` })) : (_jsx(Said, { children: "type an answer" }))] })) : null, height === undefined ? null : _jsx(Box, { flexGrow: 1 }), editing ? (_jsxs(Text, { color: base, wrap: "truncate-end", children: [_jsx(Key, { children: "Enter" }), _jsx(Said, { children: " submit \u00B7 type your answer \u00B7 " }), _jsx(Key, { children: "Esc" }), _jsx(Said, { children: " back" })] })) : (_jsxs(Text, { color: base, wrap: "truncate-end", children: [_jsx(Key, { children: "\u2191/\u2193" }), _jsx(Said, { children: " move \u00B7 " }), request.multiSelect ? (_jsxs(_Fragment, { children: [_jsx(Key, { children: "Space" }), _jsx(Said, { children: " toggle \u00B7 " }), _jsx(Key, { children: "Enter" }), _jsx(Said, { children: " submit \u00B7 " })] })) : (_jsxs(_Fragment, { children: [_jsx(Key, { children: "Enter" }), _jsx(Said, { children: " choose \u00B7 " })] })), _jsx(Key, { children: "Esc" }), _jsx(Said, { children: " cancel" })] }))] }));
129
+ }
130
+ //# sourceMappingURL=AskUserPrompt.js.map
@@ -107,6 +107,6 @@ export function SessionPicker({ cwd, data, activeSessionId = null, width, maxRow
107
107
  }
108
108
  const focused = line === selectedLine;
109
109
  return (_jsx(Text, { color: focused ? 'cyan' : base, bold: focused, wrap: "truncate-end", children: sessionRowText(row.session, row.session.id === activeSessionId) }, `s${line}`));
110
- }), empty ? (_jsx(Text, { dimColor: true, color: base, wrap: "truncate-end", children: empty })) : null, scope === 'others' ? (_jsx(Text, { dimColor: true, color: base, wrap: "truncate-end", children: "Enter shows the directory to resume from." })) : null, range ? (_jsx(Text, { dimColor: true, color: base, wrap: "truncate-end", children: pickerRangeLabel(range) })) : null, height === undefined ? null : _jsx(Box, { flexGrow: 1 }), _jsxs(Text, { color: base, wrap: "truncate-end", children: [_jsx(Key, { children: "\u2190/\u2192" }), _jsx(Said, { children: " tab \u00B7 " }), _jsx(Key, { children: "\u2191/\u2193" }), _jsx(Said, { children: " move \u00B7 " }), _jsx(Key, { children: "Enter" }), _jsx(Said, { children: " resume \u00B7 " }), _jsx(Key, { children: "Esc" }), _jsx(Said, { children: ` ${query ? 'clear search' : 'close'}` })] })] }));
110
+ }), empty ? (_jsx(Text, { dimColor: true, color: base, wrap: "truncate-end", children: empty })) : null, scope === 'others' ? (_jsx(Text, { dimColor: true, color: base, wrap: "truncate-end", children: "Enter resumes and switches to that directory." })) : null, range ? (_jsx(Text, { dimColor: true, color: base, wrap: "truncate-end", children: pickerRangeLabel(range) })) : null, height === undefined ? null : _jsx(Box, { flexGrow: 1 }), _jsxs(Text, { color: base, wrap: "truncate-end", children: [_jsx(Key, { children: "\u2190/\u2192" }), _jsx(Said, { children: " tab \u00B7 " }), _jsx(Key, { children: "\u2191/\u2193" }), _jsx(Said, { children: " move \u00B7 " }), _jsx(Key, { children: "Enter" }), _jsx(Said, { children: " resume \u00B7 " }), _jsx(Key, { children: "Esc" }), _jsx(Said, { children: ` ${query ? 'clear search' : 'close'}` })] })] }));
111
111
  }
112
112
  //# sourceMappingURL=SessionPicker.js.map
@@ -27,15 +27,17 @@ export function StatusBar({ width, profile, model, cwd, activity, toolName, busy
27
27
  ? 'Ctrl+C again to quit'
28
28
  : activity === 'approval'
29
29
  ? 'approval needed'
30
- : activity === 'cancelling'
31
- ? 'cancelling…'
32
- : activity === 'running'
33
- ? `running ${toolName ?? 'tool'}…`
34
- : activity === 'replying'
35
- ? 'replying…'
36
- : activity === 'thinking'
37
- ? 'thinking…'
38
- : 'ready';
30
+ : activity === 'question'
31
+ ? 'answer needed'
32
+ : activity === 'cancelling'
33
+ ? 'cancelling…'
34
+ : activity === 'running'
35
+ ? `running ${toolName ?? 'tool'}…`
36
+ : activity === 'replying'
37
+ ? 'replying…'
38
+ : activity === 'thinking'
39
+ ? 'thinking…'
40
+ : 'ready';
39
41
  const stateColor = quitHint
40
42
  ? 'red'
41
43
  : activity === 'cancelling'
package/dist/ui/text.js CHANGED
@@ -473,6 +473,8 @@ export function summarizeToolArgs(name, rawArguments) {
473
473
  const command = typeof args.command === 'string' ? args.command : '';
474
474
  return `$ ${sanitizeInput(command)}`;
475
475
  }
476
+ case 'ask_user':
477
+ return typeof args.question === 'string' ? args.question : '?';
476
478
  default:
477
479
  return truncateToWidth(sanitizeInput(rawArguments), 80);
478
480
  }
package/dist/version.js CHANGED
@@ -1,2 +1,5 @@
1
- export const VERSION = '0.3.0';
1
+ import { createRequire } from 'node:module';
2
+ /** Single source of truth: the version npm publishes, read at runtime from package.json. */
3
+ const { version } = createRequire(import.meta.url)('../package.json');
4
+ export const VERSION = version;
2
5
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ywldan/kiro",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "A small terminal coding agent with your own OpenAI-compatible endpoint",
5
5
  "keywords": [
6
6
  "ai",