@mindstudio-ai/remy 0.1.138 → 0.1.139

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
@@ -2865,8 +2865,10 @@ async function runSubAgent(config) {
2865
2865
  requestId,
2866
2866
  history,
2867
2867
  background,
2868
- onBackgroundComplete
2868
+ onBackgroundComplete,
2869
+ captureArtifacts
2869
2870
  } = config;
2871
+ const artifacts = {};
2870
2872
  const bgAbort = background ? new AbortController() : null;
2871
2873
  const signal = background ? bgAbort.signal : parentSignal;
2872
2874
  const agentName = subAgentId || "sub-agent";
@@ -3038,7 +3040,12 @@ ${partial}` : "[INTERRUPTED] Agent was interrupted before producing output.",
3038
3040
  if (stopReason !== "tool_use" || toolCalls.length === 0) {
3039
3041
  statusWatcher.stop();
3040
3042
  const text = getPartialText(contentBlocks);
3041
- return { text, messages: thisInvocation() };
3043
+ const hasArtifacts = Object.keys(artifacts).length > 0;
3044
+ return {
3045
+ text,
3046
+ messages: thisInvocation(),
3047
+ ...hasArtifacts ? { artifacts } : {}
3048
+ };
3042
3049
  }
3043
3050
  log5.info("Tools executing", {
3044
3051
  requestId,
@@ -3149,6 +3156,12 @@ ${partial}` : "[INTERRUPTED] Agent was interrupted before producing output.",
3149
3156
  if (innerMsgs) {
3150
3157
  block.subAgentMessages = innerMsgs;
3151
3158
  }
3159
+ if (captureArtifacts?.includes(block.name) && !r.isError) {
3160
+ try {
3161
+ artifacts[block.name] = JSON.parse(r.result);
3162
+ } catch {
3163
+ }
3164
+ }
3152
3165
  }
3153
3166
  messages.push({
3154
3167
  role: "user",
@@ -3480,13 +3493,22 @@ var browserAutomationTool = {
3480
3493
  }
3481
3494
  return result2;
3482
3495
  },
3483
- toolRegistry: context.toolRegistry
3496
+ toolRegistry: context.toolRegistry,
3497
+ captureArtifacts: ["screenshotFullPage"]
3484
3498
  });
3485
3499
  try {
3486
3500
  await sidecarRequest("/reset-browser", {}, { timeout: 5e3 });
3487
3501
  } catch {
3488
3502
  }
3489
3503
  context.subAgentMessages?.set(context.toolCallId, result.messages);
3504
+ const ss = result.artifacts?.screenshotFullPage;
3505
+ if (ss?.url) {
3506
+ return JSON.stringify({
3507
+ text: result.text,
3508
+ screenshotUrl: ss.url,
3509
+ ...ss.styleMap ? { styleMap: ss.styleMap } : {}
3510
+ });
3511
+ }
3490
3512
  return result.text;
