@openagents-org/agent-launcher 0.2.222 → 0.2.223

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openagents-org/agent-launcher",
3
- "version": "0.2.222",
3
+ "version": "0.2.223",
4
4
  "description": "OpenAgents Launcher — install, configure, and run AI coding agents from your terminal",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -468,6 +468,14 @@ function buildApiSkillsPrompt({ endpoint, workspaceId, token, agentName, channel
468
468
  `\`${curl} -s -X POST -H "${h}" -H "Content-Type: application/json"` +
469
469
  ` ${baseUrl}/v1/browser/tabs/{tab_id}/press_key` +
470
470
  ` -d '{"key":"Enter","source":"openagents:${agentName}","channel":"${channelName}"}'\`\n\n` +
471
+ '**Upload a file or image** into the page (no file dialog needed). First open the site\'s upload UI ' +
472
+ '(e.g. Medium "+" → Image) so its file input exists, then attach a workspace file by `file_id` ' +
473
+ '(upload it to Files first) or inline bytes with `name` + `data_base64`. Max 5 files / 10 MiB:\n' +
474
+ `\`${curl} -s -X POST -H "${h}" -H "Content-Type: application/json"` +
475
+ ` ${baseUrl}/v1/browser/tabs/{tab_id}/upload` +
476
+ ` -d '{"selector":"input[type=file]","files":[{"file_id":"FILE_ID"}],"source":"openagents:${agentName}","channel":"${channelName}"}'\`\n` +
477
+ 'The site sees a normal file pick and may upload immediately; check the page afterwards. ' +
478
+ 'Use this instead of clipboard paste or image-URL import, which fail in the cloud browser.\n\n' +
471
479
  '**Run JavaScript** in the page (returns the result):\n' +
472
480
  `\`${curl} -s -X POST -H "${h}" -H "Content-Type: application/json"` +
473
481
  ` ${baseUrl}/v1/browser/tabs/{tab_id}/evaluate` +
package/src/mcp-server.js CHANGED
@@ -227,6 +227,21 @@ function buildToolDefs(disabledModules) {
227
227
  required: ['tab_id', 'selector', 'text'],
228
228
  },
229
229
  },
230
+ {
231
+ name: 'workspace_browser_upload',
232
+ description: 'Upload a file or image into a page\'s file input (no file dialog needed). Open the site\'s upload UI first (e.g. Medium "+" → Image) so the input exists. Give a local file path, or a workspace file_id. Max 5 files / 10 MiB. The site may upload immediately; check the page afterwards.',
233
+ inputSchema: {
234
+ type: 'object',
235
+ properties: {
236
+ tab_id: { type: 'string', description: 'Tab ID' },
237
+ path: { type: 'string', description: 'Path of a local file on this machine to upload' },
238
+ file_id: { type: 'string', description: 'ID of a workspace shared file to upload (alternative to path)' },
239
+ selector: { type: 'string', description: 'CSS selector of the file input (default input[type=file])' },
240
+ frame_selector: { type: 'string', description: 'Optional CSS selector of an iframe containing the input' },
241
+ },
242
+ required: ['tab_id'],
243
+ },
244
+ },
230
245
  {
231
246
  name: 'workspace_browser_screenshot',
232
247
  description: 'Take a screenshot of a browser tab. Returns a base64 PNG image.',
@@ -908,6 +923,24 @@ class McpServer {
908
923
  return text(`Typed into ${args.selector}: ${args.text.slice(0, 50)}${args.text.length > 50 ? '...' : ''}`);
909
924
  }
910
925
 
926
+ case 'workspace_browser_upload': {
927
+ let file;
928
+ if (args.path) {
929
+ const fs = require('fs');
930
+ const pathMod = require('path');
931
+ file = { name: pathMod.basename(args.path), data_base64: fs.readFileSync(args.path).toString('base64') };
932
+ } else if (args.file_id) {
933
+ file = { file_id: args.file_id };
934
+ } else {
935
+ return text('Provide either path (local file) or file_id (workspace file).');
936
+ }
937
+ const r = await this.ws.browserUpload(this.workspaceId, this.token, args.tab_id, [file], {
938
+ selector: args.selector || 'input[type=file]', frame_selector: args.frame_selector,
939
+ source: `openagents:${this.agentName}`, channel: this.channelName,
940
+ });
941
+ return text(`Attached ${(r.files || []).join(', ') || 'file'} to ${args.selector || 'input[type=file]'} (${r.status || 'attached'}). Check the page to confirm the site accepted it.`);
942
+ }
943
+
911
944
  case 'workspace_browser_screenshot': {
912
945
  const buf = await this.ws.browserScreenshot(this.workspaceId, this.token, args.tab_id, { source: `openagents:${this.agentName}`, channel: this.channelName });
913
946
  const b64 = Buffer.isBuffer(buf) ? buf.toString('base64') : buf;
@@ -883,6 +883,17 @@ class WorkspaceClient {
883
883
  * Get screenshot via GET /v1/browser/tabs/{tabId}/screenshot.
884
884
  * @returns {Buffer}
885
885
  */
886
+ /**
887
+ * Attach files to a file input via POST /v1/browser/tabs/{tabId}/upload.
888
+ * @param {Array<{file_id?: string, name?: string, mime_type?: string, data_base64?: string}>} files
889
+ */
890
+ async browserUpload(workspaceId, token, tabId, files, { selector = 'input[type=file]', frame_selector, source, channel } = {}) {
891
+ const body = { selector, files, source, channel };
892
+ if (frame_selector) body.frame_selector = frame_selector;
893
+ const data = await this._post(`/v1/browser/tabs/${tabId}/upload`, body, this._wsHeaders(token));
894
+ return data.data || data;
895
+ }
896
+
886
897
  async browserScreenshot(workspaceId, token, tabId, { source, channel } = {}) {
887
898
  const query = new URLSearchParams();
888
899
  if (source) query.set('source', source);