@jun133/kitty 0.0.13 → 0.0.15

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.
@@ -7,17 +7,17 @@ import {
7
7
  mirrorProcessOutputToTerminalLog,
8
8
  renderKittyBanner,
9
9
  ui
10
- } from "./chunk-6WGSABUQ.mjs";
11
- import "./chunk-4BN45TQG.mjs";
10
+ } from "./chunk-WIKLME2V.mjs";
11
+ import "./chunk-KUP5OMPB.mjs";
12
12
  import {
13
13
  createRuntimeUiAgentCallbacks
14
- } from "./chunk-DWGFLIQA.mjs";
14
+ } from "./chunk-AQEMM5VH.mjs";
15
15
  import {
16
16
  colorRuntimeUiText,
17
17
  loadProjectContext,
18
18
  writeStdout
19
- } from "./chunk-MMIH75OY.mjs";
20
- import "./chunk-3KMC6H5K.mjs";
19
+ } from "./chunk-7FDXKNTM.mjs";
20
+ import "./chunk-S4QTRPZ7.mjs";
21
21
 
22
22
  // src/shell/cli/intro.ts
23
23
  import chalk from "chalk";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createRuntimeUiAgentCallbacks
3
- } from "./chunk-DWGFLIQA.mjs";
3
+ } from "./chunk-AQEMM5VH.mjs";
4
4
  import {
5
5
  runHostTurn
6
- } from "./chunk-MMIH75OY.mjs";
7
- import "./chunk-3KMC6H5K.mjs";
6
+ } from "./chunk-7FDXKNTM.mjs";
7
+ import "./chunk-S4QTRPZ7.mjs";
8
8
 
9
9
  // src/cli/oneShot.ts
10
10
  async function runOneShotPrompt(prompt, cwd, config, session, sessionStore, options = {}) {
@@ -2,7 +2,7 @@ import {
2
2
  InProcessSessionStore,
3
3
  SessionStore,
4
4
  createSessionRecord
5
- } from "./chunk-4BN45TQG.mjs";
5
+ } from "./chunk-KUP5OMPB.mjs";
6
6
  import {
7
7
  applyCurrentTurnFrame,
8
8
  buildChatMessages,
@@ -31,7 +31,7 @@ import {
31
31
  shouldIncludeStoredAssistantReasoning,
32
32
  sliceCurrentUserInputFrame,
33
33
  toChatMessage
34
- } from "./chunk-3KMC6H5K.mjs";
34
+ } from "./chunk-S4QTRPZ7.mjs";
35
35
  export {
36
36
  InProcessSessionStore,
37
37
  SessionStore,
package/dist/tui.mjs CHANGED
@@ -7,12 +7,15 @@ import {
7
7
  mirrorInteractionShellToTerminalLog,
8
8
  parseSessionPickerChoice,
9
9
  renderKittyBanner
10
- } from "./chunk-6WGSABUQ.mjs";
11
- import "./chunk-4BN45TQG.mjs";
10
+ } from "./chunk-WIKLME2V.mjs";
11
+ import "./chunk-KUP5OMPB.mjs";
12
12
  import {
13
- loadProjectContext
14
- } from "./chunk-MMIH75OY.mjs";
15
- import "./chunk-3KMC6H5K.mjs";
13
+ buildToolCallDisplay,
14
+ buildToolResultDisplay,
15
+ loadProjectContext,
16
+ tryParseJson
17
+ } from "./chunk-7FDXKNTM.mjs";
18
+ import "./chunk-S4QTRPZ7.mjs";
16
19
  import {
17
20
  TUI_COLORS,
18
21
  appendTranscriptEntry,
@@ -27,7 +30,7 @@ import {
27
30
  scrollTuiTranscriptToTop,
28
31
  updateComposerState,
29
32
  updateRuntimeDock
30
- } from "./chunk-4HIVDFN5.mjs";
33
+ } from "./chunk-NBKU7KA4.mjs";
31
34
 
32
35
  // src/shell/tui/input/scroll.ts
33
36
  var ENABLE_MOUSE_TRACKING = "\x1B[?1000h\x1B[?1002h\x1B[?1006h";
@@ -193,6 +196,7 @@ var TuiController = class {
193
196
  projection = new TuiTranscriptProjection();
194
197
  listeners = /* @__PURE__ */ new Set();
195
198
  pendingInput = null;
199
+ queuedInputs = [];
196
200
  interruptHandler;
197
201
  disposed = false;
198
202
  constructor(session) {
@@ -221,8 +225,12 @@ var TuiController = class {
221
225
  return this.openInput(promptLabel);
222
226
  }
223
227
  submitInput(value) {
228
+ if (this.disposed) {
229
+ return;
230
+ }
224
231
  const pending = this.pendingInput;
225
- if (!pending || this.disposed) {
232
+ if (!pending) {
233
+ this.queuedInputs.push(value);
226
234
  return;
227
235
  }
228
236
  this.pendingInput = null;
@@ -309,6 +317,7 @@ var TuiController = class {
309
317
  }
310
318
  dispose() {
311
319
  this.disposed = true;
320
+ this.queuedInputs = [];
312
321
  this.closeInput();
313
322
  this.listeners.clear();
314
323
  }
@@ -320,6 +329,10 @@ var TuiController = class {
320
329
  this.setState(updateComposerState(this.state, {
321
330
  promptLabel
322
331
  }));
332
+ const queued = this.queuedInputs.shift();
333
+ if (queued !== void 0) {
334
+ return Promise.resolve({ kind: "submit", value: queued });
335
+ }
323
336
  return new Promise((resolve) => {
324
337
  this.pendingInput = {
325
338
  resolve
@@ -341,31 +354,83 @@ var TuiController = class {
341
354
  }
342
355
  };
343
356
 
357
+ // src/shell/tui/toolFacts.ts
358
+ function projectTuiToolCallFact(name, rawArgs) {
359
+ const current = buildToolCallDisplay(name, rawArgs, 240).summary;
360
+ return {
361
+ current,
362
+ ...projectLiveExecutionFact(name, current)
363
+ };
364
+ }
365
+ function projectTuiToolResultFact(name, rawOutput) {
366
+ const display = buildToolResultDisplay(name, rawOutput);
367
+ const runningSummary = readRunningSummary(name, rawOutput, display.summary);
368
+ return {
369
+ current: void 0,
370
+ ...projectLiveExecutionFact(name, runningSummary),
371
+ transcript: name === "todo_write" ? display.preview : void 0
372
+ };
373
+ }
374
+ function projectTuiToolErrorFact(name, error) {
375
+ const current = `${name}: ${shorten(error)}`;
376
+ return {
377
+ current,
378
+ ...projectLiveExecutionFact(name, current)
379
+ };
380
+ }
381
+ function projectLiveExecutionFact(name, value) {
382
+ const normalized = name.toLowerCase();
383
+ if (normalized.includes("background")) {
384
+ return { background: value };
385
+ }
386
+ if (normalized.includes("subagent")) {
387
+ return { subagent: value };
388
+ }
389
+ return {};
390
+ }
391
+ function readRunningSummary(name, rawOutput, fallback) {
392
+ const parsed = tryParseJson(rawOutput);
393
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
394
+ return void 0;
395
+ }
396
+ const status = parsed.status;
397
+ if (status === "running" || status === "created") {
398
+ return `${fallback} ${status}`;
399
+ }
400
+ if (name === "background_run" || name === "subagent_launch") {
401
+ return void 0;
402
+ }
403
+ return void 0;
404
+ }
405
+ function shorten(value) {
406
+ const normalized = value.replace(/\s+/g, " ").trim();
407
+ if (normalized.length <= 80) {
408
+ return normalized;
409
+ }
410
+ return `${normalized.slice(0, 77)}...`;
411
+ }
412
+
344
413
  // src/shell/tui/turnDisplay.ts
345
414
  function createTuiTurnDisplay(options) {
346
415
  let aborted = false;
347
416
  const isAborted = () => aborted || options.abortSignal.aborted;
348
- const updateWork = (active, label, detail) => {
417
+ const updateCurrent = (current) => {
349
418
  if (!isAborted()) {
350
419
  options.controller.updateDock({
351
- work: {
352
- active,
353
- label,
354
- detail
355
- }
420
+ current
356
421
  });
357
422
  }
358
423
  };
359
424
  options.abortSignal.addEventListener("abort", () => {
360
425
  aborted = true;
361
- updateWork(false, "\u5DF2\u4E2D\u65AD", "\u5F53\u524D\u8F6E\u5DF2\u4E2D\u65AD");
426
+ updateCurrent(void 0);
362
427
  });
363
428
  const callbacks = {
364
429
  onModelWaitStart() {
365
- updateWork(true, "\u601D\u8003\u4E2D", "\u7B49\u5F85\u6A21\u578B\u56DE\u590D");
430
+ updateCurrent("\u601D\u8003\u4E2D");
366
431
  },
367
432
  onModelWaitStop() {
368
- updateWork(false, "\u7A7A\u95F2", "\u6A21\u578B\u7B49\u5F85\u7ED3\u675F");
433
+ updateCurrent(void 0);
369
434
  },
370
435
  onReasoningDelta(delta) {
371
436
  if (options.config.showReasoning && !isAborted()) {
@@ -393,49 +458,31 @@ function createTuiTurnDisplay(options) {
393
458
  }
394
459
  },
395
460
  onAssistantDone() {
396
- updateWork(false, "\u7A7A\u95F2", "\u56DE\u590D\u5B8C\u6210");
461
+ updateCurrent(void 0);
397
462
  },
398
- onToolCall(name) {
463
+ onToolCall(name, args) {
399
464
  if (isAborted()) {
400
465
  return;
401
466
  }
402
- const lane = classifyToolLane(name);
403
- options.controller.updateDock({
404
- work: {
405
- active: true,
406
- label: "\u6267\u884C\u5DE5\u5177",
407
- detail: name
408
- },
409
- ...lane
410
- });
467
+ const fact = projectTuiToolCallFact(name, args);
468
+ options.controller.updateDock(toDockPatch(fact));
411
469
  },
412
- onToolResult(name) {
470
+ onToolResult(name, output) {
413
471
  if (isAborted()) {
414
472
  return;
415
473
  }
416
- const lane = classifyToolLane(name, "\u5B8C\u6210");
417
- options.controller.updateDock({
418
- work: {
419
- active: false,
420
- label: "\u5DE5\u5177\u5B8C\u6210",
421
- detail: name
422
- },
423
- ...lane
424
- });
474
+ const fact = projectTuiToolResultFact(name, output);
475
+ options.controller.updateDock(toDockPatch(fact));
476
+ if (fact.transcript) {
477
+ options.controller.append("system", fact.transcript);
478
+ }
425
479
  },
426
480
  onToolError(name, error) {
427
481
  if (isAborted()) {
428
482
  return;
429
483
  }
430
- const lane = classifyToolLane(name, "\u5931\u8D25");
431
- options.controller.updateDock({
432
- work: {
433
- active: false,
434
- label: "\u5DE5\u5177\u5931\u8D25",
435
- detail: `${name}: ${shorten(error)}`
436
- },
437
- ...lane
438
- });
484
+ const fact = projectTuiToolErrorFact(name, error);
485
+ options.controller.updateDock(toDockPatch(fact));
439
486
  options.controller.append("system", `\u5DE5\u5177\u5931\u8D25\uFF1A${name}`);
440
487
  },
441
488
  onStatus(text) {
@@ -443,11 +490,7 @@ function createTuiTurnDisplay(options) {
443
490
  return;
444
491
  }
445
492
  options.controller.updateDock({
446
- work: {
447
- active: text.trim().length > 0,
448
- label: text.trim() ? "\u72B6\u6001" : "\u7A7A\u95F2",
449
- detail: text.trim() || "\u7A7A\u95F2"
450
- }
493
+ current: text.trim() || void 0
451
494
  });
452
495
  }
453
496
  };
@@ -455,40 +498,27 @@ function createTuiTurnDisplay(options) {
455
498
  callbacks,
456
499
  flush() {
457
500
  options.controller.updateDock({
458
- work: {
459
- active: false,
460
- label: "\u7A7A\u95F2",
461
- detail: "\u5F53\u524D\u8F6E\u5DF2\u6536\u53E3"
462
- }
501
+ current: void 0
463
502
  });
464
503
  },
465
504
  dispose() {
466
505
  options.controller.updateDock({
467
- work: {
468
- active: false,
469
- label: "\u7A7A\u95F2",
470
- detail: "\u6CA1\u6709\u4EFB\u52A1\u6B63\u5728\u6267\u884C"
471
- }
506
+ current: void 0
472
507
  });
473
508
  }
474
509
  };
475
510
  }
476
- function classifyToolLane(name, suffix = "\u8FD0\u884C\u4E2D") {
477
- const normalized = name.toLowerCase();
478
- if (normalized.includes("background")) {
479
- return { background: `${name} ${suffix}` };
480
- }
481
- if (normalized.includes("subagent")) {
482
- return { subagent: `${name} ${suffix}` };
511
+ function toDockPatch(fact) {
512
+ const patch = {
513
+ current: fact.current
514
+ };
515
+ if ("background" in fact) {
516
+ patch.background = fact.background;
483
517
  }
484
- return {};
485
- }
486
- function shorten(value) {
487
- const normalized = value.replace(/\s+/g, " ").trim();
488
- if (normalized.length <= 80) {
489
- return normalized;
518
+ if ("subagent" in fact) {
519
+ patch.subagent = fact.subagent;
490
520
  }
491
- return `${normalized.slice(0, 77)}...`;
521
+ return patch;
492
522
  }
493
523
 
494
524
  // src/shell/tui/shell.ts
@@ -528,23 +558,9 @@ function createTuiOutputPort(controller) {
528
558
  },
529
559
  warn(text) {
530
560
  controller.appendOutput(text, "system");
531
- controller.updateDock({
532
- work: {
533
- active: false,
534
- label: "\u63D0\u9192",
535
- detail: text
536
- }
537
- });
538
561
  },
539
562
  error(text) {
540
563
  controller.appendOutput(text, "system");
541
- controller.updateDock({
542
- work: {
543
- active: false,
544
- label: "\u9519\u8BEF",
545
- detail: text
546
- }
547
- });
548
564
  },
549
565
  dim(text) {
550
566
  controller.appendOutput(text, "system");
@@ -554,13 +570,6 @@ function createTuiOutputPort(controller) {
554
570
  },
555
571
  interrupt(text) {
556
572
  controller.appendOutput(text, "system");
557
- controller.updateDock({
558
- work: {
559
- active: false,
560
- label: "\u4E2D\u65AD",
561
- detail: text
562
- }
563
- });
564
573
  }
565
574
  };
566
575
  }
@@ -739,7 +748,7 @@ async function startTuiChat(options) {
739
748
  const [{ default: React }, ink, { createTuiAppComponent }] = await Promise.all([
740
749
  import("react"),
741
750
  import("ink"),
742
- import("./App-V6SLDWQH.mjs")
751
+ import("./App-CBTIS4IK.mjs")
743
752
  ]);
744
753
  const selected = await selectTuiSession({
745
754
  cwd: options.cwd,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jun133/kitty",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "Agent",
5
5
  "license": "MIT",
6
6
  "keywords": [