scream-code 0.6.5 → 0.6.7

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.
@@ -70274,14 +70274,48 @@ Analyze the conversation transcript and the user's explicit guidance, then produ
70274
70274
  The package must contain:
70275
70275
  - name: kebab-case skill name. Prefer the user's nameHint if it is valid kebab-case; otherwise derive a concise name from the purpose.
70276
70276
  - description: one sentence describing when to use this skill.
70277
- - content: the complete Markdown body of SKILL.md, including YAML frontmatter. The frontmatter must at least contain **name** and **description**. Keep it concrete, reusable, and focused on the user's stated purpose and focus.
70277
+ - content: the complete Markdown body of SKILL.md, following the MANDATORY structure below.
70278
70278
  - files: optional supporting files (e.g. scripts, data files) relative to the skill directory. Empty array if none.
70279
70279
 
70280
+ ### MANDATORY SKILL.md structure
70281
+
70282
+ Every generated skill MUST follow this exact section structure. Do not omit any section.
70283
+
70284
+ \`\`\`markdown
70285
+ ---
70286
+ name: <kebab-case-name>
70287
+ description: <one-sentence-purpose>
70288
+ ---
70289
+
70290
+ # <Title>
70291
+
70292
+ ## 适用场景
70293
+
70294
+ <!-- When to use this skill. List trigger phrases, project types, or situations. -->
70295
+
70296
+ ## 核心指令
70297
+
70298
+ <!-- Step-by-step instructions. Number each step. Mention specific tools by name
70299
+ (Read, Write, Bash, Agent, Glob, Grep, LSP, etc.). -->
70300
+
70301
+ ## 示例
70302
+
70303
+ <!-- One concrete example grounded in the conversation. Show a realistic
70304
+ user request and how this skill would handle it. -->
70305
+
70306
+ ## 质量检查清单
70307
+
70308
+ <!-- 3-5 checklist items the agent should verify before considering the task done. -->
70309
+ - [ ] ...
70310
+ - [ ] ...
70311
+ \`\`\`
70312
+
70280
70313
  Rules:
70281
70314
  - The skill must be reusable across similar projects, not hard-coded to the current session.
70282
70315
  - Mention tools by name (Read, Bash, Agent, etc.) when giving step-by-step instructions.
70283
70316
  - Use placeholders like <entry-file> instead of project-specific paths when possible.
70284
70317
  - Do not invent file content the user did not provide.
70318
+ - Match the user's language (Chinese or English) throughout the SKILL.md content.
70285
70319
  - Output ONLY a single fenced JSON block. No extra prose.`;
70286
70320
  const MAX_TEXT_LENGTH = 800;
70287
70321
  const MAX_TRANSCRIPT_LENGTH = 12e3;
@@ -78942,7 +78976,6 @@ var ContextMemory = class {
78942
78976
  }
