diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..887e0614 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,444 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + # Discover all projects in the repository and filter by changed files + discover: + runs-on: ubuntu-latest + outputs: + node-projects: ${{ steps.filter-projects.outputs.node-projects }} + poetry-projects: ${{ steps.filter-projects.outputs.poetry-projects }} + uv-projects: ${{ steps.filter-projects.outputs.uv-projects }} + pip-projects: ${{ steps.filter-projects.outputs.pip-projects }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get changed files + id: changed-files + run: | + if [ "${{ github.event_name }}" == "pull_request" ]; then + # For PRs, compare against the base branch + CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | tr '\n' ' ') + else + # For pushes, compare against the previous commit + CHANGED_FILES=$(git diff --name-only HEAD~1...HEAD 2>/dev/null | tr '\n' ' ' || echo "") + fi + echo "Changed files: $CHANGED_FILES" + echo "files=$CHANGED_FILES" >> $GITHUB_OUTPUT + + - name: Find all projects + id: find-projects + run: | + # Find Node.js projects (have package.json but not in node_modules) + # Exclude workspace member packages (those listed in a parent package.json workspaces field) + NODE_PROJECTS=$(find . -name "package.json" -not -path "*/node_modules/*" -exec dirname {} \; | while read dir; do + # Check if this directory is a workspace member of a parent + is_workspace_member=false + parent_dir=$(dirname "$dir") + while [ "$parent_dir" != "." ] && [ "$parent_dir" != "/" ]; do + if [ -f "$parent_dir/package.json" ]; then + # Check if parent has workspaces field that includes this dir + rel_path=$(echo "$dir" | sed "s|^$parent_dir/||") + if grep -q '"workspaces"' "$parent_dir/package.json" 2>/dev/null; then + # This is a simplified check - if parent has workspaces, skip this dir + is_workspace_member=true + break + fi + fi + parent_dir=$(dirname "$parent_dir") + done + if [ "$is_workspace_member" = "false" ]; then + echo "$dir" + fi + done | sort -u | jq -R -s -c 'split("\n") | map(select(length > 0))') + echo "node-projects=$NODE_PROJECTS" >> $GITHUB_OUTPUT + + # Find Poetry projects (have poetry.lock) + POETRY_PROJECTS=$(find . -name "poetry.lock" -exec dirname {} \; | sort -u | jq -R -s -c 'split("\n") | map(select(length > 0))') + echo "poetry-projects=$POETRY_PROJECTS" >> $GITHUB_OUTPUT + + # Find uv projects (have uv.lock) + UV_PROJECTS=$(find . -name "uv.lock" -exec dirname {} \; | sort -u | jq -R -s -c 'split("\n") | map(select(length > 0))') + echo "uv-projects=$UV_PROJECTS" >> $GITHUB_OUTPUT + + # Find pip projects (have requirements.txt but no poetry.lock or uv.lock) + PIP_PROJECTS=$(find . -name "requirements.txt" -exec dirname {} \; | while read dir; do + if [ ! -f "$dir/poetry.lock" ] && [ ! -f "$dir/uv.lock" ]; then + echo "$dir" + fi + done | sort -u | jq -R -s -c 'split("\n") | map(select(length > 0))') + echo "pip-projects=$PIP_PROJECTS" >> $GITHUB_OUTPUT + + - name: Filter projects by changed files + id: filter-projects + run: | + CHANGED_FILES="${{ steps.changed-files.outputs.files }}" + + echo "DEBUG: Changed files = '$CHANGED_FILES'" + + # Store the project lists in variables for proper quoting + NODE_ALL='${{ steps.find-projects.outputs.node-projects }}' + POETRY_ALL='${{ steps.find-projects.outputs.poetry-projects }}' + UV_ALL='${{ steps.find-projects.outputs.uv-projects }}' + PIP_ALL='${{ steps.find-projects.outputs.pip-projects }}' + + echo "DEBUG: NODE_ALL = $NODE_ALL" + echo "DEBUG: POETRY_ALL = $POETRY_ALL" + echo "DEBUG: UV_ALL = $UV_ALL" + echo "DEBUG: PIP_ALL = $PIP_ALL" + + # If no changed files detected (e.g., first commit), run all projects + if [ -z "$CHANGED_FILES" ]; then + echo "No changed files detected, running all projects" + echo "node-projects=$NODE_ALL" >> $GITHUB_OUTPUT + echo "poetry-projects=$POETRY_ALL" >> $GITHUB_OUTPUT + echo "uv-projects=$UV_ALL" >> $GITHUB_OUTPUT + echo "pip-projects=$PIP_ALL" >> $GITHUB_OUTPUT + exit 0 + fi + + # Check if CI workflow itself changed - if so, run all projects + if echo "$CHANGED_FILES" | grep -qE "(^|[[:space:]])\.github/workflows/ci\.yml([[:space:]]|$)"; then + echo "CI workflow changed, running all projects" + echo "node-projects=$NODE_ALL" >> $GITHUB_OUTPUT + echo "poetry-projects=$POETRY_ALL" >> $GITHUB_OUTPUT + echo "uv-projects=$UV_ALL" >> $GITHUB_OUTPUT + echo "pip-projects=$PIP_ALL" >> $GITHUB_OUTPUT + exit 0 + fi + + # Filter projects based on changed files + filter_projects() { + local projects_json="$1" + local matched_projects="" + + # Parse JSON array and check each project + while IFS= read -r project; do + [ -z "$project" ] && continue + + # Remove leading ./ for comparison + project_path="${project#./}" + + # Check if any changed file starts with this project path + for changed_file in $CHANGED_FILES; do + changed_file_clean="${changed_file#./}" + if [[ "$changed_file_clean" == "$project_path"* ]]; then + if [ -z "$matched_projects" ]; then + matched_projects="\"$project\"" + else + matched_projects="$matched_projects,\"$project\"" + fi + break + fi + done + done < <(echo "$projects_json" | jq -r '.[]') + + # Return as JSON array + echo "[$matched_projects]" + } + + # Filter each project type + NODE_FILTERED=$(filter_projects "$NODE_ALL") + POETRY_FILTERED=$(filter_projects "$POETRY_ALL") + UV_FILTERED=$(filter_projects "$UV_ALL") + PIP_FILTERED=$(filter_projects "$PIP_ALL") + + echo "node-projects=$NODE_FILTERED" >> $GITHUB_OUTPUT + echo "poetry-projects=$POETRY_FILTERED" >> $GITHUB_OUTPUT + echo "uv-projects=$UV_FILTERED" >> $GITHUB_OUTPUT + echo "pip-projects=$PIP_FILTERED" >> $GITHUB_OUTPUT + + # Debug output + echo "Filtered Node.js projects: $NODE_FILTERED" + echo "Filtered Poetry projects: $POETRY_FILTERED" + echo "Filtered uv projects: $UV_FILTERED" + echo "Filtered pip projects: $PIP_FILTERED" + + # Build and lint Node.js projects + node: + needs: discover + if: ${{ needs.discover.outputs.node-projects != '[]' && needs.discover.outputs.node-projects != '' }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + project: ${{ fromJson(needs.discover.outputs.node-projects) }} + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: Get npm cache directory + id: npm-cache-dir + shell: bash + run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT + + - name: Cache npm dependencies + uses: actions/cache@v4 + with: + path: ${{ steps.npm-cache-dir.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles(format('{0}/package-lock.json', matrix.project), format('{0}/package.json', matrix.project)) }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install dependencies + working-directory: ${{ matrix.project }} + run: npm install + + - name: Setup environment + working-directory: ${{ matrix.project }} + run: | + # Copy .env.example to .env if .env doesn't exist + if [ -f ".env.example" ] && [ ! -f ".env" ]; then + echo "Copying .env.example to .env..." + cp .env.example .env + fi + + - name: Build + working-directory: ${{ matrix.project }} + run: | + # Check if build script exists in package.json + if grep -q '"build"' package.json 2>/dev/null; then + echo "Running build..." + npm run build + else + echo "No build script found, skipping..." + fi + + - name: Lint + working-directory: ${{ matrix.project }} + run: | + # Check if lint script exists in package.json + if grep -q '"lint"' package.json 2>/dev/null; then + echo "Running lint..." + npm run lint + else + echo "No lint script found, skipping..." + fi + + # Build and lint Poetry projects + poetry: + needs: discover + if: ${{ needs.discover.outputs.poetry-projects != '[]' && needs.discover.outputs.poetry-projects != '' }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + project: ${{ fromJson(needs.discover.outputs.poetry-projects) }} + steps: + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + version: latest + virtualenvs-create: true + virtualenvs-in-project: true + + - name: Cache Poetry dependencies + uses: actions/cache@v4 + with: + path: ${{ matrix.project }}/.venv + key: ${{ runner.os }}-poetry-${{ hashFiles(format('{0}/poetry.lock', matrix.project)) }} + restore-keys: | + ${{ runner.os }}-poetry- + + - name: Install dependencies + working-directory: ${{ matrix.project }} + run: poetry install --no-interaction + + - name: Setup environment + working-directory: ${{ matrix.project }} + run: | + # Copy .env.example to .env if .env doesn't exist + if [ -f ".env.example" ] && [ ! -f ".env" ]; then + echo "Copying .env.example to .env..." + cp .env.example .env + fi + + - name: Lint with ruff (if available) + working-directory: ${{ matrix.project }} + run: | + if poetry run python -c "import ruff" 2>/dev/null; then + echo "Running ruff..." + poetry run ruff check . + elif poetry run python -c "import flake8" 2>/dev/null; then + echo "Running flake8..." + poetry run flake8 . + else + echo "No Python linter found, skipping..." + fi + + - name: Type check with mypy (if available) + working-directory: ${{ matrix.project }} + run: | + if poetry run python -c "import mypy" 2>/dev/null; then + echo "Running mypy..." + poetry run mypy . + else + echo "No type checker found, skipping..." + fi + + # Build and lint uv projects + uv: + needs: discover + if: ${{ needs.discover.outputs.uv-projects != '[]' && needs.discover.outputs.uv-projects != '' }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + project: ${{ fromJson(needs.discover.outputs.uv-projects) }} + steps: + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install uv + uses: astral-sh/setup-uv@v4 + + - name: Install dependencies + working-directory: ${{ matrix.project }} + run: uv sync + + - name: Setup environment + working-directory: ${{ matrix.project }} + run: | + # Copy .env.example to .env if .env doesn't exist + if [ -f ".env.example" ] && [ ! -f ".env" ]; then + echo "Copying .env.example to .env..." + cp .env.example .env + fi + + - name: Lint with ruff (if available) + working-directory: ${{ matrix.project }} + run: | + if uv run python -c "import ruff" 2>/dev/null; then + echo "Running ruff..." + uv run ruff check . + elif uv run python -c "import flake8" 2>/dev/null; then + echo "Running flake8..." + uv run flake8 . + else + echo "No Python linter found, skipping..." + fi + + - name: Type check with mypy (if available) + working-directory: ${{ matrix.project }} + run: | + if uv run python -c "import mypy" 2>/dev/null; then + echo "Running mypy..." + uv run mypy . + else + echo "No type checker found, skipping..." + fi + + # Build and lint pip projects + pip: + needs: discover + if: ${{ needs.discover.outputs.pip-projects != '[]' && needs.discover.outputs.pip-projects != '' }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + project: ${{ fromJson(needs.discover.outputs.pip-projects) }} + steps: + - uses: actions/checkout@v4 + + - name: Detect Python version + id: python-version + working-directory: ${{ matrix.project }} + run: | + if [ -f ".python-version" ]; then + VERSION=$(cat .python-version | tr -d '[:space:]') + echo "version=$VERSION" >> $GITHUB_OUTPUT + else + echo "version=3.12" >> $GITHUB_OUTPUT + fi + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ steps.python-version.outputs.version }} + + - name: Cache pip dependencies + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles(format('{0}/requirements.txt', matrix.project)) }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Install dependencies + working-directory: ${{ matrix.project }} + run: | + python -m pip install --upgrade pip + # Use project-level pip.conf if it exists + if [ -f "pip.conf" ]; then + export PIP_CONFIG_FILE="$(pwd)/pip.conf" + fi + pip install -r requirements.txt + + - name: Setup environment + working-directory: ${{ matrix.project }} + run: | + # Copy .env.example to .env if .env doesn't exist + if [ -f ".env.example" ] && [ ! -f ".env" ]; then + echo "Copying .env.example to .env..." + cp .env.example .env + fi + + - name: Install linters + run: pip install ruff + + - name: Lint with ruff + working-directory: ${{ matrix.project }} + run: | + echo "Running ruff..." + ruff check . + + # Summary job to ensure all checks passed + ci-success: + needs: [node, poetry, uv, pip] + if: always() + runs-on: ubuntu-latest + steps: + - name: Check all jobs passed + run: | + # Check each job result - 'skipped' is OK (no projects to build) + # 'success' is OK, 'failure' is not OK + NODE_RESULT="${{ needs.node.result }}" + POETRY_RESULT="${{ needs.poetry.result }}" + UV_RESULT="${{ needs.uv.result }}" + PIP_RESULT="${{ needs.pip.result }}" + + echo "Node job result: $NODE_RESULT" + echo "Poetry job result: $POETRY_RESULT" + echo "uv job result: $UV_RESULT" + echo "pip job result: $PIP_RESULT" + + if [ "$NODE_RESULT" == "failure" ] || \ + [ "$POETRY_RESULT" == "failure" ] || \ + [ "$UV_RESULT" == "failure" ] || \ + [ "$PIP_RESULT" == "failure" ]; then + echo "One or more jobs failed" + exit 1 + fi + echo "All CI checks passed!" diff --git a/asynchronous-authorization/langchain-fastapi-py/backend/uv.toml b/asynchronous-authorization/langchain-fastapi-py/backend/uv.toml new file mode 100644 index 00000000..7b83065b --- /dev/null +++ b/asynchronous-authorization/langchain-fastapi-py/backend/uv.toml @@ -0,0 +1 @@ +index-url = "https://pypi.org/simple/" diff --git a/asynchronous-authorization/langchain-fastapi-py/frontend/eslint.config.js b/asynchronous-authorization/langchain-fastapi-py/frontend/eslint.config.js index d94e7deb..e14f09f5 100644 --- a/asynchronous-authorization/langchain-fastapi-py/frontend/eslint.config.js +++ b/asynchronous-authorization/langchain-fastapi-py/frontend/eslint.config.js @@ -19,5 +19,9 @@ export default tseslint.config([ ecmaVersion: 2020, globals: globals.browser, }, + rules: { + '@typescript-eslint/no-explicit-any': 'warn', + 'react-refresh/only-export-components': 'warn', + }, }, ]) diff --git a/asynchronous-authorization/langchain-fastapi-py/frontend/package-lock.json b/asynchronous-authorization/langchain-fastapi-py/frontend/package-lock.json index d04b87de..b725f8f0 100644 --- a/asynchronous-authorization/langchain-fastapi-py/frontend/package-lock.json +++ b/asynchronous-authorization/langchain-fastapi-py/frontend/package-lock.json @@ -39,6 +39,7 @@ }, "devDependencies": { "@eslint/js": "^9.30.1", + "@types/node": "^22.10.0", "@types/react": "^19.1.8", "@types/react-dom": "^19.1.6", "@vitejs/plugin-react": "^4.6.0", @@ -2544,6 +2545,16 @@ "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", "license": "MIT" }, + "node_modules/@types/node": { + "version": "22.19.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.2.tgz", + "integrity": "sha512-LPM2G3Syo1GLzXLGJAKdqoU35XvrWzGJ21/7sgZTUpbkBaOasTj8tjwn6w+hCkqaa1TfJ/w67rJSwYItlJ2mYw==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, "node_modules/@types/react": { "version": "19.2.2", "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.2.tgz", @@ -6465,6 +6476,13 @@ "node": "*" } }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "devOptional": true, + "license": "MIT" + }, "node_modules/unified": { "version": "11.0.5", "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz", diff --git a/asynchronous-authorization/langchain-fastapi-py/frontend/package.json b/asynchronous-authorization/langchain-fastapi-py/frontend/package.json index 13b2176b..5e832de9 100644 --- a/asynchronous-authorization/langchain-fastapi-py/frontend/package.json +++ b/asynchronous-authorization/langchain-fastapi-py/frontend/package.json @@ -41,6 +41,7 @@ }, "devDependencies": { "@eslint/js": "^9.30.1", + "@types/node": "^22.10.0", "@types/react": "^19.1.8", "@types/react-dom": "^19.1.6", "@vitejs/plugin-react": "^4.6.0", diff --git a/asynchronous-authorization/langchain-fastapi-py/frontend/src/components/chat-window.tsx b/asynchronous-authorization/langchain-fastapi-py/frontend/src/components/chat-window.tsx index a3d32c27..9974e52b 100644 --- a/asynchronous-authorization/langchain-fastapi-py/frontend/src/components/chat-window.tsx +++ b/asynchronous-authorization/langchain-fastapi-py/frontend/src/components/chat-window.tsx @@ -19,7 +19,7 @@ function ChatMessages(props: { }) { return (
- {props.messages.map((m, i) => { + {props.messages.map((m) => { return ( ); @@ -124,7 +124,7 @@ export function ChatWindow(props: { const [threadId, setThreadId] = useQueryState("threadId"); const [input, setInput] = useState(""); - const fetchWithCredentials = (url, options = {}) => { + const fetchWithCredentials = (url: string, options: RequestInit = {}) => { return fetch(url, { ...options, credentials: "include", diff --git a/asynchronous-authorization/langchain-fastapi-py/frontend/tsconfig.node.json b/asynchronous-authorization/langchain-fastapi-py/frontend/tsconfig.node.json index f85a3990..351d6b68 100644 --- a/asynchronous-authorization/langchain-fastapi-py/frontend/tsconfig.node.json +++ b/asynchronous-authorization/langchain-fastapi-py/frontend/tsconfig.node.json @@ -5,6 +5,7 @@ "lib": ["ES2023"], "module": "ESNext", "skipLibCheck": true, + "types": ["node"], /* Bundler mode */ "moduleResolution": "bundler", diff --git a/asynchronous-authorization/langchain-fastapi-py/frontend/vite.config.ts b/asynchronous-authorization/langchain-fastapi-py/frontend/vite.config.ts index aa58c10f..d54ca6ae 100644 --- a/asynchronous-authorization/langchain-fastapi-py/frontend/vite.config.ts +++ b/asynchronous-authorization/langchain-fastapi-py/frontend/vite.config.ts @@ -1,4 +1,4 @@ -import path from "path"; +import { fileURLToPath, URL } from "node:url"; import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; import tailwindcss from "@tailwindcss/vite"; @@ -8,7 +8,7 @@ export default defineConfig({ plugins: [react(), tailwindcss()], resolve: { alias: { - "@": path.resolve(__dirname, "./src"), + "@": fileURLToPath(new URL("./src", import.meta.url)), }, }, }); diff --git a/auth-for-mcp/fastmcp-mcp-customtokenexchange-python/poetry.toml b/auth-for-mcp/fastmcp-mcp-customtokenexchange-python/poetry.toml new file mode 100644 index 00000000..e028e1ce --- /dev/null +++ b/auth-for-mcp/fastmcp-mcp-customtokenexchange-python/poetry.toml @@ -0,0 +1,4 @@ +[repositories] +[repositories.pypi] +url = "https://pypi.org/simple/" +default = true diff --git a/auth-for-mcp/fastmcp-mcp-customtokenexchange-python/src/api/server.py b/auth-for-mcp/fastmcp-mcp-customtokenexchange-python/src/api/server.py index f6634b62..305bd314 100644 --- a/auth-for-mcp/fastmcp-mcp-customtokenexchange-python/src/api/server.py +++ b/auth-for-mcp/fastmcp-mcp-customtokenexchange-python/src/api/server.py @@ -60,7 +60,7 @@ async def dispatch(self, request: Request, call_next): except VerifyAccessTokenError as e: logger.info(f"Token verification failed: {e}") return self._error_response("invalid_token", str(e)) - except Exception as e: + except Exception: logger.exception("Unexpected error in middleware") return self._error_response("server_error", "Internal server error", 500) diff --git a/auth-for-mcp/fastmcp-mcp-python/poetry.toml b/auth-for-mcp/fastmcp-mcp-python/poetry.toml new file mode 100644 index 00000000..e028e1ce --- /dev/null +++ b/auth-for-mcp/fastmcp-mcp-python/poetry.toml @@ -0,0 +1,4 @@ +[repositories] +[repositories.pypi] +url = "https://pypi.org/simple/" +default = true diff --git a/auth-for-mcp/hono-mcp-js/src/tools.ts b/auth-for-mcp/hono-mcp-js/src/tools.ts index c725144e..f783537a 100644 --- a/auth-for-mcp/hono-mcp-js/src/tools.ts +++ b/auth-for-mcp/hono-mcp-js/src/tools.ts @@ -55,6 +55,7 @@ export const registerTools = ( { title: "Whoami Tool", description: "Returns the authenticated user's information", + inputSchema: emptyToolInputSchema, annotations: { readOnlyHint: false }, }, (args, extra) => diff --git a/auth-for-mcp/nextjs-mcp-js/.env.example b/auth-for-mcp/nextjs-mcp-js/.env.example index 804d31a8..005cc509 100644 --- a/auth-for-mcp/nextjs-mcp-js/.env.example +++ b/auth-for-mcp/nextjs-mcp-js/.env.example @@ -1,3 +1,3 @@ -AUTH0_DOMAIN= -AUTH0_AUDIENCE= +AUTH0_DOMAIN=example-tenant.us.auth0.com +AUTH0_AUDIENCE=http://localhost:3000/ MCP_SERVER_URL=http://localhost:3000 \ No newline at end of file diff --git a/auth-for-mcp/nextjs-mcp-js/tsconfig.json b/auth-for-mcp/nextjs-mcp-js/tsconfig.json index 05342897..6d3e4d4c 100644 --- a/auth-for-mcp/nextjs-mcp-js/tsconfig.json +++ b/auth-for-mcp/nextjs-mcp-js/tsconfig.json @@ -15,8 +15,6 @@ "skipLibCheck": true, "strict": true, "target": "ES2022", - "outDir": "dist", - "rootDir": "src", "allowJs": true, "noEmit": true, "jsx": "preserve", diff --git a/auth-for-mcp/xmcp-mcp-tokenvault-js/.env.example b/auth-for-mcp/xmcp-mcp-tokenvault-js/.env.example index 03cd73a2..0a405612 100644 --- a/auth-for-mcp/xmcp-mcp-tokenvault-js/.env.example +++ b/auth-for-mcp/xmcp-mcp-tokenvault-js/.env.example @@ -1,9 +1,10 @@ -AUTH0_DOMAIN= -AUTH0_AUDIENCE= -AUTH0_CLIENT_ID= +AUTH0_DOMAIN=your-tenant.us.auth0.com +AUTH0_AUDIENCE=http://localhost:3001/mcp +AUTH0_CLIENT_ID="{yourClientId}" + # One of the ways to authorize your client -AUTH0_CLIENT_SECRET= +AUTH0_CLIENT_SECRET="{yourClientSecret}" PORT=3001 MCP_SERVER_URL=http://localhost:3001 diff --git a/authenticate-users/langchain-fastapi-py-starter/backend/uv.toml b/authenticate-users/langchain-fastapi-py-starter/backend/uv.toml new file mode 100644 index 00000000..7b83065b --- /dev/null +++ b/authenticate-users/langchain-fastapi-py-starter/backend/uv.toml @@ -0,0 +1 @@ +index-url = "https://pypi.org/simple/" diff --git a/authenticate-users/langchain-fastapi-py-starter/frontend/eslint.config.js b/authenticate-users/langchain-fastapi-py-starter/frontend/eslint.config.js index d94e7deb..96d86130 100644 --- a/authenticate-users/langchain-fastapi-py-starter/frontend/eslint.config.js +++ b/authenticate-users/langchain-fastapi-py-starter/frontend/eslint.config.js @@ -1,23 +1,27 @@ -import js from '@eslint/js' -import globals from 'globals' -import reactHooks from 'eslint-plugin-react-hooks' -import reactRefresh from 'eslint-plugin-react-refresh' -import tseslint from 'typescript-eslint' -import { globalIgnores } from 'eslint/config' +import js from "@eslint/js"; +import globals from "globals"; +import reactHooks from "eslint-plugin-react-hooks"; +import reactRefresh from "eslint-plugin-react-refresh"; +import tseslint from "typescript-eslint"; +import { globalIgnores } from "eslint/config"; export default tseslint.config([ - globalIgnores(['dist']), + globalIgnores(["dist"]), { - files: ['**/*.{ts,tsx}'], + files: ["**/*.{ts,tsx}"], extends: [ js.configs.recommended, tseslint.configs.recommended, - reactHooks.configs['recommended-latest'], + reactHooks.configs["recommended-latest"], reactRefresh.configs.vite, ], languageOptions: { ecmaVersion: 2020, globals: globals.browser, }, + rules: { + "@typescript-eslint/no-explicit-any": "warn", + "react-refresh/only-export-components": "warn", + }, }, -]) +]); diff --git a/authenticate-users/langchain-fastapi-py-starter/frontend/package-lock.json b/authenticate-users/langchain-fastapi-py-starter/frontend/package-lock.json index 8dff276f..71419f7c 100644 --- a/authenticate-users/langchain-fastapi-py-starter/frontend/package-lock.json +++ b/authenticate-users/langchain-fastapi-py-starter/frontend/package-lock.json @@ -39,6 +39,7 @@ }, "devDependencies": { "@eslint/js": "^9.30.1", + "@types/node": "^22.10.0", "@types/react": "^19.1.8", "@types/react-dom": "^19.1.6", "@vitejs/plugin-react": "^4.6.0", @@ -2603,6 +2604,16 @@ "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", "license": "MIT" }, + "node_modules/@types/node": { + "version": "22.19.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.2.tgz", + "integrity": "sha512-LPM2G3Syo1GLzXLGJAKdqoU35XvrWzGJ21/7sgZTUpbkBaOasTj8tjwn6w+hCkqaa1TfJ/w67rJSwYItlJ2mYw==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, "node_modules/@types/react": { "version": "19.1.8", "resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.8.tgz", @@ -6523,6 +6534,13 @@ "node": "*" } }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "devOptional": true, + "license": "MIT" + }, "node_modules/unified": { "version": "11.0.5", "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz", diff --git a/authenticate-users/langchain-fastapi-py-starter/frontend/package.json b/authenticate-users/langchain-fastapi-py-starter/frontend/package.json index 13b2176b..5e832de9 100644 --- a/authenticate-users/langchain-fastapi-py-starter/frontend/package.json +++ b/authenticate-users/langchain-fastapi-py-starter/frontend/package.json @@ -41,6 +41,7 @@ }, "devDependencies": { "@eslint/js": "^9.30.1", + "@types/node": "^22.10.0", "@types/react": "^19.1.8", "@types/react-dom": "^19.1.6", "@vitejs/plugin-react": "^4.6.0", diff --git a/authenticate-users/langchain-fastapi-py-starter/frontend/src/components/chat-window.tsx b/authenticate-users/langchain-fastapi-py-starter/frontend/src/components/chat-window.tsx index a3d32c27..15ca4e0d 100644 --- a/authenticate-users/langchain-fastapi-py-starter/frontend/src/components/chat-window.tsx +++ b/authenticate-users/langchain-fastapi-py-starter/frontend/src/components/chat-window.tsx @@ -1,16 +1,16 @@ +import { ArrowDown, ArrowUpIcon, LoaderCircle } from "lucide-react"; +import { useQueryState } from "nuqs"; import { useState } from "react"; -import type { FormEvent, ReactNode } from "react"; import { toast } from "sonner"; import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom"; -import { ArrowDown, ArrowUpIcon, LoaderCircle } from "lucide-react"; -import { useQueryState } from "nuqs"; -import { useStream } from "@langchain/langgraph-sdk/react"; -import { type Message } from "@langchain/langgraph-sdk"; import { ChatMessageBubble } from "@/components/chat-message-bubble"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; +import { useStream } from "@langchain/langgraph-sdk/react"; +import type { Message } from "@langchain/langgraph-sdk"; +import type { FormEvent, ReactNode } from "react"; function ChatMessages(props: { messages: Message[]; emptyStateComponent: ReactNode; @@ -19,7 +19,7 @@ function ChatMessages(props: { }) { return (
- {props.messages.map((m, i) => { + {props.messages.map((m) => { return ( ); @@ -124,7 +124,7 @@ export function ChatWindow(props: { const [threadId, setThreadId] = useQueryState("threadId"); const [input, setInput] = useState(""); - const fetchWithCredentials = (url, options = {}) => { + const fetchWithCredentials = (url: string, options: RequestInit = {}) => { return fetch(url, { ...options, credentials: "include", @@ -163,7 +163,7 @@ export function ChatWindow(props: { { type: "human", content: input, id: "temp" }, ], }), - }, + } ); setInput(""); } diff --git a/authenticate-users/langchain-fastapi-py-starter/frontend/tsconfig.node.json b/authenticate-users/langchain-fastapi-py-starter/frontend/tsconfig.node.json index f85a3990..351d6b68 100644 --- a/authenticate-users/langchain-fastapi-py-starter/frontend/tsconfig.node.json +++ b/authenticate-users/langchain-fastapi-py-starter/frontend/tsconfig.node.json @@ -5,6 +5,7 @@ "lib": ["ES2023"], "module": "ESNext", "skipLibCheck": true, + "types": ["node"], /* Bundler mode */ "moduleResolution": "bundler", diff --git a/authenticate-users/langchain-fastapi-py-starter/frontend/vite.config.ts b/authenticate-users/langchain-fastapi-py-starter/frontend/vite.config.ts index aa58c10f..e1e6c83c 100644 --- a/authenticate-users/langchain-fastapi-py-starter/frontend/vite.config.ts +++ b/authenticate-users/langchain-fastapi-py-starter/frontend/vite.config.ts @@ -1,14 +1,15 @@ -import path from "path"; +import { fileURLToPath, URL } from "node:url"; import { defineConfig } from "vite"; -import react from "@vitejs/plugin-react"; + import tailwindcss from "@tailwindcss/vite"; +import react from "@vitejs/plugin-react"; // https://vite.dev/config/ export default defineConfig({ plugins: [react(), tailwindcss()], resolve: { alias: { - "@": path.resolve(__dirname, "./src"), + "@": fileURLToPath(new URL("./src", import.meta.url)), }, }, }); diff --git a/authenticate-users/langchain-fastapi-py/backend/uv.toml b/authenticate-users/langchain-fastapi-py/backend/uv.toml new file mode 100644 index 00000000..7b83065b --- /dev/null +++ b/authenticate-users/langchain-fastapi-py/backend/uv.toml @@ -0,0 +1 @@ +index-url = "https://pypi.org/simple/" diff --git a/authenticate-users/langchain-fastapi-py/frontend/eslint.config.js b/authenticate-users/langchain-fastapi-py/frontend/eslint.config.js index d94e7deb..858fb5e2 100644 --- a/authenticate-users/langchain-fastapi-py/frontend/eslint.config.js +++ b/authenticate-users/langchain-fastapi-py/frontend/eslint.config.js @@ -19,5 +19,11 @@ export default tseslint.config([ ecmaVersion: 2020, globals: globals.browser, }, + rules: { + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-unused-expressions': 'warn', + '@typescript-eslint/no-non-null-asserted-optional-chain': 'warn', + 'react-refresh/only-export-components': 'warn', + }, }, ]) diff --git a/authenticate-users/langchain-fastapi-py/frontend/package-lock.json b/authenticate-users/langchain-fastapi-py/frontend/package-lock.json index 16793063..d55a3bc4 100644 --- a/authenticate-users/langchain-fastapi-py/frontend/package-lock.json +++ b/authenticate-users/langchain-fastapi-py/frontend/package-lock.json @@ -40,6 +40,7 @@ }, "devDependencies": { "@eslint/js": "^9.30.1", + "@types/node": "^22.15.32", "@types/react": "^19.1.8", "@types/react-dom": "^19.1.6", "@vitejs/plugin-react": "^4.6.0", @@ -2550,6 +2551,16 @@ "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", "license": "MIT" }, + "node_modules/@types/node": { + "version": "22.19.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.2.tgz", + "integrity": "sha512-LPM2G3Syo1GLzXLGJAKdqoU35XvrWzGJ21/7sgZTUpbkBaOasTj8tjwn6w+hCkqaa1TfJ/w67rJSwYItlJ2mYw==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, "node_modules/@types/react": { "version": "19.1.8", "resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.8.tgz", @@ -6480,6 +6491,13 @@ "node": "*" } }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "devOptional": true, + "license": "MIT" + }, "node_modules/unified": { "version": "11.0.5", "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz", diff --git a/authenticate-users/langchain-fastapi-py/frontend/package.json b/authenticate-users/langchain-fastapi-py/frontend/package.json index ed6aa04f..b814e49b 100644 --- a/authenticate-users/langchain-fastapi-py/frontend/package.json +++ b/authenticate-users/langchain-fastapi-py/frontend/package.json @@ -42,6 +42,7 @@ }, "devDependencies": { "@eslint/js": "^9.30.1", + "@types/node": "^22.15.32", "@types/react": "^19.1.8", "@types/react-dom": "^19.1.6", "@vitejs/plugin-react": "^4.6.0", diff --git a/authenticate-users/langchain-fastapi-py/frontend/src/components/chat-window.tsx b/authenticate-users/langchain-fastapi-py/frontend/src/components/chat-window.tsx index a3d32c27..9974e52b 100644 --- a/authenticate-users/langchain-fastapi-py/frontend/src/components/chat-window.tsx +++ b/authenticate-users/langchain-fastapi-py/frontend/src/components/chat-window.tsx @@ -19,7 +19,7 @@ function ChatMessages(props: { }) { return (
- {props.messages.map((m, i) => { + {props.messages.map((m) => { return ( ); @@ -124,7 +124,7 @@ export function ChatWindow(props: { const [threadId, setThreadId] = useQueryState("threadId"); const [input, setInput] = useState(""); - const fetchWithCredentials = (url, options = {}) => { + const fetchWithCredentials = (url: string, options: RequestInit = {}) => { return fetch(url, { ...options, credentials: "include", diff --git a/authenticate-users/langchain-fastapi-py/frontend/src/pages/DocumentsPage.tsx b/authenticate-users/langchain-fastapi-py/frontend/src/pages/DocumentsPage.tsx index 9e491167..beb64570 100644 --- a/authenticate-users/langchain-fastapi-py/frontend/src/pages/DocumentsPage.tsx +++ b/authenticate-users/langchain-fastapi-py/frontend/src/pages/DocumentsPage.tsx @@ -1,6 +1,6 @@ import { format } from "date-fns"; import { LogIn, UserPlus } from "lucide-react"; -import { ReactNode } from "react"; +import type { ReactNode } from "react"; import DocumentItemActions from "@/components/document-item-actions"; import DocumentUploadForm from "@/components/document-upload-form"; diff --git a/authenticate-users/langchain-fastapi-py/frontend/tsconfig.node.json b/authenticate-users/langchain-fastapi-py/frontend/tsconfig.node.json index f85a3990..9e3d9ab2 100644 --- a/authenticate-users/langchain-fastapi-py/frontend/tsconfig.node.json +++ b/authenticate-users/langchain-fastapi-py/frontend/tsconfig.node.json @@ -3,6 +3,7 @@ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", "target": "ES2023", "lib": ["ES2023"], + "types": ["node"], "module": "ESNext", "skipLibCheck": true, diff --git a/authenticate-users/langchain-fastapi-py/frontend/vite.config.ts b/authenticate-users/langchain-fastapi-py/frontend/vite.config.ts index aa58c10f..2f65d30e 100644 --- a/authenticate-users/langchain-fastapi-py/frontend/vite.config.ts +++ b/authenticate-users/langchain-fastapi-py/frontend/vite.config.ts @@ -1,4 +1,4 @@ -import path from "path"; +import { fileURLToPath } from "url"; import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; import tailwindcss from "@tailwindcss/vite"; @@ -8,7 +8,7 @@ export default defineConfig({ plugins: [react(), tailwindcss()], resolve: { alias: { - "@": path.resolve(__dirname, "./src"), + "@": fileURLToPath(new URL("./src", import.meta.url)), }, }, }); diff --git a/authorization-for-rag/langchain-fastapi-py/backend/uv.toml b/authorization-for-rag/langchain-fastapi-py/backend/uv.toml new file mode 100644 index 00000000..7b83065b --- /dev/null +++ b/authorization-for-rag/langchain-fastapi-py/backend/uv.toml @@ -0,0 +1 @@ +index-url = "https://pypi.org/simple/" diff --git a/authorization-for-rag/langchain-fastapi-py/frontend/eslint.config.js b/authorization-for-rag/langchain-fastapi-py/frontend/eslint.config.js index d94e7deb..96d86130 100644 --- a/authorization-for-rag/langchain-fastapi-py/frontend/eslint.config.js +++ b/authorization-for-rag/langchain-fastapi-py/frontend/eslint.config.js @@ -1,23 +1,27 @@ -import js from '@eslint/js' -import globals from 'globals' -import reactHooks from 'eslint-plugin-react-hooks' -import reactRefresh from 'eslint-plugin-react-refresh' -import tseslint from 'typescript-eslint' -import { globalIgnores } from 'eslint/config' +import js from "@eslint/js"; +import globals from "globals"; +import reactHooks from "eslint-plugin-react-hooks"; +import reactRefresh from "eslint-plugin-react-refresh"; +import tseslint from "typescript-eslint"; +import { globalIgnores } from "eslint/config"; export default tseslint.config([ - globalIgnores(['dist']), + globalIgnores(["dist"]), { - files: ['**/*.{ts,tsx}'], + files: ["**/*.{ts,tsx}"], extends: [ js.configs.recommended, tseslint.configs.recommended, - reactHooks.configs['recommended-latest'], + reactHooks.configs["recommended-latest"], reactRefresh.configs.vite, ], languageOptions: { ecmaVersion: 2020, globals: globals.browser, }, + rules: { + "@typescript-eslint/no-explicit-any": "warn", + "react-refresh/only-export-components": "warn", + }, }, -]) +]); diff --git a/authorization-for-rag/langchain-fastapi-py/frontend/package-lock.json b/authorization-for-rag/langchain-fastapi-py/frontend/package-lock.json index 16793063..d55a3bc4 100644 --- a/authorization-for-rag/langchain-fastapi-py/frontend/package-lock.json +++ b/authorization-for-rag/langchain-fastapi-py/frontend/package-lock.json @@ -40,6 +40,7 @@ }, "devDependencies": { "@eslint/js": "^9.30.1", + "@types/node": "^22.15.32", "@types/react": "^19.1.8", "@types/react-dom": "^19.1.6", "@vitejs/plugin-react": "^4.6.0", @@ -2550,6 +2551,16 @@ "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", "license": "MIT" }, + "node_modules/@types/node": { + "version": "22.19.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.2.tgz", + "integrity": "sha512-LPM2G3Syo1GLzXLGJAKdqoU35XvrWzGJ21/7sgZTUpbkBaOasTj8tjwn6w+hCkqaa1TfJ/w67rJSwYItlJ2mYw==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, "node_modules/@types/react": { "version": "19.1.8", "resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.8.tgz", @@ -6480,6 +6491,13 @@ "node": "*" } }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "devOptional": true, + "license": "MIT" + }, "node_modules/unified": { "version": "11.0.5", "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz", diff --git a/authorization-for-rag/langchain-fastapi-py/frontend/package.json b/authorization-for-rag/langchain-fastapi-py/frontend/package.json index ed6aa04f..b814e49b 100644 --- a/authorization-for-rag/langchain-fastapi-py/frontend/package.json +++ b/authorization-for-rag/langchain-fastapi-py/frontend/package.json @@ -42,6 +42,7 @@ }, "devDependencies": { "@eslint/js": "^9.30.1", + "@types/node": "^22.15.32", "@types/react": "^19.1.8", "@types/react-dom": "^19.1.6", "@vitejs/plugin-react": "^4.6.0", diff --git a/authorization-for-rag/langchain-fastapi-py/frontend/src/components/chat-window.tsx b/authorization-for-rag/langchain-fastapi-py/frontend/src/components/chat-window.tsx index a3d32c27..fdda9ec0 100644 --- a/authorization-for-rag/langchain-fastapi-py/frontend/src/components/chat-window.tsx +++ b/authorization-for-rag/langchain-fastapi-py/frontend/src/components/chat-window.tsx @@ -1,16 +1,16 @@ +import { ArrowDown, ArrowUpIcon, LoaderCircle } from "lucide-react"; +import { useQueryState } from "nuqs"; import { useState } from "react"; -import type { FormEvent, ReactNode } from "react"; import { toast } from "sonner"; import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom"; -import { ArrowDown, ArrowUpIcon, LoaderCircle } from "lucide-react"; -import { useQueryState } from "nuqs"; -import { useStream } from "@langchain/langgraph-sdk/react"; -import { type Message } from "@langchain/langgraph-sdk"; import { ChatMessageBubble } from "@/components/chat-message-bubble"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; +import type { Message } from "@langchain/langgraph-sdk"; +import { useStream } from "@langchain/langgraph-sdk/react"; +import type { FormEvent, ReactNode } from "react"; function ChatMessages(props: { messages: Message[]; emptyStateComponent: ReactNode; @@ -19,7 +19,7 @@ function ChatMessages(props: { }) { return (
- {props.messages.map((m, i) => { + {props.messages.map((m) => { return ( ); @@ -124,7 +124,7 @@ export function ChatWindow(props: { const [threadId, setThreadId] = useQueryState("threadId"); const [input, setInput] = useState(""); - const fetchWithCredentials = (url, options = {}) => { + const fetchWithCredentials = (url: string, options: RequestInit = {}) => { return fetch(url, { ...options, credentials: "include", @@ -163,7 +163,7 @@ export function ChatWindow(props: { { type: "human", content: input, id: "temp" }, ], }), - }, + } ); setInput(""); } diff --git a/authorization-for-rag/langchain-fastapi-py/frontend/src/components/document-item-actions.tsx b/authorization-for-rag/langchain-fastapi-py/frontend/src/components/document-item-actions.tsx index 38590a92..cb9c252c 100644 --- a/authorization-for-rag/langchain-fastapi-py/frontend/src/components/document-item-actions.tsx +++ b/authorization-for-rag/langchain-fastapi-py/frontend/src/components/document-item-actions.tsx @@ -1,14 +1,15 @@ import { useState } from "react"; import { toast } from "sonner"; + import { Button } from "@/components/ui/button"; import { Dialog, + DialogClose, DialogContent, - DialogHeader, - DialogTitle, DialogDescription, DialogFooter, - DialogClose, + DialogHeader, + DialogTitle, DialogTrigger, } from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; @@ -16,8 +17,8 @@ import { deleteDocument, getDocumentContent, shareDocument, - type Document, } from "@/lib/documents"; +import type { Document } from "@/lib/documents"; interface DocumentItemActionsProps { doc: Omit; @@ -78,7 +79,7 @@ export default function DocumentItemActions({ try { await shareDocument(doc.id, emailToShare.split(",")); toast.success(`${doc.fileName} shared with ${emailToShare}.`); - onActionComplete && onActionComplete(); // Trigger revalidation + onActionComplete?.(); // Trigger revalidation setEmailToShare(""); // Reset email input } catch (error) { console.error("Error sharing document:", error); @@ -93,7 +94,7 @@ export default function DocumentItemActions({ try { await deleteDocument(doc.id); toast.success(`${doc.fileName} deleted successfully.`); - onActionComplete && onActionComplete(); // Trigger revalidation + onActionComplete?.(); // Trigger revalidation } catch (error) { console.error("Error deleting document:", error); toast.error("Failed to delete document."); diff --git a/authorization-for-rag/langchain-fastapi-py/frontend/src/components/document-upload-form.tsx b/authorization-for-rag/langchain-fastapi-py/frontend/src/components/document-upload-form.tsx index a2258238..6d82b065 100644 --- a/authorization-for-rag/langchain-fastapi-py/frontend/src/components/document-upload-form.tsx +++ b/authorization-for-rag/langchain-fastapi-py/frontend/src/components/document-upload-form.tsx @@ -1,10 +1,11 @@ -import { useState, type FormEvent } from "react"; +import axios from "axios"; +import { useState } from "react"; +import type { FormEvent } from "react"; import { toast } from "sonner"; -import { Input } from "@/components/ui/input"; import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; import { apiClient } from "@/lib/api-client"; -import axios from "axios"; interface DocumentUploadFormProps { onUploadSuccess?: () => void; // Callback to refresh document list, etc. @@ -23,7 +24,7 @@ export default function DocumentUploadForm({ const allowedTypes = ["text/plain", "application/pdf", "text/markdown"]; if (!allowedTypes.includes(selectedFile.type)) { toast.error( - "Invalid File Type: Please upload a TXT, PDF, or Markdown file.", + "Invalid File Type: Please upload a TXT, PDF, or Markdown file." ); setFile(null); event.target.value = ""; // Reset file input @@ -51,20 +52,23 @@ export default function DocumentUploadForm({ toast.success(`${file.name} has been uploaded.`); setFile(null); // Reset file input const fileInput = document.getElementById( - "file-upload", + "file-upload" ) as HTMLInputElement; if (fileInput) fileInput.value = ""; - onUploadSuccess && onUploadSuccess(); // Trigger refresh or other actions + onUploadSuccess?.(); // Trigger refresh or other actions } catch (error) { if (axios.isAxiosError(error)) { console.error("Upload error:", error?.response?.data || error); toast.error( - `Upload error: ${error?.response?.data?.detail || "An unexpected error occurred. Please try again."}`, + `Upload error: ${ + error?.response?.data?.detail || + "An unexpected error occurred. Please try again." + }` ); } else { console.error("Upload error:", error); toast.error( - "Upload Error: An unexpected error occurred. Please try again.", + "Upload Error: An unexpected error occurred. Please try again." ); } } diff --git a/authorization-for-rag/langchain-fastapi-py/frontend/src/pages/DocumentsPage.tsx b/authorization-for-rag/langchain-fastapi-py/frontend/src/pages/DocumentsPage.tsx index 9e491167..e7e70b9d 100644 --- a/authorization-for-rag/langchain-fastapi-py/frontend/src/pages/DocumentsPage.tsx +++ b/authorization-for-rag/langchain-fastapi-py/frontend/src/pages/DocumentsPage.tsx @@ -1,6 +1,5 @@ import { format } from "date-fns"; import { LogIn, UserPlus } from "lucide-react"; -import { ReactNode } from "react"; import DocumentItemActions from "@/components/document-item-actions"; import DocumentUploadForm from "@/components/document-upload-form"; @@ -9,6 +8,8 @@ import { getDocumentsForUser } from "@/lib/documents"; import useAuth, { getLoginUrl, getSignupUrl } from "@/lib/use-auth"; import { useQuery, useQueryClient } from "@tanstack/react-query"; +import type { ReactNode } from "react"; + export default function DocumentsPage() { const queryClient = useQueryClient(); const { user } = useAuth(); @@ -58,7 +59,7 @@ export default function DocumentsPage() { if (!sharedWith || sharedWith.length === 0) { return Not shared; } - if (sharedWith.includes(user?.email!)) { + if (user?.email && sharedWith.includes(user.email)) { return Shared with you; } return ( diff --git a/authorization-for-rag/langchain-fastapi-py/frontend/tsconfig.node.json b/authorization-for-rag/langchain-fastapi-py/frontend/tsconfig.node.json index f85a3990..9e3d9ab2 100644 --- a/authorization-for-rag/langchain-fastapi-py/frontend/tsconfig.node.json +++ b/authorization-for-rag/langchain-fastapi-py/frontend/tsconfig.node.json @@ -3,6 +3,7 @@ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", "target": "ES2023", "lib": ["ES2023"], + "types": ["node"], "module": "ESNext", "skipLibCheck": true, diff --git a/authorization-for-rag/langchain-fastapi-py/frontend/vite.config.ts b/authorization-for-rag/langchain-fastapi-py/frontend/vite.config.ts index aa58c10f..e344c895 100644 --- a/authorization-for-rag/langchain-fastapi-py/frontend/vite.config.ts +++ b/authorization-for-rag/langchain-fastapi-py/frontend/vite.config.ts @@ -1,14 +1,15 @@ -import path from "path"; +import { fileURLToPath } from "url"; import { defineConfig } from "vite"; -import react from "@vitejs/plugin-react"; + import tailwindcss from "@tailwindcss/vite"; +import react from "@vitejs/plugin-react"; // https://vite.dev/config/ export default defineConfig({ plugins: [react(), tailwindcss()], resolve: { alias: { - "@": path.resolve(__dirname, "./src"), + "@": fileURLToPath(new URL("./src", import.meta.url)), }, }, }); diff --git a/authorization-for-rag/langchain-next-js/package-lock.json b/authorization-for-rag/langchain-next-js/package-lock.json index 0a53ea1b..47f8a8b4 100644 --- a/authorization-for-rag/langchain-next-js/package-lock.json +++ b/authorization-for-rag/langchain-next-js/package-lock.json @@ -8,6 +8,8 @@ "name": "auth0-assistant0", "version": "0.0.0", "dependencies": { + "@auth0/ai": "^6.0.0", + "@auth0/ai-langchain": "^5.0.0", "@auth0/nextjs-auth0": "4.12.1", "@langchain/community": "^0.3.55", "@langchain/core": "^0.3.78", @@ -115,6 +117,47 @@ "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", "peer": true }, + "node_modules/@auth0/ai": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@auth0/ai/-/ai-6.0.0.tgz", + "integrity": "sha512-izza6cWqcEBp0X/uNp+DOnucpu4jOtuJQgGFWfXfnjt6SL57ANr6JHmJ/+LS77fll8wZcr7K0JVgE3xfk5pXjg==", + "license": "Apache-2.0", + "dependencies": { + "@openfga/sdk": "^0.8.0", + "auth0": "^4.30.0", + "jose": "^5.9.6", + "openid-client": "^6.1.7", + "stable-hash": "^0.0.5", + "tempbox": "^1.1.1", + "zod": "^3.25.76" + } + }, + "node_modules/@auth0/ai-langchain": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@auth0/ai-langchain/-/ai-langchain-5.0.0.tgz", + "integrity": "sha512-0tfAxXYNzKNNiusAWpFxj/z1JE2PCPLmul7sSpgvJtky3C74WydvuNIEvT2sRA54quLMNaYgImO4G/3izP2y/Q==", + "license": "Apache-2.0", + "dependencies": { + "@auth0/ai": "*", + "langchain": "^0.3.11" + }, + "peerDependencies": { + "@langchain/core": "^0.3.72", + "@langchain/langgraph": "^0.4.4", + "@langchain/langgraph-sdk": "^0.0.109", + "@openfga/sdk": "0.8.0", + "zod": "^3.25.76" + } + }, + "node_modules/@auth0/ai/node_modules/jose": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/jose/-/jose-5.10.0.tgz", + "integrity": "sha512-s+3Al/p9g32Iq+oqXxkW//7jk2Vig6FF1CFqzVXoTUXt2qz89YWbL+OwS17NFYEvxC35n0FKeGO2LGYSxeM2Gg==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, "node_modules/@auth0/nextjs-auth0": { "version": "4.12.1", "resolved": "https://registry.npmjs.org/@auth0/nextjs-auth0/-/nextjs-auth0-4.12.1.tgz", @@ -2739,12 +2782,24 @@ "node": ">=12.4.0" } }, + "node_modules/@openfga/sdk": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@openfga/sdk/-/sdk-0.8.0.tgz", + "integrity": "sha512-tFd5oQ6a3ps8Qbj9V8VhETyKnl7QtQa0o9G9464yI6KAih0FhMg/5e1/T701j6hkeGqGGJCmv1csD/OXyGCpFQ==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/api": "^1.9.0", + "axios": "^1.7.9", + "tiny-async-pool": "^2.1.0" + }, + "engines": { + "node": ">=16.15.0" + } + }, "node_modules/@opentelemetry/api": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz", "integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==", - "optional": true, - "peer": true, "engines": { "node": ">=8.0.0" } @@ -4529,8 +4584,49 @@ "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "peer": true + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/auth0": { + "version": "4.37.0", + "resolved": "https://registry.npmjs.org/auth0/-/auth0-4.37.0.tgz", + "integrity": "sha512-+TqJRxh4QvbD4TQIYx1ak2vanykQkG/nIZLuR6o8LoQj425gjVG3tFuUbbOeh/nCpP1rnvU0CCV1ChZHYXLU/A==", + "license": "MIT", + "dependencies": { + "jose": "^4.13.2", + "undici-types": "^6.15.0", + "uuid": "^9.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/auth0/node_modules/jose": { + "version": "4.15.9", + "resolved": "https://registry.npmjs.org/jose/-/jose-4.15.9.tgz", + "integrity": "sha512-1vUQX+IdDMVPj4k8kOxgUqlcK518yluMuGZwqlr44FS1ppZB/5GWh4rZG89erpOBOJjU/OBsnCVFfapsRz6nEA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/auth0/node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "license": "MIT" + }, + "node_modules/auth0/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } }, "node_modules/autoprefixer": { "version": "10.4.21", @@ -4597,7 +4693,6 @@ "version": "1.12.2", "resolved": "https://registry.npmjs.org/axios/-/axios-1.12.2.tgz", "integrity": "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw==", - "peer": true, "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.4", @@ -5087,7 +5182,6 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "peer": true, "dependencies": { "delayed-stream": "~1.0.0" }, @@ -5332,7 +5426,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "peer": true, "engines": { "node": ">=0.4.0" } @@ -6461,7 +6554,6 @@ "url": "https://github.com/sponsors/RubenVerborgh" } ], - "peer": true, "engines": { "node": ">=4.0" }, @@ -6505,7 +6597,6 @@ "version": "4.0.4", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz", "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==", - "peer": true, "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -8828,7 +8919,6 @@ "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "peer": true, "engines": { "node": ">= 0.6" } @@ -8837,7 +8927,6 @@ "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "peer": true, "dependencies": { "mime-db": "1.52.0" }, @@ -10229,8 +10318,7 @@ "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "peer": true + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" }, "node_modules/psl": { "version": "1.15.0", @@ -11074,8 +11162,7 @@ "node_modules/stable-hash": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/stable-hash/-/stable-hash-0.0.5.tgz", - "integrity": "sha512-+L3ccpzibovGXFK+Ap/f8LOS0ahMrHTf3xu7mMLSpEGU0EO9ucaysSylKo9eRDFNhWve/y275iPmIZ4z39a9iA==", - "dev": true + "integrity": "sha512-+L3ccpzibovGXFK+Ap/f8LOS0ahMrHTf3xu7mMLSpEGU0EO9ucaysSylKo9eRDFNhWve/y275iPmIZ4z39a9iA==" }, "node_modules/stop-iteration-iterator": { "version": "1.1.0", @@ -11569,6 +11656,15 @@ } } }, + "node_modules/tempbox": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/tempbox/-/tempbox-1.1.1.tgz", + "integrity": "sha512-gQ4+9CSz3Rz5eQsSAfwl4kn+rgApaNaiwjELbhMzUycgXl+AXGn8lpq45DTaipADu1eJk5N90w0+OYWlCHQD5A==", + "license": "MIT", + "dependencies": { + "tinyqueue": "^3.0.0" + } + }, "node_modules/thenify": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", @@ -11588,6 +11684,12 @@ "node": ">=0.8" } }, + "node_modules/tiny-async-pool": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tiny-async-pool/-/tiny-async-pool-2.1.0.tgz", + "integrity": "sha512-ltAHPh/9k0STRQqaoUX52NH4ZQYAJz24ZAEwf1Zm+HYg3l9OXTWeqWKyYsHu40wF/F0rxd2N2bk5sLvX2qlSvg==", + "license": "MIT" + }, "node_modules/tinyglobby": { "version": "0.2.15", "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", @@ -11633,6 +11735,12 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/tinyqueue": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tinyqueue/-/tinyqueue-3.0.0.tgz", + "integrity": "sha512-gRa9gwYU3ECmQYv3lslts5hxuIa90veaEcxDYuu3QGOIAEM2mOZkVHp48ANJuu1CURtRdHKUBY5Lm1tHV+sD4g==", + "license": "ISC" + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", diff --git a/authorization-for-rag/langchain-next-js/package.json b/authorization-for-rag/langchain-next-js/package.json index 6a54f898..1a757baf 100644 --- a/authorization-for-rag/langchain-next-js/package.json +++ b/authorization-for-rag/langchain-next-js/package.json @@ -25,6 +25,8 @@ "node": ">=18" }, "dependencies": { + "@auth0/ai": "^6.0.0", + "@auth0/ai-langchain": "^5.0.0", "@auth0/nextjs-auth0": "4.12.1", "@langchain/community": "^0.3.55", "@langchain/core": "^0.3.78", diff --git a/authorization-for-rag/langchain-python/poetry.toml b/authorization-for-rag/langchain-python/poetry.toml new file mode 100644 index 00000000..e028e1ce --- /dev/null +++ b/authorization-for-rag/langchain-python/poetry.toml @@ -0,0 +1,4 @@ +[repositories] +[repositories.pypi] +url = "https://pypi.org/simple/" +default = true diff --git a/authorization-for-rag/langgraph-python/poetry.toml b/authorization-for-rag/langgraph-python/poetry.toml new file mode 100644 index 00000000..e028e1ce --- /dev/null +++ b/authorization-for-rag/langgraph-python/poetry.toml @@ -0,0 +1,4 @@ +[repositories] +[repositories.pypi] +url = "https://pypi.org/simple/" +default = true diff --git a/authorization-for-rag/openai-fga-python/pip.conf b/authorization-for-rag/openai-fga-python/pip.conf new file mode 100644 index 00000000..b0956c6a --- /dev/null +++ b/authorization-for-rag/openai-fga-python/pip.conf @@ -0,0 +1,2 @@ +[global] +index-url = https://pypi.org/simple diff --git a/call-apis-on-users-behalf/others-api/langchain-fastapi-py/backend/uv.toml b/call-apis-on-users-behalf/others-api/langchain-fastapi-py/backend/uv.toml new file mode 100644 index 00000000..7b83065b --- /dev/null +++ b/call-apis-on-users-behalf/others-api/langchain-fastapi-py/backend/uv.toml @@ -0,0 +1 @@ +index-url = "https://pypi.org/simple/" diff --git a/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/eslint.config.js b/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/eslint.config.js index d94e7deb..96d86130 100644 --- a/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/eslint.config.js +++ b/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/eslint.config.js @@ -1,23 +1,27 @@ -import js from '@eslint/js' -import globals from 'globals' -import reactHooks from 'eslint-plugin-react-hooks' -import reactRefresh from 'eslint-plugin-react-refresh' -import tseslint from 'typescript-eslint' -import { globalIgnores } from 'eslint/config' +import js from "@eslint/js"; +import globals from "globals"; +import reactHooks from "eslint-plugin-react-hooks"; +import reactRefresh from "eslint-plugin-react-refresh"; +import tseslint from "typescript-eslint"; +import { globalIgnores } from "eslint/config"; export default tseslint.config([ - globalIgnores(['dist']), + globalIgnores(["dist"]), { - files: ['**/*.{ts,tsx}'], + files: ["**/*.{ts,tsx}"], extends: [ js.configs.recommended, tseslint.configs.recommended, - reactHooks.configs['recommended-latest'], + reactHooks.configs["recommended-latest"], reactRefresh.configs.vite, ], languageOptions: { ecmaVersion: 2020, globals: globals.browser, }, + rules: { + "@typescript-eslint/no-explicit-any": "warn", + "react-refresh/only-export-components": "warn", + }, }, -]) +]); diff --git a/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/package-lock.json b/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/package-lock.json index b744add1..a637abfa 100644 --- a/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/package-lock.json +++ b/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/package-lock.json @@ -41,6 +41,7 @@ }, "devDependencies": { "@eslint/js": "^9.30.1", + "@types/node": "^22.15.32", "@types/react": "^19.1.8", "@types/react-dom": "^19.1.6", "@vitejs/plugin-react": "^4.6.0", @@ -2584,6 +2585,16 @@ "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", "license": "MIT" }, + "node_modules/@types/node": { + "version": "22.19.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.2.tgz", + "integrity": "sha512-LPM2G3Syo1GLzXLGJAKdqoU35XvrWzGJ21/7sgZTUpbkBaOasTj8tjwn6w+hCkqaa1TfJ/w67rJSwYItlJ2mYw==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, "node_modules/@types/react": { "version": "19.2.2", "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.2.tgz", diff --git a/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/package.json b/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/package.json index 1040cf98..12bab694 100644 --- a/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/package.json +++ b/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/package.json @@ -43,6 +43,7 @@ }, "devDependencies": { "@eslint/js": "^9.30.1", + "@types/node": "^22.15.32", "@types/react": "^19.1.8", "@types/react-dom": "^19.1.6", "@vitejs/plugin-react": "^4.6.0", diff --git a/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/src/components/chat-window.tsx b/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/src/components/chat-window.tsx index b0e8ae68..d61138b6 100644 --- a/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/src/components/chat-window.tsx +++ b/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/src/components/chat-window.tsx @@ -1,19 +1,18 @@ -import { useEffect, useState } from "react"; -import type { FormEvent, ReactNode } from "react"; -import { toast } from "sonner"; -import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom"; import { ArrowDown, ArrowUpIcon, LoaderCircle } from "lucide-react"; import { useQueryState } from "nuqs"; -import { useStream } from "@langchain/langgraph-sdk/react"; -import { type Message } from "@langchain/langgraph-sdk"; +import { useState } from "react"; +import { toast } from "sonner"; +import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom"; import { ChatMessageBubble } from "@/components/chat-message-bubble"; -import { Button } from "@/components/ui/button"; import { TokenVaultInterruptHandler } from "@/components/TokenVaultInterruptHandler.tsx"; -import { cn } from "@/lib/utils"; +import { Button } from "@/components/ui/button"; import { getConnectUrl } from "@/lib/use-auth"; -import { useLocation } from "react-router-dom"; +import { cn } from "@/lib/utils"; +import type { Message } from "@langchain/langgraph-sdk"; +import { useStream } from "@langchain/langgraph-sdk/react"; +import type { FormEvent, ReactNode } from "react"; function ChatMessages(props: { messages: Message[]; emptyStateComponent: ReactNode; diff --git a/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/tsconfig.node.json b/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/tsconfig.node.json index f85a3990..9e3d9ab2 100644 --- a/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/tsconfig.node.json +++ b/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/tsconfig.node.json @@ -3,6 +3,7 @@ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", "target": "ES2023", "lib": ["ES2023"], + "types": ["node"], "module": "ESNext", "skipLibCheck": true, diff --git a/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/vite.config.ts b/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/vite.config.ts index 375a2194..d3e87cff 100644 --- a/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/vite.config.ts +++ b/call-apis-on-users-behalf/others-api/langchain-fastapi-py/frontend/vite.config.ts @@ -1,24 +1,25 @@ -import path from "path"; +import { fileURLToPath } from "url"; import { defineConfig, loadEnv } from "vite"; -import react from "@vitejs/plugin-react"; + import tailwindcss from "@tailwindcss/vite"; +import react from "@vitejs/plugin-react"; // https://vite.dev/config/ export default defineConfig(({ mode }) => { - const env = loadEnv(mode, process.cwd(), '') + const env = loadEnv(mode, process.cwd(), ""); return { plugins: [react(), tailwindcss()], - server: { - proxy: { - "/api": { - target: env.API_HOST, - }, + server: { + proxy: { + "/api": { + target: env.API_HOST, }, }, - resolve: { - alias: { - "@": path.resolve(__dirname, "./src"), - }, + }, + resolve: { + alias: { + "@": fileURLToPath(new URL("./src", import.meta.url)), }, + }, }; }); diff --git a/call-apis-on-users-behalf/others-api/langchain-react-spa-js/apps/agents/package.json b/call-apis-on-users-behalf/others-api/langchain-react-spa-js/apps/agents/package.json index 4c4cc51c..9664a59f 100644 --- a/call-apis-on-users-behalf/others-api/langchain-react-spa-js/apps/agents/package.json +++ b/call-apis-on-users-behalf/others-api/langchain-react-spa-js/apps/agents/package.json @@ -31,6 +31,7 @@ "@eslint/eslintrc": "^3.3.1", "@eslint/js": "^9.36.0", "@jest/globals": "^30.2.0", + "@tsconfig/recommended": "^1.0.10", "@types/node": "^24", "@types/uuid": "^11.0.0", "@typescript-eslint/eslint-plugin": "^8.45.0", diff --git a/call-apis-on-users-behalf/others-api/langchain-react-spa-js/apps/web/package.json b/call-apis-on-users-behalf/others-api/langchain-react-spa-js/apps/web/package.json index 57246d03..50220ac3 100644 --- a/call-apis-on-users-behalf/others-api/langchain-react-spa-js/apps/web/package.json +++ b/call-apis-on-users-behalf/others-api/langchain-react-spa-js/apps/web/package.json @@ -58,6 +58,7 @@ }, "devDependencies": { "@eslint/js": "^9.37.0", + "@tsconfig/recommended": "^1.0.10", "@types/lodash": "^4.17.20", "@types/node": "^24.7.0", "@types/react": "^19.2.0", diff --git a/call-apis-on-users-behalf/others-api/langchain-react-spa-js/package-lock.json b/call-apis-on-users-behalf/others-api/langchain-react-spa-js/package-lock.json index 0b15b16e..2b26599b 100644 --- a/call-apis-on-users-behalf/others-api/langchain-react-spa-js/package-lock.json +++ b/call-apis-on-users-behalf/others-api/langchain-react-spa-js/package-lock.json @@ -52,6 +52,7 @@ "@eslint/eslintrc": "^3.3.1", "@eslint/js": "^9.36.0", "@jest/globals": "^30.2.0", + "@tsconfig/recommended": "^1.0.10", "@types/node": "^24", "@types/uuid": "^11.0.0", "@typescript-eslint/eslint-plugin": "^8.45.0", @@ -127,6 +128,7 @@ }, "devDependencies": { "@eslint/js": "^9.37.0", + "@tsconfig/recommended": "^1.0.10", "@types/lodash": "^4.17.20", "@types/node": "^24.7.0", "@types/react": "^19.2.0", diff --git a/call-apis-on-users-behalf/others-api/ms-agent-framework-vault-token-py/main.py b/call-apis-on-users-behalf/others-api/ms-agent-framework-vault-token-py/main.py index 7c312ae0..0718c432 100644 --- a/call-apis-on-users-behalf/others-api/ms-agent-framework-vault-token-py/main.py +++ b/call-apis-on-users-behalf/others-api/ms-agent-framework-vault-token-py/main.py @@ -28,7 +28,7 @@ async def read_index(request: Request, response: Response): try: await auth0_client.require_session(request, response) - except Exception as e: + except Exception: return RedirectResponse(url="/auth/login") return FileResponse("static/index.html") diff --git a/call-apis-on-users-behalf/others-api/ms-agent-framework-vault-token-py/pip.conf b/call-apis-on-users-behalf/others-api/ms-agent-framework-vault-token-py/pip.conf new file mode 100644 index 00000000..b0956c6a --- /dev/null +++ b/call-apis-on-users-behalf/others-api/ms-agent-framework-vault-token-py/pip.conf @@ -0,0 +1,2 @@ +[global] +index-url = https://pypi.org/simple diff --git a/call-apis-on-users-behalf/others-api/ms-agent-framework-vault-token-py/requirements.txt b/call-apis-on-users-behalf/others-api/ms-agent-framework-vault-token-py/requirements.txt index fe1fc3bc..fee0b2d4 100644 --- a/call-apis-on-users-behalf/others-api/ms-agent-framework-vault-token-py/requirements.txt +++ b/call-apis-on-users-behalf/others-api/ms-agent-framework-vault-token-py/requirements.txt @@ -3,6 +3,6 @@ uvicorn>=0.15.0 pydantic>=2.0.0 pydantic-settings>=2.0.0 agent-framework -auth0-fastapi>=0.3.0 +auth0-fastapi>=1.0.0b1 starlette itsdangerous diff --git a/call-apis-on-users-behalf/your-api/langchain-fastapi-py/backend/uv.toml b/call-apis-on-users-behalf/your-api/langchain-fastapi-py/backend/uv.toml new file mode 100644 index 00000000..7b83065b --- /dev/null +++ b/call-apis-on-users-behalf/your-api/langchain-fastapi-py/backend/uv.toml @@ -0,0 +1 @@ +index-url = "https://pypi.org/simple/" diff --git a/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/eslint.config.js b/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/eslint.config.js index d94e7deb..96d86130 100644 --- a/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/eslint.config.js +++ b/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/eslint.config.js @@ -1,23 +1,27 @@ -import js from '@eslint/js' -import globals from 'globals' -import reactHooks from 'eslint-plugin-react-hooks' -import reactRefresh from 'eslint-plugin-react-refresh' -import tseslint from 'typescript-eslint' -import { globalIgnores } from 'eslint/config' +import js from "@eslint/js"; +import globals from "globals"; +import reactHooks from "eslint-plugin-react-hooks"; +import reactRefresh from "eslint-plugin-react-refresh"; +import tseslint from "typescript-eslint"; +import { globalIgnores } from "eslint/config"; export default tseslint.config([ - globalIgnores(['dist']), + globalIgnores(["dist"]), { - files: ['**/*.{ts,tsx}'], + files: ["**/*.{ts,tsx}"], extends: [ js.configs.recommended, tseslint.configs.recommended, - reactHooks.configs['recommended-latest'], + reactHooks.configs["recommended-latest"], reactRefresh.configs.vite, ], languageOptions: { ecmaVersion: 2020, globals: globals.browser, }, + rules: { + "@typescript-eslint/no-explicit-any": "warn", + "react-refresh/only-export-components": "warn", + }, }, -]) +]); diff --git a/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/package-lock.json b/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/package-lock.json index d04b87de..9624533a 100644 --- a/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/package-lock.json +++ b/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/package-lock.json @@ -39,6 +39,7 @@ }, "devDependencies": { "@eslint/js": "^9.30.1", + "@types/node": "^22.15.32", "@types/react": "^19.1.8", "@types/react-dom": "^19.1.6", "@vitejs/plugin-react": "^4.6.0", @@ -2544,6 +2545,16 @@ "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", "license": "MIT" }, + "node_modules/@types/node": { + "version": "22.19.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.2.tgz", + "integrity": "sha512-LPM2G3Syo1GLzXLGJAKdqoU35XvrWzGJ21/7sgZTUpbkBaOasTj8tjwn6w+hCkqaa1TfJ/w67rJSwYItlJ2mYw==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, "node_modules/@types/react": { "version": "19.2.2", "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.2.tgz", @@ -6465,6 +6476,13 @@ "node": "*" } }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "devOptional": true, + "license": "MIT" + }, "node_modules/unified": { "version": "11.0.5", "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz", diff --git a/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/package.json b/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/package.json index 13b2176b..ff69c19a 100644 --- a/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/package.json +++ b/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/package.json @@ -41,6 +41,7 @@ }, "devDependencies": { "@eslint/js": "^9.30.1", + "@types/node": "^22.15.32", "@types/react": "^19.1.8", "@types/react-dom": "^19.1.6", "@vitejs/plugin-react": "^4.6.0", diff --git a/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/src/components/chat-window.tsx b/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/src/components/chat-window.tsx index a3d32c27..15ca4e0d 100644 --- a/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/src/components/chat-window.tsx +++ b/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/src/components/chat-window.tsx @@ -1,16 +1,16 @@ +import { ArrowDown, ArrowUpIcon, LoaderCircle } from "lucide-react"; +import { useQueryState } from "nuqs"; import { useState } from "react"; -import type { FormEvent, ReactNode } from "react"; import { toast } from "sonner"; import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom"; -import { ArrowDown, ArrowUpIcon, LoaderCircle } from "lucide-react"; -import { useQueryState } from "nuqs"; -import { useStream } from "@langchain/langgraph-sdk/react"; -import { type Message } from "@langchain/langgraph-sdk"; import { ChatMessageBubble } from "@/components/chat-message-bubble"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; +import { useStream } from "@langchain/langgraph-sdk/react"; +import type { Message } from "@langchain/langgraph-sdk"; +import type { FormEvent, ReactNode } from "react"; function ChatMessages(props: { messages: Message[]; emptyStateComponent: ReactNode; @@ -19,7 +19,7 @@ function ChatMessages(props: { }) { return (
- {props.messages.map((m, i) => { + {props.messages.map((m) => { return ( ); @@ -124,7 +124,7 @@ export function ChatWindow(props: { const [threadId, setThreadId] = useQueryState("threadId"); const [input, setInput] = useState(""); - const fetchWithCredentials = (url, options = {}) => { + const fetchWithCredentials = (url: string, options: RequestInit = {}) => { return fetch(url, { ...options, credentials: "include", @@ -163,7 +163,7 @@ export function ChatWindow(props: { { type: "human", content: input, id: "temp" }, ], }), - }, + } ); setInput(""); } diff --git a/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/tsconfig.node.json b/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/tsconfig.node.json index f85a3990..9e3d9ab2 100644 --- a/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/tsconfig.node.json +++ b/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/tsconfig.node.json @@ -3,6 +3,7 @@ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", "target": "ES2023", "lib": ["ES2023"], + "types": ["node"], "module": "ESNext", "skipLibCheck": true, diff --git a/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/vite.config.ts b/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/vite.config.ts index aa58c10f..e344c895 100644 --- a/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/vite.config.ts +++ b/call-apis-on-users-behalf/your-api/langchain-fastapi-py/frontend/vite.config.ts @@ -1,14 +1,15 @@ -import path from "path"; +import { fileURLToPath } from "url"; import { defineConfig } from "vite"; -import react from "@vitejs/plugin-react"; + import tailwindcss from "@tailwindcss/vite"; +import react from "@vitejs/plugin-react"; // https://vite.dev/config/ export default defineConfig({ plugins: [react(), tailwindcss()], resolve: { alias: { - "@": path.resolve(__dirname, "./src"), + "@": fileURLToPath(new URL("./src", import.meta.url)), }, }, });