Merge branch 'dev' into allow-assistant-message-edits

This commit is contained in:
ethanova 2025-06-21 06:39:33 -04:00 committed by GitHub
commit 4e2b28c687
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 5162 additions and 8298 deletions

View File

@ -89,7 +89,7 @@ For those who enjoy the scenic route:
- Make ≥ 3.81 - Make ≥ 3.81
- Rust (for Tauri) - Rust (for Tauri)
### Quick Start ### Run with Make
```bash ```bash
git clone https://github.com/menloresearch/jan git clone https://github.com/menloresearch/jan
@ -99,34 +99,44 @@ make dev
This handles everything: installs dependencies, builds core components, and launches the app. This handles everything: installs dependencies, builds core components, and launches the app.
### Alternative Commands **Available make targets:**
- `make dev` - Full development setup and launch
- `make build` - Production build
- `make test` - Run tests and linting
- `make clean` - Delete everything and start fresh
If you prefer the verbose approach: ### Run with Mise (easier)
You can also run with [mise](https://mise.jdx.dev/), which is a bit easier as it ensures Node.js, Rust, and other dependency versions are automatically managed:
```bash
git clone https://github.com/menloresearch/jan
cd jan
# Install mise (if not already installed)
curl https://mise.run | sh
# Install tools and start development
mise install # installs Node.js, Rust, and other tools
mise dev # runs the full development setup
```
**Available mise commands:**
- `mise dev` - Full development setup and launch
- `mise build` - Production build
- `mise test` - Run tests and linting
- `mise clean` - Delete everything and start fresh
- `mise tasks` - List all available tasks
### Manual Commands
```bash ```bash
# Setup and development
yarn install yarn install
yarn build:core yarn build:core
yarn build:extensions yarn build:extensions
yarn dev yarn dev
# Production build
yarn build
# Clean slate (when things inevitably break)
make clean
``` ```
### Available Make Targets
- `make dev` - Full development setup and launch (recommended)
- `make dev-tauri` - Tauri development (deprecated, use `make dev`)
- `make build` - Production build
- `make install-and-build` - Install dependencies and build core/extensions
- `make test` - Run tests and linting
- `make lint` - Check your code doesn't offend the linters
- `make clean` - Nuclear option: delete everything and start fresh
## System Requirements ## System Requirements
**Minimum specs for a decent experience:** **Minimum specs for a decent experience:**

215
mise.toml Normal file
View File

@ -0,0 +1,215 @@
[tools]
node = "20"
rust = "1.85.1"
sccache = "latest"
[env]
_.path = ['./node_modules/.bin']
RUSTC_WRAPPER="sccache"
# ============================================================================
# CORE SETUP AND CONFIGURATION TASKS
# ============================================================================
[tasks.config-yarn]
description = "Configure yarn version and settings"
run = [
"corepack enable",
"corepack prepare yarn@4.5.3 --activate",
"yarn --version",
"yarn config set -H enableImmutableInstalls false"
]
[tasks.install]
description = "Install dependencies"
depends = ["config-yarn"]
run = '''
#!/usr/bin/env bash
# Skip install on Windows per Makefile logic
if [[ "$OSTYPE" != "msys" && "$OSTYPE" != "win32" ]]; then
yarn install
fi
'''
sources = ['package.json', 'yarn.lock']
outputs = ['node_modules']
[tasks.build-core]
description = "Build core package"
depends = ["install"]
run = "yarn build:core"
sources = ['core/**/*']
outputs = ['core/dist']
[tasks.build-extensions]
description = "Build extensions"
depends = ["build-core"]
run = "yarn build:extensions"
sources = ['extensions/**/*']
outputs = ['pre-install/*.tgz']
[tasks.install-and-build]
description = "Install dependencies and build core and extensions (matches Makefile)"
depends = ["build-extensions"]
# ============================================================================
# DEVELOPMENT TASKS
# ============================================================================
[tasks.dev]
description = "Start development server (matches Makefile)"
depends = ["install-and-build"]
run = [
"yarn install:cortex",
"yarn download:bin",
"yarn copy:lib",
"yarn dev"
]
[tasks.dev-tauri]
description = "Start development server with Tauri (DEPRECATED - matches Makefile)"
depends = ["install-and-build"]
run = [
"yarn install:cortex",
"yarn download:bin",
"yarn copy:lib",
"yarn dev:tauri"
]
# ============================================================================
# BUILD TASKS
# ============================================================================
[tasks.build]
description = "Build complete application (matches Makefile)"
depends = ["install-and-build"]
run = "yarn build"
[tasks.build-tauri]
description = "Build Tauri application (DEPRECATED - matches Makefile)"
depends = ["install-and-build"]
run = [
"yarn copy:lib",
"yarn build"
]
[tasks.build-and-publish]
description = "Build and publish the application (matches Makefile)"
depends = ["install-and-build"]
run = "yarn build"
# ============================================================================
# QUALITY ASSURANCE TASKS
# ============================================================================
[tasks.lint]
description = "Run linting (matches Makefile)"
depends = ["build-extensions"]
run = "yarn lint"
[tasks.test]
description = "Run test suite (matches Makefile)"
depends = ["lint"]
run = "yarn test"
# ============================================================================
# PARALLEL-FRIENDLY QUALITY ASSURANCE TASKS
# ============================================================================
[tasks.lint-only]
description = "Run linting only (parallel-friendly)"
depends = ["build-extensions"]
run = "yarn lint"
hide = true
[tasks.test-only]
description = "Run tests only (parallel-friendly)"
depends = ["build-extensions"]
run = "yarn test"
hide = true
[tasks.qa-parallel]
description = "Run linting and testing in parallel"
depends = ["lint-only", "test-only"]
# ============================================================================
# UTILITY TASKS
# ============================================================================
[tasks.clean]
description = "Clean all build artifacts and dependencies (cross-platform - matches Makefile)"
run = '''
#!/usr/bin/env bash
echo "Cleaning build artifacts and dependencies..."
# Platform detection and cleanup (matches Makefile exactly)
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
# Windows cleanup using PowerShell (matches Makefile)
powershell -Command "Get-ChildItem -Path . -Include node_modules, .next, dist, build, out, .turbo, .yarn -Recurse -Directory | Remove-Item -Recurse -Force" 2>/dev/null || true
powershell -Command "Get-ChildItem -Path . -Include package-lock.json, tsconfig.tsbuildinfo -Recurse -File | Remove-Item -Recurse -Force" 2>/dev/null || true
powershell -Command "Remove-Item -Recurse -Force ./pre-install/*.tgz" 2>/dev/null || true
powershell -Command "Remove-Item -Recurse -Force ./extensions/*/*.tgz" 2>/dev/null || true
powershell -Command "Remove-Item -Recurse -Force ./electron/pre-install/*.tgz" 2>/dev/null || true
powershell -Command "Remove-Item -Recurse -Force ./src-tauri/resources" 2>/dev/null || true
powershell -Command "Remove-Item -Recurse -Force ./src-tauri/target" 2>/dev/null || true
powershell -Command "if (Test-Path \"\$(\$env:USERPROFILE)\\jan\\extensions\\\") { Remove-Item -Path \"\$(\$env:USERPROFILE)\\jan\\extensions\" -Recurse -Force }" 2>/dev/null || true
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux cleanup (matches Makefile)
find . -name "node_modules" -type d -prune -exec rm -rf '{}' + 2>/dev/null || true
find . -name ".next" -type d -exec rm -rf '{}' + 2>/dev/null || true
find . -name "dist" -type d -exec rm -rf '{}' + 2>/dev/null || true
find . -name "build" -type d -exec rm -rf '{}' + 2>/dev/null || true
find . -name "out" -type d -exec rm -rf '{}' + 2>/dev/null || true
find . -name ".turbo" -type d -exec rm -rf '{}' + 2>/dev/null || true
find . -name ".yarn" -type d -exec rm -rf '{}' + 2>/dev/null || true
find . -name "package-lock.json" -type f -exec rm -rf '{}' + 2>/dev/null || true
rm -rf ./pre-install/*.tgz 2>/dev/null || true
rm -rf ./extensions/*/*.tgz 2>/dev/null || true
rm -rf ./electron/pre-install/*.tgz 2>/dev/null || true
rm -rf ./src-tauri/resources 2>/dev/null || true
rm -rf ./src-tauri/target 2>/dev/null || true
rm -rf ~/jan/extensions 2>/dev/null || true
rm -rf "~/.cache/jan*" 2>/dev/null || true
else
# macOS cleanup (matches Makefile)
find . -name "node_modules" -type d -prune -exec rm -rf '{}' + 2>/dev/null || true
find . -name ".next" -type d -exec rm -rf '{}' + 2>/dev/null || true
find . -name "dist" -type d -exec rm -rf '{}' + 2>/dev/null || true
find . -name "build" -type d -exec rm -rf '{}' + 2>/dev/null || true
find . -name "out" -type d -exec rm -rf '{}' + 2>/dev/null || true
find . -name ".turbo" -type d -exec rm -rf '{}' + 2>/dev/null || true
find . -name ".yarn" -type d -exec rm -rf '{}' + 2>/dev/null || true
find . -name "package-lock.json" -type f -exec rm -rf '{}' + 2>/dev/null || true
rm -rf ./pre-install/*.tgz 2>/dev/null || true
rm -rf ./extensions/*/*.tgz 2>/dev/null || true
rm -rf ./electron/pre-install/*.tgz 2>/dev/null || true
rm -rf ./src-tauri/resources 2>/dev/null || true
rm -rf ./src-tauri/target 2>/dev/null || true
rm -rf ~/jan/extensions 2>/dev/null || true
rm -rf ~/Library/Caches/jan* 2>/dev/null || true
fi
echo "Clean completed!"
'''
[tasks.all]
description = "Default target - shows available commands (matches Makefile)"
run = "echo 'Specify a target to run. Use: mise tasks'"
# ============================================================================
# DEVELOPMENT WORKFLOW SHORTCUTS
# ============================================================================
[tasks.setup]
description = "Complete development setup"
depends = ["install-and-build"]
alias = "init"
[tasks.ci]
description = "Run CI pipeline (lint + test sequentially)"
depends = ["test"]
[tasks.ci-parallel]
description = "Run CI pipeline (lint + test in parallel)"
depends = ["qa-parallel"]
alias = "ci-fast"

View File

@ -2,7 +2,7 @@
export { default as i18n, loadTranslations } from './setup' export { default as i18n, loadTranslations } from './setup'
// Export the React context and hook // Export the React context and hook
export { TranslationProvider, useAppTranslation, TranslationContext } from './TranslationContext' export { TranslationProvider } from './TranslationContext'
// Export types // Export types
export type { I18nInstance, TranslationResources } from './setup' export type { I18nInstance, TranslationResources } from './setup'

View File

@ -82,7 +82,7 @@ const translate = (key: string, options: Record<string, unknown> = {}): string =
return current && typeof current === 'object' && current !== null && key in current return current && typeof current === 'object' && current !== null && key in current
? (current as Record<string, unknown>)[key] ? (current as Record<string, unknown>)[key]
: undefined : undefined
}, obj as unknown) }, obj as unknown) as string | undefined
} }
// Try to get translation from current language // Try to get translation from current language

