scream-code 0.4.7 → 0.4.8

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 (2) hide show
  1. package/dist/main.mjs +0 -241
  2. package/package.json +3 -3
package/dist/main.mjs CHANGED
@@ -135429,246 +135429,6 @@ var ScreamTUI = class {
135429
135429
  //#endregion
135430
135430
  //#region src/tui/components/chrome/loading.ts
135431
135431
  const { stdout, stdin } = process$1;
135432
- const LOGO = [
135433
- "███████╗ ██████╗██████╗ ███████╗ █████╗ ███╗ ███╗ ██████╗ ██████╗ ██████╗ ███████╗",
135434
- "██╔════╝██╔════╝██╔══██╗██╔════╝██╔══██╗████╗ ████║ ██╔════╝██╔═══██╗██╔══██╗██╔════╝",
135435
- "███████╗██║ ██████╔╝█████╗ ███████║██╔████╔██║ ██║ ██║ ██║██║ ██║█████╗ ",
135436
- "╚════██║██║ ██╔══██╗██╔══╝ ██╔══██║██║╚██╔╝██║ ██║ ██║ ██║██║ ██║██╔══╝ ",
135437
- "███████║╚██████╗██║ ██║███████╗██║ ██║██║ ╚═╝ ██║ ╚██████╗╚██████╔╝██████╔╝███████╗",
135438
- "╚══════╝ ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝"
135439
- ];
135440
- const SHADOW_CHARS = new Set([
135441
- "╚",
135442
- "═",
135443
- "╝",
135444
- "║",
135445
- "╔",
135446
- "╗",
135447
- "╠",
135448
- "╣",
135449
- "╦",
135450
- "╩",
135451
- "╬"
135452
- ]);
135453
- const SHEEN_STEP = 2;
135454
- const SHEEN_INTERVAL_MS = 150;
135455
- const LOADING_DURATION_MS = 2200;
135456
- const THEME_ACCENT = {
135457
- dark: [
135458
- 78,
135459
- 200,
135460
- 126
135461
- ],
135462
- light: [
135463
- 14,
135464
- 122,
135465
- 56
135466
- ]
135467
- };
135468
- const BLOCK_RGB = [
135469
- 255,
135470
- 255,
135471
- 255
135472
- ];
135473
- const LOGO_RGB = [
135474
- 136,
135475
- 136,
135476
- 136
135477
- ];
135478
- const DIM_RGB = [
135479
- 85,
135480
- 85,
135481
- 85
135482
- ];
135483
- function fg(r, g, b) {
135484
- return `\x1b[38;2;${r};${g};${b}m`;
135485
- }
135486
- const RESET = "\x1B[0m";
135487
- const BOLD = "\x1B[1m";
135488
- const DIM = "\x1B[2m";
135489
- function renderSheen(char, charIndex, sheenPos, isReversing, accent) {
135490
- if (char === " ") return " ";
135491
- if (char === "█") return `${fg(...BLOCK_RGB)}█${RESET}`;
135492
- if (!SHADOW_CHARS.has(char)) return `${fg(...LOGO_RGB)}${char}${RESET}`;
135493
- let color;
135494
- if (isReversing) color = charIndex <= sheenPos ? LOGO_RGB : accent;
135495
- else color = charIndex <= sheenPos ? accent : LOGO_RGB;
135496
- return `${fg(...color)}${char}${RESET}`;
135497
- }
135498
- const LOADING_TEXT = "Ai正在加载中...";
135499
- function buildShimmerPalette(n, accent) {
135500
- const size = Math.max(8, Math.min(20, Math.ceil(n * 1.5)));
135501
- const palette = [];
135502
- for (let i = 0; i < size; i++) {
135503
- const t = i / (size - 1);
135504
- palette.push([
135505
- Math.round(accent[0] - t * accent[0] * .35),
135506
- Math.round(accent[1] - t * accent[1] * .6),
135507
- Math.round(accent[2] - t * accent[2] * .33)
135508
- ]);
135509
- }
135510
- return palette;
135511
- }
135512
- function renderShimmer(pulse, accent) {
135513
- const chars = LOADING_TEXT.split("");
135514
- const n = chars.length;
135515
- const palette = buildShimmerPalette(n, accent);
135516
- let out = "";
135517
- for (let i = 0; i < n; i++) {
135518
- const phase = (pulse - i + n) % n;
135519
- const color = palette[phase];
135520
- const ratio = n <= 1 ? 0 : phase / (n - 1);
135521
- out += `${ratio < .23 ? BOLD : ratio < .69 ? "" : DIM}${fg(...color)}${chars[i]}${RESET}`;
135522
- }
135523
- return out;
135524
- }
135525
- function getTerminalSize() {
135526
- return {
135527
- cols: stdout.columns || 80,
135528
- rows: stdout.rows || 24
135529
- };
135530
- }
135531
- function visualWidth(s) {
135532
- let w = 0;
135533
- for (const ch of s.replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "")) w += /[一-鿿 -〿＀-￯]/.test(ch) ? 2 : 1;
135534
- return w;
135535
- }
135536
- function centerPad(text, width) {
135537
- const plainW = visualWidth(text);
135538
- const pad = Math.max(0, Math.floor((width - plainW) / 2));
135539
- return " ".repeat(pad) + text;
135540
- }
135541
- let ansiSupported = null;
135542
- function supportsAnsi() {
135543
- if (ansiSupported !== null) return ansiSupported;
135544
- if (!stdout.isTTY) {
135545
- ansiSupported = false;
135546
- return false;
135547
- }
135548
- if (process$1.env["NO_COLOR"]) {
135549
- ansiSupported = false;
135550
- return false;
135551
- }
135552
- if (process$1.env["FORCE_COLOR"]) {
135553
- ansiSupported = true;
135554
- return true;
135555
- }
135556
- if (process$1.platform === "win32") {
135557
- const term = (process$1.env["TERM"] ?? "").toLowerCase();
135558
- const session = (process$1.env["TERM_PROGRAM"] ?? "").toLowerCase();
135559
- if (term.includes("xterm") || term.includes("vt100") || term.includes("256color")) {
135560
- ansiSupported = true;
135561
- return true;
135562
- }
135563
- if (session.includes("terminal") || session.includes("vscode")) {
135564
- ansiSupported = true;
135565
- return true;
135566
- }
135567
- if (process$1.env["CI"]) {
135568
- ansiSupported = true;
135569
- return true;
135570
- }
135571
- ansiSupported = true;
135572
- return true;
135573
- }
135574
- if (process$1.env["TERM"] && process$1.env["TERM"] !== "dumb") {
135575
- ansiSupported = true;
135576
- return true;
135577
- }
135578
- ansiSupported = false;
135579
- return false;
135580
- }
135581
- function runLoadingAnimation(theme = "dark") {
135582
- if (!supportsAnsi()) {
135583
- for (const line of LOGO) stdout.write(`${fg(...LOGO_RGB)}${line}${RESET}\n`);
135584
- stdout.write(`${BOLD}${fg(...THEME_ACCENT[theme])}正在唤醒核心...${RESET}\n`);
135585
- return Promise.resolve();
135586
- }
135587
- return new Promise((resolve) => {
135588
- stdout.write("\x1B[?1049h");
135589
- stdout.write("\x1B[2J");
135590
- stdout.write("\x1B[?25l");
135591
- const accent = THEME_ACCENT[theme];
135592
- let sheenPos = 0;
135593
- let isReversing = false;
135594
- let shimmerPulse = 0;
135595
- let phase = "loading";
135596
- function render() {
135597
- const { cols, rows } = getTerminalSize();
135598
- const lines = [];
135599
- const contentHeight = LOGO.length + 4;
135600
- const topPad = Math.max(0, Math.floor((rows - contentHeight) / 2));
135601
- for (let i = 0; i < topPad; i++) lines.push("");
135602
- for (const line of LOGO) {
135603
- let colored = "";
135604
- for (let ci = 0; ci < line.length; ci++) colored += renderSheen(line[ci], ci, sheenPos, isReversing, accent);
135605
- lines.push(centerPad(colored, cols));
135606
- }
135607
- if (phase === "loading") lines.push(centerPad(renderShimmer(shimmerPulse, accent), cols));
135608
- else lines.push(centerPad(`${BOLD}${fg(...accent)}按下 ENTER 唤醒核心${RESET}`, cols));
135609
- lines.push("");
135610
- lines.push("");
135611
- lines.push(centerPad(`${fg(...DIM_RGB)}按住 Ctrl+C 即可退出 Scream Code${RESET}`, cols));
135612
- while (lines.length < rows) lines.push("");
135613
- stdout.write("\x1B[H");
135614
- stdout.write(lines.join("\n"));
135615
- }
135616
- function tick() {
135617
- sheenPos += SHEEN_STEP;
135618
- if (sheenPos >= 90) {
135619
- isReversing = !isReversing;
135620
- sheenPos = 0;
135621
- }
135622
- shimmerPulse = (shimmerPulse + 1) % 10;
135623
- render();
135624
- }
135625
- function onData(data) {
135626
- const key = data.toString();
135627
- if (key === "") {
135628
- interrupt();
135629
- return;
135630
- }
135631
- if ((key === "\r" || key === "\n") && phase === "ready") {
135632
- cleanup();
135633
- resolve();
135634
- }
135635
- }
135636
- function cleanup() {
135637
- clearInterval(timer);
135638
- stdin.off("data", onData);
135639
- process$1.off("SIGINT", interrupt);
135640
- process$1.off("SIGTERM", interrupt);
135641
- stdin.setRawMode(false);
135642
- stdout.write("\x1B[?25h");
135643
- stdout.write("\x1B[?1049l");
135644
- }
135645
- function interrupt() {
135646
- cleanup();
135647
- process$1.exit(0);
135648
- }
135649
- process$1.on("SIGINT", interrupt);
135650
- process$1.on("SIGTERM", interrupt);
135651
- try {
135652
- stdin.setRawMode(true);
135653
- } catch {
135654
- process$1.off("SIGINT", interrupt);
135655
- process$1.off("SIGTERM", interrupt);
135656
- stdout.write("\x1B[?25h");
135657
- stdout.write("\x1B[?1049l");
135658
- for (const line of LOGO) stdout.write(`${fg(...LOGO_RGB)}${line}${RESET}\n`);
135659
- stdout.write(`${BOLD}${fg(...accent)}正在唤醒核心...${RESET}\n`);
135660
- resolve();
135661
- return;
135662
- }
135663
- stdin.on("data", onData);
135664
- render();
135665
- const timer = setInterval(tick, SHEEN_INTERVAL_MS);
135666
- setTimeout(() => {
135667
- phase = "ready";
135668
- render();
135669
- }, LOADING_DURATION_MS);
135670
- });
135671
- }
135672
135432
  //#endregion
