@mindstudio-ai/remy 0.1.12 → 0.1.13

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
@@ -86,7 +86,7 @@ function resolveConfig(flags) {
86
86
  const activeEnv = file.environment || "prod";
87
87
  const env = file.environments?.[activeEnv];
88
88
  const apiKey = flags?.apiKey || process.env.MINDSTUDIO_API_KEY || env?.apiKey || "";
89
- const baseUrl = flags?.baseUrl || process.env.MINDSTUDIO_BASE_URL || env?.apiBaseUrl || DEFAULT_BASE_URL;
89
+ const baseUrl2 = flags?.baseUrl || process.env.MINDSTUDIO_BASE_URL || env?.apiBaseUrl || DEFAULT_BASE_URL;
90
90
  if (!apiKey) {
91
91
  log.error("No API key found");
92
92
  throw new Error(
@@ -95,52 +95,60 @@ function resolveConfig(flags) {
95
95
  }
96
96
  const keySource = flags?.apiKey ? "cli flag" : process.env.MINDSTUDIO_API_KEY ? "env var" : "config file";
97
97
  log.info("Config resolved", {
98
- baseUrl,
98
+ baseUrl: baseUrl2,
99
99
  keySource,
100
100
  environment: activeEnv
101
101
  });
102
- return { apiKey, baseUrl };
102
+ return { apiKey, baseUrl: baseUrl2 };
103
103
  }
104
104
 
105
105
  // src/prompt/index.ts
106
106
  import fs4 from "fs";
107
107
  import path3 from "path";
108
108
 
109
- // src/tools/_helpers/lsp.ts
110
- var lspBaseUrl = null;
111
- function setLspBaseUrl(url) {
112
- lspBaseUrl = url;
113
- log.info("LSP configured", { url });
109
+ // src/tools/_helpers/sidecar.ts
110
+ var baseUrl = null;
111
+ function setSidecarBaseUrl(url) {
112
+ baseUrl = url;
113
+ log.info("Sidecar configured", { url });
114
114
  }
115
- function isLspConfigured() {
116
- return lspBaseUrl !== null;
115
+ function isSidecarConfigured() {
116
+ return baseUrl !== null;
117
117
  }
118
- async function lspRequest(endpoint, body) {
119
- if (!lspBaseUrl) {
120
- throw new Error("LSP not available");
118
+ async function sidecarRequest(endpoint, body = {}, options) {
119
+ if (!baseUrl) {
120
+ throw new Error("Sidecar not available");
121
121
  }
122
- const url = `${lspBaseUrl}${endpoint}`;
123
- log.debug("LSP request", { endpoint, body });
122
+ const url = `${baseUrl}${endpoint}`;
123
+ log.debug("Sidecar request", { endpoint, body });
124
124
  try {
125
125
  const res = await fetch(url, {
126
126
  method: "POST",
127
127
  headers: { "Content-Type": "application/json" },
128
- body: JSON.stringify(body)
128
+ body: JSON.stringify(body),
129
+ signal: options?.timeout ? AbortSignal.timeout(options.timeout) : void 0
129
130
  });
130
131
  if (!res.ok) {
131
- log.error("LSP sidecar error", { endpoint, status: res.status });
132
- throw new Error(`LSP sidecar error: ${res.status}`);
132
+ log.error("Sidecar error", { endpoint, status: res.status });
133
+ throw new Error(`Sidecar error: ${res.status}`);
133
134
  }
134
135
  return res.json();
135
136
  } catch (err) {
136
- if (err.message.startsWith("LSP sidecar")) {
137
+ if (err.message.startsWith("Sidecar error")) {
137
138
  throw err;
138
139
  }
139
- log.error("LSP connection error", { endpoint, error: err.message });
140
- throw new Error(`LSP connection error: ${err.message}`);
140
+ log.error("Sidecar connection error", { endpoint, error: err.message });
141
+ throw new Error(`Sidecar connection error: ${err.message}`);
141
142
  }
142
143
  }
143
144
 
145
+ // src/tools/_helpers/lsp.ts
146
+ var setLspBaseUrl = setSidecarBaseUrl;
147
+ var isLspConfigured = isSidecarConfigured;
148
+ async function lspRequest(endpoint, body) {
149
+ return sidecarRequest(endpoint, body);
150
+ }
151
+
144
152
  // src/prompt/static/projectContext.ts
145
153
  import fs3 from "fs";
146
154
  import path2 from "path";
@@ -395,8 +403,8 @@ ${viewContext?.activeFile ? `Active file: ${viewContext.activeFile}` : ""}
395
403
 
396
404
  // src/api.ts
397
405
  async function* streamChat(params) {
398
- const { baseUrl, apiKey, signal, ...body } = params;
399
- const url = `${baseUrl}/_internal/v2/agent/remy/chat`;
406
+ const { baseUrl: baseUrl2, apiKey, signal, ...body } = params;
407
+ const url = `${baseUrl2}/_internal/v2/agent/remy/chat`;
400
408
  const startTime = Date.now();
401
409
  const messagesWithAttachments = body.messages.filter(
402
410
  (m) => m.attachments && m.attachments.length > 0
@@ -2282,6 +2290,18 @@ var browserAutomationTool = {
2282
2290
  if (!context) {
2283
2291
  return "Error: browser automation requires execution context (only available in headless mode)";
2284
2292
  }
2293
+ try {
2294
+ const status = await sidecarRequest(
2295
+ "/browser-status",
2296
+ {},
2297
+ { timeout: 5e3 }
2298
+ );
2299
+ if (!status.connected) {
2300
+ return "Error: the browser preview is not connected. The user needs to open the preview before browser tests can run.";
2301
+ }
2302
+ } catch {
2303
+ return "Error: could not check browser status. The dev environment may not be running.";
2304
+ }
2285
2305
  return runSubAgent({
2286
2306
  system: BROWSER_AUTOMATION_PROMPT,
2287
2307
  task: input.task,
package/dist/index.js CHANGED
@@ -89,8 +89,8 @@ var init_logger = __esm({
89
89
 
90
90
  // src/api.ts
91
91
  async function* streamChat(params) {
92
- const { baseUrl, apiKey, signal, ...body } = params;
93
- const url = `${baseUrl}/_internal/v2/agent/remy/chat`;
92
+ const { baseUrl: baseUrl2, apiKey, signal, ...body } = params;
93
+ const url = `${baseUrl2}/_internal/v2/agent/remy/chat`;
94
94
  const startTime = Date.now();
95
95
  const messagesWithAttachments = body.messages.filter(
96
96
  (m) => m.attachments && m.attachments.length > 0
@@ -1776,45 +1776,60 @@ var init_editsFinished = __esm({
1776
1776
  }
1777
1777
  });
1778
1778
 
1779
- // src/tools/_helpers/lsp.ts
1780
- function setLspBaseUrl(url) {
1781
- lspBaseUrl = url;
1782
- log.info("LSP configured", { url });
1779
+ // src/tools/_helpers/sidecar.ts
1780
+ function setSidecarBaseUrl(url) {
1781
+ baseUrl = url;
1782
+ log.info("Sidecar configured", { url });
1783
1783
  }
1784
- function isLspConfigured() {
1785
- return lspBaseUrl !== null;
1784
+ function isSidecarConfigured() {
1785
+ return baseUrl !== null;
1786
1786
  }
1787
- async function lspRequest(endpoint, body) {
1788
- if (!lspBaseUrl) {
1789
- throw new Error("LSP not available");
1787
+ async function sidecarRequest(endpoint, body = {}, options) {
1788
+ if (!baseUrl) {
1789
+ throw new Error("Sidecar not available");
1790
1790
  }
1791
- const url = `${lspBaseUrl}${endpoint}`;
1792
- log.debug("LSP request", { endpoint, body });
1791
+ const url = `${baseUrl}${endpoint}`;
1792
+ log.debug("Sidecar request", { endpoint, body });
1793
1793
  try {
1794
1794
  const res = await fetch(url, {
1795
1795
  method: "POST",
1796
1796
  headers: { "Content-Type": "application/json" },
1797
- body: JSON.stringify(body)
1797
+ body: JSON.stringify(body),
1798
+ signal: options?.timeout ? AbortSignal.timeout(options.timeout) : void 0
1798
1799
  });
1799
1800
  if (!res.ok) {
1800
- log.error("LSP sidecar error", { endpoint, status: res.status });
1801
- throw new Error(`LSP sidecar error: ${res.status}`);
1801
+ log.error("Sidecar error", { endpoint, status: res.status });
1802
+ throw new Error(`Sidecar error: ${res.status}`);
1802
1803
  }
1803
1804
  return res.json();
1804
1805
  } catch (err) {
1805
- if (err.message.startsWith("LSP sidecar")) {
1806
+ if (err.message.startsWith("Sidecar error")) {
1806
1807
  throw err;
1807
1808
  }
1808
- log.error("LSP connection error", { endpoint, error: err.message });
1809
- throw new Error(`LSP connection error: ${err.message}`);
1809
+ log.error("Sidecar connection error", { endpoint, error: err.message });
1810
+ throw new Error(`Sidecar connection error: ${err.message}`);
1810
1811
  }
1811
1812
  }
1812
- var lspBaseUrl;
1813
+ var baseUrl;
1814
+ var init_sidecar = __esm({
1815
+ "src/tools/_helpers/sidecar.ts"() {
1816
+ "use strict";
1817
+ init_logger();
1818
+ baseUrl = null;
1819
+ }
1820
+ });
1821
+
1822
+ // src/tools/_helpers/lsp.ts
1823
+ async function lspRequest(endpoint, body) {
1824
+ return sidecarRequest(endpoint, body);
1825
+ }
1826
+ var setLspBaseUrl, isLspConfigured;
1813
1827
  var init_lsp = __esm({
1814
1828
  "src/tools/_helpers/lsp.ts"() {
1815
1829
  "use strict";
1816
- init_logger();
1817
- lspBaseUrl = null;
1830
+ init_sidecar();
1831
+ setLspBaseUrl = setSidecarBaseUrl;
1832
+ isLspConfigured = isSidecarConfigured;
1818
1833
  }
1819
1834
  });
1820
1835
 
@@ -2221,6 +2236,7 @@ var init_browserAutomation = __esm({
2221
2236
  init_runner();
2222
2237
  init_tools();
2223
2238
  init_prompt();
2239
+ init_sidecar();
2224
2240
  browserAutomationTool = {
2225
2241
  definition: {
2226
2242
  name: "runAutomatedBrowserTest",
@@ -2240,6 +2256,18 @@ var init_browserAutomation = __esm({
2240
2256
  if (!context) {
2241
2257
  return "Error: browser automation requires execution context (only available in headless mode)";
2242
2258
  }
2259
+ try {
2260
+ const status = await sidecarRequest(
2261
+ "/browser-status",
2262
+ {},
2263
+ { timeout: 5e3 }
2264
+ );
2265
+ if (!status.connected) {
2266
+ return "Error: the browser preview is not connected. The user needs to open the preview before browser tests can run.";
2267
+ }
2268
+ } catch {
2269
+ return "Error: could not check browser status. The dev environment may not be running.";
2270
+ }
2243
2271
  return runSubAgent({
2244
2272
  system: BROWSER_AUTOMATION_PROMPT,
2245
2273
  task: input.task,
@@ -3817,7 +3845,7 @@ function resolveConfig(flags2) {
3817
3845
  const activeEnv = file.environment || "prod";
3818
3846
  const env = file.environments?.[activeEnv];
3819
3847
  const apiKey = flags2?.apiKey || process.env.MINDSTUDIO_API_KEY || env?.apiKey || "";
3820
- const baseUrl = flags2?.baseUrl || process.env.MINDSTUDIO_BASE_URL || env?.apiBaseUrl || DEFAULT_BASE_URL;
3848
+ const baseUrl2 = flags2?.baseUrl || process.env.MINDSTUDIO_BASE_URL || env?.apiBaseUrl || DEFAULT_BASE_URL;
3821
3849
  if (!apiKey) {
3822
3850
  log.error("No API key found");
3823
3851
  throw new Error(
@@ -3826,11 +3854,11 @@ function resolveConfig(flags2) {
3826
3854
  }
3827
3855
  const keySource = flags2?.apiKey ? "cli flag" : process.env.MINDSTUDIO_API_KEY ? "env var" : "config file";
3828
3856
  log.info("Config resolved", {
3829
- baseUrl,
3857
+ baseUrl: baseUrl2,
3830
3858
  keySource,
3831
3859
  environment: activeEnv
3832
3860
  });
3833
- return { apiKey, baseUrl };
3861
+ return { apiKey, baseUrl: baseUrl2 };
3834
3862
  }
3835
3863
  var CONFIG_PATH, DEFAULT_BASE_URL;
3836
3864
  var init_config = __esm({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindstudio-ai/remy",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "MindStudio coding agent",
5
5
  "repository": {
6
6
  "type": "git",