View File

@ -39,13 +39,7 @@ export const Route = createFileRoute(route.settings.hardware as any)({
component: Hardware, component: Hardware,
}) })
function SortableGPUItem({ function SortableGPUItem({ gpu, index }: { gpu: GPU; index: number }) {
gpu,
index,
}: {
gpu: GPU
index: number
}) {
const { const {
attributes, attributes,
listeners, listeners,
@ -105,7 +99,7 @@ function SortableGPUItem({
title={t('settings:hardware.driverVersion')} title={t('settings:hardware.driverVersion')}
actions={ actions={
<span className="text-main-view-fg/80"> <span className="text-main-view-fg/80">
{gpu.additional_information?.driver_version} {gpu.additional_information?.driver_version || '-'}
</span> </span>
} }
/> />
@ -113,7 +107,7 @@ function SortableGPUItem({
title={t('settings:hardware.computeCapability')} title={t('settings:hardware.computeCapability')}
actions={ actions={
<span className="text-main-view-fg/80"> <span className="text-main-view-fg/80">
{gpu.additional_information?.compute_cap} {gpu.additional_information?.compute_cap || '-'}
</span> </span>
} }
/> />
@ -164,7 +158,7 @@ function Hardware() {
} }
useEffect(() => { useEffect(() => {
if (pollingPaused) return; if (pollingPaused) return
const intervalId = setInterval(() => { const intervalId = setInterval(() => {
getHardwareInfo().then((data) => { getHardwareInfo().then((data) => {
updateCPUUsage(data.cpu.usage) updateCPUUsage(data.cpu.usage)

View File

@ -252,7 +252,7 @@ function SystemMonitor() {
{t('system-monitor:driverVersion')} {t('system-monitor:driverVersion')}
</span> </span>
<span className="text-main-view-fg"> <span className="text-main-view-fg">
{gpu.additional_information.driver_version} {gpu.additional_information?.driver_version || '-'}
</span> </span>
</div> </div>
<div className="flex justify-between items-center"> <div className="flex justify-between items-center">
@ -260,7 +260,7 @@ function SystemMonitor() {
{t('system-monitor:computeCapability')} {t('system-monitor:computeCapability')}
</span> </span>
<span className="text-main-view-fg"> <span className="text-main-view-fg">
{gpu.additional_information.compute_cap} {gpu.additional_information?.compute_cap || '-'}
</span> </span>
</div> </div>
<div className="mt-2"> <div className="mt-2">

13173
yarn.lock

File diff suppressed because it is too large Load Diff