Compare commits

..

3 Commits

Author SHA1 Message Date
Simos Mikelatos
9c85ddc807 Merge branch 'main' into fix/replace-all-spawn-with-cross-spawn 2026-04-14 23:52:44 +02:00
Haileyesus
3bbd56e8e9 fix: remove unnecessary child_process imports 2026-04-10 16:50:50 +03:00
Haileyesus
11733918e5 fix: replace child_process with cross-spawn 2026-04-10 16:37:47 +03:00
64 changed files with 821 additions and 1570 deletions

1
.gitignore vendored
View File

@@ -8,7 +8,6 @@ lerna-debug.log*
# Build outputs # Build outputs
dist/ dist/
dist-server/
dist-ssr/ dist-ssr/
build/ build/
out/ out/

View File

@@ -3,16 +3,6 @@
All notable changes to CloudCLI UI will be documented in this file. All notable changes to CloudCLI UI will be documented in this file.
## [1.29.3](https://github.com/siteboon/claudecodeui/compare/v1.29.2...v1.29.3) (2026-04-15)
### Bug Fixes
* **version-upgrade-modal:** implement reload countdown and update UI messages ([#655](https://github.com/siteboon/claudecodeui/issues/655)) ([6413042](https://github.com/siteboon/claudecodeui/commit/641304242d7705b54aab65faa4a7673438c92c60))
### Maintenance
* remove unused route (migrated to providers already) ([31f28a2](https://github.com/siteboon/claudecodeui/commit/31f28a2c183f6ead50941027632d7ab64b7bb2d4))
## [1.29.2](https://github.com/siteboon/claudecodeui/compare/v1.29.1...v1.29.2) (2026-04-14) ## [1.29.2](https://github.com/siteboon/claudecodeui/compare/v1.29.1...v1.29.2) (2026-04-14)
### Bug Fixes ### Bug Fixes

View File

@@ -3,9 +3,7 @@ import tseslint from "typescript-eslint";
import react from "eslint-plugin-react"; import react from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks"; import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh"; import reactRefresh from "eslint-plugin-react-refresh";
import { createNodeResolver, importX } from "eslint-plugin-import-x"; import importX from "eslint-plugin-import-x";
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
import boundaries from "eslint-plugin-boundaries";
import tailwindcss from "eslint-plugin-tailwindcss"; import tailwindcss from "eslint-plugin-tailwindcss";
import unusedImports from "eslint-plugin-unused-imports"; import unusedImports from "eslint-plugin-unused-imports";
import globals from "globals"; import globals from "globals";
@@ -84,7 +82,7 @@ export default tseslint.config(
"sibling", "sibling",
"index", "index",
], ],
"newlines-between": "always", "newlines-between": "never",
}, },
], ],
@@ -100,131 +98,5 @@ export default tseslint.config(
"no-control-regex": "off", "no-control-regex": "off",
"no-useless-escape": "off", "no-useless-escape": "off",
}, },
},
{
files: ["server/**/*.{js,ts}"], // apply this block only to backend source files
ignores: ["server/**/*.d.ts"], // skip generated declaration files in backend linting
plugins: {
boundaries, // enforce backend architecture boundaries (module-to-module contracts)
"import-x": importX, // keep import hygiene rules (duplicates, unresolved paths, etc.)
"unused-imports": unusedImports, // remove dead imports/variables from backend files
},
languageOptions: {
parser: tseslint.parser, // parse both JS and TS syntax in backend files
parserOptions: {
ecmaVersion: "latest", // support modern ECMAScript syntax in backend code
sourceType: "module", // treat backend files as ESM modules
},
globals: {
...globals.node, // expose Node.js globals such as process, Buffer, and __dirname equivalents
},
},
settings: {
"boundaries/include": ["server/**/*.{js,ts}"], // only analyze dependency boundaries inside backend files
"import/resolver": {
// boundaries resolves imports through eslint-module-utils, which reads the classic
// import/resolver setting instead of import-x/resolver-next.
typescript: {
project: ["server/tsconfig.json"], // resolve backend aliases using the canonical backend tsconfig
alwaysTryTypes: true, // keep normal TS package/type resolution working alongside aliases
},
node: {
extensions: [".mjs", ".cjs", ".js", ".json", ".node", ".ts", ".tsx"], // preserve Node-style fallback resolution for plain files
},
},
"import-x/resolver-next": [
// ESLint's import plugin does not read tsconfig path aliases on its own.
// This resolver teaches import-x how to understand the backend-only "@/*"
// mapping defined in server/tsconfig.json, which fixes false no-unresolved errors in editors.
createTypeScriptImportResolver({
project: ["server/tsconfig.json"], // point the resolver at the canonical backend tsconfig instead of the frontend one
alwaysTryTypes: true, // keep standard TypeScript package resolution working while backend aliases are enabled
}),
// Keep Node-style resolution available for normal package imports and plain relative JS files.
// The TypeScript resolver handles aliases, while the Node resolver preserves the expected fallback behavior.
createNodeResolver({
extensions: [".mjs", ".cjs", ".js", ".json", ".node", ".ts", ".tsx"],
}),
],
"boundaries/elements": [
{
type: "backend-shared-types", // shared backend type contract that modules may consume without creating runtime coupling
pattern: ["server/shared/types.{js,ts}"], // support the current shared types path
mode: "file", // treat the types file itself as the boundary element instead of the whole folder
},
{
type: "backend-module", // logical element name used by boundaries rules below
pattern: "server/modules/*", // each direct folder in server/modules is treated as one module boundary
mode: "folder", // classify dependencies at folder-module level (not per individual file)
capture: ["moduleName"], // capture the module folder name for messages/debugging/template use
},
],
},
rules: {
// --- Unused imports/vars (backend) ---
"unused-imports/no-unused-imports": "warn", // warn when imports are not used so they can be cleaned up
"unused-imports/no-unused-vars": "off", // keep backend signal focused on dead imports instead of local unused variables
// --- Import hygiene (backend) ---
"import-x/no-duplicates": "warn", // prevent duplicate import lines from the same module
"import-x/order": [
"warn", // keep backend import grouping/order consistent with the frontend config
{
groups: [
"builtin", // Node built-ins such as fs, path, and url come first
"external", // third-party packages come after built-ins
"internal", // aliased internal imports such as @/... come next
"parent", // ../ imports come after aliased internal imports
"sibling", // ./foo imports come after parent imports
"index", // bare ./ imports stay last
],
"newlines-between": "always", // require a blank line between import groups in backend files too
},
],
"import-x/no-unresolved": "error", // fail when an import path cannot be resolved
"import-x/no-useless-path-segments": "warn", // prefer cleaner paths (remove redundant ./ and ../ segments)
"import-x/no-absolute-path": "error", // disallow absolute filesystem imports in backend files
// --- General safety/style (backend) ---
eqeqeq: ["warn", "always", { null: "ignore" }], // avoid accidental coercion while still allowing x == null checks
// --- Architecture boundaries (backend modules) ---
"boundaries/dependencies": [
"error", // treat architecture violations as lint errors
{
default: "allow", // allow normal imports unless a rule below explicitly disallows them
checkInternals: false, // do not apply these cross-module rules to imports inside the same module
rules: [
{
from: { type: "backend-module" }, // modules may depend on the shared types contract only as erased type-only imports
to: { type: "backend-shared-types" },
disallow: {
dependency: { kind: ["value", "typeof"] },
}, // block runtime imports so shared types stay a compile-time contract instead of a hidden shared module
message:
"Backend modules may only use `import type` when importing from server/shared/types.ts (or server/types.ts).",
},
{
to: { type: "backend-module" }, // when importing anything that belongs to another backend module
disallow: { to: { internalPath: "**" } }, // block all direct/deep imports into module internals by default
message:
"Cross-module imports must go through that module's barrel file (server/modules/<module>/index.ts or index.js).", // explicit error message for architecture violations
},
{
to: { type: "backend-module" }, // same target scope as the disallow rule above
allow: {
to: {
internalPath: [
"index", // allow extensionless barrel imports resolved as module root index
"index.{js,mjs,cjs,ts,tsx}", // allow explicit index.* barrel file imports
],
},
}, // re-allow only public module entry points (barrel files)
},
],
},
],
"boundaries/no-unknown": "error", // fail fast if boundaries cannot classify a dependency, which prevents silent rule bypasses
},
} }
); );

