@framers/agentos-ext-web-browser 1.1.0 → 1.1.1

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.
@@ -4,17 +4,22 @@
4
4
  *
5
5
  * @module @framers/agentos-ext-web-browser
6
6
  */
7
- import type { ITool } from '@framers/agentos';
8
- import type { BrowserService } from '../services/browserService';
9
- import type { TypeResult } from '../types';
7
+ import type { ITool, JSONSchemaObject, ToolExecutionContext, ToolExecutionResult } from '@framers/agentos';
8
+ import type { BrowserService } from '../services/browserService.js';
9
+ import type { TypeResult } from '../types.js';
10
10
  /**
11
11
  * Tool for typing into inputs
12
12
  */
13
13
  export declare class TypeTool implements ITool {
14
14
  private browserService;
15
- readonly id = "browserType";
16
- readonly name = "Type Text";
17
- readonly description = "Type text into an input field";
15
+ readonly id = "web-browser-type-v1";
16
+ /** Tool call name used by the LLM / ToolExecutor. */
17
+ readonly name = "browser_type";
18
+ readonly displayName = "Browser Type";
19
+ readonly description = "Type text into an input field using a CSS selector.";
20
+ readonly category = "research";
21
+ readonly hasSideEffects = true;
22
+ readonly inputSchema: JSONSchemaObject;
18
23
  constructor(browserService: BrowserService);
19
24
  /**
20
25
  * Execute typing
@@ -24,21 +29,13 @@ export declare class TypeTool implements ITool {
24
29
  text: string;
25
30
  delay?: number;
26
31
  clear?: boolean;
27
- }): Promise<{
28
- success: boolean;
29
- output?: TypeResult;
30
- error?: string;
31
- }>;
32
+ }, _context: ToolExecutionContext): Promise<ToolExecutionResult<TypeResult>>;
32
33
  /**
33
34
  * Validate input
34
35
  */
35
- validate(input: any): {
36
- valid: boolean;
37
- errors: string[];
36
+ validateArgs(input: Record<string, any>): {
37
+ isValid: boolean;
38
+ errors?: any[];
38
39
  };
39
- /**
40
- * Get JSON schema for tool
41
- */
42
- getSchema(): any;
43
40
  }
44
41
  //# sourceMappingURL=type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/tools/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AC,cAAc;IAlClC,SAAgB,EAAE,yBAAyB;IAC3C,qDAAqD;IACrD,SAAgB,IAAI,kBAAkB;IACtC,SAAgB,WAAW,kBAAkB;IAC7C,SAAgB,WAAW,yDAAyD;IACpF,SAAgB,QAAQ,cAAc;IACtC,SAAgB,cAAc,QAAQ;IAEtC,SAAgB,WAAW,EAAE,gBAAgB,CAwB3C;gBAEkB,cAAc,EAAE,cAAc;IAElD;;OAEG;IACG,OAAO,CACX,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAC1E,QAAQ,EAAE,oBAAoB,GAC7B,OAAO,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAa3C;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAA;KAAE;CAiB/E"}
@@ -9,22 +9,51 @@
9
9
  */
10
10
  export class TypeTool {
11
11
  browserService;
12
- id = 'browserType';
13
- name = 'Type Text';
14
- description = 'Type text into an input field';
12
+ id = 'web-browser-type-v1';
13
+ /** Tool call name used by the LLM / ToolExecutor. */
14
+ name = 'browser_type';
15
+ displayName = 'Browser Type';
16
+ description = 'Type text into an input field using a CSS selector.';
17
+ category = 'research';
18
+ hasSideEffects = true;
19
+ inputSchema = {
20
+ type: 'object',
21
+ required: ['selector', 'text'],
22
+ properties: {
23
+ selector: {
24
+ type: 'string',
25
+ description: 'CSS selector for the input element',
26
+ },
27
+ text: {
28
+ type: 'string',
29
+ description: 'Text to type',
30
+ },
31
+ delay: {
32
+ type: 'number',
33
+ description: 'Delay between keystrokes (ms)',
34
+ default: 0,
35
+ },
36
+ clear: {
37
+ type: 'boolean',
38
+ description: 'Clear existing text before typing',
39
+ default: false,
40
+ },
41
+ },
42
+ additionalProperties: false,
43
+ };
15
44
  constructor(browserService) {
16
45
  this.browserService = browserService;
17
46
  }
18
47
  /**
19
48
  * Execute typing
20
49
  */
21
- async execute(input) {
50
+ async execute(input, _context) {
22
51
  try {
23
52
  const result = await this.browserService.type(input.selector, input.text, {
24
53
  delay: input.delay,
25
54
  clear: input.clear,
26
55
  });
27
- return { success: result.success, output: result };
56
+ return { success: result.success, output: result, error: result.success ? undefined : 'Type failed' };
28
57
  }
29
58
  catch (error) {
30
59
  return { success: false, error: error.message };
@@ -33,7 +62,7 @@ export class TypeTool {
33
62
  /**
34
63
  * Validate input
35
64
  */
36
- validate(input) {
65
+ validateArgs(input) {
37
66
  const errors = [];
38
67
  if (!input.selector) {
39
68
  errors.push('Selector is required');
@@ -47,36 +76,7 @@ export class TypeTool {
47
76
  else if (typeof input.text !== 'string') {
48
77
  errors.push('Text must be a string');
49
78
  }
50
- return { valid: errors.length === 0, errors };
51
- }
52
- /**
53
- * Get JSON schema for tool
54
- */
55
- getSchema() {
56
- return {
57
- type: 'object',
58
- required: ['selector', 'text'],
59
- properties: {
60
- selector: {
61
- type: 'string',
62
- description: 'CSS selector for the input element',
63
- },
64
- text: {
65
- type: 'string',
66
- description: 'Text to type',
67
- },
68
- delay: {
69
- type: 'number',
70
- description: 'Delay between keystrokes (ms)',
71
- default: 0,
72
- },
73
- clear: {
74
- type: 'boolean',
75
- description: 'Clear existing text before typing',
76
- default: false,
77
- },
78
- },
79
- };
79
+ return errors.length === 0 ? { isValid: true } : { isValid: false, errors };
80
80
  }
81
81
  }
82
82
  //# sourceMappingURL=type.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/tools/type.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;GAEG;AACH,MAAM,OAAO,QAAQ;IAKC;IAJJ,EAAE,GAAG,aAAa,CAAC;IACnB,IAAI,GAAG,WAAW,CAAC;IACnB,WA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IAAI,EAAE,CAAC;YACpD,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAClC,CAAC;aAAM,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC1C,MAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;QACvC,CAAC;QAED,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAC9E,CAAC;CACF"}
package/manifest.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://agentos.sh/schemas/extension-manifest-v1.json",
3
3
  "id": "com.framers.research.web-browser",
4
4
  "name": "Web Browser Extension",
5
- "version": "1.0.0",
5
+ "version": "1.1.0",
6
6
  "description": "Browser automation capabilities for AgentOS - navigate pages, scrape content, click links, and capture screenshots",
7
7
  "author": {
8
8
  "name": "Frame.dev",
@@ -20,38 +20,45 @@
20
20
  "extensions": [
21
21
  {
22
22
  "kind": "tool",
23
- "id": "browserNavigate",
23
+ "id": "browser_navigate",
24
24
  "displayName": "Navigate to URL",
25
25
  "description": "Navigate browser to a URL and get page content",
26
26
  "entry": "./dist/tools/navigate.js"
27
27
  },
28
28
  {
29
29
  "kind": "tool",
30
- "id": "browserScrape",
30
+ "id": "browser_scrape",
31
31
  "displayName": "Scrape Content",
32
32
  "description": "Extract content from web page using CSS selectors",
33
33
  "entry": "./dist/tools/scrape.js"
34
34
  },
35
35
  {
36
36
  "kind": "tool",
37
- "id": "browserClick",
37
+ "id": "browser_click",
38
38
  "displayName": "Click Element",
39
39
  "description": "Click on an element in the current page",
40
40
  "entry": "./dist/tools/click.js"
41
41
  },
42
42
  {
43
43
  "kind": "tool",
44
- "id": "browserScreenshot",
44
+ "id": "browser_screenshot",
45
45
  "displayName": "Take Screenshot",
46
46
  "description": "Capture screenshot of current page or element",
47
47
  "entry": "./dist/tools/screenshot.js"
48
48
  },
49
49
  {
50
50
  "kind": "tool",
51
- "id": "browserType",
51
+ "id": "browser_type",
52
52
  "displayName": "Type Text",
53
53
  "description": "Type text into an input field",
54
54
  "entry": "./dist/tools/type.js"
55
+ },
56
+ {
57
+ "kind": "tool",
58
+ "id": "browser_snapshot",
59
+ "displayName": "Page Snapshot",
60
+ "description": "Extract a structured snapshot of the current page DOM",
61
+ "entry": "./dist/tools/snapshot.js"
55
62
  }
56
63
  ],
57
64
  "configuration": {
@@ -90,4 +97,3 @@
90
97
  }
91
98
 
92
99
 
93
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@framers/agentos-ext-web-browser",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Browser automation extension for AgentOS",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -56,8 +56,9 @@
56
56
  "cheerio": "^1.0.0-rc.12"
57
57
  },
58
58
  "devDependencies": {
59
+ "@framers/agentos": "^0.1.0",
59
60
  "@types/node": "^20.0.0",
60
61
  "typescript": "^5.4.0",
61
62
  "vitest": "^1.6.0"
62
63
  }
63
- }
64
+ }