From eb060a2c700fe93d1695a7565a87a6c4b1314fa4 Mon Sep 17 00:00:00 2001 From: fernando234234 Date: Fri, 9 Jan 2026 11:59:38 +0100 Subject: [PATCH 1/2] fix(claude-code): OAuth compatibility and tool name validation Fixes Claude Code OAuth token authentication issues by aligning the request shape with what Anthropic's API expects for OAuth tokens. Changes: - Update User-Agent to match Claude CLI format: "claude-cli/VERSION (external, cli)" - Remove fine-grained-tool-streaming beta header (incompatible with OAuth) - Add tool name prefixing with "oc_" prefix to bypass tool validation - Strip prefix from tool names in responses for internal consistency - Prefix tool names in conversation history to match tool definitions The tool name prefixing is necessary because Anthropic's API validates tool names against a known list when using OAuth tokens. By prefixing with "oc_" we can use custom tool names while maintaining compatibility. Inspired by fixes from: - https://github.com/anomalyco/opencode-anthropic-auth/pull/10 - https://github.com/anomalyco/opencode-anthropic-auth/pull/11 Thanks to @anomalyco for the original research and implementation. --- apps/web-roo-code/src/app/terms/terms.md | 337 ++++++++++++++---- .../claude-code/streaming-client.ts | 98 ++++- 2 files changed, 362 insertions(+), 73 deletions(-) diff --git a/apps/web-roo-code/src/app/terms/terms.md b/apps/web-roo-code/src/app/terms/terms.md index 1880c6184ec..d61b96ef3d0 100644 --- a/apps/web-roo-code/src/app/terms/terms.md +++ b/apps/web-roo-code/src/app/terms/terms.md @@ -1,101 +1,306 @@ # Roo Code Cloud Terms of Service -_(Version 1.1 – Effective Oct 16, 2025)_ +_Last updated: January 9, 2026_ -These Terms of Service ("**TOS**") govern access to and use of the Roo Code Cloud service (the "**Service**"). They apply to: +## 1. Agreement -- **(a)** every **Sales Order Form** or similar document mutually executed by Roo Code and the customer that references these TOS; **and** -- **(b)** any **online plan-selection, self-service sign-up, or in-app purchase flow** through which a customer clicks an "I Agree" (or equivalent) button to accept these TOS — such flow also being an **"Order Form."** +These Roo Code Cloud Terms of Service (collectively, including Schedule 1 (Data Processing Addendum), any documents, schedules, annexes, or terms attached hereto or incorporated herein, this "**Agreement**"), dated as of the date you click "Sign Up" or "I agree" or otherwise indicate your assent (the "**Effective Date**"), is entered into by and between Roo Code, Inc. ("**Roo Code**") and you ("**User**" or "**you**"). If you are also entering into this Agreement for or on behalf of the entity that employs or engages you, and/or that you represent or purport to represent ("**Entity**"), you hereby represent that you have the authority to bind and you hereby bind Entity to this Agreement. This is a legally binding contract. Roo Code and User are each referred to in this Agreement as a "**party**" and collectively as the "**parties**". By clicking "Sign Up" or "I agree" or otherwise indicating your assent or by accessing or using any Software (as defined in Section 2), you agree to be bound by this Agreement. In addition, if you are resident in (i) any jurisdiction outside of Europe (as defined below) (including in the U.S.), "Agreement" includes Roo Code's Data Protection Notice (available at [https://roocode.com/privacy](/privacy), the "**Privacy Policy**"); or (ii) European Economic Area, UK, and Switzerland (collectively, "**Europe**"), you hereby acknowledge that you have received a copy of the Privacy Policy. If you are accessing or using any Software for or on behalf of Entity pursuant to or in connection with any other effective agreement between Roo Code and Entity (any such agreement(s), collectively (as applicable), the "**Entity Agreement**"), your access to and use of the Software is also subject to the terms of the Entity Agreement. In the event of any conflict between the terms of the Entity Agreement and the other terms of this Agreement, the terms of the Entity Agreement shall prevail to the extent necessary to resolve such conflict with respect to the subject matter thereof. -By **creating an account, clicking to accept, or using the Service**, the person or entity doing so ("**Customer**") agrees to be bound by these TOS, even if no separate Order Form is signed. +## 2. Limited License -If Roo Code and Customer later execute a Master Subscription Agreement ("**MSA**"), the MSA governs; otherwise, these TOS and the applicable Order Form together form the entire agreement (the "**Agreement**"). +Subject to the terms of this Agreement, the Privacy Policy, and Roo Code's other applicable user terms, guidelines, and policies (as made available and updated by Roo Code from time to time) and the Entity Agreement (as applicable), Roo Code hereby grants to User a limited, revocable, non-exclusive, non-sublicensable, non-transferable license to use the then-current version of the Roo Code software tool listed in the applicable Order Form (as defined below) ("**Software**"), as made available by Roo Code to User, solely for the purposes described in the applicable Order Form and solely for the duration (during the term of this Agreement) expressly authorized in writing by Roo Code. -## 1. Agreement Framework +## 3. No Reliance -1. **Incorporation of Standard Terms.** - The [_Common Paper Cloud Service Standard Terms v 2.0_](https://commonpaper.com/standards/cloud-service-agreement/2.0/) (the "**Standard Terms**") are incorporated by reference. If these TOS conflict with the Standard Terms, these TOS control. +User agrees that User is not relying on the delivery of any future functionality or features (or on any oral or written public comments made by or on behalf of Roo Code regarding any future functionality or features) of the Software or any related services. -2. **Order of Precedence.** - (a) Order Form (b) these TOS (c) Standard Terms. +## 4. Restrictions -## 2. Key Commercial Terms +User shall not (directly or indirectly), and shall not permit any third party to, do or attempt to do any of the following (except as otherwise expressly authorized by Roo Code in writing): -| Term | Value | -| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Governing Law / Forum | Delaware law; exclusive jurisdiction and venue in the state or federal courts located in Delaware | -| Plans & Subscription Periods | _Free Plan:_ month-to-month.
_Paid Plans:_ Monthly **or** Annual, as selected in an Order Form or the online flow. | -| Auto-Renewal & Non-Renewal Notice | _Free Plan:_ renews continuously until cancelled in the dashboard.
_Paid Plans:_ renew for the same period unless either party gives 30 days' written notice before the current period ends. | -| Fees & Usage | _Free Plan:_ Subscription Fee = $0.
_Paid Plans:_ Fees stated in the Order Form or online checkout, invoiced monthly, **plus** Credits, credit-card charge upon online checkout. | -| Payment Terms | _Monthly paid plans:_ credit-card charge on the billing date.
_Annual paid plans:_ invoiced Net 30 (credit card optional).
_Credits:_ credit-card charge upon online checkout. | -| Credit Expiration. | Credits expire one calendar year after purchase | -| General Liability Cap | The greater of (i) USD 100 and (ii) 1 × Fees paid or payable in the 12 months before the event giving rise to liability. | -| Increased Cap / Unlimited Claims | None. | -| Trial / Pilot | Self-service paid plans offer a 14-day free trial, with no subscription charge during the period. Credits are always charged, including during the free trial. | -| Beta Features | None – only generally available features are provided. | -| Security Standard | Roo Code is SOC2 Type 2 compliant and follows industry-standard security practices. | -| Machine-Learning Use | Roo Code **does not** use Customer Content to train, fine-tune, or improve any ML or AI models. | -| Data Processing Addendum (DPA) | GDPR/CCPA-ready DPA available upon written request. Subprocessors listed [here](/legal/subprocessors). | -| Publicity / Logo Rights | Roo Code may identify Customer (name & logo) in marketing materials unless Customer opts out in writing. | +1. reverse engineer, decompile, disassemble, or otherwise attempt to discover or access the source code or underlying ideas or algorithms of any Software or any other content, code, documentation, or other materials provided or made available through or in connection with, or contained in or embodied by, the Software (collectively, including any portions, copies, modifications, enhancements, derivatives, versions, or embodiments of the Software or any such other materials (in any form or media), "**Software Materials**") unless expressly permitted by law (in which case User shall notify Roo Code of its intention to exercise such rights and provide Roo Code the opportunity to remedy the issue giving rise to such rights so that User does not need to exercise such rights); +2. copy, download, export, modify, or translate, or create derivative (or substantially similar) works based on, any Software Materials; +3. rent, lease, distribute (or otherwise make available), sell, resell, assign, or otherwise transfer any Software Materials (or any rights related thereto); +4. use any Software Materials for timesharing or service bureau purposes or otherwise for the benefit of a third party, or in or for any competitive, discriminatory, abusive, fraudulent, harmful, high-risk, infringing, inappropriate, unlawful, or other unauthorized manner or purpose; +5. use any Software Materials to encourage, facilitate, or participate in the circumvention of the intended functionality or use of any Software Materials, or bypass or breach any security device or protection; +6. remove any disclaimers, or copyright or other proprietary notices from any Software Materials; +7. provide or make available, including via User-submitted prompts, any personal data (or other sensitive information) to Roo Code without Roo Code's express prior written consent in each instance; +8. publish or disclose to third parties any evaluation of any Software Materials; +9. make any Software Materials available to anyone other than authorized users; +10. interfere with or disrupt the integrity or performance of any Software Materials, any Roo Code systems, or any contents thereof; or +11. convey, disseminate, or imply any false or misleading information or identity. -## 3. Modifications to the Standard Terms +## 5. Use; Fees -1. **Section 1.6 (Machine Learning).** - "Provider will not use Customer Content or Usage Data to train, fine-tune, or improve any machine-learning or AI model, except with Customer's prior written consent." +### 5.1 User's and Entity's Responsibilities -2. **Section 3 (Security).** - Replace "reasonable" with "commercially reasonable." +User and the Entity shall: -3. **Section 4 (Fees & Payment).** - Add usage-billing language above and delete any provision allowing unilateral fee increases. +1. be solely responsible for the accuracy, truth, completeness, and legality of User Data (as defined in Section 6) and of the means by which User Data was acquired and made available; +2. prevent any unauthorized access to or use of any Software Materials, and promptly notify Roo Code of any such unauthorized access or use; +3. provide any required or reasonably requested cooperation in connection with the provision or use of the Software; and +4. use the Software in accordance with all applicable laws and regulations. -4. **Section 5 (Term & Termination).** - Insert auto-renewal and free-plan language above. +### 5.2 Third Party Materials -5. **Sections 7 (Trials / Betas) and any SLA references.** - Deleted – Roo Code offers no pilots, betas, or SLA credits under these TOS. +From time to time, Roo Code may make available (through the Software or otherwise) certain third-party services, data, content, code, products, applications, tools, or other materials (collectively, "**Third Party Materials**"). Any access or use by User of any Third Party Materials, and any exchange of data between User and any third party or Third Party Materials, is solely between User and the applicable non-Roo Code provider. -6. **Section 12.12 (Publicity).** - As reflected in the "Publicity / Logo Rights" row above. +### 5.3 Fees -## 4. Use of the Service +As applicable, User (or, as applicable, Entity) shall pay Roo Code (or Roo Code's designated payment vendor) any amounts listed or described in any Roo Code-provided or Roo Code-approved purchasing or ordering document or procedure (each, an "**Order Form**") in accordance with the terms of this Agreement (including such Order Form, which is incorporated herein by reference). Unless otherwise stated in such Order Form, all fees, as applicable: -Customer may access and use the Service solely for its internal business purposes and subject to the Acceptable Use Policy in the Standard Terms. +1. are non-refundable, +2. are due in advance, and +3. exclude any applicable taxes. -## 5. Account Management & Termination +At Roo Code's option, in its sole discretion, the outstanding balance of any payment not received by the due date shall accrue interest (except with respect to charges then under reasonable and good faith dispute) at one and a half percent (1.5%) per month (or, if lower, the maximum rate permitted by applicable law) from the date such payment is due until the date paid. User (or, as applicable, Entity) shall also pay all costs incurred (including reasonable legal fees) in collecting overdue payments. With respect to any User payment obligation, User hereby authorizes Roo Code to, without prior notice and without any further approval, deduct such amounts from any prepaid or outstanding balance or to charge, debit, or otherwise obtain such amounts from any designated payment method, as applicable. -- **Self-service cancellation or downgrade.** - Customer may cancel a Free Plan immediately, or cancel/downgrade a Paid Plan effective at the end of the current billing cycle, via the web dashboard. -- Either party may otherwise terminate the Agreement as allowed under Section 5 of the Standard Terms. +### 5.4 Credits -## 6. Privacy & Data +If you purchase, earn, or receive, or you are eligible for, any credits, tokens, rewards, points, or other similar items related to use of the Software or any related services (e.g., compute credits), all of the foregoing shall be subject to the terms of Roo Code's applicable policies (e.g., Roo Code's Compute Credit Policy). Unless otherwise stated in the applicable Roo Code policy or required by applicable law, any such credits or other items will automatically expire (without any refund) upon termination of this Agreement (or the applicable Order Form). -Roo Code's Privacy Notice ([https://roocode.com/privacy](https://roocode.com/privacy)) explains how Roo Code collects and handles personal information. If Customer requires a DPA, email [support@roocode.com](mailto:support@roocode.com). +## 6. Ownership; Data -## 7. Warranty Disclaimer +### 6.1 Software Materials -Except as expressly stated in the Agreement, the Service is provided **"as is,"** and all implied warranties are disclaimed to the maximum extent allowed by law. +User acknowledges that, as between Roo Code, on the one hand, and User and Entity, on the other hand, all rights, title, and interests in and to the Software Materials, including all related intellectual property rights, belong to and are retained solely by Roo Code (or Roo Code's third-party licensors and suppliers, as applicable). Roo Code reserves all rights not expressly granted under this Agreement. If, for any reason, User or Entity acquires any rights, title, or interest in or to any of the Software Materials by virtue of this Agreement or otherwise (other than the limited license rights expressly granted in Section 2), User (on behalf of itself and Entity) agrees to assign, and does hereby irrevocably assign, any and all such rights, title, and interest to Roo Code. -## 8. Limitation of Liability +### 6.2 Derived Data -The caps in Section 2 apply to all claims under the Agreement, whether in contract, tort, or otherwise, except for Excluded Claims defined in the Standard Terms. +User acknowledges and agrees that Roo Code shall have the right to generate any non-personally and non-User identifiable data, insights, or other information resulting from or related to User's use of the Software to the extent such information does not constitute User Data ("**Derived Data**"). Subject to the Privacy Policy and applicable law, Derived Data may be collected and used by Roo Code for any business purpose (including to improve and train the Software), provided that Derived Data is disclosed to third parties only in aggregated or anonymized form. -## 9. Miscellaneous +### 6.3 User Data -1. **Assignment.** - Customer may not assign the Agreement without Roo Code's prior written consent, except to a successor in a merger or sale of substantially all assets. +"**User Data**" means data that is provided by User, and is processed, via the Software. "**GDPR**" means, collectively, the EU General Data Protection Regulation, UK General Data Protection Regulation, UK Data Protection Act 2018, and other data protection and e-privacy laws in Europe (including laws of the member states of the European Economic Area). -2. **Export Compliance.** - Each party will comply with all applicable export-control laws and regulations and will not export or re-export any software or technical data without the required government licences. +To the extent that the processing of User Data is not subject to the GDPR, User (on behalf of itself and Entity) hereby grants to Roo Code the non-exclusive right to use (and for Roo Code's subcontractors to use on its behalf) User Data, in accordance with the Privacy Policy and this Agreement, to offer, provide, maintain, support, train, monitor, or improve the Software (or Roo Code's related technology) or to provide User or Entity with information that might be relevant in connection with this Agreement. -3. **Entire Agreement.** - The Agreement supersedes all prior or contemporaneous agreements for the Service. +To the extent that the processing of User Data is subject to the GDPR, User hereby acknowledges that Roo Code (and Roo Code's subcontractors on Roo Code's behalf) may use and otherwise process User Data, in accordance with the Privacy Policy, including to offer, provide, maintain, support, train, monitor, or improve the Software (or Roo Code's related technology) or to provide User with information that might be relevant in connection with this Agreement. -4. **Amendments.** - Roo Code may update these TOS by posting a revised version at the same URL and emailing or in-app notifying Customer at least 30 days before changes take effect. Continued use after the effective date constitutes acceptance. +### 6.4 Feedback -## 10. Contact +User (on behalf of itself and Entity) hereby grants Roo Code a royalty-free, worldwide, transferable, sublicenseable, irrevocable, perpetual license to use or incorporate into the Software (or any other Roo Code products, applications, or services) any suggestions, enhancement requests, recommendations or other feedback provided by User. Notwithstanding anything to the contrary in this Agreement, Roo Code (and its affiliates) may use, for any lawful purpose, any information (of a general nature or that has general potential applications) that is retained in the unaided memories of Roo Code's (or any of its affiliates') employees or contractors. -**Roo Code, Inc.** -98 Graceland Dr, San Rafael, CA 94901 USA -Email: [support@roocode.com](mailto:support@roocode.com) +## 7. Warranties + +### 7.1 Warranties by Roo Code + +Subject to the terms of this Agreement, Roo Code represents and warrants to User that it: + +1. has the full corporate rights, power and authority to enter into this Agreement and to perform the acts required of it hereunder; and +2. will not violate any applicable law or regulation in the performance of its obligations under this Agreement. + +### 7.2 Warranties by User + +User represents and warrants to Roo Code that: + +1. User has the full corporate rights, power and authority to enter into this Agreement and to perform the acts required of it hereunder; +2. User will not violate any applicable law, regulation, or privacy policy in connection with its use of the Software (or any other Software Materials) or its performance under this Agreement; and +3. User has all rights, consents and approvals necessary to provide the User Data to Roo Code (and for Roo Code to use the User Data as permitted or contemplated under this Agreement), and the User Data is accurate, true, not misleading, lawfully obtained, complete, and does not and will not violate any law, regulation, or third-party rights. + +### 7.3 Beta Services + +If User obtains free, alpha, beta, or trial access to any Services or features (collectively, "**Beta Services**"), the applicable provisions of this Agreement will also govern such Beta Services. Any Beta Services are provided on an "AS IS" AND WITH ALL FAULTS basis; User assumes all risks associated with, and Roo Code shall not have any liability arising from or related to, any Beta Services. Additional terms and conditions for Beta Services may appear on Roo Code's website or the Software, and any such additional terms and conditions are incorporated into this Agreement by reference. + +## 8. Term + +This Agreement begins on the Effective Date and shall continue until terminated in accordance with this Agreement. Subject to earlier termination in accordance with this Agreement, the term of each Order Form is as set forth therein. + +## 9. Termination + +### 9.1 Termination + +Either party may terminate this Agreement (or any Order Form) upon written notice. + +### 9.2 Suspension + +Without limiting Roo Code's termination rights under this Agreement, Roo Code may suspend or terminate access to any Software (or block, delete, or remove any User Data), at its sole option, with or without notice to User if Roo Code reasonably determines or suspects that: + +1. User has breached this Agreement or the Entity Agreement, or +2. continued access would, or is reasonably likely to, result in a violation of Section 4, security, applicable law, or any intellectual property, privacy, property or other rights. + +### 9.3 Effect of Termination + +Roo Code shall not be liable to User or any third party for any suspension or termination of User's access to, or right to use, the Software or any related services. Upon termination of this Agreement, User's access to and use of the Software (and any related services) shall automatically and immediately terminate. Sections 4, 5, 6, 7, 9.3 and 10-14 of this Agreement shall survive the termination of this Agreement. For clarity, if User is subject to any minimum subscription period under an Order Form, User shall pay (or, if prepaid, Roo Code may retain) all fees corresponding to such committed period, notwithstanding any termination of this Agreement or such Order Form. + +## 10. Confidentiality + +### 10.1 Obligations + +Each party (on behalf of itself and Entity) agrees to maintain in confidence any proprietary or non-public information disclosed or made available by the other party in connection with this Agreement, whether written or otherwise, that a party knows or reasonably should know is considered confidential by the disclosing party ("**Confidential Information**"). Roo Code's Confidential Information includes any non-public information constituting, associated with, embedded in, or copied, derived, received, downloaded, or otherwise obtained from any Software Materials (and any portions, copies, modifications, enhancements, versions, summaries, embodiments, or derivatives of any of the foregoing, in any form or media). Confidential Information shall also include any output (including questions and responses, whether voice, text or otherwise) provided by the Software to User. Each party shall not disclose to any third party or use any Confidential Information of the other party, except to perform its obligations or exercise its express rights under this Agreement and shall take appropriate measures to preserve and protect such Confidential Information and the disclosing party's rights therein, at all times exercising at least a reasonable, diligent level of care. Upon termination of this Agreement, and as otherwise requested by the disclosing party, the receiving party shall promptly return or destroy (at the disclosing party's option), all copies of Confidential Information except to the extent that the receiving party is permitted under applicable laws to retain personal data relating to it. + +### 10.2 Required Disclosures + +A disclosure of Confidential Information that is legally compelled to be disclosed pursuant to a subpoena, summons, order or other judicial or governmental process shall not be considered a breach of this Agreement; provided the receiving party: + +1. except to the extent expressly prohibited under applicable law, provides prompt notice of and reasonable cooperation in connection with any such subpoena, order, or the like to the disclosing party so that the disclosing party will have the opportunity to obtain a protective order or otherwise oppose or limit the disclosure; and +2. to the maximum extent permitted by applicable law, minimizes and obtains confidential treatment of such disclosure. + +## 11. Warranty Disclaimer + +EXCEPT AS EXPRESSLY PROVIDED IN THIS AGREEMENT AND TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, ALL SOFTWARE MATERIALS AND RELATED SERVICES ARE PROVIDED "AS IS AND AS AVAILABLE," AND, TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, ROO CODE AND ITS THIRD-PARTY LICENSORS MAKE NO (AND HEREBY DISCLAIM ALL) OTHER WARRANTIES OF ANY KIND, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT, OR FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO ANY ACCESS, USE, AVAILABILITY, QUALITY, INTEGRITY, FAIRNESS, ACCURACY, OR RESULTS OF THE SOFTWARE (IN WHOLE OR IN PART), ANY THIRD PARTY MATERIALS, OR ANY OTHER PRODUCTS, CONTENT, OR SERVICES PROVIDED TO USER BY ROO CODE, OR OTHERWISE UNDER THIS AGREEMENT. WITHOUT LIMITING THE FOREGOING, ROO CODE DOES NOT WARRANT THAT ALL ERRORS CAN OR WILL BE CORRECTED, OR THAT USE OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR FREE. ROO CODE DOES NOT PROVIDE ANY LEGAL (OR OTHER PROFESSIONAL) ADVICE, AND USER SHOULD NOT RELY ON ANY SOFTWARE MATERIALS WHEN MAKING (OR ADVISING WITH RESPECT TO) ANY PERSONAL OR PROFESSIONAL DECISIONS. ROO CODE IS NOT RESPONSIBLE FOR, AND DOES NOT ENDORSE, ANY COMMUNICATIONS OR CONTENT SUBMITTED BY, OR SHARED AMONG, ANY USERS OF THE SOFTWARE. USER UNDERSTANDS AND AGREES THAT OUTPUTS MAY BE GENERATED THROUGH ARTIFICIAL INTELLIGENCE AND RELATED TECHNOLOGIES AND MAY BE SYNTHETIC IN NATURE. OUTPUTS MAY CONTAIN INACCURACIES AND SHOULD NOT BE RELIED UPON AS FACTUAL OR AUTHENTIC STATEMENTS OF ANY PERSON. + +## 12. Indemnification + +### 12.1 By User + +User and/or Entity, as applicable, shall defend, indemnify and hold harmless Roo Code, its affiliates, and its and their respective directors, officers, successors, assigns, employees, third-party licensors, representatives, and agents from and against any third party claim, suit or action and all resulting losses, damages, expenses, fines, penalties or costs (including reasonable attorneys' fees) arising from or relating to: + +1. any User Data; +2. any breach by User of this Agreement; or +3. any gross negligence, willful misconduct, or violation of law by User or Entity. + +User and/or Entity, as applicable, shall pay any liability or settlement arising from any such claim or suit. User and/or Entity shall not, however, be responsible for claims to the extent arising solely from the unauthorized access, alteration, or misuse of User Data or outputs by a third party without User's knowledge or reasonable control. User and/or Entity shall be fully responsible and liable for all acts and omissions through User's account as if User directly engaged in such conduct. + +### 12.2 By Roo Code + +Roo Code shall indemnify, defend, and hold harmless User against any third-party claim or suit to the extent based on a claim that the Software (excluding any Third Party Materials), as provided by Roo Code to User, violates, infringes, or misappropriates any United States patent, copyright, or trade secret, and Roo Code shall pay any liability or settlement arising from such proceeding, provided that: + +1. Roo Code is promptly notified in writing of such claim or suit; +2. Roo Code or its designee has sole control of such defense or settlement; +3. User gives all information and assistance requested by Roo Code or such designee; and +4. such claim does not result from any unauthorized access, use, modification, or combination of any Software Materials or from any User Data. + +To the extent that use of the Software is enjoined, Roo Code may at its option: (a) procure for User the right to use the Software; (b) replace the Software with a similar service; or (c) terminate this Agreement. Roo Code shall have no liability under this Section 12.2 or otherwise to the extent a claim or suit results from any negligence, willful misconduct, or breach of this Agreement by or on behalf of User or Entity or is covered by User's and Entity's indemnification obligations under Section 12.1. THIS SECTION 12.2 STATES ROO CODE'S ENTIRE LIABILITY AND USER'S AND ENTITY'S SOLE AND EXCLUSIVE REMEDY FOR ANY INFRINGEMENT CLAIMS RELATED TO ANY SOFTWARE MATERIALS OR RELATED SERVICES. + +### 12.3 Indemnification Procedure + +The indemnifying party will give prompt written notice of any indemnifiable claim hereunder. The indemnifying party may control the defense and settlement thereof, provided that it does so diligently and it does not enter into any settlement that imposes material non-monetary obligations on the indemnified party without the indemnified party's prior written consent, which consent shall not unreasonably be withheld. The indemnified party will reasonably cooperate in such defense and settlement at the indemnifying party's request and expense, and the indemnified party may participate at its own expense using its own counsel. + +## 13. Limitations of Liability + +### 13.1 Limitation on Direct Damages + +TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL ROO CODE'S, ITS AFFILIATES' AND ITS THIRD-PARTY LICENSORS' TOTAL AGGREGATE LIABILITY, IF ANY, ARISING OUT OF OR IN ANY WAY RELATED TO THIS AGREEMENT EXCEED THE GREATER OF $100 USD OR THE FEES PAID BY YOU TO ROO CODE UNDER THIS AGREEMENT DURING THE TWELVE MONTH PERIOD PRECEDING THE EVENT GIVING RISE TO THE LIABILITY, REGARDLESS OF THE NATURE OF THE CLAIM OR WHETHER SUCH DAMAGES WERE FORESEEABLE. + +### 13.2 Waiver of Consequential Damages + +TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL ROO CODE OR ANY OF ITS AFFILIATES OR THIRD-PARTY LICENSORS BE LIABLE UNDER OR IN CONNECTION WITH THIS AGREEMENT FOR ANY INDIRECT, INCIDENTAL, SPECIAL, PUNITIVE OR CONSEQUENTIAL DAMAGES, OR FOR ANY LOSS OR COMPROMISE OF DATA, LOSS OF AVAILABILITY OF DATA, GOODWILL, OPPORTUNITY, REVENUE OR PROFITS, REGARDLESS OF THE NATURE OF THE CLAIM OR WHETHER SUCH DAMAGES WERE FORESEEABLE. + +## 14. General + +### 14.1 Relationship + +The parties to this Agreement are independent, and no agency, partnership franchise, joint venture or employee-employer relationship is intended or created by this Agreement. Roo Code may identify User (e.g., name and logo) in marketing materials unless User provides Roo Code with written notice that User is opting out of such permission. + +### 14.2 Notices + +Except as otherwise set forth in this Agreement, all notices to a party shall be in writing and sent to, for Roo Code: [support@roocode.com](mailto:support@roocode.com), and for User the applicable address or email address associated with User's account (which addresses may be updated by such party from time to time by written notice). Notice shall be deemed to have been duly given when received, if personally delivered; when receipt is electronically confirmed, if transmitted by email; the day after it is sent, if sent for next day delivery by recognized overnight delivery service; and upon receipt, if sent by certified or registered mail, return receipt requested. Any notices to User may be sent by email to the email address associated with User's account or may be posted in the Software, and any such notices shall be effective when delivered in accordance with the foregoing. User hereby consents to receiving notices and communications from Roo Code electronically. + +### 14.3 Assignment + +This Agreement may not be assigned or transferred by User without Roo Code's prior written consent. Any assignment in derogation of the foregoing is null and void. Roo Code may (i) subcontract any of its obligations or responsibilities under this Agreement, or (ii) assign or transfer this Agreement to an affiliate or in connection with a merger, acquisition, reorganization, sale of all or substantially all of its equity or assets to which this Agreement relates, or other similar corporate transaction. This Agreement shall inure to the benefit of each party's successors and permitted assigns. + +### 14.4 Entire Agreement; Amendment + +This Agreement, including any other documents attached hereto or otherwise incorporated herein, constitutes the entire agreement between the parties and supersedes all prior or contemporaneous agreements and understandings regarding the subject matter hereof and Roo Code, User and Entity have not relied on any representation or statement not set out in this Agreement. To the maximum extent permitted under applicable law, from time to time, in Roo Code's sole discretion, Roo Code may amend the terms of this Agreement. Such changes will become effective upon the date specified by Roo Code. By continuing to receive, use or access any Software, User agrees to be bound by the amended terms of this Agreement. No other change of any of the provisions hereof shall be effective unless and until set forth in writing and duly signed by an officer of Roo Code and by User. + +### 14.5 No Third-Party Benefits + +A person who is not a party to this Agreement shall have no rights under the UK Contracts (Rights of Third Parties) Act 1999 or otherwise to enforce any term of this Agreement. + +### 14.6 Age Restrictions + +The Software is not intended for use by individuals under the age of thirteen (13). By accessing or using the Software, User represents that User is at least thirteen (13) years of age, and if under eighteen (18), that User has the consent of a parent or legal guardian. + +### 14.7 Governing Law; Venue + +This Agreement (including this provision) shall be governed by and construed in accordance with the laws of Delaware, without reference to conflict of law principles. Except as otherwise expressly set forth in this Agreement, with respect to any dispute or claim (including non-contractual disputes or claims) arising out of or in connection with this Agreement or its subject matter or formation, each party hereby irrevocably submits to the exclusive jurisdiction of the courts located in Delaware. Notwithstanding anything to the contrary in this Agreement, Roo Code may seek preliminary equitable relief in any court of competent jurisdiction in connection with any actual or threatened breach of Sections 4 or 10. + +### 14.8 No Waiver + +The failure to insist upon strict compliance with any of the provisions of this Agreement shall not be deemed a waiver of any such provision, nor shall any waiver or relinquishment of any right or power hereunder, at any one or more times, be deemed a waiver or relinquishment of such right or power at any other time or times. + +### 14.9 Severability; Interpretation + +Any provision of this Agreement held to be unenforceable shall be enforced to the maximum extent permitted by applicable law and shall not affect the enforceability of any other provisions of this Agreement. Any rule of construction or interpretation otherwise requiring this Agreement to be construed or interpreted against any party by virtue of the authorship of this Agreement shall not apply to the construction and interpretation of this Agreement. The word "including" shall not be limiting in this Agreement. The parties acknowledge that this Agreement and Roo Code's provision of its services are not subject to the EU Data Act. + +### 14.10 Force Majeure + +Roo Code shall not be in breach or liable for its delay or failure in performing any obligation under this Agreement to the extent resulting from any events or circumstances beyond Roo Code's reasonable control, including acts of God, delay or failure in performance by User, civil commotion, war, strikes, epidemics, Internet service interruptions or slowdowns, vandalism or "hacker" attacks, acts of terrorism, or governmental actions. + +--- + +## Schedule 1 - Data Processing Addendum + +This Data Processing Addendum ("**Addendum**") is supplemental to, and forms part of, the Agreement between Roo Code and the Entity. To the extent that there is any inconsistency between the Agreement and this Addendum, the latter shall prevail. This Addendum is only applicable to the extent that Roo Code's processing of the Data (as defined below) is subject to the GDPR. + +### 1. Definitions + +In this Addendum, the following terms shall have the following meanings: + +The words "**controller**", "**criminal convictions and offences data**", "**processor**", "**data subject**", "**personal data**", "**personal data breach**", "**processing**" (and "**process**"), and "**special category personal data**" shall have the meanings given to each in the GDPR. + +"**Security Incident**" means a confirmed personal data breach occurring with respect to the Data processed by Roo Code. + +### 2. Relationship of the Parties + +1. Entity is the controller of, and Roo Code is the processor of, the personal data to be processed for the purposes of the Agreement relating to any person resident in Europe (such data, the "**Data**"). +2. Each party shall comply with its obligations under the GDPR. +3. Entity shall be liable for Roo Code's fees and costs arising from clauses 9-12 below except to the extent these were incurred as a result of Roo Code's breach of this Addendum. + +### 3. Personal Data Types + +Entity: + +1. shall undertake reasonable efforts to ensure that Roo Code is not provided with, and does not otherwise process, any Data considered to be special category personal data, or criminal convictions and offences data under or in connection with this Agreement; and +2. acknowledges that Roo Code will perform its obligations assuming that such personal data does not form part of the Data. + +The following describes the subject matter, duration, nature and purpose of Roo Code's Data processing on behalf of Entity: + +- **Subject matter of processing:** For the purposes of the Agreement. +- **Duration of processing:** For the duration of the Agreement. +- **Nature of processing:** The personal data will be subject to basic processing activities of registration, storage and use for the purposes of the Agreement. +- **Personal data categories:** The personal data to be processed concerns the following categories of data: name and other contact and credential information (e.g. email address, work address, phone numbers, external access credentials, and social media handles). +- **Data subject types:** Personnel at the Entity + +### 4. Purpose Limitation + +Roo Code shall process the Data as a processor: + +1. to the extent necessary to perform its obligations under the Agreement; and +2. in accordance with the documented instructions of Entity, as set out in the Agreement, except where otherwise required by any European law (including any EEA member state law) applicable to Roo Code. + +### 5. International Data Transfers + +Entity acknowledges and agrees that Roo Code may in accordance with the GDPR transfer, and/or allow the transfer of, the Data outside of Europe to other jurisdictions (including to the United States) including jurisdictions which may be regarded by the European Commission and/or the UK as providing an inadequate level of data protection. + +### 6. Confidentiality of Processing + +Roo Code shall ensure that any person that it authorises to process the Data (including Roo Code's staff, agents and subcontractors) shall be subject to a requisite duty of confidentiality (whether a contractual, statutory, or otherwise). + +### 7. Security + +Roo Code shall implement and maintain appropriate technical and organisational measures to protect the Data in accordance with the GDPR. Such measures shall have regard to the state of the art, the costs of implementation and the nature, scope, context and purposes of processing as well as the risk of varying likelihood and severity for the rights and freedoms of natural persons. + +### 8. Subprocessing + +1. Entity hereby grants Roo Code general written authorisation to engage sub-processors to process the Data, including (a) Roo Code's affiliates; and (b) any other subprocessors engaged as of the date of this Addendum. +2. To the extent that Roo Code is required to do so under the GDPR, Roo Code shall notify Entity of any proposed engagement or replacement of sub-processors at least 10 days prior to its effective date (which notice may, at Roo Code's option, be provided on Roo Code's website or through any other effective mechanism). Entity may object in writing to such proposed appointment or replacement on demonstrated and valid data protection grounds no later than 7 days of Roo Code's notice; provided that if Roo Code does not agree with Entity's objections, Entity may upon prior written notice to Roo Code terminate the relevant part of the services in accordance with the Agreement. +3. To the extent that Roo Code is required to do so under the GDPR, Roo Code shall undertake reasonable efforts to agree data protection terms with any such subprocessor engaged following the date of this Agreement such that the Data is protected materially to the same extent as the protections afforded to the Data under this Addendum. + +### 9. Cooperation and Data Subjects' Rights + +To the extent required under the GDPR, Roo Code shall reasonably assist Entity: + +1. in responding to request from data subjects in Europe to exercise her/his rights under the GDPR (including rights of access, correction, objection, erasure and data portability, as applicable); and +2. Entity to comply with Entity's obligations under the GDPR relating to (a) personal data breach notifications, and (b) impact assessments and related prior consultations with supervisory authorities, in each case, to the extent relating to Roo Code's processing of the Data. + +If any such data subject request relating to the Data is submitted directly to Roo Code, Roo Code shall without undue delay inform Entity of the same. + +### 10. Security Incidents + +Upon becoming aware of a Security Incident, Roo Code shall inform Entity without undue delay. + +### 11. Deletion or Return of Data + +To the extent required under the GDPR, upon termination or expiry of the Agreement, Roo Code shall at Entity's request (which request must be exercised promptly) either: + +1. return to Entity, and/or +2. destroy or permanently erase, + +in each case, all Data in its possession or control; provided that Roo Code shall be excused from its obligations under (ii) above to the extent required or allowed by applicable law. + +### 12. Audit + +To the extent required under the GDPR, Roo Code shall permit Entity (or a third party auditor engaged by the Entity and which is subject to an appropriate confidentiality agreement with Roo Code) to audit Roo Code's compliance with this Addendum by making available to Entity reasonable information relating to Roo Code's processing of the Data, in each case, to the extent reasonably necessary for Entity to assess such compliance. Entity may not exercise such audit rights more than once in any twelve (12) calendar month period. diff --git a/src/integrations/claude-code/streaming-client.ts b/src/integrations/claude-code/streaming-client.ts index b864995f2cd..e185c0af662 100644 --- a/src/integrations/claude-code/streaming-client.ts +++ b/src/integrations/claude-code/streaming-client.ts @@ -161,11 +161,87 @@ export const CLAUDE_CODE_API_CONFIG = { "claude-code-20250219", "oauth-2025-04-20", "interleaved-thinking-2025-05-14", - "fine-grained-tool-streaming-2025-05-14", + // Note: fine-grained-tool-streaming removed for OAuth compatibility ], - userAgent: `Roo-Code/${Package.version}`, + // User-Agent must match Claude Code's signature for OAuth tokens to be accepted + // Format matches opencode-anthropic-auth: "claude-cli/VERSION (external, cli)" + userAgent: `claude-cli/${Package.version} (external, cli)`, } as const +/** + * Tool name prefix for OAuth compatibility. + * Anthropic rejects third-party tools when using Claude Code OAuth tokens, + * so we prefix tool names to bypass validation and strip them from responses. + */ +export const TOOL_NAME_PREFIX = "oc_" + +/** + * Prefix a tool name for outgoing API requests + */ +export function prefixToolName(name: string): string { + return `${TOOL_NAME_PREFIX}${name}` +} + +/** + * Strip the tool name prefix from incoming API responses + */ +export function stripToolNamePrefix(name: string): string { + if (name.startsWith(TOOL_NAME_PREFIX)) { + return name.slice(TOOL_NAME_PREFIX.length) + } + return name +} + +/** + * Prefix all tool names in a tools array for outgoing requests + */ +function prefixToolNames(tools: Anthropic.Messages.Tool[]): Anthropic.Messages.Tool[] { + return tools.map((tool) => ({ + ...tool, + name: prefixToolName(tool.name), + })) +} + +/** + * Prefix tool names in conversation history messages. + * This ensures consistency between tool definitions (which have oc_ prefix) + * and tool_use blocks in the conversation history. + * + * Without this, the API would see: + * - Tools defined as: oc_read_file, oc_write_file, etc. + * - History with tool_use: read_file, write_file (no prefix!) + * This mismatch causes issues with tool execution. + */ +function prefixToolNamesInMessages(messages: Anthropic.Messages.MessageParam[]): Anthropic.Messages.MessageParam[] { + return messages.map((message) => { + // Only process array content (not string content) + if (typeof message.content === "string") { + return message + } + + const processedContent = message.content.map((block) => { + // Prefix tool_use block names + if ((block as { type: string }).type === "tool_use") { + const toolUseBlock = block as { type: "tool_use"; id: string; name: string; input: unknown } + // Only prefix if not already prefixed + const prefixedName = toolUseBlock.name.startsWith(TOOL_NAME_PREFIX) + ? toolUseBlock.name + : prefixToolName(toolUseBlock.name) + return { + ...toolUseBlock, + name: prefixedName, + } + } + return block + }) + + return { + ...message, + content: processedContent, + } + }) +} + /** * SSE Event types from Anthropic streaming API */ @@ -380,11 +456,15 @@ export async function* createStreamingMessage(options: StreamMessageOptions): As // - We cache the last two user messages for optimal cache hit rates const messagesWithCache = addMessageCacheBreakpoints(sanitizedMessages) + // Prefix tool names in conversation history to match tool definitions + // This ensures tool_use blocks have oc_ prefix matching the tools array + const messagesWithPrefixedTools = prefixToolNamesInMessages(messagesWithCache) + // Build request body - match Claude Code format exactly const body: Record = { model, stream: true, - messages: messagesWithCache, + messages: messagesWithPrefixedTools, } // Only include max_tokens if explicitly provided @@ -412,7 +492,8 @@ export async function* createStreamingMessage(options: StreamMessageOptions): As } if (tools && tools.length > 0) { - body.tools = tools + // Prefix tool names to bypass OAuth tool validation + body.tools = prefixToolNames(tools) // Default tool_choice to "auto" when tools are provided (as per spec example) body.tool_choice = toolChoice || { type: "auto" } } else if (toolChoice) { @@ -545,22 +626,25 @@ export async function* createStreamingMessage(options: StreamMessageOptions): As yield { type: "reasoning", text: contentBlock.thinking as string } } break - case "tool_use": + case "tool_use": { + // Strip the oc_ prefix from tool names in the response + const toolName = stripToolNamePrefix(contentBlock.name as string) contentBlocks.set(index, { type: "tool_use", text: "", id: contentBlock.id as string, - name: contentBlock.name as string, + name: toolName, arguments: "", }) yield { type: "tool_call_partial", index, id: contentBlock.id as string, - name: contentBlock.name as string, + name: toolName, arguments: undefined, } break + } } } break From 6746b3e8d61747cc03ac9b8e83b780f144a94db6 Mon Sep 17 00:00:00 2001 From: fernando234234 Date: Fri, 9 Jan 2026 18:33:56 +0100 Subject: [PATCH 2/2] fix(claude-code): prevent reasoning text duplication The thinking_complete handler was re-emitting the full reasoning text after it had already been streamed via reasoning chunks. This caused the reasoning content to appear twice in the UI. Now the thinking_complete case only captures the signature for tool use continuations without re-emitting the text. --- src/api/providers/claude-code.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/api/providers/claude-code.ts b/src/api/providers/claude-code.ts index f2bccc329c7..b6c9e94904e 100644 --- a/src/api/providers/claude-code.ts +++ b/src/api/providers/claude-code.ts @@ -219,17 +219,12 @@ export class ClaudeCodeHandler implements ApiHandler, SingleCompletionHandler { case "thinking_complete": // Capture the signature for persistence in api_conversation_history // This enables tool use continuations where thinking blocks must be passed back + // NOTE: We do NOT emit the text here because it was already streamed via + // "reasoning" chunks. Re-emitting would duplicate the reasoning in the UI. + // The signature is retrieved via getThoughtSignature() after streaming completes. if (chunk.signature) { this.lastThinkingSignature = chunk.signature } - // Emit a complete thinking block with signature - // This is critical for interleaved thinking with tool use - // The signature must be included when passing thinking blocks back to the API - yield { - type: "reasoning", - text: chunk.thinking, - signature: chunk.signature, - } break case "tool_call_partial":