850
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "@cloudcli-ai/cloudcli", "name": "@cloudcli-ai/cloudcli",
"version": "1.29.3", "version": "1.29.2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@cloudcli-ai/cloudcli", "name": "@cloudcli-ai/cloudcli",
"version": "1.29.3", "version": "1.29.2",
"hasInstallScript": true, "hasInstallScript": true,
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"dependencies": { "dependencies": {
@@ -69,7 +69,7 @@
"ws": "^8.14.2" "ws": "^8.14.2"
}, },
"bin": { "bin": {
"cloudcli": "dist-server/server/cli.js" "cloudcli": "server/cli.js"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^20.4.3", "@commitlint/cli": "^20.4.3",
@@ -84,8 +84,6 @@
"autoprefixer": "^10.4.16", "autoprefixer": "^10.4.16",
"concurrently": "^8.2.2", "concurrently": "^8.2.2",
"eslint": "^9.39.3", "eslint": "^9.39.3",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-boundaries": "^6.0.2",
"eslint-plugin-import-x": "^4.16.1", "eslint-plugin-import-x": "^4.16.1",
"eslint-plugin-react": "^7.37.5", "eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^7.0.1", "eslint-plugin-react-hooks": "^7.0.1",
@@ -100,8 +98,6 @@
"release-it": "^19.0.5", "release-it": "^19.0.5",
"sharp": "^0.34.2", "sharp": "^0.34.2",
"tailwindcss": "^3.4.0", "tailwindcss": "^3.4.0",
"tsc-alias": "^1.8.16",
"tsx": "^4.21.0",
"typescript": "^5.9.3", "typescript": "^5.9.3",
"typescript-eslint": "^8.56.1", "typescript-eslint": "^8.56.1",
"vite": "^7.0.4" "vite": "^7.0.4"
@@ -447,23 +443,6 @@
"node": ">=6.9.0" "node": ">=6.9.0"
} }
}, },
"node_modules/@boundaries/elements": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@boundaries/elements/-/elements-2.0.1.tgz",
"integrity": "sha512-sAWO3D8PFP6pBXdxxW93SQi/KQqqhE2AAHo3AgWfdtJXwO6bfK6/wUN81XnOZk0qRC6vHzUEKhjwVD9dtDWvxg==",
"dev": true,
"license": "MIT",
"dependencies": {
"eslint-import-resolver-node": "0.3.9",
"eslint-module-utils": "2.12.1",
"handlebars": "4.7.9",
"is-core-module": "2.16.1",
"micromatch": "4.0.8"
},
"engines": {
"node": ">=18.18"
}
},
"node_modules/@codemirror/autocomplete": { "node_modules/@codemirror/autocomplete": {
"version": "6.18.6", "version": "6.18.6",
"resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.18.6.tgz", "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.18.6.tgz",
@@ -4836,16 +4815,6 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/array-union": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz",
"integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/array.prototype.findlast": { "node_modules/array.prototype.findlast": {
"version": "1.2.5", "version": "1.2.5",
"resolved": "https://registry.npmjs.org/array.prototype.findlast/-/array.prototype.findlast-1.2.5.tgz", "resolved": "https://registry.npmjs.org/array.prototype.findlast/-/array.prototype.findlast-1.2.5.tgz",
@@ -6704,19 +6673,6 @@
"integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==",
"license": "Apache-2.0" "license": "Apache-2.0"
}, },
"node_modules/dir-glob": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
"integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==",
"dev": true,
"license": "MIT",
"dependencies": {
"path-type": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/dlv": { "node_modules/dlv": {
"version": "1.1.3", "version": "1.1.3",
"resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz",
@@ -7261,112 +7217,6 @@
} }
} }
}, },
"node_modules/eslint-import-resolver-node": {
"version": "0.3.9",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz",
"integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==",
"dev": true,
"license": "MIT",
"dependencies": {
"debug": "^3.2.7",
"is-core-module": "^2.13.0",
"resolve": "^1.22.4"
}
},
"node_modules/eslint-import-resolver-node/node_modules/debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"ms": "^2.1.1"
}
},
"node_modules/eslint-import-resolver-typescript": {
"version": "4.4.4",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-4.4.4.tgz",
"integrity": "sha512-1iM2zeBvrYmUNTj2vSC/90JTHDth+dfOfiNKkxApWRsTJYNrc8rOdxxIf5vazX+BiAXTeOT0UvWpGI/7qIWQOw==",
"dev": true,
"license": "ISC",
"dependencies": {
"debug": "^4.4.1",
"eslint-import-context": "^0.1.8",
"get-tsconfig": "^4.10.1",
"is-bun-module": "^2.0.0",
"stable-hash-x": "^0.2.0",
"tinyglobby": "^0.2.14",
"unrs-resolver": "^1.7.11"
},
"engines": {
"node": "^16.17.0 || >=18.6.0"
},
"funding": {
"url": "https://opencollective.com/eslint-import-resolver-typescript"
},
"peerDependencies": {
"eslint": "*",
"eslint-plugin-import": "*",
"eslint-plugin-import-x": "*"
},
"peerDependenciesMeta": {
"eslint-plugin-import": {
"optional": true
},
"eslint-plugin-import-x": {
"optional": true
}
}
},
"node_modules/eslint-module-utils": {
"version": "2.12.1",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.12.1.tgz",
"integrity": "sha512-L8jSWTze7K2mTg0vos/RuLRS5soomksDPoJLXIslC7c8Wmut3bx7CPpJijDcBZtxQ5lrbUdM+s0OlNbz0DCDNw==",
"dev": true,
"license": "MIT",
"dependencies": {
"debug": "^3.2.7"
},
"engines": {
"node": ">=4"
},
"peerDependenciesMeta": {
"eslint": {
"optional": true
}
}
},
"node_modules/eslint-module-utils/node_modules/debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"ms": "^2.1.1"
}
},
"node_modules/eslint-plugin-boundaries": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/eslint-plugin-boundaries/-/eslint-plugin-boundaries-6.0.2.tgz",
"integrity": "sha512-wSHgiYeMEbziP91lH0UQ9oslgF2djG1x+LV9z/qO19ggMKZaCB8pKIGePHAY91eLF4EAgpsxQk8MRSFGRPfPzw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@boundaries/elements": "2.0.1",
"chalk": "4.1.2",
"eslint-import-resolver-node": "0.3.9",
"eslint-module-utils": "2.12.1",
"handlebars": "4.7.9",
"micromatch": "4.0.8"
},
"engines": {
"node": ">=18.18"
},
"peerDependencies": {
"eslint": ">=6.0.0"
}
},
"node_modules/eslint-plugin-import-x": { "node_modules/eslint-plugin-import-x": {
"version": "4.16.1", "version": "4.16.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-import-x/-/eslint-plugin-import-x-4.16.1.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-import-x/-/eslint-plugin-import-x-4.16.1.tgz",
@@ -8669,27 +8519,6 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/globby": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
"integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==",
"dev": true,
"license": "MIT",
"dependencies": {
"array-union": "^2.1.0",
"dir-glob": "^3.0.1",
"fast-glob": "^3.2.9",
"ignore": "^5.2.0",
"merge2": "^1.4.1",
"slash": "^3.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/gopd": { "node_modules/gopd": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
@@ -8725,9 +8554,9 @@
} }
}, },
"node_modules/handlebars": { "node_modules/handlebars": {
"version": "4.7.9", "version": "4.7.8",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.9.tgz", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz",
"integrity": "sha512-4E71E0rpOaQuJR2A3xDZ+GM1HyWYv1clR58tC8emQNeQe3RH7MAzSbat+V0wG78LQBo6m6bzSG/L4pBuCsgnUQ==", "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -9617,29 +9446,6 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/is-bun-module": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-bun-module/-/is-bun-module-2.0.0.tgz",
"integrity": "sha512-gNCGbnnnnFAUGKeZ9PdbyeGYJqewpmc2aKHUEMO5nQPWU9lOmv7jcmQIv+qHD8fXW6W7qfuCwX4rY9LNRjXrkQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"semver": "^7.7.1"
}
},
"node_modules/is-bun-module/node_modules/semver": {
"version": "7.7.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz",
"integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==",
"dev": true,
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/is-callable": { "node_modules/is-callable": {
"version": "1.2.7", "version": "1.2.7",
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz",
@@ -12220,20 +12026,6 @@
"node": "^18.17.0 || >=20.5.0" "node": "^18.17.0 || >=20.5.0"
} }
}, },
"node_modules/mylas": {
"version": "2.1.14",
"resolved": "https://registry.npmjs.org/mylas/-/mylas-2.1.14.tgz",
"integrity": "sha512-BzQguy9W9NJgoVn2mRWzbFrFWWztGCcng2QI9+41frfk+Athwgx3qhqhvStz7ExeUUu7Kzw427sNzHpEZNINog==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=16.0.0"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/raouldeheer"
}
},
"node_modules/mz": { "node_modules/mz": {
"version": "2.7.0", "version": "2.7.0",
"resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz",
@@ -13197,16 +12989,6 @@
"integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/path-type": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
"integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/pathe": { "node_modules/pathe": {
"version": "2.0.3", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",
@@ -13269,19 +13051,6 @@
"pathe": "^2.0.3" "pathe": "^2.0.3"
} }
}, },
"node_modules/plimit-lit": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/plimit-lit/-/plimit-lit-1.6.1.tgz",
"integrity": "sha512-B7+VDyb8Tl6oMJT9oSO2CW8XC/T4UcJGrwOVoNGwOQsQYhlpfajmrMj5xeejqaASq3V/EqThyOeATEOMuSEXiA==",
"dev": true,
"license": "MIT",
"dependencies": {
"queue-lit": "^1.5.1"
},
"engines": {
"node": ">=12"
}
},
"node_modules/possible-typed-array-names": { "node_modules/possible-typed-array-names": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz",
@@ -13643,16 +13412,6 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/queue-lit": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/queue-lit/-/queue-lit-1.5.2.tgz",
"integrity": "sha512-tLc36IOPeMAubu8BkW8YDBV+WyIgKlYU7zUNs0J5Vk9skSZ4JfGlPOqplP0aHdfv7HL0B2Pg6nwiq60Qc6M2Hw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
}
},
"node_modules/queue-microtask": { "node_modules/queue-microtask": {
"version": "1.2.3", "version": "1.2.3",
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
@@ -15414,16 +15173,6 @@
"is-arrayish": "^0.3.1" "is-arrayish": "^0.3.1"
} }
}, },
"node_modules/slash": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
"integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/slice-ansi": { "node_modules/slice-ansi": {
"version": "8.0.0", "version": "8.0.0",
"resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-8.0.0.tgz", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-8.0.0.tgz",
@@ -16730,599 +16479,12 @@
"integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==",
"license": "Apache-2.0" "license": "Apache-2.0"
}, },
"node_modules/tsc-alias": {
"version": "1.8.16",
"resolved": "https://registry.npmjs.org/tsc-alias/-/tsc-alias-1.8.16.tgz",
"integrity": "sha512-QjCyu55NFyRSBAl6+MTFwplpFcnm2Pq01rR/uxfqJoLMm6X3O14KEGtaSDZpJYaE1bJBGDjD0eSuiIWPe2T58g==",
"dev": true,
"license": "MIT",
"dependencies": {
"chokidar": "^3.5.3",
"commander": "^9.0.0",
"get-tsconfig": "^4.10.0",
"globby": "^11.0.4",
"mylas": "^2.1.9",
"normalize-path": "^3.0.0",
"plimit-lit": "^1.2.6"
},
"bin": {
"tsc-alias": "dist/bin/index.js"
},
"engines": {
"node": ">=16.20.2"
}
},
"node_modules/tsc-alias/node_modules/chokidar": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
"dev": true,
"license": "MIT",
"dependencies": {
"anymatch": "~3.1.2",
"braces": "~3.0.2",
"glob-parent": "~5.1.2",
"is-binary-path": "~2.1.0",
"is-glob": "~4.0.1",
"normalize-path": "~3.0.0",
"readdirp": "~3.6.0"
},
"engines": {
"node": ">= 8.10.0"
},
"funding": {
"url": "https://paulmillr.com/funding/"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
}
},
"node_modules/tsc-alias/node_modules/commander": {
"version": "9.5.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": "^12.20.0 || >=14"
}
},
"node_modules/tsc-alias/node_modules/glob-parent": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
"dev": true,
"license": "ISC",
"dependencies": {
"is-glob": "^4.0.1"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/tsc-alias/node_modules/readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
"dev": true,
"license": "MIT",
"dependencies": {
"picomatch": "^2.2.1"
},
"engines": {
"node": ">=8.10.0"
}
},
"node_modules/tslib": { "node_modules/tslib": {
"version": "2.8.1", "version": "2.8.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"license": "0BSD" "license": "0BSD"
}, },
"node_modules/tsx": {
"version": "4.21.0",
"resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz",
"integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==",
"dev": true,
"license": "MIT",
"dependencies": {
"esbuild": "~0.27.0",
"get-tsconfig": "^4.7.5"
},
"bin": {
"tsx": "dist/cli.mjs"
},
"engines": {
"node": ">=18.0.0"
},
"optionalDependencies": {
"fsevents": "~2.3.3"
}
},
"node_modules/tsx/node_modules/@esbuild/aix-ppc64": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz",
"integrity": "sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==",
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"aix"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/android-arm": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.7.tgz",
"integrity": "sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/android-arm64": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.7.tgz",
"integrity": "sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/android-x64": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.7.tgz",
"integrity": "sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/darwin-arm64": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.7.tgz",
"integrity": "sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/darwin-x64": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.7.tgz",
"integrity": "sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/freebsd-arm64": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.7.tgz",
"integrity": "sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/freebsd-x64": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.7.tgz",
"integrity": "sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-arm": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.7.tgz",
"integrity": "sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-arm64": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.7.tgz",
"integrity": "sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-ia32": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.7.tgz",
"integrity": "sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-loong64": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.7.tgz",
"integrity": "sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==",
"cpu": [
"loong64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-mips64el": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.7.tgz",
"integrity": "sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==",
"cpu": [
"mips64el"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-ppc64": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.7.tgz",
"integrity": "sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==",
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-riscv64": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.7.tgz",
"integrity": "sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==",
"cpu": [
"riscv64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-s390x": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.7.tgz",
"integrity": "sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==",
"cpu": [
"s390x"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-x64": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.7.tgz",
"integrity": "sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/netbsd-arm64": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.7.tgz",
"integrity": "sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"netbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/netbsd-x64": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.7.tgz",
"integrity": "sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"netbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/openbsd-arm64": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.7.tgz",
"integrity": "sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/openbsd-x64": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.7.tgz",
"integrity": "sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/openharmony-arm64": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.7.tgz",
"integrity": "sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openharmony"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/sunos-x64": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.7.tgz",
"integrity": "sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"sunos"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/win32-arm64": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.7.tgz",
"integrity": "sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/win32-ia32": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.7.tgz",
"integrity": "sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/win32-x64": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.7.tgz",
"integrity": "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/esbuild": {
"version": "0.27.7",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.7.tgz",
"integrity": "sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"bin": {
"esbuild": "bin/esbuild"
},
"engines": {
"node": ">=18"
},
"optionalDependencies": {
"@esbuild/aix-ppc64": "0.27.7",
"@esbuild/android-arm": "0.27.7",
"@esbuild/android-arm64": "0.27.7",
"@esbuild/android-x64": "0.27.7",
"@esbuild/darwin-arm64": "0.27.7",
"@esbuild/darwin-x64": "0.27.7",
"@esbuild/freebsd-arm64": "0.27.7",
"@esbuild/freebsd-x64": "0.27.7",
"@esbuild/linux-arm": "0.27.7",
"@esbuild/linux-arm64": "0.27.7",
"@esbuild/linux-ia32": "0.27.7",
"@esbuild/linux-loong64": "0.27.7",
"@esbuild/linux-mips64el": "0.27.7",
"@esbuild/linux-ppc64": "0.27.7",
"@esbuild/linux-riscv64": "0.27.7",
"@esbuild/linux-s390x": "0.27.7",
"@esbuild/linux-x64": "0.27.7",
"@esbuild/netbsd-arm64": "0.27.7",
"@esbuild/netbsd-x64": "0.27.7",
"@esbuild/openbsd-arm64": "0.27.7",
"@esbuild/openbsd-x64": "0.27.7",
"@esbuild/openharmony-arm64": "0.27.7",
"@esbuild/sunos-x64": "0.27.7",
"@esbuild/win32-arm64": "0.27.7",
"@esbuild/win32-ia32": "0.27.7",
"@esbuild/win32-x64": "0.27.7"
}
},
"node_modules/tunnel-agent": { "node_modules/tunnel-agent": {
"version": "0.6.0", "version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",

View File

@@ -1,17 +1,16 @@
{ {
"name": "@cloudcli-ai/cloudcli", "name": "@cloudcli-ai/cloudcli",
"version": "1.29.3", "version": "1.29.2",
"description": "A web-based UI for Claude Code CLI", "description": "A web-based UI for Claude Code CLI",
"type": "module", "type": "module",
"main": "dist-server/server/index.js", "main": "server/index.js",
"bin": { "bin": {
"cloudcli": "dist-server/server/cli.js" "cloudcli": "server/cli.js"
}, },
"files": [ "files": [
"server/", "server/",
"shared/", "shared/",
"dist/", "dist/",
"dist-server/",
"scripts/", "scripts/",
"README.md" "README.md"
], ],
@@ -24,19 +23,14 @@
"url": "https://github.com/siteboon/claudecodeui/issues" "url": "https://github.com/siteboon/claudecodeui/issues"
}, },
"scripts": { "scripts": {
"dev": "concurrently --kill-others \"npm run server:dev\" \"npm run client\"", "dev": "concurrently --kill-others \"npm run server\" \"npm run client\"",
"server": "node dist-server/server/index.js", "server": "node server/index.js",
"server:dev": "tsx --tsconfig server/tsconfig.json server/index.js",
"server:dev-watch": "tsx watch --tsconfig server/tsconfig.json server/index.js",
"client": "vite", "client": "vite",
"build": "npm run build:client && npm run build:server", "build": "vite build",
"build:client": "vite build",
"prebuild:server": "node -e \"require('node:fs').rmSync('dist-server', { recursive: true, force: true })\"",
"build:server": "tsc -p server/tsconfig.json && tsc-alias -p server/tsconfig.json",
"preview": "vite preview", "preview": "vite preview",
"typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p server/tsconfig.json", "typecheck": "tsc --noEmit -p tsconfig.json",
"lint": "eslint src/ server/", "lint": "eslint src/",
"lint:fix": "eslint src/ server/ --fix", "lint:fix": "eslint src/ --fix",
"start": "npm run build && npm run server", "start": "npm run build && npm run server",
"release": "./release.sh", "release": "./release.sh",
"prepublishOnly": "npm run build", "prepublishOnly": "npm run build",
@@ -136,8 +130,6 @@
"autoprefixer": "^10.4.16", "autoprefixer": "^10.4.16",
"concurrently": "^8.2.2", "concurrently": "^8.2.2",
"eslint": "^9.39.3", "eslint": "^9.39.3",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-boundaries": "^6.0.2",
"eslint-plugin-import-x": "^4.16.1", "eslint-plugin-import-x": "^4.16.1",
"eslint-plugin-react": "^7.37.5", "eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^7.0.1", "eslint-plugin-react-hooks": "^7.0.1",
@@ -152,14 +144,11 @@
"release-it": "^19.0.5", "release-it": "^19.0.5",
"sharp": "^0.34.2", "sharp": "^0.34.2",
"tailwindcss": "^3.4.0", "tailwindcss": "^3.4.0",
"tsc-alias": "^1.8.16",
"tsx": "^4.21.0",
"typescript": "^5.9.3", "typescript": "^5.9.3",
"typescript-eslint": "^8.56.1", "typescript-eslint": "^8.56.1",
"vite": "^7.0.4" "vite": "^7.0.4"
}, },
"lint-staged": { "lint-staged": {
"src/**/*.{ts,tsx,js,jsx}": "eslint", "src/**/*.{ts,tsx,js,jsx}": "eslint"
"server/**/*.{js,ts}": "eslint"
} }
} }

View File

@@ -1,2 +1,2 @@
#!/usr/bin/env node #!/usr/bin/env node
import('@cloudcli-ai/cloudcli/dist-server/server/cli.js'); import('@cloudcli-ai/cloudcli/server/cli.js');

View File

@@ -16,12 +16,11 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import os from 'os'; import os from 'os';
import { findAppRoot, getModuleDir } from './utils/runtime-paths.js'; import { fileURLToPath } from 'url';
import { dirname } from 'path';
const __dirname = getModuleDir(import.meta.url); const __filename = fileURLToPath(import.meta.url);
// The CLI is compiled into dist-server/server, but it still needs to read the top-level const __dirname = dirname(__filename);
// package.json and .env file. Resolving the app root once keeps those lookups stable.
const APP_ROOT = findAppRoot(__dirname);
// ANSI color codes for terminal output // ANSI color codes for terminal output
const colors = { const colors = {
@@ -51,16 +50,13 @@ const c = {
}; };
// Load package.json for version info // Load package.json for version info
const packageJsonPath = path.join(APP_ROOT, 'package.json'); const packageJsonPath = path.join(__dirname, '../package.json');
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')); const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
// Match the runtime fallback in load-env.js so "cloudcli status" reports the same default
// database location that the backend will actually use when no DATABASE_PATH is configured.
const DEFAULT_DATABASE_PATH = path.join(os.homedir(), '.cloudcli', 'auth.db');
// Load environment variables from .env file if it exists // Load environment variables from .env file if it exists
function loadEnvFile() { function loadEnvFile() {
try { try {
const envPath = path.join(APP_ROOT, '.env'); const envPath = path.join(__dirname, '../.env');
const envFile = fs.readFileSync(envPath, 'utf8'); const envFile = fs.readFileSync(envPath, 'utf8');
envFile.split('\n').forEach(line => { envFile.split('\n').forEach(line => {
const trimmedLine = line.trim(); const trimmedLine = line.trim();
@@ -79,12 +75,12 @@ function loadEnvFile() {
// Get the database path (same logic as db.js) // Get the database path (same logic as db.js)
function getDatabasePath() { function getDatabasePath() {
loadEnvFile(); loadEnvFile();
return process.env.DATABASE_PATH || DEFAULT_DATABASE_PATH; return process.env.DATABASE_PATH || path.join(__dirname, 'database', 'auth.db');
} }
// Get the installation directory // Get the installation directory
function getInstallDir() { function getInstallDir() {
return APP_ROOT; return path.join(__dirname, '..');
} }
// Show status command // Show status command
@@ -128,7 +124,7 @@ function showStatus() {
console.log(` Status: ${projectsExists ? c.ok('[OK] Exists') : c.warn('[WARN] Not found')}`); console.log(` Status: ${projectsExists ? c.ok('[OK] Exists') : c.warn('[WARN] Not found')}`);
// Config file location // Config file location
const envFilePath = path.join(APP_ROOT, '.env'); const envFilePath = path.join(__dirname, '../.env');
const envExists = fs.existsSync(envFilePath); const envExists = fs.existsSync(envFilePath);
console.log(`\n${c.info('[INFO]')} Configuration File:`); console.log(`\n${c.info('[INFO]')} Configuration File:`);
console.log(` ${c.dim(envFilePath)}`); console.log(` ${c.dim(envFilePath)}`);

View File

@@ -1,12 +1,8 @@
import { spawn } from 'child_process'; import { spawn } from 'cross-spawn';
import crossSpawn from 'cross-spawn';
import { notifyRunFailed, notifyRunStopped } from './services/notification-orchestrator.js'; import { notifyRunFailed, notifyRunStopped } from './services/notification-orchestrator.js';
import { cursorAdapter } from './providers/cursor/adapter.js'; import { cursorAdapter } from './providers/cursor/adapter.js';
import { createNormalizedMessage } from './providers/types.js'; import { createNormalizedMessage } from './providers/types.js';
// Use cross-spawn on Windows for better command execution
const spawnFunction = process.platform === 'win32' ? crossSpawn : spawn;
let activeCursorProcesses = new Map(); // Track active processes by session ID let activeCursorProcesses = new Map(); // Track active processes by session ID
const WORKSPACE_TRUST_PATTERNS = [ const WORKSPACE_TRUST_PATTERNS = [
@@ -122,7 +118,7 @@ async function spawnCursor(command, options = {}, ws) {
console.log('Working directory:', workingDir); console.log('Working directory:', workingDir);
console.log('Session info - Input sessionId:', sessionId, 'Resume:', resume); console.log('Session info - Input sessionId:', sessionId, 'Resume:', resume);
const cursorProcess = spawnFunction('cursor-agent', args, { const cursorProcess = spawn('cursor-agent', args, {
cwd: workingDir, cwd: workingDir,
stdio: ['pipe', 'pipe', 'pipe'], stdio: ['pipe', 'pipe', 'pipe'],
env: { ...process.env } // Inherit all environment variables env: { ...process.env } // Inherit all environment variables

View File

@@ -2,21 +2,11 @@ import Database from 'better-sqlite3';
import path from 'path'; import path from 'path';
import fs from 'fs'; import fs from 'fs';
import crypto from 'crypto'; import crypto from 'crypto';
import { findAppRoot, getModuleDir } from '../utils/runtime-paths.js'; import { fileURLToPath } from 'url';
import { import { dirname } from 'path';
APP_CONFIG_TABLE_SQL,
USER_NOTIFICATION_PREFERENCES_TABLE_SQL,
VAPID_KEYS_TABLE_SQL,
PUSH_SUBSCRIPTIONS_TABLE_SQL,
SESSION_NAMES_TABLE_SQL,
SESSION_NAMES_LOOKUP_INDEX_SQL,
DATABASE_SCHEMA_SQL
} from './schema.js';
const __dirname = getModuleDir(import.meta.url); const __filename = fileURLToPath(import.meta.url);
// The compiled backend lives under dist-server/server/database, but the install root we log const __dirname = dirname(__filename);
// should still point at the project/app root. Resolving it here avoids build-layout drift.
const APP_ROOT = findAppRoot(__dirname);
// ANSI color codes for terminal output // ANSI color codes for terminal output
const colors = { const colors = {
@@ -34,6 +24,7 @@ const c = {
// Use DATABASE_PATH environment variable if set, otherwise use default location // Use DATABASE_PATH environment variable if set, otherwise use default location
const DB_PATH = process.env.DATABASE_PATH || path.join(__dirname, 'auth.db'); const DB_PATH = process.env.DATABASE_PATH || path.join(__dirname, 'auth.db');
const INIT_SQL_PATH = path.join(__dirname, 'init.sql');
// Ensure database directory exists if custom path is provided // Ensure database directory exists if custom path is provided
if (process.env.DATABASE_PATH) { if (process.env.DATABASE_PATH) {
@@ -71,10 +62,14 @@ const db = new Database(DB_PATH);
// app_config must exist before any other module imports (auth.js reads the JWT secret at load time). // app_config must exist before any other module imports (auth.js reads the JWT secret at load time).
// runMigrations() also creates this table, but it runs too late for existing installations // runMigrations() also creates this table, but it runs too late for existing installations
// where auth.js is imported before initializeDatabase() is called. // where auth.js is imported before initializeDatabase() is called.
db.exec(APP_CONFIG_TABLE_SQL); db.exec(`CREATE TABLE IF NOT EXISTS app_config (
key TEXT PRIMARY KEY,
value TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
)`);
// Show app installation path prominently // Show app installation path prominently
const appInstallPath = APP_ROOT; const appInstallPath = path.join(__dirname, '../..');
console.log(''); console.log('');
console.log(c.dim('═'.repeat(60))); console.log(c.dim('═'.repeat(60)));
console.log(`${c.info('[INFO]')} App Installation: ${c.bright(appInstallPath)}`); console.log(`${c.info('[INFO]')} App Installation: ${c.bright(appInstallPath)}`);
@@ -105,12 +100,53 @@ const runMigrations = () => {
db.exec('ALTER TABLE users ADD COLUMN has_completed_onboarding BOOLEAN DEFAULT 0'); db.exec('ALTER TABLE users ADD COLUMN has_completed_onboarding BOOLEAN DEFAULT 0');
} }
db.exec(USER_NOTIFICATION_PREFERENCES_TABLE_SQL); db.exec(`
db.exec(VAPID_KEYS_TABLE_SQL); CREATE TABLE IF NOT EXISTS user_notification_preferences (
db.exec(PUSH_SUBSCRIPTIONS_TABLE_SQL); user_id INTEGER PRIMARY KEY,
db.exec(APP_CONFIG_TABLE_SQL); preferences_json TEXT NOT NULL,
db.exec(SESSION_NAMES_TABLE_SQL); updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
db.exec(SESSION_NAMES_LOOKUP_INDEX_SQL); FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
)
`);
db.exec(`
CREATE TABLE IF NOT EXISTS vapid_keys (
id INTEGER PRIMARY KEY AUTOINCREMENT,
public_key TEXT NOT NULL,
private_key TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
)
`);
db.exec(`
CREATE TABLE IF NOT EXISTS push_subscriptions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL,
endpoint TEXT NOT NULL UNIQUE,
keys_p256dh TEXT NOT NULL,
keys_auth TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
)
`);
// Create app_config table if it doesn't exist (for existing installations)
db.exec(`CREATE TABLE IF NOT EXISTS app_config (
key TEXT PRIMARY KEY,
value TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
)`);
// Create session_names table if it doesn't exist (for existing installations)
db.exec(`CREATE TABLE IF NOT EXISTS session_names (
id INTEGER PRIMARY KEY AUTOINCREMENT,
session_id TEXT NOT NULL,
provider TEXT NOT NULL DEFAULT 'claude',
custom_name TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
UNIQUE(session_id, provider)
)`);
db.exec('CREATE INDEX IF NOT EXISTS idx_session_names_lookup ON session_names(session_id, provider)');
console.log('Database migrations completed successfully'); console.log('Database migrations completed successfully');
} catch (error) { } catch (error) {
@@ -122,7 +158,8 @@ const runMigrations = () => {
// Initialize database with schema // Initialize database with schema
const initializeDatabase = async () => { const initializeDatabase = async () => {
try { try {
db.exec(DATABASE_SCHEMA_SQL); const initSQL = fs.readFileSync(INIT_SQL_PATH, 'utf8');
db.exec(initSQL);
console.log('Database initialized successfully'); console.log('Database initialized successfully');
runMigrations(); runMigrations();
} catch (error) { } catch (error) {

99
server/database/init.sql Normal file
View File

@@ -0,0 +1,99 @@
-- Initialize authentication database
PRAGMA foreign_keys = ON;
-- Users table (single user system)
CREATE TABLE IF NOT EXISTS users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT UNIQUE NOT NULL,
password_hash TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
last_login DATETIME,
is_active BOOLEAN DEFAULT 1,
git_name TEXT,
git_email TEXT,
has_completed_onboarding BOOLEAN DEFAULT 0
);
-- Indexes for performance
CREATE INDEX IF NOT EXISTS idx_users_username ON users(username);
CREATE INDEX IF NOT EXISTS idx_users_active ON users(is_active);
-- API Keys table for external API access
CREATE TABLE IF NOT EXISTS api_keys (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL,
key_name TEXT NOT NULL,
api_key TEXT UNIQUE NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
last_used DATETIME,
is_active BOOLEAN DEFAULT 1,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);
CREATE INDEX IF NOT EXISTS idx_api_keys_key ON api_keys(api_key);
CREATE INDEX IF NOT EXISTS idx_api_keys_user_id ON api_keys(user_id);
CREATE INDEX IF NOT EXISTS idx_api_keys_active ON api_keys(is_active);
-- User credentials table for storing various tokens/credentials (GitHub, GitLab, etc.)
CREATE TABLE IF NOT EXISTS user_credentials (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL,
credential_name TEXT NOT NULL,
credential_type TEXT NOT NULL, -- 'github_token', 'gitlab_token', 'bitbucket_token', etc.
credential_value TEXT NOT NULL,
description TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
is_active BOOLEAN DEFAULT 1,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);
CREATE INDEX IF NOT EXISTS idx_user_credentials_user_id ON user_credentials(user_id);
CREATE INDEX IF NOT EXISTS idx_user_credentials_type ON user_credentials(credential_type);
CREATE INDEX IF NOT EXISTS idx_user_credentials_active ON user_credentials(is_active);
-- User notification preferences (backend-owned, provider-agnostic)
CREATE TABLE IF NOT EXISTS user_notification_preferences (
user_id INTEGER PRIMARY KEY,
preferences_json TEXT NOT NULL,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);
-- VAPID key pair for Web Push notifications
CREATE TABLE IF NOT EXISTS vapid_keys (
id INTEGER PRIMARY KEY AUTOINCREMENT,
public_key TEXT NOT NULL,
private_key TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
-- Browser push subscriptions
CREATE TABLE IF NOT EXISTS push_subscriptions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL,
endpoint TEXT NOT NULL UNIQUE,
keys_p256dh TEXT NOT NULL,
keys_auth TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);
-- Session custom names (provider-agnostic display name overrides)
CREATE TABLE IF NOT EXISTS session_names (
id INTEGER PRIMARY KEY AUTOINCREMENT,
session_id TEXT NOT NULL,
provider TEXT NOT NULL DEFAULT 'claude',
custom_name TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
UNIQUE(session_id, provider)
);
CREATE INDEX IF NOT EXISTS idx_session_names_lookup ON session_names(session_id, provider);
-- App configuration table (auto-generated secrets, settings, etc.)
CREATE TABLE IF NOT EXISTS app_config (
key TEXT PRIMARY KEY,
value TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);

View File

@@ -1,102 +0,0 @@
export const APP_CONFIG_TABLE_SQL = `CREATE TABLE IF NOT EXISTS app_config (
key TEXT PRIMARY KEY,
value TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);`;
export const USER_NOTIFICATION_PREFERENCES_TABLE_SQL = `CREATE TABLE IF NOT EXISTS user_notification_preferences (
user_id INTEGER PRIMARY KEY,
preferences_json TEXT NOT NULL,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);`;
export const VAPID_KEYS_TABLE_SQL = `CREATE TABLE IF NOT EXISTS vapid_keys (
id INTEGER PRIMARY KEY AUTOINCREMENT,
public_key TEXT NOT NULL,
private_key TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);`;
export const PUSH_SUBSCRIPTIONS_TABLE_SQL = `CREATE TABLE IF NOT EXISTS push_subscriptions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL,
endpoint TEXT NOT NULL UNIQUE,
keys_p256dh TEXT NOT NULL,
keys_auth TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);`;
export const SESSION_NAMES_TABLE_SQL = `CREATE TABLE IF NOT EXISTS session_names (
id INTEGER PRIMARY KEY AUTOINCREMENT,
session_id TEXT NOT NULL,
provider TEXT NOT NULL DEFAULT 'claude',
custom_name TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
UNIQUE(session_id, provider)
);`;
export const SESSION_NAMES_LOOKUP_INDEX_SQL = `CREATE INDEX IF NOT EXISTS idx_session_names_lookup ON session_names(session_id, provider);`;
export const DATABASE_SCHEMA_SQL = `PRAGMA foreign_keys = ON;
CREATE TABLE IF NOT EXISTS users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT UNIQUE NOT NULL,
password_hash TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
last_login DATETIME,
is_active BOOLEAN DEFAULT 1,
git_name TEXT,
git_email TEXT,
has_completed_onboarding BOOLEAN DEFAULT 0
);
CREATE INDEX IF NOT EXISTS idx_users_username ON users(username);
CREATE INDEX IF NOT EXISTS idx_users_active ON users(is_active);
CREATE TABLE IF NOT EXISTS api_keys (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL,
key_name TEXT NOT NULL,
api_key TEXT UNIQUE NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
last_used DATETIME,
is_active BOOLEAN DEFAULT 1,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);
CREATE INDEX IF NOT EXISTS idx_api_keys_key ON api_keys(api_key);
CREATE INDEX IF NOT EXISTS idx_api_keys_user_id ON api_keys(user_id);
CREATE INDEX IF NOT EXISTS idx_api_keys_active ON api_keys(is_active);
CREATE TABLE IF NOT EXISTS user_credentials (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL,
credential_name TEXT NOT NULL,
credential_type TEXT NOT NULL,
credential_value TEXT NOT NULL,
description TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
is_active BOOLEAN DEFAULT 1,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);
CREATE INDEX IF NOT EXISTS idx_user_credentials_user_id ON user_credentials(user_id);
CREATE INDEX IF NOT EXISTS idx_user_credentials_type ON user_credentials(credential_type);
CREATE INDEX IF NOT EXISTS idx_user_credentials_active ON user_credentials(is_active);
${USER_NOTIFICATION_PREFERENCES_TABLE_SQL}
${VAPID_KEYS_TABLE_SQL}
${PUSH_SUBSCRIPTIONS_TABLE_SQL}
${SESSION_NAMES_TABLE_SQL}
${SESSION_NAMES_LOOKUP_INDEX_SQL}
${APP_CONFIG_TABLE_SQL}
`;

View File

@@ -1,8 +1,4 @@
import { spawn } from 'child_process'; import { spawn } from 'cross-spawn';
import crossSpawn from 'cross-spawn';
// Use cross-spawn on Windows for correct .cmd resolution (same pattern as cursor-cli.js)
const spawnFunction = process.platform === 'win32' ? crossSpawn : spawn;
import { promises as fs } from 'fs'; import { promises as fs } from 'fs';
import path from 'path'; import path from 'path';
import os from 'os'; import os from 'os';
@@ -168,7 +164,7 @@ async function spawnGemini(command, options = {}, ws) {
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const geminiProcess = spawnFunction(spawnCmd, spawnArgs, { const geminiProcess = spawn(spawnCmd, spawnArgs, {
cwd: workingDir, cwd: workingDir,
stdio: ['pipe', 'pipe', 'pipe'], stdio: ['pipe', 'pipe', 'pipe'],
env: { ...process.env } // Inherit all environment variables env: { ...process.env } // Inherit all environment variables

View File

@@ -3,13 +3,13 @@
import './load-env.js'; import './load-env.js';
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import { findAppRoot, getModuleDir } from './utils/runtime-paths.js'; import { fileURLToPath } from 'url';
import { dirname } from 'path';
const __dirname = getModuleDir(import.meta.url); const __filename = fileURLToPath(import.meta.url);
// The server source runs from /server, while the compiled output runs from /dist-server/server. const __dirname = dirname(__filename);
// Resolving the app root once keeps every repo-level lookup below aligned across both layouts.
const APP_ROOT = findAppRoot(__dirname); const installMode = fs.existsSync(path.join(__dirname, '..', '.git')) ? 'git' : 'npm';
const installMode = fs.existsSync(path.join(APP_ROOT, '.git')) ? 'git' : 'npm';
// ANSI color codes for terminal output // ANSI color codes for terminal output
const colors = { const colors = {
@@ -39,7 +39,7 @@ import os from 'os';
import http from 'http'; import http from 'http';
import cors from 'cors'; import cors from 'cors';
import { promises as fsPromises } from 'fs'; import { promises as fsPromises } from 'fs';
import { spawn } from 'child_process'; import { spawn } from 'cross-spawn';
import pty from 'node-pty'; import pty from 'node-pty';
import fetch from 'node-fetch'; import fetch from 'node-fetch';
import mime from 'mime-types'; import mime from 'mime-types';
@@ -405,11 +405,11 @@ app.use('/api/sessions', authenticateToken, messagesRoutes);
app.use('/api/agent', agentRoutes); app.use('/api/agent', agentRoutes);
// Serve public files (like api-docs.html) // Serve public files (like api-docs.html)
app.use(express.static(path.join(APP_ROOT, 'public'))); app.use(express.static(path.join(__dirname, '../public')));
// Static files served after API routes // Static files served after API routes
// Add cache control: HTML files should not be cached, but assets can be cached // Add cache control: HTML files should not be cached, but assets can be cached
app.use(express.static(path.join(APP_ROOT, 'dist'), { app.use(express.static(path.join(__dirname, '../dist'), {
setHeaders: (res, filePath) => { setHeaders: (res, filePath) => {
if (filePath.endsWith('.html')) { if (filePath.endsWith('.html')) {
// Prevent HTML caching to avoid service worker issues after builds // Prevent HTML caching to avoid service worker issues after builds
@@ -431,7 +431,7 @@ app.use(express.static(path.join(APP_ROOT, 'dist'), {
app.post('/api/system/update', authenticateToken, async (req, res) => { app.post('/api/system/update', authenticateToken, async (req, res) => {
try { try {
// Get the project root directory (parent of server directory) // Get the project root directory (parent of server directory)
const projectRoot = APP_ROOT; const projectRoot = path.join(__dirname, '..');
console.log('Starting system update from directory:', projectRoot); console.log('Starting system update from directory:', projectRoot);
@@ -2273,7 +2273,7 @@ app.get('*', (req, res) => {
// Only serve index.html for HTML routes, not for static assets // Only serve index.html for HTML routes, not for static assets
// Static assets should already be handled by express.static middleware above // Static assets should already be handled by express.static middleware above
const indexPath = path.join(APP_ROOT, 'dist', 'index.html'); const indexPath = path.join(__dirname, '../dist/index.html');
// Check if dist/index.html exists (production build available) // Check if dist/index.html exists (production build available)
if (fs.existsSync(indexPath)) { if (fs.existsSync(indexPath)) {
@@ -2388,7 +2388,7 @@ async function startServer() {
configureWebPush(); configureWebPush();
// Check if running in production mode (dist folder exists) // Check if running in production mode (dist folder exists)
const distIndexPath = path.join(APP_ROOT, 'dist', 'index.html'); const distIndexPath = path.join(__dirname, '../dist/index.html');
const isProduction = fs.existsSync(distIndexPath); const isProduction = fs.existsSync(distIndexPath);
// Log Claude implementation mode // Log Claude implementation mode
@@ -2402,7 +2402,7 @@ async function startServer() {
console.log(`${c.info('[INFO]')} To run in development mode with hot-module replacement, go to http://${DISPLAY_HOST}:${VITE_PORT}`); console.log(`${c.info('[INFO]')} To run in development mode with hot-module replacement, go to http://${DISPLAY_HOST}:${VITE_PORT}`);
server.listen(SERVER_PORT, HOST, async () => { server.listen(SERVER_PORT, HOST, async () => {
const appInstallPath = APP_ROOT; const appInstallPath = path.join(__dirname, '..');
console.log(''); console.log('');
console.log(c.dim('═'.repeat(63))); console.log(c.dim('═'.repeat(63)));

View File

@@ -2,15 +2,14 @@
import fs from 'fs'; import fs from 'fs';
import os from 'os'; import os from 'os';
import path from 'path'; import path from 'path';
import { findAppRoot, getModuleDir } from './utils/runtime-paths.js'; import { fileURLToPath } from 'url';
import { dirname } from 'path';
const __dirname = getModuleDir(import.meta.url); const __filename = fileURLToPath(import.meta.url);
// Resolve the repo/app root via the nearest /server folder so this file keeps finding the const __dirname = dirname(__filename);
// same top-level .env file from both /server/load-env.js and /dist-server/server/load-env.js.
const APP_ROOT = findAppRoot(__dirname);
try { try {
const envPath = path.join(APP_ROOT, '.env'); const envPath = path.join(__dirname, '../.env');
const envFile = fs.readFileSync(envPath, 'utf8'); const envFile = fs.readFileSync(envPath, 'utf8');
envFile.split('\n').forEach(line => { envFile.split('\n').forEach(line => {
const trimmedLine = line.trim(); const trimmedLine = line.trim();
@@ -25,10 +24,6 @@ try {
console.log('No .env file found or error reading it:', e.message); console.log('No .env file found or error reading it:', e.message);
} }
// Keep the default database in a stable user-level location so rebuilding dist-server
// never changes where the backend stores auth.db when DATABASE_PATH is not set explicitly.
const DEFAULT_DATABASE_PATH = path.join(os.homedir(), '.cloudcli', 'auth.db');
if (!process.env.DATABASE_PATH) { if (!process.env.DATABASE_PATH) {
process.env.DATABASE_PATH = DEFAULT_DATABASE_PATH; process.env.DATABASE_PATH = path.join(os.homedir(), '.cloudcli', 'auth.db');
} }

View File

@@ -1,5 +1,5 @@
import express from 'express'; import express from 'express';
import { spawn } from 'child_process'; import { spawn } from 'cross-spawn';
import path from 'path'; import path from 'path';
import os from 'os'; import os from 'os';
import { promises as fs } from 'fs'; import { promises as fs } from 'fs';

View File

@@ -1,5 +1,5 @@
import express from 'express'; import express from 'express';
import { spawn } from 'child_process'; import { spawn } from 'cross-spawn';
import fs from 'fs/promises'; import fs from 'fs/promises';
import path from 'path'; import path from 'path';
import os from 'os'; import os from 'os';

View File

@@ -1,5 +1,5 @@
import express from 'express'; import express from 'express';
import { spawn } from 'child_process'; import { spawn } from 'cross-spawn';
import { promises as fs } from 'fs'; import { promises as fs } from 'fs';
import path from 'path'; import path from 'path';
import os from 'os'; import os from 'os';

View File

@@ -1,15 +1,13 @@
import express from 'express'; import express from 'express';
import { promises as fs } from 'fs'; import { promises as fs } from 'fs';
import path from 'path'; import path from 'path';
import { fileURLToPath } from 'url';
import os from 'os'; import os from 'os';
import { CLAUDE_MODELS, CURSOR_MODELS, CODEX_MODELS } from '../../shared/modelConstants.js'; import { CLAUDE_MODELS, CURSOR_MODELS, CODEX_MODELS } from '../../shared/modelConstants.js';
import { parseFrontmatter } from '../utils/frontmatter.js'; import { parseFrontmatter } from '../utils/frontmatter.js';
import { findAppRoot, getModuleDir } from '../utils/runtime-paths.js';
const __dirname = getModuleDir(import.meta.url); const __filename = fileURLToPath(import.meta.url);
// This route reads the top-level package.json for the status command, so it needs the real const __dirname = path.dirname(__filename);
// app root even after compilation moves the route file under dist-server/server/routes.
const APP_ROOT = findAppRoot(__dirname);
const router = express.Router(); const router = express.Router();
@@ -293,7 +291,7 @@ Custom commands can be created in:
'/status': async (args, context) => { '/status': async (args, context) => {
// Read version from package.json // Read version from package.json
const packageJsonPath = path.join(APP_ROOT, 'package.json'); const packageJsonPath = path.join(path.dirname(__dirname), '..', 'package.json');
let version = 'unknown'; let version = 'unknown';
let packageName = 'claude-code-ui'; let packageName = 'claude-code-ui';

View File

@@ -2,6 +2,7 @@ import express from 'express';
import { promises as fs } from 'fs'; import { promises as fs } from 'fs';
import path from 'path'; import path from 'path';
import os from 'os'; import os from 'os';
import { spawn } from 'cross-spawn';
import sqlite3 from 'sqlite3'; import sqlite3 from 'sqlite3';
import { open } from 'sqlite'; import { open } from 'sqlite';
import crypto from 'crypto'; import crypto from 'crypto';
@@ -577,4 +578,221 @@ router.get('/sessions', async (req, res) => {
}); });
} }
}); });
// GET /api/cursor/sessions/:sessionId - Get specific Cursor session from SQLite
router.get('/sessions/:sessionId', async (req, res) => {
try {
const { sessionId } = req.params;
const { projectPath } = req.query;
// Calculate cwdID hash for the project path
const cwdId = crypto.createHash('md5').update(projectPath || process.cwd()).digest('hex');
const storeDbPath = path.join(os.homedir(), '.cursor', 'chats', cwdId, sessionId, 'store.db');
// Open SQLite database
const db = await open({
filename: storeDbPath,
driver: sqlite3.Database,
mode: sqlite3.OPEN_READONLY
});
// Get all blobs to build the DAG structure
const allBlobs = await db.all(`
SELECT rowid, id, data FROM blobs
`);
// Build the DAG structure from parent-child relationships
const blobMap = new Map(); // id -> blob data
const parentRefs = new Map(); // blob id -> [parent blob ids]
const childRefs = new Map(); // blob id -> [child blob ids]
const jsonBlobs = []; // Clean JSON messages
for (const blob of allBlobs) {
blobMap.set(blob.id, blob);
// Check if this is a JSON blob (actual message) or protobuf (DAG structure)
if (blob.data && blob.data[0] === 0x7B) { // Starts with '{' - JSON blob
try {
const parsed = JSON.parse(blob.data.toString('utf8'));
jsonBlobs.push({ ...blob, parsed });
} catch (e) {
console.log('Failed to parse JSON blob:', blob.rowid);
}
} else if (blob.data) { // Protobuf blob - extract parent references
const parents = [];
let i = 0;
// Scan for parent references (0x0A 0x20 followed by 32-byte hash)
while (i < blob.data.length - 33) {
if (blob.data[i] === 0x0A && blob.data[i+1] === 0x20) {
const parentHash = blob.data.slice(i+2, i+34).toString('hex');
if (blobMap.has(parentHash)) {
parents.push(parentHash);
}
i += 34;
} else {
i++;
}
}
if (parents.length > 0) {
parentRefs.set(blob.id, parents);
// Update child references
for (const parentId of parents) {
if (!childRefs.has(parentId)) {
childRefs.set(parentId, []);
}
childRefs.get(parentId).push(blob.id);
}
}
}
}
// Perform topological sort to get chronological order
const visited = new Set();
const sorted = [];
// DFS-based topological sort
function visit(nodeId) {
if (visited.has(nodeId)) return;
visited.add(nodeId);
// Visit all parents first (dependencies)
const parents = parentRefs.get(nodeId) || [];
for (const parentId of parents) {
visit(parentId);
}
// Add this node after all its parents
const blob = blobMap.get(nodeId);
if (blob) {
sorted.push(blob);
}
}
// Start with nodes that have no parents (roots)
for (const blob of allBlobs) {
if (!parentRefs.has(blob.id)) {
visit(blob.id);
}
}
// Visit any remaining nodes (disconnected components)
for (const blob of allBlobs) {
visit(blob.id);
}
// Now extract JSON messages in the order they appear in the sorted DAG
const messageOrder = new Map(); // JSON blob id -> order index
let orderIndex = 0;
for (const blob of sorted) {
// Check if this blob references any JSON messages
if (blob.data && blob.data[0] !== 0x7B) { // Protobuf blob
// Look for JSON blob references
for (const jsonBlob of jsonBlobs) {
try {
const jsonIdBytes = Buffer.from(jsonBlob.id, 'hex');
if (blob.data.includes(jsonIdBytes)) {
if (!messageOrder.has(jsonBlob.id)) {
messageOrder.set(jsonBlob.id, orderIndex++);
}
}
} catch (e) {
// Skip if can't convert ID
}
}
}
}
// Sort JSON blobs by their appearance order in the DAG
const sortedJsonBlobs = jsonBlobs.sort((a, b) => {
const orderA = messageOrder.get(a.id) ?? Number.MAX_SAFE_INTEGER;
const orderB = messageOrder.get(b.id) ?? Number.MAX_SAFE_INTEGER;
if (orderA !== orderB) return orderA - orderB;
// Fallback to rowid if not in order map
return a.rowid - b.rowid;
});
// Use sorted JSON blobs
const blobs = sortedJsonBlobs.map((blob, idx) => ({
...blob,
sequence_num: idx + 1,
original_rowid: blob.rowid
}));
// Get metadata from meta table
const metaRows = await db.all(`
SELECT key, value FROM meta
`);
// Parse metadata
let metadata = {};
for (const row of metaRows) {
if (row.value) {
try {
// Try to decode as hex-encoded JSON
const hexMatch = row.value.toString().match(/^[0-9a-fA-F]+$/);
if (hexMatch) {
const jsonStr = Buffer.from(row.value, 'hex').toString('utf8');
metadata[row.key] = JSON.parse(jsonStr);
} else {
metadata[row.key] = row.value.toString();
}
} catch (e) {
metadata[row.key] = row.value.toString();
}
}
}
// Extract messages from sorted JSON blobs
const messages = [];
for (const blob of blobs) {
try {
// We already parsed JSON blobs earlier
const parsed = blob.parsed;
if (parsed) {
// Filter out ONLY system messages at the server level
// Check both direct role and nested message.role
const role = parsed?.role || parsed?.message?.role;
if (role === 'system') {
continue; // Skip only system messages
}
messages.push({
id: blob.id,
sequence: blob.sequence_num,
rowid: blob.original_rowid,
content: parsed
});
}
} catch (e) {
// Skip blobs that cause errors
console.log(`Skipping blob ${blob.id}: ${e.message}`);
}
}
await db.close();
res.json({
success: true,
session: {
id: sessionId,
projectPath: projectPath,
messages: messages,
metadata: metadata,
cwdId: cwdId
}
});
} catch (error) {
console.error('Error reading Cursor session:', error);
res.status(500).json({
error: 'Failed to read Cursor session',
details: error.message
});
}
});
export default router; export default router;

View File

@@ -1,5 +1,5 @@
import express from 'express'; import express from 'express';
import { spawn } from 'child_process'; import { spawn } from 'cross-spawn';
import path from 'path'; import path from 'path';
import { promises as fs } from 'fs'; import { promises as fs } from 'fs';
import { extractProjectDirectory } from '../projects.js'; import { extractProjectDirectory } from '../projects.js';

View File

@@ -4,7 +4,7 @@ import path from 'path';
import os from 'os'; import os from 'os';
import { fileURLToPath } from 'url'; import { fileURLToPath } from 'url';
import { dirname } from 'path'; import { dirname } from 'path';
import { spawn } from 'child_process'; import { spawn } from 'cross-spawn';
const router = express.Router(); const router = express.Router();
const __filename = fileURLToPath(import.meta.url); const __filename = fileURLToPath(import.meta.url);

View File

@@ -1,7 +1,7 @@
import express from 'express'; import express from 'express';
import { promises as fs } from 'fs'; import { promises as fs } from 'fs';
import path from 'path'; import path from 'path';
import { spawn } from 'child_process'; import { spawn } from 'cross-spawn';
import os from 'os'; import os from 'os';
import { addProjectManually } from '../projects.js'; import { addProjectManually } from '../projects.js';

View File

@@ -12,7 +12,7 @@ import express from 'express';
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import { promises as fsPromises } from 'fs'; import { promises as fsPromises } from 'fs';
import { spawn } from 'child_process'; import { spawn } from 'cross-spawn';
import { fileURLToPath } from 'url'; import { fileURLToPath } from 'url';
import { dirname } from 'path'; import { dirname } from 'path';
import os from 'os'; import os from 'os';

View File

@@ -2,7 +2,7 @@ import express from 'express';
import { userDb } from '../database/db.js'; import { userDb } from '../database/db.js';
import { authenticateToken } from '../middleware/auth.js'; import { authenticateToken } from '../middleware/auth.js';
import { getSystemGitConfig } from '../utils/gitConfig.js'; import { getSystemGitConfig } from '../utils/gitConfig.js';
import { spawn } from 'child_process'; import { spawn } from 'cross-spawn';
const router = express.Router(); const router = express.Router();

View File

@@ -1,33 +0,0 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"lib": ["ES2022"],
"baseUrl": ".",
"paths": {
// In the backend config, "@" maps to the /server directory itself.
"@/*": ["*"]
},
// The backend is still mostly JavaScript today, so allowJs lets us add a real
// TypeScript build without forcing a large rename before the tooling is usable.
"allowJs": true,
// Keep the migration incremental: existing JS keeps building, while any new TS files
// still go through the normal TypeScript pipeline and strict checks.
"checkJs": false,
"strict": true,
"noEmitOnError": true,
// The backend build emits both /server and /shared into dist-server, so rootDir must
// stay one level above this file even though the config itself now lives in /server.
"rootDir": "..",
"outDir": "../dist-server",
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"types": ["node"]
},
"include": ["./**/*.js", "./**/*.ts", "../shared/**/*.js", "../shared/**/*.ts"],
"exclude": ["../dist", "../dist-server", "../node_modules", "../src"]
}

View File

@@ -1,4 +1,4 @@
import { spawn } from 'child_process'; import { spawn } from 'cross-spawn';
function spawnAsync(command, args) { function spawnAsync(command, args) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {

View File

@@ -1,7 +1,7 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import os from 'os'; import os from 'os';
import { spawn } from 'child_process'; import { spawn } from 'cross-spawn';
const PLUGINS_DIR = path.join(os.homedir(), '.claude-code-ui', 'plugins'); const PLUGINS_DIR = path.join(os.homedir(), '.claude-code-ui', 'plugins');
const PLUGINS_CONFIG_PATH = path.join(os.homedir(), '.claude-code-ui', 'plugins.json'); const PLUGINS_CONFIG_PATH = path.join(os.homedir(), '.claude-code-ui', 'plugins.json');

View File

@@ -1,4 +1,4 @@
import { spawn } from 'child_process'; import { spawn } from 'cross-spawn';
import path from 'path'; import path from 'path';
import { scanPlugins, getPluginsConfig, getPluginDir } from './plugin-loader.js'; import { scanPlugins, getPluginsConfig, getPluginDir } from './plugin-loader.js';

View File

@@ -1,37 +0,0 @@
import path from 'path';
import { fileURLToPath } from 'url';
export function getModuleDir(importMetaUrl) {
return path.dirname(fileURLToPath(importMetaUrl));
}
export function findServerRoot(startDir) {
// Source files live under /server, while compiled files live under /dist-server/server.
// Walking up to the nearest "server" folder gives every backend module one stable anchor
// that works in both layouts instead of relying on fragile "../.." assumptions.
let currentDir = startDir;
while (path.basename(currentDir) !== 'server') {
const parentDir = path.dirname(currentDir);
if (parentDir === currentDir) {
throw new Error(`Could not resolve the backend server root from "${startDir}".`);
}
currentDir = parentDir;
}
return currentDir;
}
export function findAppRoot(startDir) {
const serverRoot = findServerRoot(startDir);
const parentOfServerRoot = path.dirname(serverRoot);
// Source files live at <app>/server, while compiled files live at <app>/dist-server/server.
// When the nearest server folder sits inside dist-server we need to hop one extra level up
// so repo-level files still resolve from the real app root instead of the build directory.
return path.basename(parentOfServerRoot) === 'dist-server'
? path.dirname(parentOfServerRoot)
: parentOfServerRoot;
}

View File

@@ -19,7 +19,7 @@ import type {
PendingPermissionRequest, PendingPermissionRequest,
PermissionMode, PermissionMode,
} from '../types/types'; } from '../types/types';
import type { Project, ProjectSession, LLMProvider } from '../../../types/app'; import type { Project, ProjectSession, SessionProvider } from '../../../types/app';
import { escapeRegExp } from '../utils/chatFormatting'; import { escapeRegExp } from '../utils/chatFormatting';
import { useFileMentions } from './useFileMentions'; import { useFileMentions } from './useFileMentions';
import { type SlashCommand, useSlashCommands } from './useSlashCommands'; import { type SlashCommand, useSlashCommands } from './useSlashCommands';
@@ -33,7 +33,7 @@ interface UseChatComposerStateArgs {
selectedProject: Project | null; selectedProject: Project | null;
selectedSession: ProjectSession | null; selectedSession: ProjectSession | null;
currentSessionId: string | null; currentSessionId: string | null;
provider: LLMProvider; provider: SessionProvider;
permissionMode: PermissionMode | string; permissionMode: PermissionMode | string;
cyclePermissionMode: () => void; cyclePermissionMode: () => void;
cursorModel: string; cursorModel: string;

View File

@@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef, useState } from 'react';
import { authenticatedFetch } from '../../../utils/api'; import { authenticatedFetch } from '../../../utils/api';
import { CLAUDE_MODELS, CODEX_MODELS, CURSOR_MODELS, GEMINI_MODELS } from '../../../../shared/modelConstants'; import { CLAUDE_MODELS, CODEX_MODELS, CURSOR_MODELS, GEMINI_MODELS } from '../../../../shared/modelConstants';
import type { PendingPermissionRequest, PermissionMode } from '../types/types'; import type { PendingPermissionRequest, PermissionMode } from '../types/types';
import type { ProjectSession, LLMProvider } from '../../../types/app'; import type { ProjectSession, SessionProvider } from '../../../types/app';
interface UseChatProviderStateArgs { interface UseChatProviderStateArgs {
selectedSession: ProjectSession | null; selectedSession: ProjectSession | null;
@@ -11,8 +11,8 @@ interface UseChatProviderStateArgs {
export function useChatProviderState({ selectedSession }: UseChatProviderStateArgs) { export function useChatProviderState({ selectedSession }: UseChatProviderStateArgs) {
const [permissionMode, setPermissionMode] = useState<PermissionMode>('default'); const [permissionMode, setPermissionMode] = useState<PermissionMode>('default');
const [pendingPermissionRequests, setPendingPermissionRequests] = useState<PendingPermissionRequest[]>([]); const [pendingPermissionRequests, setPendingPermissionRequests] = useState<PendingPermissionRequest[]>([]);
const [provider, setProvider] = useState<LLMProvider>(() => { const [provider, setProvider] = useState<SessionProvider>(() => {
return (localStorage.getItem('selected-provider') as LLMProvider) || 'claude'; return (localStorage.getItem('selected-provider') as SessionProvider) || 'claude';
}); });
const [cursorModel, setCursorModel] = useState<string>(() => { const [cursorModel, setCursorModel] = useState<string>(() => {
return localStorage.getItem('cursor-model') || CURSOR_MODELS.DEFAULT; return localStorage.getItem('cursor-model') || CURSOR_MODELS.DEFAULT;

View File

@@ -1,7 +1,7 @@
import { useEffect, useRef } from 'react'; import { useEffect, useRef } from 'react';
import type { Dispatch, MutableRefObject, SetStateAction } from 'react'; import type { Dispatch, MutableRefObject, SetStateAction } from 'react';
import type { PendingPermissionRequest } from '../types/types'; import type { PendingPermissionRequest } from '../types/types';
import type { Project, ProjectSession, LLMProvider } from '../../../types/app'; import type { Project, ProjectSession, SessionProvider } from '../../../types/app';
import type { SessionStore, NormalizedMessage } from '../../../stores/useSessionStore'; import type { SessionStore, NormalizedMessage } from '../../../stores/useSessionStore';
type PendingViewSession = { type PendingViewSession = {
@@ -48,7 +48,7 @@ type LatestChatMessage = {
interface UseChatRealtimeHandlersArgs { interface UseChatRealtimeHandlersArgs {
latestMessage: LatestChatMessage | null; latestMessage: LatestChatMessage | null;
provider: LLMProvider; provider: SessionProvider;
selectedProject: Project | null; selectedProject: Project | null;
selectedSession: ProjectSession | null; selectedSession: ProjectSession | null;
currentSessionId: string | null; currentSessionId: string | null;

View File

@@ -2,7 +2,7 @@ import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } fr
import type { MutableRefObject } from 'react'; import type { MutableRefObject } from 'react';
import { authenticatedFetch } from '../../../utils/api'; import { authenticatedFetch } from '../../../utils/api';
import type { ChatMessage, Provider } from '../types/types'; import type { ChatMessage, Provider } from '../types/types';
import type { Project, ProjectSession, LLMProvider } from '../../../types/app'; import type { Project, ProjectSession, SessionProvider } from '../../../types/app';
import { createCachedDiffCalculator, type DiffCalculator } from '../utils/messageTransforms'; import { createCachedDiffCalculator, type DiffCalculator } from '../utils/messageTransforms';
import { normalizedToChatMessages } from './useChatMessages'; import { normalizedToChatMessages } from './useChatMessages';
import type { SessionStore, NormalizedMessage } from '../../../stores/useSessionStore'; import type { SessionStore, NormalizedMessage } from '../../../stores/useSessionStore';
@@ -40,7 +40,7 @@ interface ScrollRestoreState {
function chatMessageToNormalized( function chatMessageToNormalized(
msg: ChatMessage, msg: ChatMessage,
sessionId: string, sessionId: string,
provider: LLMProvider, provider: SessionProvider,
): NormalizedMessage | null { ): NormalizedMessage | null {
const id = `local_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`; const id = `local_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
const ts = msg.timestamp instanceof Date const ts = msg.timestamp instanceof Date
@@ -151,7 +151,7 @@ export function useChatSessionState({
// When a real session ID arrives and we have a pending user message, flush it to the store // When a real session ID arrives and we have a pending user message, flush it to the store
const prevActiveSessionRef = useRef<string | null>(null); const prevActiveSessionRef = useRef<string | null>(null);
if (activeSessionId && activeSessionId !== prevActiveSessionRef.current && pendingUserMessage) { if (activeSessionId && activeSessionId !== prevActiveSessionRef.current && pendingUserMessage) {
const prov = (localStorage.getItem('selected-provider') as LLMProvider) || 'claude'; const prov = (localStorage.getItem('selected-provider') as SessionProvider) || 'claude';
const normalized = chatMessageToNormalized(pendingUserMessage, activeSessionId, prov); const normalized = chatMessageToNormalized(pendingUserMessage, activeSessionId, prov);
if (normalized) { if (normalized) {
sessionStore.appendRealtime(activeSessionId, normalized); sessionStore.appendRealtime(activeSessionId, normalized);
@@ -189,7 +189,7 @@ export function useChatSessionState({
setPendingUserMessage(msg); setPendingUserMessage(msg);
return; return;
} }
const prov = (localStorage.getItem('selected-provider') as LLMProvider) || 'claude'; const prov = (localStorage.getItem('selected-provider') as SessionProvider) || 'claude';
const normalized = chatMessageToNormalized(msg, activeSessionId, prov); const normalized = chatMessageToNormalized(msg, activeSessionId, prov);
if (normalized) { if (normalized) {
sessionStore.appendRealtime(activeSessionId, normalized); sessionStore.appendRealtime(activeSessionId, normalized);
@@ -240,7 +240,7 @@ export function useChatSessionState({
try { try {
const slot = await sessionStore.fetchMore(selectedSession.id, { const slot = await sessionStore.fetchMore(selectedSession.id, {
provider: sessionProvider as LLMProvider, provider: sessionProvider as SessionProvider,
projectName: selectedProject.name, projectName: selectedProject.name,
projectPath: selectedProject.fullPath || selectedProject.path || '', projectPath: selectedProject.fullPath || selectedProject.path || '',
limit: MESSAGES_PER_PAGE, limit: MESSAGES_PER_PAGE,
@@ -374,7 +374,7 @@ export function useChatSessionState({
// Fetch from server → store updates → chatMessages re-derives automatically // Fetch from server → store updates → chatMessages re-derives automatically
setIsLoadingSessionMessages(true); setIsLoadingSessionMessages(true);
sessionStore.fetchFromServer(selectedSession.id, { sessionStore.fetchFromServer(selectedSession.id, {
provider: (selectedSession.__provider || provider) as LLMProvider, provider: (selectedSession.__provider || provider) as SessionProvider,
projectName: selectedProject.name, projectName: selectedProject.name,
projectPath: selectedProject.fullPath || selectedProject.path || '', projectPath: selectedProject.fullPath || selectedProject.path || '',
limit: MESSAGES_PER_PAGE, limit: MESSAGES_PER_PAGE,
@@ -410,7 +410,7 @@ export function useChatSessionState({
// Skip store refresh during active streaming // Skip store refresh during active streaming
if (!isLoading) { if (!isLoading) {
await sessionStore.refreshFromServer(selectedSession.id, { await sessionStore.refreshFromServer(selectedSession.id, {
provider: (selectedSession.__provider || provider) as LLMProvider, provider: (selectedSession.__provider || provider) as SessionProvider,
projectName: selectedProject.name, projectName: selectedProject.name,
projectPath: selectedProject.fullPath || selectedProject.path || '', projectPath: selectedProject.fullPath || selectedProject.path || '',
}); });
@@ -468,7 +468,7 @@ export function useChatSessionState({
try { try {
// Load all messages into the store for search navigation // Load all messages into the store for search navigation
const slot = await sessionStore.fetchFromServer(selectedSession.id, { const slot = await sessionStore.fetchFromServer(selectedSession.id, {
provider: sessionProvider as LLMProvider, provider: sessionProvider as SessionProvider,
projectName: selectedProject.name, projectName: selectedProject.name,
projectPath: selectedProject.fullPath || selectedProject.path || '', projectPath: selectedProject.fullPath || selectedProject.path || '',
limit: null, limit: null,
@@ -655,7 +655,7 @@ export function useChatSessionState({
try { try {
const slot = await sessionStore.fetchFromServer(requestSessionId, { const slot = await sessionStore.fetchFromServer(requestSessionId, {
provider: sessionProvider as LLMProvider, provider: sessionProvider as SessionProvider,
projectName: selectedProject.name, projectName: selectedProject.name,
projectPath: selectedProject.fullPath || selectedProject.path || '', projectPath: selectedProject.fullPath || selectedProject.path || '',
limit: null, limit: null,

View File

@@ -1,6 +1,6 @@
import type { Project, ProjectSession, LLMProvider } from '../../../types/app'; import type { Project, ProjectSession, SessionProvider } from '../../../types/app';
export type Provider = LLMProvider; export type Provider = SessionProvider;
export type PermissionMode = 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan'; export type PermissionMode = 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan';

View File

@@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next';
import { useTasksSettings } from '../../../contexts/TasksSettingsContext'; import { useTasksSettings } from '../../../contexts/TasksSettingsContext';
import { QuickSettingsPanel } from '../../quick-settings-panel'; import { QuickSettingsPanel } from '../../quick-settings-panel';
import type { ChatInterfaceProps, Provider } from '../types/types'; import type { ChatInterfaceProps, Provider } from '../types/types';
import type { LLMProvider } from '../../../types/app'; import type { SessionProvider } from '../../../types/app';
import { useChatProviderState } from '../hooks/useChatProviderState'; import { useChatProviderState } from '../hooks/useChatProviderState';
import { useChatSessionState } from '../hooks/useChatSessionState'; import { useChatSessionState } from '../hooks/useChatSessionState';
import { useChatRealtimeHandlers } from '../hooks/useChatRealtimeHandlers'; import { useChatRealtimeHandlers } from '../hooks/useChatRealtimeHandlers';
@@ -206,9 +206,9 @@ function ChatInterface({
// so missed streaming events are shown. Also reset isLoading. // so missed streaming events are shown. Also reset isLoading.
const handleWebSocketReconnect = useCallback(async () => { const handleWebSocketReconnect = useCallback(async () => {
if (!selectedProject || !selectedSession) return; if (!selectedProject || !selectedSession) return;
const providerVal = (localStorage.getItem('selected-provider') as LLMProvider) || 'claude'; const providerVal = (localStorage.getItem('selected-provider') as SessionProvider) || 'claude';
await sessionStore.refreshFromServer(selectedSession.id, { await sessionStore.refreshFromServer(selectedSession.id, {
provider: (selectedSession.__provider || providerVal) as LLMProvider, provider: (selectedSession.__provider || providerVal) as SessionProvider,
projectName: selectedProject.name, projectName: selectedProject.name,
projectPath: selectedProject.fullPath || selectedProject.path || '', projectPath: selectedProject.fullPath || selectedProject.path || '',
}); });

View File

@@ -2,7 +2,7 @@ import { useTranslation } from 'react-i18next';
import { useCallback, useRef } from 'react'; import { useCallback, useRef } from 'react';
import type { Dispatch, RefObject, SetStateAction } from 'react'; import type { Dispatch, RefObject, SetStateAction } from 'react';
import type { ChatMessage } from '../../types/types'; import type { ChatMessage } from '../../types/types';
import type { Project, ProjectSession, LLMProvider } from '../../../../types/app'; import type { Project, ProjectSession, SessionProvider } from '../../../../types/app';
import { getIntrinsicMessageKey } from '../../utils/messageKeys'; import { getIntrinsicMessageKey } from '../../utils/messageKeys';
import MessageComponent from './MessageComponent'; import MessageComponent from './MessageComponent';
import ProviderSelectionEmptyState from './ProviderSelectionEmptyState'; import ProviderSelectionEmptyState from './ProviderSelectionEmptyState';
@@ -15,8 +15,8 @@ interface ChatMessagesPaneProps {
chatMessages: ChatMessage[]; chatMessages: ChatMessage[];
selectedSession: ProjectSession | null; selectedSession: ProjectSession | null;
currentSessionId: string | null; currentSessionId: string | null;
provider: LLMProvider; provider: SessionProvider;
setProvider: (provider: LLMProvider) => void; setProvider: (provider: SessionProvider) => void;
textareaRef: RefObject<HTMLTextAreaElement>; textareaRef: RefObject<HTMLTextAreaElement>;
claudeModel: string; claudeModel: string;
setClaudeModel: (model: string) => void; setClaudeModel: (model: string) => void;

View File

@@ -8,14 +8,14 @@ import {
CODEX_MODELS, CODEX_MODELS,
GEMINI_MODELS, GEMINI_MODELS,
} from "../../../../../shared/modelConstants"; } from "../../../../../shared/modelConstants";
import type { ProjectSession, LLMProvider } from "../../../../types/app"; import type { ProjectSession, SessionProvider } from "../../../../types/app";
import { NextTaskBanner } from "../../../task-master"; import { NextTaskBanner } from "../../../task-master";
type ProviderSelectionEmptyStateProps = { type ProviderSelectionEmptyStateProps = {
selectedSession: ProjectSession | null; selectedSession: ProjectSession | null;
currentSessionId: string | null; currentSessionId: string | null;
provider: LLMProvider; provider: SessionProvider;
setProvider: (next: LLMProvider) => void; setProvider: (next: SessionProvider) => void;
textareaRef: React.RefObject<HTMLTextAreaElement>; textareaRef: React.RefObject<HTMLTextAreaElement>;
claudeModel: string; claudeModel: string;
setClaudeModel: (model: string) => void; setClaudeModel: (model: string) => void;
@@ -32,7 +32,7 @@ type ProviderSelectionEmptyStateProps = {
}; };
type ProviderDef = { type ProviderDef = {
id: LLMProvider; id: SessionProvider;
name: string; name: string;
infoKey: string; infoKey: string;
accent: string; accent: string;
@@ -75,7 +75,7 @@ const PROVIDERS: ProviderDef[] = [
}, },
]; ];
function getModelConfig(p: LLMProvider) { function getModelConfig(p: SessionProvider) {
if (p === "claude") return CLAUDE_MODELS; if (p === "claude") return CLAUDE_MODELS;
if (p === "codex") return CODEX_MODELS; if (p === "codex") return CODEX_MODELS;
if (p === "gemini") return GEMINI_MODELS; if (p === "gemini") return GEMINI_MODELS;
@@ -83,7 +83,7 @@ function getModelConfig(p: LLMProvider) {
} }
function getModelValue( function getModelValue(
p: LLMProvider, p: SessionProvider,
c: string, c: string,
cu: string, cu: string,
co: string, co: string,
@@ -119,7 +119,7 @@ export default function ProviderSelectionEmptyState({
defaultValue: "Start the next task", defaultValue: "Start the next task",
}); });
const selectProvider = (next: LLMProvider) => { const selectProvider = (next: SessionProvider) => {
setProvider(next); setProvider(next);
localStorage.setItem("selected-provider", next); localStorage.setItem("selected-provider", next);
setTimeout(() => textareaRef.current?.focus(), 100); setTimeout(() => textareaRef.current?.focus(), 100);

View File

@@ -1,11 +1,11 @@
import type { LLMProvider } from '../../types/app'; import type { SessionProvider } from '../../types/app';
import ClaudeLogo from './ClaudeLogo'; import ClaudeLogo from './ClaudeLogo';
import CodexLogo from './CodexLogo'; import CodexLogo from './CodexLogo';
import CursorLogo from './CursorLogo'; import CursorLogo from './CursorLogo';
import GeminiLogo from './GeminiLogo'; import GeminiLogo from './GeminiLogo';
type SessionProviderLogoProps = { type SessionProviderLogoProps = {
provider?: LLMProvider | string | null; provider?: SessionProvider | string | null;
className?: string; className?: string;
}; };

View File

@@ -1,15 +1,17 @@
import { Check, ChevronLeft, ChevronRight, Loader2 } from 'lucide-react'; import { Check, ChevronLeft, ChevronRight, Loader2 } from 'lucide-react';
import { useCallback, useEffect, useRef, useState } from 'react'; import { useCallback, useEffect, useRef, useState } from 'react';
import type { LLMProvider } from '../../../types/app';
import { authenticatedFetch } from '../../../utils/api'; import { authenticatedFetch } from '../../../utils/api';
import { useProviderAuthStatus } from '../../provider-auth/hooks/useProviderAuthStatus';
import ProviderLoginModal from '../../provider-auth/view/ProviderLoginModal'; import ProviderLoginModal from '../../provider-auth/view/ProviderLoginModal';
import AgentConnectionsStep from './subcomponents/AgentConnectionsStep'; import AgentConnectionsStep from './subcomponents/AgentConnectionsStep';
import GitConfigurationStep from './subcomponents/GitConfigurationStep'; import GitConfigurationStep from './subcomponents/GitConfigurationStep';
import OnboardingStepProgress from './subcomponents/OnboardingStepProgress'; import OnboardingStepProgress from './subcomponents/OnboardingStepProgress';
import type { CliProvider, ProviderStatusMap } from './types';
import { import {
cliProviders,
createInitialProviderStatuses,
gitEmailPattern, gitEmailPattern,
readErrorMessageFromResponse, readErrorMessageFromResponse,
selectedProject,
} from './utils'; } from './utils';
type OnboardingProps = { type OnboardingProps = {
@@ -22,14 +24,59 @@ export default function Onboarding({ onComplete }: OnboardingProps) {
const [gitEmail, setGitEmail] = useState(''); const [gitEmail, setGitEmail] = useState('');
const [isSubmitting, setIsSubmitting] = useState(false); const [isSubmitting, setIsSubmitting] = useState(false);
const [errorMessage, setErrorMessage] = useState(''); const [errorMessage, setErrorMessage] = useState('');
const [activeLoginProvider, setActiveLoginProvider] = useState<LLMProvider | null>(null); const [activeLoginProvider, setActiveLoginProvider] = useState<CliProvider | null>(null);
const { const [providerStatuses, setProviderStatuses] = useState<ProviderStatusMap>(createInitialProviderStatuses);
providerAuthStatus,
checkProviderAuthStatus,
refreshProviderAuthStatuses,
} = useProviderAuthStatus();
const previousActiveLoginProviderRef = useRef<LLMProvider | null | undefined>(undefined); const previousActiveLoginProviderRef = useRef<CliProvider | null | undefined>(undefined);
const checkProviderAuthStatus = useCallback(async (provider: CliProvider) => {
try {
const response = await authenticatedFetch(`/api/cli/${provider}/status`);
if (!response.ok) {
setProviderStatuses((previous) => ({
...previous,
[provider]: {
authenticated: false,
email: null,
loading: false,
error: 'Failed to check authentication status',
},
}));
return;
}
const payload = (await response.json()) as {
authenticated?: boolean;
email?: string | null;
error?: string | null;
};
setProviderStatuses((previous) => ({
...previous,
[provider]: {
authenticated: Boolean(payload.authenticated),
email: payload.email ?? null,
loading: false,
error: payload.error ?? null,
},
}));
} catch (caughtError) {
console.error(`Error checking ${provider} auth status:`, caughtError);
setProviderStatuses((previous) => ({
...previous,
[provider]: {
authenticated: false,
email: null,
loading: false,
error: caughtError instanceof Error ? caughtError.message : 'Unknown error',
},
}));
}
}, []);
const refreshAllProviderStatuses = useCallback(async () => {
await Promise.all(cliProviders.map((provider) => checkProviderAuthStatus(provider)));
}, [checkProviderAuthStatus]);
const loadGitConfig = useCallback(async () => { const loadGitConfig = useCallback(async () => {
try { try {
@@ -52,24 +99,23 @@ export default function Onboarding({ onComplete }: OnboardingProps) {
useEffect(() => { useEffect(() => {
void loadGitConfig(); void loadGitConfig();
void refreshProviderAuthStatuses(); void refreshAllProviderStatuses();
}, [loadGitConfig, refreshProviderAuthStatuses]); }, [loadGitConfig, refreshAllProviderStatuses]);
useEffect(() => { useEffect(() => {
const previousProvider = previousActiveLoginProviderRef.current; const previousProvider = previousActiveLoginProviderRef.current;
previousActiveLoginProviderRef.current = activeLoginProvider; previousActiveLoginProviderRef.current = activeLoginProvider;
const didCloseModal = previousProvider !== undefined const isInitialMount = previousProvider === undefined;
&& previousProvider !== null const didCloseModal = previousProvider !== null && activeLoginProvider === null;
&& activeLoginProvider === null;
// Refresh statuses after the login modal is closed. // Refresh statuses once on mount and again after the login modal is closed.
if (didCloseModal) { if (isInitialMount || didCloseModal) {
void refreshProviderAuthStatuses(); void refreshAllProviderStatuses();
} }
}, [activeLoginProvider, refreshProviderAuthStatuses]); }, [activeLoginProvider, refreshAllProviderStatuses]);
const handleProviderLoginOpen = (provider: LLMProvider) => { const handleProviderLoginOpen = (provider: CliProvider) => {
setActiveLoginProvider(provider); setActiveLoginProvider(provider);
}; };
@@ -163,7 +209,7 @@ export default function Onboarding({ onComplete }: OnboardingProps) {
/> />
) : ( ) : (
<AgentConnectionsStep <AgentConnectionsStep
providerStatuses={providerAuthStatus} providerStatuses={providerStatuses}
onOpenProviderLogin={handleProviderLoginOpen} onOpenProviderLogin={handleProviderLoginOpen}
/> />
)} )}
@@ -233,6 +279,7 @@ export default function Onboarding({ onComplete }: OnboardingProps) {
isOpen={Boolean(activeLoginProvider)} isOpen={Boolean(activeLoginProvider)}
onClose={() => setActiveLoginProvider(null)} onClose={() => setActiveLoginProvider(null)}
provider={activeLoginProvider} provider={activeLoginProvider}
project={selectedProject}
onComplete={handleLoginComplete} onComplete={handleLoginComplete}
/> />
)} )}

View File

@@ -1,10 +1,9 @@
import { Check } from 'lucide-react'; import { Check } from 'lucide-react';
import SessionProviderLogo from '../../../llm-logo-provider/SessionProviderLogo'; import SessionProviderLogo from '../../../llm-logo-provider/SessionProviderLogo';
import type { LLMProvider } from '../../../../types/app'; import type { CliProvider, ProviderAuthStatus } from '../types';
import type { ProviderAuthStatus } from '../../../provider-auth/types';
type AgentConnectionCardProps = { type AgentConnectionCardProps = {
provider: LLMProvider; provider: CliProvider;
title: string; title: string;
status: ProviderAuthStatus; status: ProviderAuthStatus;
connectedClassName: string; connectedClassName: string;

View File

@@ -1,10 +1,9 @@
import type { LLMProvider } from '../../../../types/app'; import type { CliProvider, ProviderStatusMap } from '../types';
import type { ProviderAuthStatusMap } from '../../../provider-auth/types';
import AgentConnectionCard from './AgentConnectionCard'; import AgentConnectionCard from './AgentConnectionCard';
type AgentConnectionsStepProps = { type AgentConnectionsStepProps = {
providerStatuses: ProviderAuthStatusMap; providerStatuses: ProviderStatusMap;
onOpenProviderLogin: (provider: LLMProvider) => void; onOpenProviderLogin: (provider: CliProvider) => void;
}; };
const providerCards = [ const providerCards = [

View File

@@ -0,0 +1,12 @@
import type { CliProvider } from '../../provider-auth/types';
export type { CliProvider };
export type ProviderAuthStatus = {
authenticated: boolean;
email: string | null;
loading: boolean;
error: string | null;
};
export type ProviderStatusMap = Record<CliProvider, ProviderAuthStatus>;

View File

@@ -1,5 +1,24 @@
import { IS_PLATFORM } from '../../../constants/config';
import type { CliProvider, ProviderStatusMap } from './types';
export const cliProviders: CliProvider[] = ['claude', 'cursor', 'codex', 'gemini'];
export const gitEmailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; export const gitEmailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
export const selectedProject = {
name: 'default',
displayName: 'default',
fullPath: IS_PLATFORM ? '/workspace' : '',
path: IS_PLATFORM ? '/workspace' : '',
};
export const createInitialProviderStatuses = (): ProviderStatusMap => ({
claude: { authenticated: false, email: null, loading: true, error: null },
cursor: { authenticated: false, email: null, loading: true, error: null },
codex: { authenticated: false, email: null, loading: true, error: null },
gemini: { authenticated: false, email: null, loading: true, error: null },
});
export const readErrorMessageFromResponse = async (response: Response, fallback: string) => { export const readErrorMessageFromResponse = async (response: Response, fallback: string) => {
try { try {
const payload = (await response.json()) as { error?: string }; const payload = (await response.json()) as { error?: string };

View File

@@ -1,109 +0,0 @@
import { useCallback, useState } from 'react';
import { authenticatedFetch } from '../../../utils/api';
import type { LLMProvider } from '../../../types/app';
import {
CLI_AUTH_STATUS_ENDPOINTS,
CLI_PROVIDERS,
createInitialProviderAuthStatusMap,
} from '../types';
import type {
ProviderAuthStatus,
ProviderAuthStatusMap,
} from '../types';
type ProviderAuthStatusPayload = {
authenticated?: boolean;
email?: string | null;
method?: string | null;
error?: string | null;
};
const FALLBACK_STATUS_ERROR = 'Failed to check authentication status';
const FALLBACK_UNKNOWN_ERROR = 'Unknown error';
const toErrorMessage = (error: unknown): string => (
error instanceof Error ? error.message : FALLBACK_UNKNOWN_ERROR
);
const toProviderAuthStatus = (
payload: ProviderAuthStatusPayload,
fallbackError: string | null = null,
): ProviderAuthStatus => ({
authenticated: Boolean(payload.authenticated),
email: payload.email ?? null,
method: payload.method ?? null,
error: payload.error ?? fallbackError,
loading: false,
});
type UseProviderAuthStatusOptions = {
initialLoading?: boolean;
};
export function useProviderAuthStatus(
{ initialLoading = true }: UseProviderAuthStatusOptions = {},
) {
const [providerAuthStatus, setProviderAuthStatus] = useState<ProviderAuthStatusMap>(() => (
createInitialProviderAuthStatusMap(initialLoading)
));
const setProviderLoading = useCallback((provider: LLMProvider) => {
setProviderAuthStatus((previous) => ({
...previous,
[provider]: {
...previous[provider],
loading: true,
error: null,
},
}));
}, []);
const setProviderStatus = useCallback((provider: LLMProvider, status: ProviderAuthStatus) => {
setProviderAuthStatus((previous) => ({
...previous,
[provider]: status,
}));
}, []);
const checkProviderAuthStatus = useCallback(async (provider: LLMProvider) => {
setProviderLoading(provider);
try {
const response = await authenticatedFetch(CLI_AUTH_STATUS_ENDPOINTS[provider]);
if (!response.ok) {
setProviderStatus(provider, {
authenticated: false,
email: null,
method: null,
loading: false,
error: FALLBACK_STATUS_ERROR,
});
return;
}
const payload = (await response.json()) as ProviderAuthStatusPayload;
setProviderStatus(provider, toProviderAuthStatus(payload));
} catch (caughtError) {
console.error(`Error checking ${provider} auth status:`, caughtError);
setProviderStatus(provider, {
authenticated: false,
email: null,
method: null,
loading: false,
error: toErrorMessage(caughtError),
});
}
}, [setProviderLoading, setProviderStatus]);
const refreshProviderAuthStatuses = useCallback(async (providers: LLMProvider[] = CLI_PROVIDERS) => {
await Promise.all(providers.map((provider) => checkProviderAuthStatus(provider)));
}, [checkProviderAuthStatus]);
return {
providerAuthStatus,
setProviderAuthStatus,
checkProviderAuthStatus,
refreshProviderAuthStatuses,
};
}

View File

@@ -1,27 +1 @@
import type { LLMProvider } from '../../types/app'; export type CliProvider = 'claude' | 'cursor' | 'codex' | 'gemini';
export type ProviderAuthStatus = {
authenticated: boolean;
email: string | null;
method: string | null;
error: string | null;
loading: boolean;
};
export type ProviderAuthStatusMap = Record<LLMProvider, ProviderAuthStatus>;
export const CLI_PROVIDERS: LLMProvider[] = ['claude', 'cursor', 'codex', 'gemini'];
export const CLI_AUTH_STATUS_ENDPOINTS: Record<LLMProvider, string> = {
claude: '/api/cli/claude/status',
cursor: '/api/cli/cursor/status',
codex: '/api/cli/codex/status',
gemini: '/api/cli/gemini/status',
};
export const createInitialProviderAuthStatusMap = (loading = true): ProviderAuthStatusMap => ({
claude: { authenticated: false, email: null, method: null, error: null, loading },
cursor: { authenticated: false, email: null, method: null, error: null, loading },
codex: { authenticated: false, email: null, method: null, error: null, loading },
gemini: { authenticated: false, email: null, method: null, error: null, loading },
});

View File

@@ -1,12 +1,21 @@
import { ExternalLink, KeyRound, X } from 'lucide-react'; import { ExternalLink, KeyRound, X } from 'lucide-react';
import StandaloneShell from '../../standalone-shell/view/StandaloneShell'; import StandaloneShell from '../../standalone-shell/view/StandaloneShell';
import { DEFAULT_PROJECT_FOR_EMPTY_SHELL, IS_PLATFORM } from '../../../constants/config'; import { IS_PLATFORM } from '../../../constants/config';
import type { LLMProvider } from '../../../types/app'; import type { CliProvider } from '../types';
type LoginModalProject = {
name?: string;
displayName?: string;
fullPath?: string;
path?: string;
[key: string]: unknown;
};
type ProviderLoginModalProps = { type ProviderLoginModalProps = {
isOpen: boolean; isOpen: boolean;
onClose: () => void; onClose: () => void;
provider?: LLMProvider; provider?: CliProvider;
project?: LoginModalProject | null;
onComplete?: (exitCode: number) => void; onComplete?: (exitCode: number) => void;
customCommand?: string; customCommand?: string;
isAuthenticated?: boolean; isAuthenticated?: boolean;
@@ -17,7 +26,7 @@ const getProviderCommand = ({
customCommand, customCommand,
isAuthenticated: _isAuthenticated, isAuthenticated: _isAuthenticated,
}: { }: {
provider: LLMProvider; provider: CliProvider;
customCommand?: string; customCommand?: string;
isAuthenticated: boolean; isAuthenticated: boolean;
}) => { }) => {
@@ -40,17 +49,30 @@ const getProviderCommand = ({
return 'gemini status'; return 'gemini status';
}; };
const getProviderTitle = (provider: LLMProvider) => { const getProviderTitle = (provider: CliProvider) => {
if (provider === 'claude') return 'Claude CLI Login'; if (provider === 'claude') return 'Claude CLI Login';
if (provider === 'cursor') return 'Cursor CLI Login'; if (provider === 'cursor') return 'Cursor CLI Login';
if (provider === 'codex') return 'Codex CLI Login'; if (provider === 'codex') return 'Codex CLI Login';
return 'Gemini CLI Configuration'; return 'Gemini CLI Configuration';
}; };
const normalizeProject = (project?: LoginModalProject | null) => {
const normalizedName = project?.name || 'default';
const normalizedFullPath = project?.fullPath ?? project?.path ?? (IS_PLATFORM ? '/workspace' : '');
return {
name: normalizedName,
displayName: project?.displayName || normalizedName,
fullPath: normalizedFullPath,
path: project?.path ?? normalizedFullPath,
};
};
export default function ProviderLoginModal({ export default function ProviderLoginModal({
isOpen, isOpen,
onClose, onClose,
provider = 'claude', provider = 'claude',
project = null,
onComplete, onComplete,
customCommand, customCommand,
isAuthenticated = false, isAuthenticated = false,
@@ -61,6 +83,7 @@ export default function ProviderLoginModal({
const command = getProviderCommand({ provider, customCommand, isAuthenticated }); const command = getProviderCommand({ provider, customCommand, isAuthenticated });
const title = getProviderTitle(provider); const title = getProviderTitle(provider);
const shellProject = normalizeProject(project);
const handleComplete = (exitCode: number) => { const handleComplete = (exitCode: number) => {
onComplete?.(exitCode); onComplete?.(exitCode);
@@ -135,7 +158,7 @@ export default function ProviderLoginModal({
</button> </button>
</div> </div>
) : ( ) : (
<StandaloneShell project={DEFAULT_PROJECT_FOR_EMPTY_SHELL} command={command} onComplete={handleComplete} minimal={true} /> <StandaloneShell project={shellProject} command={command} onComplete={handleComplete} minimal={true} />
)} )}
</div> </div>
</div> </div>

View File

@@ -1,6 +1,7 @@
import type { import type {
AgentCategory, AgentCategory,
AgentProvider, AgentProvider,
AuthStatus,
ClaudeMcpFormState, ClaudeMcpFormState,
CodexMcpFormState, CodexMcpFormState,
CodeEditorSettingsState, CodeEditorSettingsState,
@@ -33,6 +34,13 @@ export const DEFAULT_CODE_EDITOR_SETTINGS: CodeEditorSettingsState = {
fontSize: '14', fontSize: '14',
}; };
export const DEFAULT_AUTH_STATUS: AuthStatus = {
authenticated: false,
email: null,
loading: true,
error: null,
};
export const DEFAULT_MCP_TEST_RESULT: McpTestResult = { export const DEFAULT_MCP_TEST_RESULT: McpTestResult = {
success: false, success: false,
message: '', message: '',
@@ -80,3 +88,9 @@ export const DEFAULT_CURSOR_PERMISSIONS: CursorPermissionsState = {
skipPermissions: false, skipPermissions: false,
}; };
export const AUTH_STATUS_ENDPOINTS: Record<AgentProvider, string> = {
claude: '/api/cli/claude/status',
cursor: '/api/cli/cursor/status',
codex: '/api/cli/codex/status',
gemini: '/api/cli/gemini/status',
};

View File

@@ -1,13 +1,15 @@
import { useCallback, useEffect, useRef, useState } from 'react'; import { useCallback, useEffect, useRef, useState } from 'react';
import { useTheme } from '../../../contexts/ThemeContext'; import { useTheme } from '../../../contexts/ThemeContext';
import { authenticatedFetch } from '../../../utils/api'; import { authenticatedFetch } from '../../../utils/api';
import { useProviderAuthStatus } from '../../provider-auth/hooks/useProviderAuthStatus';
import { import {
AUTH_STATUS_ENDPOINTS,
DEFAULT_AUTH_STATUS,
DEFAULT_CODE_EDITOR_SETTINGS, DEFAULT_CODE_EDITOR_SETTINGS,
DEFAULT_CURSOR_PERMISSIONS, DEFAULT_CURSOR_PERMISSIONS,
} from '../constants/constants'; } from '../constants/constants';
import type { import type {
AgentProvider, AgentProvider,
AuthStatus,
ClaudeMcpFormState, ClaudeMcpFormState,
ClaudePermissionsState, ClaudePermissionsState,
CodeEditorSettingsState, CodeEditorSettingsState,
@@ -21,6 +23,7 @@ import type {
NotificationPreferencesState, NotificationPreferencesState,
ProjectSortOrder, ProjectSortOrder,
SettingsMainTab, SettingsMainTab,
SettingsProject,
} from '../types/types'; } from '../types/types';
type ThemeContextValue = { type ThemeContextValue = {
@@ -31,6 +34,15 @@ type ThemeContextValue = {
type UseSettingsControllerArgs = { type UseSettingsControllerArgs = {
isOpen: boolean; isOpen: boolean;
initialTab: string; initialTab: string;
projects: SettingsProject[];
onClose: () => void;
};
type StatusApiResponse = {
authenticated?: boolean;
email?: string | null;
error?: string | null;
method?: string;
}; };
type JsonResult = { type JsonResult = {
@@ -154,6 +166,20 @@ const mapCliServersToMcpServers = (servers: McpCliServer[] = []): McpServer[] =>
})) }))
); );
const getDefaultProject = (projects: SettingsProject[]): SettingsProject => {
if (projects.length > 0) {
return projects[0];
}
const cwd = typeof process !== 'undefined' && process.cwd ? process.cwd() : '';
return {
name: 'default',
displayName: 'default',
fullPath: cwd,
path: cwd,
};
};
const toResponseJson = async <T>(response: Response): Promise<T> => response.json() as Promise<T>; const toResponseJson = async <T>(response: Response): Promise<T> => response.json() as Promise<T>;
const createEmptyClaudePermissions = (): ClaudePermissionsState => ({ const createEmptyClaudePermissions = (): ClaudePermissionsState => ({
@@ -178,7 +204,7 @@ const createDefaultNotificationPreferences = (): NotificationPreferencesState =>
}, },
}); });
export function useSettingsController({ isOpen, initialTab }: UseSettingsControllerArgs) { export function useSettingsController({ isOpen, initialTab, projects, onClose }: UseSettingsControllerArgs) {
const { isDarkMode, toggleDarkMode } = useTheme() as ThemeContextValue; const { isDarkMode, toggleDarkMode } = useTheme() as ThemeContextValue;
const closeTimerRef = useRef<number | null>(null); const closeTimerRef = useRef<number | null>(null);
@@ -216,11 +242,64 @@ export function useSettingsController({ isOpen, initialTab }: UseSettingsControl
const [showLoginModal, setShowLoginModal] = useState(false); const [showLoginModal, setShowLoginModal] = useState(false);
const [loginProvider, setLoginProvider] = useState<ActiveLoginProvider>(''); const [loginProvider, setLoginProvider] = useState<ActiveLoginProvider>('');
const { const [selectedProject, setSelectedProject] = useState<SettingsProject | null>(null);
providerAuthStatus,
checkProviderAuthStatus, const [claudeAuthStatus, setClaudeAuthStatus] = useState<AuthStatus>(DEFAULT_AUTH_STATUS);
refreshProviderAuthStatuses, const [cursorAuthStatus, setCursorAuthStatus] = useState<AuthStatus>(DEFAULT_AUTH_STATUS);
} = useProviderAuthStatus(); const [codexAuthStatus, setCodexAuthStatus] = useState<AuthStatus>(DEFAULT_AUTH_STATUS);
const [geminiAuthStatus, setGeminiAuthStatus] = useState<AuthStatus>(DEFAULT_AUTH_STATUS);
const setAuthStatusByProvider = useCallback((provider: AgentProvider, status: AuthStatus) => {
if (provider === 'claude') {
setClaudeAuthStatus(status);
return;
}
if (provider === 'cursor') {
setCursorAuthStatus(status);
return;
}
if (provider === 'gemini') {
setGeminiAuthStatus(status);
return;
}
setCodexAuthStatus(status);
}, []);
const checkAuthStatus = useCallback(async (provider: AgentProvider) => {
try {
const response = await authenticatedFetch(AUTH_STATUS_ENDPOINTS[provider]);
if (!response.ok) {
setAuthStatusByProvider(provider, {
authenticated: false,
email: null,
loading: false,
error: 'Failed to check authentication status',
});
return;
}
const data = await toResponseJson<StatusApiResponse>(response);
setAuthStatusByProvider(provider, {
authenticated: Boolean(data.authenticated),
email: data.email || null,
loading: false,
error: data.error || null,
method: data.method,
});
} catch (error) {
console.error(`Error checking ${provider} auth status:`, error);
setAuthStatusByProvider(provider, {
authenticated: false,
email: null,
loading: false,
error: getErrorMessage(error),
});
}
}, [setAuthStatusByProvider]);
const fetchCursorMcpServers = useCallback(async () => { const fetchCursorMcpServers = useCallback(async () => {
try { try {
@@ -645,8 +724,9 @@ export function useSettingsController({ isOpen, initialTab }: UseSettingsControl
const openLoginForProvider = useCallback((provider: AgentProvider) => { const openLoginForProvider = useCallback((provider: AgentProvider) => {
setLoginProvider(provider); setLoginProvider(provider);
setSelectedProject(getDefaultProject(projects));
setShowLoginModal(true); setShowLoginModal(true);
}, []); }, [projects]);
const handleLoginComplete = useCallback((exitCode: number) => { const handleLoginComplete = useCallback((exitCode: number) => {
if (exitCode !== 0 || !loginProvider) { if (exitCode !== 0 || !loginProvider) {
@@ -654,8 +734,8 @@ export function useSettingsController({ isOpen, initialTab }: UseSettingsControl
} }
setSaveStatus('success'); setSaveStatus('success');
void checkProviderAuthStatus(loginProvider); void checkAuthStatus(loginProvider);
}, [checkProviderAuthStatus, loginProvider]); }, [checkAuthStatus, loginProvider]);
const saveSettings = useCallback(async () => { const saveSettings = useCallback(async () => {
setSaveStatus(null); setSaveStatus(null);
@@ -747,8 +827,11 @@ export function useSettingsController({ isOpen, initialTab }: UseSettingsControl
setActiveTab(normalizeMainTab(initialTab)); setActiveTab(normalizeMainTab(initialTab));
void loadSettings(); void loadSettings();
void refreshProviderAuthStatuses(); void checkAuthStatus('claude');
}, [initialTab, isOpen, loadSettings, refreshProviderAuthStatuses]); void checkAuthStatus('cursor');
void checkAuthStatus('codex');
void checkAuthStatus('gemini');
}, [checkAuthStatus, initialTab, isOpen, loadSettings]);
useEffect(() => { useEffect(() => {
localStorage.setItem('codeEditorTheme', codeEditorSettings.theme); localStorage.setItem('codeEditorTheme', codeEditorSettings.theme);
@@ -852,13 +935,17 @@ export function useSettingsController({ isOpen, initialTab }: UseSettingsControl
closeCodexMcpForm, closeCodexMcpForm,
submitCodexMcpForm, submitCodexMcpForm,
handleCodexMcpDelete, handleCodexMcpDelete,
providerAuthStatus, claudeAuthStatus,
cursorAuthStatus,
codexAuthStatus,
geminiAuthStatus,
geminiPermissionMode, geminiPermissionMode,
setGeminiPermissionMode, setGeminiPermissionMode,
openLoginForProvider, openLoginForProvider,
showLoginModal, showLoginModal,
setShowLoginModal, setShowLoginModal,
loginProvider, loginProvider,
selectedProject,
handleLoginComplete, handleLoginComplete,
}; };
} }

View File

@@ -1,9 +1,7 @@
import type { Dispatch, SetStateAction } from 'react'; import type { Dispatch, SetStateAction } from 'react';
import type { LLMProvider } from '../../../types/app';
import type { ProviderAuthStatus } from '../../provider-auth/types';
export type SettingsMainTab = 'agents' | 'appearance' | 'git' | 'api' | 'tasks' | 'notifications' | 'plugins' | 'about'; export type SettingsMainTab = 'agents' | 'appearance' | 'git' | 'api' | 'tasks' | 'notifications' | 'plugins' | 'about';
export type AgentProvider = LLMProvider; export type AgentProvider = 'claude' | 'cursor' | 'codex' | 'gemini';
export type AgentCategory = 'account' | 'permissions' | 'mcp'; export type AgentCategory = 'account' | 'permissions' | 'mcp';
export type ProjectSortOrder = 'name' | 'date'; export type ProjectSortOrder = 'name' | 'date';
export type SaveStatus = 'success' | 'error' | null; export type SaveStatus = 'success' | 'error' | null;
@@ -20,7 +18,13 @@ export type SettingsProject = {
path?: string; path?: string;
}; };
export type AuthStatus = ProviderAuthStatus; export type AuthStatus = {
authenticated: boolean;
email: string | null;
loading: boolean;
error: string | null;
method?: string;
};
export type KeyValueMap = Record<string, string>; export type KeyValueMap = Record<string, string>;

View File

@@ -56,17 +56,23 @@ function Settings({ isOpen, onClose, projects = [], initialTab = 'agents' }: Set
closeCodexMcpForm, closeCodexMcpForm,
submitCodexMcpForm, submitCodexMcpForm,
handleCodexMcpDelete, handleCodexMcpDelete,
providerAuthStatus, claudeAuthStatus,
cursorAuthStatus,
codexAuthStatus,
geminiAuthStatus,
geminiPermissionMode, geminiPermissionMode,
setGeminiPermissionMode, setGeminiPermissionMode,
openLoginForProvider, openLoginForProvider,
showLoginModal, showLoginModal,
setShowLoginModal, setShowLoginModal,
loginProvider, loginProvider,
selectedProject,
handleLoginComplete, handleLoginComplete,
} = useSettingsController({ } = useSettingsController({
isOpen, isOpen,
initialTab initialTab,
projects,
onClose,
}); });
const { const {
@@ -99,7 +105,13 @@ function Settings({ isOpen, onClose, projects = [], initialTab = 'agents' }: Set
return null; return null;
} }
const isAuthenticated = Boolean(loginProvider && providerAuthStatus[loginProvider].authenticated); const isAuthenticated = loginProvider === 'claude'
? claudeAuthStatus.authenticated
: loginProvider === 'cursor'
? cursorAuthStatus.authenticated
: loginProvider === 'codex'
? codexAuthStatus.authenticated
: false;
return ( return (
<div className="modal-backdrop fixed inset-0 z-[9999] flex items-center justify-center bg-background/80 backdrop-blur-sm md:p-4"> <div className="modal-backdrop fixed inset-0 z-[9999] flex items-center justify-center bg-background/80 backdrop-blur-sm md:p-4">
@@ -109,7 +121,7 @@ function Settings({ isOpen, onClose, projects = [], initialTab = 'agents' }: Set
<h2 className="text-base font-semibold text-foreground">{t('title')}</h2> <h2 className="text-base font-semibold text-foreground">{t('title')}</h2>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
{saveStatus === 'success' && ( {saveStatus === 'success' && (
<span className="animate-in fade-in text-xs text-muted-foreground">{t('saveStatus.success')}</span> <span className="text-xs text-muted-foreground animate-in fade-in">{t('saveStatus.success')}</span>
)} )}
<Button <Button
variant="ghost" variant="ghost"
@@ -146,8 +158,14 @@ function Settings({ isOpen, onClose, projects = [], initialTab = 'agents' }: Set
{activeTab === 'agents' && ( {activeTab === 'agents' && (
<AgentsSettingsTab <AgentsSettingsTab
providerAuthStatus={providerAuthStatus} claudeAuthStatus={claudeAuthStatus}
onProviderLogin={openLoginForProvider} cursorAuthStatus={cursorAuthStatus}
codexAuthStatus={codexAuthStatus}
geminiAuthStatus={geminiAuthStatus}
onClaudeLogin={() => openLoginForProvider('claude')}
onCursorLogin={() => openLoginForProvider('cursor')}
onCodexLogin={() => openLoginForProvider('codex')}
onGeminiLogin={() => openLoginForProvider('gemini')}
claudePermissions={claudePermissions} claudePermissions={claudePermissions}
onClaudePermissionsChange={setClaudePermissions} onClaudePermissionsChange={setClaudePermissions}
cursorPermissions={cursorPermissions} cursorPermissions={cursorPermissions}
@@ -201,6 +219,7 @@ function Settings({ isOpen, onClose, projects = [], initialTab = 'agents' }: Set
isOpen={showLoginModal} isOpen={showLoginModal}
onClose={() => setShowLoginModal(false)} onClose={() => setShowLoginModal(false)}
provider={loginProvider || 'claude'} provider={loginProvider || 'claude'}
project={selectedProject}
onComplete={handleLoginComplete} onComplete={handleLoginComplete}
isAuthenticated={isAuthenticated} isAuthenticated={isAuthenticated}
/> />

View File

@@ -6,8 +6,14 @@ import AgentSelectorSection from './sections/AgentSelectorSection';
import type { AgentContext, AgentsSettingsTabProps } from './types'; import type { AgentContext, AgentsSettingsTabProps } from './types';
export default function AgentsSettingsTab({ export default function AgentsSettingsTab({
providerAuthStatus, claudeAuthStatus,
onProviderLogin, cursorAuthStatus,
codexAuthStatus,
geminiAuthStatus,
onClaudeLogin,
onCursorLogin,
onCodexLogin,
onGeminiLogin,
claudePermissions, claudePermissions,
onClaudePermissionsChange, onClaudePermissionsChange,
cursorPermissions, cursorPermissions,
@@ -35,27 +41,30 @@ export default function AgentsSettingsTab({
const agentContextById = useMemo<Record<AgentProvider, AgentContext>>(() => ({ const agentContextById = useMemo<Record<AgentProvider, AgentContext>>(() => ({
claude: { claude: {
authStatus: providerAuthStatus.claude, authStatus: claudeAuthStatus,
onLogin: () => onProviderLogin('claude'), onLogin: onClaudeLogin,
}, },
cursor: { cursor: {
authStatus: providerAuthStatus.cursor, authStatus: cursorAuthStatus,
onLogin: () => onProviderLogin('cursor'), onLogin: onCursorLogin,
}, },
codex: { codex: {
authStatus: providerAuthStatus.codex, authStatus: codexAuthStatus,
onLogin: () => onProviderLogin('codex'), onLogin: onCodexLogin,
}, },
gemini: { gemini: {
authStatus: providerAuthStatus.gemini, authStatus: geminiAuthStatus,
onLogin: () => onProviderLogin('gemini'), onLogin: onGeminiLogin,
}, },
}), [ }), [
onProviderLogin, claudeAuthStatus,
providerAuthStatus.claude, codexAuthStatus,
providerAuthStatus.codex, cursorAuthStatus,
providerAuthStatus.cursor, geminiAuthStatus,
providerAuthStatus.gemini, onClaudeLogin,
onCodexLogin,
onCursorLogin,
onGeminiLogin,
]); ]);
return ( return (

View File

@@ -17,11 +17,16 @@ export type AgentContext = {
}; };
export type AgentContextByProvider = Record<AgentProvider, AgentContext>; export type AgentContextByProvider = Record<AgentProvider, AgentContext>;
export type ProviderAuthStatusByProvider = Record<AgentProvider, AuthStatus>;
export type AgentsSettingsTabProps = { export type AgentsSettingsTabProps = {
providerAuthStatus: ProviderAuthStatusByProvider; claudeAuthStatus: AuthStatus;
onProviderLogin: (provider: AgentProvider) => void; cursorAuthStatus: AuthStatus;
codexAuthStatus: AuthStatus;
geminiAuthStatus: AuthStatus;
onClaudeLogin: () => void;
onCursorLogin: () => void;
onCodexLogin: () => void;
onGeminiLogin: () => void;
claudePermissions: ClaudePermissionsState; claudePermissions: ClaudePermissionsState;
onClaudePermissionsChange: (value: ClaudePermissionsState) => void; onClaudePermissionsChange: (value: ClaudePermissionsState) => void;
cursorPermissions: CursorPermissionsState; cursorPermissions: CursorPermissionsState;

View File

@@ -2,7 +2,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import type React from 'react'; import type React from 'react';
import type { TFunction } from 'i18next'; import type { TFunction } from 'i18next';
import { api } from '../../../utils/api'; import { api } from '../../../utils/api';
import type { Project, ProjectSession, LLMProvider } from '../../../types/app'; import type { Project, ProjectSession, SessionProvider } from '../../../types/app';
import type { import type {
AdditionalSessionsByProject, AdditionalSessionsByProject,
DeleteProjectConfirmation, DeleteProjectConfirmation,
@@ -545,7 +545,7 @@ export function useSidebarController({
}, [onRefresh]); }, [onRefresh]);
const updateSessionSummary = useCallback( const updateSessionSummary = useCallback(
async (_projectName: string, sessionId: string, summary: string, provider: LLMProvider) => { async (_projectName: string, sessionId: string, summary: string, provider: SessionProvider) => {
const trimmed = summary.trim(); const trimmed = summary.trim();
if (!trimmed) { if (!trimmed) {
setEditingSession(null); setEditingSession(null);

View File

@@ -1,9 +1,9 @@
import type { LoadingProgress, Project, ProjectSession, LLMProvider } from '../../../types/app'; import type { LoadingProgress, Project, ProjectSession, SessionProvider } from '../../../types/app';
export type ProjectSortOrder = 'name' | 'date'; export type ProjectSortOrder = 'name' | 'date';
export type SessionWithProvider = ProjectSession & { export type SessionWithProvider = ProjectSession & {
__provider: LLMProvider; __provider: SessionProvider;
}; };
export type AdditionalSessionsByProject = Record<string, ProjectSession[]>; export type AdditionalSessionsByProject = Record<string, ProjectSession[]>;
@@ -18,7 +18,7 @@ export type SessionDeleteConfirmation = {
projectName: string; projectName: string;
sessionId: string; sessionId: string;
sessionTitle: string; sessionTitle: string;
provider: LLMProvider; provider: SessionProvider;
}; };
export type SidebarProps = { export type SidebarProps = {

View File

@@ -6,7 +6,7 @@ import { useUiPreferences } from '../../../hooks/useUiPreferences';
import { useSidebarController } from '../hooks/useSidebarController'; import { useSidebarController } from '../hooks/useSidebarController';
import { useTaskMaster } from '../../../contexts/TaskMasterContext'; import { useTaskMaster } from '../../../contexts/TaskMasterContext';
import { useTasksSettings } from '../../../contexts/TasksSettingsContext'; import { useTasksSettings } from '../../../contexts/TasksSettingsContext';
import type { Project, LLMProvider } from '../../../types/app'; import type { Project, SessionProvider } from '../../../types/app';
import type { MCPServerStatus, SidebarProps } from '../types/types'; import type { MCPServerStatus, SidebarProps } from '../types/types';
import SidebarCollapsed from './subcomponents/SidebarCollapsed'; import SidebarCollapsed from './subcomponents/SidebarCollapsed';
import SidebarContent from './subcomponents/SidebarContent'; import SidebarContent from './subcomponents/SidebarContent';
@@ -177,7 +177,7 @@ function Sidebar({
setEditingSession(null); setEditingSession(null);
setEditingSessionName(''); setEditingSessionName('');
}, },
onSaveEditingSession: (projectName: string, sessionId: string, summary: string, provider: LLMProvider) => { onSaveEditingSession: (projectName: string, sessionId: string, summary: string, provider: SessionProvider) => {
void updateSessionSummary(projectName, sessionId, summary, provider); void updateSessionSummary(projectName, sessionId, summary, provider);
}, },
t, t,
@@ -235,7 +235,7 @@ function Sidebar({
isSearching={isSearching} isSearching={isSearching}
searchProgress={searchProgress} searchProgress={searchProgress}
onConversationResultClick={(projectName: string, sessionId: string, provider: string, messageTimestamp?: string | null, messageSnippet?: string | null) => { onConversationResultClick={(projectName: string, sessionId: string, provider: string, messageTimestamp?: string | null, messageSnippet?: string | null) => {
const resolvedProvider = (provider || 'claude') as LLMProvider; const resolvedProvider = (provider || 'claude') as SessionProvider;
const project = projects.find(p => p.name === projectName); const project = projects.find(p => p.name === projectName);
const searchTarget = { __searchTargetTimestamp: messageTimestamp || null, __searchTargetSnippet: messageSnippet || null }; const searchTarget = { __searchTargetTimestamp: messageTimestamp || null, __searchTargetSnippet: messageSnippet || null };
const sessionObj = { const sessionObj = {

View File

@@ -2,7 +2,7 @@ import { Check, ChevronDown, ChevronRight, Edit3, Folder, FolderOpen, Star, Tras
import type { TFunction } from 'i18next'; import type { TFunction } from 'i18next';
import { Button } from '../../../../shared/view/ui'; import { Button } from '../../../../shared/view/ui';
import { cn } from '../../../../lib/utils'; import { cn } from '../../../../lib/utils';
import type { Project, ProjectSession, LLMProvider } from '../../../../types/app'; import type { Project, ProjectSession, SessionProvider } from '../../../../types/app';
import type { MCPServerStatus, SessionWithProvider } from '../../types/types'; import type { MCPServerStatus, SessionWithProvider } from '../../types/types';
import { getTaskIndicatorStatus } from '../../utils/utils'; import { getTaskIndicatorStatus } from '../../utils/utils';
import TaskIndicator from './TaskIndicator'; import TaskIndicator from './TaskIndicator';
@@ -38,14 +38,14 @@ type SidebarProjectItemProps = {
projectName: string, projectName: string,
sessionId: string, sessionId: string,
sessionTitle: string, sessionTitle: string,
provider: LLMProvider, provider: SessionProvider,
) => void; ) => void;
onLoadMoreSessions: (project: Project) => void; onLoadMoreSessions: (project: Project) => void;
onNewSession: (project: Project) => void; onNewSession: (project: Project) => void;
onEditingSessionNameChange: (value: string) => void; onEditingSessionNameChange: (value: string) => void;
onStartEditingSession: (sessionId: string, initialName: string) => void; onStartEditingSession: (sessionId: string, initialName: string) => void;
onCancelEditingSession: () => void; onCancelEditingSession: () => void;
onSaveEditingSession: (projectName: string, sessionId: string, summary: string, provider: LLMProvider) => void; onSaveEditingSession: (projectName: string, sessionId: string, summary: string, provider: SessionProvider) => void;
t: TFunction; t: TFunction;
}; };

View File

@@ -1,6 +1,6 @@
import { useEffect } from 'react'; import { useEffect } from 'react';
import type { TFunction } from 'i18next'; import type { TFunction } from 'i18next';
import type { LoadingProgress, Project, ProjectSession, LLMProvider } from '../../../../types/app'; import type { LoadingProgress, Project, ProjectSession, SessionProvider } from '../../../../types/app';
import type { import type {
LoadingSessionsByProject, LoadingSessionsByProject,
MCPServerStatus, MCPServerStatus,
@@ -42,14 +42,14 @@ export type SidebarProjectListProps = {
projectName: string, projectName: string,
sessionId: string, sessionId: string,
sessionTitle: string, sessionTitle: string,
provider: LLMProvider, provider: SessionProvider,
) => void; ) => void;
onLoadMoreSessions: (project: Project) => void; onLoadMoreSessions: (project: Project) => void;
onNewSession: (project: Project) => void; onNewSession: (project: Project) => void;
onEditingSessionNameChange: (value: string) => void; onEditingSessionNameChange: (value: string) => void;
onStartEditingSession: (sessionId: string, initialName: string) => void; onStartEditingSession: (sessionId: string, initialName: string) => void;
onCancelEditingSession: () => void; onCancelEditingSession: () => void;
onSaveEditingSession: (projectName: string, sessionId: string, summary: string, provider: LLMProvider) => void; onSaveEditingSession: (projectName: string, sessionId: string, summary: string, provider: SessionProvider) => void;
t: TFunction; t: TFunction;
}; };

View File

@@ -1,7 +1,7 @@
import { ChevronDown, Plus } from 'lucide-react'; import { ChevronDown, Plus } from 'lucide-react';
import type { TFunction } from 'i18next'; import type { TFunction } from 'i18next';
import { Button } from '../../../../shared/view/ui'; import { Button } from '../../../../shared/view/ui';
import type { Project, ProjectSession, LLMProvider } from '../../../../types/app'; import type { Project, ProjectSession, SessionProvider } from '../../../../types/app';
import type { SessionWithProvider } from '../../types/types'; import type { SessionWithProvider } from '../../types/types';
import SidebarSessionItem from './SidebarSessionItem'; import SidebarSessionItem from './SidebarSessionItem';
@@ -18,14 +18,14 @@ type SidebarProjectSessionsProps = {
onEditingSessionNameChange: (value: string) => void; onEditingSessionNameChange: (value: string) => void;
onStartEditingSession: (sessionId: string, initialName: string) => void; onStartEditingSession: (sessionId: string, initialName: string) => void;
onCancelEditingSession: () => void; onCancelEditingSession: () => void;
onSaveEditingSession: (projectName: string, sessionId: string, summary: string, provider: LLMProvider) => void; onSaveEditingSession: (projectName: string, sessionId: string, summary: string, provider: SessionProvider) => void;
onProjectSelect: (project: Project) => void; onProjectSelect: (project: Project) => void;
onSessionSelect: (session: SessionWithProvider, projectName: string) => void; onSessionSelect: (session: SessionWithProvider, projectName: string) => void;
onDeleteSession: ( onDeleteSession: (
projectName: string, projectName: string,
sessionId: string, sessionId: string,
sessionTitle: string, sessionTitle: string,
provider: LLMProvider, provider: SessionProvider,
) => void; ) => void;
onLoadMoreSessions: (project: Project) => void; onLoadMoreSessions: (project: Project) => void;
onNewSession: (project: Project) => void; onNewSession: (project: Project) => void;

View File

@@ -3,7 +3,7 @@ import type { TFunction } from 'i18next';
import { Badge, Button } from '../../../../shared/view/ui'; import { Badge, Button } from '../../../../shared/view/ui';
import { cn } from '../../../../lib/utils'; import { cn } from '../../../../lib/utils';
import { formatTimeAgo } from '../../../../utils/dateUtils'; import { formatTimeAgo } from '../../../../utils/dateUtils';
import type { Project, ProjectSession, LLMProvider } from '../../../../types/app'; import type { Project, ProjectSession, SessionProvider } from '../../../../types/app';
import type { SessionWithProvider } from '../../types/types'; import type { SessionWithProvider } from '../../types/types';
import { createSessionViewModel } from '../../utils/utils'; import { createSessionViewModel } from '../../utils/utils';
import SessionProviderLogo from '../../../llm-logo-provider/SessionProviderLogo'; import SessionProviderLogo from '../../../llm-logo-provider/SessionProviderLogo';
@@ -18,14 +18,14 @@ type SidebarSessionItemProps = {
onEditingSessionNameChange: (value: string) => void; onEditingSessionNameChange: (value: string) => void;
onStartEditingSession: (sessionId: string, initialName: string) => void; onStartEditingSession: (sessionId: string, initialName: string) => void;
onCancelEditingSession: () => void; onCancelEditingSession: () => void;
onSaveEditingSession: (projectName: string, sessionId: string, summary: string, provider: LLMProvider) => void; onSaveEditingSession: (projectName: string, sessionId: string, summary: string, provider: SessionProvider) => void;
onProjectSelect: (project: Project) => void; onProjectSelect: (project: Project) => void;
onSessionSelect: (session: SessionWithProvider, projectName: string) => void; onSessionSelect: (session: SessionWithProvider, projectName: string) => void;
onDeleteSession: ( onDeleteSession: (
projectName: string, projectName: string,
sessionId: string, sessionId: string,
sessionTitle: string, sessionTitle: string,
provider: LLMProvider, provider: SessionProvider,
) => void; ) => void;
t: TFunction; t: TFunction;
}; };

View File

@@ -3,15 +3,3 @@
* Indicates if the app is running in Platform mode (hosted) or OSS mode (self-hosted) * Indicates if the app is running in Platform mode (hosted) or OSS mode (self-hosted)
*/ */
export const IS_PLATFORM = import.meta.env.VITE_IS_PLATFORM === 'true'; export const IS_PLATFORM = import.meta.env.VITE_IS_PLATFORM === 'true';
/**
* For empty shell instances where no project is provided,
* we use a default project object to ensure the shell can still function.
* This prevents errors related to missing project data.
*/
export const DEFAULT_PROJECT_FOR_EMPTY_SHELL = {
name: 'default',
displayName: 'default',
fullPath: IS_PLATFORM ? '/workspace' : '',
path: IS_PLATFORM ? '/workspace' : '',
};

View File

@@ -8,7 +8,7 @@
*/ */
import { useCallback, useMemo, useRef, useState } from 'react'; import { useCallback, useMemo, useRef, useState } from 'react';
import type { LLMProvider } from '../types/app'; import type { SessionProvider } from '../types/app';
import { authenticatedFetch } from '../utils/api'; import { authenticatedFetch } from '../utils/api';
// ─── NormalizedMessage (mirrors server/adapters/types.js) ──────────────────── // ─── NormalizedMessage (mirrors server/adapters/types.js) ────────────────────
@@ -33,7 +33,7 @@ export interface NormalizedMessage {
id: string; id: string;
sessionId: string; sessionId: string;
timestamp: string; timestamp: string;
provider: LLMProvider; provider: SessionProvider;
kind: MessageKind; kind: MessageKind;
// kind-specific fields (flat for simplicity) // kind-specific fields (flat for simplicity)
@@ -169,7 +169,7 @@ export function useSessionStore() {
const fetchFromServer = useCallback(async ( const fetchFromServer = useCallback(async (
sessionId: string, sessionId: string,
opts: { opts: {
provider?: LLMProvider; provider?: SessionProvider;
projectName?: string; projectName?: string;
projectPath?: string; projectPath?: string;
limit?: number | null; limit?: number | null;
@@ -228,7 +228,7 @@ export function useSessionStore() {
const fetchMore = useCallback(async ( const fetchMore = useCallback(async (
sessionId: string, sessionId: string,
opts: { opts: {
provider?: LLMProvider; provider?: SessionProvider;
projectName?: string; projectName?: string;
projectPath?: string; projectPath?: string;
limit?: number; limit?: number;
@@ -303,7 +303,7 @@ export function useSessionStore() {
const refreshFromServer = useCallback(async ( const refreshFromServer = useCallback(async (
sessionId: string, sessionId: string,
opts: { opts: {
provider?: LLMProvider; provider?: SessionProvider;
projectName?: string; projectName?: string;
projectPath?: string; projectPath?: string;
} = {}, } = {},
@@ -357,7 +357,7 @@ export function useSessionStore() {
* Update or create a streaming message (accumulated text so far). * Update or create a streaming message (accumulated text so far).
* Uses a well-known ID so subsequent calls replace the same message. * Uses a well-known ID so subsequent calls replace the same message.
*/ */
const updateStreaming = useCallback((sessionId: string, accumulatedText: string, msgProvider: LLMProvider) => { const updateStreaming = useCallback((sessionId: string, accumulatedText: string, msgProvider: SessionProvider) => {
const slot = getSlot(sessionId); const slot = getSlot(sessionId);
const streamId = `__streaming_${sessionId}`; const streamId = `__streaming_${sessionId}`;
const msg: NormalizedMessage = { const msg: NormalizedMessage = {

View File

@@ -1,4 +1,4 @@
export type LLMProvider = 'claude' | 'cursor' | 'codex' | 'gemini'; export type SessionProvider = 'claude' | 'cursor' | 'codex' | 'gemini';
export type AppTab = 'chat' | 'files' | 'shell' | 'git' | 'tasks' | 'preview' | `plugin:${string}`; export type AppTab = 'chat' | 'files' | 'shell' | 'git' | 'tasks' | 'preview' | `plugin:${string}`;
@@ -12,7 +12,7 @@ export interface ProjectSession {
updated_at?: string; updated_at?: string;
lastActivity?: string; lastActivity?: string;
messageCount?: number; messageCount?: number;
__provider?: LLMProvider; __provider?: SessionProvider;
__projectName?: string; __projectName?: string;
[key: string]: unknown; [key: string]: unknown;
} }

View File

@@ -4,13 +4,6 @@
"useDefineForClassFields": true, "useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"], "lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext", "module": "ESNext",
"baseUrl": ".",
"paths": {
// The frontend keeps "@" mapped to /src.
// The backend gets its own "@" mapping in server/tsconfig.json so both sides can use
// the same alias name without sharing one compiler configuration.
"@/*": ["src/*"]
},
"skipLibCheck": true, "skipLibCheck": true,
"moduleResolution": "Bundler", "moduleResolution": "Bundler",
"resolveJsonModule": true, "resolveJsonModule": true,
@@ -21,8 +14,7 @@
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"allowJs": true, "allowJs": true,
// "checkJs": true, // "checkJs": true,
"types": ["vite/client"], "types": ["vite/client"]
"ignoreDeprecations": "5.0"
}, },
"include": ["src", "shared", "vite.config.js"] "include": ["src", "shared", "vite.config.js"]
} }

View File

@@ -1,4 +1,3 @@
import { fileURLToPath, URL } from 'node:url'
import { defineConfig, loadEnv } from 'vite' import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react' import react from '@vitejs/plugin-react'
import { getConnectableHost, normalizeLoopbackHost } from './shared/networkHosts.js' import { getConnectableHost, normalizeLoopbackHost } from './shared/networkHosts.js'
@@ -20,11 +19,6 @@ export default defineConfig(({ mode }) => {
return { return {
plugins: [react()], plugins: [react()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
server: { server: {
host, host,
port: parseInt(env.VITE_PORT) || 5173, port: parseInt(env.VITE_PORT) || 5173,