3491
3513
  } finally {
3492
3514
  release();
@@ -3534,19 +3556,18 @@ var screenshotTool = {
3534
3556
  if (input.instructions && context) {
3535
3557
  const task = input.path ? `Navigate to "${input.path}", then: ${input.instructions}. After completing these steps, take a full-page screenshot.` : `${input.instructions}. After completing these steps, take a full-page screenshot.`;
3536
3558
  const result = await browserAutomationTool.execute({ task }, context);
3537
- const urlMatch = result.match(
3538
- /https:\/\/[^\s"')]+\.(?:png|jpg|jpeg|webp)/i
3539
- );
3540
- if (!urlMatch) {
3541
- return `Error: browser navigation completed but no screenshot URL was returned. Agent output: ${result}`;
3542
- }
3543
- const url = urlMatch[0];
3559
+ const resultStr = result;
3560
+ let url;
3544
3561
  let styleMap;
3545
3562
  try {
3546
- const parsed = JSON.parse(result);
3547
- styleMap = parsed?.styleMap;
3563
+ const parsed = JSON.parse(resultStr);
3564
+ url = parsed.screenshotUrl;
3565
+ styleMap = parsed.styleMap;
3548
3566
  } catch {
3549
3567
  }
3568
+ if (!url) {
3569
+ return `Error: browser navigation completed but no screenshot URL was returned. Agent output: ${resultStr}`;
3570
+ }
3550
3571
  const analysisPrompt = buildScreenshotAnalysisPrompt({
3551
3572
  prompt: input.prompt,
3552
3573
  styleMap
@@ -3870,19 +3891,18 @@ async function execute5(input, onLog, context) {
3870
3891
  try {
3871
3892
  const task = input.path ? `Navigate to "${input.path}", then: ${input.instructions}. After completing these steps, take a full-page screenshot.` : `${input.instructions}. After completing these steps, take a full-page screenshot.`;
3872
3893
  const result = await browserAutomationTool.execute({ task }, context);
3873
- const urlMatch = result.match(
3874
- /https:\/\/[^\s"')]+\.(?:png|jpg|jpeg|webp)/i
3875
- );
3876
- if (!urlMatch) {
3877
- return `Error: browser navigation completed but no screenshot URL was returned. Agent output: ${result}`;
3878
- }
3879
- const url = urlMatch[0];
3894
+ const resultStr = result;
3895
+ let url;
3880
3896
  let styleMap;
3881
3897
  try {
3882
- const parsed = JSON.parse(result);
3883
- styleMap = parsed?.styleMap;
3898
+ const parsed = JSON.parse(resultStr);
3899
+ url = parsed.screenshotUrl;
3900
+ styleMap = parsed.styleMap;
3884
3901
  } catch {
3885
3902
  }
3903
+ if (!url) {
3904
+ return `Error: browser navigation completed but no screenshot URL was returned. Agent output: ${resultStr}`;
3905
+ }
3886
3906
  const analysisPrompt = buildScreenshotAnalysisPrompt({
3887
3907
  prompt: input.prompt,
3888
3908
  styleMap
package/dist/index.js CHANGED
@@ -3244,8 +3244,10 @@ async function runSubAgent(config) {
3244
3244
  requestId,
3245
3245
  history,
3246
3246
  background,
3247
- onBackgroundComplete
3247
+ onBackgroundComplete,
3248
+ captureArtifacts
3248
3249
  } = config;
3250
+ const artifacts = {};
3249
3251
  const bgAbort = background ? new AbortController() : null;
3250
3252
  const signal = background ? bgAbort.signal : parentSignal;
3251
3253
  const agentName = subAgentId || "sub-agent";
@@ -3417,7 +3419,12 @@ ${partial}` : "[INTERRUPTED] Agent was interrupted before producing output.",
3417
3419
  if (stopReason !== "tool_use" || toolCalls.length === 0) {
3418
3420
  statusWatcher.stop();
3419
3421
  const text = getPartialText(contentBlocks);
3420
- return { text, messages: thisInvocation() };
3422
+ const hasArtifacts = Object.keys(artifacts).length > 0;
3423
+ return {
3424
+ text,
3425
+ messages: thisInvocation(),
3426
+ ...hasArtifacts ? { artifacts } : {}
3427
+ };
3421
3428
  }
3422
3429
  log6.info("Tools executing", {
3423
3430
  requestId,
@@ -3528,6 +3535,12 @@ ${partial}` : "[INTERRUPTED] Agent was interrupted before producing output.",
3528
3535
  if (innerMsgs) {
3529
3536
  block.subAgentMessages = innerMsgs;
3530
3537
  }
3538
+ if (captureArtifacts?.includes(block.name) && !r.isError) {
3539
+ try {
3540
+ artifacts[block.name] = JSON.parse(r.result);
3541
+ } catch {
3542
+ }
3543
+ }
3531
3544
  }
3532
3545
  messages.push({
3533
3546
  role: "user",
@@ -3895,13 +3908,22 @@ var init_browserAutomation = __esm({
3895
3908
  }
3896
3909
  return result2;
3897
3910
  },
3898
- toolRegistry: context.toolRegistry
3911
+ toolRegistry: context.toolRegistry,
3912
+ captureArtifacts: ["screenshotFullPage"]
3899
3913
  });
3900
3914
  try {
3901
3915
  await sidecarRequest("/reset-browser", {}, { timeout: 5e3 });
3902
3916
  } catch {
3903
3917
  }
3904
3918
  context.subAgentMessages?.set(context.toolCallId, result.messages);
3919
+ const ss = result.artifacts?.screenshotFullPage;
3920
+ if (ss?.url) {
3921
+ return JSON.stringify({
3922
+ text: result.text,
3923
+ screenshotUrl: ss.url,
3924
+ ...ss.styleMap ? { styleMap: ss.styleMap } : {}
3925
+ });
3926
+ }
3905
3927
  return result.text;
3906
3928
  } finally {
3907
3929
  release();
@@ -3959,19 +3981,18 @@ var init_screenshot2 = __esm({
3959
3981
  if (input.instructions && context) {
3960
3982
  const task = input.path ? `Navigate to "${input.path}", then: ${input.instructions}. After completing these steps, take a full-page screenshot.` : `${input.instructions}. After completing these steps, take a full-page screenshot.`;
3961
3983
  const result = await browserAutomationTool.execute({ task }, context);
3962
- const urlMatch = result.match(
3963
- /https:\/\/[^\s"')]+\.(?:png|jpg|jpeg|webp)/i
3964
- );
3965
- if (!urlMatch) {
3966
- return `Error: browser navigation completed but no screenshot URL was returned. Agent output: ${result}`;
3967
- }
3968
- const url = urlMatch[0];
3984
+ const resultStr = result;
3985
+ let url;
3969
3986
  let styleMap;
3970
3987
  try {
3971
- const parsed = JSON.parse(result);
3972
- styleMap = parsed?.styleMap;
3988
+ const parsed = JSON.parse(resultStr);
3989
+ url = parsed.screenshotUrl;
3990
+ styleMap = parsed.styleMap;
3973
3991
  } catch {
3974
3992
  }
3993
+ if (!url) {
3994
+ return `Error: browser navigation completed but no screenshot URL was returned. Agent output: ${resultStr}`;
3995
+ }
3975
3996
  const analysisPrompt = buildScreenshotAnalysisPrompt({
3976
3997
  prompt: input.prompt,
3977
3998
  styleMap
@@ -4311,19 +4332,18 @@ async function execute5(input, onLog, context) {
4311
4332
  try {
4312
4333
  const task = input.path ? `Navigate to "${input.path}", then: ${input.instructions}. After completing these steps, take a full-page screenshot.` : `${input.instructions}. After completing these steps, take a full-page screenshot.`;
4313
4334
  const result = await browserAutomationTool.execute({ task }, context);
4314
- const urlMatch = result.match(
4315
- /https:\/\/[^\s"')]+\.(?:png|jpg|jpeg|webp)/i
4316
- );
4317
- if (!urlMatch) {
4318
- return `Error: browser navigation completed but no screenshot URL was returned. Agent output: ${result}`;
4319
- }
4320
- const url = urlMatch[0];
4335
+ const resultStr = result;
4336
+ let url;
4321
4337
  let styleMap;
4322
4338
  try {
4323
- const parsed = JSON.parse(result);
4324
- styleMap = parsed?.styleMap;
4339
+ const parsed = JSON.parse(resultStr);
4340
+ url = parsed.screenshotUrl;
4341
+ styleMap = parsed.styleMap;
4325
4342
  } catch {
4326
4343
  }
4344
+ if (!url) {
4345
+ return `Error: browser navigation completed but no screenshot URL was returned. Agent output: ${resultStr}`;
4346
+ }
4327
4347
  const analysisPrompt = buildScreenshotAnalysisPrompt({
4328
4348
  prompt: input.prompt,
4329
4349
  styleMap
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindstudio-ai/remy",
3
- "version": "0.1.138",
3
+ "version": "0.1.139",
4
4
  "description": "MindStudio coding agent",
5
5
  "repository": {
6
6
  "type": "git",