@mindstudio-ai/remy 0.1.127 → 0.1.129

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.
package/dist/headless.js CHANGED
@@ -2822,10 +2822,12 @@ Current date: ${dateStr}`;
2822
2822
  const excludeToolsFromClearing = tools2.filter((t) => t.clearable === false).map((t) => t.name);
2823
2823
  let turns = 0;
2824
2824
  const run = async () => {
2825
+ const historyLen = (history ?? []).length;
2825
2826
  const messages = [
2826
2827
  ...history ?? [],
2827
2828
  { role: "user", content: task }
2828
2829
  ];
2830
+ const thisInvocation = () => messages.slice(historyLen);
2829
2831
  function getPartialText(blocks) {
2830
2832
  return blocks.filter((b) => b.type === "text").map((b) => b.text).join("");
2831
2833
  }
@@ -2836,10 +2838,10 @@ Current date: ${dateStr}`;
2836
2838
  text: partial ? `[INTERRUPTED - PARTIAL OUTPUT RETRIEVED] Note that partial output may include thinking text or other unfinalized decisions. It is NOT an authoritative response from this agent.
2837
2839
 
2838
2840
  ${partial}` : "[INTERRUPTED] Agent was interrupted before producing output.",
2839
- messages
2841
+ messages: thisInvocation()
2840
2842
  };
2841
2843
  }
2842
- return { text: "Error: cancelled", messages };
2844
+ return { text: "Error: cancelled", messages: thisInvocation() };
2843
2845
  }
2844
2846
  let lastToolResult = "";
