Repository: pickle-com/glass Branch: main Commit: 71bc3dce7c92 Files: 153 Total size: 1.3 MB Directory structure: gitextract_d8n6n_v9/ ├── .firebaserc ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.md │ │ └── feature_request.md │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows/ │ ├── assign-on-comment.yml │ └── build.yml ├── .gitignore ├── .gitmodules ├── .npmrc ├── .prettierignore ├── .prettierrc ├── .vscode/ │ └── settings.json ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── build.js ├── docs/ │ ├── DESIGN_PATTERNS.md │ └── refactor-plan.md ├── electron-builder.yml ├── entitlements.plist ├── firebase.json ├── firestore.indexes.json ├── functions/ │ ├── .eslintrc.js │ ├── .gitignore │ ├── index.js │ └── package.json ├── notarize.js ├── package.json ├── pickleglass_web/ │ ├── app/ │ │ ├── activity/ │ │ │ ├── details/ │ │ │ │ └── page.tsx │ │ │ └── page.tsx │ │ ├── download/ │ │ │ └── page.tsx │ │ ├── globals.css │ │ ├── help/ │ │ │ └── page.tsx │ │ ├── layout.tsx │ │ ├── login/ │ │ │ └── page.tsx │ │ ├── page.tsx │ │ ├── personalize/ │ │ │ └── page.tsx │ │ └── settings/ │ │ ├── billing/ │ │ │ └── page.tsx │ │ ├── page.tsx │ │ └── privacy/ │ │ └── page.tsx │ ├── backend_node/ │ │ ├── index.js │ │ ├── ipcBridge.js │ │ ├── middleware/ │ │ │ └── auth.js │ │ └── routes/ │ │ ├── auth.js │ │ ├── conversations.js │ │ ├── presets.js │ │ └── user.js │ ├── components/ │ │ ├── ClientLayout.tsx │ │ ├── SearchPopup.tsx │ │ └── Sidebar.tsx │ ├── next-env.d.ts │ ├── next.config.js │ ├── package.json │ ├── postcss.config.js │ ├── public/ │ │ └── README.md │ ├── requirements.txt │ ├── tailwind.config.js │ ├── tsconfig.json │ └── utils/ │ ├── api.ts │ ├── auth.ts │ ├── firebase.ts │ └── firestore.ts ├── preload.js └── src/ ├── bridge/ │ ├── featureBridge.js │ ├── internalBridge.js │ └── windowBridge.js ├── features/ │ ├── ask/ │ │ ├── askService.js │ │ └── repositories/ │ │ ├── firebase.repository.js │ │ ├── index.js │ │ └── sqlite.repository.js │ ├── common/ │ │ ├── ai/ │ │ │ ├── factory.js │ │ │ └── providers/ │ │ │ ├── anthropic.js │ │ │ ├── deepgram.js │ │ │ ├── gemini.js │ │ │ ├── ollama.js │ │ │ ├── openai.js │ │ │ └── whisper.js │ │ ├── config/ │ │ │ ├── checksums.js │ │ │ ├── config.js │ │ │ └── schema.js │ │ ├── prompts/ │ │ │ ├── promptBuilder.js │ │ │ └── promptTemplates.js │ │ ├── repositories/ │ │ │ ├── firestoreConverter.js │ │ │ ├── ollamaModel/ │ │ │ │ ├── index.js │ │ │ │ └── sqlite.repository.js │ │ │ ├── permission/ │ │ │ │ ├── index.js │ │ │ │ └── sqlite.repository.js │ │ │ ├── preset/ │ │ │ │ ├── firebase.repository.js │ │ │ │ ├── index.js │ │ │ │ └── sqlite.repository.js │ │ │ ├── providerSettings/ │ │ │ │ ├── index.js │ │ │ │ └── sqlite.repository.js │ │ │ ├── session/ │ │ │ │ ├── firebase.repository.js │ │ │ │ ├── index.js │ │ │ │ └── sqlite.repository.js │ │ │ ├── user/ │ │ │ │ ├── firebase.repository.js │ │ │ │ ├── index.js │ │ │ │ └── sqlite.repository.js │ │ │ └── whisperModel/ │ │ │ └── index.js │ │ ├── services/ │ │ │ ├── authService.js │ │ │ ├── databaseInitializer.js │ │ │ ├── encryptionService.js │ │ │ ├── firebaseClient.js │ │ │ ├── localAIManager.js │ │ │ ├── migrationService.js │ │ │ ├── modelStateService.js │ │ │ ├── ollamaService.js │ │ │ ├── permissionService.js │ │ │ ├── sqliteClient.js │ │ │ └── whisperService.js │ │ └── utils/ │ │ └── spawnHelper.js │ ├── listen/ │ │ ├── listenService.js │ │ ├── stt/ │ │ │ ├── repositories/ │ │ │ │ ├── firebase.repository.js │ │ │ │ ├── index.js │ │ │ │ └── sqlite.repository.js │ │ │ └── sttService.js │ │ └── summary/ │ │ ├── repositories/ │ │ │ ├── firebase.repository.js │ │ │ ├── index.js │ │ │ └── sqlite.repository.js │ │ └── summaryService.js │ ├── settings/ │ │ ├── repositories/ │ │ │ ├── firebase.repository.js │ │ │ ├── index.js │ │ │ └── sqlite.repository.js │ │ └── settingsService.js │ └── shortcuts/ │ ├── repositories/ │ │ ├── index.js │ │ └── sqlite.repository.js │ └── shortcutsService.js ├── index.js ├── preload.js ├── ui/ │ ├── app/ │ │ ├── ApiKeyHeader.js │ │ ├── HeaderController.js │ │ ├── MainHeader.js │ │ ├── PermissionHeader.js │ │ ├── PickleGlassApp.js │ │ ├── WelcomeHeader.js │ │ ├── content.html │ │ └── header.html │ ├── ask/ │ │ └── AskView.js │ ├── assets/ │ │ ├── SystemAudioDump │ │ ├── logo.icns │ │ └── smd.js │ ├── listen/ │ │ ├── ListenView.js │ │ ├── audioCore/ │ │ │ ├── aec.js │ │ │ ├── listenCapture.js │ │ │ └── renderer.js │ │ ├── stt/ │ │ │ └── SttView.js │ │ └── summary/ │ │ └── SummaryView.js │ ├── settings/ │ │ ├── SettingsView.js │ │ └── ShortCutSettingsView.js │ └── styles/ │ └── glass-bypass.css └── window/ ├── smoothMovementManager.js ├── windowLayoutManager.js └── windowManager.js ================================================ FILE CONTENTS ================================================ ================================================ FILE: .firebaserc ================================================ { "projects": { "default": "pickle-3651a" } } ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report.md ================================================ --- name: Bug Report about: Create a report to help us improve title: "[BUG] " labels: bug assignees: '' --- **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Environment (please complete the following information):** - OS: [e.g. macOS, Windows] - App Version [e.g. 1.0.0] **Additional context** Add any other context about the problem here. ================================================ FILE: .github/ISSUE_TEMPLATE/feature_request.md ================================================ --- name: Feature Request about: Suggest an idea for this project title: "[FEAT] " labels: feature assignees: '' --- **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context or screenshots about the feature request here. ================================================ FILE: .github/PULL_REQUEST_TEMPLATE.md ================================================ --- name: Pull Request about: Propose a change to the codebase --- ## Summary of Changes Please provide a brief, high-level summary of the changes in this pull request. ## Related Issue - Closes #XXX *Please replace `XXX` with the issue number that this pull request resolves. If it does not resolve a specific issue, please explain why this change is needed.* ## Contributor's Self-Review Checklist Please check the boxes that apply. This is a reminder of what we look for in a good pull request. - [ ] I have read the [CONTRIBUTING.md](https://github.com/your-org/your-repo/blob/main/CONTRIBUTING.md) document. - [ ] My code follows the project's coding style and architectural patterns as described in [DESIGN_PATTERNS.md](https://github.com/your-org/your-repo/blob/main/docs/DESIGN_PATTERNS.md). - [ ] I have added or updated relevant tests for my changes. - [ ] I have updated the documentation to reflect my changes (if applicable). - [ ] My changes have been tested locally and are working as expected. ## Additional Context (Optional) Add any other context or screenshots about the pull request here. ================================================ FILE: .github/workflows/assign-on-comment.yml ================================================ name: Assign on Comment on: issue_comment: types: [created] jobs: # Job 1: Any contributor can self-assign self-assign: # Only run if the comment is exactly '/assign' if: startsWith(github.event.comment.body, '/assign') && !contains(github.event.comment.body, '@') runs-on: ubuntu-latest permissions: issues: write steps: - name: Assign commenter to the issue uses: actions/github-script@v7 with: script: | // Assign the commenter as the assignee await github.rest.issues.addAssignees({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, assignees: [context.actor] }); // Add a rocket (🚀) reaction to indicate success await github.rest.reactions.createForIssueComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: context.payload.comment.id, content: 'rocket' }); # Job 2: Admin can assign others assign-others: # Only run if the comment starts with '/assign @' and the commenter is in the admin group if: startsWith(github.event.comment.body, '/assign @') && contains(fromJson('["OWNER", "COLLABORATOR", "MEMBER"]'), github.event.comment.author_association) runs-on: ubuntu-latest permissions: issues: write steps: - name: Assign mentioned user uses: actions/github-script@v7 with: script: | const mention = context.payload.comment.body.split(' ')[1]; const assignee = mention.substring(1); // Remove '@' // Assign the mentioned user as the assignee await github.rest.issues.addAssignees({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, assignees: [assignee] }); // Add a thumbs up (+1) reaction to indicate success await github.rest.reactions.createForIssueComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: context.payload.comment.id, content: '+1' }); ================================================ FILE: .github/workflows/build.yml ================================================ name: Build & Verify on: push: branches: [ "main" ] # Runs on every push to main branch jobs: build: # Currently runs on macOS only, can add windows-latest later runs-on: macos-latest steps: - name: 🚚 Checkout code uses: actions/checkout@v4 - name: ⚙️ Setup Node.js environment uses: actions/setup-node@v4 with: node-version: '20.x' # Node.js version compatible with project cache: 'npm' # npm dependency caching for speed improvement - name: 📦 Install root dependencies run: npm install - name: 🌐 Install and build web (Renderer) part # Move to pickleglass_web directory and run commands working-directory: ./pickleglass_web run: | npm install npm run build - name: 🖥️ Build Electron app # Run Electron build script from root directory run: npm run build - name: 🚨 Send failure notification to Slack if: failure() uses: rtCamp/action-slack-notify@v2 env: SLACK_CHANNEL: general SLACK_TITLE: "🚨 Build Failed" SLACK_MESSAGE: "😭 Build failed for `${{ github.repository }}` repo on main branch." SLACK_COLOR: 'danger' SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} ================================================ FILE: .gitignore ================================================ # Logs src/data logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* lerna-debug.log* # Diagnostic reports (https://nodejs.org/api/report.html) report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json # Runtime data pids *.pid *.seed *.pid.lock .DS_Store # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage *.lcov # nyc test coverage .nyc_output # node-waf configuration .lock-wscript # Compiled binary addons (https://nodejs.org/api/addons.html) build/Release # Dependency directories node_modules/ jspm_packages/ # TypeScript v1 declaration files typings/ # TypeScript cache *.tsbuildinfo # Optional npm cache directory .npm # Optional eslint cache .eslintcache # Optional REPL history .node_repl_history # Output of 'npm pack' *.tgz # Yarn Integrity file .yarn-integrity # dotenv environment variables file .env .env.test # parcel-bundler cache (https://parceljs.org/) .cache # next.js build output .next # nuxt.js build output .nuxt # vuepress build output .vuepress/dist # Serverless directories .serverless/ # FuseBox cache .fusebox/ # DynamoDB Local files .dynamodb/ # Webpack .webpack/ # Vite .vite/ # Electron-Forge out/ .specstory .specstory/ data/pickleglass.db pickleglass_web/backend/__pycache__/ pickleglass_web/venv/ # Node / JS node_modules/ npm-debug.log yarn-error.log # Database data/*.db data/*.db-journal data/*.db-shm data/*.db-wal # Build output out/ dist/ build/ ================================================ FILE: .gitmodules ================================================ [submodule "aec"] path = aec url = https://github.com/samtiz/aec.git ================================================ FILE: .npmrc ================================================ better-sqlite3:ignore-scripts=true sharp:ignore-scripts=true ================================================ FILE: .prettierignore ================================================ src/ui/assets node_modules ================================================ FILE: .prettierrc ================================================ { "semi": true, "tabWidth": 4, "printWidth": 150, "singleQuote": true, "trailingComma": "es5", "bracketSpacing": true, "arrowParens": "avoid", "endOfLine": "lf" } ================================================ FILE: .vscode/settings.json ================================================ { "search.useIgnoreFiles": true } ================================================ FILE: CONTRIBUTING.md ================================================ # Contributing to Glass Thank you for considering contributing to **Glass by Pickle**! Contributions make the open-source community vibrant, innovative, and collaborative. We appreciate every contribution you make—big or small. This document guides you through the entire contribution process, from finding an issue to getting your pull request merged. --- ## 🚀 Contribution Workflow To ensure a smooth and effective workflow, all contributions must go through the following process. Please follow these steps carefully. ### 1. Find or Create an Issue All work begins with an issue. This is the central place to discuss new ideas and track progress. - Browse our existing [**Issues**](https://github.com/pickle-com/glass/issues) to find something you'd like to work on. We recommend looking for issues labeled `good first issue` if you're new! - If you have a new idea or find a bug that hasn't been reported, please **create a new issue** using our templates. ### 2. Claim the Issue To avoid duplicate work, you must claim an issue before you start coding. - On the issue you want to work on, leave a comment with the command: ``` /assign ``` - Our GitHub bot will automatically assign the issue to you. Once your profile appears in the **`Assignees`** section on the right, you are ready to start development. ### 3. Fork & Create a Branch Now it's time to set up your local environment. 1. **Fork** the repository to your own GitHub account. 2. **Clone** your forked repository to your local machine. 3. **Create a new branch** from `main`. A clear branch name is recommended. - For new features: `feat/short-description` (e.g., `feat/user-login-ui`) - For bug fixes: `fix/short-description` (e.g., `fix/header-rendering-bug`) ### 4. Develop Write your code! As you work, please adhere to our quality standards. - **Code Style & Quality**: Our project uses `Prettier` and `ESLint` to maintain a consistent code style. - **Architecture & Design Patterns**: All new code must be consistent with the project's architecture. Please read our **[Design Patterns Guide](https://github.com/pickle-com/glass/blob/main/docs/DESIGN_PATTERNS.md)** before making significant changes. ### 5. Create a Pull Request (PR) Once your work is ready, create a Pull Request to the `main` branch of the original repository. - **Fill out the PR Template**: Our template will appear automatically. Please provide a clear summary of your changes. - **Link the Issue**: In the PR description, include the line `Closes #XXX` (e.g., `Closes #123`) to link it to the issue you resolved. This is mandatory. - **Code Review**: A maintainer will review your code, provide feedback, and merge it. --- # Developing ### Prerequisites Ensure the following are installed: - [Node.js v20.x.x](https://nodejs.org/en/download) - [Python](https://www.python.org/downloads/) - (Windows users) [Build Tools for Visual Studio](https://visualstudio.microsoft.com/downloads/) Ensure you're using Node.js version 20.x.x to avoid build errors with native dependencies. ```bash # Check your Node.js version node --version # If you need to install Node.js 20.x.x, we recommend using nvm: # curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash # nvm install 20 # nvm use 20 ``` ## Setup and Build ```bash npm run setup ``` Please ensure that you can make a full production build before pushing code. ## Linting ```bash npm run lint ``` If you get errors, be sure to fix them before committing. ================================================ FILE: LICENSE ================================================ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ================================================ FILE: README.md ================================================