78943
78977
  case "step.end": {
78944
78978
  const openStep = this.openSteps.get(event.uuid);
78945
- this.openSteps.delete(event.uuid);
78946
78979
  if (event.usage !== void 0) {
78947
78980
  const openStepIndex = openStep === void 0 ? -1 : this._history.indexOf(openStep);
78948
78981
  this._tokenCount = event.usage.inputCacheRead + event.usage.inputCacheCreation + event.usage.inputOther + event.usage.output;
@@ -78953,13 +78986,13 @@ var ContextMemory = class {
78953
78986
  }
78954
78987
  case "content.part": {
78955
78988
  const openStep = this.openSteps.get(event.stepUuid);
78956
- if (openStep === void 0) throw new Error(`Received content_part for unknown step_uuid '${event.stepUuid}' (no open step_begin)`);
78989
+ if (openStep === void 0) return;
78957
78990
  openStep.content.push(event.part);
78958
78991
  return;
78959
78992
  }
78960
78993
  case "tool.call": {
78961
78994
  const openStep = this.openSteps.get(event.stepUuid);
78962
- if (openStep === void 0) throw new Error(`Received tool_call for unknown step_uuid '${event.stepUuid}' (no open step_begin)`);
78995
+ if (openStep === void 0) return;
78963
78996
  openStep.toolCalls.push({
78964
78997
  type: "function",
78965
78998
  id: event.toolCallId,
@@ -101279,6 +101312,13 @@ var SessionSubagentHost = class {
101279
101312
  options.signal.throwIfAborted();
101280
101313
  await this.triggerSubagentStart(parent, profileName, options.prompt, options.signal);
101281
101314
  options.signal.throwIfAborted();
101315
+ parent.emitEvent({
101316
+ type: "subagent.started",
101317
+ subagentId: childId,
101318
+ parentToolCallId: options.parentToolCallId,
101319
+ subagentName: profileName,
101320
+ runInBackground: options.runInBackground
101321
+ });
101282
101322
  let childPrompt = options.prompt;
101283
101323
  if (profileName === "explore") {
101284
101324
  const gitContext = await collectGitContext(child.jian, child.config.cwd);
@@ -121592,9 +121632,12 @@ var ChoicePickerComponent = class extends Container {
121592
121632
  const chosen = this.list.selected();
121593
121633
  if (chosen?.actionKeys !== void 0 && this.list.view().query.length === 0) {
121594
121634
  const ch = printableChar(data);
121595
- if (ch !== void 0 && chosen.actionKeys[ch] !== void 0) {
121596
- chosen.actionKeys[ch]();
121597
- return;
121635
+ if (ch !== void 0) {
121636
+ const fn = chosen.actionKeys[ch] ?? chosen.actionKeys[ch.toLowerCase()];
121637
+ if (fn !== void 0) {
121638
+ fn();
121639
+ return;
121640
+ }
121598
121641
  }
121599
121642
  }
121600
121643
  this.list.handleKey(data);
@@ -122483,40 +122526,38 @@ function parseColorFgBg(value) {
122483
122526
  * WCAG AA.
122484
122527
  */
122485
122528
  const dark = {
122486
- blue400: "#4EC87E",
122487
- blue500: "#72A4E9",
122488
- cyan400: "#5BC0BE",
122529
+ green: "#4EC87E",
122530
+ blue: "#72A4E9",
122531
+ cyan: "#5BC0BE",
122489
122532
  gray50: "#F5F5F5",
122490
122533
  gray100: "#E0E0E0",
122491
122534
  gray500: "#888888",
122492
122535
  gray600: "#6B6B6B",
122493
122536
  gray700: "#5A5A5A",
122494
- green400: "#4EC87E",
122495
- green300: "#7AD99B",
122496
- red400: "#E85454",
122497
- red300: "#F08585",
122537
+ greenLight: "#7AD99B",
122538
+ red: "#E85454",
122539
+ redLight: "#F08585",
122498
122540
  amber400: "#E8A838",
122499
122541
  gold400: "#FBD700",
122500
122542
  tangerine400: "#FF5401",
122501
122543
  orange300: "#FFCB6B"
122502
122544
  };
122503
122545
  const light = {
122504
- blue500: "#2563EB",
122505
- blue600: "#0E7A38",
122506
- cyan700: "#00838F",
122546
+ green: "#0E7A38",
122547
+ blue: "#2563EB",
122548
+ cyan: "#00838F",
122507
122549
  gray900: "#1A1A1A",
122508
122550
  gray700: "#454545",
122509
122551
  gray600: "#5F5F5F",
122510
122552
  gray500: "#737373",
122511
- green700: "#0E7A38",
122512
- red700: "#B91C1C",
122553
+ red: "#B91C1C",
122513
122554
  amber800: "#92660A",
122514
122555
  gold700: "#8C7600",
122515
122556
  tangerine700: "#B33A00",
122516
122557
  orange700: "#9A4A00"
122517
122558
  };
122518
122559
  const darkColors = {
122519
- primary: dark.blue400,
122560
+ primary: dark.green,
122520
122561
  accent: dark.tangerine400,
122521
122562
  planMode: "#00FFFF",
122522
122563
  text: dark.gray100,
@@ -122529,13 +122570,13 @@ const darkColors = {
122529
122570
  mdQuote: "#7F848E",
122530
122571
  border: dark.gray700,
122531
122572
  borderFocus: dark.gold400,
122532
- success: dark.green400,
122573
+ success: dark.green,
122533
122574
  warning: dark.amber400,
122534
- error: dark.red400,
122535
- diffAdded: dark.green400,
122536
- diffRemoved: dark.red400,
122537
- diffAddedStrong: dark.green300,
122538
- diffRemovedStrong: dark.red300,
122575
+ error: dark.red,
122576
+ diffAdded: dark.green,
122577
+ diffRemoved: dark.red,
122578
+ diffAddedStrong: dark.greenLight,
122579
+ diffRemovedStrong: dark.redLight,
122539
122580
  diffGutter: dark.gray600,
122540
122581
  diffMeta: dark.gray500,
122541
122582
  roleUser: dark.orange300,
@@ -122545,7 +122586,7 @@ const darkColors = {
122545
122586
  status: dark.gray500
122546
122587
  };
122547
122588
  const lightColors = {
122548
- primary: light.blue600,
122589
+ primary: light.green,
122549
122590
  accent: light.tangerine700,
122550
122591
  planMode: "#00FFFF",
122551
122592
  text: light.gray900,
@@ -122558,13 +122599,13 @@ const lightColors = {
122558
122599
  mdQuote: "#616161",
122559
122600
  border: light.gray500,
122560
122601
  borderFocus: light.gold700,
122561
- success: light.green700,
122602
+ success: light.green,
122562
122603
  warning: light.amber800,
122563
- error: light.red700,
122564
- diffAdded: light.green700,
122565
- diffRemoved: light.red700,
122566
- diffAddedStrong: light.green700,
122567
- diffRemovedStrong: light.red700,
122604
+ error: light.red,
122605
+ diffAdded: light.green,
122606
+ diffRemoved: light.red,
122607
+ diffAddedStrong: light.green,
122608
+ diffRemovedStrong: light.red,
122568
122609
  diffGutter: light.gray500,
122569
122610
  diffMeta: light.gray600,
122570
122611
  roleUser: light.orange700,
@@ -125796,7 +125837,7 @@ function formatKeyArgument(toolName, key, value, workspaceDir) {
125796
125837
  return truncateArgValue(key, toolName === "Read" && PATH_KEYS.has(key) ? makeWorkspaceRelativePath(value, workspaceDir) : value);
125797
125838
  }
125798
125839
  function extractKeyArgument(toolName, args, workspaceDir) {
125799
- const candidates = {
125840
+ const keyMap = {
125800
125841
  Bash: ["command"],
125801
125842
  Read: ["path", "file_path"],
125802
125843
  Write: ["path", "file_path"],
@@ -125806,7 +125847,17 @@ function extractKeyArgument(toolName, args, workspaceDir) {
125806
125847
  FetchURL: ["url"],
125807
125848
  WebSearch: ["query"],
125808
125849
  Agent: ["description", "prompt"]
125809
- }[toolName] ?? Object.keys(args);
125850
+ };
125851
+ if (toolName === "Glob") {
125852
+ const pattern = args["pattern"];
125853
+ if (typeof pattern !== "string" || pattern.length === 0) return null;
125854
+ let summary = pattern;
125855
+ const path = args["path"];
125856
+ if (typeof path === "string" && path.length > 0) summary += ` · ${makeWorkspaceRelativePath(path, workspaceDir)}`;
125857
+ if (args["include_dirs"] === false) summary += " · no dirs";
125858
+ return truncateArgValue("pattern", summary);
125859
+ }
125860
+ const candidates = keyMap[toolName] ?? Object.keys(args);
125810
125861
  for (const key of candidates) {
125811
125862
  const val = args[key];
125812
125863
  if (typeof val === "string" && val.length > 0) return formatKeyArgument(toolName, key, val.split("\n")[0] ?? val, workspaceDir);
@@ -126193,6 +126244,17 @@ var ToolCallComponent = class ToolCallComponent extends Container {
126193
126244
  this.notifySnapshotChange();
126194
126245
  this.ui?.requestRender();
126195
126246
  }
126247
+ /** Handles SDK `subagent.started` once the child turn begins. */
126248
+ onSubagentStarted(meta) {
126249
+ this.subagentAgentId = meta.agentId;
126250
+ this.subagentAgentName = meta.agentName;
126251
+ if (!meta.runInBackground && this.subagentPhase === "spawning") this.subagentPhase = "running";
126252
+ this.syncSubagentElapsedTimer();
126253
+ this.headerText.setText(this.buildHeader());
126254
+ this.rebuildContent();
126255
+ this.notifySnapshotChange();
126256
+ this.ui?.requestRender();
126257
+ }
126196
126258
  /**
126197
126259
  * Handles SDK `subagent.completed`. Moves the phase to 'done' and records
126198
126260
  * token usage plus the result summary for the header chip and tail summary.
@@ -130494,6 +130556,9 @@ var SessionEventHandler = class {
130494
130556
  case "subagent.spawned":
130495
130557
  this.handleSubagentSpawned(event);
130496
130558
  break;
130559
+ case "subagent.started":
130560
+ this.handleSubagentStarted(event);
130561
+ break;
130497
130562
  case "subagent.completed":
130498
130563
  this.handleSubagentCompleted(event);
130499
130564
  break;
@@ -130972,6 +131037,16 @@ var SessionEventHandler = class {
130972
131037
  runInBackground: event.runInBackground
130973
131038
  });
130974
131039
  }
131040
+ handleSubagentStarted(event) {
131041
+ if (event.runInBackground) return;
131042
+ const tc = this.host.streamingUI.getToolComponent(event.parentToolCallId);
131043
+ if (tc === void 0) return;
131044
+ tc.onSubagentStarted({
131045
+ agentId: event.subagentId,
131046
+ agentName: event.subagentName,
131047
+ runInBackground: event.runInBackground
131048
+ });
131049
+ }
130975
131050
  handleSubagentCompleted(event) {
130976
131051
  const { streamingUI } = this.host;
130977
131052
  const backgroundMeta = this.backgroundAgentMetadata.get(event.subagentId);
@@ -133935,7 +134010,6 @@ var TranscriptController = class TranscriptController {
133935
134010
  }
133936
134011
  toggleToolOutputExpansion() {
133937
134012
  const { state } = this.host;
133938
- state.ui.setClearOnShrink(false);
133939
134013
  state.toolOutputExpanded = !state.toolOutputExpanded;
133940
134014
  const walk = (children) => {
133941
134015
  for (const child of children) {
@@ -133948,7 +134022,6 @@ var TranscriptController = class TranscriptController {
133948
134022
  }
133949
134023
  togglePlanExpansion() {
133950
134024
  const { state } = this.host;
133951
- state.ui.setClearOnShrink(false);
133952
134025
  const next = !state.planExpanded;
133953
134026
  let toggled = false;
133954
134027
  for (const child of state.transcriptContainer.children) if (isPlanExpandable(child) && child.setPlanExpanded(next)) toggled = true;
@@ -139721,6 +139794,14 @@ var ScreamTUI = class {
139721
139794
  resetSessionRuntime() {
139722
139795
  this.sessionManager.resetSessionRuntime();
139723
139796
  }
139797
+ /**
139798
+ * Pin the editor + footer to the terminal bottom. The pi-tui patch adds a
139799
+ * `fixedBottomLineCount` property: the last N rendered lines stay pinned
139800
+ * while the transcript above scrolls independently.
139801
+ *
139802
+ * We override `doRender` to measure the editor + footer height each frame
139803
+ * and set the count before the real render runs.
139804
+ */
139724
139805
  async resumeSession(targetSessionId) {
139725
139806
  return (await this.sessionManager.resumeSession(targetSessionId)).switched;
139726
139807
  }
@@ -139780,17 +139861,17 @@ var ScreamTUI = class {
139780
139861
  applyTheme(theme, resolved) {
139781
139862
  this.lifecycleController.applyTheme(theme, resolved);
139782
139863
  }
139783
- mountEditorReplacement(panel) {
139864
+ swapEditor(component) {
139784
139865
  this.state.editorContainer.clear();
139785
- this.state.editorContainer.addChild(panel);
139786
- this.state.ui.setFocus(panel);
139866
+ this.state.editorContainer.addChild(component);
139867
+ this.state.ui.setFocus(component);
139787
139868
  this.state.ui.requestRender();
139788
139869
  }
139870
+ mountEditorReplacement(panel) {
139871
+ this.swapEditor(panel);
139872
+ }
139789
139873
  restoreEditor() {
139790
- this.state.editorContainer.clear();
139791
- this.state.editorContainer.addChild(this.state.editor);
139792
- this.state.ui.setFocus(this.state.editor);
139793
- this.state.ui.requestRender();
139874
+ this.swapEditor(this.state.editor);
139794
139875
  }
139795
139876
  showHelpPanel() {
139796
139877
  this.dialogManager.showHelpPanel(this.getSlashCommands());
package/dist/main.mjs CHANGED
@@ -6,7 +6,7 @@ const __dirname = __cjsShimDirname(__filename);
6
6
  import "./suppress-sqlite-warning-C2VB0doZ.mjs";
7
7
  //#region src/main.ts
8
8
  try {
9
- (await import("./app-BwuBgXNw.mjs")).main();
9
+ (await import("./app-NYV7g66W.mjs")).main();
10
10
  } catch (error) {
11
11
  process.stderr.write(`${error instanceof Error ? error.stack ?? error.message : String(error)}\n`);
12
12
  process.exit(1);