flavor-code 1.4.3-beta.2 → 1.4.4-beta.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.
Files changed (34) hide show
  1. package/README.md +27 -2
  2. package/README.zh-CN.md +27 -2
  3. package/dist/agent/loop.d.ts +1 -0
  4. package/dist/{app-G35YBHPR.js → app-C5I2TH7I.js} +399 -109
  5. package/dist/{chunk-FAJ6YDZK.js → chunk-36IDJRLQ.js} +1 -1
  6. package/dist/{chunk-HGTCIHWA.js → chunk-5BDKRA6U.js} +30 -1
  7. package/dist/{chunk-T6RE76D2.js → chunk-IKGT4MDT.js} +35 -23
  8. package/dist/{chunk-K7UGGWJV.js → chunk-JQM2L2YM.js} +1 -1
  9. package/dist/{chunk-6X62CGMA.js → chunk-ONRY3C2L.js} +3 -0
  10. package/dist/{chunk-IDJAHEG6.js → chunk-U4XTQ5PU.js} +392 -188
  11. package/dist/{chunk-SJUIIHIA.js → chunk-X6U6BO5D.js} +1 -1
  12. package/dist/{claude-ink-BE56DB6N.js → claude-ink-F554I3GJ.js} +1 -1
  13. package/dist/{cli-3MF6EL2H.js → cli-V3BLZ5UW.js} +7 -7
  14. package/dist/cli-main.js +16 -16
  15. package/dist/config/protected-file.d.ts +2 -0
  16. package/dist/config/schema.d.ts +3 -0
  17. package/dist/context/global-instructions.d.ts +12 -0
  18. package/dist/context/manager.d.ts +2 -0
  19. package/dist/desktop/main.js +660 -419
  20. package/dist/desktop-renderer/assets/{index-DCqIrF1S.js → index-CjC0Ibiq.js} +2 -2
  21. package/dist/desktop-renderer/assets/{interactive-terminal-B6GbpzIn.js → interactive-terminal-IjIT3Xoa.js} +1 -1
  22. package/dist/desktop-renderer/index.html +1 -1
  23. package/dist/{doctor-OHCGK52S.js → doctor-SEL32R7M.js} +3 -3
  24. package/dist/harness/local.d.ts +1 -0
  25. package/dist/{load-QK6CMLDF.js → load-RHWXNUCS.js} +2 -2
  26. package/dist/{manager-5SI4MPES.js → manager-IYBNNKUP.js} +2 -2
  27. package/dist/{production-6DIZ6YLQ.js → production-TD7UWWXW.js} +6 -6
  28. package/dist/production.d.ts +2 -0
  29. package/dist/sdk/index.js +6 -6
  30. package/dist/{store-ZIHN6363.js → store-MZZERW7K.js} +2 -2
  31. package/dist/ui/commands.d.ts +11 -3
  32. package/dist/ui/session.d.ts +2 -1
  33. package/package.json +1 -1
  34. package//346/212/200/346/234/257/346/226/271/346/241/210/346/212/245/345/221/212.md +649 -1
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  readRecoverableFile,
8
8
  updateProtectedFile
9
- } from "./chunk-HGTCIHWA.js";
9
+ } from "./chunk-5BDKRA6U.js";
10
10
 
11
11
  // src/utils/crash-guard.ts
12
12
  import { mkdirSync, writeFileSync } from "fs";
@@ -4,7 +4,7 @@ import {
4
4
  FlavorConfigSchema,
5
5
  ProviderConfigSchema,
6
6
  configPathSegments
7
- } from "./chunk-6X62CGMA.js";
7
+ } from "./chunk-ONRY3C2L.js";
8
8
  import {
9
9
  __commonJS,
10
10
  __require,
@@ -376,6 +376,34 @@ async function updateProtectedFile(options) {
376
376
  return next;
377
377
  }, options.lockTimeoutMs ?? LOCK_TIMEOUT_MS, options.staleLockMs ?? STALE_LOCK_MS);
378
378
  }
379
+ async function updatePlainTextFile(path, update, maxBytes) {
380
+ await mkdir(dirname(path), { recursive: true, mode: 448 });
381
+ return withFileLock(path, async () => {
382
+ const current = await readOptionalPlainText(path, maxBytes);
383
+ const next = await update(current);
384
+ if (next === void 0 || next === current) return current;
385
+ if (await readOptionalPlainText(path, maxBytes) !== current) {
386
+ throw new Error(`Text file changed while the update was prepared: ${path}`);
387
+ }
388
+ await writeAtomic(path, next, defaultFileOperations);
389
+ return next;
390
+ }, LOCK_TIMEOUT_MS, STALE_LOCK_MS);
391
+ }
392
+ async function readOptionalPlainText(path, maxBytes) {
393
+ try {
394
+ if (maxBytes !== void 0 && (await stat(path)).size > maxBytes) {
395
+ throw new Error(`Text file exceeds ${maxBytes} bytes: ${path}`);
396
+ }
397
+ const bytes = await readFile(path);
398
+ if (maxBytes !== void 0 && bytes.length > maxBytes) {
399
+ throw new Error(`Text file exceeds ${maxBytes} bytes: ${path}`);
400
+ }
401
+ return new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes);
402
+ } catch (error) {
403
+ if (isCode(error, "ENOENT")) return void 0;
404
+ throw error;
405
+ }
406
+ }
379
407
  async function withFileLock(path, operation, lockTimeoutMs, staleLockMs) {
380
408
  const lockPath = `${path}.lock`;
381
409
  const token = JSON.stringify({ pid: process.pid, nonce: randomUUID() });
@@ -919,6 +947,7 @@ function redactConfig(config) {
919
947
  export {
920
948
  readRecoverableFile,
921
949
  updateProtectedFile,
950
+ updatePlainTextFile,
922
951
  encryptDocument,
923
952
  decryptDocument,
924
953
  loadOrCreateConfigKey,
@@ -10250,7 +10250,7 @@ function layoutNode(node, availableWidth, availableHeight, widthMode, heightMode
10250
10250
  layout.height = node._lOutH;
10251
10251
  return;
10252
10252
  }
10253
- if (node._cN > 0 && (sameGen || !node.isDirty_)) {
10253
+ if (node._cN > 0 && (sameGen || !node.isDirty_) && (!performLayout || node.children.length === 0)) {
10254
10254
  const cIn = node._cIn;
10255
10255
  for (let i = 0; i < node._cN; i++) {
10256
10256
  const o = i * 8;
@@ -14950,15 +14950,16 @@ function isXtermJs() {
14950
14950
  return xtversionName?.startsWith("xterm.js") ?? false;
14951
14951
  }
14952
14952
  var EXTENDED_KEYS_TERMINALS = [
14953
- "iTerm.app",
14953
+ // env.terminal is normalized to lowercase in utils/env.ts.
14954
+ "iterm.app",
14954
14955
  "kitty",
14955
- "WezTerm",
14956
+ "wezterm",
14956
14957
  "ghostty",
14957
14958
  "tmux",
14958
14959
  "windows-terminal"
14959
14960
  ];
14960
- function supportsExtendedKeys() {
14961
- return EXTENDED_KEYS_TERMINALS.includes(env.terminal ?? "");
14961
+ function supportsExtendedKeys(terminal = env.terminal) {
14962
+ return EXTENDED_KEYS_TERMINALS.includes(terminal?.toLowerCase() ?? "");
14962
14963
  }
14963
14964
  var SYNC_OUTPUT_SUPPORTED = isSynchronizedOutputSupported();
14964
14965
  function writeDiffToTerminal(terminal, diff2, skipSyncMarkers = false) {
@@ -18731,7 +18732,7 @@ var LogUpdate = class {
18731
18732
  const startTime = performance.now();
18732
18733
  const stylePool = this.options.stylePool;
18733
18734
  if (next.viewport.height < prev.viewport.height || prev.viewport.width !== 0 && next.viewport.width !== prev.viewport.width) {
18734
- return fullResetSequence_CAUSES_FLICKER(next, "resize", stylePool);
18735
+ return fullResetSequence_CAUSES_FLICKER(next, "resize", stylePool, altScreen);
18735
18736
  }
18736
18737
  let scrollPatch = [];
18737
18738
  if (altScreen && next.scrollHint && decstbmSafe) {
@@ -18755,7 +18756,7 @@ var LogUpdate = class {
18755
18756
  logForDebugging(
18756
18757
  `Full reset (shrink->below): prevHeight=${prev.screen.height}, nextHeight=${next.screen.height}, viewport=${prev.viewport.height}`
18757
18758
  );
18758
- return fullResetSequence_CAUSES_FLICKER(next, "offscreen", stylePool);
18759
+ return fullResetSequence_CAUSES_FLICKER(next, "offscreen", stylePool, altScreen);
18759
18760
  }
18760
18761
  if (prev.screen.height >= prev.viewport.height && prev.screen.height > 0 && cursorAtBottom && !isGrowing) {
18761
18762
  const viewportY2 = prev.screen.height - prev.viewport.height;
@@ -18770,7 +18771,7 @@ var LogUpdate = class {
18770
18771
  if (scrollbackChangeY >= 0) {
18771
18772
  const prevLine = readLine(prev.screen, scrollbackChangeY);
18772
18773
  const nextLine = readLine(next.screen, scrollbackChangeY);
18773
- return fullResetSequence_CAUSES_FLICKER(next, "offscreen", stylePool, {
18774
+ return fullResetSequence_CAUSES_FLICKER(next, "offscreen", stylePool, altScreen, {
18774
18775
  triggerY: scrollbackChangeY,
18775
18776
  prevLine,
18776
18777
  nextLine
@@ -18787,7 +18788,8 @@ var LogUpdate = class {
18787
18788
  return fullResetSequence_CAUSES_FLICKER(
18788
18789
  next,
18789
18790
  "offscreen",
18790
- this.options.stylePool
18791
+ this.options.stylePool,
18792
+ altScreen
18791
18793
  );
18792
18794
  }
18793
18795
  screen.txn((prev2) => [
@@ -18852,7 +18854,7 @@ var LogUpdate = class {
18852
18854
  }
18853
18855
  });
18854
18856
  if (needsFullReset) {
18855
- return fullResetSequence_CAUSES_FLICKER(next, "offscreen", stylePool, {
18857
+ return fullResetSequence_CAUSES_FLICKER(next, "offscreen", stylePool, altScreen, {
18856
18858
  triggerY: resetTriggerY,
18857
18859
  prevLine: readLine(prev.screen, resetTriggerY),
18858
18860
  nextLine: readLine(next.screen, resetTriggerY)
@@ -18875,7 +18877,8 @@ var LogUpdate = class {
18875
18877
  next,
18876
18878
  prev.screen.height,
18877
18879
  next.screen.height,
18878
- stylePool
18880
+ stylePool,
18881
+ !altScreen
18879
18882
  );
18880
18883
  }
18881
18884
  if (altScreen) {
@@ -18933,22 +18936,24 @@ function readLine(screen, y) {
18933
18936
  }
18934
18937
  return line.trimEnd();
18935
18938
  }
18936
- function fullResetSequence_CAUSES_FLICKER(frame, reason, stylePool, debug) {
18939
+ function fullResetSequence_CAUSES_FLICKER(frame, reason, stylePool, altScreen, debug) {
18937
18940
  const screen = new VirtualScreen({ x: 0, y: 0 }, frame.viewport.width);
18938
- renderFrame(screen, frame, stylePool);
18941
+ renderFrame(screen, frame, stylePool, !altScreen);
18939
18942
  return [{ type: "clearTerminal", reason, debug }, ...screen.diff];
18940
18943
  }
18941
- function renderFrame(screen, frame, stylePool) {
18942
- renderFrameSlice(screen, frame, 0, frame.screen.height, stylePool);
18944
+ function renderFrame(screen, frame, stylePool, allowScroll) {
18945
+ renderFrameSlice(screen, frame, 0, frame.screen.height, stylePool, allowScroll);
18943
18946
  }
18944
- function renderFrameSlice(screen, frame, startY, endY, stylePool) {
18947
+ function renderFrameSlice(screen, frame, startY, endY, stylePool, allowScroll = true) {
18945
18948
  let currentStyleId = stylePool.none;
18946
18949
  let currentHyperlink = void 0;
18947
18950
  let lastRenderedStyleId = -1;
18948
18951
  const { width: screenWidth, cells, charPool, hyperlinkPool } = frame.screen;
18949
18952
  let index = startY * screenWidth;
18950
18953
  for (let y = startY; y < endY; y += 1) {
18951
- if (screen.cursor.y < y) {
18954
+ if (!allowScroll) {
18955
+ moveCursorTo(screen, 0, y);
18956
+ } else if (screen.cursor.y < y) {
18952
18957
  const rowsToAdvance = y - screen.cursor.y;
18953
18958
  screen.txn((prev) => {
18954
18959
  const patches = new Array(1 + rowsToAdvance);
@@ -18995,7 +19000,9 @@ function renderFrameSlice(screen, frame, startY, endY, stylePool) {
18995
19000
  currentHyperlink,
18996
19001
  void 0
18997
19002
  );
18998
- screen.txn((prev) => [[CARRIAGE_RETURN, NEWLINE], { dx: -prev.x, dy: 1 }]);
19003
+ if (allowScroll) {
19004
+ screen.txn((prev) => [[CARRIAGE_RETURN, NEWLINE], { dx: -prev.x, dy: 1 }]);
19005
+ }
18999
19006
  }
19000
19007
  transitionStyle(screen.diff, stylePool, currentStyleId, stylePool.none);
19001
19008
  transitionHyperlink(screen.diff, currentHyperlink, void 0);
@@ -21832,8 +21839,9 @@ var Ink = class {
21832
21839
  // blank→paint flicker). useVirtualScroll's height scaling already bounds
21833
21840
  // the per-resize cost; synchronous handling keeps dimensions consistent.
21834
21841
  handleResize = () => {
21835
- const cols = this.options.stdout.columns || 80;
21836
- const rows = this.options.stdout.rows || 24;
21842
+ const cols = this.options.stdout.columns ?? 80;
21843
+ const rows = this.options.stdout.rows ?? 24;
21844
+ if (cols < 1 || rows < 1) return;
21837
21845
  if (cols === this.terminalColumns && rows === this.terminalRows) return;
21838
21846
  this.terminalColumns = cols;
21839
21847
  this.terminalRows = rows;
@@ -21847,7 +21855,8 @@ var Ink = class {
21847
21855
  }
21848
21856
  if (this.currentNode !== null) {
21849
21857
  this.render(this.currentNode);
21850
- if (this.rootNode.yogaNode?.getComputedWidth() !== this.terminalColumns) {
21858
+ const layout = this.rootNode.yogaNode;
21859
+ if (layout?.getComputedWidth() !== cols || this.altScreenActive && layout?.getComputedHeight() !== rows) {
21851
21860
  this.rootNode.onComputeLayout?.();
21852
21861
  this.onRender();
21853
21862
  }
@@ -21912,14 +21921,17 @@ var Ink = class {
21912
21921
  if (this.isUnmounted || this.isPaused) {
21913
21922
  return;
21914
21923
  }
21924
+ if (this.options.stdout.isTTY && ((this.options.stdout.columns ?? 80) < 1 || (this.options.stdout.rows ?? 24) < 1)) {
21925
+ return;
21926
+ }
21915
21927
  if (this.drainTimer !== null) {
21916
21928
  clearTimeout(this.drainTimer);
21917
21929
  this.drainTimer = null;
21918
21930
  }
21919
21931
  flushInteractionTime();
21920
21932
  const renderStart = performance.now();
21921
- const terminalWidth = this.options.stdout.columns || 80;
21922
- const terminalRows = this.options.stdout.rows || 24;
21933
+ const terminalWidth = this.terminalColumns;
21934
+ const terminalRows = this.terminalRows;
21923
21935
  const frame = this.renderer({
21924
21936
  frontFrame: this.frontFrame,
21925
21937
  backFrame: this.backFrame,
@@ -21,7 +21,7 @@ import {
21
21
  } from "./chunk-RV3EXUXM.js";
22
22
  import {
23
23
  loadConfig
24
- } from "./chunk-HGTCIHWA.js";
24
+ } from "./chunk-5BDKRA6U.js";
25
25
  import {
26
26
  external_exports
27
27
  } from "./chunk-EWD7FWTH.js";
@@ -83,6 +83,9 @@ var FlavorConfigSchema = external_exports.object({
83
83
  skills: external_exports.object({
84
84
  disabled: external_exports.array(SkillNameSchema).max(1e3).default([])
85
85
  }).prefault({}),
86
+ globalInstructions: external_exports.object({
87
+ enabled: external_exports.boolean().default(true)
88
+ }).prefault({}),
86
89
  agents: external_exports.object({
87
90
  main: external_exports.object({ model: external_exports.string() }).optional(),
88
91
  subagent: external_exports.object({ model: external_exports.string() }).optional()