@jun133/kitty 0.0.13 → 0.0.14

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,16 +7,16 @@ import {
7
7
  mirrorProcessOutputToTerminalLog,
8
8
  renderKittyBanner,
9
9
  ui
10
- } from "./chunk-6WGSABUQ.mjs";
10
+ } from "./chunk-KKGULDIF.mjs";
11
11
  import "./chunk-4BN45TQG.mjs";
12
12
  import {
13
13
  createRuntimeUiAgentCallbacks
14
- } from "./chunk-DWGFLIQA.mjs";
14
+ } from "./chunk-VR3L2EPP.mjs";
15
15
  import {
16
16
  colorRuntimeUiText,
17
17
  loadProjectContext,
18
18
  writeStdout
19
- } from "./chunk-MMIH75OY.mjs";
19
+ } from "./chunk-KROQCOWD.mjs";
20
20
  import "./chunk-3KMC6H5K.mjs";
21
21
 
22
22
  // src/shell/cli/intro.ts
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createRuntimeUiAgentCallbacks
3
- } from "./chunk-DWGFLIQA.mjs";
3
+ } from "./chunk-VR3L2EPP.mjs";
4
4
  import {
5
5
  runHostTurn
6
- } from "./chunk-MMIH75OY.mjs";
6
+ } from "./chunk-KROQCOWD.mjs";
7
7
  import "./chunk-3KMC6H5K.mjs";
8
8
 
9
9
  // src/cli/oneShot.ts
package/dist/tui.mjs CHANGED
@@ -7,11 +7,14 @@ import {
7
7
  mirrorInteractionShellToTerminalLog,
8
8
  parseSessionPickerChoice,
9
9
  renderKittyBanner
10
- } from "./chunk-6WGSABUQ.mjs";
10
+ } from "./chunk-KKGULDIF.mjs";
11
11
  import "./chunk-4BN45TQG.mjs";
12
12
  import {
13
- loadProjectContext
14
- } from "./chunk-MMIH75OY.mjs";
13
+ buildToolCallDisplay,
14
+ buildToolResultDisplay,
15
+ loadProjectContext,
16
+ tryParseJson
17
+ } from "./chunk-KROQCOWD.mjs";
15
18
  import "./chunk-3KMC6H5K.mjs";
16
19
  import {
17
20
  TUI_COLORS,
@@ -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";
@@ -341,31 +344,83 @@ var TuiController = class {
341
344
  }
342
345
  };
343
346
 
347
+ // src/shell/tui/toolFacts.ts
348
+ function projectTuiToolCallFact(name, rawArgs) {
349
+ const current = buildToolCallDisplay(name, rawArgs, 240).summary;
350
+ return {
351
+ current,
352
+ ...projectLiveExecutionFact(name, current)
353
+ };
354
+ }
355
+ function projectTuiToolResultFact(name, rawOutput) {
356
+ const display = buildToolResultDisplay(name, rawOutput);
357
+ const runningSummary = readRunningSummary(name, rawOutput, display.summary);
358
+ return {
359
+ current: void 0,
360
+ ...projectLiveExecutionFact(name, runningSummary),
361
+ transcript: name === "todo_write" ? display.preview : void 0
362
+ };
363
+ }
364
+ function projectTuiToolErrorFact(name, error) {
365
+ const current = `${name}: ${shorten(error)}`;
366
+ return {
367
+ current,
368
+ ...projectLiveExecutionFact(name, current)
369
+ };
370
+ }
371
+ function projectLiveExecutionFact(name, value) {
372
+ const normalized = name.toLowerCase();
373
+ if (normalized.includes("background")) {
374
+ return { background: value };
375
+ }
376
+ if (normalized.includes("subagent")) {
377
+ return { subagent: value };
378
+ }
379
+ return {};
380
+ }
381
+ function readRunningSummary(name, rawOutput, fallback) {
382
+ const parsed = tryParseJson(rawOutput);
383
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
384
+ return void 0;
385
+ }
386
+ const status = parsed.status;
387
+ if (status === "running" || status === "created") {
388
+ return `${fallback} ${status}`;
389
+ }
390
+ if (name === "background_run" || name === "subagent_launch") {
391
+ return void 0;
392
+ }
393
+ return void 0;
394
+ }
395
+ function shorten(value) {
396
+ const normalized = value.replace(/\s+/g, " ").trim();
397
+ if (normalized.length <= 80) {
398
+ return normalized;
399
+ }
400
+ return `${normalized.slice(0, 77)}...`;
401
+ }
402
+
344
403
  // src/shell/tui/turnDisplay.ts
