config loading (#1820)
* Nate/control plane client (#1691) * docs: add docs and schema for "OS" provider (#1536) * ignore .env * fix(gui): ctx rendering w/ renderInlineAs: "" (#1541) * ✨ use and cache imports for autocomplete (#1456) * ✨ use and cache imports for autocomplete * fix tsc * fix codeqwen autocomplete leading space * add voyage rerank-1 * feat: `--noEmit` for tsc checks in CI (#1559) * docs: update CustomContextProvider docs (#1557) * add stop tokens to qwen prompt * update docs to reflect 3.5 sonnet being best * docs: comment out unused providers (#1561) * import Handlebars * feat: toast notification for config updates (#1560) * feat: toast notification for config updates * feat: only trigger toast on config.json save * displayRawMarkdown option * feat: open pane on install (#1564) * feat: open pane on activation * comment out testing code * update to reflect 16 stop words limit for deepseek * feat: only trigger config update toast in vscode (#1571) * docs(prompt-files): fix typos + clarify (#1575) * doc: prompt file typo + clarifications * fix: add back correct docs * chore: add telemetry for pageviews (#1576) * feat: update onboarding w/ embeddings model (#1570) * chore(gui): remove unused pages * feat: add embeddings step * feat: update styles * feat: copy button updates * fix: correct pull command for embed model * fix: remove commented code * fix: remove commented code * feat: simplify copy btn props * chore: rename onboarding selection event * feat: add provider config * fix: undo msg name * remove dead code * fix: invalid mode check * fix: remove testing logic * docs(telemetry): add pageviews to tracking list (#1581) * Add reranker configuration options to codebase embedding docs (#1584) - Introduce reranker concept - List available reranker options - Provide configuration instructions - Update keywords to include "reranker" * chore: update pr template with screenshots (#1590) * Refactor ConfirmationDialog to use SecondaryButton for cancel action (#1586) * Added instructions for running docs server locally (#1578) - Added NPM script method - Added VS Code task method - Update contributing guidelines * Update branch policy (#1577) - Change PR target to `dev` branch - Update `CONTRIBUTING.md` instructions * Consolidate example configurations into the main configuration guide (#1579) - Moved examples to configuration.md - Deleted the separate examples.md file - Updated sidebar order and links - Improved readability and structure in configuration.md * fix: fullscreen gui retains context when hidden, fixed fullscreen focusing (#1582) * Update completionProvider.ts (warning tab-autocomplete models) (#1566) * feat: enhanced IndexingProgressBar with blinking dot feature - Integrated BlinkingDot component - Added STATUS_COLORS for various states - Replaced CircleDiv with BlinkingDot in UI - Updated status messages and layout * small UI tweaks * feat(gui): enhance ModelCard, ModelProviderTag, and Toggle components (#1595) - add styling and adjustments to ModelCard - update ModelProviderTag font size - remove box shadow from Toggle component - tweak icon styles in ModelCard - improve alignment and spacing * media query * feat: add best experience onboarding * fix: file rename * stop movement on button hover by keeping same border thickness * fix mistake in setting cursor: pointer * fix when free trial option is shown * Support Node.js versions below 20 for streaming response handling (#1591) - Add fallback for Node < 20 - Implement toAsyncIterable for streaming - Use TextDecoder for manual decoding - Maintain existing streaming for Node 20+ * small fixes * feat: add free trial card to onboarding (#1600) * feat: add free trial card to onboarding * add import * fix hasPassedFTL * fix /edit cancellation from UI * feat: add `applyCodeBlock` experimental prop (#1601) * feat: add new model styling improvements (#1609) * feat: add new model styling improvements * better gap size * feat: update bug_report.yml (#1610) * chore: update bug_report.yml * typo fix * feat: add labels to "Add docs" dialog (#1612) * feat: add labels to "Add docs" dialog * remove autofocus * don't double load config * small fixes * speed up directory traversal, and use correct native path module * option not to show config update toast * merge air-gapped and recommended setup pages * chore: add telemetry for full screen toggle (#1618) * Fix headings in codebase-embeddings.md (#1617) * mention jetbrains * docs: update changie (#1619) * feat: updated changie config * hide toc and autogenerate * Update changelog.mdx * link to deeper explanation of embeddings models * ensure target="_blank" for all links in sidebar * fix gif links in intellij README.md * don't require rust in dependency installation * chore: fix padding on gh button (#1620) * chore: adjust button padding * Update tasks.json * escape colons in diff path * smoother lancedb indexing reporting * smooth progress updates for indexing * fix tsc err * rerank-lite-1 * remove doccs * basic tests for VS Code extension * improved testing of VS Code extension * docs: add docs and schema for "OS" provider (#1536) * ignore .env * 🚑 fix constant warnings when onboarding with Ollama * ✨ use and cache imports for autocomplete (#1456) * ✨ use and cache imports for autocomplete * fix tsc * team analytics * apply control plane settings * workos auth * ide protocol get session info * UI for auth * profile switching * small fixes * updates * refresh tokens * updates * fix tsc errs * model select in toolbar to make room for profile selector * prod client id * link to prod URL * internal beta option * profiles change listener --------- Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com> Co-authored-by: Priyash <38959321+priyashpatil@users.noreply.github.com> Co-authored-by: Jonah Wagner <jonahwagner231@gmail.com> Co-authored-by: YohannZe <99359799+YohannZe@users.noreply.github.com> Co-authored-by: Dan Dascalescu <ddascalescu+github@gmail.com> * temporary patch for type errs * Dev (#1689) * Fix an issue where CMD+K does not clear the terminal when the terminal has focus (#1671) On MacOS, ⌘+K is bound, by default, to Terminal:Clear. Without this change ⌘+K does not clear the terminal but instead iniates a chord sequence and waits for the next stroke of the chord. Co-authored-by: Rob Leidle <rleidle@tesla.com> * Change treeSitter to cache the Language objects it loads from wasm (#1672) Without this change, for a repository with 600 typescript files, the indexer would fail to finish correctly and there would be many of the following errors in the webview console log: 'Unable to load language for file ${path} RuntimeError: table index is out of bounds' The following bash will create a repo that reproduces the problem: current_path="." for ((i=1; i<=20; i++)); do new_folder="folder-$i" mkdir -p "$current_path/$new_folder" current_path="$current_path/$new_folder" for ((a=1; a<=30; a++)); do head -c 10000 /dev/urandom | base64 > "$current_path/file-$a.ts" done done Co-authored-by: Rob Leidle <rleidle@tesla.com> * acknowledge sourcemap flag in esbuild.js * don't run jetbrains-release.yaml on vscode releases * further testing for walkDir * chore: add telemetry to commands (#1673) * test: Add basic unit test to baseLLM (#1668) * update version * test: Add basic unit test to baseLLM --------- Co-authored-by: Nate Sesti <sestinj@gmail.com> Co-authored-by: inimaz <imaz@ai-verse.com> * feat: add Quick Actions CodeLens feature (#1674) * docs: add docs and schema for "OS" provider (#1536) * ignore .env * ✨ use and cache imports for autocomplete (#1456) * ✨ use and cache imports for autocomplete * fix tsc * add voyage rerank-1 * import Handlebars * feat: open pane on install (#1564) * feat: open pane on activation * comment out testing code * chore: add telemetry for pageviews (#1576) * feat: update onboarding w/ embeddings model (#1570) * chore(gui): remove unused pages * feat: add embeddings step * feat: update styles * feat: copy button updates * fix: correct pull command for embed model * fix: remove commented code * fix: remove commented code * feat: simplify copy btn props * chore: rename onboarding selection event * feat: add provider config * fix: undo msg name * remove dead code * fix: invalid mode check * fix: remove testing logic * fix: fullscreen gui retains context when hidden, fixed fullscreen focusing (#1582) * small UI tweaks * media query * feat: add best experience onboarding * small fixes * feat: add free trial card to onboarding (#1600) * feat: add free trial card to onboarding * add import * chore: add telemetry for full screen toggle (#1618) * rerank-lite-1 * remove doccs * basic tests for VS Code extension * improved testing of VS Code extension * manually implement stop tokens for hf inference api * chore: onboarding metrics (#1626) * fix: pageview tracking * feat: add onboarding telemetry * create single `onboardingStatus` type * improved var naming * remove console logs * fix windows performance issue * rename vscodeExtension.ts * migration of onboarding variables * "stash" instead of "delete" in indexing progress * fix preview.yaml * also fix main.yaml * Update troubleshooting.md (#1637) * feat: add quick actions * Update index.d.ts * quick actions mvp * update docs * subscribe to vscode change settings * Update commands.ts * cleanup * Update quick-actions.md * Update VerticalPerLineCodeLensProvider.ts * resolve feedback --------- Co-authored-by: Nate Sesti <sestinj@gmail.com> Co-authored-by: Nate Sesti <33237525+sestinj@users.noreply.github.com> Co-authored-by: Jonah Wagner <jonahwagner231@gmail.com> * chore: add `isCommandEvent` to command telemetry (#1675) * chore: add `isCommandEvent` to command telemetry * Update commands.ts * Nate/better retrieval (#1677) * deduplicatearray tests * break out separate retrieval pipelines * IConfigHandler * tests for codebase indexer * better .continueignore for continue * indexing fixes * ignore .gitignore and .continueignore when indexing * retrieval pipeline improvements * fix formatting err in out .continueignore * add necessary filter to lance_db_cache * update package.json version * skip unused tests * don't ignore .prompt files * update version * Update pull_request_template.md * don't use multi-media format when there are multiple text items * add free trial experience (#1685) * fix: add code range for quick actions/fixes (#1687) * fix: add code range for quick actions/fixes * Update test.js * add pathSep message type * docs improvements * jetbrains fix * update package.json version --------- Co-authored-by: Rob Leidle <rleidle@gmail.com> Co-authored-by: Rob Leidle <rleidle@tesla.com> Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com> Co-authored-by: inimaz <49730431+inimaz@users.noreply.github.com> Co-authored-by: inimaz <imaz@ai-verse.com> Co-authored-by: Jonah Wagner <jonahwagner231@gmail.com> Co-authored-by: Priyash <38959321+priyashpatil@users.noreply.github.com> * update package.json version * skip extension tests * update package.json version * handlebars import * don't push package.json version change from CI * fix: scroll issues w/ code blocks (#1688) * fix: scroll issues w/ code blocks * chore: name offset * chore: remove docs start * chore: update headings on troubleshooting.md (#1696) * ignore .svn folder for indexing (#1699) * chore: clearer naming for `useSuffix` (#1702) * chore: clearer naming for `useSuffix` * schema updates * fix: cmd+shft+l closes sidebar if focused (#1638) * docs: add docs and schema for "OS" provider (#1536) * ignore .env * ✨ use and cache imports for autocomplete (#1456) * ✨ use and cache imports for autocomplete * fix tsc * add voyage rerank-1 * import Handlebars * feat: open pane on install (#1564) * feat: open pane on activation * comment out testing code * chore: add telemetry for pageviews (#1576) * feat: update onboarding w/ embeddings model (#1570) * chore(gui): remove unused pages * feat: add embeddings step * feat: update styles * feat: copy button updates * fix: correct pull command for embed model * fix: remove commented code * fix: remove commented code * feat: simplify copy btn props * chore: rename onboarding selection event * feat: add provider config * fix: undo msg name * remove dead code * fix: invalid mode check * fix: remove testing logic * fix: fullscreen gui retains context when hidden, fixed fullscreen focusing (#1582) * small UI tweaks * media query * feat: add best experience onboarding * small fixes * feat: add free trial card to onboarding (#1600) * feat: add free trial card to onboarding * add import * chore: add telemetry for full screen toggle (#1618) * rerank-lite-1 * remove doccs * basic tests for VS Code extension * improved testing of VS Code extension * manually implement stop tokens for hf inference api * chore: onboarding metrics (#1626) * fix: pageview tracking * feat: add onboarding telemetry * create single `onboardingStatus` type * improved var naming * remove console logs * fix windows performance issue * rename vscodeExtension.ts * migration of onboarding variables * "stash" instead of "delete" in indexing progress * fix preview.yaml * also fix main.yaml * Update troubleshooting.md (#1637) * feat: close panel if main input is focused * add skip param * Update TipTapEditor.tsx * merge dev * Update commands.ts --------- Co-authored-by: Nate Sesti <sestinj@gmail.com> Co-authored-by: Nate Sesti <33237525+sestinj@users.noreply.github.com> Co-authored-by: Jonah Wagner <jonahwagner231@gmail.com> * bugfix: quick actions undefined array (#1704) * feat: add rich quick pick for quick edit (#1706) * feat: multistep quick pick * fix: multi step for context provider * Update test.js * Create deepseek.md (#1708) * style: add max height to model selector (#1712) * update styling * remove testing code * remove comments * feat: add tutorial card (#1716) * feat: create tutorial card * Update TutorialCard.tsx * feat: add file search to quick edit (#1714) * feat: multistep quick pick * fix: multi step for context provider * Update test.js * add file search * complete file search * remove unused import * add comments * Update utils.ts * update naming * chore: move quick pick instantiation (#1723) * Break out into NPM modules (#1726) * config.json types * export all schemas * break out request logic into packages * update openai adapters to export body types * update packaging of npm modules * update packages * continue proxy * mistral * Fix typo in documentation (#1722) In set-up-codestral.md "Trobleshooting" -> "Troubleshooting" * update package.json version * 🪄 model dropdown, control plane (#1692) * Nate/control plane client (#1691) * docs: add docs and schema for "OS" provider (#1536) * ignore .env * fix(gui): ctx rendering w/ renderInlineAs: "" (#1541) * ✨ use and cache imports for autocomplete (#1456) * ✨ use and cache imports for autocomplete * fix tsc * fix codeqwen autocomplete leading space * add voyage rerank-1 * feat: `--noEmit` for tsc checks in CI (#1559) * docs: update CustomContextProvider docs (#1557) * add stop tokens to qwen prompt * update docs to reflect 3.5 sonnet being best * docs: comment out unused providers (#1561) * import Handlebars * feat: toast notification for config updates (#1560) * feat: toast notification for config updates * feat: only trigger toast on config.json save * displayRawMarkdown option * feat: open pane on install (#1564) * feat: open pane on activation * comment out testing code * update to reflect 16 stop words limit for deepseek * feat: only trigger config update toast in vscode (#1571) * docs(prompt-files): fix typos + clarify (#1575) * doc: prompt file typo + clarifications * fix: add back correct docs * chore: add telemetry for pageviews (#1576) * feat: update onboarding w/ embeddings model (#1570) * chore(gui): remove unused pages * feat: add embeddings step * feat: update styles * feat: copy button updates * fix: correct pull command for embed model * fix: remove commented code * fix: remove commented code * feat: simplify copy btn props * chore: rename onboarding selection event * feat: add provider config * fix: undo msg name * remove dead code * fix: invalid mode check * fix: remove testing logic * docs(telemetry): add pageviews to tracking list (#1581) * Add reranker configuration options to codebase embedding docs (#1584) - Introduce reranker concept - List available reranker options - Provide configuration instructions - Update keywords to include "reranker" * chore: update pr template with screenshots (#1590) * Refactor ConfirmationDialog to use SecondaryButton for cancel action (#1586) * Added instructions for running docs server locally (#1578) - Added NPM script method - Added VS Code task method - Update contributing guidelines * Update branch policy (#1577) - Change PR target to `dev` branch - Update `CONTRIBUTING.md` instructions * Consolidate example configurations into the main configuration guide (#1579) - Moved examples to configuration.md - Deleted the separate examples.md file - Updated sidebar order and links - Improved readability and structure in configuration.md * fix: fullscreen gui retains context when hidden, fixed fullscreen focusing (#1582) * Update completionProvider.ts (warning tab-autocomplete models) (#1566) * feat: enhanced IndexingProgressBar with blinking dot feature - Integrated BlinkingDot component - Added STATUS_COLORS for various states - Replaced CircleDiv with BlinkingDot in UI - Updated status messages and layout * small UI tweaks * feat(gui): enhance ModelCard, ModelProviderTag, and Toggle components (#1595) - add styling and adjustments to ModelCard - update ModelProviderTag font size - remove box shadow from Toggle component - tweak icon styles in ModelCard - improve alignment and spacing * media query * feat: add best experience onboarding * fix: file rename * stop movement on button hover by keeping same border thickness * fix mistake in setting cursor: pointer * fix when free trial option is shown * Support Node.js versions below 20 for streaming response handling (#1591) - Add fallback for Node < 20 - Implement toAsyncIterable for streaming - Use TextDecoder for manual decoding - Maintain existing streaming for Node 20+ * small fixes * feat: add free trial card to onboarding (#1600) * feat: add free trial card to onboarding * add import * fix hasPassedFTL * fix /edit cancellation from UI * feat: add `applyCodeBlock` experimental prop (#1601) * feat: add new model styling improvements (#1609) * feat: add new model styling improvements * better gap size * feat: update bug_report.yml (#1610) * chore: update bug_report.yml * typo fix * feat: add labels to "Add docs" dialog (#1612) * feat: add labels to "Add docs" dialog * remove autofocus * don't double load config * small fixes * speed up directory traversal, and use correct native path module * option not to show config update toast * merge air-gapped and recommended setup pages * chore: add telemetry for full screen toggle (#1618) * Fix headings in codebase-embeddings.md (#1617) * mention jetbrains * docs: update changie (#1619) * feat: updated changie config * hide toc and autogenerate * Update changelog.mdx * link to deeper explanation of embeddings models * ensure target="_blank" for all links in sidebar * fix gif links in intellij README.md * don't require rust in dependency installation * chore: fix padding on gh button (#1620) * chore: adjust button padding * Update tasks.json * escape colons in diff path * smoother lancedb indexing reporting * smooth progress updates for indexing * fix tsc err * rerank-lite-1 * remove doccs * basic tests for VS Code extension * improved testing of VS Code extension * docs: add docs and schema for "OS" provider (#1536) * ignore .env * 🚑 fix constant warnings when onboarding with Ollama * ✨ use and cache imports for autocomplete (#1456) * ✨ use and cache imports for autocomplete * fix tsc * team analytics * apply control plane settings * workos auth * ide protocol get session info * UI for auth * profile switching * small fixes * updates * refresh tokens * updates * fix tsc errs * model select in toolbar to make room for profile selector * prod client id * link to prod URL * internal beta option * profiles change listener --------- Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com> Co-authored-by: Priyash <38959321+priyashpatil@users.noreply.github.com> Co-authored-by: Jonah Wagner <jonahwagner231@gmail.com> Co-authored-by: YohannZe <99359799+YohannZe@users.noreply.github.com> Co-authored-by: Dan Dascalescu <ddascalescu+github@gmail.com> * temporary patch for type errs --------- Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com> Co-authored-by: Priyash <38959321+priyashpatil@users.noreply.github.com> Co-authored-by: Jonah Wagner <jonahwagner231@gmail.com> Co-authored-by: YohannZe <99359799+YohannZe@users.noreply.github.com> Co-authored-by: Dan Dascalescu <ddascalescu+github@gmail.com> * skip extension tests * JetBrains status bar spinner for autocomplete * Remove unused images * partial accept jetbrains * fix double-rendering of jetbrains completions * fix offset of multi-line jetbrains completions * enable/disable actions * upgrade to version 0.0.54 * fix: wrap editor buttons when out of space (#1727) * Add .continuerc file to config directory on activation to prevent it's indexing. (#1733) * Updated the content links that were deprecated in the document (#1709) Co-authored-by: Ihe Fan <ih.fan.1027@gmail.com> * Nate/dev (#1739) * JetBrains status bar spinner for autocomplete * Remove unused images * partial accept jetbrains * fix double-rendering of jetbrains completions * fix offset of multi-line jetbrains completions * enable/disable actions * upgrade to version 0.0.54 * llm-info package * small profile switching improvements * instruct cmd+I not to leave placeholders * @ files in context-providers docs * onboarding fix * update jetbrains ci to build gui * feat: single default quick pick to edit (#1743) * feat: single default quick pick to edit * Update quick-actions.md * Update quick-actions.md * use defaultQuickAction * quick fixes * fix: handle line removal diff (#1744) * fix: handle line removal diff * remove comments * Configurable `maxChunkSize` for embedding providers (#1746) * Add `maxChunkSize` to `EmbeddingsProvider` * Add `maxChunkSize` to schema * add support for docs via config (#1594) * mistral mamba (#1748) * 🐍 mistral mamba * autoscale retrieval based on context length * autoscale retrieval based on context length * fix input box movement * update jetbrains build * test: add myers diff tests (#1754) * feat: enhance help center (#1755) * feat: enhance help center * Update help.tsx * feat: add azure provider config (#1764) * autocomplete reload fix * logout of control plane * Update QuickEditQuickPick.ts (#1772) * Update QuickEditQuickPick.ts * updates * Update QuickEditQuickPick.ts * pass refreshed access token to continue-proxy model * test: add dir read check for walkDir (#1773) * test: add dir read check for walkDir * Update ignore.ts * Update walkDir.test.ts * Update walkDir.test.ts * gpt-4o-mini * gpt-4o-mini * gpt4omini to ui selector * fix: layout alignment (#1779) * fix: delete old docs index on force re-index (#1778) * add "Codebase Force Re-Index" command (#1757) * Add `HuggingFaceTEIReranker` (#1711) * Add `HuggingFaceTEIReranker` * Add `huggingface-tei` to `config_schema.json` * update package.json version * update config schemas * skip test failing only due to type error * fix: convert `walkDir` to an async generator (#1783) * walkdir to async generator * add yields * handle ignore files * Update CodebaseIndexer.ts * Update walkDir.ts * chore: bump VS Code ext version * fix completions support in ContinueProxy * add test for walkDir * IAnalyticsProvider * feat: crawl `.mdx` docs * update workspaces on session info change * rename from profile to workspace (user-facing) * update config schema files * feat: improve chat thread ui for better readability (#1786) * add "language" template variable for autocomplete * Enable debug logs (#1800) * Add an enableDebugLogs flag * Send logs to VSCode * Refresh index fixes (#1795) * Use the resultType given to markComplete This fixes an issue where if there were multiple result types in itemToAction such as an update with UpdateNewVersion and UpdateOldVersion, only the UpdateOldVersion would be hit (which is a noop) and the UpdateNewVersion would never be fired, causing us to never update the timestamp of the tag_catalog. * Add a Compute and UpdateLastUpdated to refreshIndex Removes the ability to insert duplicate rows if we're just computing the result. Instead we replace the existing row instead. * Don't insert compute tags They are REPLACEd in markComplete now. * docs: change page heading to model providers (#1684) * feat: allow JetBrains users to index docs (#1797) * feat: allow JetBrains users to index docs * update docs service * update global context * throw error popup on jetbrains + transformers * update toast notifications * update typings * fix tsc errors * Index on file change (#1785) * Reload the submenu items when the context provider data is refreshed * update version * Just call refreshSubmenuItems * remove log statements * cleanup * Remove the Promise declaration * Copy currentFiles to a new dict since we're going to mutate it Don't mutate the caller's currentFiles unexpectedly * Remove reIndexFile and just call index/forceReIndex * We MUST await the refreshCodebaseIndex call * Expose send on core * remove unused import * Reindex the workspaces on save * Call core.send Ideally, we can implement externalRequest on the webview later so we don't have to expose messenger to the VSCode extension * Always refreshSubmenuItems in refreshCodebaseIndex * whitespace * Change messenger back to private * Add Pause Codebase On Start setting (#1788) * Add a skipInitialSync function * Add pauseInitialCodebaseIndex * docs * version bump * Rename to pauseCodebaseIndexOnStart * Un-shadow file context provider (#1801) * allow FileContextProvider to handle files * remove commented-out lines * chore: add telemetry to alt-enter (#1805) * Set the indexProgress indicator to paused on startup if pauseCodebaseIndexOnStart is set (#1804) * Fix Input Toolbar layout (#1792) * set to flex flex-column * Remove fixed height and always show the StyledDivs content to hold its size * Add a Delete Message button to the StepContainer (#1790) * Add a delete button * add a delete message action to the GUI * Fix off by one error * format * This index should be less than length * Update to trash icon * Simplify walkDir(...) and improve performance by roughly 10x in larger repos (#1806) The performance of WalkDir is improved by replacing the recursive DFS with a stack based implementation (less memory in-use during peak exploration). In addition, some unnecessary flags and options were removed which allowed the code to be overall simplified. Much less rule matching is occuring with the same files returned. Some performance results on my linux host: small repo: - 649 files returned by walkDir() - 9 .gitignore files - walkDir() old vs new duration: 918 ms to 143 ms medium sized repo: - 9271 returned by walkDir() - 35 .gitignore files - walkDir() old vs new duration: 10,886 ms to 970ms large sized repo: - 197,900 files returned by walkDir() - 929 .gitignore files - walkDir() old vs new duration: 498,151 ms to 37,353 ms Co-authored-by: Rob Leidle <rleidle@tesla.com> * modified assistant indicator in UI * update package.json version * feat: add Llama 3.1 8B to cloudflare provider options (#1811) Co-authored-by: jdelorey@cloudflare.com <jdelorey@cloudflare.com> * increase gemini pro contextLength (#1809) * fix indentation (#1808) * Llama 3.1 405b model selection (#1813) * add support for llama3 405b * 3.1 * name mapping * updates to model setup * fix walkDir tests on windows * chore: add docs as top level config (#1816) * chore: add docs as top level config * Update core.ts * feat: make @codebase a hardcoded ctx provider (#1818) * chore: add docs as top level config * Update core.ts * feat: make @codebase a hardcoded ctx provider * docs schema * Nate/dev (#1819) * llm-info package * small profile switching improvements * instruct cmd+I not to leave placeholders * @ files in context-providers docs * onboarding fix * jetbrains login * fix jetbrains login * change beta wording * proxy context provider * fix proxy context provider * revert to prod id, url * update package.json version --------- Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com> Co-authored-by: Priyash <38959321+priyashpatil@users.noreply.github.com> Co-authored-by: Jonah Wagner <jonahwagner231@gmail.com> Co-authored-by: YohannZe <99359799+YohannZe@users.noreply.github.com> Co-authored-by: Dan Dascalescu <ddascalescu+github@gmail.com> Co-authored-by: Rob Leidle <rleidle@gmail.com> Co-authored-by: Rob Leidle <rleidle@tesla.com> Co-authored-by: inimaz <49730431+inimaz@users.noreply.github.com> Co-authored-by: inimaz <imaz@ai-verse.com> Co-authored-by: Anaël Bonnafous <71386173+AnaelBonnafous@users.noreply.github.com> Co-authored-by: Huy Tran <119860259+tranquochuy645@users.noreply.github.com> Co-authored-by: Gabriel Gordbegli <ggordbegli@gmail.com> Co-authored-by: Raven-1027 <83693755+Raven-1027@users.noreply.github.com> Co-authored-by: Ihe Fan <ih.fan.1027@gmail.com> Co-authored-by: Lukas Kreussel <65088241+LLukas22@users.noreply.github.com> Co-authored-by: Josh Vera <josh@joshvera.com> Co-authored-by: Peter Zaback <pzaback@gmail.com> Co-authored-by: James Delorey <deloreyjmi@gmail.com> Co-authored-by: jdelorey@cloudflare.com <jdelorey@cloudflare.com>
This commit is contained in:
parent
805984f0ad
commit
9fd9ebfb9a
37 changed files with 742 additions and 153 deletions
|
|
@ -177,6 +177,7 @@ export class ConfigHandler {
|
|||
const localProfileLoader = new LocalProfileLoader(
|
||||
ide,
|
||||
ideSettingsPromise,
|
||||
controlPlaneClient,
|
||||
writeLog,
|
||||
);
|
||||
this.profiles = [new ProfileLifecycleManager(localProfileLoader)];
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ import CustomLLMClass from "../llm/llms/CustomLLM.js";
|
|||
import FreeTrial from "../llm/llms/FreeTrial.js";
|
||||
import { llmFromDescription } from "../llm/llms/index.js";
|
||||
|
||||
import ContinueProxyContextProvider from "../context/providers/ContinueProxyContextProvider.js";
|
||||
import { fetchwithRequestOptions } from "../util/fetchWithOptions.js";
|
||||
import { copyOf } from "../util/index.js";
|
||||
import mergeJson from "../util/merge.js";
|
||||
|
|
@ -59,6 +60,8 @@ import {
|
|||
getPromptFiles,
|
||||
slashCommandFromPromptFile,
|
||||
} from "./promptFile.js";
|
||||
import CodebaseContextProvider from "../context/providers/CodebaseContextProvider.js";
|
||||
|
||||
const { execSync } = require("child_process");
|
||||
|
||||
function resolveSerializedConfig(filepath: string): SerializedContinueConfig {
|
||||
|
|
@ -94,13 +97,16 @@ function loadSerializedConfig(
|
|||
workspaceConfigs: ContinueRcJson[],
|
||||
ideSettings: IdeSettings,
|
||||
ideType: IdeType,
|
||||
overrideConfigJson: SerializedContinueConfig | undefined,
|
||||
): SerializedContinueConfig {
|
||||
const configPath = getConfigJsonPath(ideType);
|
||||
let config: SerializedContinueConfig;
|
||||
try {
|
||||
config = resolveSerializedConfig(configPath);
|
||||
} catch (e) {
|
||||
throw new Error(`Failed to parse config.json: ${e}`);
|
||||
let config: SerializedContinueConfig = overrideConfigJson!;
|
||||
if (!config) {
|
||||
try {
|
||||
config = resolveSerializedConfig(configPath);
|
||||
} catch (e) {
|
||||
throw new Error(`Failed to parse config.json: ${e}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (config.allowAnonymousTelemetry === undefined) {
|
||||
|
|
@ -210,6 +216,7 @@ async function intermediateToFinalConfig(
|
|||
ideSettings: IdeSettings,
|
||||
uniqueId: string,
|
||||
writeLog: (log: string) => Promise<void>,
|
||||
workOsAccessToken: string | undefined,
|
||||
allowFreeTrial: boolean = true,
|
||||
): Promise<ContinueConfig> {
|
||||
// Auto-detect models
|
||||
|
|
@ -347,8 +354,15 @@ async function intermediateToFinalConfig(
|
|||
).filter((x) => x !== undefined) as BaseLLM[];
|
||||
}
|
||||
|
||||
// These context providers are always included, regardless of what, if anything,
|
||||
// the user has configured in config.json
|
||||
const DEFAULT_CONTEXT_PROVIDERS = [
|
||||
new FileContextProvider({}),
|
||||
new CodebaseContextProvider({}),
|
||||
];
|
||||
|
||||
// Context providers
|
||||
const contextProviders: IContextProvider[] = [new FileContextProvider({})];
|
||||
const contextProviders: IContextProvider[] = DEFAULT_CONTEXT_PROVIDERS;
|
||||
for (const provider of config.contextProviders || []) {
|
||||
if (isContextProviderWithParams(provider)) {
|
||||
const cls = contextProviderClassFromName(provider.name) as any;
|
||||
|
|
@ -356,7 +370,15 @@ async function intermediateToFinalConfig(
|
|||
console.warn(`Unknown context provider ${provider.name}`);
|
||||
continue;
|
||||
}
|
||||
contextProviders.push(new cls(provider.params));
|
||||
const instance: IContextProvider = new cls(provider.params);
|
||||
|
||||
// Handle continue-proxy
|
||||
if (instance.description.title === "continue-proxy") {
|
||||
(instance as ContinueProxyContextProvider).workOsAccessToken =
|
||||
workOsAccessToken;
|
||||
}
|
||||
|
||||
contextProviders.push(instance);
|
||||
} else {
|
||||
contextProviders.push(new CustomContextProviderClass(provider));
|
||||
}
|
||||
|
|
@ -536,9 +558,16 @@ async function loadFullConfigNode(
|
|||
ideType: IdeType,
|
||||
uniqueId: string,
|
||||
writeLog: (log: string) => Promise<void>,
|
||||
workOsAccessToken: string | undefined,
|
||||
overrideConfigJson: SerializedContinueConfig | undefined,
|
||||
): Promise<ContinueConfig> {
|
||||
// Serialized config
|
||||
let serialized = loadSerializedConfig(workspaceConfigs, ideSettings, ideType);
|
||||
let serialized = loadSerializedConfig(
|
||||
workspaceConfigs,
|
||||
ideSettings,
|
||||
ideType,
|
||||
overrideConfigJson,
|
||||
);
|
||||
|
||||
// Convert serialized to intermediate config
|
||||
let intermediate = await serializedToIntermediateConfig(serialized, ide);
|
||||
|
|
@ -584,6 +613,7 @@ async function loadFullConfigNode(
|
|||
ideSettings,
|
||||
uniqueId,
|
||||
writeLog,
|
||||
workOsAccessToken,
|
||||
);
|
||||
return finalConfig;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,20 +6,8 @@ import {
|
|||
SerializedContinueConfig,
|
||||
} from "../..";
|
||||
import { ControlPlaneClient } from "../../control-plane/client";
|
||||
import { TeamAnalytics } from "../../control-plane/TeamAnalytics";
|
||||
import ContinueProxy from "../../llm/llms/stubs/ContinueProxy";
|
||||
import { Telemetry } from "../../util/posthog";
|
||||
import {
|
||||
defaultContextProvidersJetBrains,
|
||||
defaultContextProvidersVsCode,
|
||||
defaultSlashCommandsJetBrains,
|
||||
defaultSlashCommandsVscode,
|
||||
} from "../default";
|
||||
import {
|
||||
intermediateToFinalConfig,
|
||||
serializedToIntermediateConfig,
|
||||
} from "../load";
|
||||
import { IProfileLoader } from "./IProfileLoader";
|
||||
import doLoadConfig from "./doLoadConfig";
|
||||
|
||||
export default class ControlPlaneProfileLoader implements IProfileLoader {
|
||||
private static RELOAD_INTERVAL = 1000 * 60 * 15; // every 15 minutes
|
||||
|
|
@ -49,58 +37,20 @@ export default class ControlPlaneProfileLoader implements IProfileLoader {
|
|||
}
|
||||
|
||||
async doLoadConfig(): Promise<ContinueConfig> {
|
||||
const ideInfo = await this.ide.getIdeInfo();
|
||||
const settings =
|
||||
this.workspaceSettings ??
|
||||
((await this.controlPlaneClient.getSettingsForWorkspace(
|
||||
this.profileId,
|
||||
)) as any);
|
||||
|
||||
// First construct a SerializedContinueConfig from the ControlPlaneSettings (TODO)
|
||||
const serializedConfig: SerializedContinueConfig = settings;
|
||||
|
||||
serializedConfig.contextProviders ??=
|
||||
ideInfo.ideType === "vscode"
|
||||
? defaultContextProvidersVsCode
|
||||
: defaultContextProvidersJetBrains;
|
||||
serializedConfig.slashCommands ??=
|
||||
ideInfo.ideType === "vscode"
|
||||
? defaultSlashCommandsVscode
|
||||
: defaultSlashCommandsJetBrains;
|
||||
|
||||
const intermediateConfig = await serializedToIntermediateConfig(
|
||||
serializedConfig,
|
||||
return doLoadConfig(
|
||||
this.ide,
|
||||
);
|
||||
|
||||
const uniqueId = await this.ide.getUniqueId();
|
||||
const finalConfig = await intermediateToFinalConfig(
|
||||
intermediateConfig,
|
||||
this.ide,
|
||||
await this.ideSettingsPromise,
|
||||
uniqueId,
|
||||
this.ideSettingsPromise,
|
||||
this.controlPlaneClient,
|
||||
this.writeLog,
|
||||
serializedConfig,
|
||||
);
|
||||
|
||||
// Set up team analytics/telemetry
|
||||
await Telemetry.setup(true, uniqueId, ideInfo.extensionVersion);
|
||||
await TeamAnalytics.setup(
|
||||
settings.analytics,
|
||||
uniqueId,
|
||||
ideInfo.extensionVersion,
|
||||
);
|
||||
|
||||
[
|
||||
...finalConfig.models,
|
||||
...(finalConfig.tabAutocompleteModels ?? []),
|
||||
].forEach(async (model) => {
|
||||
if (model.providerName === "continue-proxy") {
|
||||
const accessToken = await this.controlPlaneClient.getAccessToken();
|
||||
(model as ContinueProxy).workOsAccessToken = accessToken;
|
||||
}
|
||||
});
|
||||
|
||||
return finalConfig;
|
||||
}
|
||||
|
||||
setIsActive(isActive: boolean): void {}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { ContinueConfig, ContinueRcJson, IDE, IdeSettings } from "../..";
|
||||
import { Telemetry } from "../../util/posthog";
|
||||
import { loadFullConfigNode } from "../load";
|
||||
import { ContinueConfig, IDE, IdeSettings } from "../..";
|
||||
import { ControlPlaneClient } from "../../control-plane/client";
|
||||
import doLoadConfig from "./doLoadConfig";
|
||||
import { IProfileLoader } from "./IProfileLoader";
|
||||
|
||||
export default class LocalProfileLoader implements IProfileLoader {
|
||||
|
|
@ -11,42 +11,18 @@ export default class LocalProfileLoader implements IProfileLoader {
|
|||
constructor(
|
||||
private ide: IDE,
|
||||
private ideSettingsPromise: Promise<IdeSettings>,
|
||||
// private controlPlaneClient: ControlPlaneClient,
|
||||
private controlPlaneClient: ControlPlaneClient,
|
||||
private writeLog: (message: string) => Promise<void>,
|
||||
) {}
|
||||
|
||||
async doLoadConfig(): Promise<ContinueConfig> {
|
||||
let workspaceConfigs: ContinueRcJson[] = [];
|
||||
try {
|
||||
workspaceConfigs = await this.ide.getWorkspaceConfigs();
|
||||
} catch (e) {
|
||||
console.warn("Failed to load workspace configs");
|
||||
}
|
||||
|
||||
const ideInfo = await this.ide.getIdeInfo();
|
||||
const uniqueId = await this.ide.getUniqueId();
|
||||
const ideSettings = await this.ideSettingsPromise;
|
||||
|
||||
const newConfig = await loadFullConfigNode(
|
||||
return doLoadConfig(
|
||||
this.ide,
|
||||
workspaceConfigs,
|
||||
ideSettings,
|
||||
ideInfo.ideType,
|
||||
uniqueId,
|
||||
this.ideSettingsPromise,
|
||||
this.controlPlaneClient,
|
||||
this.writeLog,
|
||||
undefined,
|
||||
);
|
||||
newConfig.allowAnonymousTelemetry =
|
||||
newConfig.allowAnonymousTelemetry &&
|
||||
(await this.ide.isTelemetryEnabled());
|
||||
|
||||
// Setup telemetry only after (and if) we know it is enabled
|
||||
await Telemetry.setup(
|
||||
newConfig.allowAnonymousTelemetry ?? true,
|
||||
await this.ide.getUniqueId(),
|
||||
ideInfo.extensionVersion,
|
||||
);
|
||||
|
||||
return newConfig;
|
||||
}
|
||||
|
||||
setIsActive(isActive: boolean): void {}
|
||||
|
|
|
|||
69
core/config/profile/doLoadConfig.ts
Normal file
69
core/config/profile/doLoadConfig.ts
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
import {
|
||||
ContinueRcJson,
|
||||
IDE,
|
||||
IdeSettings,
|
||||
SerializedContinueConfig,
|
||||
} from "../..";
|
||||
import { ControlPlaneClient } from "../../control-plane/client";
|
||||
import { TeamAnalytics } from "../../control-plane/TeamAnalytics";
|
||||
import ContinueProxy from "../../llm/llms/stubs/ContinueProxy";
|
||||
import { Telemetry } from "../../util/posthog";
|
||||
import { loadFullConfigNode } from "../load";
|
||||
|
||||
export default async function doLoadConfig(
|
||||
ide: IDE,
|
||||
ideSettingsPromise: Promise<IdeSettings>,
|
||||
controlPlaneClient: ControlPlaneClient,
|
||||
writeLog: (message: string) => Promise<void>,
|
||||
overrideConfigJson: SerializedContinueConfig | undefined,
|
||||
) {
|
||||
let workspaceConfigs: ContinueRcJson[] = [];
|
||||
try {
|
||||
workspaceConfigs = await ide.getWorkspaceConfigs();
|
||||
} catch (e) {
|
||||
console.warn("Failed to load workspace configs");
|
||||
}
|
||||
|
||||
const ideInfo = await ide.getIdeInfo();
|
||||
const uniqueId = await ide.getUniqueId();
|
||||
const ideSettings = await ideSettingsPromise;
|
||||
const workOsAccessToken = await controlPlaneClient.getAccessToken();
|
||||
|
||||
const newConfig = await loadFullConfigNode(
|
||||
ide,
|
||||
workspaceConfigs,
|
||||
ideSettings,
|
||||
ideInfo.ideType,
|
||||
uniqueId,
|
||||
writeLog,
|
||||
workOsAccessToken,
|
||||
overrideConfigJson,
|
||||
);
|
||||
newConfig.allowAnonymousTelemetry =
|
||||
newConfig.allowAnonymousTelemetry && (await ide.isTelemetryEnabled());
|
||||
|
||||
// Setup telemetry only after (and if) we know it is enabled
|
||||
await Telemetry.setup(
|
||||
newConfig.allowAnonymousTelemetry ?? true,
|
||||
await ide.getUniqueId(),
|
||||
ideInfo.extensionVersion,
|
||||
);
|
||||
|
||||
if (newConfig.analytics) {
|
||||
await TeamAnalytics.setup(
|
||||
newConfig.analytics as any, // TODO: Need to get rid of index.d.ts once and for all
|
||||
uniqueId,
|
||||
ideInfo.extensionVersion,
|
||||
);
|
||||
}
|
||||
|
||||
[...newConfig.models, ...(newConfig.tabAutocompleteModels ?? [])].forEach(
|
||||
async (model) => {
|
||||
if (model.providerName === "continue-proxy") {
|
||||
(model as ContinueProxy).workOsAccessToken = workOsAccessToken;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
return newConfig;
|
||||
}
|
||||
76
core/context/providers/ContinueProxyContextProvider.ts
Normal file
76
core/context/providers/ContinueProxyContextProvider.ts
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
import { CONTROL_PLANE_URL } from "../../control-plane/client.js";
|
||||
import {
|
||||
ContextItem,
|
||||
ContextProviderDescription,
|
||||
ContextProviderExtras,
|
||||
ContextSubmenuItem,
|
||||
LoadSubmenuItemsArgs,
|
||||
} from "../../index.js";
|
||||
import { BaseContextProvider } from "../index.js";
|
||||
|
||||
class ContinueProxyContextProvider extends BaseContextProvider {
|
||||
static description: ContextProviderDescription = {
|
||||
title: "continue-proxy",
|
||||
displayTitle: "Continue Proxy",
|
||||
description: "Retrieve a context item from a Continue for Teams add-on",
|
||||
type: "submenu",
|
||||
};
|
||||
|
||||
workOsAccessToken: string | undefined = undefined;
|
||||
|
||||
override get description(): ContextProviderDescription {
|
||||
return {
|
||||
title:
|
||||
this.options.title || ContinueProxyContextProvider.description.title,
|
||||
displayTitle:
|
||||
this.options.displayTitle ||
|
||||
ContinueProxyContextProvider.description.displayTitle,
|
||||
description:
|
||||
this.options.description ||
|
||||
ContinueProxyContextProvider.description.description,
|
||||
type: this.options.type || ContinueProxyContextProvider.description.type,
|
||||
};
|
||||
}
|
||||
|
||||
async loadSubmenuItems(
|
||||
args: LoadSubmenuItemsArgs,
|
||||
): Promise<ContextSubmenuItem[]> {
|
||||
const response = await args.fetch(
|
||||
new URL(`/proxy/context/${this.options.id}/list`, CONTROL_PLANE_URL),
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${this.workOsAccessToken}`,
|
||||
},
|
||||
},
|
||||
);
|
||||
const data = await response.json();
|
||||
return data.items;
|
||||
}
|
||||
|
||||
async getContextItems(
|
||||
query: string,
|
||||
extras: ContextProviderExtras,
|
||||
): Promise<ContextItem[]> {
|
||||
const response = await extras.fetch(
|
||||
new URL(`/proxy/context/${this.options.id}/retrieve`, CONTROL_PLANE_URL),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${this.workOsAccessToken}`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
query: query || "",
|
||||
fullInput: extras.fullInput,
|
||||
}),
|
||||
},
|
||||
);
|
||||
|
||||
const items: any = await response.json();
|
||||
return items;
|
||||
}
|
||||
}
|
||||
|
||||
export default ContinueProxyContextProvider;
|
||||
|
|
@ -157,7 +157,10 @@ class DocsContextProvider extends BaseContextProvider {
|
|||
name: "Instructions",
|
||||
description: "Instructions",
|
||||
content:
|
||||
"Use the above documentation to answer the following question. You should not reference anything outside of what is shown, unless it is a commonly known concept. Reference URLs whenever possible using markdown formatting. If there isn't enough information to answer the question, suggest where the user might look to learn more.",
|
||||
"Use the above documentation to answer the following question. You should not reference " +
|
||||
"anything outside of what is shown, unless it is a commonly known concept. Reference URLs " +
|
||||
"whenever possible using markdown formatting. If there isn't enough information to answer " +
|
||||
"the question, suggest where the user might look to learn more.",
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
@ -167,7 +170,9 @@ class DocsContextProvider extends BaseContextProvider {
|
|||
): Promise<ContextSubmenuItem[]> {
|
||||
const ideInfo = await args.ide.getIdeInfo();
|
||||
const isJetBrains = ideInfo.ideType === "jetbrains";
|
||||
const configSites = this.options?.sites || [];
|
||||
const configSites = [
|
||||
...new Set([...(this.options?.sites || []), ...(args.config.docs || [])]),
|
||||
];
|
||||
const submenuItemsMap = new Map<string, ContextSubmenuItem>();
|
||||
|
||||
if (!isJetBrains) {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { ContextProviderName } from "../../index.js";
|
|||
import { BaseContextProvider } from "../index.js";
|
||||
import CodeContextProvider from "./CodeContextProvider.js";
|
||||
import CodebaseContextProvider from "./CodebaseContextProvider.js";
|
||||
import ContinueProxyContextProvider from "./ContinueProxyContextProvider.js";
|
||||
import CurrentFileContextProvider from "./CurrentFileContextProvider.js";
|
||||
import DatabaseContextProvider from "./DatabaseContextProvider.js";
|
||||
import DiffContextProvider from "./DiffContextProvider.js";
|
||||
|
|
@ -40,7 +41,6 @@ const Providers: (typeof BaseContextProvider)[] = [
|
|||
HttpContextProvider,
|
||||
SearchContextProvider,
|
||||
OSContextProvider,
|
||||
CodebaseContextProvider,
|
||||
ProblemsContextProvider,
|
||||
FolderContextProvider,
|
||||
DocsContextProvider,
|
||||
|
|
@ -51,6 +51,7 @@ const Providers: (typeof BaseContextProvider)[] = [
|
|||
CodeContextProvider,
|
||||
CurrentFileContextProvider,
|
||||
URLContextProvider,
|
||||
ContinueProxyContextProvider,
|
||||
];
|
||||
|
||||
export function contextProviderClassFromName(
|
||||
|
|
|
|||
|
|
@ -24,7 +24,10 @@ export async function retrieveContextItemsFromEmbeddings(
|
|||
(await extras.ide.getIdeInfo()).ideType === "jetbrains"
|
||||
) {
|
||||
throw new Error(
|
||||
"The transformers.js context provider is not currently supported in JetBrains. For now, you can use Ollama to set up local embeddings, or use our 'free-trial' embeddings provider. See here to learn more: https://docs.continue.dev/walkthroughs/codebase-embeddings#embeddings-providers",
|
||||
"The transformers.js context provider is not currently supported in JetBrains. " +
|
||||
"For now, you can use Ollama to set up local embeddings, or use our 'free-trial' " +
|
||||
"embeddings provider. See here to learn more: " +
|
||||
"https://docs.continue.dev/walkthroughs/codebase-embeddings#embeddings-providers",
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -81,7 +84,9 @@ export async function retrieveContextItemsFromEmbeddings(
|
|||
|
||||
return [
|
||||
...results.map((r) => {
|
||||
const name = `${getRelativePath(r.filepath, workspaceDirs)} (${r.startLine}-${r.endLine})`;
|
||||
const name = `${getRelativePath(r.filepath, workspaceDirs)} (${
|
||||
r.startLine
|
||||
}-${r.endLine})`;
|
||||
const description = `${r.filepath} (${r.startLine}-${r.endLine})`;
|
||||
return {
|
||||
name,
|
||||
|
|
|
|||
20
core/control-plane/auth/index.ts
Normal file
20
core/control-plane/auth/index.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
const CLIENT_ID = "client_01J0FW6XN8N2XJAECF7NE0Y65J";
|
||||
// const CLIENT_ID = "client_01J0FW6XCPMJMQ3CG51RB4HBZQ"; // Staging
|
||||
|
||||
export async function getAuthUrlForTokenPage(): Promise<string> {
|
||||
const url = new URL("https://api.workos.com/user_management/authorize");
|
||||
const params = {
|
||||
response_type: "code",
|
||||
client_id: CLIENT_ID,
|
||||
redirect_uri: "https://app.continue.dev/tokens/callback",
|
||||
// redirect_uri: "http://localhost:3000/tokens/callback",
|
||||
state: uuidv4(),
|
||||
provider: "authkit",
|
||||
};
|
||||
Object.keys(params).forEach((key) =>
|
||||
url.searchParams.append(key, params[key as keyof typeof params]),
|
||||
);
|
||||
return url.toString();
|
||||
}
|
||||
|
|
@ -72,10 +72,14 @@ export class ControlPlaneClient {
|
|||
return [];
|
||||
}
|
||||
|
||||
const resp = await this.request(`/workspaces`, {
|
||||
method: "GET",
|
||||
});
|
||||
return (await resp.json()) as any;
|
||||
try {
|
||||
const resp = await this.request(`/workspaces`, {
|
||||
method: "GET",
|
||||
});
|
||||
return (await resp.json()) as any;
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
async getSettingsForWorkspace(workspaceId: string): Promise<ConfigJson> {
|
||||
|
|
|
|||
43
core/core.ts
43
core/core.ts
|
|
@ -17,10 +17,10 @@ import {
|
|||
import { createNewPromptFile } from "./config/promptFile.js";
|
||||
import { addModel, addOpenAIKey, deleteModel } from "./config/util.js";
|
||||
import { ContinueServerClient } from "./continueServer/stubs/client.js";
|
||||
import { ControlPlaneClient } from "./control-plane/client.js";
|
||||
import { getAuthUrlForTokenPage } from "./control-plane/auth";
|
||||
import { ControlPlaneClient } from "./control-plane/client";
|
||||
import { CodebaseIndexer, PauseToken } from "./indexing/CodebaseIndexer.js";
|
||||
import { DocsService } from "./indexing/docs/DocsService.js";
|
||||
import TransformersJsEmbeddingsProvider from "./indexing/embeddings/TransformersJsEmbeddingsProvider.js";
|
||||
import Ollama from "./llm/llms/Ollama.js";
|
||||
import type { FromCoreProtocol, ToCoreProtocol } from "./protocol";
|
||||
import { GlobalContext } from "./util/GlobalContext.js";
|
||||
|
|
@ -143,21 +143,19 @@ export class Core {
|
|||
);
|
||||
|
||||
// Index on initialization
|
||||
this.ide
|
||||
.getWorkspaceDirs()
|
||||
.then(async (dirs) => {
|
||||
// Respect pauseCodebaseIndexOnStart user settings
|
||||
if (ideSettings.pauseCodebaseIndexOnStart) {
|
||||
await this.messenger.request("indexProgress", {
|
||||
progress: 100,
|
||||
desc: "Initial Indexing Skipped",
|
||||
status: "paused",
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.ide.getWorkspaceDirs().then(async (dirs) => {
|
||||
// Respect pauseCodebaseIndexOnStart user settings
|
||||
if (ideSettings.pauseCodebaseIndexOnStart) {
|
||||
await this.messenger.request("indexProgress", {
|
||||
progress: 100,
|
||||
desc: "Initial Indexing Skipped",
|
||||
status: "paused",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.refreshCodebaseIndex(dirs);
|
||||
});
|
||||
this.refreshCodebaseIndex(dirs);
|
||||
});
|
||||
});
|
||||
|
||||
const getLlm = async () => {
|
||||
|
|
@ -280,8 +278,12 @@ export class Core {
|
|||
return;
|
||||
}
|
||||
|
||||
const siteIndexingOptions: SiteIndexingConfig[] = ((mProvider) =>
|
||||
mProvider?.options?.sites || [])({ ...provider });
|
||||
const siteIndexingOptions: SiteIndexingConfig[] = ((mProvider) => [
|
||||
...new Set([
|
||||
...(mProvider?.options?.sites || []),
|
||||
...(config.docs || []),
|
||||
]),
|
||||
])({ ...provider });
|
||||
|
||||
for (const site of siteIndexingOptions) {
|
||||
await this.getEmbeddingsProviderAndIndexDoc(site, msg.data.reIndex);
|
||||
|
|
@ -294,6 +296,7 @@ export class Core {
|
|||
const items = config.contextProviders
|
||||
?.find((provider) => provider.description.title === msg.data.title)
|
||||
?.loadSubmenuItems({
|
||||
config,
|
||||
ide: this.ide,
|
||||
fetch: (url, init) =>
|
||||
fetchwithRequestOptions(url, init, config.requestOptions),
|
||||
|
|
@ -656,6 +659,10 @@ export class Core {
|
|||
on("didChangeControlPlaneSessionInfo", async (msg) => {
|
||||
this.configHandler.updateControlPlaneSessionInfo(msg.data.sessionInfo);
|
||||
});
|
||||
on("auth/getAuthUrl", async (msg) => {
|
||||
const url = await getAuthUrlForTokenPage();
|
||||
return { url };
|
||||
});
|
||||
}
|
||||
|
||||
private indexingCancellationController: AbortController | undefined;
|
||||
|
|
|
|||
17
core/index.d.ts
vendored
17
core/index.d.ts
vendored
|
|
@ -137,6 +137,7 @@ export interface ContextProviderExtras {
|
|||
}
|
||||
|
||||
export interface LoadSubmenuItemsArgs {
|
||||
config: ContinueConfig;
|
||||
ide: IDE;
|
||||
fetch: FetchFunction;
|
||||
}
|
||||
|
|
@ -422,8 +423,8 @@ export interface IdeSettings {
|
|||
remoteConfigSyncPeriod: number;
|
||||
userToken: string;
|
||||
enableControlServerBeta: boolean;
|
||||
pauseCodebaseIndexOnStart: boolean
|
||||
enableDebugLogs: boolean
|
||||
pauseCodebaseIndexOnStart: boolean;
|
||||
enableDebugLogs: boolean;
|
||||
}
|
||||
|
||||
export interface IDE {
|
||||
|
|
@ -858,6 +859,12 @@ interface ExperimentalConfig {
|
|||
quickActions?: QuickActionConfig[];
|
||||
}
|
||||
|
||||
interface AnalyticsConfig {
|
||||
type: string;
|
||||
url?: string;
|
||||
clientKey?: string;
|
||||
}
|
||||
|
||||
// config.json
|
||||
export interface SerializedContinueConfig {
|
||||
env?: string[];
|
||||
|
|
@ -878,6 +885,7 @@ export interface SerializedContinueConfig {
|
|||
ui?: ContinueUIConfig;
|
||||
reranker?: RerankerDescription;
|
||||
experimental?: ExperimentalConfig;
|
||||
analytics?: AnalyticsConfig;
|
||||
}
|
||||
|
||||
export type ConfigMergeType = "merge" | "overwrite";
|
||||
|
|
@ -928,6 +936,8 @@ export interface Config {
|
|||
reranker?: RerankerDescription | Reranker;
|
||||
/** Experimental configuration */
|
||||
experimental?: ExperimentalConfig;
|
||||
/** Analytics configuration */
|
||||
analytics?: AnalyticsConfig;
|
||||
}
|
||||
|
||||
// in the actual Continue source code
|
||||
|
|
@ -948,6 +958,8 @@ export interface ContinueConfig {
|
|||
ui?: ContinueUIConfig;
|
||||
reranker?: Reranker;
|
||||
experimental?: ExperimentalConfig;
|
||||
analytics?: AnalyticsConfig;
|
||||
docs?: SiteIndexingConfig[];
|
||||
}
|
||||
|
||||
export interface BrowserSerializedContinueConfig {
|
||||
|
|
@ -965,4 +977,5 @@ export interface BrowserSerializedContinueConfig {
|
|||
ui?: ContinueUIConfig;
|
||||
reranker?: RerankerDescription;
|
||||
experimental?: ExperimentalConfig;
|
||||
analytics?: AnalyticsConfig;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import type { LLMOptions, ModelProvider } from "../../..";
|
||||
import { CONTROL_PLANE_URL } from "../../../control-plane/client";
|
||||
import OpenAI from "../OpenAI.js";
|
||||
|
||||
class ContinueProxy extends OpenAI {
|
||||
|
|
@ -16,8 +17,7 @@ class ContinueProxy extends OpenAI {
|
|||
}
|
||||
static providerName: ModelProvider = "continue-proxy";
|
||||
static defaultOptions: Partial<LLMOptions> = {
|
||||
apiBase:
|
||||
"https://control-plane-api-service-i3dqylpbqa-uc.a.run.app/model-proxy/v1",
|
||||
apiBase: new URL("/model-proxy/v1", CONTROL_PLANE_URL).toString(),
|
||||
useLegacyCompletionsEndpoint: false,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -147,4 +147,6 @@ export type ToCoreFromIdeOrWebviewProtocol = {
|
|||
addAutocompleteModel: [{ model: ModelDescription }, void];
|
||||
|
||||
"profiles/switch": [{ id: string }, undefined];
|
||||
|
||||
"auth/getAuthUrl": [undefined, { url: string }];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ export async function migrate(
|
|||
|
||||
if (!fs.existsSync(migrationPath)) {
|
||||
try {
|
||||
await callback();
|
||||
await Promise.resolve(callback());
|
||||
fs.writeFileSync(migrationPath, "");
|
||||
} catch (e) {
|
||||
console.warn(`Migration ${id} failed`, e);
|
||||
|
|
|
|||
27
docs/static/schemas/config.json
vendored
27
docs/static/schemas/config.json
vendored
|
|
@ -1828,6 +1828,33 @@
|
|||
"title": "config.json",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"docs": {
|
||||
"title": "Docs",
|
||||
"description": "A list of documentation sites to be indexed",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string",
|
||||
"description": "The title of the documentation site"
|
||||
},
|
||||
"startUrl": {
|
||||
"type": "string",
|
||||
"description": "The starting URL for indexing the documentation"
|
||||
},
|
||||
"rootUrl": {
|
||||
"type": "string",
|
||||
"description": "The root URL of the documentation site"
|
||||
},
|
||||
"maxDepth": {
|
||||
"type": "integer",
|
||||
"description": "The maximum depth to crawl the documentation site"
|
||||
}
|
||||
},
|
||||
"required": ["title", "startUrl"]
|
||||
}
|
||||
},
|
||||
"allowAnonymousTelemetry": {
|
||||
"title": "Allow Anonymous Telemetry",
|
||||
"markdownDescription": "If this field is set to True, we will collect anonymous telemetry as described in the documentation page on telemetry. If set to `false`, we will not collect any data. Learn more in [the docs](https://docs.continue.dev/telemetry).",
|
||||
|
|
|
|||
1
eval/.gitignore
vendored
Normal file
1
eval/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
repos
|
||||
|
|
@ -4,7 +4,7 @@ pluginGroup = com.github.continuedev.continueintellijextension
|
|||
pluginName = continue-intellij-extension
|
||||
pluginRepositoryUrl = https://github.com/continuedev/continue
|
||||
# SemVer format -> https://semver.org
|
||||
pluginVersion = 0.0.55
|
||||
pluginVersion = 0.0.56
|
||||
|
||||
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
|
||||
pluginSinceBuild = 223
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package com.github.continuedev.continueintellijextension.activities
|
||||
|
||||
import com.github.continuedev.continueintellijextension.auth.AuthListener
|
||||
import com.github.continuedev.continueintellijextension.auth.ContinueAuthService
|
||||
import com.github.continuedev.continueintellijextension.auth.ControlPlaneSessionInfo
|
||||
import com.github.continuedev.continueintellijextension.constants.getContinueGlobalPath
|
||||
import com.github.continuedev.continueintellijextension.`continue`.*
|
||||
import com.github.continuedev.continueintellijextension.listeners.ContinuePluginSelectionListener
|
||||
|
|
@ -25,6 +28,7 @@ import java.nio.file.Files
|
|||
import java.nio.file.Paths
|
||||
import javax.swing.*
|
||||
import com.intellij.ide.plugins.PluginManager
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.extensions.PluginId
|
||||
|
||||
fun showTutorial(project: Project) {
|
||||
|
|
@ -126,6 +130,32 @@ class ContinuePluginStartupActivity : StartupActivity, Disposable, DumbAware {
|
|||
}
|
||||
})
|
||||
|
||||
// Listen for clicking settings button to start the auth flow
|
||||
val authService = service<ContinueAuthService>()
|
||||
val initialSessionInfo = authService.loadControlPlaneSessionInfo()
|
||||
|
||||
if (initialSessionInfo != null) {
|
||||
val data = mapOf(
|
||||
"sessionInfo" to initialSessionInfo
|
||||
)
|
||||
continuePluginService.coreMessenger?.request("didChangeControlPlaneSessionInfo", data, null) { _ -> }
|
||||
continuePluginService.sendToWebview("didChangeControlPlaneSessionInfo", data)
|
||||
}
|
||||
|
||||
connection.subscribe(AuthListener.TOPIC, object : AuthListener {
|
||||
override fun startAuthFlow() {
|
||||
authService.startAuthFlow(project)
|
||||
}
|
||||
|
||||
override fun handleUpdatedSessionInfo(sessionInfo: ControlPlaneSessionInfo?) {
|
||||
val data = mapOf(
|
||||
"sessionInfo" to sessionInfo
|
||||
)
|
||||
continuePluginService.coreMessenger?.request("didChangeControlPlaneSessionInfo", data, null) { _ -> }
|
||||
continuePluginService.sendToWebview("didChangeControlPlaneSessionInfo", data)
|
||||
}
|
||||
})
|
||||
|
||||
GlobalScope.async(Dispatchers.IO) {
|
||||
val listener =
|
||||
ContinuePluginSelectionListener(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
package com.github.continuedev.continueintellijextension.auth
|
||||
import com.intellij.util.messages.Topic
|
||||
|
||||
interface AuthListener {
|
||||
fun startAuthFlow()
|
||||
|
||||
fun handleUpdatedSessionInfo(sessionInfo: ControlPlaneSessionInfo?)
|
||||
|
||||
companion object {
|
||||
val TOPIC = Topic.create("StartAuthFlow", AuthListener::class.java)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.github.continuedev.continueintellijextension.auth
|
||||
|
||||
import com.intellij.openapi.ui.DialogWrapper
|
||||
import com.intellij.ui.components.JBLabel
|
||||
import com.intellij.ui.components.JBTextField
|
||||
import javax.swing.JComponent
|
||||
import javax.swing.JPanel
|
||||
import java.awt.BorderLayout
|
||||
|
||||
class ContinueAuthDialog(private val onTokenEntered: (String) -> Unit) : DialogWrapper(true) {
|
||||
private val tokenField = JBTextField()
|
||||
|
||||
init {
|
||||
init()
|
||||
title = "Enter Continue Authentication Token"
|
||||
}
|
||||
|
||||
override fun createCenterPanel(): JComponent {
|
||||
val panel = JPanel(BorderLayout())
|
||||
panel.add(JBLabel("Please enter your Continue authentication token:"), BorderLayout.NORTH)
|
||||
panel.add(tokenField, BorderLayout.CENTER)
|
||||
return panel
|
||||
}
|
||||
|
||||
override fun doOKAction() {
|
||||
val token = tokenField.text
|
||||
if (token.isNotBlank()) {
|
||||
onTokenEntered(token)
|
||||
super.doOKAction()
|
||||
} else {
|
||||
setErrorText("Please enter a valid token")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,207 @@
|
|||
package com.github.continuedev.continueintellijextension.auth
|
||||
|
||||
import com.github.continuedev.continueintellijextension.services.ContinuePluginService
|
||||
import com.intellij.credentialStore.Credentials
|
||||
import com.intellij.ide.passwordSafe.PasswordSafe
|
||||
import com.intellij.ide.util.PropertiesComponent
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.components.Service
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.remoteServer.util.CloudConfigurationUtil.createCredentialAttributes
|
||||
import java.awt.Desktop
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import net.minidev.json.JSONObject
|
||||
import okhttp3.MediaType.Companion.toMediaType
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
import java.net.URL
|
||||
|
||||
@Service
|
||||
class ContinueAuthService {
|
||||
companion object {
|
||||
fun getInstance(): ContinueAuthService = service<ContinueAuthService>()
|
||||
private const val CREDENTIALS_USER = "ContinueAuthUser"
|
||||
private const val ACCESS_TOKEN_KEY = "ContinueAccessToken"
|
||||
private const val REFRESH_TOKEN_KEY = "ContinueRefreshToken"
|
||||
private const val ACCOUNT_ID_KEY = "ContinueAccountId"
|
||||
private const val ACCOUNT_LABEL_KEY = "ContinueAccountLabel"
|
||||
private const val CONTROL_PLANE_URL = "https://control-plane-api-service-i3dqylpbqa-uc.a.run.app"
|
||||
// private const val CONTROL_PLANE_URL = "http://localhost:3001"
|
||||
}
|
||||
|
||||
fun startAuthFlow(project: Project) {
|
||||
// Open login page
|
||||
openSignInPage(project)
|
||||
|
||||
// Open a dialog where the user should paste their sign-in token
|
||||
com.intellij.openapi.application.ApplicationManager.getApplication().invokeLater {
|
||||
val dialog = ContinueAuthDialog() { token ->
|
||||
// Store the token
|
||||
handleNewRefreshToken(token)
|
||||
}
|
||||
dialog.show()
|
||||
}
|
||||
}
|
||||
|
||||
fun signOut() {
|
||||
// Clear the stored tokens
|
||||
setAccessToken("")
|
||||
setRefreshToken("")
|
||||
setAccountId("")
|
||||
setAccountLabel("")
|
||||
}
|
||||
|
||||
private fun handleNewRefreshToken(token: String) {
|
||||
// Launch a coroutine to call the suspend function
|
||||
kotlinx.coroutines.GlobalScope.launch {
|
||||
try {
|
||||
val response = refreshToken(token)
|
||||
val accessToken = response["accessToken"] as? String
|
||||
val refreshToken = response["refreshToken"] as? String
|
||||
val user = response["user"] as? Map<*, *>
|
||||
val firstName = user?.get("firstName") as? String
|
||||
val lastName = user?.get("lastName") as? String
|
||||
val label = "$firstName $lastName"
|
||||
val id = user?.get("id") as? String
|
||||
|
||||
// Persist the session info
|
||||
setRefreshToken(refreshToken!!)
|
||||
val sessionInfo = ControlPlaneSessionInfo(accessToken!!, ControlPlaneSessionInfo.Account(id!!, label))
|
||||
setControlPlaneSessionInfo(sessionInfo)
|
||||
|
||||
// Notify listeners
|
||||
ApplicationManager.getApplication().messageBus.syncPublisher(AuthListener.TOPIC).handleUpdatedSessionInfo(sessionInfo)
|
||||
|
||||
} catch (e: Exception) {
|
||||
// Handle any exceptions
|
||||
println("Exception while refreshing token: ${e.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun refreshToken(refreshToken: String) = withContext(Dispatchers.IO) {
|
||||
val client = OkHttpClient()
|
||||
val url = URL(CONTROL_PLANE_URL).toURI().resolve("/auth/refresh").toURL()
|
||||
val jsonBody = JSONObject().apply {
|
||||
put("refreshToken", refreshToken)
|
||||
}
|
||||
|
||||
val requestBody = jsonBody.toString().toRequestBody("application/json".toMediaType())
|
||||
|
||||
val request = Request.Builder()
|
||||
.url(url)
|
||||
.post(requestBody)
|
||||
.header("Content-Type", "application/json")
|
||||
.build()
|
||||
|
||||
val response = client.newCall(request).execute()
|
||||
|
||||
val responseBody = response.body?.string()
|
||||
val gson = com.google.gson.Gson()
|
||||
val responseMap = gson.fromJson(responseBody, Map::class.java)
|
||||
|
||||
responseMap
|
||||
}
|
||||
|
||||
|
||||
private fun openSignInPage(project: Project) {
|
||||
val coreMessenger = project.service<ContinuePluginService>().coreMessenger
|
||||
coreMessenger?.request("auth/getAuthUrl", null, null) { response ->
|
||||
val authUrl = (response as? Map<*, *>)?.get("url") as? String
|
||||
if (authUrl != null) {
|
||||
// Open the auth URL in the browser
|
||||
Desktop.getDesktop().browse(java.net.URI(authUrl))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun retrieveSecret(key: String): String? {
|
||||
val attributes = createCredentialAttributes(key, CREDENTIALS_USER)
|
||||
val passwordSafe: PasswordSafe = PasswordSafe.instance
|
||||
|
||||
val credentials: Credentials? = passwordSafe[attributes!!]
|
||||
return credentials?.getPasswordAsString()
|
||||
}
|
||||
|
||||
private fun storeSecret(key: String, secret: String) {
|
||||
val attributes = createCredentialAttributes(key, CREDENTIALS_USER)
|
||||
val passwordSafe: PasswordSafe = PasswordSafe.instance
|
||||
|
||||
val credentials = Credentials(CREDENTIALS_USER, secret)
|
||||
passwordSafe.set(attributes!!, credentials)
|
||||
}
|
||||
|
||||
private fun getAccessToken(): String? {
|
||||
return retrieveSecret(ACCESS_TOKEN_KEY)
|
||||
}
|
||||
|
||||
private fun setAccessToken(token: String) {
|
||||
storeSecret(ACCESS_TOKEN_KEY, token)
|
||||
}
|
||||
|
||||
private fun getRefreshToken(): String? {
|
||||
return retrieveSecret(REFRESH_TOKEN_KEY)
|
||||
}
|
||||
|
||||
private fun setRefreshToken(token: String) {
|
||||
storeSecret(REFRESH_TOKEN_KEY, token)
|
||||
}
|
||||
|
||||
fun getAccountId(): String? {
|
||||
return PropertiesComponent.getInstance().getValue(ACCOUNT_ID_KEY)
|
||||
}
|
||||
|
||||
fun setAccountId(id: String) {
|
||||
PropertiesComponent.getInstance().setValue(ACCOUNT_ID_KEY, id)
|
||||
}
|
||||
|
||||
fun getAccountLabel(): String? {
|
||||
return PropertiesComponent.getInstance().getValue(ACCOUNT_LABEL_KEY)
|
||||
}
|
||||
|
||||
fun setAccountLabel(label: String) {
|
||||
PropertiesComponent.getInstance().setValue(ACCOUNT_LABEL_KEY, label)
|
||||
}
|
||||
|
||||
// New method to load all info as an object
|
||||
fun loadControlPlaneSessionInfo(): ControlPlaneSessionInfo? {
|
||||
val accessToken = getAccessToken()
|
||||
val accountId = getAccountId()
|
||||
val accountLabel = getAccountLabel()
|
||||
|
||||
return if (accessToken != null && accountId != null && accountLabel != null) {
|
||||
ControlPlaneSessionInfo(
|
||||
accessToken = accessToken,
|
||||
account = ControlPlaneSessionInfo.Account(
|
||||
id = accountId,
|
||||
label = accountLabel
|
||||
)
|
||||
)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
// New method to set all info from a ControlPlaneSessionInfo object
|
||||
fun setControlPlaneSessionInfo(info: ControlPlaneSessionInfo) {
|
||||
setAccessToken(info.accessToken)
|
||||
setAccountId(info.account.id)
|
||||
setAccountLabel(info.account.label)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Data class to represent the ControlPlaneSessionInfo
|
||||
data class ControlPlaneSessionInfo(
|
||||
val accessToken: String,
|
||||
val account: Account
|
||||
) {
|
||||
data class Account(
|
||||
val id: String,
|
||||
val label: String
|
||||
)
|
||||
}
|
||||
|
|
@ -147,7 +147,9 @@ class CoreMessenger(private val project: Project, esbuildPath: String, continueC
|
|||
"applyToFile",
|
||||
"getGitHubAuthToken",
|
||||
"setGitHubAuthToken",
|
||||
"pathSep"
|
||||
"pathSep",
|
||||
"getControlPlaneSessionInfo",
|
||||
"logoutOfControlPlane"
|
||||
)
|
||||
|
||||
private val PASS_THROUGH_TO_WEBVIEW = listOf<String>(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.github.continuedev.continueintellijextension.`continue`
|
||||
|
||||
import com.github.continuedev.continueintellijextension.*
|
||||
import com.github.continuedev.continueintellijextension.auth.AuthListener
|
||||
import com.github.continuedev.continueintellijextension.auth.ContinueAuthService
|
||||
import com.github.continuedev.continueintellijextension.constants.*
|
||||
import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings
|
||||
import com.github.continuedev.continueintellijextension.services.ContinuePluginService
|
||||
|
|
@ -232,9 +234,28 @@ class IdeProtocolClient (
|
|||
respond(mapOf(
|
||||
"remoteConfigServerUrl" to settings.continueState.remoteConfigServerUrl,
|
||||
"remoteConfigSyncPeriod" to settings.continueState.remoteConfigSyncPeriod,
|
||||
"userToken" to settings.continueState.userToken
|
||||
"userToken" to settings.continueState.userToken,
|
||||
"enableControlServerBeta" to settings.continueState.enableContinueTeamsBeta
|
||||
))
|
||||
}
|
||||
"getControlPlaneSessionInfo" -> {
|
||||
val silent = (data as? Map<String, Any>)?.get("silent") as? Boolean ?: false
|
||||
|
||||
val authService = service<ContinueAuthService>()
|
||||
if (silent) {
|
||||
val sessionInfo = authService.loadControlPlaneSessionInfo()
|
||||
respond(sessionInfo)
|
||||
} else {
|
||||
authService.startAuthFlow(project)
|
||||
respond(null)
|
||||
}
|
||||
}
|
||||
"logoutOfControlPlane" -> {
|
||||
val authService = service<ContinueAuthService>()
|
||||
authService.signOut()
|
||||
ApplicationManager.getApplication().messageBus.syncPublisher(AuthListener.TOPIC).handleUpdatedSessionInfo(null)
|
||||
respond(null)
|
||||
}
|
||||
"getIdeInfo" -> {
|
||||
val applicationInfo = ApplicationInfo.getInstance()
|
||||
val ideName: String = applicationInfo.fullApplicationName
|
||||
|
|
|
|||
|
|
@ -1,20 +1,13 @@
|
|||
package com.github.continuedev.continueintellijextension.services
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.components.PersistentStateComponent
|
||||
import com.intellij.openapi.components.ServiceManager
|
||||
import com.intellij.openapi.components.State
|
||||
import com.intellij.openapi.components.Storage
|
||||
import com.intellij.openapi.components.*
|
||||
import com.intellij.openapi.options.Configurable
|
||||
import com.intellij.openapi.project.DumbAware
|
||||
import com.intellij.util.messages.Topic
|
||||
import java.awt.GridBagConstraints
|
||||
import java.awt.GridBagLayout
|
||||
import javax.swing.JCheckBox
|
||||
import javax.swing.JComponent
|
||||
import javax.swing.JLabel
|
||||
import javax.swing.JPanel
|
||||
import javax.swing.JTextField
|
||||
import javax.swing.*
|
||||
|
||||
class ContinueSettingsComponent: DumbAware {
|
||||
val panel: JPanel = JPanel(GridBagLayout())
|
||||
|
|
@ -22,6 +15,7 @@ class ContinueSettingsComponent: DumbAware {
|
|||
val remoteConfigSyncPeriod: JTextField = JTextField()
|
||||
val userToken: JTextField = JTextField()
|
||||
val enableTabAutocomplete: JCheckBox = JCheckBox("Enable Tab Autocomplete")
|
||||
val enableContinueTeamsBeta: JCheckBox = JCheckBox("Enable Continue for Teams Beta (requires restart)")
|
||||
|
||||
init {
|
||||
val constraints = GridBagConstraints()
|
||||
|
|
@ -34,7 +28,6 @@ class ContinueSettingsComponent: DumbAware {
|
|||
|
||||
panel.add(JLabel("Remote Config Server URL:"), constraints)
|
||||
constraints.gridy++
|
||||
constraints.gridy++
|
||||
panel.add(remoteConfigServerUrl, constraints)
|
||||
constraints.gridy++
|
||||
panel.add(JLabel("Remote Config Sync Period (in minutes):"), constraints)
|
||||
|
|
@ -47,6 +40,8 @@ class ContinueSettingsComponent: DumbAware {
|
|||
constraints.gridy++
|
||||
panel.add(enableTabAutocomplete, constraints)
|
||||
constraints.gridy++
|
||||
panel.add(enableContinueTeamsBeta, constraints)
|
||||
constraints.gridy++
|
||||
|
||||
// Add a "filler" component that takes up all remaining vertical space
|
||||
constraints.weighty = 1.0
|
||||
|
|
@ -69,6 +64,7 @@ open class ContinueExtensionSettings : PersistentStateComponent<ContinueExtensio
|
|||
var userToken: String? = null
|
||||
var enableTabAutocomplete: Boolean = true
|
||||
var ghAuthToken: String? = null
|
||||
var enableContinueTeamsBeta: Boolean = false
|
||||
}
|
||||
|
||||
var continueState: ContinueState = ContinueState()
|
||||
|
|
@ -108,7 +104,8 @@ class ContinueExtensionConfigurable : Configurable {
|
|||
val modified = mySettingsComponent?.remoteConfigServerUrl?.text != settings.continueState.remoteConfigServerUrl ||
|
||||
mySettingsComponent?.remoteConfigSyncPeriod?.text?.toInt() != settings.continueState.remoteConfigSyncPeriod ||
|
||||
mySettingsComponent?.userToken?.text != settings.continueState.userToken ||
|
||||
mySettingsComponent?.enableTabAutocomplete?.isSelected != settings.continueState.enableTabAutocomplete
|
||||
mySettingsComponent?.enableTabAutocomplete?.isSelected != settings.continueState.enableTabAutocomplete ||
|
||||
mySettingsComponent?.enableContinueTeamsBeta?.isSelected != settings.continueState.enableContinueTeamsBeta
|
||||
return modified;
|
||||
}
|
||||
|
||||
|
|
@ -118,6 +115,7 @@ class ContinueExtensionConfigurable : Configurable {
|
|||
settings.continueState.remoteConfigSyncPeriod = mySettingsComponent?.remoteConfigSyncPeriod?.text?.toInt() ?: 60
|
||||
settings.continueState.userToken = mySettingsComponent?.userToken?.text
|
||||
settings.continueState.enableTabAutocomplete = mySettingsComponent?.enableTabAutocomplete?.isSelected ?: false
|
||||
settings.continueState.enableContinueTeamsBeta = mySettingsComponent?.enableContinueTeamsBeta?.isSelected ?: false
|
||||
|
||||
ApplicationManager.getApplication().messageBus.syncPublisher(SettingsListener.TOPIC).settingsUpdated(settings.continueState)
|
||||
}
|
||||
|
|
@ -128,6 +126,7 @@ class ContinueExtensionConfigurable : Configurable {
|
|||
mySettingsComponent?.remoteConfigSyncPeriod?.text = settings.continueState.remoteConfigSyncPeriod.toString()
|
||||
mySettingsComponent?.userToken?.text = settings.continueState.userToken
|
||||
mySettingsComponent?.enableTabAutocomplete?.isSelected = settings.continueState.enableTabAutocomplete
|
||||
mySettingsComponent?.enableContinueTeamsBeta?.isSelected = settings.continueState.enableContinueTeamsBeta
|
||||
}
|
||||
|
||||
override fun disposeUIResources() {
|
||||
|
|
|
|||
|
|
@ -68,7 +68,10 @@ class ContinueBrowser(val project: Project, url: String, useOsr: Boolean = false
|
|||
"index/forceReIndex",
|
||||
"index/indexingProgressBarInitialized",
|
||||
"completeOnboarding",
|
||||
"addAutocompleteModel"
|
||||
"addAutocompleteModel",
|
||||
"config/listProfiles",
|
||||
"profiles/switch",
|
||||
"didChangeSelectedProfile",
|
||||
)
|
||||
|
||||
private fun registerAppSchemeHandler() {
|
||||
|
|
|
|||
|
|
@ -1827,6 +1827,33 @@
|
|||
"title": "config.json",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"docs": {
|
||||
"title": "Docs",
|
||||
"description": "A list of documentation sites to be indexed",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string",
|
||||
"description": "The title of the documentation site"
|
||||
},
|
||||
"startUrl": {
|
||||
"type": "string",
|
||||
"description": "The starting URL for indexing the documentation"
|
||||
},
|
||||
"rootUrl": {
|
||||
"type": "string",
|
||||
"description": "The root URL of the documentation site"
|
||||
},
|
||||
"maxDepth": {
|
||||
"type": "integer",
|
||||
"description": "The maximum depth to crawl the documentation site"
|
||||
}
|
||||
},
|
||||
"required": ["title", "startUrl"]
|
||||
}
|
||||
},
|
||||
"allowAnonymousTelemetry": {
|
||||
"title": "Allow Anonymous Telemetry",
|
||||
"markdownDescription": "If this field is set to True, we will collect anonymous telemetry as described in the documentation page on telemetry. If set to `false`, we will not collect any data. Learn more in [the docs](https://docs.continue.dev/telemetry).",
|
||||
|
|
|
|||
|
|
@ -1827,6 +1827,33 @@
|
|||
"title": "config.json",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"docs": {
|
||||
"title": "Docs",
|
||||
"description": "A list of documentation sites to be indexed",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string",
|
||||
"description": "The title of the documentation site"
|
||||
},
|
||||
"startUrl": {
|
||||
"type": "string",
|
||||
"description": "The starting URL for indexing the documentation"
|
||||
},
|
||||
"rootUrl": {
|
||||
"type": "string",
|
||||
"description": "The root URL of the documentation site"
|
||||
},
|
||||
"maxDepth": {
|
||||
"type": "integer",
|
||||
"description": "The maximum depth to crawl the documentation site"
|
||||
}
|
||||
},
|
||||
"required": ["title", "startUrl"]
|
||||
}
|
||||
},
|
||||
"allowAnonymousTelemetry": {
|
||||
"title": "Allow Anonymous Telemetry",
|
||||
"markdownDescription": "If this field is set to True, we will collect anonymous telemetry as described in the documentation page on telemetry. If set to `false`, we will not collect any data. Learn more in [the docs](https://docs.continue.dev/telemetry).",
|
||||
|
|
|
|||
|
|
@ -2049,6 +2049,36 @@
|
|||
"title": "config.json",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"docs": {
|
||||
"title": "Docs",
|
||||
"description": "A list of documentation sites to be indexed",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string",
|
||||
"description": "The title of the documentation site"
|
||||
},
|
||||
"startUrl": {
|
||||
"type": "string",
|
||||
"description": "The starting URL for indexing the documentation"
|
||||
},
|
||||
"rootUrl": {
|
||||
"type": "string",
|
||||
"description": "The root URL of the documentation site"
|
||||
},
|
||||
"maxDepth": {
|
||||
"type": "integer",
|
||||
"description": "The maximum depth to crawl the documentation site"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"title",
|
||||
"startUrl"
|
||||
]
|
||||
}
|
||||
},
|
||||
"allowAnonymousTelemetry": {
|
||||
"title": "Allow Anonymous Telemetry",
|
||||
"markdownDescription": "If this field is set to True, we will collect anonymous telemetry as described in the documentation page on telemetry. If set to `false`, we will not collect any data. Learn more in [the docs](https://docs.continue.dev/telemetry).",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"icon": "media/icon.png",
|
||||
"version": "0.9.187",
|
||||
"version": "0.9.188",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/continuedev/continue"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ import { PromiseAdapter, promiseFromEvent } from "./promiseUtils";
|
|||
|
||||
export const AUTH_TYPE = "continue";
|
||||
const AUTH_NAME = "Continue";
|
||||
const CLIENT_ID = "client_01J0FW6XN8N2XJAECF7NE0Y65J";
|
||||
const CLIENT_ID = "client_01J0FW6XN8N2XJAECF7NE0Y65J"; // Production
|
||||
// const CLIENT_ID = "client_01J0FW6XCPMJMQ3CG51RB4HBZQ"; // Staging
|
||||
const SESSIONS_SECRET_KEY = `${AUTH_TYPE}.sessions`;
|
||||
|
||||
class UriEventHandler extends EventEmitter<Uri> implements UriHandler {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import { IdeMessengerContext } from "../context/IdeMessenger";
|
|||
import { useAuth } from "../hooks/useAuth";
|
||||
import { useWebviewListener } from "../hooks/useWebviewListener";
|
||||
import { RootState } from "../redux/store";
|
||||
import { getFontSize, isJetBrains } from "../util";
|
||||
import { getFontSize } from "../util";
|
||||
import HeaderButtonWithText from "./HeaderButtonWithText";
|
||||
|
||||
const StyledListbox = styled(Listbox)`
|
||||
|
|
@ -235,7 +235,7 @@ function ProfileSwitcher(props: {}) {
|
|||
</HeaderButtonWithText>
|
||||
|
||||
{/* Only show login if beta explicitly enabled */}
|
||||
{!isJetBrains() && controlServerBetaEnabled && (
|
||||
{controlServerBetaEnabled && (
|
||||
<HeaderButtonWithText
|
||||
text={
|
||||
session?.account
|
||||
|
|
@ -243,7 +243,7 @@ function ProfileSwitcher(props: {}) {
|
|||
: "Click to login to Continue"
|
||||
}
|
||||
onClick={() => {
|
||||
if (session.account) {
|
||||
if (session?.account) {
|
||||
logout();
|
||||
} else {
|
||||
login();
|
||||
|
|
|
|||
|
|
@ -218,10 +218,7 @@ function ModelSelect() {
|
|||
>
|
||||
<div>{modelSelectTitle(defaultModel) || "Select model"}</div>
|
||||
<div className="pointer-events-none flex items-center">
|
||||
<ChevronDownIcon
|
||||
className="h-2.5 w-2.5"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<ChevronDownIcon className="h-2.5 w-2.5" aria-hidden="true" />
|
||||
</div>
|
||||
</StyledListboxButton>
|
||||
<StyledListboxOptions>
|
||||
|
|
|
|||
|
|
@ -124,7 +124,10 @@ function useSubmenuContextProviders() {
|
|||
query,
|
||||
MINISEARCH_OPTIONS,
|
||||
);
|
||||
console.debug(`Search results for ${providerTitle}:`, results.length);
|
||||
console.debug(
|
||||
`Search results for ${providerTitle}:`,
|
||||
results.length,
|
||||
);
|
||||
return results.map((result) => {
|
||||
return { ...result, providerTitle };
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@continuedev/config-types",
|
||||
"version": "1.0.8",
|
||||
"version": "1.0.9",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
|
|
|||
|
|
@ -195,6 +195,14 @@ export const devDataSchema = z.object({
|
|||
});
|
||||
export type DevData = z.infer<typeof devDataSchema>;
|
||||
|
||||
export const siteIndexingConfigSchema = z.object({
|
||||
startUrl: z.string(),
|
||||
rootUrl: z.string(),
|
||||
title: z.string(),
|
||||
maxDepth: z.string().optional(),
|
||||
faviconUrl: z.string().optional(),
|
||||
});
|
||||
|
||||
export const configJsonSchema = z.object({
|
||||
models: z.array(modelDescriptionSchema),
|
||||
tabAutocompleteModel: modelDescriptionSchema.optional(),
|
||||
|
|
@ -212,5 +220,6 @@ export const configJsonSchema = z.object({
|
|||
disableIndexing: z.boolean().optional(),
|
||||
tabAutocompleteOptions: tabAutocompleteOptionsSchema.optional(),
|
||||
ui: uiOptionsSchema.optional(),
|
||||
docs: z.array(siteIndexingConfigSchema).optional(),
|
||||
});
|
||||
export type ConfigJson = z.infer<typeof configJsonSchema>;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue