chore: refactor core and server packages
This commit is contained in:
parent
2fe4514678
commit
8ae1e4a24a
3
.gitignore
vendored
3
.gitignore
vendored
@ -49,4 +49,5 @@ test_results.html
|
||||
electron/shared/**
|
||||
|
||||
# docs
|
||||
docs/yarn.lock
|
||||
docs/yarn.lock
|
||||
electron/.version.bak
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
{
|
||||
"name": "@janhq/core",
|
||||
"version": "0.1.10",
|
||||
"description": "Jan app core lib",
|
||||
"description": "Core library for the Jan AI application framework",
|
||||
"keywords": [
|
||||
"jan",
|
||||
"core"
|
||||
],
|
||||
"homepage": "https://jan.ai",
|
||||
"license": "AGPL-3.0",
|
||||
"browser": "dist/core.es5.js",
|
||||
"main": "dist/core.es5.js",
|
||||
"module": "dist/index.cjs.js",
|
||||
"browser": "dist/index.js",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/node/index.cjs.js",
|
||||
"typings": "dist/types/index.d.ts",
|
||||
"files": [
|
||||
"dist",
|
||||
@ -18,13 +18,13 @@
|
||||
],
|
||||
"author": "Jan <service@jan.ai>",
|
||||
"exports": {
|
||||
".": "./dist/core.es5.js",
|
||||
".": "./dist/index.js",
|
||||
"./node": "./dist/node/index.cjs.js"
|
||||
},
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
".": [
|
||||
"./dist/core.es5.js.map",
|
||||
"./dist/index.js.map",
|
||||
"./dist/types/index.d.ts"
|
||||
],
|
||||
"node": [
|
||||
@ -37,14 +37,13 @@
|
||||
"lint": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'",
|
||||
"test": "jest",
|
||||
"prebuild": "rimraf dist",
|
||||
"build": "rollup -c rollup.config.ts"
|
||||
"build": "tsc -p . && rolldown -c rolldown.config.mjs"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@npmcli/arborist": "^9.0.0",
|
||||
"@rollup/plugin-replace": "^5.0.5",
|
||||
"@npmcli/arborist": "^7.1.0",
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/node": "^22.10.0",
|
||||
"@types/pacote": "^11.1.8",
|
||||
"@types/pacote": "^11.1.7",
|
||||
"@types/request": "^2.48.12",
|
||||
"electron": "33.2.1",
|
||||
"eslint": "8.57.0",
|
||||
@ -56,12 +55,7 @@
|
||||
"request": "^2.88.2",
|
||||
"request-progress": "^3.0.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "^2.38.5",
|
||||
"rollup-plugin-commonjs": "^9.1.8",
|
||||
"rollup-plugin-json": "^3.1.0",
|
||||
"rollup-plugin-node-resolve": "^5.2.0",
|
||||
"rollup-plugin-sourcemaps": "^0.6.3",
|
||||
"rollup-plugin-typescript2": "^0.36.0",
|
||||
"rolldown": "1.0.0-beta.1",
|
||||
"ts-jest": "^29.2.5",
|
||||
"tslib": "^2.6.2",
|
||||
"typescript": "^5.3.3"
|
||||
|
||||
51
core/rolldown.config.mjs
Normal file
51
core/rolldown.config.mjs
Normal file
@ -0,0 +1,51 @@
|
||||
import { defineConfig } from 'rolldown'
|
||||
import pkgJson from './package.json' with { type: 'json' }
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
input: 'src/index.ts',
|
||||
output: {
|
||||
format: 'esm',
|
||||
file: 'dist/index.js',
|
||||
sourcemap: true,
|
||||
},
|
||||
platform: 'browser',
|
||||
external: ['path'],
|
||||
define: {
|
||||
NODE: JSON.stringify(`${pkgJson.name}/${pkgJson.node}`),
|
||||
VERSION: JSON.stringify(pkgJson.version),
|
||||
},
|
||||
},
|
||||
{
|
||||
input: 'src/node/index.ts',
|
||||
external: [
|
||||
'fs/promises',
|
||||
'path',
|
||||
'pacote',
|
||||
'@types/pacote',
|
||||
'@npmcli/arborist',
|
||||
'ulidx',
|
||||
'node-fetch',
|
||||
'fs',
|
||||
'request',
|
||||
'crypto',
|
||||
'url',
|
||||
'http',
|
||||
'os',
|
||||
'util',
|
||||
'child_process',
|
||||
'electron',
|
||||
'request-progress',
|
||||
],
|
||||
output: {
|
||||
format: 'cjs',
|
||||
file: 'dist/node/index.cjs.js',
|
||||
sourcemap: true,
|
||||
inlineDynamicImports: true,
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.js', '.ts'],
|
||||
},
|
||||
platform: 'node',
|
||||
},
|
||||
])
|
||||
@ -1,93 +0,0 @@
|
||||
import resolve from 'rollup-plugin-node-resolve'
|
||||
import commonjs from 'rollup-plugin-commonjs'
|
||||
import sourceMaps from 'rollup-plugin-sourcemaps'
|
||||
import typescript from 'rollup-plugin-typescript2'
|
||||
import json from 'rollup-plugin-json'
|
||||
import replace from '@rollup/plugin-replace'
|
||||
|
||||
const pkg = require('./package.json')
|
||||
|
||||
export default [
|
||||
{
|
||||
input: `src/index.ts`,
|
||||
output: [
|
||||
// { file: pkg.main, name: libraryName, format: 'umd', sourcemap: true },
|
||||
{ file: pkg.main, format: 'es', sourcemap: true },
|
||||
],
|
||||
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
|
||||
external: ['path'],
|
||||
watch: {
|
||||
include: 'src/**',
|
||||
},
|
||||
plugins: [
|
||||
// Allow json resolution
|
||||
json(),
|
||||
// Compile TypeScript files
|
||||
typescript({
|
||||
useTsconfigDeclarationDir: true,
|
||||
exclude: ['**/*.test.ts', 'src/node/**'],
|
||||
}),
|
||||
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
|
||||
// commonjs(),
|
||||
// Allow node_modules resolution, so you can use 'external' to control
|
||||
// which external modules to include in the bundle
|
||||
// https://github.com/rollup/rollup-plugin-node-resolve#usage
|
||||
replace({
|
||||
'preventAssignment': true,
|
||||
'node:crypto': 'crypto',
|
||||
'delimiters': ['"', '"'],
|
||||
}),
|
||||
resolve({
|
||||
browser: true,
|
||||
}),
|
||||
|
||||
// Resolve source maps to the original source
|
||||
sourceMaps(),
|
||||
],
|
||||
},
|
||||
{
|
||||
input: `src/node/index.ts`,
|
||||
output: [
|
||||
{ file: 'dist/node/index.cjs.js', format: 'cjs', sourcemap: true },
|
||||
],
|
||||
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
|
||||
external: [
|
||||
'fs/promises',
|
||||
'path',
|
||||
'pacote',
|
||||
'@types/pacote',
|
||||
'@npmcli/arborist',
|
||||
'ulidx',
|
||||
'node-fetch',
|
||||
'fs',
|
||||
'request',
|
||||
'crypto',
|
||||
'url',
|
||||
'http',
|
||||
'os',
|
||||
'util',
|
||||
'child_process',
|
||||
],
|
||||
watch: {
|
||||
include: 'src/node/**',
|
||||
},
|
||||
plugins: [
|
||||
// Allow json resolution
|
||||
json(),
|
||||
// Compile TypeScript files
|
||||
typescript({
|
||||
useTsconfigDeclarationDir: true,
|
||||
exclude: ['**/*.test.ts', 'src/browser/**'],
|
||||
}),
|
||||
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
|
||||
commonjs(),
|
||||
// Allow node_modules resolution, so you can use 'external' to control
|
||||
// which external modules to include in the bundle
|
||||
// https://github.com/rollup/rollup-plugin-node-resolve#usage
|
||||
resolve(),
|
||||
|
||||
// Resolve source maps to the original source
|
||||
sourceMaps(),
|
||||
],
|
||||
},
|
||||
]
|
||||
@ -1,4 +1,9 @@
|
||||
import { DownloadRequest, FileStat, NetworkConfig, SystemInformation } from '../types'
|
||||
import {
|
||||
DownloadRequest,
|
||||
FileStat,
|
||||
NetworkConfig,
|
||||
SystemInformation,
|
||||
} from '../types'
|
||||
|
||||
/**
|
||||
* Execute a extension module function in main process
|
||||
@ -9,11 +14,12 @@ import { DownloadRequest, FileStat, NetworkConfig, SystemInformation } from '../
|
||||
* @returns Promise<any>
|
||||
*
|
||||
*/
|
||||
const executeOnMain: (extension: string, method: string, ...args: any[]) => Promise<any> = (
|
||||
extension,
|
||||
method,
|
||||
...args
|
||||
) => globalThis.core?.api?.invokeExtensionFunc(extension, method, ...args)
|
||||
const executeOnMain: (
|
||||
extension: string,
|
||||
method: string,
|
||||
...args: any[]
|
||||
) => Promise<any> = (extension, method, ...args) =>
|
||||
globalThis.core?.api?.invokeExtensionFunc(extension, method, ...args)
|
||||
|
||||
/**
|
||||
* Downloads a file from a URL and saves it to the local file system.
|
||||
@ -23,10 +29,11 @@ const executeOnMain: (extension: string, method: string, ...args: any[]) => Prom
|
||||
*
|
||||
* @returns {Promise<any>} A promise that resolves when the file is downloaded.
|
||||
*/
|
||||
const downloadFile: (downloadRequest: DownloadRequest, network?: NetworkConfig) => Promise<any> = (
|
||||
downloadRequest,
|
||||
network
|
||||
) => globalThis.core?.api?.downloadFile(downloadRequest, network)
|
||||
const downloadFile: (
|
||||
downloadRequest: DownloadRequest,
|
||||
network?: NetworkConfig
|
||||
) => Promise<any> = (downloadRequest, network) =>
|
||||
globalThis.core?.api?.downloadFile(downloadRequest, network)
|
||||
|
||||
/**
|
||||
* Aborts the download of a specific file.
|
||||
@ -41,7 +48,8 @@ const abortDownload: (fileName: string) => Promise<any> = (fileName) =>
|
||||
*
|
||||
* @returns {Promise<string>} A Promise that resolves with Jan's data folder path.
|
||||
*/
|
||||
const getJanDataFolderPath = (): Promise<string> => globalThis.core.api?.getJanDataFolderPath()
|
||||
const getJanDataFolderPath = (): Promise<string> =>
|
||||
globalThis.core.api?.getJanDataFolderPath()
|
||||
|
||||
/**
|
||||
* Opens the file explorer at a specific path.
|
||||
@ -64,14 +72,16 @@ const joinPath: (paths: string[]) => Promise<string> = (paths) =>
|
||||
* @param path - The file path to retrieve dirname.
|
||||
* @returns {Promise<string>} A promise that resolves the dirname.
|
||||
*/
|
||||
const dirName: (path: string) => Promise<string> = (path) => globalThis.core.api?.dirName(path)
|
||||
const dirName: (path: string) => Promise<string> = (path) =>
|
||||
globalThis.core.api?.dirName(path)
|
||||
|
||||
/**
|
||||
* Retrieve the basename from an url.
|
||||
* @param path - The path to retrieve.
|
||||
* @returns {Promise<string>} A promise that resolves with the basename.
|
||||
*/
|
||||
const baseName: (paths: string) => Promise<string> = (path) => globalThis.core.api?.baseName(path)
|
||||
const baseName: (paths: string) => Promise<string> = (path) =>
|
||||
globalThis.core.api?.baseName(path)
|
||||
|
||||
/**
|
||||
* Opens an external URL in the default web browser.
|
||||
@ -87,13 +97,15 @@ const openExternalUrl: (url: string) => Promise<any> = (url) =>
|
||||
*
|
||||
* @returns {Promise<string>} - A promise that resolves with the resource path.
|
||||
*/
|
||||
const getResourcePath: () => Promise<string> = () => globalThis.core.api?.getResourcePath()
|
||||
const getResourcePath: () => Promise<string> = () =>
|
||||
globalThis.core.api?.getResourcePath()
|
||||
|
||||
/**
|
||||
* Gets the user's home path.
|
||||
* @returns return user's home path
|
||||
*/
|
||||
const getUserHomePath = (): Promise<string> => globalThis.core.api?.getUserHomePath()
|
||||
const getUserHomePath = (): Promise<string> =>
|
||||
globalThis.core.api?.getUserHomePath()
|
||||
|
||||
/**
|
||||
* Log to file from browser processes.
|
||||
@ -111,8 +123,10 @@ const log: (message: string, fileName?: string) => void = (message, fileName) =>
|
||||
*
|
||||
* @returns {Promise<boolean>} - A promise that resolves with a boolean indicating whether the path is a subdirectory.
|
||||
*/
|
||||
const isSubdirectory: (from: string, to: string) => Promise<boolean> = (from: string, to: string) =>
|
||||
globalThis.core.api?.isSubdirectory(from, to)
|
||||
const isSubdirectory: (from: string, to: string) => Promise<boolean> = (
|
||||
from: string,
|
||||
to: string
|
||||
) => globalThis.core.api?.isSubdirectory(from, to)
|
||||
|
||||
/**
|
||||
* Get system information
|
||||
@ -159,5 +173,4 @@ export {
|
||||
systemInformation,
|
||||
showToast,
|
||||
dirName,
|
||||
FileStat,
|
||||
}
|
||||
|
||||
@ -57,7 +57,10 @@ export default class Extension {
|
||||
* @type {string}
|
||||
*/
|
||||
get specifier() {
|
||||
return this.origin + (this.installOptions.version ? '@' + this.installOptions.version : '')
|
||||
return (
|
||||
this.origin +
|
||||
(this.installOptions.version ? '@' + this.installOptions.version : '')
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -75,8 +78,10 @@ export default class Extension {
|
||||
async getManifest() {
|
||||
// Get the package's manifest (package.json object)
|
||||
try {
|
||||
await import('pacote').then((pacote) => {
|
||||
return pacote.manifest(this.specifier, this.installOptions).then((mnf) => {
|
||||
const pacote = require('pacote')
|
||||
return pacote
|
||||
.manifest(this.specifier, this.installOptions)
|
||||
.then((mnf: any) => {
|
||||
// set the Package properties based on the it's manifest
|
||||
this.name = mnf.name
|
||||
this.productName = mnf.productName as string | undefined
|
||||
@ -84,9 +89,10 @@ export default class Extension {
|
||||
this.main = mnf.main
|
||||
this.description = mnf.description
|
||||
})
|
||||
})
|
||||
} catch (error) {
|
||||
throw new Error(`Package ${this.origin} does not contain a valid manifest: ${error}`)
|
||||
throw new Error(
|
||||
`Package ${this.origin} does not contain a valid manifest: ${error}`
|
||||
)
|
||||
}
|
||||
|
||||
return true
|
||||
@ -103,10 +109,13 @@ export default class Extension {
|
||||
await this.getManifest()
|
||||
|
||||
// Install the package in a child folder of the given folder
|
||||
const pacote = await import('pacote')
|
||||
const pacote = require('pacote')
|
||||
await pacote.extract(
|
||||
this.specifier,
|
||||
join(ExtensionManager.instance.getExtensionsPath() ?? '', this.name ?? ''),
|
||||
join(
|
||||
ExtensionManager.instance.getExtensionsPath() ?? '',
|
||||
this.name ?? ''
|
||||
),
|
||||
this.installOptions
|
||||
)
|
||||
|
||||
@ -169,13 +178,12 @@ export default class Extension {
|
||||
* @returns the latest available version if a new version is available or false if not.
|
||||
*/
|
||||
async isUpdateAvailable() {
|
||||
return import('pacote').then((pacote) => {
|
||||
if (this.origin) {
|
||||
return pacote.manifest(this.origin).then((mnf) => {
|
||||
return mnf.version !== this.version ? mnf.version : false
|
||||
})
|
||||
}
|
||||
})
|
||||
const pacote = require('pacote')
|
||||
if (this.origin) {
|
||||
return pacote.manifest(this.origin).then((mnf: any) => {
|
||||
return mnf.version !== this.version ? mnf.version : false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -11,10 +11,10 @@
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"declarationDir": "dist/types",
|
||||
"outDir": "dist/lib",
|
||||
"outDir": "dist",
|
||||
"importHelpers": true,
|
||||
"types": ["jest", "node"]
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["*.test.ts"]
|
||||
"exclude": ["src/**/*.test.ts"]
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@
|
||||
"electron-updater": "^6.1.7",
|
||||
"fs-extra": "^11.2.0",
|
||||
"node-fetch": "2",
|
||||
"pacote": "^17.0.4",
|
||||
"pacote": "^21.0.0",
|
||||
"request": "^2.88.2",
|
||||
"request-progress": "^3.0.0",
|
||||
"ulidx": "^2.3.0"
|
||||
|
||||
@ -509,161 +509,161 @@ __metadata:
|
||||
|
||||
"@janhq/core@file:../../core/package.tgz::locator=%40janhq%2Fassistant-extension%40workspace%3Aassistant-extension":
|
||||
version: 0.1.10
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=02e76a&locator=%40janhq%2Fassistant-extension%40workspace%3Aassistant-extension"
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=663527&locator=%40janhq%2Fassistant-extension%40workspace%3Aassistant-extension"
|
||||
dependencies:
|
||||
rxjs: "npm:^7.8.1"
|
||||
ulidx: "npm:^2.3.0"
|
||||
checksum: 10c0/6402872ec92c48269a29766dcdf498289032b62ab8637a1f35d3c4cd78bfa814b94746f9d0f409ac4b653b6f7828109ce910f44c506d16efb40fef872e9b57bb
|
||||
checksum: 10c0/1297917d8be757142645a76657af16193ea3ac58de53a2cc60142ef7c2a5900b461e84c237da0f13be58f6ce70155d53d1d1745702d8d9fdf8b177a5c67b09b5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@janhq/core@file:../../core/package.tgz::locator=%40janhq%2Fconversational-extension%40workspace%3Aconversational-extension":
|
||||
version: 0.1.10
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=02e76a&locator=%40janhq%2Fconversational-extension%40workspace%3Aconversational-extension"
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=663527&locator=%40janhq%2Fconversational-extension%40workspace%3Aconversational-extension"
|
||||
dependencies:
|
||||
rxjs: "npm:^7.8.1"
|
||||
ulidx: "npm:^2.3.0"
|
||||
checksum: 10c0/6402872ec92c48269a29766dcdf498289032b62ab8637a1f35d3c4cd78bfa814b94746f9d0f409ac4b653b6f7828109ce910f44c506d16efb40fef872e9b57bb
|
||||
checksum: 10c0/1297917d8be757142645a76657af16193ea3ac58de53a2cc60142ef7c2a5900b461e84c237da0f13be58f6ce70155d53d1d1745702d8d9fdf8b177a5c67b09b5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@janhq/core@file:../../core/package.tgz::locator=%40janhq%2Fengine-management-extension%40workspace%3Aengine-management-extension":
|
||||
version: 0.1.10
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=02e76a&locator=%40janhq%2Fengine-management-extension%40workspace%3Aengine-management-extension"
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=663527&locator=%40janhq%2Fengine-management-extension%40workspace%3Aengine-management-extension"
|
||||
dependencies:
|
||||
rxjs: "npm:^7.8.1"
|
||||
ulidx: "npm:^2.3.0"
|
||||
checksum: 10c0/6402872ec92c48269a29766dcdf498289032b62ab8637a1f35d3c4cd78bfa814b94746f9d0f409ac4b653b6f7828109ce910f44c506d16efb40fef872e9b57bb
|
||||
checksum: 10c0/1297917d8be757142645a76657af16193ea3ac58de53a2cc60142ef7c2a5900b461e84c237da0f13be58f6ce70155d53d1d1745702d8d9fdf8b177a5c67b09b5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@janhq/core@file:../../core/package.tgz::locator=%40janhq%2Finference-anthropic-extension%40workspace%3Ainference-anthropic-extension":
|
||||
version: 0.1.10
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=02e76a&locator=%40janhq%2Finference-anthropic-extension%40workspace%3Ainference-anthropic-extension"
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=663527&locator=%40janhq%2Finference-anthropic-extension%40workspace%3Ainference-anthropic-extension"
|
||||
dependencies:
|
||||
rxjs: "npm:^7.8.1"
|
||||
ulidx: "npm:^2.3.0"
|
||||
checksum: 10c0/6402872ec92c48269a29766dcdf498289032b62ab8637a1f35d3c4cd78bfa814b94746f9d0f409ac4b653b6f7828109ce910f44c506d16efb40fef872e9b57bb
|
||||
checksum: 10c0/1297917d8be757142645a76657af16193ea3ac58de53a2cc60142ef7c2a5900b461e84c237da0f13be58f6ce70155d53d1d1745702d8d9fdf8b177a5c67b09b5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@janhq/core@file:../../core/package.tgz::locator=%40janhq%2Finference-cohere-extension%40workspace%3Ainference-cohere-extension":
|
||||
version: 0.1.10
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=02e76a&locator=%40janhq%2Finference-cohere-extension%40workspace%3Ainference-cohere-extension"
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=663527&locator=%40janhq%2Finference-cohere-extension%40workspace%3Ainference-cohere-extension"
|
||||
dependencies:
|
||||
rxjs: "npm:^7.8.1"
|
||||
ulidx: "npm:^2.3.0"
|
||||
checksum: 10c0/6402872ec92c48269a29766dcdf498289032b62ab8637a1f35d3c4cd78bfa814b94746f9d0f409ac4b653b6f7828109ce910f44c506d16efb40fef872e9b57bb
|
||||
checksum: 10c0/1297917d8be757142645a76657af16193ea3ac58de53a2cc60142ef7c2a5900b461e84c237da0f13be58f6ce70155d53d1d1745702d8d9fdf8b177a5c67b09b5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@janhq/core@file:../../core/package.tgz::locator=%40janhq%2Finference-cortex-extension%40workspace%3Ainference-cortex-extension":
|
||||
version: 0.1.10
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=02e76a&locator=%40janhq%2Finference-cortex-extension%40workspace%3Ainference-cortex-extension"
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=663527&locator=%40janhq%2Finference-cortex-extension%40workspace%3Ainference-cortex-extension"
|
||||
dependencies:
|
||||
rxjs: "npm:^7.8.1"
|
||||
ulidx: "npm:^2.3.0"
|
||||
checksum: 10c0/6402872ec92c48269a29766dcdf498289032b62ab8637a1f35d3c4cd78bfa814b94746f9d0f409ac4b653b6f7828109ce910f44c506d16efb40fef872e9b57bb
|
||||
checksum: 10c0/1297917d8be757142645a76657af16193ea3ac58de53a2cc60142ef7c2a5900b461e84c237da0f13be58f6ce70155d53d1d1745702d8d9fdf8b177a5c67b09b5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@janhq/core@file:../../core/package.tgz::locator=%40janhq%2Finference-groq-extension%40workspace%3Ainference-groq-extension":
|
||||
version: 0.1.10
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=02e76a&locator=%40janhq%2Finference-groq-extension%40workspace%3Ainference-groq-extension"
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=663527&locator=%40janhq%2Finference-groq-extension%40workspace%3Ainference-groq-extension"
|
||||
dependencies:
|
||||
rxjs: "npm:^7.8.1"
|
||||
ulidx: "npm:^2.3.0"
|
||||
checksum: 10c0/6402872ec92c48269a29766dcdf498289032b62ab8637a1f35d3c4cd78bfa814b94746f9d0f409ac4b653b6f7828109ce910f44c506d16efb40fef872e9b57bb
|
||||
checksum: 10c0/1297917d8be757142645a76657af16193ea3ac58de53a2cc60142ef7c2a5900b461e84c237da0f13be58f6ce70155d53d1d1745702d8d9fdf8b177a5c67b09b5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@janhq/core@file:../../core/package.tgz::locator=%40janhq%2Finference-martian-extension%40workspace%3Ainference-martian-extension":
|
||||
version: 0.1.10
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=02e76a&locator=%40janhq%2Finference-martian-extension%40workspace%3Ainference-martian-extension"
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=663527&locator=%40janhq%2Finference-martian-extension%40workspace%3Ainference-martian-extension"
|
||||
dependencies:
|
||||
rxjs: "npm:^7.8.1"
|
||||
ulidx: "npm:^2.3.0"
|
||||
checksum: 10c0/6402872ec92c48269a29766dcdf498289032b62ab8637a1f35d3c4cd78bfa814b94746f9d0f409ac4b653b6f7828109ce910f44c506d16efb40fef872e9b57bb
|
||||
checksum: 10c0/1297917d8be757142645a76657af16193ea3ac58de53a2cc60142ef7c2a5900b461e84c237da0f13be58f6ce70155d53d1d1745702d8d9fdf8b177a5c67b09b5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@janhq/core@file:../../core/package.tgz::locator=%40janhq%2Finference-mistral-extension%40workspace%3Ainference-mistral-extension":
|
||||
version: 0.1.10
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=02e76a&locator=%40janhq%2Finference-mistral-extension%40workspace%3Ainference-mistral-extension"
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=663527&locator=%40janhq%2Finference-mistral-extension%40workspace%3Ainference-mistral-extension"
|
||||
dependencies:
|
||||
rxjs: "npm:^7.8.1"
|
||||
ulidx: "npm:^2.3.0"
|
||||
checksum: 10c0/6402872ec92c48269a29766dcdf498289032b62ab8637a1f35d3c4cd78bfa814b94746f9d0f409ac4b653b6f7828109ce910f44c506d16efb40fef872e9b57bb
|
||||
checksum: 10c0/1297917d8be757142645a76657af16193ea3ac58de53a2cc60142ef7c2a5900b461e84c237da0f13be58f6ce70155d53d1d1745702d8d9fdf8b177a5c67b09b5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@janhq/core@file:../../core/package.tgz::locator=%40janhq%2Finference-nvidia-extension%40workspace%3Ainference-nvidia-extension":
|
||||
version: 0.1.10
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=02e76a&locator=%40janhq%2Finference-nvidia-extension%40workspace%3Ainference-nvidia-extension"
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=663527&locator=%40janhq%2Finference-nvidia-extension%40workspace%3Ainference-nvidia-extension"
|
||||
dependencies:
|
||||
rxjs: "npm:^7.8.1"
|
||||
ulidx: "npm:^2.3.0"
|
||||
checksum: 10c0/6402872ec92c48269a29766dcdf498289032b62ab8637a1f35d3c4cd78bfa814b94746f9d0f409ac4b653b6f7828109ce910f44c506d16efb40fef872e9b57bb
|
||||
checksum: 10c0/1297917d8be757142645a76657af16193ea3ac58de53a2cc60142ef7c2a5900b461e84c237da0f13be58f6ce70155d53d1d1745702d8d9fdf8b177a5c67b09b5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@janhq/core@file:../../core/package.tgz::locator=%40janhq%2Finference-openai-extension%40workspace%3Ainference-openai-extension":
|
||||
version: 0.1.10
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=02e76a&locator=%40janhq%2Finference-openai-extension%40workspace%3Ainference-openai-extension"
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=663527&locator=%40janhq%2Finference-openai-extension%40workspace%3Ainference-openai-extension"
|
||||
dependencies:
|
||||
rxjs: "npm:^7.8.1"
|
||||
ulidx: "npm:^2.3.0"
|
||||
checksum: 10c0/6402872ec92c48269a29766dcdf498289032b62ab8637a1f35d3c4cd78bfa814b94746f9d0f409ac4b653b6f7828109ce910f44c506d16efb40fef872e9b57bb
|
||||
checksum: 10c0/1297917d8be757142645a76657af16193ea3ac58de53a2cc60142ef7c2a5900b461e84c237da0f13be58f6ce70155d53d1d1745702d8d9fdf8b177a5c67b09b5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@janhq/core@file:../../core/package.tgz::locator=%40janhq%2Finference-openrouter-extension%40workspace%3Ainference-openrouter-extension":
|
||||
version: 0.1.10
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=02e76a&locator=%40janhq%2Finference-openrouter-extension%40workspace%3Ainference-openrouter-extension"
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=663527&locator=%40janhq%2Finference-openrouter-extension%40workspace%3Ainference-openrouter-extension"
|
||||
dependencies:
|
||||
rxjs: "npm:^7.8.1"
|
||||
ulidx: "npm:^2.3.0"
|
||||
checksum: 10c0/6402872ec92c48269a29766dcdf498289032b62ab8637a1f35d3c4cd78bfa814b94746f9d0f409ac4b653b6f7828109ce910f44c506d16efb40fef872e9b57bb
|
||||
checksum: 10c0/1297917d8be757142645a76657af16193ea3ac58de53a2cc60142ef7c2a5900b461e84c237da0f13be58f6ce70155d53d1d1745702d8d9fdf8b177a5c67b09b5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@janhq/core@file:../../core/package.tgz::locator=%40janhq%2Finference-triton-trt-llm-extension%40workspace%3Ainference-triton-trtllm-extension":
|
||||
version: 0.1.10
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=02e76a&locator=%40janhq%2Finference-triton-trt-llm-extension%40workspace%3Ainference-triton-trtllm-extension"
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=663527&locator=%40janhq%2Finference-triton-trt-llm-extension%40workspace%3Ainference-triton-trtllm-extension"
|
||||
dependencies:
|
||||
rxjs: "npm:^7.8.1"
|
||||
ulidx: "npm:^2.3.0"
|
||||
checksum: 10c0/6402872ec92c48269a29766dcdf498289032b62ab8637a1f35d3c4cd78bfa814b94746f9d0f409ac4b653b6f7828109ce910f44c506d16efb40fef872e9b57bb
|
||||
checksum: 10c0/1297917d8be757142645a76657af16193ea3ac58de53a2cc60142ef7c2a5900b461e84c237da0f13be58f6ce70155d53d1d1745702d8d9fdf8b177a5c67b09b5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@janhq/core@file:../../core/package.tgz::locator=%40janhq%2Fmodel-extension%40workspace%3Amodel-extension":
|
||||
version: 0.1.10
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=02e76a&locator=%40janhq%2Fmodel-extension%40workspace%3Amodel-extension"
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=663527&locator=%40janhq%2Fmodel-extension%40workspace%3Amodel-extension"
|
||||
dependencies:
|
||||
rxjs: "npm:^7.8.1"
|
||||
ulidx: "npm:^2.3.0"
|
||||
checksum: 10c0/6402872ec92c48269a29766dcdf498289032b62ab8637a1f35d3c4cd78bfa814b94746f9d0f409ac4b653b6f7828109ce910f44c506d16efb40fef872e9b57bb
|
||||
checksum: 10c0/1297917d8be757142645a76657af16193ea3ac58de53a2cc60142ef7c2a5900b461e84c237da0f13be58f6ce70155d53d1d1745702d8d9fdf8b177a5c67b09b5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@janhq/core@file:../../core/package.tgz::locator=%40janhq%2Fmonitoring-extension%40workspace%3Amonitoring-extension":
|
||||
version: 0.1.10
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=02e76a&locator=%40janhq%2Fmonitoring-extension%40workspace%3Amonitoring-extension"
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=663527&locator=%40janhq%2Fmonitoring-extension%40workspace%3Amonitoring-extension"
|
||||
dependencies:
|
||||
rxjs: "npm:^7.8.1"
|
||||
ulidx: "npm:^2.3.0"
|
||||
checksum: 10c0/6402872ec92c48269a29766dcdf498289032b62ab8637a1f35d3c4cd78bfa814b94746f9d0f409ac4b653b6f7828109ce910f44c506d16efb40fef872e9b57bb
|
||||
checksum: 10c0/1297917d8be757142645a76657af16193ea3ac58de53a2cc60142ef7c2a5900b461e84c237da0f13be58f6ce70155d53d1d1745702d8d9fdf8b177a5c67b09b5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@janhq/core@file:../../core/package.tgz::locator=%40janhq%2Ftensorrt-llm-extension%40workspace%3Atensorrt-llm-extension":
|
||||
version: 0.1.10
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=02e76a&locator=%40janhq%2Ftensorrt-llm-extension%40workspace%3Atensorrt-llm-extension"
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=663527&locator=%40janhq%2Ftensorrt-llm-extension%40workspace%3Atensorrt-llm-extension"
|
||||
dependencies:
|
||||
rxjs: "npm:^7.8.1"
|
||||
ulidx: "npm:^2.3.0"
|
||||
checksum: 10c0/6402872ec92c48269a29766dcdf498289032b62ab8637a1f35d3c4cd78bfa814b94746f9d0f409ac4b653b6f7828109ce910f44c506d16efb40fef872e9b57bb
|
||||
checksum: 10c0/1297917d8be757142645a76657af16193ea3ac58de53a2cc60142ef7c2a5900b461e84c237da0f13be58f6ce70155d53d1d1745702d8d9fdf8b177a5c67b09b5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
import { setup } from './helpers/setup'
|
||||
import { startServer as start } from './index'
|
||||
/**
|
||||
* Setup extensions and start the server
|
||||
*/
|
||||
setup().then(() => start())
|
||||
@ -1,38 +1,28 @@
|
||||
{
|
||||
"name": "@janhq/server",
|
||||
"version": "0.1.3",
|
||||
"main": "build/index.js",
|
||||
"types": "build/index.d.ts",
|
||||
"main": "dist/index.js",
|
||||
"author": "Jan <service@jan.ai>",
|
||||
"license": "AGPL-3.0",
|
||||
"homepage": "https://jan.ai",
|
||||
"description": "Use offline LLMs with your own data. Run open source models like Llama2 or Falcon on your internal computers/servers.",
|
||||
"description": "Jan API Server proxies route all requests to cortex.cpp server with customized configurations.",
|
||||
"files": [
|
||||
"build/**",
|
||||
"cortex.json"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint . --ext \".js,.jsx,.ts,.tsx\"",
|
||||
"test:e2e": "playwright test --workers=1",
|
||||
"dev": "tsc --watch & node --watch build/main.js",
|
||||
"build": "tsc"
|
||||
"build": "rolldown -c rolldown.config.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@alumna/reflect": "^1.1.3",
|
||||
"@cyclic.sh/s3fs": "^1.2.9",
|
||||
"@fastify/cors": "^10.0.1",
|
||||
"@fastify/http-proxy": "^10.0.0",
|
||||
"@fastify/static": "^6.12.0",
|
||||
"@fastify/swagger": "^9.4.0",
|
||||
"@fastify/swagger-ui": "5.2.0",
|
||||
"@janhq/core": "link:../core",
|
||||
"@npmcli/arborist": "^7.3.1",
|
||||
"dotenv": "^16.3.1",
|
||||
"fastify": "^5.2.0",
|
||||
"fetch-retry": "^5.0.6",
|
||||
"node-fetch": "2",
|
||||
"request": "^2.88.2",
|
||||
"request-progress": "^3.0.0",
|
||||
"tcp-port-used": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -42,6 +32,7 @@
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.3",
|
||||
"@typescript-eslint/parser": "^6.7.3",
|
||||
"eslint-plugin-react": "^7.34.0",
|
||||
"rolldown": "1.0.0-beta.1",
|
||||
"run-script-os": "^1.1.6",
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
|
||||
17
server/rolldown.config.mjs
Normal file
17
server/rolldown.config.mjs
Normal file
@ -0,0 +1,17 @@
|
||||
import { defineConfig } from 'rolldown'
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
input: 'index.ts',
|
||||
output: {
|
||||
format: 'cjs',
|
||||
file: 'dist/index.js',
|
||||
sourcemap: true,
|
||||
inlineDynamicImports: true,
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.js', '.ts'],
|
||||
},
|
||||
platform: 'node',
|
||||
},
|
||||
])
|
||||
@ -4,8 +4,8 @@
|
||||
"module": "commonjs",
|
||||
"noImplicitAny": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"outDir": "./build",
|
||||
"strict": false,
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./",
|
||||
"noEmitOnError": true,
|
||||
"esModuleInterop": true,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user