Logo

Glass by Pickle: Digital Mind Extension 🧠

Pickle DiscordPickle WebsiteFollow Daniel

> This project is a fork of [CheatingDaddy](https://github.com/sohzm/cheating-daddy) with modifications and enhancements. Thanks to [Soham](https://x.com/soham_btw) and all the open-source contributors who made this possible! 🤖 **Fast, light & open-source**—Glass lives on your desktop, sees what you see, listens in real time, understands your context, and turns every moment into structured knowledge. 💬 **Proactive in meetings**—it surfaces action items, summaries, and answers the instant you need them. 🫥️ **Truly invisible**—never shows up in screen recordings, screenshots, or your dock; no always-on capture or hidden sharing. To have fun building with us, join our [Discord](https://discord.gg/UCZH5B5Hpd)! ## Instant Launch ⚡️  Skip the setup—launch instantly with our ready-to-run macOS app. [[Download Here]](https://www.dropbox.com/scl/fi/znid09apxiwtwvxer6oc9/Glass_latest.dmg?rlkey=gwvvyb3bizkl25frhs4k1zwds&st=37q31b4w&dl=1) ## Quick Start (Local Build) ### Prerequisites First download & install [Python](https://www.python.org/downloads/) and [Node](https://nodejs.org/en/download). If you are using Windows, you need to also install [Build Tools for Visual Studio](https://visualstudio.microsoft.com/downloads/) Ensure you're using Node.js version 20.x.x to avoid build errors with native dependencies. ```bash # Check your Node.js version node --version # If you need to install Node.js 20.x.x, we recommend using nvm: # curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash # nvm install 20 # nvm use 20 ``` ### Installation ```bash npm run setup ``` ## Highlights ### Ask: get answers based on all your previous screen actions & audio booking-screen ### Meetings: real-time meeting notes, live summaries, session records booking-screen ### Use your own API key, or sign up to use ours (free) booking-screen **Currently Supporting:** - OpenAI API: Get OpenAI API Key [here](https://platform.openai.com/api-keys) - Gemini API: Get Gemini API Key [here](https://aistudio.google.com/apikey) - Local LLM Ollama & Whisper ### Liquid Glass Design (coming soon) booking-screen

for a more detailed guide, please refer to this video. we don't waste money on fancy vids; we just code.

## Keyboard Shortcuts `Ctrl/Cmd + \` : show and hide main window `Ctrl/Cmd + Enter` : ask AI using all your previous screen and audio `Ctrl/Cmd + Arrows` : move main window position ## Repo Activity ![Alt](https://repobeats.axiom.co/api/embed/a23e342faafa84fa8797fa57762885d82fac1180.svg "Repobeats analytics image") ## Contributing We love contributions! Feel free to open issues for bugs or feature requests. For detailed guide, please see our [contributing guide](/CONTRIBUTING.md). > Currently, we're working on a full code refactor and modularization. Once that's completed, we'll jump into addressing the major issues. ### Contributors ### Help Wanted Issues We have a list of [help wanted](https://github.com/pickle-com/glass/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22%F0%9F%99%8B%E2%80%8D%E2%99%82%EF%B8%8Fhelp%20wanted%22) that contain small features and bugs which have a relatively limited scope. This is a great place to get started, gain experience, and get familiar with our contribution process. ### 🛠 Current Issues & Improvements | Status | Issue | Description | |--------|--------------------------------|---------------------------------------------------| | 🚧 WIP | Liquid Glass | Liquid Glass UI for MacOS 26 | ### Changelog - Jul 5: Now support Gemini, Intel Mac supported - Jul 6: Full code refactoring has done. - Jul 7: Now support Claude, LLM/STT model selection - Jul 8: Now support Windows(beta), Improved AEC by Rust(to seperate mic/system audio), shortcut editing(beta) - Jul 8: Now support Local LLM & STT, Firebase Data Storage ## About Pickle **Our mission is to build a living digital clone for everyone.** Glass is part of Step 1—a trusted pipeline that transforms your daily data into a scalable clone. Visit [pickle.com](https://pickle.com) to learn more. ## Star History [![Star History Chart](https://api.star-history.com/svg?repos=pickle-com/glass&type=Date)](https://www.star-history.com/#pickle-com/glass&Date) ================================================ FILE: build.js ================================================ const esbuild = require('esbuild'); const path = require('path'); const baseConfig = { bundle: true, platform: 'browser', format: 'esm', loader: { '.js': 'jsx' }, sourcemap: true, external: ['electron'], define: { 'process.env.NODE_ENV': `"${process.env.NODE_ENV || 'development'}"`, }, }; const entryPoints = [ { in: 'src/ui/app/HeaderController.js', out: 'public/build/header' }, { in: 'src/ui/app/PickleGlassApp.js', out: 'public/build/content' }, ]; async function build() { try { console.log('Building renderer process code...'); await Promise.all(entryPoints.map(point => esbuild.build({ ...baseConfig, entryPoints: [point.in], outfile: `${point.out}.js`, }))); console.log('✅ Renderer builds successful!'); } catch (e) { console.error('Renderer build failed:', e); process.exit(1); } } async function watch() { try { const contexts = await Promise.all(entryPoints.map(point => esbuild.context({ ...baseConfig, entryPoints: [point.in], outfile: `${point.out}.js`, }))); console.log('Watching for changes...'); await Promise.all(contexts.map(context => context.watch())); } catch (e) { console.error('Watch mode failed:', e); process.exit(1); } } if (process.argv.includes('--watch')) { watch(); } else { build(); } ================================================ FILE: docs/DESIGN_PATTERNS.md ================================================ # Glass: Design Patterns and Architectural Overview Welcome to the Glass project! This document is the definitive guide to the architectural patterns, conventions, and design philosophy that guide our development. Adhering to these principles is essential for building new features, maintaining the quality of our codebase, and ensuring a stable, consistent developer experience. The architecture is designed to be modular, robust, and clear, with a strict separation of concerns. --- ## Core Architectural Principles These are the fundamental rules that govern the entire application. 1. **Centralized Data Logic**: All data persistence logic (reading from or writing to a database) is centralized within the **Electron Main Process**. The UI layers (both Electron's renderer and the web dashboard) are forbidden from accessing data sources directly. 2. **Feature-Based Modularity**: Code is organized by feature (`src/features`) to promote encapsulation and separation of concerns. A new feature should be self-contained within its own directory. 3. **Dual-Database Repositories**: The data access layer uses a **Repository Pattern** that abstracts away the underlying database. Every repository that handles user data **must** have two implementations: one for the local `SQLite` database and one for the cloud `Firebase` database. Both must expose an identical interface. 4. **AI Provider Abstraction**: AI model interactions are abstracted using a **Factory Pattern**. To add a new provider (e.g., a new LLM), you only need to create a new provider module that conforms to the base interface in `src/common/ai/providers/` and register it in the `factory.js`. 5. **Single Source of Truth for Schema**: The schema for the local SQLite database is defined in a single location: `src/common/config/schema.js`. Any change to the database structure **must** be updated here. 6. **Encryption by Default**: All sensitive user data **must** be encrypted before being persisted to Firebase. This includes, but is not limited to, API keys, conversation titles, transcription text, and AI-generated summaries. This is handled automatically by the `createEncryptedConverter` Firestore helper. --- ## I. Electron Application Architecture (`src/`) This section details the architecture of the core desktop application. ### 1. Overall Pattern: Service-Repository The Electron app's logic is primarily built on a **Service-Repository** pattern, with the Views being the HTML/JS files in the `src/app` and `src/features` directories. - **Views** (`*.html`, `*View.js`): The UI layer. Views are responsible for rendering the interface and capturing user interactions. They are intentionally kept "dumb" and delegate all significant logic to a corresponding Service. - **Services** (`*Service.js`): Services contain the application's business logic. They act as the intermediary between Views and Repositories. For example, `sttService` contains the logic for STT, while `summaryService` handles the logic for generating summaries. - **Repositories** (`*.repository.js`): Repositories are responsible for all data access. They are the *only* part of the application that directly interacts with `sqliteClient` or `firebaseClient`. **Location of Modules:** - **Feature-Specific**: If a service or repository is used by only one feature, it should reside within that feature's directory (e.g., `src/features/listen/summary/summaryService.js`). - **Common**: If a service or repository is shared across multiple features (like `authService` or `userRepository`), it must be placed in `src/common/services/` or `src/common/repositories/` respectively. ### 2. Data Persistence: The Dual Repository Factory The application dynamically switches between using the local SQLite database and the cloud-based Firebase Firestore. - **SQLite**: The default data store for all users, especially those not logged in. This ensures full offline functionality. The low-level client is `src/common/services/sqliteClient.js`. - **Firebase**: Used exclusively for users who are authenticated. This enables data synchronization across devices and with the web dashboard. The selection mechanism is a sophisticated **Factory and Adapter Pattern** located in the `index.js` file of each repository directory (e.g., `src/common/repositories/session/index.js`). **How it works:** 1. **Service Call**: A service makes a call to a high-level repository function, like `sessionRepository.create('ask')`. The service is unaware of the user's state or the underlying database. 2. **Repository Selection (Factory)**: The `index.js` adapter logic first determines which underlying repository to use. It imports and calls `authService.getCurrentUser()` to check the login state. If the user is logged in, it selects `firebase.repository.js`; otherwise, it defaults to `sqlite.repository.js`. 3. **UID Injection (Adapter)**: The adapter then retrieves the current user's ID (`uid`) from `authService.getCurrentUserId()`. It injects this `uid` into the actual, low-level repository call (e.g., `firebaseRepository.create(uid, 'ask')`). 4. **Execution**: The selected repository (`sqlite` or `firebase`) executes the data operation. This powerful pattern accomplishes two critical goals: - It makes the services completely agnostic about the underlying data source. - It frees the services from the responsibility of managing and passing user IDs for every database query. **Visualizing the Data Flow** ```mermaid graph TD subgraph "Electron Main Process" A -- User Action --> B[Service Layer]; B -- Data Request --> C[Repository Factory]; C -- Check Login Status --> D{Decision}; D -- No --> E[SQLite Repository]; D -- Yes --> F[Firebase Repository]; E -- Access Local DB --> G[(SQLite)]; F -- Access Cloud DB --> H[(Firebase)]; G -- Return Data --> B; H -- Return Data --> B; B -- Update UI --> A; end style A fill:#D6EAF8,stroke:#3498DB style G fill:#E8DAEF,stroke:#8E44AD style H fill:#FADBD8,stroke:#E74C3C ``` --- ## II. Web Dashboard Architecture (`pickleglass_web/`) This section details the architecture of the Next.js web application, which serves as the user-facing dashboard for account management and cloud data viewing. ### 1. Frontend, Backend, and Main Process Communication The web dashboard has a more complex, three-part architecture: 1. **Next.js Frontend (`app/`):** The React-based user interface. 2. **Node.js Backend (`backend_node/`):** An Express.js server that acts as an intermediary. 3. **Electron Main Process (`src/`):** The ultimate authority for all local data access. Crucially, **the web dashboard's backend cannot access the local SQLite database directly**. It must communicate with the Electron main process to request data. ### 2. The IPC Data Flow When the web frontend needs data that resides in the local SQLite database (e.g., viewing a non-synced session), it follows this precise flow: 1. **HTTP Request**: The Next.js frontend makes a standard API call to its own Node.js backend (e.g., `GET /api/conversations`). 2. **IPC Request**: The Node.js backend receives the HTTP request. It **does not** contain any database logic. Instead, it uses the `ipcRequest` helper from `backend_node/ipcBridge.js`. 3. **IPC Emission**: `ipcRequest` sends an event to the Electron main process over an IPC channel (`web-data-request`). It passes three things: the desired action (e.g., `'get-sessions'`), a unique channel name for the response, and a payload. 4. **Main Process Listener**: The Electron main process has a listener (`ipcMain.on('web-data-request', ...)`) that receives this request. It identifies the action and calls the appropriate **Service** or **Repository** to fetch the data from the SQLite database. 5. **IPC Response**: Once the data is retrieved, the main process sends it back to the web backend using the unique response channel provided in the request. 6. **HTTP Response**: The web backend's `ipcRequest` promise resolves with the data, and the backend sends it back to the Next.js frontend as a standard JSON HTTP response. This round-trip ensures our core principle of centralizing data logic in the main process is never violated. **Visualizing the IPC Data Flow** ```mermaid sequenceDiagram participant FE as Next.js Frontend participant BE as Node.js Backend participant Main as Electron Main Process FE->>+BE: 1. HTTP GET /api/local-data Note over BE: Receives local data request BE->>+Main: 2. ipcRequest('get-data', responseChannel) Note over Main: Receives request, fetches data from SQLite
via Service/Repository Main-->>-BE: 3. ipcResponse on responseChannel (data) Note over BE: Receives data, prepares HTTP response BE-->>-FE: 4. HTTP 200 OK (JSON data) ``` ================================================ FILE: docs/refactor-plan.md ================================================ # Refactor Plan: Non-Window Logic Migration from windowManager.js ## Goal `windowManager.js`를 순수 창 관리 모듈로 만들기 위해 비즈니스 로직을 해당 서비스와 `featureBridge.js`로 이전. ## Steps (based on initial plan) 1. **Shortcuts**: Completed. Logic moved to `shortcutsService.js` and IPC to `featureBridge.js`. Used `internalBridge` for coordination. 2. **Screenshot**: Next. Move `captureScreenshot` function and related IPC handlers from `windowManager.js` to `askService.js` (since it's primarily used there). Update `askService.js` to use its own screenshot method. Add IPC handlers to `featureBridge.js` if needed. 3. **System Permissions**: Create new `permissionService.js` in `src/features/common/services/`. Move all permission-related logic (check, request, open preferences, mark completed, etc.) and IPC handlers from `windowManager.js` to the new service and `featureBridge.js`. 4. **API Key / Model State**: Completely remove from `windowManager.js` (e.g., `setupApiKeyIPC` and helpers). Ensure all usages (e.g., in `askService.js`) directly require and use `modelStateService.js` instead. ## Notes - Maintain original logic without changes. - Break circular dependencies if found. - Use `internalBridge` for inter-module communication where appropriate. - After each step, verify no errors and test functionality. ================================================ FILE: electron-builder.yml ================================================ # electron-builder.yml # The unique application ID appId: com.pickle.glass # The user-facing application name productName: Glass # Publish configuration for GitHub releases publish: provider: github owner: pickle-com repo: glass releaseType: draft # Protocols configuration for deep linking protocols: name: PickleGlass Protocol schemes: - pickleglass # List of files to be included in the app package files: - src/**/* - package.json - pickleglass_web/backend_node/**/* - '!**/node_modules/electron/**' - public/build/**/* # Additional resources to be copied into the app's resources directory extraResources: - from: pickleglass_web/out to: out asarUnpack: - "src/ui/assets/SystemAudioDump" - "**/node_modules/sharp/**/*" - "**/node_modules/@img/**/*" # Windows configuration win: icon: src/ui/assets/logo.ico target: - target: nsis arch: x64 - target: portable arch: x64 requestedExecutionLevel: asInvoker signAndEditExecutable: true cscLink: build\certs\glass-dev.pfx cscKeyPassword: "${env.CSC_KEY_PASSWORD}" signtoolOptions: certificateSubjectName: "Glass Dev Code Signing" # NSIS installer configuration for Windows nsis: oneClick: false perMachine: false allowToChangeInstallationDirectory: true deleteAppDataOnUninstall: true createDesktopShortcut: always createStartMenuShortcut: true shortcutName: Glass # macOS specific configuration mac: # The application category type category: public.app-category.utilities # Path to the .icns icon file icon: src/ui/assets/logo.icns # Minimum macOS version (supports both Intel and Apple Silicon) minimumSystemVersion: '11.0' hardenedRuntime: true entitlements: entitlements.plist entitlementsInherit: entitlements.plist target: - target: dmg arch: universal - target: zip arch: universal ================================================ FILE: entitlements.plist ================================================ com.apple.security.cs.allow-jit com.apple.security.cs.allow-unsigned-executable-memory com.apple.security.cs.debugger com.apple.security.cs.disable-library-validation com.apple.security.device.audio-input com.apple.security.device.microphone com.apple.security.network.client com.apple.security.network.server com.apple.security.temporary-exception.mach-lookup.global-name com.deeplink.pickleglass.MachPortRendezvousServer.* com.apple.security.app-sandbox ================================================ FILE: firebase.json ================================================ { "functions": [ { "source": "functions", "codebase": "pickle-glass", "ignore": [ "node_modules", ".git", "firebase-debug.log", "firebase-debug.*.log", "*.local" ], "predeploy": [ "npm --prefix \"$RESOURCE_DIR\" run lint" ] } ], "firestore": { "rules": "firestore.rules", "indexes": "firestore.indexes.json" }, "hosting": { "public": "pickleglass_web/out", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ], "rewrites": [ { "source": "**", "destination": "/index.html" } ] } } ================================================ FILE: firestore.indexes.json ================================================ { "indexes": [], "fieldOverrides": [] } ================================================ FILE: functions/.eslintrc.js ================================================ module.exports = { env: { es6: true, node: true, }, parserOptions: { "ecmaVersion": 2018, }, extends: [ "eslint:recommended", "google", ], rules: { "no-restricted-globals": ["error", "name", "length"], "prefer-arrow-callback": "error", "quotes": ["error", "double", {"allowTemplateLiterals": true}], }, overrides: [ { files: ["**/*.spec.*"], env: { mocha: true, }, rules: {}, }, ], globals: {}, }; ================================================ FILE: functions/.gitignore ================================================ node_modules/ *.local ================================================ FILE: functions/index.js ================================================ /** * Import function triggers from their respective submodules: * * const {onCall} = require("firebase-functions/v2/https"); * const {onDocumentWritten} = require("firebase-functions/v2/firestore"); * * See a full list of supported triggers at https://firebase.google.com/docs/functions */ const {onRequest} = require("firebase-functions/v2/https"); const logger = require("firebase-functions/logger"); const admin = require("firebase-admin"); const cors = require("cors")({origin: true}); admin.initializeApp(); // Create and deploy your first functions // https://firebase.google.com/docs/functions/get-started // exports.helloWorld = onRequest((request, response) => { // logger.info("Hello logs!", {structuredData: true}); // response.send("Hello from Firebase!"); // }); /** * @name pickleGlassAuthCallback * @description * Validate Firebase ID token and return custom token. * On success, return success response with user information. * On failure, return error message. * * @param {object} request - HTTPS request object. { token: "..." } in body. * @param {object} response - HTTPS response object. */ const authCallbackHandler = (request, response) => { cors(request, response, async () => { try { logger.info("pickleGlassAuthCallback function triggered", { body: request.body, }); if (request.method !== "POST") { response.status(405).send("Method Not Allowed"); return; } if (!request.body || !request.body.token) { logger.error("Token is missing from the request body"); response.status(400).send({ success: false, error: "ID token is required.", }); return; } const idToken = request.body.token; const decodedToken = await admin.auth().verifyIdToken(idToken); const uid = decodedToken.uid; logger.info("Successfully verified token for UID:", uid); const customToken = await admin.auth().createCustomToken(uid); response.status(200).send({ success: true, message: "Authentication successful.", user: { uid: decodedToken.uid, email: decodedToken.email, name: decodedToken.name, picture: decodedToken.picture, }, customToken, }); } catch (error) { logger.error("Authentication failed:", error); response.status(401).send({ success: false, error: "Invalid token or authentication failed.", details: error.message, }); } }); }; exports.pickleGlassAuthCallback = onRequest( {region: "us-west1"}, authCallbackHandler, ); ================================================ FILE: functions/package.json ================================================ { "name": "functions", "description": "Cloud Functions for Firebase", "scripts": { "lint": "eslint . --fix", "serve": "firebase emulators:start --only functions", "shell": "firebase functions:shell", "start": "npm run shell", "deploy": "firebase deploy --only functions", "logs": "firebase functions:log" }, "engines": { "node": "20" }, "main": "index.js", "dependencies": { "cors": "^2.8.5", "firebase-admin": "^12.7.0", "firebase-functions": "^6.0.1" }, "devDependencies": { "eslint": "^8.15.0", "eslint-config-google": "^0.14.0", "firebase-functions-test": "^3.1.0" }, "private": true } ================================================ FILE: notarize.js ================================================ const { notarize } = require('@electron/notarize'); exports.notarizeApp = async function (context) { if (context.electronPlatformName !== 'darwin') { return; } console.log(' notarizing a macOS build!'); const { appOutDir } = context; const appName = context.packager.appInfo.productFilename; const appPath = `${appOutDir}/${appName}.app`; if (!process.env.APPLE_ID || !process.env.APPLE_ID_PASSWORD || !process.env.APPLE_TEAM_ID) { throw new Error('APPLE_ID, APPLE_ID_PASSWORD, and APPLE_TEAM_ID environment variables are required for notarization.'); } await notarize({ appBundleId: 'com.pickle.glass', appPath: appPath, appleId: process.env.APPLE_ID, appleIdPassword: process.env.APPLE_ID_PASSWORD, teamId: process.env.APPLE_TEAM_ID, }); console.log(`Successfully notarized ${appName}`); }; ================================================ FILE: package.json ================================================ { "name": "pickle-glass", "productName": "Glass", "version": "0.2.4", "description": "Cl*ely for Free", "main": "src/index.js", "scripts": { "setup": "npm install && cd pickleglass_web && npm install && npm run build && cd .. && npm start", "start": "npm run build:renderer && electron .", "package": "npm run build:all && electron-builder --dir", "make": "npm run build:renderer && electron-forge make", "build": "npm run build:all && electron-builder --config electron-builder.yml --publish never", "build:win": "npm run build:all && electron-builder --win --x64 --publish never", "publish": "npm run build:all && electron-builder --config electron-builder.yml --publish always", "lint": "eslint --ext .ts,.tsx,.js .", "postinstall": "electron-builder install-app-deps", "build:renderer": "node build.js", "build:web": "cd pickleglass_web && npm run build && cd ..", "build:all": "npm run build:renderer && npm run build:web", "watch:renderer": "node build.js --watch" }, "keywords": [ "glass", "pickle glass", "ai assistant", "real-time", "live summary", "contextual ai" ], "author": { "name": "Pickle Team" }, "license": "GPL-3.0", "dependencies": { "@anthropic-ai/sdk": "^0.56.0", "@deepgram/sdk": "^4.9.1", "@google/genai": "^1.8.0", "@google/generative-ai": "^0.24.1", "axios": "^1.10.0", "better-sqlite3": "^9.6.0", "cors": "^2.8.5", "dotenv": "^17.0.0", "electron-squirrel-startup": "^1.0.1", "electron-store": "^8.2.0", "electron-updater": "^6.6.2", "express": "^4.18.2", "firebase": "^11.10.0", "firebase-admin": "^13.4.0", "jsonwebtoken": "^9.0.2", "keytar": "^7.9.0", "node-fetch": "^2.7.0", "openai": "^4.70.0", "portkey-ai": "^1.10.1", "react-hot-toast": "^2.5.2", "sharp": "^0.34.2", "validator": "^13.11.0", "wait-on": "^8.0.3", "ws": "^8.18.0" }, "devDependencies": { "@electron/fuses": "^1.8.0", "@electron/notarize": "^2.5.0", "electron": "^30.5.1", "electron-builder": "^26.0.12", "electron-reloader": "^1.2.3", "esbuild": "^0.25.5", "prettier": "^3.6.2" }, "optionalDependencies": { "electron-liquid-glass": "^1.0.1" } } ================================================ FILE: pickleglass_web/app/activity/details/page.tsx ================================================ 'use client' import { useState, useEffect, Suspense } from 'react' import { useRedirectIfNotAuth } from '@/utils/auth' import { useSearchParams, useRouter } from 'next/navigation' import Link from 'next/link' import { UserProfile, SessionDetails, Transcript, AiMessage, getSessionDetails, deleteSession, } from '@/utils/api' type ConversationItem = (Transcript & { type: 'transcript' }) | (AiMessage & { type: 'ai_message' }); const Section = ({ title, children }: { title: string, children: React.ReactNode }) => (

{title}

{children}
); function SessionDetailsContent() { const userInfo = useRedirectIfNotAuth() as UserProfile | null; const [sessionDetails, setSessionDetails] = useState(null); const [isLoading, setIsLoading] = useState(true); const searchParams = useSearchParams(); const sessionId = searchParams.get('sessionId'); const router = useRouter(); const [deleting, setDeleting] = useState(false); useEffect(() => { if (userInfo && sessionId) { const fetchDetails = async () => { setIsLoading(true); try { const details = await getSessionDetails(sessionId as string); setSessionDetails(details); } catch (error) { console.error('Failed to load session details:', error); } finally { setIsLoading(false); } }; fetchDetails(); } }, [userInfo, sessionId]); const handleDelete = async () => { if (!sessionId) return; if (!window.confirm('Are you sure you want to delete this activity? This cannot be undone.')) return; setDeleting(true); try { await deleteSession(sessionId); router.push('/activity'); } catch (error) { alert('Failed to delete activity.'); setDeleting(false); console.error(error); } }; if (!userInfo || isLoading) { return (

Loading session details...

); } if (!sessionDetails) { return (

Session Not Found

The requested session could not be found.

← Back to Activity
) } const askMessages = sessionDetails.ai_messages || []; return (
Back

{sessionDetails.session.title || `Conversation on ${new Date(sessionDetails.session.started_at * 1000).toLocaleDateString()}`}

{new Date(sessionDetails.session.started_at * 1000).toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' })} {new Date(sessionDetails.session.started_at * 1000).toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit', hour12: true })} {sessionDetails.session.session_type}
{sessionDetails.summary && (

"{sessionDetails.summary.tldr}"

{sessionDetails.summary.bullet_json && JSON.parse(sessionDetails.summary.bullet_json).length > 0 &&

Key Points:

    {JSON.parse(sessionDetails.summary.bullet_json).map((point: string, index: number) => (
  • {point}
  • ))}
} {sessionDetails.summary.action_json && JSON.parse(sessionDetails.summary.action_json).length > 0 &&

Action Items:

    {JSON.parse(sessionDetails.summary.action_json).map((action: string, index: number) => (
  • {action}
  • ))}
}
)} {sessionDetails.transcripts && sessionDetails.transcripts.length > 0 && (
{sessionDetails.transcripts.map((item) => (

{item.speaker}: {item.text}

))}
)} {askMessages.length > 0 && (
{askMessages.map((item) => (

{item.role === 'user' ? 'You' : 'AI'}

{item.content}

))}
)}
); } export default function SessionDetailsPage() { return (

Loading...

}>
); } ================================================ FILE: pickleglass_web/app/activity/page.tsx ================================================ 'use client' import { useState, useEffect } from 'react' import Link from 'next/link' import { useRedirectIfNotAuth } from '@/utils/auth' import { UserProfile, Session, getSessions, deleteSession, } from '@/utils/api' export default function ActivityPage() { const userInfo = useRedirectIfNotAuth() as UserProfile | null; const [sessions, setSessions] = useState([]) const [isLoading, setIsLoading] = useState(true) const [deletingId, setDeletingId] = useState(null) const fetchSessions = async () => { try { const fetchedSessions = await getSessions(); setSessions(fetchedSessions); } catch (error) { console.error('Failed to fetch conversations:', error) } finally { setIsLoading(false) } } useEffect(() => { fetchSessions() }, []) if (!userInfo) { return (

Loading...

) } const getGreeting = () => { const hour = new Date().getHours() if (hour < 12) return 'Good morning' if (hour < 18) return 'Good afternoon' return 'Good evening' } const handleDelete = async (sessionId: string) => { if (!window.confirm('Are you sure you want to delete this activity? This cannot be undone.')) return; setDeletingId(sessionId); try { await deleteSession(sessionId); setSessions(sessions => sessions.filter(s => s.id !== sessionId)); } catch (error) { alert('Failed to delete activity.'); console.error(error); } finally { setDeletingId(null); } } return (

{getGreeting()}, {userInfo.display_name}

Your Past Activity

{isLoading ? (

Loading conversations...

) : sessions.length > 0 ? (
{sessions.map((session) => (
{session.title || `Conversation - ${new Date(session.started_at * 1000).toLocaleDateString()}`}
{new Date(session.started_at * 1000).toLocaleString()}
{session.session_type || 'ask'}
))}
) : (

No conversations yet. Start a conversation in the desktop app to see your activity here.

💡 Tip: Use the desktop app to have AI-powered conversations that will appear here automatically.
)}
) } ================================================ FILE: pickleglass_web/app/download/page.tsx ================================================ 'use client' import { Download, Smartphone, Monitor, Tablet } from 'lucide-react' import { useRedirectIfNotAuth } from '@/utils/auth' export default function DownloadPage() { const userInfo = useRedirectIfNotAuth() if (!userInfo) { return (

Loading...

) } return (

Download pickleglass

Use pickleglass on various platforms

Desktop

Windows, macOS, Linux

Mobile

iOS, Android

Tablet

iPad, Android Tablet

System Requirements

Windows

  • • Windows 10 or later
  • • 4GB RAM
  • • 100MB Storage

macOS

  • • macOS 11.0 or later
  • • 4GB RAM
  • • 100MB Storage

Mobile

  • • iOS 14.0 or later
  • • Android 8.0 or later
  • • 50MB Storage

Having issues? Check out our Help Center.

) } ================================================ FILE: pickleglass_web/app/globals.css ================================================ @tailwind base; @tailwind components; @tailwind utilities; :root { --foreground-rgb: 0, 0, 0; --background-start-rgb: 214, 219, 220; --background-end-rgb: 255, 255, 255; } @media (prefers-color-scheme: dark) { :root { --foreground-rgb: 255, 255, 255; --background-start-rgb: 0, 0, 0; --background-end-rgb: 0, 0, 0; } } body { color: rgb(var(--foreground-rgb)); background: linear-gradient( to bottom, transparent, rgb(var(--background-end-rgb)) ) rgb(var(--background-start-rgb)); letter-spacing: -0.03em; } @layer utilities { .text-balance { text-wrap: balance; } } ================================================ FILE: pickleglass_web/app/help/page.tsx ================================================ 'use client' import { HelpCircle, Book, MessageCircle, Mail } from 'lucide-react' import { useRedirectIfNotAuth } from '@/utils/auth' export default function HelpPage() { const userInfo = useRedirectIfNotAuth() if (!userInfo) { return (

Loading...

) } return (

Help Center

Getting Started

New to pickleglass? Learn about basic features and setup methods.

  • • Setting up personalized contexts
  • • Selecting presets and creating custom contexts
  • • Checking activity records
  • • Changing settings

Frequently Asked Questions

Check out frequently asked questions and answers from other users.

How do I change the context?

On the Personalize page, select a preset or enter a custom context, then click the Save button.

Where can I check my activity history?

You can check your past activity records on the My Activity page.

Community

Connect with other users and share tips.

Contact Us

Couldn't find a solution? Contact us directly.

💡 Tip

Each context is optimized for different situations. Choose the appropriate preset for your work environment, or create your own custom context!

) } ================================================ FILE: pickleglass_web/app/layout.tsx ================================================ import './globals.css' import { Inter } from 'next/font/google' import ClientLayout from '@/components/ClientLayout' const inter = Inter({ subsets: ['latin'] }) export const metadata = { title: 'pickleglass - AI Assistant', description: 'Personalized AI Assistant for various contexts', } export default function RootLayout({ children, }: { children: React.ReactNode }) { return ( {children} ) } ================================================ FILE: pickleglass_web/app/login/page.tsx ================================================ 'use client' import { useRouter } from 'next/navigation' import { GoogleAuthProvider, signInWithPopup } from 'firebase/auth' import { auth } from '@/utils/firebase' import { Chrome } from 'lucide-react' import { useState, useEffect } from 'react' export default function LoginPage() { const router = useRouter() const [isLoading, setIsLoading] = useState(false) const [isElectronMode, setIsElectronMode] = useState(false) useEffect(() => { const urlParams = new URLSearchParams(window.location.search) const mode = urlParams.get('mode') setIsElectronMode(mode === 'electron') }, []) const handleGoogleSignIn = async () => { const provider = new GoogleAuthProvider() setIsLoading(true) try { const result = await signInWithPopup(auth, provider) const user = result.user if (user) { console.log('✅ Google login successful:', user.uid) if (isElectronMode) { try { const idToken = await user.getIdToken() const deepLinkUrl = `pickleglass://auth-success?` + new URLSearchParams({ uid: user.uid, email: user.email || '', displayName: user.displayName || '', token: idToken }).toString() console.log('🔗 Return to electron app via deep link:', deepLinkUrl) window.location.href = deepLinkUrl // Maybe we don't need this // setTimeout(() => { // alert('Login completed. Please return to Pickle Glass app.') // }, 1000) } catch (error) { console.error('❌ Deep link processing failed:', error) alert('Login was successful but failed to return to app. Please check the app.') } } else if (typeof window !== 'undefined' && window.require) { try { const { ipcRenderer } = window.require('electron') const idToken = await user.getIdToken() ipcRenderer.send('firebase-auth-success', { uid: user.uid, displayName: user.displayName, email: user.email, idToken }) console.log('📡 Auth info sent to electron successfully') } catch (error) { console.error('❌ Electron communication failed:', error) } } else { router.push('/settings') } } } catch (error: any) { console.error('❌ Google login failed:', error) if (error.code !== 'auth/popup-closed-by-user') { alert('An error occurred during login. Please try again.') } } finally { setIsLoading(false) } } return (

Welcome to Pickle Glass

Sign in with your Google account to sync your data across all devices.

{isElectronMode ? (

🔗 Login requested from Electron app

) : (

Local mode will run if you don't sign in.

)}

By signing in, you agree to our Terms of Service and Privacy Policy.

) } ================================================ FILE: pickleglass_web/app/page.tsx ================================================ 'use client' import { useEffect } from 'react' import { useRouter } from 'next/navigation' export default function Home() { const router = useRouter() useEffect(() => { router.push('/personalize') }, [router]) return (

Loading...

) } ================================================ FILE: pickleglass_web/app/personalize/page.tsx ================================================ 'use client' import { useState, useEffect } from 'react' import { ChevronDown, Plus, Copy } from 'lucide-react' import { getPresets, updatePreset, createPreset, PromptPreset } from '@/utils/api' export default function PersonalizePage() { const [allPresets, setAllPresets] = useState([]); const [selectedPreset, setSelectedPreset] = useState(null); const [showPresets, setShowPresets] = useState(true); const [editorContent, setEditorContent] = useState(''); const [loading, setLoading] = useState(true); const [saving, setSaving] = useState(false); const [isDirty, setIsDirty] = useState(false); useEffect(() => { const fetchData = async () => { try { setLoading(true); const presetsData = await getPresets(); setAllPresets(presetsData); if (presetsData.length > 0) { const firstUserPreset = presetsData.find(p => p.is_default === 0) || presetsData[0]; setSelectedPreset(firstUserPreset); setEditorContent(firstUserPreset.prompt); } } catch (error) { console.error("Failed to fetch presets:", error); } finally { setLoading(false); } }; fetchData(); }, []); const handlePresetClick = (preset: PromptPreset) => { if (isDirty && !window.confirm("You have unsaved changes. Are you sure you want to switch?")) { return; } setSelectedPreset(preset); setEditorContent(preset.prompt); setIsDirty(false); }; const handleEditorChange = (e: React.ChangeEvent) => { setEditorContent(e.target.value); setIsDirty(true); }; const handleSave = async () => { if (!selectedPreset || saving || !isDirty) return; if (selectedPreset.is_default === 1) { alert("Default presets cannot be modified."); return; } try { setSaving(true); await updatePreset(selectedPreset.id, { title: selectedPreset.title, prompt: editorContent }); setAllPresets(prev => prev.map(p => p.id === selectedPreset.id ? { ...p, prompt: editorContent } : p ) ); setIsDirty(false); } catch (error) { console.error("Save failed:", error); alert("Failed to save preset. See console for details."); } finally { setSaving(false); } }; const handleCreateNewPreset = async () => { const title = prompt("Enter a title for the new preset:"); if (!title) return; try { setSaving(true); const { id } = await createPreset({ title, prompt: "Enter your custom prompt here..." }); const newPreset: PromptPreset = { id, uid: 'current_user', title, prompt: "Enter your custom prompt here...", is_default: 0, created_at: Date.now(), sync_state: 'clean' }; setAllPresets(prev => [...prev, newPreset]); setSelectedPreset(newPreset); setEditorContent(newPreset.prompt); setIsDirty(false); } catch (error) { console.error("Failed to create preset:", error); alert("Failed to create preset. See console for details."); } finally { setSaving(false); } }; const handleDuplicatePreset = async () => { if (!selectedPreset) return; const title = prompt("Enter a title for the duplicated preset:", `${selectedPreset.title} (Copy)`); if (!title) return; try { setSaving(true); const { id } = await createPreset({ title, prompt: editorContent }); const newPreset: PromptPreset = { id, uid: 'current_user', title, prompt: editorContent, is_default: 0, created_at: Date.now(), sync_state: 'clean' }; setAllPresets(prev => [...prev, newPreset]); setSelectedPreset(newPreset); setIsDirty(false); } catch (error) { console.error("Failed to duplicate preset:", error); alert("Failed to duplicate preset. See console for details."); } finally { setSaving(false); } }; if (loading) { return (
Loading...
); } return (

Presets

Personalize

{selectedPreset && ( )}
{showPresets && (
{allPresets.map((preset) => (
handlePresetClick(preset)} className={` p-4 rounded-lg cursor-pointer transition-all duration-200 bg-white h-48 flex flex-col shadow-sm hover:shadow-md relative ${selectedPreset?.id === preset.id ? 'border-2 border-blue-500 shadow-md' : 'border border-gray-200 hover:border-gray-300' } `} > {preset.is_default === 1 && (
Default
)}

{preset.title}

{preset.prompt.substring(0, 100) + (preset.prompt.length > 100 ? '...' : '')}

))}
)}
{selectedPreset?.is_default === 1 && (

This is a default preset and cannot be edited. Use the "Duplicate" button above to create an editable copy, or create a new preset.

)}