135673
135433
  //#region src/cli/run-shell.ts
135674
135434
  async function runShell(opts, version) {
@@ -135707,7 +135467,6 @@ async function runShell(opts, version) {
135707
135467
  const config = await harness.getConfig();
135708
135468
  const configMs = Date.now() - configStartedAt;
135709
135469
  await harness.preflight();
135710
- await runLoadingAnimation(resolvedTheme);
135711
135470
  const tui = new ScreamTUI(harness, {
135712
135471
  cliOptions: opts,
135713
135472
  tuiConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scream-code",
3
- "version": "0.4.7",
3
+ "version": "0.4.8",
4
4
  "description": "The Starting Point for Next-Gen Agents",
5
5
  "license": "MIT",
6
6
  "author": "ScreamCli",
@@ -58,9 +58,9 @@
58
58
  "tsx": "^4.21.0",
59
59
  "@scream-cli/agent-core": "^0.3.10",
60
60
  "@scream-cli/config": "^0.3.10",
61
- "@scream-cli/scream-code-sdk": "^0.3.10",
62
- "@scream-cli/migration-legacy": "^0.3.10",
63
61
  "@scream-cli/scream-telemetry": "^0.3.10",
62
+ "@scream-cli/migration-legacy": "^0.3.10",
63
+ "@scream-cli/scream-code-sdk": "^0.3.10",
64
64
  "@scream-code/memory": "0.3.10"
65
65
  },
66
66
  "engines": {