2845
2847
  while (true) {
@@ -2946,7 +2948,10 @@ ${partial}` : "[INTERRUPTED] Agent was interrupted before producing output.",
2946
2948
  stopReason = event.stopReason;
2947
2949
  break;
2948
2950
  case "error":
2949
- return { text: `Error: ${event.error}`, messages };
2951
+ return {
2952
+ text: `Error: ${event.error}`,
2953
+ messages: thisInvocation()
2954
+ };
2950
2955
  }
2951
2956
  }
2952
2957
  } catch (err) {
@@ -2968,7 +2973,7 @@ ${partial}` : "[INTERRUPTED] Agent was interrupted before producing output.",
2968
2973
  if (stopReason !== "tool_use" || toolCalls.length === 0) {
2969
2974
  statusWatcher.stop();
2970
2975
  const text = getPartialText(contentBlocks);
2971
- return { text, messages };
2976
+ return { text, messages: thisInvocation() };
2972
2977
  }
2973
2978
  log5.info("Tools executing", {
2974
2979
  requestId,
@@ -3511,6 +3516,92 @@ var screenshotTool = {
3511
3516
  }
3512
3517
  };
3513
3518
 
3519
+ // src/subagents/common/tools.ts
3520
+ var COMMON_READ_TOOLS = [
3521
+ {
3522
+ name: "readFile",
3523
+ description: "Read a file's contents with line numbers. Always read a file before editing it \u2014 never guess at contents. For large files, consider using symbols first to identify the relevant section, then use offset and maxLines to read just that section. Line numbers in the output correspond to what editFile expects. Defaults to first 500 lines. Use a negative offset to read from the end of the file (e.g., offset: -50 reads the last 50 lines).",
3524
+ inputSchema: {
3525
+ type: "object",
3526
+ properties: {
3527
+ path: {
3528
+ type: "string",
3529
+ description: "The file path to read, relative to the project root."
3530
+ },
3531
+ offset: {
3532
+ type: "number",
3533
+ description: "Line number to start reading from (1-indexed). Use a negative number to read from the end (e.g., -50 reads the last 50 lines). Defaults to 1."
3534
+ },
3535
+ maxLines: {
3536
+ type: "number",
3537
+ description: "Maximum number of lines to return. Defaults to 500. Set to 0 for no limit."
3538
+ }
3539
+ },
3540
+ required: ["path"]
3541
+ }
3542
+ },
3543
+ {
3544
+ name: "listDir",
3545
+ description: "List the contents of a directory with one level of subdirectory expansion. Shows file sizes and collapses single-child directory chains (a/b/c/ shown as one entry). Use this for a quick overview of a directory's structure. For finding files across the whole project, use glob instead.",
3546
+ inputSchema: {
3547
+ type: "object",
3548
+ properties: {
3549
+ path: {
3550
+ type: "string",
3551
+ description: 'Directory path to list, relative to project root. Defaults to ".".'
3552
+ }
3553
+ }
3554
+ }
3555
+ },
3556
+ {
3557
+ name: "grep",
3558
+ description: "Search file contents for a regex pattern. Returns matching lines with file paths and line numbers (default 50 results). Use this to find where something is used, locate function definitions, or search for patterns across the codebase. For finding a symbol's definition precisely, prefer the definition tool if LSP is available. Automatically excludes node_modules and .git.",
3559
+ inputSchema: {
3560
+ type: "object",
3561
+ properties: {
3562
+ pattern: {
3563
+ type: "string",
3564
+ description: "The search pattern (regex supported)."
3565
+ },
3566
+ path: {
3567
+ type: "string",
3568
+ description: "Directory or file to search in. Defaults to current directory."
3569
+ },
3570
+ glob: {
3571
+ type: "string",
3572
+ description: 'File glob to filter (e.g., "*.ts"). Only used with ripgrep.'
3573
+ },
3574
+ maxResults: {
3575
+ type: "number",
3576
+ description: "Maximum number of matching lines to return. Defaults to 50. Increase if you need more comprehensive results."
3577
+ }
3578
+ },
3579
+ required: ["pattern"]
3580
+ }
3581
+ },
3582
+ {
3583
+ name: "glob",
3584
+ description: 'Find files matching a glob pattern. Returns matching file paths sorted alphabetically (default 200 results). Use this to discover project structure, find files by name or extension, or check if a file exists. Common patterns: "**/*.ts" (all TypeScript files), "src/**/*.tsx" (React components in src), "*.json" (root-level JSON files). Automatically excludes node_modules and .git.',
3585
+ inputSchema: {
3586
+ type: "object",
3587
+ properties: {
3588
+ pattern: {
3589
+ type: "string",
3590
+ description: 'Glob pattern (e.g., "**/*.ts", "src/**/*.tsx", "*.json").'
3591
+ },
3592
+ maxResults: {
3593
+ type: "number",
3594
+ description: "Maximum number of file paths to return. Defaults to 200. Increase if you need the complete list."
3595
+ }
3596
+ },
3597
+ required: ["pattern"]
3598
+ }
3599
+ }
3600
+ ];
3601
+ var COMMON_READ_TOOL_NAMES = new Set(
3602
+ COMMON_READ_TOOLS.map((t) => t.name)
3603
+ );
3604
+
3514
3605
  // src/subagents/designExpert/tools/searchGoogle.ts
3515
3606
  var searchGoogle_exports = {};
3516
3607
  __export(searchGoogle_exports, {
@@ -4006,9 +4097,10 @@ var tools = {
4006
4097
  generateImages: generateImages_exports,
4007
4098
  editImages: editImages_exports
4008
4099
  };
4009
- var DESIGN_EXPERT_TOOLS = Object.values(tools).map(
4010
- (t) => t.definition
4011
- );
4100
+ var DESIGN_EXPERT_TOOLS = [
4101
+ ...COMMON_READ_TOOLS,
4102
+ ...Object.values(tools).map((t) => t.definition)
4103
+ ];
4012
4104
  async function executeDesignExpertTool(name, input, context, toolCallId, onLog) {
4013
4105
  const tool = tools[name];
4014
4106
  if (!tool) {
@@ -4036,32 +4128,101 @@ function walkMdFiles2(dir, skip) {
4036
4128
  }
4037
4129
  } catch {
4038
4130
  }
4039
- return files;
4131
+ return files.sort();
4132
+ }
4133
+ function parseFrontmatter2(filePath) {
4134
+ try {
4135
+ const content = fs14.readFileSync(filePath, "utf-8");
4136
+ const match = content.match(/^---\n([\s\S]*?)\n---/);
4137
+ if (!match) {
4138
+ return {};
4139
+ }
4140
+ const fm = {};
4141
+ for (const line of match[1].split("\n")) {
4142
+ const sep = line.indexOf(":");
4143
+ if (sep > 0) {
4144
+ const key = line.slice(0, sep).trim();
4145
+ const val = line.slice(sep + 1).trim();
4146
+ fm[key] = val;
4147
+ }
4148
+ }
4149
+ return fm;
4150
+ } catch {
4151
+ return {};
4152
+ }
4040
4153
  }
4041
- function loadFilesAsXml(dir, tag, skip) {
4042
- const files = walkMdFiles2(dir, skip);
4154
+ function loadSpecIndex() {
4155
+ const files = walkMdFiles2("src", /* @__PURE__ */ new Set(["roadmap"]));
4043
4156
  if (files.length === 0) {
4044
4157
  return "";
4045
4158
  }
4046
- const sections = files.map((f) => {
4047
- try {
4048
- const content = fs14.readFileSync(f, "utf-8").trim();
4049
- return `<file path="${f}">
4050
- ${content}
4051
- </file>`;
4052
- } catch {
4053
- return "";
4159
+ const lines = files.map((f) => {
4160
+ const fm = parseFrontmatter2(f);
4161
+ let line = `- ${f}`;
4162
+ if (fm.name) {
4163
+ line += ` \u2014 "${fm.name}"`;
4054
4164
  }
4055
- }).filter(Boolean);
4056
- return `<${tag}>
4057
- ${sections.join("\n\n")}
4058
- </${tag}>`;
4059
- }
4060
- function loadSpecContext() {
4061
- return loadFilesAsXml("src", "spec_files", /* @__PURE__ */ new Set(["roadmap"]));
4165
+ if (fm.description) {
4166
+ line += ` \u2014 ${fm.description}`;
4167
+ }
4168
+ return line;
4169
+ });
4170
+ return `<spec_files>
4171
+ ## Project Spec Files
4172
+ Use readFile to access full contents.
4173
+
4174
+ ${lines.join("\n")}
4175
+ </spec_files>`;
4062
4176
  }
4063
- function loadRoadmapContext() {
4064
- return loadFilesAsXml("src/roadmap", "current_roadmap");
4177
+ function loadRoadmapIndex() {
4178
+ const parts = [];
4179
+ try {
4180
+ const indexJson = JSON.parse(
4181
+ fs14.readFileSync("src/roadmap/index.json", "utf-8")
4182
+ );
4183
+ if (indexJson.lanes?.length > 0) {
4184
+ const laneLines = indexJson.lanes.map(
4185
+ (l) => `- **${l.name}**: ${l.narrative || ""} (${l.items?.length || 0} items)`
4186
+ );
4187
+ parts.push(`### Lanes
4188
+ ${laneLines.join("\n")}`);
4189
+ }
4190
+ if (indexJson.standalone?.length > 0) {
4191
+ parts.push(
4192
+ `### Standalone
4193
+ ${indexJson.standalone.map((s) => `- ${s}`).join("\n")}`
4194
+ );
4195
+ }
4196
+ } catch {
4197
+ }
4198
+ const files = walkMdFiles2("src/roadmap");
4199
+ if (files.length > 0) {
4200
+ const lines = files.map((f) => {
4201
+ const fm = parseFrontmatter2(f);
4202
+ let line = `- ${f}`;
4203
+ if (fm.name) {
4204
+ line += ` \u2014 "${fm.name}"`;
4205
+ }
4206
+ if (fm.status) {
4207
+ line += ` (${fm.status})`;
4208
+ }
4209
+ if (fm.description) {
4210
+ line += ` \u2014 ${fm.description}`;
4211
+ }
4212
+ return line;
4213
+ });
4214
+ parts.push(`### Items
4215
+ ${lines.join("\n")}`);
4216
+ }
4217
+ if (parts.length === 0) {
4218
+ return "";
4219
+ }
4220
+ return `<current_roadmap>
4221
+ ## Roadmap
4222
+ Use readFile to access full contents.
4223
+
4224
+ ${parts.join("\n\n")}
4225
+ </current_roadmap>`;
4065
4226
  }
4066
4227
  function loadPlatformBrief() {
4067
4228
  return `<platform_brief>
@@ -4262,7 +4423,7 @@ var PROMPT_TEMPLATE = readAsset(SUBAGENT, "prompt.md").replace(/\{\{([^}]+)\}\}/
4262
4423
  return RUNTIME_PLACEHOLDERS.has(k) ? match : readAsset(SUBAGENT, k);
4263
4424
  }).replace(/\n{3,}/g, "\n\n");
4264
4425
  function getDesignExpertPrompt(onboardingState) {
4265
- const specContext = loadSpecContext();
4426
+ const specContext = loadSpecIndex();
4266
4427
  const indices = getSampleIndices(
4267
4428
  {
4268
4429
  uiInspiration: uiScreens.length,
@@ -4381,7 +4542,13 @@ var designExpertTool = {
4381
4542
  history: history.length > 0 ? history : void 0,
4382
4543
  tools: DESIGN_EXPERT_TOOLS,
4383
4544
  externalTools: /* @__PURE__ */ new Set(),
4384
- executeTool: (name, input2, toolCallId, onLog) => executeDesignExpertTool(name, input2, context, toolCallId, onLog),
4545
+ executeTool: (name, input2, toolCallId, onLog) => {
4546
+ if (COMMON_READ_TOOL_NAMES.has(name)) {
4547
+ const childCtx = toolCallId ? deriveContext(context, toolCallId) : context;
4548
+ return executeTool(name, input2, childCtx);
4549
+ }
4550
+ return executeDesignExpertTool(name, input2, context, toolCallId, onLog);
4551
+ },
4385
4552
  apiConfig: context.apiConfig,
4386
4553
  model: context.model,
4387
4554
  subAgentId: "visualDesignExpert",
@@ -4408,28 +4575,7 @@ var designExpertTool = {
4408
4575
 
4409
4576
  // src/subagents/productVision/tools.ts
4410
4577
  var VISION_TOOLS = [
4411
- {
4412
- name: "listDir",
4413
- description: "List files in src/roadmap/.",
4414
- inputSchema: {
4415
- type: "object",
4416
- properties: {}
4417
- }
4418
- },
4419
- {
4420
- name: "readFile",
4421
- description: 'Read a file from src/roadmap/. Path is relative to src/roadmap/ (e.g. "index.json", "mute.md").',
4422
- inputSchema: {
4423
- type: "object",
4424
- properties: {
4425
- path: {
4426
- type: "string",
4427
- description: "File path relative to src/roadmap/."
4428
- }
4429
- },
4430
- required: ["path"]
4431
- }
4432
- },
4578
+ ...COMMON_READ_TOOLS,
4433
4579
  {
4434
4580
  name: "writeFile",
4435
4581
  description: 'Create or overwrite a file in src/roadmap/. Path is relative to src/roadmap/ (e.g. "index.json", "ai-weekly-digest.md").',
@@ -4482,42 +4628,15 @@ var VISION_TOOLS = [
4482
4628
  import fs16 from "fs";
4483
4629
  import path9 from "path";
4484
4630
  var ROADMAP_DIR = "src/roadmap";
4631
+ var PITCH_DECK_SHELL = readAsset(
4632
+ "subagents/productVision",
4633
+ "pitch-deck-shell.html"
4634
+ );
4485
4635
  function resolve(filePath) {
4486
4636
  return path9.join(ROADMAP_DIR, filePath);
4487
4637
  }
4488
4638
  async function executeVisionTool(name, input, context) {
4489
4639
  switch (name) {
4490
- case "listDir": {
4491
- try {
4492
- fs16.mkdirSync(ROADMAP_DIR, { recursive: true });
4493
- const entries = fs16.readdirSync(ROADMAP_DIR, { withFileTypes: true });
4494
- const lines = [];
4495
- const dirs = entries.filter((e) => e.isDirectory()).sort((a, b) => a.name.localeCompare(b.name));
4496
- const files = entries.filter((e) => !e.isDirectory()).sort((a, b) => a.name.localeCompare(b.name));
4497
- for (const d of dirs) {
4498
- lines.push(`${d.name}/`);
4499
- }
4500
- for (const f of files) {
4501
- const stat = fs16.statSync(resolve(f.name));
4502
- const size = stat.size < 1024 ? `${stat.size}B` : `${(stat.size / 1024).toFixed(1)}KB`;
4503
- lines.push(`${f.name} (${size})`);
4504
- }
4505
- return lines.length > 0 ? lines.join("\n") : "(empty)";
4506
- } catch (err) {
4507
- return `Error: ${err.message}`;
4508
- }
4509
- }
4510
- case "readFile": {
4511
- const filePath = resolve(input.path);
4512
- try {
4513
- const content = fs16.readFileSync(filePath, "utf-8");
4514
- const lines = content.split("\n");
4515
- const numbered = lines.map((line, i) => `${String(i + 1).padStart(4)} ${line}`).join("\n");
4516
- return numbered;
4517
- } catch (err) {
4518
- return `Error reading ${filePath}: ${err.message}`;
4519
- }
4520
- }
4521
4640
  case "writeFile": {
4522
4641
  const filePath = resolve(input.path);
4523
4642
  try {
@@ -4557,31 +4676,26 @@ ${unifiedDiff(filePath, oldContent, "")}`;
4557
4676
  const filePath = resolve("pitch.html");
4558
4677
  try {
4559
4678
  fs16.mkdirSync(ROADMAP_DIR, { recursive: true });
4560
- const existingHtml = fs16.existsSync(filePath) ? fs16.readFileSync(filePath, "utf-8").trim() : "";
4561
- let task = `
4679
+ const existing = fs16.existsSync(filePath) ? fs16.readFileSync(filePath, "utf-8").trim() : "";
4680
+ const currentDeck = existing || PITCH_DECK_SHELL;
4681
+ const task = `
4562
4682
  <pitch_content>${input.task}</pitch_content>
4563
4683
 
4564
- We are building the pitch deck for the app. Using the provided <pitch_content>, as well as the app's spec data, think about what would make a compelling, interactive, self-contained horizontally-scrolling HTML slide deck for this product. Keep it simple, clean, powerful. Giant text, large logo, big, bold stats and claims. Edit the content as necessary to create the most impactful, bold, and beautiful slides. This should not feel text heavy, and it should not feel like a landing page - it should feel like a modern interactive presentation that leaves the user wowed by the product.
4684
+ <current_deck>${currentDeck}</current_deck>
4565
4685
 
4566
- ### Rules
4567
- - The deck must be a single HTML file - it will be rendered in an iFrame.
4568
- - Keep it simple: 100svh 100vw slides that scroll horizontally using browser scrolling. Must look beautiful on desktop and mobile - use all the principles you know about designing effective landing pages to make a beautiful deck.
4569
- - The deck must support keyboard navigation left and right, and big clickable arrows to transition.
4570
- - Animation between slides must be seamless, no flicker or flashing.
4571
- - Be bold and impactful. Do not be wordy or verbose, no one reads decks with too many words.
4572
- - Keep it simple: 5-7 slides max. No fluff, just imapct.
4573
- - Code must be clean, bug free, and easy-to-parse. Use GSAP for animations.
4574
- `;
4575
- if (existingHtml) {
4576
- task += `
4686
+ We are building the pitch deck for the app. Using the provided <pitch_content>, as well as the app's spec data, think about what would make a compelling, interactive, self-contained horizontally-scrolling HTML slide deck for this product. Keep it simple, clean, powerful. Giant text, large logo, big, bold stats and claims. Edit the content as necessary to create the most impactful, bold, and beautiful slides. This should not feel like an essay, and it should not feel like a landing page \u2014 it should feel like a modern interactive presentation that leaves the user wowed by the product and excited about its future.
4577
4687
 
4578
- The current pitch deck HTML is below. Refine and update it rather than starting from scratch \u2014 preserve the existing design and structure where it still works, and update the content and slides to reflect the new pitch.
4688
+ Use <current_deck> as your starting point and replace or update the content as needed, maintaining the bones of the presentation scaffolding.
4579
4689
 
4580
- <existing_pitch_html>${existingHtml}</existing_pitch_html>`;
4581
- }
4582
- task += `
4690
+ ### Rules
4691
+ - The deck must be a single HTML file \u2014 it will be rendered in an iframe.
4692
+ - Must look beautiful on desktop and mobile.
4693
+ - Animation between slides must be seamless, no flicker or flashing.
4694
+ - Be bold and impactful.
4695
+ - 6-8 slides max. No fluff, just impact.
4696
+ - Code must be clean, bug free, and easy to parse. Use GSAP for animations.
4583
4697
 
4584
- Respond only with the HTML of the deck as a single fenced markdown block and absolutely no other text - your response will be written directly to a file.`;
4698
+ Respond only with the complete HTML file and absolutely no other text. Your response will be written directly to an html file.`;
4585
4699
  const result = await designExpertTool.execute({ task }, context);
4586
4700
  const htmlMatch = result.match(
4587
4701
  /```(?:html|wireframe)\n([\s\S]*?)```/
@@ -4605,15 +4719,15 @@ ${unifiedDiff(filePath, oldContent, html)}`;
4605
4719
  // src/subagents/productVision/prompt.ts
4606
4720
  var BASE_PROMPT2 = readAsset("subagents/productVision", "prompt.md");
4607
4721
  function getProductVisionPrompt() {
4608
- const specContext = loadSpecContext();
4609
- const roadmapContext = loadRoadmapContext();
4722
+ const specIndex = loadSpecIndex();
4723
+ const roadmapIndex = loadRoadmapIndex();
4610
4724
  const parts = [BASE_PROMPT2, loadPlatformBrief()];
4611
4725
  parts.push("<!-- cache_breakpoint -->");
4612
- if (specContext) {
4613
- parts.push(specContext);
4726
+ if (specIndex) {
4727
+ parts.push(specIndex);
4614
4728
  }
4615
- if (roadmapContext) {
4616
- parts.push(roadmapContext);
4729
+ if (roadmapIndex) {
4730
+ parts.push(roadmapIndex);
4617
4731
  }
4618
4732
  return parts.join("\n\n");
4619
4733
  }
@@ -4650,11 +4764,13 @@ var productVisionTool = {
4650
4764
  history: history.length > 0 ? history : void 0,
4651
4765
  tools: VISION_TOOLS,
4652
4766
  externalTools: /* @__PURE__ */ new Set(),
4653
- executeTool: (name, input2, toolCallId) => executeVisionTool(
4654
- name,
4655
- input2,
4656
- toolCallId ? deriveContext(context, toolCallId) : context
4657
- ),
4767
+ executeTool: (name, input2, toolCallId) => {
4768
+ const childCtx = toolCallId ? deriveContext(context, toolCallId) : context;
4769
+ if (COMMON_READ_TOOL_NAMES.has(name)) {
4770
+ return executeTool(name, input2, childCtx);
4771
+ }
4772
+ return executeVisionTool(name, input2, childCtx);
4773
+ },
4658
4774
  apiConfig: context.apiConfig,
4659
4775
  model: context.model,
4660
4776
  subAgentId: "productVision",
@@ -4681,49 +4797,7 @@ var productVisionTool = {
4681
4797
 
4682
4798
  // src/subagents/codeSanityCheck/tools.ts
4683
4799
  var SANITY_CHECK_TOOLS = [
4684
- {
4685
- name: "readFile",
4686
- description: "Read a file from the project.",
4687
- inputSchema: {
4688
- type: "object",
4689
- properties: {
4690
- path: {
4691
- type: "string",
4692
- description: "File path relative to project root."
4693
- }
4694
- },
4695
- required: ["path"]
4696
- }
4697
- },
4698
- {
4699
- name: "grep",
4700
- description: "Search file contents for a pattern.",
4701
- inputSchema: {
4702
- type: "object",
4703
- properties: {
4704
- pattern: { type: "string", description: "Search pattern (regex)." },
4705
- path: {
4706
- type: "string",
4707
- description: "Directory or file to search in."
4708
- }
4709
- },
4710
- required: ["pattern"]
4711
- }
4712
- },
4713
- {
4714
- name: "glob",
4715
- description: "Find files by glob pattern.",
4716
- inputSchema: {
4717
- type: "object",
4718
- properties: {
4719
- pattern: {
4720
- type: "string",
4721
- description: 'Glob pattern (e.g., "src/**/*.ts").'
4722
- }
4723
- },
4724
- required: ["pattern"]
4725
- }
4726
- },
4800
+ ...COMMON_READ_TOOLS,
4727
4801
  {
4728
4802
  name: "searchGoogle",
4729
4803
  description: "Search the web. Use to verify packages are current or find alternatives.",
@@ -4792,11 +4866,11 @@ var codeSanityCheckTool = {
4792
4866
  if (!context) {
4793
4867
  return "Error: code sanity check requires execution context";
4794
4868
  }
4795
- const specContext = loadSpecContext();
4869
+ const specIndex = loadSpecIndex();
4796
4870
  const parts = [BASE_PROMPT3, loadPlatformBrief()];
4797
4871
  parts.push("<!-- cache_breakpoint -->");
4798
- if (specContext) {
4799
- parts.push(specContext);
4872
+ if (specIndex) {
4873
+ parts.push(specIndex);
4800
4874
  }
4801
4875
  const system = parts.join("\n\n");
4802
4876
  const result = await runSubAgent({