Skip to content

Devika is the first open-source implementation of an Agentic Software Engineer. Initially started as an open-source alternative to Devin.

Python

Svelte => SvelteKit (#17)

theophine savio theodorec246fa7e9fb2
diff --git a/ui/.DS_Store b/ui/.DS_Store
deleted file mode 100644
index 82b415b..0000000
Binary files a/ui/.DS_Store and /dev/null differ
diff --git a/ui/.gitignore b/ui/.gitignore
index c07ea0f..13ab264 100644
--- a/ui/.gitignore
+++ b/ui/.gitignore
@@ -1,2 +1,11 @@
+.DS_Store
node_modules/
+/build
+/.svelte-kit
+/package
+.env
+.env.*
+!.env.example
+vite.config.js.timestamp-*
+vite.config.ts.timestamp-*
pnpm-lock.yaml
diff --git a/ui/.npmrc b/ui/.npmrc
new file mode 100644
index 0000000..b6f27f1
--- /dev/null
+++ b/ui/.npmrc
@@ -0,0 +1 @@
+engine-strict=true
diff --git a/ui/bun.lockb b/ui/bun.lockb
index 0f55da9..1be2284 100755
Binary files a/ui/bun.lockb and b/ui/bun.lockb differ
diff --git a/ui/index.html b/ui/index.html
deleted file mode 100644
index ba08615..0000000
--- a/ui/index.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>Devika AI</title>
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" />
- </head>
- <body class="bg-slate-950 text-white font-sans">
- <div id="app"></div>
- <script type="module" src="/src/main.js"></script>
- </body>
-</html>
\ No newline at end of file
diff --git a/ui/package.json b/ui/package.json
index bea3278..9bf7a67 100644
--- a/ui/package.json
+++ b/ui/package.json
@@ -1,38 +1,26 @@
{
- "name": "devika-ui",
- "version": "1.0.0",
- "description": "",
- "main": "index.js",
+ "name": "ui",
+ "version": "0.0.1",
+ "private": true,
"scripts": {
- "dev": "vite",
+ "dev": "vite dev",
"build": "vite build",
"preview": "vite preview"
},
- "keywords": [],
- "author": "",
- "license": "ISC",
+ "devDependencies": {
+ "@sveltejs/adapter-auto": "^3.0.0",
+ "@sveltejs/kit": "^2.0.0",
+ "@sveltejs/vite-plugin-svelte": "^3.0.0",
+ "autoprefixer": "^10.4.16",
+ "postcss": "^8.4.32",
+ "postcss-load-config": "^5.0.2",
+ "svelte": "^4.2.7",
+ "tailwindcss": "^3.3.6",
+ "vite": "^5.0.3"
+ },
+ "type": "module",
"dependencies": {
- "@babel/core": "^7.24.1",
- "@babel/preset-env": "^7.24.1",
- "@rollup/plugin-commonjs": "^25.0.7",
- "@rollup/plugin-node-resolve": "^15.2.3",
- "@sveltejs/vite-plugin-svelte": "^3.0.2",
- "autoprefixer": "latest",
- "css-loader": "^6.10.0",
- "mini-css-extract-plugin": "^2.8.1",
- "postcss": "latest",
- "postcss-loader": "^8.1.1",
- "rollup": "^4.13.0",
- "rollup-plugin-css-only": "^4.5.2",
- "rollup-plugin-livereload": "^2.0.5",
- "rollup-plugin-postcss": "^4.0.2",
- "rollup-plugin-svelte": "^7.2.0",
- "rollup-plugin-terser": "^7.0.2",
- "svelte": "^4.2.12",
- "svelte-loader": "^3.2.0",
- "tailwindcss": "latest",
- "vite": "^5.1.6",
- "xterm": "^5.2.0",
+ "xterm": "^5.3.0",
"xterm-addon-fit": "^0.8.0"
}
-}
\ No newline at end of file
+}
diff --git a/ui/postcss.config.cjs b/ui/postcss.config.cjs
new file mode 100644
index 0000000..e48cff5
--- /dev/null
+++ b/ui/postcss.config.cjs
@@ -0,0 +1,13 @@
+const tailwindcss = require("tailwindcss");
+const autoprefixer = require("autoprefixer");
+
+const config = {
+ plugins: [
+ //Some plugins, like tailwindcss/nesting, need to run before Tailwind,
+ tailwindcss(),
+ //But others, like autoprefixer, need to run after,
+ autoprefixer,
+ ],
+};
+
+module.exports = config;
diff --git a/ui/postcss.config.js b/ui/postcss.config.js
deleted file mode 100644
index 12a703d..0000000
--- a/ui/postcss.config.js
+++ /dev/null
@@ -1,6 +0,0 @@
-module.exports = {
- plugins: {
- tailwindcss: {},
- autoprefixer: {},
- },
-};
diff --git a/ui/public/.DS_Store b/ui/public/.DS_Store
deleted file mode 100644
index 3001f71..0000000
Binary files a/ui/public/.DS_Store and /dev/null differ
diff --git a/ui/src/App.svelte b/ui/src/App.svelte
deleted file mode 100644
index fbac006..0000000
--- a/ui/src/App.svelte
+++ /dev/null
@@ -1,76 +0,0 @@
-<script>
- import { onMount } from "svelte";
- import Sidebar from "./components/Sidebar.svelte";
- import ControlPanel from "./components/ControlPanel.svelte";
- import MessageContainer from "./components/MessageContainer.svelte";
- import InternalMonologue from "./components/InternalMonologue.svelte";
- import MessageInput from "./components/MessageInput.svelte";
- import BrowserWidget from "./components/BrowserWidget.svelte";
- import TerminalWidget from "./components/TerminalWidget.svelte";
- import {
- fetchProjectList,
- fetchModelList,
- fetchAgentState,
- fetchMessages,
- checkInternetStatus,
- } from "./api";
-
- onMount(() => {
- localStorage.clear();
-
- const intervalId = setInterval(async () => {
- await fetchProjectList();
- await fetchModelList();
- await fetchAgentState();
- await fetchMessages();
- await checkInternetStatus();
- }, 1000);
-
- return () => clearInterval(intervalId);
- });
-</script>
-
-<div class="flex h-screen">
- <Sidebar />
-
- <div class="flex flex-col flex-1 p-4">
- <ControlPanel />
-
- <div class="flex h-full space-x-4">
- <div class="flex flex-col w-1/2">
- <MessageContainer />
- <InternalMonologue />
- <MessageInput />
- </div>
-
- <div class="flex flex-col w-1/2 space-y-4">
- <BrowserWidget />
- <TerminalWidget />
- </div>
- </div>
- </div>
-</div>
-
-<style>
- @import "tailwindcss/base";
- @import "tailwindcss/components";
- @import "tailwindcss/utilities";
-
- :global(::-webkit-scrollbar) {
- width: 10px;
- }
-
- :global(::-webkit-scrollbar-track) {
- background: #2d3748;
- border-radius: 10px;
- }
-
- :global(::-webkit-scrollbar-thumb) {
- background: #4a5568;
- border-radius: 10px;
- }
-
- :global(::-webkit-scrollbar-thumb:hover) {
- background: #6b7280;
- }
-</style>
\ No newline at end of file
diff --git a/ui/src/app.html b/ui/src/app.html
new file mode 100644
index 0000000..dc69f40
--- /dev/null
+++ b/ui/src/app.html
@@ -0,0 +1,13 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <link rel="icon" href="%sveltekit.assets%/favicon.png" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" />
+ %sveltekit.head%
+ </head>
+ <body data-sveltekit-preload-data="hover" class="bg-slate-950 text-white font-sans">
+ <div style="display: contents">%sveltekit.body%</div>
+ </body>
+</html>
diff --git a/ui/src/app.pcss b/ui/src/app.pcss
new file mode 100644
index 0000000..1a7b7cf
--- /dev/null
+++ b/ui/src/app.pcss
@@ -0,0 +1,4 @@
+/* Write your global styles here, in PostCSS syntax */
+@tailwind base;
+@tailwind components;
+@tailwind utilities;
diff --git a/ui/src/index.css b/ui/src/index.css
deleted file mode 100644
index 5be59b4..0000000
--- a/ui/src/index.css
+++ /dev/null
@@ -1,3 +0,0 @@
-@import 'tailwindcss/base';
-@import 'tailwindcss/components';
-@import 'tailwindcss/utilities';
\ No newline at end of file
diff --git a/ui/src/api.js b/ui/src/lib/api.js
similarity index 100%
rename from ui/src/api.js
rename to ui/src/lib/api.js
diff --git a/ui/src/components/BrowserWidget.svelte b/ui/src/lib/components/BrowserWidget.svelte
similarity index 93%
rename from ui/src/components/BrowserWidget.svelte
rename to ui/src/lib/components/BrowserWidget.svelte
index c2794dd..0c1c72a 100644
--- a/ui/src/components/BrowserWidget.svelte
+++ b/ui/src/lib/components/BrowserWidget.svelte
@@ -1,6 +1,6 @@
<script>
- import { agentState } from "../store";
- import { API_BASE_URL } from "../api";
+ import { agentState } from "$lib/store";
+ import { API_BASE_URL } from "$lib/api";
</script>
<div class="flex flex-col bg-slate-950 border border-indigo-700 rounded flex-1 overflow-hidden">
diff --git a/ui/src/components/ControlPanel.svelte b/ui/src/lib/components/ControlPanel.svelte
similarity index 98%
rename from ui/src/components/ControlPanel.svelte
rename to ui/src/lib/components/ControlPanel.svelte
index 66cbda6..d856fe3 100644
--- a/ui/src/components/ControlPanel.svelte
+++ b/ui/src/lib/components/ControlPanel.svelte
@@ -1,7 +1,7 @@
<script>
import { onMount } from 'svelte';
- import { projectList, modelList, internet } from "../store";
- import { createProject, fetchProjectList, getTokenUsage } from "../api";
+ import { projectList, modelList, internet } from "$lib/store";
+ import { createProject, fetchProjectList, getTokenUsage } from "$lib/api";
let selectedProject = localStorage.getItem("selectedProject") || "Select Project";
let selectedModel = localStorage.getItem("selectedModel") || "Select Model";
diff --git a/ui/src/components/InternalMonologue.svelte b/ui/src/lib/components/InternalMonologue.svelte
similarity index 91%
rename from ui/src/components/InternalMonologue.svelte
rename to ui/src/lib/components/InternalMonologue.svelte
index f5fdbc3..2e72029 100644
--- a/ui/src/components/InternalMonologue.svelte
+++ b/ui/src/lib/components/InternalMonologue.svelte
@@ -1,5 +1,5 @@
<script>
- import { agentState } from "../store";
+ import { agentState } from "$lib/store";
</script>
<div
diff --git a/ui/src/components/MessageContainer.svelte b/ui/src/lib/components/MessageContainer.svelte
similarity index 98%
rename from ui/src/components/MessageContainer.svelte
rename to ui/src/lib/components/MessageContainer.svelte
index 64da8ae..6f68634 100644
--- a/ui/src/components/MessageContainer.svelte
+++ b/ui/src/lib/components/MessageContainer.svelte
@@ -1,5 +1,5 @@
<script>
- import { messages } from "../store";
+ import { messages } from "$lib/store";
import { onMount, afterUpdate } from "svelte";
let messageContainer;
diff --git a/ui/src/components/MessageInput.svelte b/ui/src/lib/components/MessageInput.svelte
similarity index 94%
rename from ui/src/components/MessageInput.svelte
rename to ui/src/lib/components/MessageInput.svelte
index 762e8c1..310f741 100644
--- a/ui/src/components/MessageInput.svelte
+++ b/ui/src/lib/components/MessageInput.svelte
@@ -1,6 +1,6 @@
<script>
- import { sendMessage, executeAgent, API_BASE_URL } from "../api";
- import { agentState, messages } from "../store";
+ import { sendMessage, executeAgent, API_BASE_URL } from "$lib/api";
+ import { agentState, messages } from "$lib/store";
let isAgentActive = false;
diff --git a/ui/src/components/Sidebar.svelte b/ui/src/lib/components/Sidebar.svelte
similarity index 89%
rename from ui/src/components/Sidebar.svelte
rename to ui/src/lib/components/Sidebar.svelte
index 9f51397..b413a8d 100644
--- a/ui/src/components/Sidebar.svelte
+++ b/ui/src/lib/components/Sidebar.svelte
@@ -1,5 +1,5 @@
<div
- class="flex flex-col w-20 bg-slate-950 p-4 space-y-4 items-center shadow-2xl shadow-indigo-700"
+ class="flex flex-col w-20 h-dvh fixed top-0 left-0 z-10 bg-slate-950 p-4 space-y-4 items-center shadow-2xl shadow-indigo-700"
>
<div class="p-5 rounded nav-button relative">
<button class="text-gray-400 hover:text-white flex justify-center w-full">
diff --git a/ui/src/components/TerminalWidget.svelte b/ui/src/lib/components/TerminalWidget.svelte
similarity index 98%
rename from ui/src/components/TerminalWidget.svelte
rename to ui/src/lib/components/TerminalWidget.svelte
index a9d8b72..1700a0c 100644
--- a/ui/src/components/TerminalWidget.svelte
+++ b/ui/src/lib/components/TerminalWidget.svelte
@@ -3,7 +3,7 @@
import { Terminal } from "xterm";
import "xterm/css/xterm.css";
import { FitAddon } from "xterm-addon-fit";
- import { agentState } from "../store";
+ import { agentState } from "$lib/store";
let terminalElement;
let terminal;
diff --git a/ui/src/store.js b/ui/src/lib/store.js
similarity index 100%
rename from ui/src/store.js
rename to ui/src/lib/store.js
diff --git a/ui/src/main.js b/ui/src/main.js
deleted file mode 100644
index a299347..0000000
--- a/ui/src/main.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import App from './App.svelte';
-import './index.css';
-
-const app = new App({
- target: document.getElementById('app'),
-});
-
-export default app;
\ No newline at end of file
diff --git a/ui/src/routes/+layout.js b/ui/src/routes/+layout.js
new file mode 100644
index 0000000..62ad4e4
--- /dev/null
+++ b/ui/src/routes/+layout.js
@@ -0,0 +1 @@
+export const ssr = false
diff --git a/ui/src/routes/+layout.svelte b/ui/src/routes/+layout.svelte
new file mode 100644
index 0000000..7f15a49
--- /dev/null
+++ b/ui/src/routes/+layout.svelte
@@ -0,0 +1,9 @@
+<script>
+ import "../app.pcss"
+ import Sidebar from '$lib/components/Sidebar.svelte'
+</script>
+
+<main class="h-dvh w-[calc(100dvw-5rem)] ml-20">
+ <Sidebar />
+ <slot />
+</main>
\ No newline at end of file
diff --git a/ui/src/routes/+page.svelte b/ui/src/routes/+page.svelte
new file mode 100644
index 0000000..229ed3f
--- /dev/null
+++ b/ui/src/routes/+page.svelte
@@ -0,0 +1,67 @@
+<script>
+ import { onMount } from "svelte";
+ import ControlPanel from "$lib/components/ControlPanel.svelte";
+ import MessageContainer from "$lib/components/MessageContainer.svelte";
+ import InternalMonologue from "$lib/components/InternalMonologue.svelte";
+ import MessageInput from "$lib/components/MessageInput.svelte";
+ import BrowserWidget from "$lib/components/BrowserWidget.svelte";
+ import TerminalWidget from "$lib/components/TerminalWidget.svelte";
+ import {
+ fetchProjectList,
+ fetchModelList,
+ fetchAgentState,
+ fetchMessages,
+ checkInternetStatus,
+ } from "$lib/api";
+
+ onMount(() => {
+ localStorage.clear();
+
+ const intervalId = setInterval(async () => {
+ await fetchProjectList();
+ await fetchModelList();
+ await fetchAgentState();
+ await fetchMessages();
+ await checkInternetStatus();
+ }, 1000);
+
+ return () => clearInterval(intervalId);
+ });
+</script>
+
+<div class="flex flex-col p-4 h-full">
+ <ControlPanel />
+
+ <div class="flex h-full space-x-4">
+ <div class="flex flex-col w-1/2">
+ <MessageContainer />
+ <InternalMonologue />
+ <MessageInput />
+ </div>
+
+ <div class="flex flex-col w-1/2 space-y-4">
+ <BrowserWidget />
+ <TerminalWidget />
+ </div>
+ </div>
+</div>
+
+<style>
+ :global(::-webkit-scrollbar) {
+ width: 10px;
+ }
+
+ :global(::-webkit-scrollbar-track) {
+ background: #2d3748;
+ border-radius: 10px;
+ }
+
+ :global(::-webkit-scrollbar-thumb) {
+ background: #4a5568;
+ border-radius: 10px;
+ }
+
+ :global(::-webkit-scrollbar-thumb:hover) {
+ background: #6b7280;
+ }
+</style>
diff --git a/ui/public/assets/bootup.mp3 b/ui/static/assets/bootup.mp3
similarity index 100%
rename from ui/public/assets/bootup.mp3
rename to ui/static/assets/bootup.mp3
diff --git a/ui/public/assets/devika-avatar.png b/ui/static/assets/devika-avatar.png
similarity index 100%
rename from ui/public/assets/devika-avatar.png
rename to ui/static/assets/devika-avatar.png
diff --git a/ui/public/assets/loading-lottie.json b/ui/static/assets/loading-lottie.json
similarity index 100%
rename from ui/public/assets/loading-lottie.json
rename to ui/static/assets/loading-lottie.json
diff --git a/ui/public/assets/user-avatar.png b/ui/static/assets/user-avatar.png
similarity index 100%
rename from ui/public/assets/user-avatar.png
rename to ui/static/assets/user-avatar.png
diff --git a/ui/static/favicon.png b/ui/static/favicon.png
new file mode 100644
index 0000000..825b9e6
Binary files /dev/null and b/ui/static/favicon.png differ
diff --git a/ui/public/index.html b/ui/static/index.html
similarity index 100%
rename from ui/public/index.html
rename to ui/static/index.html
diff --git a/ui/svelte.config.js b/ui/svelte.config.js
new file mode 100644
index 0000000..4df404a
--- /dev/null
+++ b/ui/svelte.config.js
@@ -0,0 +1,16 @@
+import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
+import adapter from "@sveltejs/adapter-auto";
+
+/** @type {import('@sveltejs/kit').Config} */
+const config = {
+ kit: {
+ // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
+ // If your environment is not supported or you settled on a specific environment, switch out the adapter.
+ // See https://kit.svelte.dev/docs/adapters for more information about adapters.
+ adapter: adapter(),
+ },
+
+ preprocess: [vitePreprocess({})],
+};
+
+export default config;
diff --git a/ui/tailwind.config.cjs b/ui/tailwind.config.cjs
new file mode 100644
index 0000000..75fd684
--- /dev/null
+++ b/ui/tailwind.config.cjs
@@ -0,0 +1,12 @@
+/** @type {import('tailwindcss').Config}*/
+const config = {
+ content: ["./src/**/*.{html,js,svelte,ts}"],
+
+ theme: {
+ extend: {},
+ },
+
+ plugins: [],
+};
+
+module.exports = config;
diff --git a/ui/tailwind.config.js b/ui/tailwind.config.js
deleted file mode 100644
index cca3cf7..0000000
--- a/ui/tailwind.config.js
+++ /dev/null
@@ -1,11 +0,0 @@
-module.exports = {
- purge: ["./index.html", "./src/**/*.{svelte,js,ts}"],
- darkMode: false,
- theme: {
- extend: {},
- },
- variants: {
- extend: {},
- },
- plugins: [],
-};
diff --git a/ui/vite.config.js b/ui/vite.config.js
new file mode 100644
index 0000000..576a486
--- /dev/null
+++ b/ui/vite.config.js
@@ -0,0 +1,9 @@
+import { sveltekit } from '@sveltejs/kit/vite';
+import { defineConfig } from 'vite';
+
+export default defineConfig({
+ plugins: [sveltekit()],
+ server: {
+ port: 3000,
+ },
+});
diff --git a/ui/vite.config.mjs b/ui/vite.config.mjs
deleted file mode 100644
index 484cb91..0000000
--- a/ui/vite.config.mjs
+++ /dev/null
@@ -1,9 +0,0 @@
-import { defineConfig } from 'vite';
-import { svelte } from '@sveltejs/vite-plugin-svelte';
-
-export default defineConfig({
- plugins: [svelte()],
- server: {
- port: 3000,
- },
-});
\ No newline at end of file