@mindstudio-ai/remy 0.1.313 → 0.1.315

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/index.js CHANGED
@@ -1389,179 +1389,6 @@ var init_sdkConsultant = __esm({
1389
1389
  }
1390
1390
  });
1391
1391
 
1392
- // src/usageLedger.ts
1393
- import fs8 from "fs";
1394
- function nanoToDollars(nano) {
1395
- return typeof nano === "number" ? nano / 1e9 : void 0;
1396
- }
1397
- function recordUsage(entry) {
1398
- try {
1399
- if (fd === null) {
1400
- fs8.mkdirSync(".logs", { recursive: true });
1401
- fd = fs8.openSync(LEDGER_FILE, "a");
1402
- }
1403
- fs8.writeSync(fd, JSON.stringify(entry) + "\n");
1404
- } catch {
1405
- }
1406
- }
1407
- var LEDGER_FILE, fd;
1408
- var init_usageLedger = __esm({
1409
- "src/usageLedger.ts"() {
1410
- "use strict";
1411
- LEDGER_FILE = ".logs/usage.ndjson";
1412
- fd = null;
1413
- }
1414
- });
1415
-
1416
- // src/subagents/common/runMindstudioCli.ts
1417
- function stripFlags(args2) {
1418
- const out = [];
1419
- for (let i = 0; i < args2.length; i++) {
1420
- const arg = args2[i];
1421
- if (arg === "--no-meta") {
1422
- continue;
1423
- }
1424
- if (arg === "--output-key") {
1425
- i++;
1426
- continue;
1427
- }
1428
- out.push(arg);
1429
- }
1430
- return out;
1431
- }
1432
- async function runMindstudioCliResult(args2, options) {
1433
- const cleanArgs = stripFlags(args2);
1434
- const cliAction = args2[0];
1435
- const agentName = options?.caller ?? "mindstudio-cli";
1436
- const start = Date.now();
1437
- const res = await runCli("mindstudio", cleanArgs, options);
1438
- if (!res.ok) {
1439
- return { ok: false, value: formatCliResult(res) };
1440
- }
1441
- const truncNote = res.truncated ? "\n\n[output truncated]" : "";
1442
- let envelope;
1443
- try {
1444
- envelope = JSON.parse(res.output);
1445
- } catch {
1446
- return { ok: true, value: res.output + truncNote };
1447
- }
1448
- if (envelope && typeof envelope === "object" && Array.isArray(envelope.results)) {
1449
- const durationMs = Date.now() - start;
1450
- for (const step of envelope.results) {
1451
- if (typeof step?.billingCost === "number") {
1452
- recordUsage({
1453
- ts: Date.now(),
1454
- agentName,
1455
- cliAction: `${cliAction}:${step.stepType ?? "step"}`,
1456
- cost: nanoToDollars(step.billingCost),
1457
- inputTokens: 0,
1458
- outputTokens: 0,
1459
- durationMs,
1460
- toolNames: []
1461
- });
1462
- }
1463
- }
1464
- return { ok: true, value: JSON.stringify(envelope.results) + truncNote };
1465
- }
1466
- if (typeof envelope?.$billingCost === "number") {
1467
- recordUsage({
1468
- ts: Date.now(),
1469
- agentName,
1470
- cliAction,
1471
- cost: nanoToDollars(envelope.$billingCost),
1472
- billingEvents: envelope.$billingEvents,
1473
- // CLI billing isn't expressed as input/output tokens for most actions
1474
- // (image gen is per-image, scrape per-page, etc). `numUnits` inside each
1475
- // billingEvent carries the per-event unit count.
1476
- inputTokens: 0,
1477
- outputTokens: 0,
1478
- durationMs: Date.now() - start,
1479
- toolNames: []
1480
- });
1481
- }
1482
- if (options?.outputKey) {
1483
- const v = envelope?.[options.outputKey];
1484
- if (v === void 0 || v === null) {
1485
- return { ok: false, value: JSON.stringify(stripDollarKeys(envelope)) };
1486
- }
1487
- const value = typeof v === "string" ? v : JSON.stringify(v);
1488
- return { ok: true, value: value + truncNote };
1489
- }
1490
- return {
1491
- ok: true,
1492
- value: JSON.stringify(stripDollarKeys(envelope)) + truncNote
1493
- };
1494
- }
1495
- async function runMindstudioCli(args2, options) {
1496
- return (await runMindstudioCliResult(args2, options)).value;
1497
- }
1498
- function stripDollarKeys(envelope) {
1499
- if (!envelope || typeof envelope !== "object" || Array.isArray(envelope)) {
1500
- return envelope;
1501
- }
1502
- const out = {};
1503
- for (const [k, v] of Object.entries(envelope)) {
1504
- if (!k.startsWith("$")) {
1505
- out[k] = v;
1506
- }
1507
- }
1508
- return out;
1509
- }
1510
- var init_runMindstudioCli = __esm({
1511
- "src/subagents/common/runMindstudioCli.ts"() {
1512
- "use strict";
1513
- init_runCli();
1514
- init_usageLedger();
1515
- }
1516
- });
1517
-
1518
- // src/tools/common/searchGoogle.ts
1519
- var FETCH_TOP_N, searchGoogleTool;
1520
- var init_searchGoogle = __esm({
1521
- "src/tools/common/searchGoogle.ts"() {
1522
- "use strict";
1523
- init_runMindstudioCli();
1524
- init_runCli();
1525
- FETCH_TOP_N = 5;
1526
- searchGoogleTool = {
1527
- definition: {
1528
- name: "searchGoogle",
1529
- description: "Search Google and return results. Use for research, finding documentation, looking up APIs, or any task where web search would help. The top results come back with their page content already included, so read those before reaching for scrapeWebUrl \u2014 you only need that for URLs this did not return, or for a result further down the list.",
1530
- inputSchema: {
1531
- type: "object",
1532
- properties: {
1533
- query: {
1534
- type: "string",
1535
- description: "The search query."
1536
- }
1537
- },
1538
- required: ["query"]
1539
- }
1540
- },
1541
- async execute(input, context) {
1542
- const query = input.query;
1543
- return runMindstudioCli(
1544
- [
1545
- "search-google",
1546
- "--query",
1547
- query,
1548
- "--export-type",
1549
- "json",
1550
- "--fetch-top-n",
1551
- String(FETCH_TOP_N)
1552
- ],
1553
- {
1554
- outputKey: "results",
1555
- maxBuffer: SEARCH_MAX_BUFFER,
1556
- onLog: context?.onLog,
1557
- caller: "parent"
1558
- }
1559
- );
1560
- }
1561
- };
1562
- }
1563
- });
1564
-
1565
1392
  // src/tools/common/setProjectMetadata.ts
1566
1393
  var setProjectMetadataTool;
1567
1394
  var init_setProjectMetadata = __esm({
@@ -1601,7 +1428,7 @@ var init_setProjectMetadata = __esm({
1601
1428
  });
1602
1429
 
1603
1430
  // src/assets.ts
1604
- import fs9 from "fs";
1431
+ import fs8 from "fs";
1605
1432
  import path3 from "path";
1606
1433
  function assetPath(...segments) {
1607
1434
  return path3.join(ASSETS_BASE, ...segments);
@@ -1609,7 +1436,7 @@ function assetPath(...segments) {
1609
1436
  function readAsset(...segments) {
1610
1437
  const full = assetPath(...segments);
1611
1438
  try {
1612
- return fs9.readFileSync(full, "utf-8").trim();
1439
+ return fs8.readFileSync(full, "utf-8").trim();
1613
1440
  } catch {
1614
1441
  throw new Error(`Required asset missing: ${full}`);
1615
1442
  }
@@ -1617,7 +1444,7 @@ function readAsset(...segments) {
1617
1444
  function readJsonAsset(fallback, ...segments) {
1618
1445
  const full = assetPath(...segments);
1619
1446
  try {
1620
- return JSON.parse(fs9.readFileSync(full, "utf-8"));
1447
+ return JSON.parse(fs8.readFileSync(full, "utf-8"));
1621
1448
  } catch {
1622
1449
  return fallback;
1623
1450
  }
@@ -1683,6 +1510,30 @@ var init_sentinel = __esm({
1683
1510
  }
1684
1511
  });
1685
1512
 
1513
+ // src/usageLedger.ts
1514
+ import fs9 from "fs";
1515
+ function nanoToDollars(nano) {
1516
+ return typeof nano === "number" ? nano / 1e9 : void 0;
1517
+ }
1518
+ function recordUsage(entry) {
1519
+ try {
1520
+ if (fd === null) {
1521
+ fs9.mkdirSync(".logs", { recursive: true });
1522
+ fd = fs9.openSync(LEDGER_FILE, "a");
1523
+ }
1524
+ fs9.writeSync(fd, JSON.stringify(entry) + "\n");
1525
+ } catch {
1526
+ }
1527
+ }
1528
+ var LEDGER_FILE, fd;
1529
+ var init_usageLedger = __esm({
1530
+ "src/usageLedger.ts"() {
1531
+ "use strict";
1532
+ LEDGER_FILE = ".logs/usage.ndjson";
1533
+ fd = null;
1534
+ }
1535
+ });
1536
+
1686
1537
  // src/compaction/index.ts
1687
1538
  async function compactConversation(messages, apiConfig, model, signal) {
1688
1539
  const endIndex = findSafeInsertionPoint(messages);
@@ -2096,7 +1947,7 @@ var init_compaction = __esm({
2096
1947
  init_api();
2097
1948
  init_assets();
2098
1949
  init_sentinel();
2099
- init_tools8();
1950
+ init_tools9();
2100
1951
  init_logger();
2101
1952
  init_usageLedger();
2102
1953
  log2 = createLogger("compaction");
@@ -2200,6 +2051,13 @@ var init_surfaces = __esm({
2200
2051
  modelType: "text",
2201
2052
  userPickable: true
2202
2053
  },
2054
+ research: {
2055
+ default: "claude-5-sonnet",
2056
+ label: "Research Agent",
2057
+ description: "Researches using the web and reports back with citations.",
2058
+ modelType: "text",
2059
+ userPickable: true
2060
+ },
2203
2061
  copyEditor: {
2204
2062
  default: "claude-5-sonnet",
2205
2063
  label: "Copy Agent",
@@ -2285,6 +2143,8 @@ var init_surfaces = __esm({
2285
2143
  // 500K window
2286
2144
  "glm-5.2": { forceCompactAt: 85e4 },
2287
2145
  "muse-spark-1.1": { forceCompactAt: 85e4 },
2146
+ "muse-spark-1.2": { forceCompactAt: 85e4 },
2147
+ "muse-spark-1.3": { forceCompactAt: 85e4 },
2288
2148
  "kimi-k2-7-code": { forceCompactAt: 2e5 },
2289
2149
  // 262K window
2290
2150
  "kimi-k3": { forceCompactAt: 85e4 },
@@ -4322,6 +4182,108 @@ var init_queryDatabase = __esm({
4322
4182
  }
4323
4183
  });
4324
4184
 
4185
+ // src/subagents/common/runMindstudioCli.ts
4186
+ function stripFlags(args2) {
4187
+ const out = [];
4188
+ for (let i = 0; i < args2.length; i++) {
4189
+ const arg = args2[i];
4190
+ if (arg === "--no-meta") {
4191
+ continue;
4192
+ }
4193
+ if (arg === "--output-key") {
4194
+ i++;
4195
+ continue;
4196
+ }
4197
+ out.push(arg);
4198
+ }
4199
+ return out;
4200
+ }
4201
+ async function runMindstudioCliResult(args2, options) {
4202
+ const cleanArgs = stripFlags(args2);
4203
+ const cliAction = args2[0];
4204
+ const agentName = options?.caller ?? "mindstudio-cli";
4205
+ const start = Date.now();
4206
+ const res = await runCli("mindstudio", cleanArgs, options);
4207
+ if (!res.ok) {
4208
+ return { ok: false, value: formatCliResult(res) };
4209
+ }
4210
+ const truncNote = res.truncated ? "\n\n[output truncated]" : "";
4211
+ let envelope;
4212
+ try {
4213
+ envelope = JSON.parse(res.output);
4214
+ } catch {
4215
+ return { ok: true, value: res.output + truncNote };
4216
+ }
4217
+ if (envelope && typeof envelope === "object" && Array.isArray(envelope.results)) {
4218
+ const durationMs = Date.now() - start;
4219
+ for (const step of envelope.results) {
4220
+ if (typeof step?.billingCost === "number") {
4221
+ recordUsage({
4222
+ ts: Date.now(),
4223
+ agentName,
4224
+ cliAction: `${cliAction}:${step.stepType ?? "step"}`,
4225
+ cost: nanoToDollars(step.billingCost),
4226
+ inputTokens: 0,
4227
+ outputTokens: 0,
4228
+ durationMs,
4229
+ toolNames: []
4230
+ });
4231
+ }
4232
+ }
4233
+ return { ok: true, value: JSON.stringify(envelope.results) + truncNote };
4234
+ }
4235
+ if (typeof envelope?.$billingCost === "number") {
4236
+ recordUsage({
4237
+ ts: Date.now(),
4238
+ agentName,
4239
+ cliAction,
4240
+ cost: nanoToDollars(envelope.$billingCost),
4241
+ billingEvents: envelope.$billingEvents,
4242
+ // CLI billing isn't expressed as input/output tokens for most actions
4243
+ // (image gen is per-image, scrape per-page, etc). `numUnits` inside each
4244
+ // billingEvent carries the per-event unit count.
4245
+ inputTokens: 0,
4246
+ outputTokens: 0,
4247
+ durationMs: Date.now() - start,
4248
+ toolNames: []
4249
+ });
4250
+ }
4251
+ if (options?.outputKey) {
4252
+ const v = envelope?.[options.outputKey];
4253
+ if (v === void 0 || v === null) {
4254
+ return { ok: false, value: JSON.stringify(stripDollarKeys(envelope)) };
4255
+ }
4256
+ const value = typeof v === "string" ? v : JSON.stringify(v);
4257
+ return { ok: true, value: value + truncNote };
4258
+ }
4259
+ return {
4260
+ ok: true,
4261
+ value: JSON.stringify(stripDollarKeys(envelope)) + truncNote
4262
+ };
4263
+ }
4264
+ async function runMindstudioCli(args2, options) {
4265
+ return (await runMindstudioCliResult(args2, options)).value;
4266
+ }
4267
+ function stripDollarKeys(envelope) {
4268
+ if (!envelope || typeof envelope !== "object" || Array.isArray(envelope)) {
4269
+ return envelope;
4270
+ }
4271
+ const out = {};
4272
+ for (const [k, v] of Object.entries(envelope)) {
4273
+ if (!k.startsWith("$")) {
4274
+ out[k] = v;
4275
+ }
4276
+ }
4277
+ return out;
4278
+ }
4279
+ var init_runMindstudioCli = __esm({
4280
+ "src/subagents/common/runMindstudioCli.ts"() {
4281
+ "use strict";
4282
+ init_runCli();
4283
+ init_usageLedger();
4284
+ }
4285
+ });
4286
+
4325
4287
  // src/tools/_helpers/uploadImage.ts
4326
4288
  import { readFile, stat } from "fs/promises";
4327
4289
  import { basename, extname, resolve } from "path";
@@ -5653,7 +5615,7 @@ The first-party SDK (@mindstudio-ai/agent) provides access to 200+ AI models (Op
5653
5615
  ## What Remy apps are NOT good for
5654
5616
 
5655
5617
  - Native mobile apps (iOS/Android). Mobile-responsive web apps are fine.
5656
- - Fast-twitch multiplayer and live co-editing (shared cursors, 60fps sync) \u2014 client\u2192server is always a method invoke, so sub-100ms bidirectional interaction isn't a fit.
5618
+ - Real-time action games (server-authoritative simulation, guaranteed-order sync) \u2014 event delivery is at-most-once and ordering is the app's job, so there is no server tick to build one on.
5657
5619
  </platform_brief>`;
5658
5620
  }
5659
5621
  var init_context = __esm({
@@ -5818,7 +5780,7 @@ var log9, CAPTURE_COMMANDS, browserAutomationTool;
5818
5780
  var init_browserAutomation = __esm({
5819
5781
  "src/subagents/browserAutomation/index.ts"() {
5820
5782
  "use strict";
5821
- init_tools8();
5783
+ init_tools9();
5822
5784
  init_runner();
5823
5785
  init_tools2();
5824
5786
  init_tools();
@@ -5983,62 +5945,175 @@ var init_screenshot2 = __esm({
5983
5945
  }
5984
5946
  });
5985
5947
 
5986
- // src/subagents/designExpert/tools/searchGoogle.ts
5987
- var searchGoogle_exports = {};
5988
- __export(searchGoogle_exports, {
5989
- definition: () => definition,
5990
- execute: () => execute
5991
- });
5992
- async function execute(input, onLog) {
5948
+ // src/subagents/research/tools.ts
5949
+ async function executeSearchGoogle(input, onLog, caller) {
5950
+ const fetchTopN = Math.max(0, Math.round(Number(input.fetchTopN) || 0));
5993
5951
  return runMindstudioCli(
5994
5952
  [
5995
5953
  "search-google",
5996
5954
  "--query",
5997
- input.query,
5955
+ String(input.query),
5998
5956
  "--export-type",
5999
5957
  "json",
6000
5958
  "--fetch-top-n",
6001
- String(FETCH_TOP_N2)
5959
+ String(fetchTopN)
6002
5960
  ],
6003
5961
  {
6004
5962
  outputKey: "results",
5963
+ maxBuffer: SEARCH_MAX_BUFFER,
6005
5964
  onLog,
6006
- caller: "designExpert",
6007
- maxBuffer: SEARCH_MAX_BUFFER
5965
+ caller
6008
5966
  }
6009
5967
  );
6010
5968
  }
6011
- var FETCH_TOP_N2, definition;
6012
- var init_searchGoogle2 = __esm({
6013
- "src/subagents/designExpert/tools/searchGoogle.ts"() {
5969
+ async function executeScrapeWebUrl(input, onLog, caller) {
5970
+ return runMindstudioCli(
5971
+ [
5972
+ "scrape-url",
5973
+ "--url",
5974
+ String(input.url),
5975
+ "--page-options",
5976
+ JSON.stringify({ onlyMainContent: true })
5977
+ ],
5978
+ {
5979
+ maxBuffer: SCRAPE_MAX_BUFFER,
5980
+ onLog,
5981
+ caller
5982
+ }
5983
+ );
5984
+ }
5985
+ var searchGoogleDefinition, scrapeWebUrlDefinition, RESEARCH_TOOLS;
5986
+ var init_tools3 = __esm({
5987
+ "src/subagents/research/tools.ts"() {
6014
5988
  "use strict";
5989
+ init_tools();
6015
5990
  init_runMindstudioCli();
6016
5991
  init_runCli();
6017
- FETCH_TOP_N2 = 5;
6018
- definition = {
5992
+ init_bash();
5993
+ searchGoogleDefinition = {
6019
5994
  name: "searchGoogle",
6020
- description: 'Search Google for web results. Reserch modern design trends in industries or verticals, "best [domain] apps 2026", ui patterns, or find something specific if the the user has an explicit reference. Searching for and reading case studies is a great way to get information and context about a project\'s domain. Prioritize authoritative sources like Figma and other design leaders, avoid random blog spam. The top results come back with their page content already included, so read those directly \u2014 only use `scrapeWebUrl` for a result further down the list, or for a URL this did not return.',
5995
+ description: "Search Google. Returns ~25 results (title, description, URL) \u2014 fast (~5s) when `fetchTopN` is omitted. Set `fetchTopN` (3\u20135) to also get the top results' page content inline, capped at ~4,000 chars per page \u2014 one call delivers excerpts, but it is much slower (~30\u201360s). Default pattern: fire SERP-only searches in parallel, then scrape the specific pages worth reading in full.",
6021
5996
  inputSchema: {
6022
5997
  type: "object",
6023
5998
  properties: {
6024
5999
  query: {
6025
6000
  type: "string",
6026
6001
  description: "The search query."
6002
+ },
6003
+ fetchTopN: {
6004
+ type: "number",
6005
+ description: "Also fetch page content (capped ~4,000 chars each) for this many top results. Omit for a fast SERP-only search."
6027
6006
  }
6028
6007
  },
6029
6008
  required: ["query"]
6030
6009
  }
6031
6010
  };
6011
+ scrapeWebUrlDefinition = {
6012
+ name: "scrapeWebUrl",
6013
+ description: "Fetch a web page as markdown. Renders JavaScript, so client-rendered pages come back complete. Returns the full page \u2014 long docs can run tens of thousands of tokens, so fetch only pages you have chosen to read, and fire independent fetches in parallel. For code hosted on GitHub/npm, prefer cloning with bash over scraping the repo page.",
6014
+ inputSchema: {
6015
+ type: "object",
6016
+ properties: {
6017
+ url: {
6018
+ type: "string",
6019
+ description: "The URL to fetch."
6020
+ }
6021
+ },
6022
+ required: ["url"]
6023
+ }
6024
+ };
6025
+ RESEARCH_TOOLS = [
6026
+ ...COMMON_READ_TOOLS,
6027
+ searchGoogleDefinition,
6028
+ scrapeWebUrlDefinition,
6029
+ bashTool.definition
6030
+ ];
6031
+ }
6032
+ });
6033
+
6034
+ // src/subagents/research/index.ts
6035
+ async function runResearch(task, context) {
6036
+ const specIndex = loadSpecIndex();
6037
+ const parts = [BASE_PROMPT2, loadPlatformBrief()];
6038
+ parts.push("<!-- cache_breakpoint -->");
6039
+ if (specIndex) {
6040
+ parts.push(specIndex);
6041
+ }
6042
+ const system = parts.join("\n\n");
6043
+ const result = await runSubAgent({
6044
+ system,
6045
+ task,
6046
+ tools: RESEARCH_TOOLS,
6047
+ externalTools: /* @__PURE__ */ new Set(),
6048
+ executeTool: (name, toolInput, toolCallId, onLog, sams) => {
6049
+ const childCtx = toolCallId ? {
6050
+ ...deriveContext(context, toolCallId, onLog),
6051
+ subAgentMessages: sams
6052
+ } : context;
6053
+ if (name === "searchGoogle") {
6054
+ return executeSearchGoogle(toolInput, childCtx.onLog, "research");
6055
+ }
6056
+ if (name === "scrapeWebUrl") {
6057
+ return executeScrapeWebUrl(toolInput, childCtx.onLog, "research");
6058
+ }
6059
+ return executeTool(name, toolInput, childCtx);
6060
+ },
6061
+ apiConfig: context.apiConfig,
6062
+ model: resolveModel("research", context.models, context.model),
6063
+ subAgentId: "research",
6064
+ signal: context.signal,
6065
+ parentToolId: context.toolCallId,
6066
+ requestId: context.requestId,
6067
+ onEvent: context.onEvent,
6068
+ resolveExternalTool: context.resolveExternalTool,
6069
+ toolRegistry: context.toolRegistry
6070
+ });
6071
+ context.subAgentMessages?.set(context.toolCallId, result.messages);
6072
+ return result.text;
6073
+ }
6074
+ var BASE_PROMPT2, researchTool;
6075
+ var init_research = __esm({
6076
+ "src/subagents/research/index.ts"() {
6077
+ "use strict";
6078
+ init_assets();
6079
+ init_runner();
6080
+ init_context();
6081
+ init_tools9();
6082
+ init_tools3();
6083
+ init_surfaces();
6084
+ BASE_PROMPT2 = readAsset("subagents/research", "prompt.md");
6085
+ researchTool = {
6086
+ definition: {
6087
+ name: "research",
6088
+ description: "Your researcher. Hand it a question and it searches the web, reads the pages and source code that matter, and returns a distilled, citation-backed report. Use it for both objective research like third-party APIs and services, as well as for subjective things like current trends, patterns, and approaches (from architecture to UI to even just high-level framings and ideas). Brief it neutrally: state the question and the relevant project context, not the answer you expect.",
6089
+ inputSchema: {
6090
+ type: "object",
6091
+ properties: {
6092
+ task: {
6093
+ type: "string",
6094
+ description: "What you need to find out, in natural language, plus any project context it cannot get from reading the spec. Phrase it as a question to answer, not a conclusion to confirm."
6095
+ }
6096
+ },
6097
+ required: ["task"]
6098
+ }
6099
+ },
6100
+ async execute(input, context) {
6101
+ if (!context) {
6102
+ return "Error: research requires execution context";
6103
+ }
6104
+ return runResearch(input.task, context);
6105
+ }
6106
+ };
6032
6107
  }
6033
6108
  });
6034
6109
 
6035
6110
  // src/subagents/designExpert/tools/scrapeWebUrl.ts
6036
6111
  var scrapeWebUrl_exports = {};
6037
6112
  __export(scrapeWebUrl_exports, {
6038
- definition: () => definition2,
6039
- execute: () => execute2
6113
+ definition: () => definition,
6114
+ execute: () => execute
6040
6115
  });
6041
- async function execute2(input, onLog) {
6116
+ async function execute(input, onLog) {
6042
6117
  const pageOptions = { onlyMainContent: true };
6043
6118
  return runMindstudioCli(
6044
6119
  [
@@ -6051,15 +6126,15 @@ async function execute2(input, onLog) {
6051
6126
  { onLog, caller: "designExpert", maxBuffer: SCRAPE_MAX_BUFFER }
6052
6127
  );
6053
6128
  }
6054
- var definition2;
6129
+ var definition;
6055
6130
  var init_scrapeWebUrl = __esm({
6056
6131
  "src/subagents/designExpert/tools/scrapeWebUrl.ts"() {
6057
6132
  "use strict";
6058
6133
  init_runMindstudioCli();
6059
6134
  init_runCli();
6060
- definition2 = {
6135
+ definition = {
6061
6136
  name: "scrapeWebUrl",
6062
- description: "Fetch the content of a web page as markdown. Use when reading sites from search results or specific things the user wants to incorporate.",
6137
+ description: "Fetch the content of a web page as markdown. Use for reading a specific URL \u2014 a site the user referenced, a brand to match, a page the researcher cited that you want in full.",
6063
6138
  inputSchema: {
6064
6139
  type: "object",
6065
6140
  properties: {
@@ -6078,14 +6153,14 @@ var init_scrapeWebUrl = __esm({
6078
6153
  var renderImage_exports = {};
6079
6154
  __export(renderImage_exports, {
6080
6155
  RENDER_ANALYZE_PROMPT: () => RENDER_ANALYZE_PROMPT,
6081
- definition: () => definition3,
6082
- execute: () => execute3
6156
+ definition: () => definition2,
6157
+ execute: () => execute2
6083
6158
  });
6084
6159
  import { mkdir, unlink, writeFile } from "fs/promises";
6085
6160
  import { tmpdir } from "os";
6086
6161
  import { dirname, join, resolve as resolve2, sep } from "path";
6087
6162
  import { randomUUID } from "crypto";
6088
- async function execute3(input, onLog, context) {
6163
+ async function execute2(input, onLog, context) {
6089
6164
  const html = typeof input.html === "string" ? input.html : "";
6090
6165
  const width = Math.round(Number(input.width));
6091
6166
  const height = Math.round(Number(input.height));
@@ -6169,7 +6244,7 @@ async function execute3(input, onLog, context) {
6169
6244
  ]
6170
6245
  });
6171
6246
  }
6172
- var MIN_DIMENSION, MAX_DIMENSION, RENDER_ANALYZE_PROMPT, definition3;
6247
+ var MIN_DIMENSION, MAX_DIMENSION, RENDER_ANALYZE_PROMPT, definition2;
6173
6248
  var init_renderImage = __esm({
6174
6249
  "src/subagents/designExpert/tools/images/renderImage.ts"() {
6175
6250
  "use strict";
@@ -6182,7 +6257,7 @@ var init_renderImage = __esm({
6182
6257
  MIN_DIMENSION = 16;
6183
6258
  MAX_DIMENSION = 4096;
6184
6259
  RENDER_ANALYZE_PROMPT = 'You are reviewing a browser-rendered graphic (composed from HTML/CSS by a designer) for fidelity. Report: whether the composition fills the full canvas or leaves unintended gaps at any edge, any clipped or overflowing text, whether custom webfonts appear to have loaded (distinctive letterforms vs generic fallback serif/sans), any misalignment or uneven spacing, any unintended scrollbars or default-styling artifacts, and \u2014 if the background is transparent \u2014 any fringing or stray opaque pixels at the edges. Then briefly describe the overall composition and how polished it looks. Be concise and practical. Respond only with your analysis as Markdown (starting with the title "Render Review") and absolutely no other text. Do not use emojis - use unicode if you need symbols.';
6185
- definition3 = {
6260
+ definition2 = {
6186
6261
  name: "renderImage",
6187
6262
  description: "Render a self-contained HTML document in a real browser and capture it as a hosted PNG at exact pixel dimensions, with a fidelity review included. Deterministic \u2014 exact hex colors, real loaded webfonts, precise geometry \u2014 unlike generateImages, which is an image model. Use for token-exact graphics: Open Graph share cards, wordmarks, flat/geometric icon tiles, badges, any composition where letterforms and spacing carry the design. Compose with HTML/CSS (link webfonts from CDNs \u2014 the renderer waits for them to load); inline existing SVG markup when needed, but never hand-write new SVG path data.",
6188
6263
  inputSchema: {
@@ -6222,8 +6297,8 @@ var init_renderImage = __esm({
6222
6297
  // src/subagents/designExpert/tools/analyzeDesign.ts
6223
6298
  var analyzeDesign_exports = {};
6224
6299
  __export(analyzeDesign_exports, {
6225
- definition: () => definition4,
6226
- execute: () => execute4
6300
+ definition: () => definition3,
6301
+ execute: () => execute3
6227
6302
  });
6228
6303
  import { readFile as readFile2 } from "fs/promises";
6229
6304
  import { extname as extname2, join as join2 } from "path";
@@ -6245,7 +6320,7 @@ function splitFrontmatter(raw) {
6245
6320
  html: raw.slice(match[0].length)
6246
6321
  };
6247
6322
  }
6248
- async function execute4(input, onLog, context) {
6323
+ async function execute3(input, onLog, context) {
6249
6324
  const url = String(input.url ?? "").trim();
6250
6325
  if (!url) {
6251
6326
  return "Error: url is required.";
@@ -6349,7 +6424,7 @@ ${basePrompt}` : basePrompt;
6349
6424
  renderedHeight: rendered.height
6350
6425
  });
6351
6426
  }
6352
- var DESIGN_REFERENCE_PROMPT, definition4, IMAGE_EXT_RE, HTML_EXTS, HTML_RENDER_WIDTH, HTML_RENDER_START_HEIGHT;
6427
+ var DESIGN_REFERENCE_PROMPT, definition3, IMAGE_EXT_RE, HTML_EXTS, HTML_RENDER_WIDTH, HTML_RENDER_START_HEIGHT;
6353
6428
  var init_analyzeDesign = __esm({
6354
6429
  "src/subagents/designExpert/tools/analyzeDesign.ts"() {
6355
6430
  "use strict";
@@ -6384,7 +6459,7 @@ Identify the specific design moves that make this page interesting and unique, d
6384
6459
 
6385
6460
  Respond only with your analysis as Markdown and absolutely no other text. Do not use emojis - use unicode if you need symbols.
6386
6461
  `;
6387
- definition4 = {
6462
+ definition3 = {
6388
6463
  name: "analyzeDesign",
6389
6464
  description: "Analyze the visual design of a website, an image (URL or file on disk), or an HTML document on disk. Websites are screenshotted first; an HTML file is rendered in a real browser first and the render is analyzed, which is how you look at a wireframe you authored. Provides static image analysis only, will not capture animations or video. With no prompt, a website or image gets a full design reference analysis (mood, color, typography, layout, distinctiveness) and a rendered HTML document gets a fidelity review (clipping, overflow, webfont loading, alignment). Provide a custom prompt to ask a specific design question instead. Use a bulleted list to ask many questions at once.",
6390
6465
  inputSchema: {
@@ -6412,10 +6487,10 @@ Respond only with your analysis as Markdown and absolutely no other text. Do not
6412
6487
  // src/subagents/designExpert/tools/analyzeImage.ts
6413
6488
  var analyzeImage_exports = {};
6414
6489
  __export(analyzeImage_exports, {
6415
- definition: () => definition5,
6416
- execute: () => execute5
6490
+ definition: () => definition4,
6491
+ execute: () => execute4
6417
6492
  });
6418
- async function execute5(input, onLog, context) {
6493
+ async function execute4(input, onLog, context) {
6419
6494
  const prompt = buildScreenshotAnalysisPrompt({
6420
6495
  prompt: input.prompt
6421
6496
  });
@@ -6428,14 +6503,14 @@ async function execute5(input, onLog, context) {
6428
6503
  });
6429
6504
  return JSON.stringify({ url, analysis });
6430
6505
  }
6431
- var definition5;
6506
+ var definition4;
6432
6507
  var init_analyzeImage2 = __esm({
6433
6508
  "src/subagents/designExpert/tools/analyzeImage.ts"() {
6434
6509
  "use strict";
6435
6510
  init_analyzeImage();
6436
6511
  init_screenshot();
6437
6512
  init_surfaces();
6438
- definition5 = {
6513
+ definition4 = {
6439
6514
  name: "analyzeImage",
6440
6515
  description: "Analyze an image using a vision model. Provides static image analysis only, will not capture animations or video. Returns an objective description of what is visible \u2014 shapes, colors, layout, text, artifacts. Use for factual inventory of image contents, not for subjective design judgment - the vision model providing the analysis has no sense of design. You are the design expert - use the analysis tool for factual inventory, then apply your own expertise for quality and suitability assessments. Optionally provide specific questions about what you're looking for. Use a bulleted list to ask many questions at once. If you are analyzing a screenshot of the app preview, you can reuse the same screenshot URL multiple times to ask multiple questions.",
6441
6516
  inputSchema: {
@@ -6703,10 +6778,10 @@ var init_imageGenerator = __esm({
6703
6778
  // src/subagents/designExpert/tools/images/generateImages.ts
6704
6779
  var generateImages_exports = {};
6705
6780
  __export(generateImages_exports, {
6706
- definition: () => definition6,
6707
- execute: () => execute6
6781
+ definition: () => definition5,
6782
+ execute: () => execute5
6708
6783
  });
6709
- async function execute6(input, onLog, context) {
6784
+ async function execute5(input, onLog, context) {
6710
6785
  return generateImageAssets({
6711
6786
  prompts: input.prompts,
6712
6787
  width: input.width,
@@ -6733,13 +6808,13 @@ async function execute6(input, onLog, context) {
6733
6808
  )
6734
6809
  });
6735
6810
  }
6736
- var definition6;
6811
+ var definition5;
6737
6812
  var init_generateImages = __esm({
6738
6813
  "src/subagents/designExpert/tools/images/generateImages.ts"() {
6739
6814
  "use strict";
6740
6815
  init_imageGenerator();
6741
6816
  init_surfaces();
6742
- definition6 = {
6817
+ definition5 = {
6743
6818
  name: "generateImages",
6744
6819
  description: "Generate images. Returns CDN URLs with a quality analysis for each image. Produces high-quality results for everything from photorealistic images and abstract/creative visuals. Pass multiple prompts to generate in parallel. No need to analyze images separately after generating \u2014 the analysis is included.",
6745
6820
  inputSchema: {
@@ -6778,10 +6853,10 @@ var init_generateImages = __esm({
6778
6853
  // src/subagents/designExpert/tools/images/editImages.ts
6779
6854
  var editImages_exports = {};
6780
6855
  __export(editImages_exports, {
6781
- definition: () => definition7,
6782
- execute: () => execute7
6856
+ definition: () => definition6,
6857
+ execute: () => execute6
6783
6858
  });
6784
- async function execute7(input, onLog, context) {
6859
+ async function execute6(input, onLog, context) {
6785
6860
  return generateImageAssets({
6786
6861
  prompts: input.prompts,
6787
6862
  sourceImages: input.sourceImages,
@@ -6808,13 +6883,13 @@ async function execute7(input, onLog, context) {
6808
6883
  )
6809
6884
  });
6810
6885
  }
6811
- var definition7;
6886
+ var definition6;
6812
6887
  var init_editImages = __esm({
6813
6888
  "src/subagents/designExpert/tools/images/editImages.ts"() {
6814
6889
  "use strict";
6815
6890
  init_imageGenerator();
6816
6891
  init_surfaces();
6817
- definition7 = {
6892
+ definition6 = {
6818
6893
  name: "editImages",
6819
6894
  description: "Edit or transform existing images. Provide one or more source image URLs as reference and a prompt describing the desired edit. Use for compositing, style transfer, subject transformation, blending multiple references, or incorporating one or more references into something new. Returns CDN URLs with analysis.",
6820
6895
  inputSchema: {
@@ -6855,7 +6930,7 @@ var init_editImages = __esm({
6855
6930
 
6856
6931
  // src/subagents/copyEditor/tools.ts
6857
6932
  var COPY_EDITOR_TOOLS;
6858
- var init_tools3 = __esm({
6933
+ var init_tools4 = __esm({
6859
6934
  "src/subagents/copyEditor/tools.ts"() {
6860
6935
  "use strict";
6861
6936
  init_tools();
@@ -6864,17 +6939,17 @@ var init_tools3 = __esm({
6864
6939
  });
6865
6940
 
6866
6941
  // src/subagents/copyEditor/index.ts
6867
- var BASE_PROMPT2, copyEditorTool;
6942
+ var BASE_PROMPT3, copyEditorTool;
6868
6943
  var init_copyEditor = __esm({
6869
6944
  "src/subagents/copyEditor/index.ts"() {
6870
6945
  "use strict";
6871
6946
  init_assets();
6872
6947
  init_runner();
6873
6948
  init_context();
6874
- init_tools8();
6875
- init_tools3();
6949
+ init_tools9();
6950
+ init_tools4();
6876
6951
  init_surfaces();
6877
- BASE_PROMPT2 = readAsset("subagents/copyEditor", "prompt.md");
6952
+ BASE_PROMPT3 = readAsset("subagents/copyEditor", "prompt.md");
6878
6953
  copyEditorTool = {
6879
6954
  definition: {
6880
6955
  name: "copyEditor",
@@ -6895,7 +6970,7 @@ var init_copyEditor = __esm({
6895
6970
  return "Error: copy editor requires execution context";
6896
6971
  }
6897
6972
  const specIndex = loadSpecIndex();
6898
- const parts = [BASE_PROMPT2];
6973
+ const parts = [BASE_PROMPT3];
6899
6974
  parts.push("<!-- cache_breakpoint -->");
6900
6975
  if (specIndex) {
6901
6976
  parts.push(specIndex);
@@ -6933,18 +7008,18 @@ var init_copyEditor = __esm({
6933
7008
  // src/subagents/designExpert/tools/polishCopy.ts
6934
7009
  var polishCopy_exports = {};
6935
7010
  __export(polishCopy_exports, {
6936
- definition: () => definition8,
6937
- execute: () => execute8
7011
+ definition: () => definition7,
7012
+ execute: () => execute7
6938
7013
  });
6939
- async function execute8(input, _onLog, context) {
7014
+ async function execute7(input, _onLog, context) {
6940
7015
  return copyEditorTool.execute(input, context);
6941
7016
  }
6942
- var definition8;
7017
+ var definition7;
6943
7018
  var init_polishCopy = __esm({
6944
7019
  "src/subagents/designExpert/tools/polishCopy.ts"() {
6945
7020
  "use strict";
6946
7021
  init_copyEditor();
6947
- definition8 = {
7022
+ definition7 = {
6948
7023
  name: "polishCopy",
6949
7024
  description: "Hand off any user-facing copy you've written \u2014 headlines, captions, labels, body text \u2014 and get back a sharper version: better built for its audience and free of the fingerprints that make writing read as AI. It elevates how the copy communicates without inventing facts or claims you didn't give it. Give it the text plus what it's for (where it appears, the audience).",
6950
7025
  inputSchema: {
@@ -6982,10 +7057,10 @@ A loaded reference drops out of the conversation once it ages out. Re-read it at
6982
7057
  // src/subagents/designExpert/tools/loadSkill.ts
6983
7058
  var loadSkill_exports = {};
6984
7059
  __export(loadSkill_exports, {
6985
- definition: () => definition9,
6986
- execute: () => execute9
7060
+ definition: () => definition8,
7061
+ execute: () => execute8
6987
7062
  });
6988
- async function execute9(input) {
7063
+ async function execute8(input) {
6989
7064
  const id = String(input.skill ?? "");
6990
7065
  const skill = designSkillCatalog.get(id);
6991
7066
  if (!skill) {
@@ -7001,12 +7076,12 @@ This reference lives at ${skill.path}. Re-read it with readFile if you need it a
7001
7076
  return `Error loading skill "${id}": ${err.message}`;
7002
7077
  }
7003
7078
  }
7004
- var definition9;
7079
+ var definition8;
7005
7080
  var init_loadSkill2 = __esm({
7006
7081
  "src/subagents/designExpert/tools/loadSkill.ts"() {
7007
7082
  "use strict";
7008
7083
  init_catalog2();
7009
- definition9 = {
7084
+ definition8 = {
7010
7085
  name: "loadSkill",
7011
7086
  description: "Load the full craft reference for a design surface that isn't in your prompt. The available skills and the trigger for each are listed in <available_skills>. Load one before designing in its area, not after \u2014 these are hard-won technique recipes, and the defaulted version of these surfaces is exactly what they exist to prevent. Calling this is cheap and expected \u2014 if you're unsure whether you need it, load it.",
7012
7087
  inputSchema: {
@@ -7031,8 +7106,8 @@ var init_loadSkill2 = __esm({
7031
7106
  var createWireframe_exports = {};
7032
7107
  __export(createWireframe_exports, {
7033
7108
  WIREFRAMES_DIR: () => WIREFRAMES_DIR,
7034
- definition: () => definition10,
7035
- execute: () => execute10
7109
+ definition: () => definition9,
7110
+ execute: () => execute9
7036
7111
  });
7037
7112
  import { mkdir as mkdir2, stat as stat2, writeFile as writeFile2 } from "fs/promises";
7038
7113
  import { join as join3 } from "path";
@@ -7103,7 +7178,7 @@ async function uploadMirror(context, slug, content) {
7103
7178
  return { ok: false, note: err.message };
7104
7179
  }
7105
7180
  }
7106
- async function execute10(input, onLog, context) {
7181
+ async function execute9(input, onLog, context) {
7107
7182
  if (!context) {
7108
7183
  return "Error: createWireframe requires execution context";
7109
7184
  }
@@ -7149,7 +7224,7 @@ async function execute10(input, onLog, context) {
7149
7224
  }
7150
7225
  return lines.join("\n");
7151
7226
  }
7152
- var log10, WIREFRAMES_DIR, UPLOAD_TIMEOUT_MS2, definition10, SLUG_RE;
7227
+ var log10, WIREFRAMES_DIR, UPLOAD_TIMEOUT_MS2, definition9, SLUG_RE;
7153
7228
  var init_createWireframe = __esm({
7154
7229
  "src/subagents/designExpert/tools/createWireframe.ts"() {
7155
7230
  "use strict";
@@ -7158,7 +7233,7 @@ var init_createWireframe = __esm({
7158
7233
  log10 = createLogger("createWireframe");
7159
7234
  WIREFRAMES_DIR = "src/.wireframes";
7160
7235
  UPLOAD_TIMEOUT_MS2 = 3e4;
7161
- definition10 = {
7236
+ definition9 = {
7162
7237
  name: "createWireframe",
7163
7238
  description: "Generate a wireframe from self-contained HTML+CSS you author and write it to disk as a design artifact. This is how a wireframe comes to exist \u2014 the way generateImages is how an image comes to exist \u2014 and the developer builds from the file it creates. The result also hands back the reference line that embeds the wireframe in your response and in specs; paste it wherever the wireframe belongs and it renders as a live preview. Calling again with the same slug revises the wireframe in place, so existing references stay current \u2014 a revision is a call to this tool, never a prose description of changes to an earlier wireframe.",
7164
7239
  inputSchema: {
@@ -7197,13 +7272,13 @@ async function executeDesignExpertTool(name, input, context, toolCallId, onLog)
7197
7272
  const childContext = context && toolCallId ? deriveContext(context, toolCallId, onLog) : context;
7198
7273
  return tool.execute(input, onLog, childContext);
7199
7274
  }
7200
- var tools, DESIGN_EXPERT_TOOLS;
7201
- var init_tools4 = __esm({
7275
+ var research, tools, DESIGN_EXPERT_TOOLS;
7276
+ var init_tools5 = __esm({
7202
7277
  "src/subagents/designExpert/tools/index.ts"() {
7203
7278
  "use strict";
7204
- init_tools8();
7279
+ init_tools9();
7205
7280
  init_tools();
7206
- init_searchGoogle2();
7281
+ init_research();
7207
7282
  init_scrapeWebUrl();
7208
7283
  init_analyzeDesign();
7209
7284
  init_analyzeImage2();
@@ -7214,8 +7289,29 @@ var init_tools4 = __esm({
7214
7289
  init_loadSkill2();
7215
7290
  init_createWireframe();
7216
7291
  init_screenshot2();
7292
+ research = {
7293
+ definition: {
7294
+ name: "research",
7295
+ description: "Your researcher, for design questions your built-in catalogs and expertise do not settle: how leading products present a specific kind of data or interaction, current conventions or best practices for a pattern, general-purpose ideas and inspiration. It searches the web, reads the sources that matter, and returns a distilled report with citations and concrete specifics. Brief it neutrally: the question or topic, not the answer you expect.",
7296
+ inputSchema: {
7297
+ type: "object",
7298
+ properties: {
7299
+ task: {
7300
+ type: "string",
7301
+ description: "What you need to find out, in natural language, with enough product context to make the findings relevant."
7302
+ }
7303
+ },
7304
+ required: ["task"]
7305
+ }
7306
+ },
7307
+ execute: (input, _onLog, context) => {
7308
+ if (!context) {
7309
+ return Promise.resolve("Error: research requires execution context");
7310
+ }
7311
+ return runResearch(input.task, context);
7312
+ }
7313
+ };
7217
7314
  tools = {
7218
- searchGoogle: searchGoogle_exports,
7219
7315
  scrapeWebUrl: scrapeWebUrl_exports,
7220
7316
  analyzeDesign: analyzeDesign_exports,
7221
7317
  analyzeImage: analyzeImage_exports,
@@ -7229,7 +7325,8 @@ var init_tools4 = __esm({
7229
7325
  polishCopy: polishCopy_exports,
7230
7326
  loadSkill: loadSkill_exports,
7231
7327
  // Appended last: tool order is part of the subagent's prompt-cache prefix.
7232
- createWireframe: createWireframe_exports
7328
+ createWireframe: createWireframe_exports,
7329
+ research
7233
7330
  };
7234
7331
  DESIGN_EXPERT_TOOLS = [
7235
7332
  ...COMMON_READ_TOOLS,
@@ -7708,9 +7805,9 @@ var DESCRIPTION, RENDER_WRITE_TOOL_NAMES, DESIGN_EXPERT_RENDER_TOOLS, designExpe
7708
7805
  var init_designExpert = __esm({
7709
7806
  "src/subagents/designExpert/index.ts"() {
7710
7807
  "use strict";
7711
- init_tools8();
7808
+ init_tools9();
7712
7809
  init_runner();
7713
- init_tools4();
7810
+ init_tools5();
7714
7811
  init_tools();
7715
7812
  init_prompt2();
7716
7813
  init_validateWireframeRefs();
@@ -7766,7 +7863,7 @@ Visual design expert. Describe the situation and what you need \u2014 the agent
7766
7863
 
7767
7864
  // src/subagents/productVision/tools.ts
7768
7865
  var VISION_TOOLS;
7769
- var init_tools5 = __esm({
7866
+ var init_tools6 = __esm({
7770
7867
  "src/subagents/productVision/tools.ts"() {
7771
7868
  "use strict";
7772
7869
  init_tools();
@@ -7936,7 +8033,7 @@ var init_executor = __esm({
7936
8033
  function getProductVisionPrompt() {
7937
8034
  const specIndex = loadSpecIndex();
7938
8035
  const roadmapIndex = loadRoadmapIndex();
7939
- const parts = [BASE_PROMPT3, loadPlatformBrief()];
8036
+ const parts = [BASE_PROMPT4, loadPlatformBrief()];
7940
8037
  parts.push("<!-- cache_breakpoint -->");
7941
8038
  if (specIndex) {
7942
8039
  parts.push(specIndex);
@@ -7946,13 +8043,13 @@ function getProductVisionPrompt() {
7946
8043
  }
7947
8044
  return parts.join("\n\n");
7948
8045
  }
7949
- var BASE_PROMPT3;
8046
+ var BASE_PROMPT4;
7950
8047
  var init_prompt3 = __esm({
7951
8048
  "src/subagents/productVision/prompt.ts"() {
7952
8049
  "use strict";
7953
8050
  init_assets();
7954
8051
  init_context();
7955
- BASE_PROMPT3 = readAsset("subagents/productVision", "prompt.md");
8052
+ BASE_PROMPT4 = readAsset("subagents/productVision", "prompt.md");
7956
8053
  }
7957
8054
  });
7958
8055
 
@@ -7961,9 +8058,9 @@ var productVisionTool;
7961
8058
  var init_productVision = __esm({
7962
8059
  "src/subagents/productVision/index.ts"() {
7963
8060
  "use strict";
7964
- init_tools8();
8061
+ init_tools9();
7965
8062
  init_runner();
7966
- init_tools5();
8063
+ init_tools6();
7967
8064
  init_tools();
7968
8065
  init_executor();
7969
8066
  init_prompt3();
@@ -8039,7 +8136,7 @@ var init_productVision = __esm({
8039
8136
 
8040
8137
  // src/subagents/codeSanityCheck/tools.ts
8041
8138
  var SANITY_CHECK_TOOLS;
8042
- var init_tools6 = __esm({
8139
+ var init_tools7 = __esm({
8043
8140
  "src/subagents/codeSanityCheck/tools.ts"() {
8044
8141
  "use strict";
8045
8142
  init_tools();
@@ -8088,23 +8185,40 @@ var init_tools6 = __esm({
8088
8185
  },
8089
8186
  required: ["command"]
8090
8187
  }
8188
+ },
8189
+ // Appended last: tool order is part of the subagent's prompt-cache prefix.
8190
+ {
8191
+ name: "research",
8192
+ description: "Deep researcher. When the plan hinges on an unfamiliar third-party service, API, or claim you cannot settle with a quick search, hand it the question \u2014 it researches properly (multiple sources, official docs, reading real source code) and returns a distilled, citation-backed report. Quick package-liveness checks stay on searchGoogle; use this when being wrong would be expensive. Brief it neutrally: the question, not the answer you expect.",
8193
+ inputSchema: {
8194
+ type: "object",
8195
+ properties: {
8196
+ task: {
8197
+ type: "string",
8198
+ description: "What you need to find out, in natural language."
8199
+ }
8200
+ },
8201
+ required: ["task"]
8202
+ }
8091
8203
  }
8092
8204
  ];
8093
8205
  }
8094
8206
  });
8095
8207
 
8096
8208
  // src/subagents/codeSanityCheck/index.ts
8097
- var BASE_PROMPT4, codeSanityCheckTool;
8209
+ var BASE_PROMPT5, codeSanityCheckTool;
8098
8210
  var init_codeSanityCheck = __esm({
8099
8211
  "src/subagents/codeSanityCheck/index.ts"() {
8100
8212
  "use strict";
8101
8213
  init_assets();
8102
8214
  init_runner();
8103
8215
  init_context();
8104
- init_tools8();
8105
- init_tools6();
8216
+ init_tools9();
8217
+ init_tools7();
8218
+ init_research();
8219
+ init_tools3();
8106
8220
  init_surfaces();
8107
- BASE_PROMPT4 = readAsset("subagents/codeSanityCheck", "prompt.md");
8221
+ BASE_PROMPT5 = readAsset("subagents/codeSanityCheck", "prompt.md");
8108
8222
  codeSanityCheckTool = {
8109
8223
  definition: {
8110
8224
  name: "codeSanityCheck",
@@ -8125,7 +8239,7 @@ var init_codeSanityCheck = __esm({
8125
8239
  return "Error: code sanity check requires execution context";
8126
8240
  }
8127
8241
  const specIndex = loadSpecIndex();
8128
- const parts = [BASE_PROMPT4, loadPlatformBrief()];
8242
+ const parts = [BASE_PROMPT5, loadPlatformBrief()];
8129
8243
  parts.push("<!-- cache_breakpoint -->");
8130
8244
  if (specIndex) {
8131
8245
  parts.push(specIndex);
@@ -8141,6 +8255,16 @@ var init_codeSanityCheck = __esm({
8141
8255
  ...deriveContext(context, toolCallId, onLog),
8142
8256
  subAgentMessages: sams
8143
8257
  } : context;
8258
+ if (name === "searchGoogle") {
8259
+ return executeSearchGoogle(
8260
+ { ...toolInput, fetchTopN: 5 },
8261
+ childCtx.onLog,
8262
+ "codeSanityCheck"
8263
+ );
8264
+ }
8265
+ if (name === "research") {
8266
+ return runResearch(String(toolInput.task ?? ""), childCtx);
8267
+ }
8144
8268
  return executeTool(name, toolInput, childCtx);
8145
8269
  },
8146
8270
  apiConfig: context.apiConfig,
@@ -8284,7 +8408,7 @@ The copy in <overview_copy> is final \u2014 it was authored and edited before it
8284
8408
 
8285
8409
  // src/subagents/specSync/tools.ts
8286
8410
  var SPEC_SYNC_TOOLS;
8287
- var init_tools7 = __esm({
8411
+ var init_tools8 = __esm({
8288
8412
  "src/subagents/specSync/tools.ts"() {
8289
8413
  "use strict";
8290
8414
  init_tools();
@@ -8319,19 +8443,19 @@ var init_lock = __esm({
8319
8443
  });
8320
8444
 
8321
8445
  // src/subagents/specSync/index.ts
8322
- var BASE_PROMPT5, MSFM_DOCS, specSyncTool;
8446
+ var BASE_PROMPT6, MSFM_DOCS, specSyncTool;
8323
8447
  var init_specSync = __esm({
8324
8448
  "src/subagents/specSync/index.ts"() {
8325
8449
  "use strict";
8326
8450
  init_assets();
8327
8451
  init_runner();
8328
8452
  init_context();
8329
- init_tools8();
8453
+ init_tools9();
8330
8454
  init_writeBuildOverview();
8331
- init_tools7();
8455
+ init_tools8();
8332
8456
  init_lock();
8333
8457
  init_surfaces();
8334
- BASE_PROMPT5 = readAsset("subagents/specSync", "prompt.md");
8458
+ BASE_PROMPT6 = readAsset("subagents/specSync", "prompt.md");
8335
8459
  MSFM_DOCS = `<mindstudio_flavored_markdown_spec_docs>
8336
8460
  ${readAsset(
8337
8461
  "prompt",
@@ -8370,7 +8494,7 @@ ${readAsset(
8370
8494
  }
8371
8495
  const specIndex = loadSpecIndex();
8372
8496
  const parts = [
8373
- BASE_PROMPT5,
8497
+ BASE_PROMPT6,
8374
8498
  loadPlatformBrief(),
8375
8499
  MSFM_DOCS,
8376
8500
  "<!-- cache_breakpoint -->"
@@ -8502,7 +8626,7 @@ function executeTool(name, input, context) {
8502
8626
  return tool.execute(input, context);
8503
8627
  }
8504
8628
  var ALL_TOOLS, SUBAGENT_TOOL_NAMES;
8505
- var init_tools8 = __esm({
8629
+ var init_tools9 = __esm({
8506
8630
  "src/tools/index.ts"() {
8507
8631
  "use strict";
8508
8632
  init_readSpec();
@@ -8516,7 +8640,6 @@ var init_tools8 = __esm({
8516
8640
  init_promptUser();
8517
8641
  init_confirmDestructiveAction();
8518
8642
  init_sdkConsultant();
8519
- init_searchGoogle();
8520
8643
  init_setProjectMetadata();
8521
8644
  init_compactConversation();
8522
8645
  init_loadSkill();
@@ -8541,6 +8664,7 @@ var init_tools8 = __esm({
8541
8664
  init_codeSanityCheck();
8542
8665
  init_copyEditor();
8543
8666
  init_specSync();
8667
+ init_research();
8544
8668
  init_scrapeWebUrl2();
8545
8669
  init_writeBuildOverview();
8546
8670
  ALL_TOOLS = [
@@ -8550,7 +8674,6 @@ var init_tools8 = __esm({
8550
8674
  confirmDestructiveActionTool,
8551
8675
  askMindStudioSdkTool,
8552
8676
  scrapeWebUrlTool,
8553
- searchGoogleTool,
8554
8677
  setProjectMetadataTool,
8555
8678
  designExpertTool,
8556
8679
  productVisionTool,
@@ -8589,7 +8712,8 @@ var init_tools8 = __esm({
8589
8712
  // Appended rather than grouped: position is part of the cache prefix, so a
8590
8713
  // new tool goes at the end to leave every existing session's prefix intact.
8591
8714
  loadSkillTool,
8592
- testJewelTool
8715
+ testJewelTool,
8716
+ researchTool
8593
8717
  ];
8594
8718
  SUBAGENT_TOOL_NAMES = /* @__PURE__ */ new Set([
8595
8719
  "visualDesignExpert",
@@ -8598,7 +8722,8 @@ var init_tools8 = __esm({
8598
8722
  "copyEditor",
8599
8723
  "specSync",
8600
8724
  "runAutomatedBrowserTest",
8601
- "askMindStudioSdk"
8725
+ "askMindStudioSdk",
8726
+ "research"
8602
8727
  ]);
8603
8728
  }
8604
8729
  });
@@ -10110,7 +10235,7 @@ var init_agent = __esm({
10110
10235
  "src/agent.ts"() {
10111
10236
  "use strict";
10112
10237
  init_api();
10113
- init_tools8();
10238
+ init_tools9();
10114
10239
  init_session();
10115
10240
  init_logger();
10116
10241
  init_usageLedger();
@@ -10821,7 +10946,7 @@ var init_headless = __esm({
10821
10946
  init_attachments();
10822
10947
  init_planFile();
10823
10948
  init_stats();
10824
- init_tools8();
10949
+ init_tools9();
10825
10950
  init_messageQueue();
10826
10951
  init_resolve();
10827
10952
  init_sentinel();