@agent-smith/feat-frontend 0.0.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.
@@ -0,0 +1,59 @@
1
+ /*
2
+ # tool
3
+ name: playwright-cli
4
+ description: "Run a Playwright cli command. Load the `playwright-cli` skill to understand the api"
5
+ arguments:
6
+ arguments:
7
+ description: |-
8
+ The playwright-cli command arguments. Example: open https://playwright.dev --headed
9
+ required: true
10
+ */
11
+ import { utils } from "@agent-smith/core";
12
+ import { parseArgsStringToArgv } from 'string-argv';
13
+
14
+
15
+ async function action(args, options) {
16
+ const ar = parseArgsStringToArgv(args.arguments);
17
+ if (options?.variables?.workspace) {
18
+ } else {
19
+ throw new Error("no workspace var");
20
+ }
21
+ //write only in workspace
22
+ ar.forEach(v => {
23
+ if (v.includes("--filename=")) {
24
+ const p = v.replace("--filename=").trim();
25
+ if (!p.startsWith("/workspace")) {
26
+ return "The filename argument must be a path starting with /workspace";
27
+ }
28
+ }
29
+ if (v.includes("--profile=")) {
30
+ const p = v.replace("--profile=").trim();
31
+ if (!p.startsWith("/workspace")) {
32
+ return "The profile argument must be a path starting with /workspace";
33
+ }
34
+ }
35
+ });
36
+ const vars = [];
37
+ ar.forEach(a => {
38
+ if (a.includes("/workspace")) {
39
+ a = a.replaceAll("/workspace", options.variables.workspace);
40
+ }
41
+ vars.push(a);
42
+ });
43
+ if (ar[0] == "open") {
44
+ if (!ar.includes("--headed")) {
45
+ return "Please use the --headed flag so he user can see the operations";
46
+ }
47
+ }
48
+ console.log("Executing playwright-cli", vars.join(" "));
49
+ const res = await utils.execute("playwright-cli", vars);
50
+ if (ar[0] == "screenshot") {
51
+ return "Screenshot saved";
52
+ }
53
+ //console.log("RES", res);
54
+ return res.replaceAll(options.variables.workspace, "/workspace");;
55
+ }
56
+
57
+ export {
58
+ action,
59
+ };
@@ -0,0 +1,54 @@
1
+ /*
2
+ # tool
3
+ name: playwright-cli
4
+ description: "Run a Playwright cli command. Load the `playwright-cli` skill to understand the api"
5
+ arguments:
6
+ arguments:
7
+ description: |-
8
+ The playwright-cli command arguments. Example: open https://playwright.dev --headed
9
+ required: true
10
+ */
11
+ import { utils } from "@agent-smith/core";
12
+ import { parseArgsStringToArgv } from 'string-argv';
13
+
14
+
15
+ async function action(args, options) {
16
+ const ar = parseArgsStringToArgv(args.arguments);
17
+ if (options?.variables?.workspace) {
18
+ } else {
19
+ throw new Error("no workspace var");
20
+ }
21
+ //write only in workspace
22
+ ar.forEach(v => {
23
+ if (v.includes("--filename=")) {
24
+ const p = v.replace("--filename=").trim();
25
+ if (!p.startsWith("/workspace")) {
26
+ return "The filename argument must be a path starting with /workspace";
27
+ }
28
+ }
29
+ if (v.includes("--profile=")) {
30
+ const p = v.replace("--profile=").trim();
31
+ if (!p.startsWith("/workspace")) {
32
+ return "The profile argument must be a path starting with /workspace";
33
+ }
34
+ }
35
+ });
36
+ const vars = [];
37
+ ar.forEach(a => {
38
+ if (a.includes("/workspace")) {
39
+ a = a.replaceAll("/workspace", options.variables.workspace);
40
+ }
41
+ vars.push(a);
42
+ });
43
+ console.log("Executing playwright-cli", vars.join(" "));
44
+ const res = await utils.execute("playwright-cli", vars);
45
+ if (ar[0] == "screenshot") {
46
+ return "Screenshot saved";
47
+ }
48
+ //console.log("RES", res);
49
+ return res.replaceAll(options.variables.workspace, "/workspace");;
50
+ }
51
+
52
+ export {
53
+ action,
54
+ };
@@ -0,0 +1,97 @@
1
+ /*
2
+ # tool
3
+ name: playwright
4
+ description: "Execute a Playwright Python script"
5
+ arguments:
6
+ script:
7
+ description: |-
8
+ The Playwright Python code to execute
9
+ required: true
10
+ parallelCalls: false
11
+ */
12
+ import { JsBoxlite } from '@boxlite-ai/boxlite';
13
+
14
+ async function action(args, options) {
15
+ //console.log("SHELL ARGS", args);
16
+ //console.log("SHELL OPTS", options);
17
+ const location = options?.variables?.path ?? options?.variables?.workspace;
18
+ if (!location) {
19
+ return "[Error]: shell tool missing path or workspace parameter";
20
+ }
21
+ if (options?.debug) {
22
+ console.log('Opening box', location);
23
+ }
24
+ //console.log("Cmd:", cmd, cmdArgs);
25
+ const runtime = JsBoxlite.withDefaultConfig();
26
+ const box = await runtime.create({
27
+ image: 'chinayin/playwright:1.52.0-chromium-python3.12',
28
+ workingDir: "/workspace",
29
+ homeDir: "/workspace",
30
+ volumes: [
31
+ { hostPath: location, guestPath: '/workspace' },
32
+ ],
33
+ memoryMib: 2048,
34
+ //network: { "mode": "enabled", allowNet: ["http://localhost:5173"] },
35
+ reuseExisting: true,
36
+ //autoRemove: true,
37
+ });
38
+ process.on('SIGINT', () => box.stop().then(() => process.exit(0)));
39
+ const stdOutBuf = new Array();
40
+ const stdErrBuf = new Array();
41
+ let res = "";
42
+ setTimeout(() => {
43
+ stdErrBuf.push("Timeout: the process has timed out");
44
+ box.stop();
45
+ }, 60000);
46
+ try {
47
+ let cmd = `python3 << 'EOF'\n${args.script}\nEOF`;
48
+ const execution = await box.exec("sh", ["-c", cmd]);
49
+ async function readStdout() {
50
+ const stdout = await execution.stdout();
51
+ while (true) {
52
+ const line = await stdout.next();
53
+ if (line === null)
54
+ break;
55
+ const lt = line.trim();
56
+ console.log(`[stdout] ${lt}`);
57
+ stdOutBuf.push(lt);
58
+ }
59
+ }
60
+ async function readStderr() {
61
+ const stderr = await execution.stderr();
62
+ while (true) {
63
+ const line = await stderr.next();
64
+ if (line === null)
65
+ break;
66
+ const lt = line.trim();
67
+ console.error(`[stderr] ${lt}`);
68
+ stdErrBuf.push(lt);
69
+ }
70
+ }
71
+ await Promise.all([readStdout(), readStderr()]);
72
+ const result = await execution.wait();
73
+ //console.log("CMD RES", result);
74
+ res = `[Exit code]: ${result.exitCode}\n`;
75
+ if (result?.errorMessage) {
76
+ console.error("ERROR", result.errorMessage);
77
+ stdErrBuf.push(result.errorMessage);
78
+ }
79
+ if (stdOutBuf.length > 0) {
80
+ res += `[Stdout]: ${stdOutBuf.join("\n")}\n`;
81
+ }
82
+ if (stdErrBuf.length > 0) {
83
+ res += `[Stderr]: ${stdErrBuf.join("\n")}\n`;
84
+ }
85
+ }
86
+ catch (e) {
87
+ console.error(e);
88
+ }
89
+ finally {
90
+ if (options?.debug) {
91
+ console.log("stopping shell box");
92
+ }
93
+ await box.stop();
94
+ }
95
+ return res;
96
+ }
97
+ export { action, };
@@ -0,0 +1,35 @@
1
+ tool:
2
+ name: lx-browser
3
+ description: An agent that has access to browser usage using Playwright
4
+ arguments:
5
+ prompt:
6
+ description: "The question or browser operation to perform"
7
+ required: true
8
+ description: Playwright agent
9
+ category: code/frontend
10
+ prompt: |-
11
+ {prompt}
12
+ template:
13
+ system: |-
14
+ You are Lynx Coder, a coding agent from Lynx AI.
15
+
16
+ Your task is to use a browser with playwright-cli. Constraints:
17
+
18
+ - You always work in headed mode: use the `--headed` flag with commands like `open`
19
+ - Close the browser when you are done
20
+ - For screenshots use the `--filename` flag with absolute paths starting with /workspace. You don"t need to verify if he screenshots has been saved. Limit the size of the screenshots (max 1024px width).
21
+
22
+ Important: start by loading the `playwright-cli` skill to understand the api before running commands.
23
+ model: qwen35b
24
+ variables:
25
+ required:
26
+ workspace:
27
+ description: The local directory path where to operate
28
+ toolsList:
29
+ - playwright-cli-headed
30
+ - load-skill
31
+ workflow:
32
+ before:
33
+ - adaptater: from-container
34
+ after:
35
+ - adaptater: to-container
@@ -0,0 +1,37 @@
1
+ description: Frontend coder assistant agent
2
+ category: code/frontend
3
+ prompt: |-
4
+ {prompt}
5
+ template:
6
+ system: |-
7
+ You are Lynx Coder, a coding agent from Lynx AI.
8
+
9
+ {file:../fragments/workspace.md}
10
+
11
+ {file:../fragments/ctx-helper-files.md}
12
+
13
+ Load the typescript-coding-guide skill when you need to code.
14
+ model: qwen35b
15
+ inferParams:
16
+ min_p: 0
17
+ top_k: 20
18
+ top_p: 0.85
19
+ temperature: 0.6
20
+ repetition_penalty: 1
21
+ presence_penalty: 1.2
22
+ chat_template_kwargs:
23
+ enable_thinking: true
24
+ preserve_thinking: true
25
+ variables:
26
+ required:
27
+ workspace:
28
+ description: The local directory path where to operate
29
+ toolsList:
30
+ - read-file
31
+ - load-image
32
+ - write-file
33
+ - edit-search-replace
34
+ - shell
35
+ - browser-agent
36
+ - load-skill
37
+ - load-task
@@ -0,0 +1,31 @@
1
+ description: Frontend coder light agent
2
+ category: code/frontend
3
+ prompt: |-
4
+ {prompt}
5
+ template:
6
+ system: |-
7
+ You are Lynx Coder, a coding agent from Lynx AI.
8
+
9
+ {file:../fragments/workspace.md}
10
+
11
+ {file:../fragments/ctx-helper-files.md}
12
+ model: qwen35b
13
+ inferParams:
14
+ min_p: 0
15
+ top_k: 20
16
+ top_p: 0.85
17
+ temperature: 0.6
18
+ repetition_penalty: 1
19
+ chat_template_kwargs:
20
+ enable_thinking: true
21
+ preserve_thinking: true
22
+ variables:
23
+ required:
24
+ workspace:
25
+ description: The local directory path where to operate
26
+ toolsList:
27
+ - shell
28
+ - python
29
+ - load-image
30
+ - edit-search-replace
31
+ - browser-agent
@@ -0,0 +1,41 @@
1
+ description: Frontend coder team manager agent
2
+ category: code/frontend
3
+ prompt: |-
4
+ {prompt}
5
+ template:
6
+ system: |-
7
+ You are Lynx Coder, a coding agent from Lynx AI. Your can organise the workflow of other agents. As a coordinator you can delegate tasks to agents to orchestrate the work and coordinate the team of agents. Available agents:
8
+
9
+ {file:../fragments/agents-manager-ts.md}
10
+
11
+ {file:../fragments/workspace.md}
12
+
13
+ {file:../fragments/ctx-helper-files.md}
14
+
15
+ Load the typescript-coding-guide skill when you need to code.
16
+
17
+ To visualy check in the browser do the following: instruct the browser agent with the steps to accomplish (clicks,..) and to take a screenshot (make sure the directory exists before transmiting a path to an agent). Then read back the screenshot to visualy inspect anything.
18
+ model: qwen35b
19
+ inferParams:
20
+ min_p: 0
21
+ top_k: 20
22
+ top_p: 0.85
23
+ temperature: 0.6
24
+ repetition_penalty: 1
25
+ chat_template_kwargs:
26
+ enable_thinking: true
27
+ preserve_thinking: true
28
+ variables:
29
+ required:
30
+ workspace:
31
+ description: The local directory path where to operate
32
+ toolsList:
33
+ - read-file
34
+ - write-file
35
+ - edit-search-replace
36
+ - shell
37
+ - python
38
+ - run-agent
39
+ - load-skill
40
+ - read-webpage
41
+ - load-image
@@ -0,0 +1,37 @@
1
+ description: Frontend coder agent
2
+ category: code/frontend
3
+ prompt: |-
4
+ {prompt}
5
+ template:
6
+ system: |-
7
+ You are Lynx Coder, a coding agent from Lynx AI.
8
+
9
+ {file:../fragments/workspace.md}
10
+
11
+ {file:../fragments/ctx-helper-files.md}
12
+
13
+ Load the typescript-coding-guide skill when you need to code. For Playwright always use the headed mode ("--headed" parameter). Close the browser when you are done.
14
+ model: qwen35b
15
+ inferParams:
16
+ min_p: 0
17
+ top_k: 20
18
+ top_p: 0.85
19
+ temperature: 0.6
20
+ repetition_penalty: 1
21
+ chat_template_kwargs:
22
+ enable_thinking: true
23
+ preserve_thinking: true
24
+ variables:
25
+ required:
26
+ workspace:
27
+ description: The local directory path where to operate
28
+ toolsList:
29
+ - read-file
30
+ - write-file
31
+ - edit-search-replace
32
+ - shell
33
+ - python
34
+ - load-skill
35
+ - read-webpage
36
+ - load-image
37
+ - playwright-cli
@@ -0,0 +1,4 @@
1
+ - `frontend-assistant`: a fork of yourself, the default agent. Run it by default to delegate any task.
2
+ - `browser-agent`: a junior agent that manage browser operations using Playwright. Use it to perform browser operations, like making screenshots. Always provide simple and direct instructions to this agent, no complex operations.
3
+
4
+ All the agents can read and write files and have the same tools as you.
@@ -0,0 +1,6 @@
1
+ Project's context helper files:
2
+
3
+ - `AGENTS.md`: general high level context map of the project. Read this first.
4
+ - `.agents/documentation/project-nav.md`: a map of the project
5
+
6
+ To navigate the code read local directories `.agents/documentation/codebase-summary.md` files.
@@ -0,0 +1,6 @@
1
+ You are operating on a Linux filesystem, the current working directory is `/workspace`. If a user refers to a relative path, its relative to `/workspace`.
2
+
3
+ Directories for AI agents:
4
+
5
+ - `/workspace/.agents/documentation`: where the documentation to navigate the codebase is
6
+ - `/workspace/.agents/tasks`: where we store tasks for AI agents. If the user refers to a task check this directory