ui: move Llama Chat to SvelteKit 3 and its built-in service worker (#32463)
* ui: replace deprecated packages and fix npm audit findings
Swap the mdast stub for @types/mdast, move the katex override to 0.19.0,
and override glob, source-map and html-encoding-sniffer under
workbox-build and http-server so installs no longer pull deprecated
packages. Apply the non-breaking npm audit fixes to the lockfile.
Assisted-by: Claude (Opus 5.5 Medium)
* ui: migrate Llama Chat to SvelteKit 3 and its built-in service worker
Move to SvelteKit 3, Vite 8, TypeScript 6 and Storybook 10.6. The
SvelteKit options move from svelte.config.js into sveltekit() in
vite.config.ts, $lib imports become #lib subpath imports from
package.json, and $app/environment becomes $app/env. Modules named
server.* or living under a server/ folder are server-only in SvelteKit 3,
so the llama-server components, store and enums move to llama-server
names.
@vite-pwa/sveltekit and Workbox give way to SvelteKit's own service
worker in src/service-worker, registered by usePwa(), which precaches the
app files and leaves API requests to the network. A small plugin emits
manifest.webmanifest. static/sw.js removes the worker of older builds, and
llama-server serves a self-removing service-worker.js as well as sw.js
when the built-in UI is off or replaced.
Assisted-by: Claude (Opus 5.5 Medium)
* ui: use SvelteKit 3's update detection and Svelte 5's current patterns
A page the service worker doesn't control now learns of a new build
from SvelteKit itself: `updated` from $app/state checks
_app/version.json on navigation, on focus and every hour. It replaces
the version Llama Chat kept in localStorage and compared by hand.
Reload on the update prompt pulls in the new worker and activates it
before reloading, so one click lands on the new build, whether or not
a worker controlled the page.
Following Svelte's current guidance:
- usePwa keeps its state in $state rather than a store, and no effect
checks `browser`
- nearViewport, autoResizeTextarea and the custom CSS injection are
attachments ({@attach}) rather than actions (use:)
- class lists use arrays rather than class: directives
- the chat contexts come from createContext, typed, in place of
setContext/getContext with string keys
- ActionIconCopyToClipboard takes $props() rather than `export let`
Assisted-by: Claude (Opus 5.5 Medium)
* ui: move to ESLint 10
ESLint 9 is out of support. Every plugin the app uses supports 10:
typescript-eslint, eslint-plugin-svelte, perfectionist,
simple-import-sort, eslint-plugin-storybook and eslint-config-prettier.
@eslint/js and @eslint/compat follow.
ESLint 10's recommended rules ask for two things the code now does:
errors rethrown from a catch keep the caught error as their `cause`,
and no variable starts with a value that every path overwrites.
Assisted-by: Claude (Opus 5.5 Medium)
* ui: override minimatch to clear npm audit's last finding
ESLint 10.14, @eslint/config-array 0.23.5 and typescript-eslint 8.72
depend on minimatch 10, which GHSA-g3hv-75wg-m249 (denial of service
via globparts amplification) affects below 11.0.1. Their fixed releases
move to minimatch 11 but are all younger than the repo's 7-day
min-release-age, so an override pins minimatch 11.0.5, the newest the
rule allows. The three only call new Minimatch(), match() and
minimatch(), which minimatch 11 keeps. npm audit now finds nothing.
Assisted-by: Claude (Opus 5.5 Medium)
This commit is contained in:
1 parent
4df3f2959c
commit
67cf8967eb
724 files changed
+4824
-9272
No files matched your search
@@ -72,11 +72,13 @@ function(ui_validate_assets files in_dir)
|
||||
set(found_index FALSE)
|
||||
set(found_manifest FALSE)
|
||||
set(found_sw FALSE)
|
||||
# the service worker: SvelteKit's service-worker.js, or Workbox's workbox-*.js in the
|
||||
# prebuilt archives of builds before SvelteKit 3
|
||||
set(found_service_worker FALSE)
|
||||
set(found_build_json FALSE)
|
||||
set(found_version_json FALSE)
|
||||
set(found_bundle_js FALSE)
|
||||
set(found_bundle_css FALSE)
|
||||
set(found_workbox_js FALSE)
|
||||
|
||||
foreach(f ${files})
|
||||
get_filename_component(base "${f}" NAME)
|
||||
@@ -86,6 +88,8 @@ function(ui_validate_assets files in_dir)
|
||||
set(found_manifest TRUE)
|
||||
elseif(base STREQUAL "sw.js")
|
||||
set(found_sw TRUE)
|
||||
elseif(base STREQUAL "service-worker.js" OR base MATCHES "^workbox.*\\.js$")
|
||||
set(found_service_worker TRUE)
|
||||
elseif(base STREQUAL "build.json")
|
||||
set(found_build_json TRUE)
|
||||
elseif(base STREQUAL "version.json")
|
||||
@@ -94,8 +98,6 @@ function(ui_validate_assets files in_dir)
|
||||
set(found_bundle_js TRUE)
|
||||
elseif(base MATCHES "^bundle.*\\.css$")
|
||||
set(found_bundle_css TRUE)
|
||||
elseif(base MATCHES "^workbox.*\\.js$")
|
||||
set(found_workbox_js TRUE)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
@@ -109,6 +111,9 @@ function(ui_validate_assets files in_dir)
|
||||
if(NOT found_sw)
|
||||
list(APPEND missing "sw.js")
|
||||
endif()
|
||||
if(NOT found_service_worker)
|
||||
list(APPEND missing "service-worker.js (or workbox[hash].js in an older build)")
|
||||
endif()
|
||||
if(NOT found_build_json)
|
||||
list(APPEND missing "build.json")
|
||||
endif()
|
||||
@@ -121,9 +126,6 @@ function(ui_validate_assets files in_dir)
|
||||
if(NOT found_bundle_css)
|
||||
list(APPEND missing "bundle[hash].css")
|
||||
endif()
|
||||
if(NOT found_workbox_js)
|
||||
list(APPEND missing "workbox[hash].js")
|
||||
endif()
|
||||
|
||||
if(missing)
|
||||
set(listing "")
|
||||
|
||||
@@ -564,9 +564,10 @@ bool server_http_context::init_listener(const common_params & params) {
|
||||
srv->Get(params.api_prefix + "/index.html", serve_asset_cached("index.html", true, cache_revalidate));
|
||||
|
||||
// All remaining assets registered directly from the embedded asset table.
|
||||
// PWA revalidation files (sw.js, manifest, version.json) use no-cache;
|
||||
// PWA revalidation files (service workers, manifest, version.json) use no-cache;
|
||||
// everything else is immutable.
|
||||
static const std::unordered_set<std::string> no_cache_names = {
|
||||
"service-worker.js",
|
||||
"sw.js",
|
||||
"manifest.webmanifest",
|
||||
"_app/version.json",
|
||||
@@ -588,9 +589,10 @@ bool server_http_context::init_listener(const common_params & params) {
|
||||
}
|
||||
|
||||
// a browser that used the built-in UI keeps its service worker, so it shows the old UI even after the UI is replaced or disabled
|
||||
// answer the worker's update check with a worker that removes itself; a sw.js in public_path is served first
|
||||
// answer the worker's update check with a worker that removes itself; a worker file in public_path is served first
|
||||
// sw.js is the worker path of older UI builds, service-worker.js the current one
|
||||
if (!params.ui || !params.public_path.empty()) {
|
||||
srv->Get(params.api_prefix + "/sw.js", [](const httplib::Request &, httplib::Response & res) {
|
||||
const auto serve_sw_remove = [](const httplib::Request &, httplib::Response & res) {
|
||||
static constexpr const char * sw_remove_js = R"(
|
||||
self.addEventListener('install', () => self.skipWaiting());
|
||||
self.addEventListener('activate', (e) => e.waitUntil((async () => {
|
||||
@@ -601,7 +603,9 @@ self.addEventListener('activate', (e) => e.waitUntil((async () => {
|
||||
)";
|
||||
res.set_header("Cache-Control", "no-cache");
|
||||
res.set_content(sw_remove_js, "application/javascript");
|
||||
});
|
||||
};
|
||||
srv->Get(params.api_prefix + "/sw.js", serve_sw_remove);
|
||||
srv->Get(params.api_prefix + "/service-worker.js", serve_sw_remove);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Preview } from '@storybook/sveltekit';
|
||||
import '../src/app.css';
|
||||
import ModeWatcherDecorator from './decorators/ModeWatcherDecorator.svelte';
|
||||
import TooltipProviderDecorator from './decorators/TooltipProviderDecorator.svelte';
|
||||
import type { Preview } from '@storybook/sveltekit';
|
||||
|
||||
const preview: Preview = {
|
||||
parameters: {
|
||||
|
||||
@@ -209,7 +209,7 @@ ui/apps/chat/ → build → build/ui/apps/chat/dist/
|
||||
### SvelteKit Configuration
|
||||
|
||||
```javascript
|
||||
// svelte.config.js
|
||||
// vite.config.ts - options passed to sveltekit({ ... })
|
||||
adapter: adapter({
|
||||
pages: '../../../build/ui/apps/chat/dist', // Output directory
|
||||
assets: '../../../build/ui/apps/chat/dist', // Static assets
|
||||
@@ -363,7 +363,7 @@ Components are organized in `app/` (application-specific) and `ui/` (shadcn-svel
|
||||
| `DialogConfirmation` | Generic confirmation for destructive actions |
|
||||
| `DialogConversationRename` | Edit conversation title |
|
||||
|
||||
**Server/Model Components** (`app/server/`, `app/models/`):
|
||||
**Server/Model Components** (`app/servers/`, `app/models/`):
|
||||
|
||||
| Component | Responsibility |
|
||||
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------- |
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
|
||||
import svelteConfig from './svelte.config.js';
|
||||
import { includeIgnoreFile } from '@eslint/compat';
|
||||
import js from '@eslint/js';
|
||||
import { loadConfig } from '@sveltejs/load-config';
|
||||
import prettier from 'eslint-config-prettier';
|
||||
import perfectionist from 'eslint-plugin-perfectionist';
|
||||
import simpleImportSort from 'eslint-plugin-simple-import-sort';
|
||||
@@ -11,6 +11,7 @@ import globals from 'globals';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import ts from 'typescript-eslint';
|
||||
|
||||
const svelteConfig = (await loadConfig('./', { traverse: false }))?.config;
|
||||
const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url));
|
||||
// Require a blank line between sibling element-like nodes in a Svelte template
|
||||
// (elements, components, and the {#if} / {#each} / {#await} / {#snippet} /
|
||||
|
||||
Generated
+1944
-6539
File diff suppressed because it is too large.
Load diff
+38
-32
@@ -14,7 +14,7 @@
|
||||
"reset": "rm -rf .svelte-kit node_modules",
|
||||
"format": "eslint --fix . && prettier --write .",
|
||||
"format:files": "sh -c 'eslint --fix \"$@\" && prettier --write \"$@\"' sh",
|
||||
"lint": "prettier --check . && eslint .",
|
||||
"lint": "svelte-kit sync && prettier --check . && eslint .",
|
||||
"test": "npm run test:ui -- --run && npm run test:client -- --run && npm run test:unit -- --run && npm run test:e2e",
|
||||
"test:e2e": "playwright test",
|
||||
"test:e2e:pwa": "playwright test tests/e2e/pwa.e2e.ts",
|
||||
@@ -28,8 +28,8 @@
|
||||
"test:unit:pwa": "vitest --project=unit --run tests/unit/pwa.spec.ts",
|
||||
"test:pwa": "npm run test:unit:pwa && npm run test:e2e:pwa",
|
||||
"test:ui": "vitest --project=ui",
|
||||
"storybook": "storybook dev -p 6006",
|
||||
"build-storybook": "storybook build",
|
||||
"storybook": "svelte-kit sync && storybook dev -p 6006",
|
||||
"build-storybook": "svelte-kit sync && storybook build",
|
||||
"cleanup": "rm -rf .svelte-kit build node_modules test-results dist dev-dist debug-storybook.log static/pwa-*.png static/maskable-icon-*.png static/apple-touch-icon-*.png static/apple-splash-*.png static/favicon*.ico"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -39,28 +39,29 @@
|
||||
"@codemirror/language": "6.13.1",
|
||||
"@codemirror/state": "6.7.6",
|
||||
"@codemirror/view": "6.43.15",
|
||||
"@eslint/compat": "1.4.1",
|
||||
"@eslint/js": "9.39.2",
|
||||
"@eslint/compat": "2.1.1",
|
||||
"@eslint/js": "10.0.1",
|
||||
"@internationalized/date": "3.12.2",
|
||||
"@lezer/highlight": "1.2.5",
|
||||
"@lucide/svelte": "1.46.0",
|
||||
"@modelcontextprotocol/sdk": "1.32.1",
|
||||
"@playwright/test": "1.56.1",
|
||||
"@storybook/addon-a11y": "10.6.2",
|
||||
"@storybook/addon-docs": "10.6.2",
|
||||
"@storybook/addon-mcp": "10.6.2",
|
||||
"@storybook/addon-svelte-csf": "5.1.5",
|
||||
"@storybook/addon-vitest": "10.6.2",
|
||||
"@storybook/sveltekit": "10.6.2",
|
||||
"@sveltejs/adapter-static": "3.0.10",
|
||||
"@sveltejs/kit": "2.70.2",
|
||||
"@sveltejs/vite-plugin-svelte": "6.2.1",
|
||||
"@storybook/addon-a11y": "10.6.6",
|
||||
"@storybook/addon-docs": "10.6.6",
|
||||
"@storybook/addon-mcp": "10.6.6",
|
||||
"@storybook/addon-svelte-csf": "5.1.6",
|
||||
"@storybook/addon-vitest": "10.6.6",
|
||||
"@storybook/sveltekit": "10.6.6",
|
||||
"@sveltejs/adapter-static": "4.0.1",
|
||||
"@sveltejs/kit": "3.2.0",
|
||||
"@sveltejs/load-config": "0.2.3",
|
||||
"@sveltejs/vite-plugin-svelte": "7.3.1",
|
||||
"@tailwindcss/forms": "0.5.10",
|
||||
"@tailwindcss/typography": "0.5.20",
|
||||
"@tailwindcss/vite": "4.1.11",
|
||||
"@tailwindcss/vite": "4.3.5",
|
||||
"@types/mdast": "4.0.4",
|
||||
"@types/node": "24.13.0",
|
||||
"@vite-pwa/assets-generator": "1.0.4",
|
||||
"@vite-pwa/sveltekit": "1.1.0",
|
||||
"@vitest/browser": "4.1.12",
|
||||
"@vitest/browser-playwright": "4.1.12",
|
||||
"@vitest/coverage-v8": "4.1.12",
|
||||
@@ -68,18 +69,17 @@
|
||||
"clsx": "2.1.1",
|
||||
"dexie": "4.4.3",
|
||||
"dompurify": "3.4.17",
|
||||
"eslint": "9.39.4",
|
||||
"eslint": "10.14.0",
|
||||
"eslint-config-prettier": "10.1.8",
|
||||
"eslint-plugin-perfectionist": "^5.10.1",
|
||||
"eslint-plugin-simple-import-sort": "^14.0.0",
|
||||
"eslint-plugin-storybook": "10.6.2",
|
||||
"eslint-plugin-svelte": "3.19.0",
|
||||
"eslint-plugin-storybook": "10.6.6",
|
||||
"eslint-plugin-svelte": "3.24.1",
|
||||
"fflate": "0.8.3",
|
||||
"globals": "16.5.0",
|
||||
"highlight.js": "11.11.1",
|
||||
"http-server": "14.1.1",
|
||||
"llama-brand": "https://codeload.github.com/ggml-org/llama-brand/tar.gz/f05540643c1ca2a18d732ed6491c839686da9a3a",
|
||||
"mdast": "3.0.0",
|
||||
"mdsvex": "0.12.7",
|
||||
"mermaid": "11.17.2",
|
||||
"mode-watcher": "1.1.0",
|
||||
@@ -98,32 +98,38 @@
|
||||
"remark-math": "6.0.0",
|
||||
"remark-rehype": "11.1.2",
|
||||
"sass": "1.100.0",
|
||||
"storybook": "10.6.2",
|
||||
"svelte": "5.56.1",
|
||||
"svelte-check": "4.6.0",
|
||||
"storybook": "10.6.6",
|
||||
"svelte": "5.57.3",
|
||||
"svelte-check": "4.7.8",
|
||||
"svelte-sonner": "1.1.1",
|
||||
"tailwind-merge": "3.6.0",
|
||||
"tailwind-variants": "3.3.1",
|
||||
"tailwindcss": "4.3.0",
|
||||
"tailwindcss": "4.3.5",
|
||||
"tw-animate-css": "1.4.0",
|
||||
"typescript": "5.9.3",
|
||||
"typescript-eslint": "8.60.1",
|
||||
"typescript": "6.0.3",
|
||||
"typescript-eslint": "8.72.1",
|
||||
"unified": "11.0.5",
|
||||
"unist-util-visit": "5.1.0",
|
||||
"uuid": "13.0.2",
|
||||
"vaul-svelte": "1.0.0-next.7",
|
||||
"vite": "7.3.7",
|
||||
"vite-plugin-devtools-json": "0.2.1",
|
||||
"vite": "8.3.6",
|
||||
"vite-plugin-devtools-json": "1.1.2",
|
||||
"vitest": "4.1.12",
|
||||
"vitest-browser-svelte": "2.1.1",
|
||||
"workbox-window": "7.4.1"
|
||||
"vitest-browser-svelte": "2.1.1"
|
||||
},
|
||||
"overrides": {
|
||||
"@storybook/svelte": "10.6.2",
|
||||
"@storybook/svelte": "10.6.6",
|
||||
"cookie": "1.1.1",
|
||||
"katex": "0.18.11",
|
||||
"http-server": {
|
||||
"html-encoding-sniffer": "6.0.0"
|
||||
},
|
||||
"katex": "0.19.0",
|
||||
"minimatch": "11.0.5",
|
||||
"postcss-selector-parser": "7.1.6",
|
||||
"sharp": "0.35.5",
|
||||
"valibot": "1.4.2"
|
||||
},
|
||||
"imports": {
|
||||
"#lib/*": "./src/lib/*"
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,6 @@ import { existsSync, writeFileSync } from 'node:fs';
|
||||
import { resolve } from 'path';
|
||||
import type { Plugin } from 'vite';
|
||||
|
||||
let processed = false;
|
||||
|
||||
const OUTPUT_DIR = process.env.LLAMA_UI_OUT_DIR ?? BUILD_CONFIG.OUTPUT_DIR;
|
||||
|
||||
/**
|
||||
@@ -16,13 +14,10 @@ const OUTPUT_DIR = process.env.LLAMA_UI_OUT_DIR ?? BUILD_CONFIG.OUTPUT_DIR;
|
||||
export function buildInfoPlugin(): Plugin {
|
||||
return {
|
||||
apply: 'build',
|
||||
closeBundle() {
|
||||
setTimeout(() => {
|
||||
buildApp: {
|
||||
// post order runs after the SvelteKit adapter has written the output
|
||||
async handler() {
|
||||
try {
|
||||
if (processed) return;
|
||||
|
||||
processed = true;
|
||||
|
||||
const buildNumber = process.env.LLAMA_BUILD_NUMBER || 'b0000';
|
||||
const outDir = resolve(OUTPUT_DIR);
|
||||
const indexPath = resolve(outDir, 'index.html');
|
||||
@@ -36,7 +31,8 @@ export function buildInfoPlugin(): Plugin {
|
||||
} catch (error) {
|
||||
console.error('Failed to write build.json:', error);
|
||||
}
|
||||
}, 100);
|
||||
},
|
||||
order: 'post'
|
||||
},
|
||||
name: 'llamacpp:build-info'
|
||||
};
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { HEADERS } from '../src/lib/constants/headers.constants';
|
||||
import {
|
||||
PWA_FILE_PATHS,
|
||||
PWA_MANIFEST,
|
||||
PWA_MANIFEST_PLUGIN
|
||||
} from '../src/lib/constants/pwa.constants';
|
||||
import type { Plugin } from 'vite';
|
||||
|
||||
const MANIFEST_SOURCE = JSON.stringify(PWA_MANIFEST);
|
||||
// the build writes files relative to its output directory: the path without its leading slash
|
||||
const MANIFEST_FILE = PWA_FILE_PATHS.MANIFEST.slice(1);
|
||||
|
||||
/**
|
||||
* Serve manifest.webmanifest in dev and emit it next to the client build output.
|
||||
* The adapter copies the client output, so the file lands at the root of the build.
|
||||
*/
|
||||
export function pwaManifestPlugin(): Plugin {
|
||||
return {
|
||||
configureServer(server) {
|
||||
server.middlewares.use(PWA_FILE_PATHS.MANIFEST, (_req, res) => {
|
||||
res.setHeader(HEADERS.CONTENT_TYPE, PWA_MANIFEST_PLUGIN.CONTENT_TYPE);
|
||||
res.end(MANIFEST_SOURCE);
|
||||
});
|
||||
},
|
||||
generateBundle() {
|
||||
if (this.environment.name !== PWA_MANIFEST_PLUGIN.ENVIRONMENT) return;
|
||||
|
||||
this.emitFile({ fileName: MANIFEST_FILE, source: MANIFEST_SOURCE, type: 'asset' });
|
||||
},
|
||||
name: PWA_MANIFEST_PLUGIN.NAME
|
||||
};
|
||||
}
|
||||
@@ -3,8 +3,6 @@ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
||||
import { resolve } from 'path';
|
||||
import type { Plugin } from 'vite';
|
||||
|
||||
let processed = false;
|
||||
|
||||
const OUTPUT_DIR = process.env.LLAMA_UI_OUT_DIR ?? BUILD_CONFIG.OUTPUT_DIR;
|
||||
|
||||
function rewrite(path: string, pairs: [string, string][]): void {
|
||||
@@ -31,35 +29,25 @@ function rewrite(path: string, pairs: [string, string][]): void {
|
||||
* SvelteKit bakes root absolute /_app/ paths into the SPA fallback because paths.relative
|
||||
* does not apply to a depth agnostic fallback page. Rewriting to ./_app/ lets a plain
|
||||
* recursive copy of the output into /any/subdir/ resolve assets against the document URL.
|
||||
* Runs after adapter-static writes index.html and the PWA plugin writes sw.js, deferred the
|
||||
* same way as buildInfoPlugin so the emitted files exist.
|
||||
* Runs after adapter-static writes index.html.
|
||||
*/
|
||||
export function relativizeBasePlugin(): Plugin {
|
||||
return {
|
||||
apply: 'build',
|
||||
closeBundle() {
|
||||
setTimeout(() => {
|
||||
buildApp: {
|
||||
// post order runs after the SvelteKit adapter has written the output
|
||||
async handler() {
|
||||
try {
|
||||
if (processed) return;
|
||||
|
||||
processed = true;
|
||||
|
||||
const outDir = resolve(OUTPUT_DIR);
|
||||
|
||||
// index.html: modulepreload, stylesheet and bootstrap import reference "/_app/
|
||||
rewrite(resolve(outDir, 'index.html'), [['"/_app/', '"./_app/']]);
|
||||
|
||||
// sw.js: the only absolute entries are the navigate fallback precache key and handler
|
||||
rewrite(resolve(outDir, 'sw.js'), [
|
||||
['{url:"/"', '{url:"./"'],
|
||||
['createHandlerBoundToURL("/"', 'createHandlerBoundToURL("./"']
|
||||
]);
|
||||
|
||||
console.log('Relativized base refs in index.html and sw.js');
|
||||
console.log('Relativized base refs in index.html');
|
||||
} catch (error) {
|
||||
console.error('Failed to relativize base refs:', error);
|
||||
}
|
||||
}, 100);
|
||||
},
|
||||
order: 'post'
|
||||
},
|
||||
name: 'llamacpp:relativize-base'
|
||||
};
|
||||
|
||||
@@ -11,8 +11,6 @@ import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
|
||||
import { resolve } from 'path';
|
||||
import type { Plugin } from 'vite';
|
||||
|
||||
let processed = false;
|
||||
|
||||
const OUTPUT_DIR = process.env.LLAMA_UI_OUT_DIR ?? BUILD_CONFIG.OUTPUT_DIR;
|
||||
|
||||
/**
|
||||
@@ -85,13 +83,10 @@ export function generateSplashScreenLinks(outDir: string): string[] {
|
||||
export function splashScreenPlugin(): Plugin {
|
||||
return {
|
||||
apply: 'build',
|
||||
closeBundle() {
|
||||
setTimeout(() => {
|
||||
buildApp: {
|
||||
// post order runs after the SvelteKit adapter has written the output
|
||||
async handler() {
|
||||
try {
|
||||
if (processed) return;
|
||||
|
||||
processed = true;
|
||||
|
||||
const outDir = resolve(OUTPUT_DIR);
|
||||
const indexPath = resolve(outDir, 'index.html');
|
||||
|
||||
@@ -123,7 +118,8 @@ export function splashScreenPlugin(): Plugin {
|
||||
} catch (error) {
|
||||
console.error('Failed to process build output:', error);
|
||||
}
|
||||
}, 100);
|
||||
},
|
||||
order: 'post'
|
||||
},
|
||||
name: 'llamacpp:splash-screen'
|
||||
};
|
||||
|
||||
@@ -10,7 +10,6 @@ set(UI_SOURCE_FILES
|
||||
package-lock.json
|
||||
src/.gitignore
|
||||
vite.config.ts
|
||||
svelte.config.js
|
||||
tsconfig.json
|
||||
scripts/vite-plugin-llama-cpp-build.ts
|
||||
)
|
||||
Vendored
+2
-4
@@ -1,9 +1,7 @@
|
||||
// See https://svelte.dev/docs/kit/types#app.d.ts
|
||||
// for information about these interfaces
|
||||
|
||||
import 'vite-plugin-pwa/pwa-assets';
|
||||
import 'vite-plugin-pwa/svelte';
|
||||
import { ModelModality, ServerModelStatus, ServerRole } from '$lib/enums';
|
||||
import { ModelModality, ServerModelStatus, ServerRole } from '#lib/enums/index.ts';
|
||||
// Import chat types from dedicated module
|
||||
import type {
|
||||
// API types
|
||||
@@ -57,7 +55,7 @@ import type {
|
||||
SettingsConfigType,
|
||||
SettingsConfigValue,
|
||||
SettingsFieldConfig
|
||||
} from '$lib/types';
|
||||
} from '#lib/types/index.ts';
|
||||
|
||||
declare global {
|
||||
// namespace App {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Button, type ButtonSize, type ButtonVariant } from '$lib/components/ui/button';
|
||||
import * as Tooltip from '$lib/components/ui/tooltip';
|
||||
import { TooltipSide } from '$lib/enums';
|
||||
import { Button, type ButtonSize, type ButtonVariant } from '#lib/components/ui/button/index.ts';
|
||||
import * as Tooltip from '#lib/components/ui/tooltip/index.ts';
|
||||
import { TooltipSide } from '#lib/enums/index.ts';
|
||||
import type { Component } from 'svelte';
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
<script lang="ts">
|
||||
import ActionIcon from './ActionIcon.svelte';
|
||||
import { Copy } from '@lucide/svelte';
|
||||
import { ICON_CLASS_DEFAULT } from '$lib/constants';
|
||||
import { copyToClipboard } from '$lib/utils';
|
||||
import { ICON_CLASS_DEFAULT } from '#lib/constants/index.ts';
|
||||
import { copyToClipboard } from '#lib/utils/index.ts';
|
||||
|
||||
export let ariaLabel: string = 'Copy to clipboard';
|
||||
export let canCopy: boolean = true;
|
||||
export let text: string;
|
||||
interface Props {
|
||||
ariaLabel?: string;
|
||||
canCopy?: boolean;
|
||||
text: string;
|
||||
}
|
||||
|
||||
let { ariaLabel = 'Copy to clipboard', canCopy = true, text }: Props = $props();
|
||||
</script>
|
||||
|
||||
<ActionIcon
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import * as Tooltip from '$lib/components/ui/tooltip';
|
||||
import { deviceStore } from '$lib/stores';
|
||||
import * as Tooltip from '#lib/components/ui/tooltip/index.ts';
|
||||
import { deviceStore } from '#lib/stores/index.ts';
|
||||
import type { Component, Snippet } from 'svelte';
|
||||
import type { HTMLButtonAttributes } from 'svelte/elements';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { MODALITY_ICONS, MODALITY_LABELS } from '$lib/constants';
|
||||
import { ModelModality } from '$lib/enums';
|
||||
import { MODALITY_ICONS, MODALITY_LABELS } from '#lib/constants/index.ts';
|
||||
import { ModelModality } from '#lib/enums/index.ts';
|
||||
|
||||
interface Props {
|
||||
modalities: ModelModality[];
|
||||
|
||||
+4
-4
@@ -4,10 +4,10 @@
|
||||
DialogChatAttachmentsPreview,
|
||||
DialogMcpResourcePreview,
|
||||
ScrollCarousel
|
||||
} from '$lib/components/app';
|
||||
import { ScrollCarouselVariant } from '$lib/enums';
|
||||
import type { DatabaseMessageExtraMcpResource } from '$lib/types';
|
||||
import { getAttachmentDisplayItems, isMcpPrompt, isMcpResource } from '$lib/utils';
|
||||
} from '#lib/components/app/index.ts';
|
||||
import { ScrollCarouselVariant } from '#lib/enums/index.ts';
|
||||
import type { DatabaseMessageExtraMcpResource } from '#lib/types/index.ts';
|
||||
import { getAttachmentDisplayItems, isMcpPrompt, isMcpResource } from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
class?: string;
|
||||
|
||||
+4
-4
@@ -4,15 +4,15 @@
|
||||
ChatAttachmentsListItemMcpResource,
|
||||
ChatAttachmentsListItemThumbnailFile,
|
||||
ChatAttachmentsListItemThumbnailImage
|
||||
} from '$lib/components/app';
|
||||
import { AttachmentType } from '$lib/enums';
|
||||
} from '#lib/components/app/index.ts';
|
||||
import { AttachmentType } from '#lib/enums/index.ts';
|
||||
import type {
|
||||
ChatAttachmentDisplayItem,
|
||||
DatabaseMessageExtraMcpPrompt,
|
||||
DatabaseMessageExtraMcpResource,
|
||||
MCPResourceAttachment
|
||||
} from '$lib/types';
|
||||
import { isMcpPrompt, isMcpResource, isPdfFile } from '$lib/utils';
|
||||
} from '#lib/types/index.ts';
|
||||
import { isMcpPrompt, isMcpResource, isPdfFile } from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
class?: string;
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { X } from '@lucide/svelte';
|
||||
import { ActionIcon, ChatMessageMcpPromptContent } from '$lib/components/app';
|
||||
import { McpPromptVariant } from '$lib/enums';
|
||||
import type { DatabaseMessageExtraMcpPrompt } from '$lib/types';
|
||||
import { ActionIcon, ChatMessageMcpPromptContent } from '#lib/components/app/index.ts';
|
||||
import { McpPromptVariant } from '#lib/enums/index.ts';
|
||||
import type { DatabaseMessageExtraMcpPrompt } from '#lib/types/index.ts';
|
||||
|
||||
interface Props {
|
||||
class?: string;
|
||||
|
||||
+5
-5
@@ -1,11 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { AlertCircle, Loader2 } from '@lucide/svelte';
|
||||
import { X } from '@lucide/svelte';
|
||||
import { ActionIcon } from '$lib/components/app';
|
||||
import * as Tooltip from '$lib/components/ui/tooltip';
|
||||
import { mcpStore } from '$lib/stores';
|
||||
import type { MCPResourceAttachment } from '$lib/types';
|
||||
import { getResourceDisplayName, getResourceIcon } from '$lib/utils';
|
||||
import { ActionIcon } from '#lib/components/app/index.ts';
|
||||
import * as Tooltip from '#lib/components/ui/tooltip/index.ts';
|
||||
import { mcpStore } from '#lib/stores/index.ts';
|
||||
import type { MCPResourceAttachment } from '#lib/types/index.ts';
|
||||
import { getResourceDisplayName, getResourceIcon } from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
attachment: MCPResourceAttachment;
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { Music, Video, X } from '@lucide/svelte';
|
||||
import { ActionIcon } from '$lib/components/app';
|
||||
import { ICON_CLASS_DEFAULT } from '$lib/constants';
|
||||
import { AttachmentType } from '$lib/enums';
|
||||
import { ActionIcon } from '#lib/components/app/index.ts';
|
||||
import { ICON_CLASS_DEFAULT } from '#lib/constants/index.ts';
|
||||
import { AttachmentType } from '#lib/enums/index.ts';
|
||||
import {
|
||||
formatFileSize,
|
||||
getFileTypeLabel,
|
||||
@@ -11,7 +11,7 @@
|
||||
isPdfFile,
|
||||
isTextFile,
|
||||
isVideoFile
|
||||
} from '$lib/utils';
|
||||
} from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
attachment?: DatabaseMessageExtra;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { X } from '@lucide/svelte';
|
||||
import { ActionIcon } from '$lib/components/app';
|
||||
import { ActionIcon } from '#lib/components/app/index.ts';
|
||||
|
||||
interface Props {
|
||||
class?: string;
|
||||
|
||||
+4
-4
@@ -4,9 +4,9 @@
|
||||
ChatAttachmentsPreviewFileInfo,
|
||||
ChatAttachmentsPreviewNavButtons,
|
||||
ChatAttachmentsPreviewThumbnailStrip
|
||||
} from '$lib/components/app';
|
||||
import { UI_DATA_ATTRS } from '$lib/constants';
|
||||
import { modelsStore } from '$lib/stores';
|
||||
} from '#lib/components/app/index.ts';
|
||||
import { UI_DATA_ATTRS } from '#lib/constants/index.ts';
|
||||
import { modelsStore } from '#lib/stores/index.ts';
|
||||
import {
|
||||
createBase64DataUrl,
|
||||
formatFileSize,
|
||||
@@ -19,7 +19,7 @@
|
||||
isPdfFile,
|
||||
isTextFile,
|
||||
isVideoFile
|
||||
} from '$lib/utils';
|
||||
} from '#lib/utils/index.ts';
|
||||
|
||||
interface PreviewItem {
|
||||
id: string;
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
import ChatAttachmentsPreviewCurrentItemUnavailable from './ChatAttachmentsPreviewCurrentItemUnavailable.svelte';
|
||||
import ChatAttachmentsPreviewCurrentItemVideo from './ChatAttachmentsPreviewCurrentItemVideo.svelte';
|
||||
import { FileIcon, FileText, Image, Music, Video } from '@lucide/svelte';
|
||||
import type { ChatAttachmentDisplayItem } from '$lib/types';
|
||||
import type { ChatAttachmentDisplayItem } from '#lib/types/index.ts';
|
||||
|
||||
interface Props {
|
||||
currentItem: ChatAttachmentDisplayItem | null;
|
||||
|
||||
+8
-8
@@ -1,13 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { Eye, FileText, Info } from '@lucide/svelte';
|
||||
import { SyntaxHighlightedCode } from '$lib/components/app';
|
||||
import * as Alert from '$lib/components/ui/alert';
|
||||
import { Button } from '$lib/components/ui/button';
|
||||
import { ICON_CLASS_DEFAULT, PDF_AS_IMAGES_LEGACY_CONTENT_REGEX } from '$lib/constants';
|
||||
import { AttachmentType, MimeTypeApplication, PdfViewMode } from '$lib/enums';
|
||||
import type { ChatAttachmentDisplayItem } from '$lib/types';
|
||||
import { getLanguageFromFilename } from '$lib/utils';
|
||||
import { convertPDFToImage, convertPDFToText } from '$lib/utils/browser-only';
|
||||
import { SyntaxHighlightedCode } from '#lib/components/app/index.ts';
|
||||
import * as Alert from '#lib/components/ui/alert/index.ts';
|
||||
import { Button } from '#lib/components/ui/button/index.ts';
|
||||
import { ICON_CLASS_DEFAULT, PDF_AS_IMAGES_LEGACY_CONTENT_REGEX } from '#lib/constants/index.ts';
|
||||
import { AttachmentType, MimeTypeApplication, PdfViewMode } from '#lib/enums/index.ts';
|
||||
import type { ChatAttachmentDisplayItem } from '#lib/types/index.ts';
|
||||
import { convertPDFToImage, convertPDFToText } from '#lib/utils/browser-only.ts';
|
||||
import { getLanguageFromFilename } from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
currentItem: ChatAttachmentDisplayItem | null;
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { SyntaxHighlightedCode } from '$lib/components/app';
|
||||
import { SyntaxHighlightedCode } from '#lib/components/app/index.ts';
|
||||
|
||||
interface Props {
|
||||
displayTextContent: string | undefined;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { ChevronLeft, ChevronRight } from '@lucide/svelte';
|
||||
import { Button } from '$lib/components/ui/button';
|
||||
import { Button } from '#lib/components/ui/button/index.ts';
|
||||
|
||||
interface Props {
|
||||
onPrev: () => void;
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { FileText, Music, Video } from '@lucide/svelte';
|
||||
import { ScrollCarousel } from '$lib/components/app';
|
||||
import { ICON_CLASS_DEFAULT, UI_DATA_ATTRS } from '$lib/constants';
|
||||
import { ScrollCarouselVariant } from '$lib/enums';
|
||||
import { ScrollCarousel } from '#lib/components/app/index.ts';
|
||||
import { ICON_CLASS_DEFAULT, UI_DATA_ATTRS } from '#lib/constants/index.ts';
|
||||
import { ScrollCarouselVariant } from '#lib/enums/index.ts';
|
||||
|
||||
interface PreviewItem {
|
||||
id: string;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
ChatFormMcpResourcesList,
|
||||
ChatFormPickers,
|
||||
DialogMcpResourcesBrowser
|
||||
} from '$lib/components/app';
|
||||
} from '#lib/components/app/index.ts';
|
||||
import {
|
||||
CHAT_FORM_SINGLE_ROW_MAX_TEXT_PX,
|
||||
CLIPBOARD_CONTENT_QUOTE_PREFIX,
|
||||
@@ -20,7 +20,7 @@
|
||||
INPUT_CLASSES,
|
||||
PROMPT_CONTENT_SEPARATOR,
|
||||
SETTING_CONFIG_DEFAULT
|
||||
} from '$lib/constants';
|
||||
} from '#lib/constants/index.ts';
|
||||
import {
|
||||
ContentPartType,
|
||||
FileExtensionText,
|
||||
@@ -28,9 +28,9 @@
|
||||
MimeTypeText,
|
||||
SpecialFileType,
|
||||
ToolSource
|
||||
} from '$lib/enums';
|
||||
import { useChatFormExpansion } from '$lib/hooks/use-chat-form-expansion.svelte';
|
||||
import { useChatFormPickers } from '$lib/hooks/use-chat-form-pickers.svelte';
|
||||
} from '#lib/enums/index.ts';
|
||||
import { useChatFormExpansion } from '#lib/hooks/use-chat-form-expansion.svelte.ts';
|
||||
import { useChatFormPickers } from '#lib/hooks/use-chat-form-pickers.svelte.ts';
|
||||
import {
|
||||
chatStore,
|
||||
conversationsStore,
|
||||
@@ -41,14 +41,22 @@
|
||||
settingsStore,
|
||||
toolsStore,
|
||||
uiStore
|
||||
} from '$lib/stores';
|
||||
} from '#lib/stores/index.ts';
|
||||
import type {
|
||||
FileMentionEntry,
|
||||
GetPromptResult,
|
||||
MCPPromptInfo,
|
||||
MCPResourceInfo,
|
||||
PromptMessage
|
||||
} from '$lib/types';
|
||||
} from '#lib/types/index.ts';
|
||||
import {
|
||||
AudioRecorder,
|
||||
convertToWav,
|
||||
createAudioFile,
|
||||
describeMicrophoneError,
|
||||
isAudioRecordingSupported,
|
||||
microphoneUnavailableReason
|
||||
} from '#lib/utils/browser-only.ts';
|
||||
import {
|
||||
buildMentionInsertion,
|
||||
findCommandToken,
|
||||
@@ -57,15 +65,7 @@
|
||||
isIMEComposing,
|
||||
parseClipboardContent,
|
||||
uuid
|
||||
} from '$lib/utils';
|
||||
import {
|
||||
AudioRecorder,
|
||||
convertToWav,
|
||||
createAudioFile,
|
||||
describeMicrophoneError,
|
||||
isAudioRecordingSupported,
|
||||
microphoneUnavailableReason
|
||||
} from '$lib/utils/browser-only';
|
||||
} from '#lib/utils/index.ts';
|
||||
import { onMount, untrack } from 'svelte';
|
||||
import type { ClassValue } from 'svelte/elements';
|
||||
import { toast } from 'svelte-sonner';
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { Plus } from '@lucide/svelte';
|
||||
import { Button } from '$lib/components/ui/button';
|
||||
import * as Tooltip from '$lib/components/ui/tooltip';
|
||||
import { ATTACHMENT_TOOLTIP_TEXT, ICON_CLASS_DEFAULT } from '$lib/constants';
|
||||
import { Button } from '#lib/components/ui/button/index.ts';
|
||||
import * as Tooltip from '#lib/components/ui/tooltip/index.ts';
|
||||
import { ATTACHMENT_TOOLTIP_TEXT, ICON_CLASS_DEFAULT } from '#lib/constants/index.ts';
|
||||
|
||||
interface Props {
|
||||
disabled?: boolean;
|
||||
|
||||
+10
-10
@@ -10,21 +10,21 @@
|
||||
PencilRuler,
|
||||
Video
|
||||
} from '@lucide/svelte';
|
||||
import { Checkbox } from '$lib/components/ui/checkbox';
|
||||
import * as Collapsible from '$lib/components/ui/collapsible';
|
||||
import * as Drawer from '$lib/components/ui/drawer';
|
||||
import * as Tooltip from '$lib/components/ui/tooltip';
|
||||
import { Checkbox } from '#lib/components/ui/checkbox/index.ts';
|
||||
import * as Collapsible from '#lib/components/ui/collapsible/index.ts';
|
||||
import * as Drawer from '#lib/components/ui/drawer/index.ts';
|
||||
import * as Tooltip from '#lib/components/ui/tooltip/index.ts';
|
||||
import {
|
||||
ATTACHMENT_FILE_ITEMS,
|
||||
ATTACHMENT_MENU_TEXT,
|
||||
ATTACHMENT_MODALITY_TEXT,
|
||||
ICON_CLASS_DEFAULT
|
||||
} from '$lib/constants';
|
||||
import { getChatFormActionsContext } from '$lib/contexts';
|
||||
import { AttachmentAction, AttachmentItemEnabledWhen } from '$lib/enums/attachment.enums';
|
||||
import { useAttachmentMenu } from '$lib/hooks/use-attachment-menu.svelte';
|
||||
import { useToolsPanel } from '$lib/hooks/use-tools-panel.svelte';
|
||||
import type { ToolGroup } from '$lib/types';
|
||||
} from '#lib/constants/index.ts';
|
||||
import { getChatFormActionsContext } from '#lib/contexts/index.ts';
|
||||
import { AttachmentAction, AttachmentItemEnabledWhen } from '#lib/enums/attachment.enums.ts';
|
||||
import { useAttachmentMenu } from '#lib/hooks/use-attachment-menu.svelte.ts';
|
||||
import { useToolsPanel } from '#lib/hooks/use-tools-panel.svelte.ts';
|
||||
import type { ToolGroup } from '#lib/types/index.ts';
|
||||
import type { Snippet } from 'svelte';
|
||||
|
||||
interface Props {
|
||||
|
||||
+9
-9
@@ -1,20 +1,20 @@
|
||||
<script lang="ts">
|
||||
import { File, Folder, Image, MessageSquare, Mic, Plus, Video } from '@lucide/svelte';
|
||||
import { ChatFormActionAddToolsSubmenu } from '$lib/components/app';
|
||||
import { buttonVariants } from '$lib/components/ui/button';
|
||||
import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
|
||||
import * as Tooltip from '$lib/components/ui/tooltip';
|
||||
import { cn } from '$lib/components/ui/utils';
|
||||
import { ChatFormActionAddToolsSubmenu } from '#lib/components/app/index.ts';
|
||||
import { buttonVariants } from '#lib/components/ui/button/index.ts';
|
||||
import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.ts';
|
||||
import * as Tooltip from '#lib/components/ui/tooltip/index.ts';
|
||||
import { cn } from '#lib/components/ui/utils.ts';
|
||||
import {
|
||||
ATTACHMENT_FILE_ITEMS,
|
||||
ATTACHMENT_MENU_TEXT,
|
||||
ATTACHMENT_MODALITY_TEXT,
|
||||
ATTACHMENT_TOOLTIP_TEXT,
|
||||
ICON_CLASS_DEFAULT
|
||||
} from '$lib/constants';
|
||||
import { getChatFormActionsContext } from '$lib/contexts';
|
||||
import { AttachmentAction, AttachmentItemEnabledWhen } from '$lib/enums';
|
||||
import { useAttachmentMenu } from '$lib/hooks/use-attachment-menu.svelte';
|
||||
} from '#lib/constants/index.ts';
|
||||
import { getChatFormActionsContext } from '#lib/contexts/index.ts';
|
||||
import { AttachmentAction, AttachmentItemEnabledWhen } from '#lib/enums/index.ts';
|
||||
import { useAttachmentMenu } from '#lib/hooks/use-attachment-menu.svelte.ts';
|
||||
|
||||
interface Props {
|
||||
class?: string;
|
||||
|
||||
+8
-8
@@ -1,13 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { Check, ChevronDown, ChevronRight, Info, Loader2, PencilRuler } from '@lucide/svelte';
|
||||
import { Checkbox } from '$lib/components/ui/checkbox';
|
||||
import * as Collapsible from '$lib/components/ui/collapsible';
|
||||
import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
|
||||
import * as Tooltip from '$lib/components/ui/tooltip';
|
||||
import { ATTACHMENT_MENU_TEXT, CLI_FLAGS, ICON_CLASS_DEFAULT } from '$lib/constants';
|
||||
import { useToolsPanel } from '$lib/hooks/use-tools-panel.svelte';
|
||||
import { mcpStore, toolsStore } from '$lib/stores';
|
||||
import type { ToolGroup } from '$lib/types';
|
||||
import { Checkbox } from '#lib/components/ui/checkbox/index.ts';
|
||||
import * as Collapsible from '#lib/components/ui/collapsible/index.ts';
|
||||
import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.ts';
|
||||
import * as Tooltip from '#lib/components/ui/tooltip/index.ts';
|
||||
import { ATTACHMENT_MENU_TEXT, CLI_FLAGS, ICON_CLASS_DEFAULT } from '#lib/constants/index.ts';
|
||||
import { useToolsPanel } from '#lib/hooks/use-tools-panel.svelte.ts';
|
||||
import { mcpStore, toolsStore } from '#lib/stores/index.ts';
|
||||
import type { ToolGroup } from '#lib/types/index.ts';
|
||||
|
||||
const toolsPanel = useToolsPanel();
|
||||
const hasMcpServersAvailable = $derived(mcpStore.getServers().length > 0);
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
import ChatFormActionAddButton from './ChatFormActionAddButton.svelte';
|
||||
import ChatFormActionAddDrawer from './ChatFormActionAddDrawer.svelte';
|
||||
import ChatFormActionAddDropdown from './ChatFormActionAddDropdown.svelte';
|
||||
import { deviceStore } from '$lib/stores';
|
||||
import { deviceStore } from '#lib/stores/index.ts';
|
||||
</script>
|
||||
|
||||
{#if deviceStore.isMobile}
|
||||
|
||||
+9
-9
@@ -1,14 +1,14 @@
|
||||
<script lang="ts">
|
||||
import { Check, Info, Lightbulb, LightbulbOff } from '@lucide/svelte';
|
||||
import { Button } from '$lib/components/ui/button';
|
||||
import * as Drawer from '$lib/components/ui/drawer';
|
||||
import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
|
||||
import * as Tooltip from '$lib/components/ui/tooltip';
|
||||
import { ICON_CLASS_DEFAULT, REASONING_EFFORT_LABELS } from '$lib/constants';
|
||||
import { ReasoningEffort } from '$lib/enums';
|
||||
import { useReasoningMenu } from '$lib/hooks/use-reasoning-menu.svelte';
|
||||
import { deviceStore } from '$lib/stores';
|
||||
import type { ReasoningEffortLevel } from '$lib/types';
|
||||
import { Button } from '#lib/components/ui/button/index.ts';
|
||||
import * as Drawer from '#lib/components/ui/drawer/index.ts';
|
||||
import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.ts';
|
||||
import * as Tooltip from '#lib/components/ui/tooltip/index.ts';
|
||||
import { ICON_CLASS_DEFAULT, REASONING_EFFORT_LABELS } from '#lib/constants/index.ts';
|
||||
import { ReasoningEffort } from '#lib/enums/index.ts';
|
||||
import { useReasoningMenu } from '#lib/hooks/use-reasoning-menu.svelte.ts';
|
||||
import { deviceStore } from '#lib/stores/index.ts';
|
||||
import type { ReasoningEffortLevel } from '#lib/types/index.ts';
|
||||
|
||||
const reasoning = useReasoningMenu();
|
||||
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { Mic, MicOff, Square } from '@lucide/svelte';
|
||||
import { Button } from '$lib/components/ui/button';
|
||||
import * as Tooltip from '$lib/components/ui/tooltip';
|
||||
import { ICON_CLASS_DEFAULT } from '$lib/constants';
|
||||
import { Button } from '#lib/components/ui/button/index.ts';
|
||||
import * as Tooltip from '#lib/components/ui/tooltip/index.ts';
|
||||
import { ICON_CLASS_DEFAULT } from '#lib/constants/index.ts';
|
||||
|
||||
interface Props {
|
||||
class?: string;
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { ArrowUp } from '@lucide/svelte';
|
||||
import { Button } from '$lib/components/ui/button';
|
||||
import * as Tooltip from '$lib/components/ui/tooltip';
|
||||
import { Button } from '#lib/components/ui/button/index.ts';
|
||||
import * as Tooltip from '#lib/components/ui/tooltip/index.ts';
|
||||
|
||||
interface Props {
|
||||
canSend?: boolean;
|
||||
|
||||
+10
-10
@@ -7,16 +7,16 @@
|
||||
ChatFormActionSubmit,
|
||||
ChatFormContextGauge,
|
||||
ModelsSelector
|
||||
} from '$lib/components/app';
|
||||
import { Button } from '$lib/components/ui/button';
|
||||
import { ICON_CLASS_DEFAULT, SET_WORKING_DIRECTORY_LABEL } from '$lib/constants';
|
||||
import { setChatFormActionsContext } from '$lib/contexts';
|
||||
import { FileTypeCategory } from '$lib/enums';
|
||||
import { useChatFormModel } from '$lib/hooks/use-chat-form-model.svelte';
|
||||
import { useShowContextGauge } from '$lib/hooks/use-context-gauge.svelte';
|
||||
import { ChatService } from '$lib/services';
|
||||
import { conversationsStore, deviceStore, settingsStore, toolsStore } from '$lib/stores';
|
||||
import { abbreviateWorkingDir, getFileTypeCategory } from '$lib/utils';
|
||||
} from '#lib/components/app/index.ts';
|
||||
import { Button } from '#lib/components/ui/button/index.ts';
|
||||
import { ICON_CLASS_DEFAULT, SET_WORKING_DIRECTORY_LABEL } from '#lib/constants/index.ts';
|
||||
import { setChatFormActionsContext } from '#lib/contexts/index.ts';
|
||||
import { FileTypeCategory } from '#lib/enums/index.ts';
|
||||
import { useChatFormModel } from '#lib/hooks/use-chat-form-model.svelte.ts';
|
||||
import { useShowContextGauge } from '#lib/hooks/use-context-gauge.svelte.ts';
|
||||
import { ChatService } from '#lib/services/index.ts';
|
||||
import { conversationsStore, deviceStore, settingsStore, toolsStore } from '#lib/stores/index.ts';
|
||||
import { abbreviateWorkingDir, getFileTypeCategory } from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
canSend?: boolean;
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@
|
||||
gaugeTriggerLeave,
|
||||
gaugeTriggerPointerDown
|
||||
} from './gauge-popup.svelte';
|
||||
import { useContextGauge } from '$lib/hooks/use-context-gauge.svelte';
|
||||
import { chatStore, conversationsStore, deviceStore } from '$lib/stores';
|
||||
import { useContextGauge } from '#lib/hooks/use-context-gauge.svelte.ts';
|
||||
import { chatStore, conversationsStore, deviceStore } from '#lib/stores/index.ts';
|
||||
import { untrack } from 'svelte';
|
||||
|
||||
interface Props {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import ContextGaugeDetailRow from './ContextGaugeDetailRow.svelte';
|
||||
import { STATS_UNITS } from '$lib/constants';
|
||||
import { STATS_UNITS } from '#lib/constants/index.ts';
|
||||
|
||||
interface Props {
|
||||
currentRead: number;
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { colorLevelTextClass } from './context-gauge';
|
||||
import { CONTEXT_GAUGE_DIAL_SIZES } from '$lib/constants';
|
||||
import { ColorLevel } from '$lib/enums';
|
||||
import { CONTEXT_GAUGE_DIAL_SIZES } from '#lib/constants/index.ts';
|
||||
import { ColorLevel } from '#lib/enums/index.ts';
|
||||
|
||||
interface Props {
|
||||
percent: number | null;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { Loader2 } from '@lucide/svelte';
|
||||
import { Button } from '$lib/components/ui/button';
|
||||
import { Button } from '#lib/components/ui/button/index.ts';
|
||||
|
||||
interface Props {
|
||||
modelId: string | null;
|
||||
|
||||
+5
-5
@@ -9,11 +9,11 @@
|
||||
gaugePopupClose
|
||||
} from './gauge-popup.svelte';
|
||||
import { FoldVertical, Loader2 } from '@lucide/svelte';
|
||||
import { Button } from '$lib/components/ui/button';
|
||||
import * as Drawer from '$lib/components/ui/drawer';
|
||||
import { useContextGauge } from '$lib/hooks/use-context-gauge.svelte';
|
||||
import { agenticStore, chatStore, conversationsStore, deviceStore } from '$lib/stores';
|
||||
import { formatParameters } from '$lib/utils/formatters';
|
||||
import { Button } from '#lib/components/ui/button/index.ts';
|
||||
import * as Drawer from '#lib/components/ui/drawer/index.ts';
|
||||
import { useContextGauge } from '#lib/hooks/use-context-gauge.svelte.ts';
|
||||
import { agenticStore, chatStore, conversationsStore, deviceStore } from '#lib/stores/index.ts';
|
||||
import { formatParameters } from '#lib/utils/formatters.ts';
|
||||
|
||||
const gauge = useContextGauge();
|
||||
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { ColorLevel, MessageRole } from '$lib/enums';
|
||||
import type { ApiProcessingState, DatabaseMessage } from '$lib/types';
|
||||
import { ColorLevel, MessageRole } from '#lib/enums/index.ts';
|
||||
import type { ApiProcessingState, DatabaseMessage } from '#lib/types/index.ts';
|
||||
|
||||
const WARNING_THRESHOLD = 80;
|
||||
const CRITICAL_THRESHOLD = 95;
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import {
|
||||
CONTEXT_GAUGE_CLOSE_GRACE_MS,
|
||||
CONTEXT_GAUGE_DIAL_GAP_PX,
|
||||
CONTEXT_GAUGE_EDGE_MARGIN_PX
|
||||
} from '$lib/constants';
|
||||
} from '#lib/constants/index.ts';
|
||||
|
||||
let closeTimer: ReturnType<typeof setTimeout> | undefined;
|
||||
let lastPointerType = '';
|
||||
|
||||
+16
-11
@@ -2,17 +2,22 @@
|
||||
import ChatFormCurrentWorkingDirectoryChip from './ChatFormCurrentWorkingDirectoryChip.svelte';
|
||||
import ChatFormCurrentWorkingDirectoryResultsList from './ChatFormCurrentWorkingDirectoryResultsList.svelte';
|
||||
import { FolderOpen, X } from '@lucide/svelte';
|
||||
import SearchInput from '$lib/components/app/forms/SearchInput.svelte';
|
||||
import * as Drawer from '$lib/components/ui/drawer';
|
||||
import * as Popover from '$lib/components/ui/popover';
|
||||
import { DEFAULT_MOBILE_BREAKPOINT, HOME_TILDE, SEARCH, UI_DATA_ATTRS } from '$lib/constants';
|
||||
import { BuiltInTool, GlobSearchType, KeyboardKey, ToolSource } from '$lib/enums';
|
||||
import { useDebouncedSearch } from '$lib/hooks/use-debounced-search.svelte';
|
||||
import { usePickerNavigation } from '$lib/hooks/use-picker-navigation.svelte';
|
||||
import { useScrollActiveRow } from '$lib/hooks/use-scroll-active-row.svelte';
|
||||
import { ToolsService } from '$lib/services/tools.service';
|
||||
import { conversationsStore, deviceStore, toolsStore } from '$lib/stores';
|
||||
import { abbreviateHome, runGlobSearchWithChildren } from '$lib/utils';
|
||||
import SearchInput from '#lib/components/app/forms/SearchInput.svelte';
|
||||
import * as Drawer from '#lib/components/ui/drawer/index.ts';
|
||||
import * as Popover from '#lib/components/ui/popover/index.ts';
|
||||
import {
|
||||
DEFAULT_MOBILE_BREAKPOINT,
|
||||
HOME_TILDE,
|
||||
SEARCH,
|
||||
UI_DATA_ATTRS
|
||||
} from '#lib/constants/index.ts';
|
||||
import { BuiltInTool, GlobSearchType, KeyboardKey, ToolSource } from '#lib/enums/index.ts';
|
||||
import { useDebouncedSearch } from '#lib/hooks/use-debounced-search.svelte.ts';
|
||||
import { usePickerNavigation } from '#lib/hooks/use-picker-navigation.svelte.ts';
|
||||
import { useScrollActiveRow } from '#lib/hooks/use-scroll-active-row.svelte.ts';
|
||||
import { ToolsService } from '#lib/services/tools.service.ts';
|
||||
import { conversationsStore, deviceStore, toolsStore } from '#lib/stores/index.ts';
|
||||
import { abbreviateHome, runGlobSearchWithChildren } from '#lib/utils/index.ts';
|
||||
|
||||
// Microtask delay so the popover's focus scope tears down first.
|
||||
const FOCUS_DELAY_MS = 0;
|
||||
|
||||
+8
-6
@@ -1,9 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { Folder, X } from '@lucide/svelte';
|
||||
import { ActionIcon } from '$lib/components/app/actions';
|
||||
import * as Tooltip from '$lib/components/ui/tooltip';
|
||||
import { SET_WORKING_DIRECTORY_LABEL } from '$lib/constants';
|
||||
import { abbreviateWorkingDir } from '$lib/utils';
|
||||
import { ActionIcon } from '#lib/components/app/actions/index.ts';
|
||||
import * as Tooltip from '#lib/components/ui/tooltip/index.ts';
|
||||
import { SET_WORKING_DIRECTORY_LABEL } from '#lib/constants/index.ts';
|
||||
import { abbreviateWorkingDir } from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
directory?: string | null;
|
||||
@@ -29,8 +29,10 @@
|
||||
</script>
|
||||
|
||||
<span
|
||||
class:text-foreground={directory}
|
||||
class="text-muted-foreground inline-flex items-center gap-1 text-xs group"
|
||||
class={[
|
||||
'text-muted-foreground inline-flex items-center gap-1 text-xs group',
|
||||
directory && 'text-foreground'
|
||||
]}
|
||||
>
|
||||
<div class="flex min-w-0 items-center gap-1 cursor-pointer">
|
||||
<Folder class="w-3.5 h-3.5" />
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { Folder } from '@lucide/svelte';
|
||||
import { cn } from '$lib/components/ui/utils';
|
||||
import { UI_DATA_ATTRS } from '$lib/constants';
|
||||
import { highlightMatch } from '$lib/utils';
|
||||
import { cn } from '#lib/components/ui/utils.ts';
|
||||
import { UI_DATA_ATTRS } from '#lib/constants/index.ts';
|
||||
import { highlightMatch } from '#lib/utils/index.ts';
|
||||
import { fly } from 'svelte/transition';
|
||||
|
||||
// Fly-in transition for the results list.
|
||||
|
||||
+5
-5
@@ -1,11 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { fileMentionWidgets } from './mention-badge-widget';
|
||||
import { EditorView } from '@codemirror/view';
|
||||
import { MarkdownEditor } from '$lib/components/app';
|
||||
import { SETTINGS_KEYS } from '$lib/constants';
|
||||
import { deviceStore } from '$lib/stores';
|
||||
import { settingsStore } from '$lib/stores/settings/index.svelte';
|
||||
import { toolsStore } from '$lib/stores/tools.svelte';
|
||||
import { MarkdownEditor } from '#lib/components/app/index.ts';
|
||||
import { SETTINGS_KEYS } from '#lib/constants/index.ts';
|
||||
import { deviceStore } from '#lib/stores/index.ts';
|
||||
import { settingsStore } from '#lib/stores/settings/index.svelte.ts';
|
||||
import { toolsStore } from '#lib/stores/tools.svelte.ts';
|
||||
import { onMount } from 'svelte';
|
||||
import type { ClassValue } from 'svelte/elements';
|
||||
|
||||
|
||||
+5
-5
@@ -4,10 +4,10 @@
|
||||
|
||||
import type { EditorState, Range } from '@codemirror/state';
|
||||
import { Decoration, WidgetType } from '@codemirror/view';
|
||||
import { codeRanges } from '$lib/components/app/content/MarkdownEditor/markdown-syntax';
|
||||
import { SETTINGS_KEYS } from '$lib/constants';
|
||||
import { settingsStore } from '$lib/stores/settings/index.svelte';
|
||||
import { toolsStore } from '$lib/stores/tools.svelte';
|
||||
import { codeRanges } from '#lib/components/app/content/MarkdownEditor/markdown-syntax.ts';
|
||||
import { SETTINGS_KEYS } from '#lib/constants/index.ts';
|
||||
import { settingsStore } from '#lib/stores/settings/index.svelte.ts';
|
||||
import { toolsStore } from '#lib/stores/tools.svelte.ts';
|
||||
import {
|
||||
decodeFileLinkPath,
|
||||
fileMentionLinkRe,
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
MENTION_BADGE_CLASSNAME,
|
||||
MENTION_BADGE_ICON_CLASSNAME,
|
||||
MENTION_BADGE_SVG_ATTRIBUTES
|
||||
} from '$lib/utils';
|
||||
} from '#lib/utils/index.ts';
|
||||
|
||||
const MENTION_RE = new RegExp(fileMentionLinkRe().source, 'g');
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { ChatAttachmentsListItemMcpResource, ScrollCarousel } from '$lib/components/app';
|
||||
import { ScrollCarouselVariant } from '$lib/enums';
|
||||
import { mcpStore } from '$lib/stores';
|
||||
import { ChatAttachmentsListItemMcpResource, ScrollCarousel } from '#lib/components/app/index.ts';
|
||||
import { ScrollCarouselVariant } from '#lib/enums/index.ts';
|
||||
import { mcpStore } from '#lib/stores/index.ts';
|
||||
|
||||
interface Props {
|
||||
class?: string;
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { mcpStore } from '$lib/stores';
|
||||
import type { MCPServerSettingsEntry } from '$lib/types';
|
||||
import { mcpStore } from '#lib/stores/index.ts';
|
||||
import type { MCPServerSettingsEntry } from '#lib/types/index.ts';
|
||||
import type { Snippet } from 'svelte';
|
||||
|
||||
interface Props {
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
<script generics="T" lang="ts">
|
||||
import { SearchInput } from '$lib/components/app';
|
||||
import ScrollArea from '$lib/components/ui/scroll-area/scroll-area.svelte';
|
||||
import { CHAT_FORM_POPOVER_MAX_HEIGHT, UI_DATA_ATTRS } from '$lib/constants';
|
||||
import { useScrollActiveRow } from '$lib/hooks/use-scroll-active-row.svelte';
|
||||
import { SearchInput } from '#lib/components/app/index.ts';
|
||||
import ScrollArea from '#lib/components/ui/scroll-area/scroll-area.svelte';
|
||||
import { CHAT_FORM_POPOVER_MAX_HEIGHT, UI_DATA_ATTRS } from '#lib/constants/index.ts';
|
||||
import { useScrollActiveRow } from '#lib/hooks/use-scroll-active-row.svelte.ts';
|
||||
import type { Snippet } from 'svelte';
|
||||
|
||||
interface Props {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { UI_DATA_ATTRS } from '$lib/constants';
|
||||
import { UI_DATA_ATTRS } from '#lib/constants/index.ts';
|
||||
import type { Snippet } from 'svelte';
|
||||
|
||||
interface Props {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import * as Popover from '$lib/components/ui/popover';
|
||||
import * as Popover from '#lib/components/ui/popover/index.ts';
|
||||
import type { Snippet } from 'svelte';
|
||||
|
||||
interface Props {
|
||||
|
||||
+4
-4
@@ -3,10 +3,10 @@
|
||||
ChatFormPickerList,
|
||||
ChatFormPickerListItem,
|
||||
ChatFormPickerPopover
|
||||
} from '$lib/components/app/chat';
|
||||
import { CHAT_FORM_COMMAND_ICONS } from '$lib/constants';
|
||||
import { usePickerNavigation } from '$lib/hooks/use-picker-navigation.svelte';
|
||||
import type { ChatFormCommand } from '$lib/types';
|
||||
} from '#lib/components/app/chat/index.ts';
|
||||
import { CHAT_FORM_COMMAND_ICONS } from '#lib/constants/index.ts';
|
||||
import { usePickerNavigation } from '#lib/hooks/use-picker-navigation.svelte.ts';
|
||||
import type { ChatFormCommand } from '#lib/types/index.ts';
|
||||
|
||||
/**
|
||||
* Slash-command picker; `query` (typed after `/`) filters the commands.
|
||||
|
||||
+6
-6
@@ -6,12 +6,12 @@
|
||||
ChatFormPickerListItemSkeleton,
|
||||
ChatFormPickerPopover,
|
||||
ChatFormPromptPickerArgumentForm
|
||||
} from '$lib/components/app/chat';
|
||||
import Badge from '$lib/components/ui/badge/badge.svelte';
|
||||
import { KeyboardKey } from '$lib/enums';
|
||||
import { mcpStore } from '$lib/stores';
|
||||
import type { GetPromptResult, MCPPromptInfo, MCPServerSettingsEntry } from '$lib/types';
|
||||
import { debounce, uuid } from '$lib/utils';
|
||||
} from '#lib/components/app/chat/index.ts';
|
||||
import Badge from '#lib/components/ui/badge/badge.svelte';
|
||||
import { KeyboardKey } from '#lib/enums/index.ts';
|
||||
import { mcpStore } from '#lib/stores/index.ts';
|
||||
import type { GetPromptResult, MCPPromptInfo, MCPServerSettingsEntry } from '#lib/types/index.ts';
|
||||
import { debounce, uuid } from '#lib/utils/index.ts';
|
||||
import { SvelteMap } from 'svelte/reactivity';
|
||||
|
||||
interface Props {
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import ChatFormPromptPickerArgumentInput from './ChatFormPromptPickerArgumentInput.svelte';
|
||||
import { Button } from '$lib/components/ui/button';
|
||||
import type { MCPPromptInfo } from '$lib/types';
|
||||
import { Button } from '#lib/components/ui/button/index.ts';
|
||||
import type { MCPPromptInfo } from '#lib/types/index.ts';
|
||||
|
||||
interface Props {
|
||||
prompt: MCPPromptInfo;
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Input } from '$lib/components/ui/input';
|
||||
import { Label } from '$lib/components/ui/label';
|
||||
import type { MCPPromptInfo } from '$lib/types';
|
||||
import { Input } from '#lib/components/ui/input/index.ts';
|
||||
import { Label } from '#lib/components/ui/label/index.ts';
|
||||
import type { MCPPromptInfo } from '#lib/types/index.ts';
|
||||
import { fly } from 'svelte/transition';
|
||||
|
||||
type PromptArgument = NonNullable<MCPPromptInfo['arguments']>[number];
|
||||
|
||||
+11
-11
@@ -1,22 +1,22 @@
|
||||
<script lang="ts">
|
||||
import { File, Folder } from '@lucide/svelte';
|
||||
import { ChatFormPickerList, ChatFormPickerListItem } from '$lib/components/app/chat';
|
||||
import HighlightedMatch from '$lib/components/app/forms/HighlightedMatch.svelte';
|
||||
import * as Popover from '$lib/components/ui/popover';
|
||||
import * as Tooltip from '$lib/components/ui/tooltip';
|
||||
import { FILE_GLOB_SEARCH_PICKERS, HOME_TILDE, SEARCH } from '$lib/constants';
|
||||
import { ChatFormPickerList, ChatFormPickerListItem } from '#lib/components/app/chat/index.ts';
|
||||
import HighlightedMatch from '#lib/components/app/forms/HighlightedMatch.svelte';
|
||||
import * as Popover from '#lib/components/ui/popover/index.ts';
|
||||
import * as Tooltip from '#lib/components/ui/tooltip/index.ts';
|
||||
import { FILE_GLOB_SEARCH_PICKERS, HOME_TILDE, SEARCH } from '#lib/constants/index.ts';
|
||||
import {
|
||||
BuiltInTool,
|
||||
FileMentionEntryType,
|
||||
GlobSearchType,
|
||||
KeyboardKey,
|
||||
ToolSource
|
||||
} from '$lib/enums';
|
||||
import { useDebouncedSearch } from '$lib/hooks/use-debounced-search.svelte';
|
||||
import { usePickerNavigation } from '$lib/hooks/use-picker-navigation.svelte';
|
||||
import { conversationsStore, deviceStore, settingsStore, toolsStore } from '$lib/stores';
|
||||
import type { FileMentionEntry, GlobEntryResult } from '$lib/types';
|
||||
import { abbreviateHome, runGlobSearchWithChildren } from '$lib/utils';
|
||||
} from '#lib/enums/index.ts';
|
||||
import { useDebouncedSearch } from '#lib/hooks/use-debounced-search.svelte.ts';
|
||||
import { usePickerNavigation } from '#lib/hooks/use-picker-navigation.svelte.ts';
|
||||
import { conversationsStore, deviceStore, settingsStore, toolsStore } from '#lib/stores/index.ts';
|
||||
import type { FileMentionEntry, GlobEntryResult } from '#lib/types/index.ts';
|
||||
import { abbreviateHome, runGlobSearchWithChildren } from '#lib/utils/index.ts';
|
||||
|
||||
/**
|
||||
* Floating file/folder mention picker. The chat input is the search
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
FileMentionEntry,
|
||||
GetPromptResult,
|
||||
MCPPromptInfo
|
||||
} from '$lib/types';
|
||||
} from '#lib/types/index.ts';
|
||||
|
||||
interface Props {
|
||||
/** What every picker's popover floats by. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CHAT_FORM_RESIZE_MS } from '$lib/constants';
|
||||
import { CHAT_FORM_RESIZE_MS } from '#lib/constants/index.ts';
|
||||
|
||||
export interface CollapsedHeightHoldOptions {
|
||||
getCard: () => HTMLElement | undefined;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { hasMarkdownStructure } from '$lib/components/app/content/MarkdownEditor/markdown-structure';
|
||||
import { CHAT_FORM_EXPAND_MIN_LINES } from '$lib/constants';
|
||||
import { hasMarkdownStructure } from '#lib/components/app/content/MarkdownEditor/markdown-structure.ts';
|
||||
import { CHAT_FORM_EXPAND_MIN_LINES } from '#lib/constants/index.ts';
|
||||
|
||||
/** The collapsed card's `rounded-4xl` on a phone. */
|
||||
const COLLAPSED_CARD_RADIUS = '2rem';
|
||||
|
||||
+15
-10
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import {
|
||||
ChatMessageAssistant,
|
||||
ChatMessageCompaction,
|
||||
@@ -7,24 +6,30 @@
|
||||
ChatMessageSynthetic,
|
||||
ChatMessageSystem,
|
||||
ChatMessageUser
|
||||
} from '$lib/components/app/chat';
|
||||
} from '#lib/components/app/chat/index.ts';
|
||||
import {
|
||||
AGENTIC_TEXT_COPY_SEPARATOR,
|
||||
REASONING_TAGS,
|
||||
ROUTES,
|
||||
SYSTEM_MESSAGE_PLACEHOLDER
|
||||
} from '$lib/constants';
|
||||
import { setChatMessageActionsContext, setChatMessageEditContext } from '$lib/contexts';
|
||||
import { AgenticSectionType, AttachmentType, MessageRole, MessageType } from '$lib/enums';
|
||||
import { DatabaseService } from '$lib/services/database.service';
|
||||
import { chatStore, conversationsStore, deviceStore } from '$lib/stores';
|
||||
} from '#lib/constants/index.ts';
|
||||
import { setChatMessageActionsContext, setChatMessageEditContext } from '#lib/contexts/index.ts';
|
||||
import {
|
||||
AgenticSectionType,
|
||||
AttachmentType,
|
||||
MessageRole,
|
||||
MessageType
|
||||
} from '#lib/enums/index.ts';
|
||||
import { DatabaseService } from '#lib/services/database.service.ts';
|
||||
import { chatStore, conversationsStore, deviceStore } from '#lib/stores/index.ts';
|
||||
import type {
|
||||
ChatMessageActions,
|
||||
ChatMessageDeletionInfo,
|
||||
DatabaseMessageExtraMcpPrompt
|
||||
} from '$lib/types';
|
||||
import { deriveAgenticSections } from '$lib/utils';
|
||||
import { parseFilesToMessageExtras } from '$lib/utils/browser-only';
|
||||
} from '#lib/types/index.ts';
|
||||
import { parseFilesToMessageExtras } from '#lib/utils/browser-only.ts';
|
||||
import { deriveAgenticSections } from '#lib/utils/index.ts';
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
interface Props {
|
||||
class?: string;
|
||||
|
||||
+7
-7
@@ -8,13 +8,13 @@
|
||||
ChatMessageAssistantStatistics,
|
||||
ChatMessageContextMenu,
|
||||
ChatMessageEditForm
|
||||
} from '$lib/components/app';
|
||||
import { getChatMessageEditContext } from '$lib/contexts';
|
||||
import { MessageRole } from '$lib/enums';
|
||||
import { useProcessingState } from '$lib/hooks/use-processing-state.svelte';
|
||||
import { chatStore, modelsStore, serverStore, settingsStore } from '$lib/stores';
|
||||
import { modelLoadProgressText } from '$lib/utils';
|
||||
import { hasAgenticContent } from '$lib/utils';
|
||||
} from '#lib/components/app/index.ts';
|
||||
import { getChatMessageEditContext } from '#lib/contexts/index.ts';
|
||||
import { MessageRole } from '#lib/enums/index.ts';
|
||||
import { useProcessingState } from '#lib/hooks/use-processing-state.svelte.ts';
|
||||
import { chatStore, modelsStore, serverStore, settingsStore } from '#lib/stores/index.ts';
|
||||
import { modelLoadProgressText } from '#lib/utils/index.ts';
|
||||
import { hasAgenticContent } from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
class?: string;
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { ModelBadge, ModelsSelector } from '$lib/components/app';
|
||||
import { ServerModelStatus } from '$lib/enums';
|
||||
import { modelsStore } from '$lib/stores';
|
||||
import { copyToClipboard } from '$lib/utils';
|
||||
import { ModelBadge, ModelsSelector } from '#lib/components/app/index.ts';
|
||||
import { ServerModelStatus } from '#lib/enums/index.ts';
|
||||
import { modelsStore } from '#lib/stores/index.ts';
|
||||
import { copyToClipboard } from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
displayedModel: string | null;
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import type { UseProcessingStateReturn } from '$lib/hooks/use-processing-state.svelte';
|
||||
import type { UseProcessingStateReturn } from '#lib/hooks/use-processing-state.svelte.ts';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
interface Props {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { buildAssistantRawOutput, deriveAgenticSections } from '$lib/utils';
|
||||
import { buildAssistantRawOutput, deriveAgenticSections } from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
message: DatabaseMessage;
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { ChatMessageStatistics } from '$lib/components/app';
|
||||
import { ChatMessageStatisticsMode } from '$lib/enums';
|
||||
import type { UseProcessingStateReturn } from '$lib/hooks/use-processing-state.svelte';
|
||||
import { agenticStore } from '$lib/stores';
|
||||
import { ChatMessageStatistics } from '#lib/components/app/index.ts';
|
||||
import { ChatMessageStatisticsMode } from '#lib/enums/index.ts';
|
||||
import type { UseProcessingStateReturn } from '#lib/hooks/use-processing-state.svelte.ts';
|
||||
import { agenticStore } from '#lib/stores/index.ts';
|
||||
|
||||
interface Props {
|
||||
message: DatabaseMessage;
|
||||
|
||||
+7
-7
@@ -6,13 +6,13 @@
|
||||
ChatMessageEditForm,
|
||||
CollapsibleContentBlock,
|
||||
MarkdownContent
|
||||
} from '$lib/components/app';
|
||||
import { COLLAPSIBLE_TRANSITION_MS } from '$lib/constants';
|
||||
import { getChatMessageEditContext } from '$lib/contexts';
|
||||
import { useProcessingState } from '$lib/hooks/use-processing-state.svelte';
|
||||
import { chatStore, conversationsStore, settingsStore } from '$lib/stores';
|
||||
import type { DatabaseMessage } from '$lib/types';
|
||||
import { compactionTokensBefore, formatNumber } from '$lib/utils';
|
||||
} from '#lib/components/app/index.ts';
|
||||
import { COLLAPSIBLE_TRANSITION_MS } from '#lib/constants/index.ts';
|
||||
import { getChatMessageEditContext } from '#lib/contexts/index.ts';
|
||||
import { useProcessingState } from '#lib/hooks/use-processing-state.svelte.ts';
|
||||
import { chatStore, conversationsStore, settingsStore } from '#lib/stores/index.ts';
|
||||
import type { DatabaseMessage } from '#lib/types/index.ts';
|
||||
import { compactionTokensBefore, formatNumber } from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
class?: string;
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Folder, FolderX } from '@lucide/svelte';
|
||||
import type { DatabaseMessage } from '$lib/types';
|
||||
import { parseCwdMessage } from '$lib/utils';
|
||||
import type { DatabaseMessage } from '#lib/types/index.ts';
|
||||
import { parseCwdMessage } from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
class?: string;
|
||||
|
||||
+4
-4
@@ -3,10 +3,10 @@
|
||||
ChatMessageActionIcons,
|
||||
ChatMessageEditForm,
|
||||
ChatMessageMcpPromptContent
|
||||
} from '$lib/components/app';
|
||||
import { getChatMessageEditContext } from '$lib/contexts';
|
||||
import { McpPromptVariant } from '$lib/enums';
|
||||
import type { DatabaseMessageExtraMcpPrompt } from '$lib/types';
|
||||
} from '#lib/components/app/index.ts';
|
||||
import { getChatMessageEditContext } from '#lib/contexts/index.ts';
|
||||
import { McpPromptVariant } from '#lib/enums/index.ts';
|
||||
import type { DatabaseMessageExtraMcpPrompt } from '#lib/types/index.ts';
|
||||
|
||||
interface Props {
|
||||
class?: string;
|
||||
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { TruncatedText } from '$lib/components/app/misc';
|
||||
import { Card } from '$lib/components/ui/card';
|
||||
import * as Tooltip from '$lib/components/ui/tooltip';
|
||||
import { McpPromptVariant } from '$lib/enums';
|
||||
import { mcpStore } from '$lib/stores';
|
||||
import type { DatabaseMessageExtraMcpPrompt } from '$lib/types';
|
||||
import { TruncatedText } from '#lib/components/app/misc/index.ts';
|
||||
import { Card } from '#lib/components/ui/card/index.ts';
|
||||
import * as Tooltip from '#lib/components/ui/tooltip/index.ts';
|
||||
import { McpPromptVariant } from '#lib/enums/index.ts';
|
||||
import { mcpStore } from '#lib/stores/index.ts';
|
||||
import type { DatabaseMessageExtraMcpPrompt } from '#lib/types/index.ts';
|
||||
import { SvelteMap } from 'svelte/reactivity';
|
||||
|
||||
interface ContentPart {
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import ChatMessageCwdChange from './ChatMessageCwdChange.svelte';
|
||||
import type { DatabaseMessage } from '$lib/types';
|
||||
import { parseCwdMessage } from '$lib/utils';
|
||||
import type { DatabaseMessage } from '#lib/types/index.ts';
|
||||
import { parseCwdMessage } from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
class?: string;
|
||||
|
||||
+8
-8
@@ -1,13 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { Check, X } from '@lucide/svelte';
|
||||
import { ChatMessageActionIcons, MarkdownContent } from '$lib/components/app';
|
||||
import { Button } from '$lib/components/ui/button';
|
||||
import { Card } from '$lib/components/ui/card';
|
||||
import { INPUT_CLASSES } from '$lib/constants';
|
||||
import { getChatMessageEditContext } from '$lib/contexts';
|
||||
import { KeyboardKey } from '$lib/enums';
|
||||
import { settingsStore } from '$lib/stores';
|
||||
import { autoResizeTextarea, isIMEComposing } from '$lib/utils';
|
||||
import { ChatMessageActionIcons, MarkdownContent } from '#lib/components/app/index.ts';
|
||||
import { Button } from '#lib/components/ui/button/index.ts';
|
||||
import { Card } from '#lib/components/ui/card/index.ts';
|
||||
import { INPUT_CLASSES } from '#lib/constants/index.ts';
|
||||
import { getChatMessageEditContext } from '#lib/contexts/index.ts';
|
||||
import { KeyboardKey } from '#lib/enums/index.ts';
|
||||
import { settingsStore } from '#lib/stores/index.ts';
|
||||
import { autoResizeTextarea, isIMEComposing } from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
class?: string;
|
||||
|
||||
+3
-3
@@ -11,14 +11,14 @@
|
||||
import ChatMessageToolCallBlockRunJavascript from './ChatMessageToolCallBlockRunJavascript.svelte';
|
||||
import ChatMessageToolCallBlockSearchResults from './ChatMessageToolCallBlockSearchResults.svelte';
|
||||
import ChatMessageToolCallBlockWriteFile from './ChatMessageToolCallBlockWriteFile.svelte';
|
||||
import { BuiltInTool } from '$lib/enums';
|
||||
import type { AgenticSection, DatabaseMessageExtra } from '$lib/types';
|
||||
import { BuiltInTool } from '#lib/enums/index.ts';
|
||||
import type { AgenticSection, DatabaseMessageExtra } from '#lib/types/index.ts';
|
||||
import {
|
||||
extractSearchQuery,
|
||||
extractSearchResults,
|
||||
isWebSearchToolName,
|
||||
looksLikeSearchResult
|
||||
} from '$lib/utils';
|
||||
} from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
section: AgenticSection;
|
||||
|
||||
+6
-6
@@ -5,17 +5,17 @@
|
||||
|
||||
import ToolCallBlock from './ToolCallBlock.svelte';
|
||||
import { Loader2 } from '@lucide/svelte';
|
||||
import { MarkdownContent, SyntaxHighlightedCode } from '$lib/components/app';
|
||||
import { MAX_HEIGHT_CODE_BLOCK } from '$lib/constants';
|
||||
import { AttachmentType, FileTypeText, MimeTypeAudio, ToolResultKind } from '$lib/enums';
|
||||
import type { AgenticSection, DatabaseMessageExtra, ToolResultLine } from '$lib/types';
|
||||
import { MarkdownContent, SyntaxHighlightedCode } from '#lib/components/app/index.ts';
|
||||
import { MAX_HEIGHT_CODE_BLOCK } from '#lib/constants/index.ts';
|
||||
import { AttachmentType, FileTypeText, MimeTypeAudio, ToolResultKind } from '#lib/enums/index.ts';
|
||||
import type { AgenticSection, DatabaseMessageExtra, ToolResultLine } from '#lib/types/index.ts';
|
||||
import { createBase64DataUrl } from '#lib/utils/data-url.ts';
|
||||
import {
|
||||
classifyToolResult,
|
||||
formatJsonPretty,
|
||||
getToolUi,
|
||||
parseToolResultWithMedia
|
||||
} from '$lib/utils';
|
||||
import { createBase64DataUrl } from '$lib/utils/data-url';
|
||||
} from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
section: AgenticSection;
|
||||
|
||||
+11
-6
@@ -2,12 +2,17 @@
|
||||
import { parseEditFileMeta, parseEditFileTitleMeta } from './parsers/edit-file';
|
||||
import ToolCallBlock from './ToolCallBlock.svelte';
|
||||
import { XCircle } from '@lucide/svelte';
|
||||
import { SyntaxHighlightedCode } from '$lib/components/app';
|
||||
import { MAX_HEIGHT_CODE_BLOCK, RESULT_STAT_SEPARATOR } from '$lib/constants';
|
||||
import { FileTypeText } from '$lib/enums';
|
||||
import { toolsStore } from '$lib/stores';
|
||||
import type { AgenticSection } from '$lib/types';
|
||||
import { abbreviateHome, computeLineDiff, formatJsonPretty, prefixFor } from '$lib/utils';
|
||||
import { SyntaxHighlightedCode } from '#lib/components/app/index.ts';
|
||||
import { MAX_HEIGHT_CODE_BLOCK, RESULT_STAT_SEPARATOR } from '#lib/constants/index.ts';
|
||||
import { FileTypeText } from '#lib/enums/index.ts';
|
||||
import { toolsStore } from '#lib/stores/index.ts';
|
||||
import type { AgenticSection } from '#lib/types/index.ts';
|
||||
import {
|
||||
abbreviateHome,
|
||||
computeLineDiff,
|
||||
formatJsonPretty,
|
||||
prefixFor
|
||||
} from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
section: AgenticSection;
|
||||
|
||||
+10
-8
@@ -9,11 +9,14 @@
|
||||
import { parseExecShellCommandMeta } from './parsers/exec-shell-command';
|
||||
import ToolCallBlock from './ToolCallBlock.svelte';
|
||||
import { AlertTriangle, Check, CircleStop, Loader2, XCircle } from '@lucide/svelte';
|
||||
import { CollapsibleTerminalBlock } from '$lib/components/app';
|
||||
import { SETTINGS_KEYS, TOOL_RUNTIME_SCROLL_AT_BOTTOM_THRESHOLD_PX } from '$lib/constants';
|
||||
import { AgenticSectionType, AttachmentType } from '$lib/enums';
|
||||
import { settingsStore, toolsStore } from '$lib/stores';
|
||||
import type { AgenticSection, DatabaseMessageExtra, ToolResultLine } from '$lib/types';
|
||||
import { CollapsibleTerminalBlock } from '#lib/components/app/index.ts';
|
||||
import {
|
||||
SETTINGS_KEYS,
|
||||
TOOL_RUNTIME_SCROLL_AT_BOTTOM_THRESHOLD_PX
|
||||
} from '#lib/constants/index.ts';
|
||||
import { AgenticSectionType, AttachmentType } from '#lib/enums/index.ts';
|
||||
import { settingsStore, toolsStore } from '#lib/stores/index.ts';
|
||||
import type { AgenticSection, DatabaseMessageExtra, ToolResultLine } from '#lib/types/index.ts';
|
||||
import {
|
||||
abbreviateHome,
|
||||
type ExecShellExitStatus,
|
||||
@@ -22,7 +25,7 @@
|
||||
parseExecShellCommandError,
|
||||
parseExecShellCommandExitStatus,
|
||||
parseToolResultWithMedia
|
||||
} from '$lib/utils';
|
||||
} from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
section: AgenticSection;
|
||||
@@ -264,8 +267,7 @@
|
||||
{:else if section.toolResult}
|
||||
<div
|
||||
bind:this={scrollEl}
|
||||
class:is-clamped={!useFullHeightCodeBlocks}
|
||||
class="terminal-output"
|
||||
class={['terminal-output', !useFullHeightCodeBlocks && 'is-clamped']}
|
||||
onscroll={handleScrollEvent}
|
||||
>
|
||||
{#each outputLines as line, i (i)}
|
||||
|
||||
+3
-3
@@ -2,9 +2,9 @@
|
||||
import { parseFileGlobSearchMeta } from './parsers/file-glob-search';
|
||||
import ToolCallBlock from './ToolCallBlock.svelte';
|
||||
import { XCircle } from '@lucide/svelte';
|
||||
import { toolsStore } from '$lib/stores';
|
||||
import type { AgenticSection } from '$lib/types';
|
||||
import { abbreviateHome } from '$lib/utils';
|
||||
import { toolsStore } from '#lib/stores/index.ts';
|
||||
import type { AgenticSection } from '#lib/types/index.ts';
|
||||
import { abbreviateHome } from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
section: AgenticSection;
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Clock, Loader2 } from '@lucide/svelte';
|
||||
import { AgenticSectionType } from '$lib/enums';
|
||||
import type { AgenticSection } from '$lib/types';
|
||||
import { AgenticSectionType } from '#lib/enums/index.ts';
|
||||
import type { AgenticSection } from '#lib/types/index.ts';
|
||||
|
||||
interface Props {
|
||||
section: AgenticSection;
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
<script lang="ts">
|
||||
import ToolCallBlock from './ToolCallBlock.svelte';
|
||||
import { XCircle } from '@lucide/svelte';
|
||||
import { toolsStore } from '$lib/stores';
|
||||
import type { AgenticSection } from '$lib/types';
|
||||
import { abbreviateHome } from '$lib/utils';
|
||||
import { toolsStore } from '#lib/stores/index.ts';
|
||||
import type { AgenticSection } from '#lib/types/index.ts';
|
||||
import { abbreviateHome } from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
section: AgenticSection;
|
||||
|
||||
+3
-3
@@ -2,9 +2,9 @@
|
||||
import { parseGrepSearchMeta } from './parsers/grep-search';
|
||||
import ToolCallBlock from './ToolCallBlock.svelte';
|
||||
import { XCircle } from '@lucide/svelte';
|
||||
import { toolsStore } from '$lib/stores';
|
||||
import type { AgenticSection } from '$lib/types';
|
||||
import { abbreviateHome } from '$lib/utils';
|
||||
import { toolsStore } from '#lib/stores/index.ts';
|
||||
import type { AgenticSection } from '#lib/types/index.ts';
|
||||
import { abbreviateHome } from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
section: AgenticSection;
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { parseReadFileMeta } from './parsers/read-file';
|
||||
import ToolCallBlock from './ToolCallBlock.svelte';
|
||||
import { SyntaxHighlightedCode } from '$lib/components/app';
|
||||
import { CODE_BLOCK, MAX_HEIGHT_CODE_BLOCK } from '$lib/constants';
|
||||
import type { AgenticSection } from '$lib/types';
|
||||
import { SyntaxHighlightedCode } from '#lib/components/app/index.ts';
|
||||
import { CODE_BLOCK, MAX_HEIGHT_CODE_BLOCK } from '#lib/constants/index.ts';
|
||||
import type { AgenticSection } from '#lib/types/index.ts';
|
||||
|
||||
interface Props {
|
||||
section: AgenticSection;
|
||||
|
||||
+8
-5
@@ -1,11 +1,14 @@
|
||||
<script lang="ts">
|
||||
import { parseReadMediaMeta } from './parsers/read-media';
|
||||
import ToolCallBlock from './ToolCallBlock.svelte';
|
||||
import { ATTACHMENT_SAVED_REGEX } from '$lib/constants/agentic.constants';
|
||||
import { AttachmentType, MimeTypeAudio } from '$lib/enums';
|
||||
import type { DatabaseMessageExtraAudioFile, DatabaseMessageExtraImageFile } from '$lib/types';
|
||||
import type { AgenticSection } from '$lib/types';
|
||||
import { createBase64DataUrl } from '$lib/utils/data-url';
|
||||
import { ATTACHMENT_SAVED_REGEX } from '#lib/constants/agentic.constants.ts';
|
||||
import { AttachmentType, MimeTypeAudio } from '#lib/enums/index.ts';
|
||||
import type {
|
||||
DatabaseMessageExtraAudioFile,
|
||||
DatabaseMessageExtraImageFile
|
||||
} from '#lib/types/index.ts';
|
||||
import type { AgenticSection } from '#lib/types/index.ts';
|
||||
import { createBase64DataUrl } from '#lib/utils/data-url.ts';
|
||||
|
||||
interface Props {
|
||||
section: AgenticSection;
|
||||
|
||||
+5
-5
@@ -2,11 +2,11 @@
|
||||
import { parseRunJavascriptMeta } from './parsers/run-javascript';
|
||||
import ToolCallBlock from './ToolCallBlock.svelte';
|
||||
import { Terminal, XCircle } from '@lucide/svelte';
|
||||
import { SyntaxHighlightedCode } from '$lib/components/app';
|
||||
import { MAX_HEIGHT_CODE_BLOCK } from '$lib/constants';
|
||||
import { FileTypeText } from '$lib/enums';
|
||||
import type { AgenticSection } from '$lib/types';
|
||||
import { getToolUi } from '$lib/utils';
|
||||
import { SyntaxHighlightedCode } from '#lib/components/app/index.ts';
|
||||
import { MAX_HEIGHT_CODE_BLOCK } from '#lib/constants/index.ts';
|
||||
import { FileTypeText } from '#lib/enums/index.ts';
|
||||
import type { AgenticSection } from '#lib/types/index.ts';
|
||||
import { getToolUi } from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
section: AgenticSection;
|
||||
|
||||
+7
-7
@@ -1,18 +1,18 @@
|
||||
<script lang="ts">
|
||||
import { Globe, Loader2 } from '@lucide/svelte';
|
||||
import { CollapsibleContentBlock } from '$lib/components/app';
|
||||
import * as HoverCard from '$lib/components/ui/hover-card';
|
||||
import { ICON_CLASS_DEFAULT, ICON_CLASS_SPIN } from '$lib/constants';
|
||||
import { AgenticSectionType } from '$lib/enums';
|
||||
import { mcpStore } from '$lib/stores';
|
||||
import type { AgenticSection, SearchResult } from '$lib/types';
|
||||
import { CollapsibleContentBlock } from '#lib/components/app/index.ts';
|
||||
import * as HoverCard from '#lib/components/ui/hover-card/index.ts';
|
||||
import { ICON_CLASS_DEFAULT, ICON_CLASS_SPIN } from '#lib/constants/index.ts';
|
||||
import { AgenticSectionType } from '#lib/enums/index.ts';
|
||||
import { mcpStore } from '#lib/stores/index.ts';
|
||||
import type { AgenticSection, SearchResult } from '#lib/types/index.ts';
|
||||
import {
|
||||
buildProxiedIconUrl,
|
||||
extractSearchQuery,
|
||||
extractSearchResults,
|
||||
faviconForUrl,
|
||||
sanitizeExternalUrl
|
||||
} from '$lib/utils';
|
||||
} from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
section: AgenticSection;
|
||||
|
||||
+6
-6
@@ -2,12 +2,12 @@
|
||||
import { parseWriteFileMeta, parseWriteFileTitleMeta } from './parsers/write-file';
|
||||
import ToolCallBlock from './ToolCallBlock.svelte';
|
||||
import { XCircle } from '@lucide/svelte';
|
||||
import { SyntaxHighlightedCode } from '$lib/components/app';
|
||||
import { MAX_HEIGHT_CODE_BLOCK, RESULT_STAT_SEPARATOR } from '$lib/constants';
|
||||
import { FileTypeText } from '$lib/enums';
|
||||
import { toolsStore } from '$lib/stores';
|
||||
import type { AgenticSection } from '$lib/types';
|
||||
import { abbreviateHome, formatJsonPretty } from '$lib/utils';
|
||||
import { SyntaxHighlightedCode } from '#lib/components/app/index.ts';
|
||||
import { MAX_HEIGHT_CODE_BLOCK, RESULT_STAT_SEPARATOR } from '#lib/constants/index.ts';
|
||||
import { FileTypeText } from '#lib/enums/index.ts';
|
||||
import { toolsStore } from '#lib/stores/index.ts';
|
||||
import type { AgenticSection } from '#lib/types/index.ts';
|
||||
import { abbreviateHome, formatJsonPretty } from '#lib/utils/index.ts';
|
||||
|
||||
interface Props {
|
||||
section: AgenticSection;
|
||||
|
||||
+6
-6
@@ -10,12 +10,12 @@
|
||||
// snippet - everything around them is this single source of truth.
|
||||
|
||||
import { Loader2, Wrench } from '@lucide/svelte';
|
||||
import { CollapsibleContentBlock } from '$lib/components/app';
|
||||
import { ICON_CLASS_DEFAULT, ICON_CLASS_SPIN } from '$lib/constants';
|
||||
import { AgenticSectionType } from '$lib/enums';
|
||||
import { mcpStore } from '$lib/stores';
|
||||
import type { AgenticSection, ToolUiEntry } from '$lib/types';
|
||||
import { getToolUi } from '$lib/utils';
|
||||
import { CollapsibleContentBlock } from '#lib/components/app/index.ts';
|
||||
import { ICON_CLASS_DEFAULT, ICON_CLASS_SPIN } from '#lib/constants/index.ts';
|
||||
import { AgenticSectionType } from '#lib/enums/index.ts';
|
||||
import { mcpStore } from '#lib/stores/index.ts';
|
||||
import type { AgenticSection, ToolUiEntry } from '#lib/types/index.ts';
|
||||
import { getToolUi } from '#lib/utils/index.ts';
|
||||
import type { Component, Snippet } from 'svelte';
|
||||
|
||||
type ToolCallBlockMetaWithError = TMeta & { errorMessage?: string };
|
||||
|
||||
+4
-4
@@ -8,10 +8,10 @@ import {
|
||||
FILE_PATH_SEPARATOR_REGEX,
|
||||
TOOL_ARG_PATH_KEYS,
|
||||
TOOL_ARG_STRING_FIELD_PATTERN_TEMPLATE
|
||||
} from '$lib/constants';
|
||||
import { BuiltInTool } from '$lib/enums';
|
||||
import type { AgenticSection } from '$lib/types/agentic';
|
||||
import { parsePartialJsonArgs } from '$lib/utils/parse-partial-json-args';
|
||||
} from '#lib/constants/index.ts';
|
||||
import { BuiltInTool } from '#lib/enums/index.ts';
|
||||
import type { AgenticSection } from '#lib/types/agentic.js';
|
||||
import { parsePartialJsonArgs } from '#lib/utils/parse-partial-json-args.ts';
|
||||
|
||||
/**
|
||||
* Strict (final-state) JSON parser for a tool-args blob. Mirrors the
|
||||
|
||||
+9
-4
@@ -10,10 +10,15 @@ import {
|
||||
fileNameFromPath,
|
||||
parseToolArgs
|
||||
} from './_shared';
|
||||
import { TOOL_ARG_PATH_KEYS } from '$lib/constants';
|
||||
import { BuiltInTool } from '$lib/enums';
|
||||
import type { AgenticSection, EditFileEdit, EditFileMeta, EditFileTitleMeta } from '$lib/types';
|
||||
import { tryParseToolResultObject } from '$lib/utils';
|
||||
import { TOOL_ARG_PATH_KEYS } from '#lib/constants/index.ts';
|
||||
import { BuiltInTool } from '#lib/enums/index.ts';
|
||||
import type {
|
||||
AgenticSection,
|
||||
EditFileEdit,
|
||||
EditFileMeta,
|
||||
EditFileTitleMeta
|
||||
} from '#lib/types/index.ts';
|
||||
import { tryParseToolResultObject } from '#lib/utils/index.ts';
|
||||
|
||||
export function parseEditFileMeta(section: AgenticSection): EditFileMeta | null {
|
||||
const args = parseToolArgs(BuiltInTool.SERVER_EDIT_FILE, section, { partial: true });
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@
|
||||
// the error / exit status elide from call-section to result-section.
|
||||
|
||||
import { parseToolArgs } from './_shared';
|
||||
import { BuiltInTool } from '$lib/enums';
|
||||
import type { AgenticSection } from '$lib/types';
|
||||
import { BuiltInTool } from '#lib/enums/index.ts';
|
||||
import type { AgenticSection } from '#lib/types/index.ts';
|
||||
|
||||
export type ExecShellCommandMeta = {
|
||||
command: string;
|
||||
|
||||
+3
-3
@@ -5,9 +5,9 @@
|
||||
// emit unparseable output.
|
||||
|
||||
import { parseToolArgs } from './_shared';
|
||||
import { BuiltInTool } from '$lib/enums';
|
||||
import type { AgenticSection } from '$lib/types';
|
||||
import { splitSearchSummaryList } from '$lib/utils';
|
||||
import { BuiltInTool } from '#lib/enums/index.ts';
|
||||
import type { AgenticSection } from '#lib/types/index.ts';
|
||||
import { splitSearchSummaryList } from '#lib/utils/index.ts';
|
||||
|
||||
export type FileGlobSearchMeta = {
|
||||
path: string;
|
||||
|
||||
+3
-3
@@ -6,9 +6,9 @@
|
||||
// surfaced.
|
||||
|
||||
import { parseToolArgs } from './_shared';
|
||||
import { BuiltInTool } from '$lib/enums';
|
||||
import type { AgenticSection } from '$lib/types';
|
||||
import { splitSearchSummaryList } from '$lib/utils';
|
||||
import { BuiltInTool } from '#lib/enums/index.ts';
|
||||
import type { AgenticSection } from '#lib/types/index.ts';
|
||||
import { splitSearchSummaryList } from '#lib/utils/index.ts';
|
||||
|
||||
export type GrepSearchMatch = {
|
||||
file: string;
|
||||
|
||||
+4
-4
@@ -4,10 +4,10 @@
|
||||
// can render incrementally as the file path streams in.
|
||||
|
||||
import { parseToolArgs } from './_shared';
|
||||
import { CODE_BLOCK, FILE_PATH_SEPARATOR_REGEX } from '$lib/constants';
|
||||
import { BuiltInTool } from '$lib/enums';
|
||||
import type { AgenticSection } from '$lib/types';
|
||||
import { getFileTypeByExtension } from '$lib/utils';
|
||||
import { CODE_BLOCK, FILE_PATH_SEPARATOR_REGEX } from '#lib/constants/index.ts';
|
||||
import { BuiltInTool } from '#lib/enums/index.ts';
|
||||
import type { AgenticSection } from '#lib/types/index.ts';
|
||||
import { getFileTypeByExtension } from '#lib/utils/index.ts';
|
||||
|
||||
export type ReadFileMeta = {
|
||||
fileName: string;
|
||||
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
import { FILE_PATH_SEPARATOR_REGEX, NEWLINE } from '$lib/constants';
|
||||
import { FILE_PATH_SEPARATOR_REGEX, NEWLINE } from '#lib/constants/index.ts';
|
||||
import {
|
||||
PREFIX_FILE,
|
||||
PREFIX_MIME,
|
||||
PREFIX_SIZE,
|
||||
READ_MEDIA_SIZE_REGEX
|
||||
} from '$lib/constants/read-media';
|
||||
import type { AgenticSection } from '$lib/types';
|
||||
} from '#lib/constants/read-media.ts';
|
||||
import type { AgenticSection } from '#lib/types/index.ts';
|
||||
|
||||
export interface ReadMediaMeta {
|
||||
fileName: string;
|
||||
|
||||
+3
-3
@@ -6,9 +6,9 @@
|
||||
// are handled.
|
||||
|
||||
import { parseToolArgs } from './_shared';
|
||||
import { JSON_ARRAY_OPEN, JSON_OBJECT_OPEN } from '$lib/constants';
|
||||
import { BuiltInTool } from '$lib/enums';
|
||||
import type { AgenticSection } from '$lib/types';
|
||||
import { JSON_ARRAY_OPEN, JSON_OBJECT_OPEN } from '#lib/constants/index.ts';
|
||||
import { BuiltInTool } from '#lib/enums/index.ts';
|
||||
import type { AgenticSection } from '#lib/types/index.ts';
|
||||
|
||||
export type RunJavascriptMeta = {
|
||||
code: string;
|
||||
|
||||
+4
-4
@@ -10,10 +10,10 @@ import {
|
||||
fileNameFromPath,
|
||||
parseToolArgs
|
||||
} from './_shared';
|
||||
import { CODE_BLOCK, TOOL_ARG_PATH_KEYS } from '$lib/constants';
|
||||
import { BuiltInTool } from '$lib/enums';
|
||||
import type { AgenticSection, WriteFileMeta, WriteFileTitleMeta } from '$lib/types';
|
||||
import { getFileTypeByExtension, tryParseToolResultObject } from '$lib/utils';
|
||||
import { CODE_BLOCK, TOOL_ARG_PATH_KEYS } from '#lib/constants/index.ts';
|
||||
import { BuiltInTool } from '#lib/enums/index.ts';
|
||||
import type { AgenticSection, WriteFileMeta, WriteFileTitleMeta } from '#lib/types/index.ts';
|
||||
import { getFileTypeByExtension, tryParseToolResultObject } from '#lib/utils/index.ts';
|
||||
|
||||
// Plain text when the call carries no path, or one with no known extension.
|
||||
function languageForPath(filePath: string | undefined): string {
|
||||
|
||||
+5
-5
@@ -5,11 +5,11 @@
|
||||
ChatMessageEditForm,
|
||||
ChatMessageStatistics,
|
||||
ChatMessageUserBubble
|
||||
} from '$lib/components/app/chat';
|
||||
import { getChatMessageEditContext } from '$lib/contexts';
|
||||
import { ChatMessageStatisticsMode, MessageRole } from '$lib/enums';
|
||||
import { useProcessingState } from '$lib/hooks/use-processing-state.svelte';
|
||||
import { chatStore, settingsStore } from '$lib/stores';
|
||||
} from '#lib/components/app/chat/index.ts';
|
||||
import { getChatMessageEditContext } from '#lib/contexts/index.ts';
|
||||
import { ChatMessageStatisticsMode, MessageRole } from '#lib/enums/index.ts';
|
||||
import { useProcessingState } from '#lib/hooks/use-processing-state.svelte.ts';
|
||||
import { chatStore, settingsStore } from '#lib/stores/index.ts';
|
||||
|
||||
interface Props {
|
||||
class?: string;
|
||||
|
||||
Loaded 100 of 724 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user