345
404
  function createTuiTurnDisplay(options) {
346
405
  let aborted = false;
347
406
  const isAborted = () => aborted || options.abortSignal.aborted;
348
- const updateWork = (active, label, detail) => {
407
+ const updateCurrent = (current) => {
349
408
  if (!isAborted()) {
350
409
  options.controller.updateDock({
351
- work: {
352
- active,
353
- label,
354
- detail
355
- }
410
+ current
356
411
  });
357
412
  }
358
413
  };
359
414
  options.abortSignal.addEventListener("abort", () => {
360
415
  aborted = true;
361
- updateWork(false, "\u5DF2\u4E2D\u65AD", "\u5F53\u524D\u8F6E\u5DF2\u4E2D\u65AD");
416
+ updateCurrent(void 0);
362
417
  });
363
418
  const callbacks = {
364
419
  onModelWaitStart() {
365
- updateWork(true, "\u601D\u8003\u4E2D", "\u7B49\u5F85\u6A21\u578B\u56DE\u590D");
420
+ updateCurrent("\u601D\u8003\u4E2D");
366
421
  },
367
422
  onModelWaitStop() {
368
- updateWork(false, "\u7A7A\u95F2", "\u6A21\u578B\u7B49\u5F85\u7ED3\u675F");
423
+ updateCurrent(void 0);
369
424
  },
370
425
  onReasoningDelta(delta) {
371
426
  if (options.config.showReasoning && !isAborted()) {
@@ -393,49 +448,31 @@ function createTuiTurnDisplay(options) {
393
448
  }
394
449
  },
395
450
  onAssistantDone() {
396
- updateWork(false, "\u7A7A\u95F2", "\u56DE\u590D\u5B8C\u6210");
451
+ updateCurrent(void 0);
397
452
  },
398
- onToolCall(name) {
453
+ onToolCall(name, args) {
399
454
  if (isAborted()) {
400
455
  return;
401
456
  }
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
- });
457
+ const fact = projectTuiToolCallFact(name, args);
458
+ options.controller.updateDock(toDockPatch(fact));
411
459
  },
412
- onToolResult(name) {
460
+ onToolResult(name, output) {
413
461
  if (isAborted()) {
414
462
  return;
415
463
  }
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
- });
464
+ const fact = projectTuiToolResultFact(name, output);
465
+ options.controller.updateDock(toDockPatch(fact));
466
+ if (fact.transcript) {
467
+ options.controller.append("system", fact.transcript);
468
+ }
425
469
  },
426
470
  onToolError(name, error) {
427
471
  if (isAborted()) {
428
472
  return;
429
473
  }
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
- });
474
+ const fact = projectTuiToolErrorFact(name, error);
475
+ options.controller.updateDock(toDockPatch(fact));
439
476
  options.controller.append("system", `\u5DE5\u5177\u5931\u8D25\uFF1A${name}`);
440
477
  },
441
478
  onStatus(text) {
@@ -443,11 +480,7 @@ function createTuiTurnDisplay(options) {
443
480
  return;
444
481
  }
445
482
  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
- }
483
+ current: text.trim() || void 0
451
484
  });
452
485
  }
453
486
  };
@@ -455,40 +488,27 @@ function createTuiTurnDisplay(options) {
455
488
  callbacks,
456
489
  flush() {
457
490
  options.controller.updateDock({
458
- work: {
459
- active: false,
460
- label: "\u7A7A\u95F2",
461
- detail: "\u5F53\u524D\u8F6E\u5DF2\u6536\u53E3"
462
- }
491
+ current: void 0
463
492
  });
464
493
  },
465
494
  dispose() {
466
495
  options.controller.updateDock({
467
- work: {
468
- active: false,
469
- label: "\u7A7A\u95F2",
470
- detail: "\u6CA1\u6709\u4EFB\u52A1\u6B63\u5728\u6267\u884C"
471
- }
496
+ current: void 0
472
497
  });
473
498
  }
474
499
  };
475
500
  }
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}` };
501
+ function toDockPatch(fact) {
502
+ const patch = {
503
+ current: fact.current
504
+ };
505
+ if ("background" in fact) {
506
+ patch.background = fact.background;
483
507
  }
484
- return {};
485
- }
486
- function shorten(value) {
487
- const normalized = value.replace(/\s+/g, " ").trim();
488
- if (normalized.length <= 80) {
489
- return normalized;
508
+ if ("subagent" in fact) {
509
+ patch.subagent = fact.subagent;
490
510
  }
491
- return `${normalized.slice(0, 77)}...`;
511
+ return patch;
492
512
  }
493
513
 
494
514
  // src/shell/tui/shell.ts
@@ -528,23 +548,9 @@ function createTuiOutputPort(controller) {
528
548
  },
529
549
  warn(text) {
530
550
  controller.appendOutput(text, "system");
531
- controller.updateDock({
532
- work: {
533
- active: false,
534
- label: "\u63D0\u9192",
535
- detail: text
536
- }
537
- });
538
551
  },
539
552
  error(text) {
540
553
  controller.appendOutput(text, "system");
541
- controller.updateDock({
542
- work: {
543
- active: false,
544
- label: "\u9519\u8BEF",
545
- detail: text
546
- }
547
- });
548
554
  },
549
555
  dim(text) {
550
556
  controller.appendOutput(text, "system");
@@ -554,13 +560,6 @@ function createTuiOutputPort(controller) {
554
560
  },
555
561
  interrupt(text) {
556
562
  controller.appendOutput(text, "system");
557
- controller.updateDock({
558
- work: {
559
- active: false,
560
- label: "\u4E2D\u65AD",
561
- detail: text
562
- }
563
- });
564
563
  }
565
564
  };
566
565
  }
@@ -739,7 +738,7 @@ async function startTuiChat(options) {
739
738
  const [{ default: React }, ink, { createTuiAppComponent }] = await Promise.all([
740
739
  import("react"),
741
740
  import("ink"),
742
- import("./App-V6SLDWQH.mjs")
741
+ import("./App-CBTIS4IK.mjs")
743
742
  ]);
744
743
  const selected = await selectTuiSession({
745
744
  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.14",
4
4
  "description": "Agent",
5
5
  "license": "MIT",
6
6
  "keywords": [