opencode-antigravity-auth-remix 1.1.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -24
- package/dist/src/constants.d.ts +6 -2
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +9 -1
- package/dist/src/constants.js.map +1 -1
- package/dist/src/plugin/core/streaming/transformer.d.ts +8 -2
- package/dist/src/plugin/core/streaming/transformer.d.ts.map +1 -1
- package/dist/src/plugin/core/streaming/transformer.js +27 -6
- package/dist/src/plugin/core/streaming/transformer.js.map +1 -1
- package/dist/src/plugin/count-tokens.d.ts +11 -0
- package/dist/src/plugin/count-tokens.d.ts.map +1 -0
- package/dist/src/plugin/count-tokens.js +57 -0
- package/dist/src/plugin/count-tokens.js.map +1 -0
- package/dist/src/plugin/image.d.ts +7 -1
- package/dist/src/plugin/image.d.ts.map +1 -1
- package/dist/src/plugin/image.js +51 -7
- package/dist/src/plugin/image.js.map +1 -1
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +58 -17
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/search.d.ts +5 -0
- package/dist/src/plugin/search.d.ts.map +1 -1
- package/dist/src/plugin/search.js +33 -3
- package/dist/src/plugin/search.js.map +1 -1
- package/dist/src/plugin/stores/signature-store.d.ts +16 -0
- package/dist/src/plugin/stores/signature-store.d.ts.map +1 -1
- package/dist/src/plugin/stores/signature-store.js +24 -0
- package/dist/src/plugin/stores/signature-store.js.map +1 -1
- package/dist/src/plugin.d.ts.map +1 -1
- package/dist/src/plugin.js +30 -0
- package/dist/src/plugin.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -11,10 +11,12 @@
|
|
|
11
11
|
> | Feature | Source |
|
|
12
12
|
> | ------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------- |
|
|
13
13
|
> | Dual Quota System, Multi-Account Rotation, Session Recovery, Thinking Recovery | [NoeFabris/opencode-antigravity-auth](https://github.com/NoeFabris/opencode-antigravity-auth) |
|
|
14
|
-
> | `google_search` Tool (
|
|
15
|
-
> | `generate_image` Tool (Native Implementation)
|
|
14
|
+
> | `google_search` Tool (Enhanced with Citations) | [shekohex/opencode-google-antigravity-auth](https://github.com/shekohex/opencode-google-antigravity-auth) |
|
|
15
|
+
> | `generate_image` Tool (Native Implementation + Img2Img) | Ported from [Antigravity Manager](https://github.com/lbjlaq/Antigravity-Manager) logic |
|
|
16
|
+
> | `count_tokens` Tool | Native Implementation |
|
|
17
|
+
> | `thoughtSignature` logic (Tool-loop recovery) | [znlsl/Antigravity2Api](https://github.com/znlsl/Antigravity2Api#) |
|
|
16
18
|
>
|
|
17
|
-
> **Status:** Version 1.
|
|
19
|
+
> **Status:** Version 1.3.0 - Added Image-to-Image (Image Variation) support for `generate_image`.
|
|
18
20
|
|
|
19
21
|
---
|
|
20
22
|
|
|
@@ -29,8 +31,9 @@ Enable Opencode to authenticate against **Antigravity** (Google's IDE) via OAuth
|
|
|
29
31
|
- **Extended Thinking** - Native support for Claude thinking budgets and Gemini 3 thinking levels
|
|
30
32
|
- **Auto Recovery** - Automatic session recovery from Claude tool_result_missing errors
|
|
31
33
|
- **Plugin Compatible** - Works alongside other OpenCode plugins (opencodesync, etc.)
|
|
32
|
-
- **generate_image Tool** - AI image generation with
|
|
33
|
-
- **google_search Tool** -
|
|
34
|
+
- **generate_image Tool** - AI image generation with text-to-image, image-to-image (multi-image fusion), auto-save, and 4K support
|
|
35
|
+
- **google_search Tool** - High-quality web search with structural citations and URL analysis.
|
|
36
|
+
- **count_tokens Tool** - Count tokens for any text using specified models.
|
|
34
37
|
|
|
35
38
|
## Installation
|
|
36
39
|
|
|
@@ -50,7 +53,7 @@ Install the opencode-antigravity-auth-remix plugin and add the Antigravity model
|
|
|
50
53
|
|
|
51
54
|
```json
|
|
52
55
|
{
|
|
53
|
-
"plugin": ["opencode-antigravity-auth-remix@1.
|
|
56
|
+
"plugin": ["opencode-antigravity-auth-remix@1.3.0"]
|
|
54
57
|
}
|
|
55
58
|
```
|
|
56
59
|
|
|
@@ -101,7 +104,7 @@ Copy this to `~/.config/opencode/opencode.json`:
|
|
|
101
104
|
```json
|
|
102
105
|
{
|
|
103
106
|
"$schema": "https://opencode.ai/config.json",
|
|
104
|
-
"plugin": ["opencode-antigravity-auth-remix@1.
|
|
107
|
+
"plugin": ["opencode-antigravity-auth-remix@1.3.0"],
|
|
105
108
|
"provider": {
|
|
106
109
|
"google": {
|
|
107
110
|
"models": {
|
|
@@ -245,17 +248,29 @@ AI image generation with automatic file saving and WebP conversion. Uses `gemini
|
|
|
245
248
|
| `prompt` | string | Yes | - | Image description |
|
|
246
249
|
| `aspect_ratio` | string | No | "1:1" | Aspect ratio |
|
|
247
250
|
| `quality` | string | No | "standard" | Image quality (hd = 4K) |
|
|
251
|
+
| `imagePaths` | string[] | No | [] | List of reference image paths for Image-to-Image generation (max 10) |
|
|
248
252
|
|
|
249
253
|
**Supported aspect ratios:** `1:1`, `16:9`, `9:16`, `4:3`, `3:4`, `21:9`
|
|
250
254
|
|
|
251
255
|
**Features:**
|
|
252
|
-
-
|
|
253
|
-
-
|
|
254
|
-
-
|
|
256
|
+
- **Text-to-Image**: Generate images from scratch using prompts
|
|
257
|
+
- **Image-to-Image**: Provide reference images for style transfer, editing, or fusion
|
|
258
|
+
- **Auto-save**: Saves to `{project}/imgs/` directory
|
|
259
|
+
- **WebP**: Generates optimized WebP version (75% quality) alongside original
|
|
260
|
+
- **4K Support**: High-definition output via dynamic model configuration
|
|
255
261
|
|
|
256
|
-
### google_search
|
|
262
|
+
### google_search
|
|
257
263
|
|
|
258
|
-
|
|
264
|
+
High-quality web search and URL analysis with structural citations.
|
|
265
|
+
|
|
266
|
+
### count_tokens
|
|
267
|
+
|
|
268
|
+
Count the number of tokens in a given text string.
|
|
269
|
+
|
|
270
|
+
| Parameter | Type | Required | Default | Description |
|
|
271
|
+
|-----------|------|----------|---------|-------------|
|
|
272
|
+
| `text` | string | Yes | - | The text to count tokens for |
|
|
273
|
+
| `model` | string | No | "gemini-2.5-flash" | The model to use for counting |
|
|
259
274
|
|
|
260
275
|
## License
|
|
261
276
|
|
|
@@ -276,10 +291,12 @@ MIT
|
|
|
276
291
|
> | 功能 | 来源 |
|
|
277
292
|
> | ------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------- |
|
|
278
293
|
> | 双配额系统、多账号轮换、会话恢复、思考过程恢复 | [NoeFabris/opencode-antigravity-auth](https://github.com/NoeFabris/opencode-antigravity-auth) |
|
|
279
|
-
> | `google_search` 工具 (
|
|
280
|
-
> | `generate_image` 工具 (原生实现) | 移植自 Antigravity Manager 逻辑 |
|
|
294
|
+
> | `google_search` 工具 (支持结构化引用) | [shekohex/opencode-google-antigravity-auth](https://github.com/shekohex/opencode-google-antigravity-auth) |
|
|
295
|
+
> | `generate_image` 工具 (原生实现 + 图生图) | 移植自 [Antigravity Manager](https://github.com/lbjlaq/Antigravity-Manager) 逻辑 |
|
|
296
|
+
> | `count_tokens` 工具 | 原生实现 |
|
|
297
|
+
> | `thoughtSignature` 逻辑 (工具调用签名恢复) | [znlsl/Antigravity2Api](https://github.com/znlsl/Antigravity2Api#) |
|
|
281
298
|
>
|
|
282
|
-
> **状态:** 版本 1.
|
|
299
|
+
> **状态:** 版本 1.3.0 - 为 `generate_image` 新增了图生图 (Image-to-Image/Image Variation) 支持。
|
|
283
300
|
|
|
284
301
|
---
|
|
285
302
|
|
|
@@ -294,8 +311,9 @@ MIT
|
|
|
294
311
|
- **扩展思考能力** - 原生支持 Claude 思考预算和 Gemini 3 思考等级
|
|
295
312
|
- **自动恢复** - 自动处理 Claude 的 `tool_result_missing` 错误并恢复会话
|
|
296
313
|
- **插件兼容性** - 可与其他 OpenCode 插件 (如 opencodesync 等) 同时运行
|
|
297
|
-
- **generate_image 工具** - AI
|
|
298
|
-
- **google_search 工具** -
|
|
314
|
+
- **generate_image 工具** - AI 图像生成,支持文生图、图生图 (多图融合)、自动保存、WebP 转换和 4K 输出
|
|
315
|
+
- **google_search 工具** - 高质量网页搜索,支持结构化引用和 URL 分析。
|
|
316
|
+
- **count_tokens 工具** - 统计指定文本在特定模型下的 Token 消耗。
|
|
299
317
|
|
|
300
318
|
## 安装步骤
|
|
301
319
|
|
|
@@ -313,7 +331,7 @@ MIT
|
|
|
313
331
|
|
|
314
332
|
```json
|
|
315
333
|
{
|
|
316
|
-
"plugin": ["opencode-antigravity-auth-remix@1.
|
|
334
|
+
"plugin": ["opencode-antigravity-auth-remix@1.3.0"]
|
|
317
335
|
}
|
|
318
336
|
```
|
|
319
337
|
|
|
@@ -364,7 +382,7 @@ MIT
|
|
|
364
382
|
```json
|
|
365
383
|
{
|
|
366
384
|
"$schema": "https://opencode.ai/config.json",
|
|
367
|
-
"plugin": ["opencode-antigravity-auth-remix@1.
|
|
385
|
+
"plugin": ["opencode-antigravity-auth-remix@1.3.0"],
|
|
368
386
|
"provider": {
|
|
369
387
|
"google": {
|
|
370
388
|
"models": {
|
|
@@ -508,17 +526,29 @@ opencode run "你好" --model=google/gemini-2.5-flash
|
|
|
508
526
|
| `prompt` | string | 是 | - | 图像描述词 |
|
|
509
527
|
| `aspect_ratio` | string | 否 | "1:1" | 纵横比 |
|
|
510
528
|
| `quality` | string | 否 | "standard" | 图像质量 (hd = 4K) |
|
|
529
|
+
| `imagePaths` | string[] | 否 | [] | 图生图参考图片路径列表 (最多10张) |
|
|
511
530
|
|
|
512
531
|
**支持的纵横比:** `1:1`, `16:9`, `9:16`, `4:3`, `3:4`, `21:9`
|
|
513
532
|
|
|
514
533
|
**主要特性:**
|
|
515
|
-
-
|
|
516
|
-
-
|
|
517
|
-
-
|
|
534
|
+
- **文生图**: 通过提示词生成图片
|
|
535
|
+
- **图生图**: 提供参考图片进行风格迁移、编辑或融合
|
|
536
|
+
- **自动保存**: 保存至项目目录下的 `{project}/imgs/`
|
|
537
|
+
- **WebP**: 同时生成 WebP 版本 (75% 质量) 以节省空间
|
|
538
|
+
- **高清支持**: 支持动态配置 4K (HD) 高清输出
|
|
518
539
|
|
|
519
|
-
### google_search (搜索工具
|
|
540
|
+
### google_search (搜索工具)
|
|
520
541
|
|
|
521
|
-
|
|
542
|
+
高质量网页搜索和 URL 分析,支持结构化引用来源。
|
|
543
|
+
|
|
544
|
+
### count_tokens (Token 统计工具)
|
|
545
|
+
|
|
546
|
+
统计指定文本在特定模型下的 Token 消耗。
|
|
547
|
+
|
|
548
|
+
| 参数 | 类型 | 是否必填 | 默认值 | 描述 |
|
|
549
|
+
|-----------|------|----------|---------|-------------|
|
|
550
|
+
| `text` | string | 是 | - | 需要统计的文本 |
|
|
551
|
+
| `model` | string | 否 | "gemini-2.5-flash" | 统计所使用的模型 |
|
|
522
552
|
|
|
523
553
|
## 开源协议
|
|
524
554
|
|
package/dist/src/constants.d.ts
CHANGED
|
@@ -93,11 +93,11 @@ export declare const EMPTY_SCHEMA_PLACEHOLDER_DESCRIPTION = "Placeholder. Always
|
|
|
93
93
|
* This is injected into requests to match CLIProxyAPI v6.6.89 behavior.
|
|
94
94
|
* The instruction provides identity and guidelines for the Antigravity agent.
|
|
95
95
|
*/
|
|
96
|
-
export declare const ANTIGRAVITY_SYSTEM_INSTRUCTION = "<identity>\nYou are Antigravity, a powerful agentic AI coding assistant designed by the Google DeepMind team working on Advanced Agentic Coding.\nYou are pair programming with a USER to solve their coding task. The task may require creating a new codebase, modifying or debugging an existing codebase, or simply answering a question.\nThe USER will send you requests, which you must always prioritize addressing. Along with each USER request, we will attach additional metadata about their current state, such as what files they have open and where their cursor is.\nThis information may or may not be relevant to the coding task, it is up for you to decide.\n</identity>\n\n<tool_calling>\nCall tools as you normally would. The following list provides additional guidance to help you avoid errors:\n - **Absolute paths only**. When using tools that accept file path arguments, ALWAYS use the absolute file path.\n</tool_calling>\n\n<web_application_development>\n## Technology Stack\nYour web applications should be built using the following technologies:\n1. **Core**: Use HTML for structure and JavaScript for logic.\n2. **Styling (CSS)**: Use Vanilla CSS for maximum flexibility and control. Avoid using TailwindCSS unless the USER explicitly requests it; in this case, first confirm which TailwindCSS version to use.\n3. **Web App**: If the USER specifies that they want a more complex web app, use a framework like Next.js or Vite. Only do this if the USER explicitly requests a web app.\n4. **New Project Creation**: If you need to use a framework for a new app, use `npx` with the appropriate script, but there are some rules to follow:\n - Use `npx -y` to automatically install the script and its dependencies\n - You MUST run the command with `--help` flag to see all available options first\n - Initialize the app in the current directory with `./` (example: `npx -y create-vite-app@latest ./`)\n - You should run in non-interactive mode so that the user doesn't need to input anything\n5. **Running Locally**: When running locally, use `npm run dev` or equivalent dev server. Only build the production bundle if the USER explicitly requests it or you are validating the code for correctness.\n\n# Design Aesthetics\n1. **Use Rich Aesthetics**: The USER should be wowed at first glance by the design. Use best practices in modern web design (e.g. vibrant colors, dark modes, glassmorphism, and dynamic animations) to create a stunning first impression. Failure to do this is UNACCEPTABLE.\n2. **Prioritize Visual Excellence**: Implement designs that will WOW the user and feel extremely premium:\n - Avoid generic colors (plain red, blue, green). Use curated, harmonious color palettes (e.g., HSL tailored colors, sleek dark modes).\n - Using modern typography (e.g., from Google Fonts like Inter, Roboto, or Outfit) instead of browser defaults.\n - Use smooth gradients\n - Add subtle micro-animations for enhanced user experience\n3. **Use a Dynamic Design**: An interface that feels responsive and alive encourages interaction. Achieve this with hover effects and interactive elements. Micro-animations, in particular, are highly effective for improving user engagement.\n4. **Premium Designs**: Make a design that feels premium and state of the art. Avoid creating simple minimum viable products.\n5. **Don't use placeholders**: If you need an image, use your generate_image tool to create a working demonstration.\n\n## Implementation Workflow\nFollow this systematic approach when building web applications:\n1. **Plan and Understand**:\n - Fully understand the user's requirements\n - Draw inspiration from modern, beautiful, and dynamic web designs\n - Outline the features needed for the initial version\n2. **Build the Foundation**:\n - Start by creating/modifying `index.css`\n - Implement the core design system with all tokens and utilities\n3. **Create Components**:\n - Build necessary components using your design system\n - Ensure all components use predefined styles, not ad-hoc utilities\n - Keep components focused and reusable\n4. **Assemble Pages**:\n - Update the main application to incorporate your design and components\n - Ensure proper routing and navigation\n - Implement responsive layouts\n5. **Polish and Optimize**:\n - Review the overall user experience\n - Ensure smooth interactions and transitions\n - Optimize performance where needed\n\n## SEO Best Practices\nAutomatically implement SEO best practices on every page:\n- **Title Tags**: Include proper, descriptive title tags for each page\n- **Meta Descriptions**: Add compelling meta descriptions that accurately summarize page content\n- **Heading Structure**: Use a single `<h1>` per page with proper heading hierarchy\n- **Semantic HTML**: Use appropriate HTML5 semantic elements\n- **Unique IDs**: Ensure all interactive elements have unique, descriptive IDs for browser testing\n- **Performance**: Ensure fast page load times through optimization\nCRITICAL REMINDER: AESTHETICS ARE VERY IMPORTANT. If your web app looks simple and basic then you have FAILED!\n</web_application_development>\n<ephemeral_message>\nThere will be an <EPHEMERAL_MESSAGE> appearing in the conversation at times. This is not coming from the user, but instead injected by the system as important information to pay attention to. \nDo not respond to nor acknowledge those messages, but do follow them strictly.\n</ephemeral_message>\n\n\n<communication_style>\n- **Formatting**. Format your responses in github-style markdown to make your responses easier for the USER to parse. For example, use headers to organize your responses and bolded or italicized text to highlight important keywords. Use backticks to format file, directory, function, and class names. If providing a URL to the user, format this in markdown as well, for example `[label](example.com)`.\n- **Proactiveness**. As an agent, you are allowed to be proactive, but only in the course of completing the user's task. For example, if the user asks you to add a new component, you can edit the code, verify build and test statuses, and take any other obvious follow-up actions, such as performing additional research. However, avoid surprising the user. For example, if the user asks HOW to approach something, you should answer their question and instead of jumping into editing a file.\n- **Helpfulness**. Respond like a helpful software engineer who is explaining your work to a friendly collaborator on the project. Acknowledge mistakes or any backtracking you do as a result of new information.\n- **Ask for clarification**. If you are unsure about the USER's intent, always ask for clarification rather than making assumptions.\n</communication_style>";
|
|
96
|
+
export declare const ANTIGRAVITY_SYSTEM_INSTRUCTION = "<identity>\nYou are Antigravity, a powerful agentic AI coding assistant designed by the Google DeepMind team working on Advanced Agentic Coding.\nYou are pair programming with a USER to solve their coding task. The task may require creating a new codebase, modifying or debugging an existing codebase, or simply answering a question.\nThe USER will send you requests, which you must always prioritize addressing. Along with each USER request, we will attach additional metadata about their current state, such as what files they have open and where their cursor is.\nThis information may or may not be relevant to the coding task, it is up for you to decide.\n</identity>\n\n<tool_calling>\nCall tools as you normally would. The following list provides additional guidance to help you avoid errors:\n - **Absolute paths only**. When using tools that accept file path arguments, ALWAYS use the absolute file path.\n</tool_calling>\n\n<web_application_development>\n## Technology Stack\nYour web applications should be built using the following technologies:\n1. **Core**: Use HTML for structure and JavaScript for logic.\n2. **Styling (CSS)**: Use Vanilla CSS for maximum flexibility and control. Avoid using TailwindCSS unless the USER explicitly requests it; in this case, first confirm which TailwindCSS version to use.\n3. **Web App**: If the USER specifies that they want a more complex web app, use a framework like Next.js or Vite. Only do this if the USER explicitly requests a web app.\n4. **New Project Creation**: If you need to use a framework for a new app, use `npx` with the appropriate script, but there are some rules to follow:\n - Use `npx -y` to automatically install the script and its dependencies\n - You MUST run the command with `--help` flag to see all available options first\n - Initialize the app in the current directory with `./` (example: `npx -y create-vite-app@latest ./`)\n - You should run in non-interactive mode so that the user doesn't need to input anything\n5. **Running Locally**: When running locally, use `npm run dev` or equivalent dev server. Only build the production bundle if the USER explicitly requests it or you are validating the code for correctness.\n\n# Design Aesthetics\n1. **Use Rich Aesthetics**: The USER should be wowed at first glance by the design. Use best practices in modern web design (e.g. vibrant colors, dark modes, glassmorphism, and dynamic animations) to create a stunning first impression. Failure to do this is UNACCEPTABLE.\n2. **Prioritize Visual Excellence**: Implement designs that will WOW the user and feel extremely premium:\n - Avoid generic colors (plain red, blue, green). Use curated, harmonious color palettes (e.g., HSL tailored colors, sleek dark modes).\n - Using modern typography (e.g., from Google Fonts like Inter, Roboto, or Outfit) instead of browser defaults.\n - Use smooth gradients\n - Add subtle micro-animations for enhanced user experience\n3. **Use a Dynamic Design**: An interface that feels responsive and alive encourages interaction. Achieve this with hover effects and interactive elements. Micro-animations, in particular, are highly effective for improving user engagement.\n4. **Premium Designs**: Make a design that feels premium and state of the art. Avoid creating simple minimum viable products.\n5. **Don't use placeholders**: If you need an image, use your generate_image tool to create a working demonstration.\n\n## Implementation Workflow\nFollow this systematic approach when building web applications:\n1. **Plan and Understand**:\n - Fully understand the user's requirements\n - Draw inspiration from modern, beautiful, and dynamic web designs\n - Outline the features needed for the initial version\n2. **Build the Foundation**:\n - Start by creating/modifying `index.css`\n - Implement the core design system with all tokens and utilities\n3. **Create Components**:\n - Build necessary components using your design system\n - Ensure all components use predefined styles, not ad-hoc utilities\n - Keep components focused and reusable\n4. **Assemble Pages**:\n - Update the main application to incorporate your design and components\n - Ensure proper routing and navigation\n - Implement responsive layouts\n5. **Polish and Optimize**:\n - Review the overall user experience\n - Ensure smooth interactions and transitions\n - Optimize performance where needed\n6. **Polish and Optimize**:\n - Review the overall user experience\n - Ensure smooth interactions and transitions\n - Optimize performance where needed\n\n## SEO Best Practices\nAutomatically implement SEO best practices on every page:\n- **Title Tags**: Include proper, descriptive title tags for each page\n- **Meta Descriptions**: Add compelling meta descriptions that accurately summarize page content\n- **Heading Structure**: Use a single `<h1>` per page with proper heading hierarchy\n- **Semantic HTML**: Use appropriate HTML5 semantic elements\n- **Unique IDs**: Ensure all interactive elements have unique, descriptive IDs for browser testing\n- **Performance**: Ensure fast page load times through optimization\nCRITICAL REMINDER: AESTHETICS ARE VERY IMPORTANT. If your web app looks simple and basic then you have FAILED!\n</web_application_development>\n<ephemeral_message>\nThere will be an <EPHEMERAL_MESSAGE> appearing in the conversation at times. This is not coming from the user, but instead injected by the system as important information to pay attention to. \nDo not respond to nor acknowledge those messages, but do follow them strictly.\n</ephemeral_message>\n\n\n<communication_style>\n- **Formatting**. Format your responses in github-style markdown to make your responses easier for the USER to parse. For example, use headers to organize your responses and bolded or italicized text to highlight important keywords. Use backticks to format file, directory, function, and class names. If providing a URL to the user, format this in markdown as well, for example `[label](example.com)`.\n- **Proactiveness**. As an agent, you are allowed to be proactive, but only in the course of completing the user's task. For example, if the user asks you to add a new component, you can edit the code, verify build and test statuses, and take any other obvious follow-up actions, such as performing additional research. However, avoid surprising the user. For example, if the user asks HOW to approach something, you should answer their question and instead of jumping into editing a file.\n- **Helpfulness**. Respond like a helpful software engineer who is explaining your work to a friendly collaborator on the project. Acknowledge mistakes or any backtracking you do as a result of new information.\n- **Ask for clarification**. If you are unsure about the USER's intent, always ask for clarification rather than making assumptions.\n</communication_style>";
|
|
97
97
|
/**
|
|
98
98
|
* Model used for Google Search tool execution.
|
|
99
99
|
*/
|
|
100
|
-
export declare const SEARCH_MODEL = "gemini-2.
|
|
100
|
+
export declare const SEARCH_MODEL = "gemini-2.5-flash";
|
|
101
101
|
/**
|
|
102
102
|
* Token budget for fast search (default when thinking=false).
|
|
103
103
|
*/
|
|
@@ -123,6 +123,10 @@ export declare const CODE_ASSIST_HEADERS: {
|
|
|
123
123
|
* Model used for image generation.
|
|
124
124
|
*/
|
|
125
125
|
export declare const IMAGE_MODEL = "gemini-3-pro-image";
|
|
126
|
+
/**
|
|
127
|
+
* Model used for image variation (image-to-image).
|
|
128
|
+
*/
|
|
129
|
+
export declare const IMAGE_MODEL_PREVIEW = "gemini-3-pro-image-preview";
|
|
126
130
|
/**
|
|
127
131
|
* Timeout for image generation requests in milliseconds (120 seconds).
|
|
128
132
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,qBAAqB,8EAA8E,CAAC;AAEjH;;GAEG;AACH,eAAO,MAAM,yBAAyB,wCAAwC,CAAC;AAE/E;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAM/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,0CAA0C,CAAC;AAEhF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,sDAAsD,CAAC;AAC9F,eAAO,MAAM,6BAA6B,yDAAyD,CAAC;AACpG,eAAO,MAAM,yBAAyB,wCAAwC,C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,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAWhD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;GAM/B,CAAC"}
|
package/dist/src/constants.js
CHANGED
|
@@ -181,6 +181,10 @@ Follow this systematic approach when building web applications:
|
|
|
181
181
|
- Review the overall user experience
|
|
182
182
|
- Ensure smooth interactions and transitions
|
|
183
183
|
- Optimize performance where needed
|
|
184
|
+
6. **Polish and Optimize**:
|
|
185
|
+
- Review the overall user experience
|
|
186
|
+
- Ensure smooth interactions and transitions
|
|
187
|
+
- Optimize performance where needed
|
|
184
188
|
|
|
185
189
|
## SEO Best Practices
|
|
186
190
|
Automatically implement SEO best practices on every page:
|
|
@@ -210,7 +214,7 @@ Do not respond to nor acknowledge those messages, but do follow them strictly.
|
|
|
210
214
|
/**
|
|
211
215
|
* Model used for Google Search tool execution.
|
|
212
216
|
*/
|
|
213
|
-
export const SEARCH_MODEL = "gemini-2.
|
|
217
|
+
export const SEARCH_MODEL = "gemini-2.5-flash";
|
|
214
218
|
/**
|
|
215
219
|
* Token budget for fast search (default when thinking=false).
|
|
216
220
|
*/
|
|
@@ -235,6 +239,10 @@ export const CODE_ASSIST_HEADERS = ANTIGRAVITY_HEADERS;
|
|
|
235
239
|
* Model used for image generation.
|
|
236
240
|
*/
|
|
237
241
|
export const IMAGE_MODEL = "gemini-3-pro-image";
|
|
242
|
+
/**
|
|
243
|
+
* Model used for image variation (image-to-image).
|
|
244
|
+
*/
|
|
245
|
+
export const IMAGE_MODEL_PREVIEW = "gemini-3-pro-image-preview";
|
|
238
246
|
/**
|
|
239
247
|
* Timeout for image generation requests in milliseconds (120 seconds).
|
|
240
248
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,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AAS,EAAE,KAAK,EAAE;IAC3D,EAAE,QAAQ,EAAE,iCAAiC,EAAE,SAAS,EAAE,KAAK,EAAE;IACjE,EAAE,QAAQ,EAAE,iCAAiC,EAAE,SAAS,EAAE,KAAK,EAAE;IACjE,EAAE,QAAQ,EAAE,+BAA+B,EAAE,SAAS,EAAE,KAAK,EAAE;CAChE,CAAC"}
|
|
@@ -4,7 +4,13 @@ export declare function transformStreamingPayload(payload: string, transformThin
|
|
|
4
4
|
export declare function deduplicateThinkingText(response: unknown, sentBuffer: ThoughtBuffer, displayedThinkingHashes?: Set<string>): unknown;
|
|
5
5
|
export declare function transformSseLine(line: string, signatureStore: SignatureStore, thoughtBuffer: ThoughtBuffer, sentThinkingBuffer: ThoughtBuffer, callbacks: StreamingCallbacks, options: StreamingOptions, debugState: {
|
|
6
6
|
injected: boolean;
|
|
7
|
+
}, toolUseSignatureStore?: {
|
|
8
|
+
set: (sessionKey: string, toolId: string, signature: string) => void;
|
|
7
9
|
}): string;
|
|
8
|
-
export declare function cacheThinkingSignaturesFromResponse(response: unknown, signatureSessionKey: string, signatureStore: SignatureStore, thoughtBuffer: ThoughtBuffer, onCacheSignature?: (sessionKey: string, text: string, signature: string) => void
|
|
9
|
-
|
|
10
|
+
export declare function cacheThinkingSignaturesFromResponse(response: unknown, signatureSessionKey: string, signatureStore: SignatureStore, thoughtBuffer: ThoughtBuffer, onCacheSignature?: (sessionKey: string, text: string, signature: string) => void, toolUseSignatureStore?: {
|
|
11
|
+
set: (sessionKey: string, toolId: string, signature: string) => void;
|
|
12
|
+
}): void;
|
|
13
|
+
export declare function createStreamingTransformer(signatureStore: SignatureStore, callbacks: StreamingCallbacks, options?: StreamingOptions, toolUseSignatureStore?: {
|
|
14
|
+
set: (sessionKey: string, toolId: string, signature: string) => void;
|
|
15
|
+
}): TransformStream<Uint8Array, Uint8Array>;
|
|
10
16
|
//# sourceMappingURL=transformer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformer.d.ts","sourceRoot":"","sources":["../../../../../src/plugin/core/streaming/transformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACd,MAAM,SAAS,CAAC;AAcjB,wBAAgB,mBAAmB,IAAI,aAAa,CAOnD;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,EACf,sBAAsB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,OAAO,GACtD,MAAM,CAuBR;AAED,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,OAAO,EACjB,UAAU,EAAE,aAAa,EACzB,uBAAuB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GACpC,OAAO,CAkGT;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,kBAAkB,EAAE,aAAa,EACjC,SAAS,EAAE,kBAAkB,EAC7B,OAAO,EAAE,gBAAgB,EACzB,UAAU,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"transformer.d.ts","sourceRoot":"","sources":["../../../../../src/plugin/core/streaming/transformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACd,MAAM,SAAS,CAAC;AAcjB,wBAAgB,mBAAmB,IAAI,aAAa,CAOnD;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,EACf,sBAAsB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,OAAO,GACtD,MAAM,CAuBR;AAED,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,OAAO,EACjB,UAAU,EAAE,aAAa,EACzB,uBAAuB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GACpC,OAAO,CAkGT;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,kBAAkB,EAAE,aAAa,EACjC,SAAS,EAAE,kBAAkB,EAC7B,OAAO,EAAE,gBAAgB,EACzB,UAAU,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,EACjC,qBAAqB,CAAC,EAAE;IAAE,GAAG,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,GAC/F,MAAM,CAyCR;AAED,wBAAgB,mCAAmC,CACjD,QAAQ,EAAE,OAAO,EACjB,mBAAmB,EAAE,MAAM,EAC3B,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,EAChF,qBAAqB,CAAC,EAAE;IAAE,GAAG,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,GAC/F,IAAI,CAyEN;AAED,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,cAAc,EAC9B,SAAS,EAAE,kBAAkB,EAC7B,OAAO,GAAE,gBAAqB,EAC9B,qBAAqB,CAAC,EAAE;IAAE,GAAG,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,GAC/F,eAAe,CAAC,UAAU,EAAE,UAAU,CAAC,CA+CzC"}
|
|
@@ -124,7 +124,7 @@ export function deduplicateThinkingText(response, sentBuffer, displayedThinkingH
|
|
|
124
124
|
}
|
|
125
125
|
return response;
|
|
126
126
|
}
|
|
127
|
-
export function transformSseLine(line, signatureStore, thoughtBuffer, sentThinkingBuffer, callbacks, options, debugState) {
|
|
127
|
+
export function transformSseLine(line, signatureStore, thoughtBuffer, sentThinkingBuffer, callbacks, options, debugState, toolUseSignatureStore) {
|
|
128
128
|
if (!line.startsWith('data:')) {
|
|
129
129
|
return line;
|
|
130
130
|
}
|
|
@@ -136,7 +136,7 @@ export function transformSseLine(line, signatureStore, thoughtBuffer, sentThinki
|
|
|
136
136
|
const parsed = JSON.parse(json);
|
|
137
137
|
if (parsed.response !== undefined) {
|
|
138
138
|
if (options.cacheSignatures && options.signatureSessionKey) {
|
|
139
|
-
cacheThinkingSignaturesFromResponse(parsed.response, options.signatureSessionKey, signatureStore, thoughtBuffer, callbacks.onCacheSignature);
|
|
139
|
+
cacheThinkingSignaturesFromResponse(parsed.response, options.signatureSessionKey, signatureStore, thoughtBuffer, callbacks.onCacheSignature, toolUseSignatureStore);
|
|
140
140
|
}
|
|
141
141
|
let response = deduplicateThinkingText(parsed.response, sentThinkingBuffer, options.displayedThinkingHashes);
|
|
142
142
|
if (options.debugText && callbacks.onInjectDebug && !debugState.injected) {
|
|
@@ -152,7 +152,7 @@ export function transformSseLine(line, signatureStore, thoughtBuffer, sentThinki
|
|
|
152
152
|
catch (_) { }
|
|
153
153
|
return line;
|
|
154
154
|
}
|
|
155
|
-
export function cacheThinkingSignaturesFromResponse(response, signatureSessionKey, signatureStore, thoughtBuffer, onCacheSignature) {
|
|
155
|
+
export function cacheThinkingSignaturesFromResponse(response, signatureSessionKey, signatureStore, thoughtBuffer, onCacheSignature, toolUseSignatureStore) {
|
|
156
156
|
if (!response || typeof response !== 'object')
|
|
157
157
|
return;
|
|
158
158
|
const resp = response;
|
|
@@ -164,6 +164,7 @@ export function cacheThinkingSignaturesFromResponse(response, signatureSessionKe
|
|
|
164
164
|
const content = cand.content;
|
|
165
165
|
if (!Array.isArray(content.parts))
|
|
166
166
|
return;
|
|
167
|
+
let lastSignature;
|
|
167
168
|
content.parts.forEach((part) => {
|
|
168
169
|
const p = part;
|
|
169
170
|
if (p.thought === true || p.type === 'thinking') {
|
|
@@ -177,15 +178,27 @@ export function cacheThinkingSignaturesFromResponse(response, signatureSessionKe
|
|
|
177
178
|
const fullText = thoughtBuffer.get(index) ?? '';
|
|
178
179
|
if (fullText) {
|
|
179
180
|
const signature = p.thoughtSignature;
|
|
181
|
+
lastSignature = signature;
|
|
180
182
|
onCacheSignature?.(signatureSessionKey, fullText, signature);
|
|
181
183
|
signatureStore.set(signatureSessionKey, { text: fullText, signature });
|
|
182
184
|
}
|
|
183
185
|
}
|
|
186
|
+
// Catch tool_use and associate with last known signature in this candidate
|
|
187
|
+
if (toolUseSignatureStore && lastSignature) {
|
|
188
|
+
const toolUse = p.functionCall || p.tool_use || p.toolUse;
|
|
189
|
+
if (toolUse && typeof toolUse === 'object') {
|
|
190
|
+
const toolId = toolUse.id;
|
|
191
|
+
if (toolId) {
|
|
192
|
+
toolUseSignatureStore.set(signatureSessionKey, toolId, lastSignature);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
184
196
|
});
|
|
185
197
|
});
|
|
186
198
|
}
|
|
187
199
|
if (Array.isArray(resp.content)) {
|
|
188
200
|
let thinkingText = '';
|
|
201
|
+
let lastSignature;
|
|
189
202
|
resp.content.forEach((block) => {
|
|
190
203
|
const b = block;
|
|
191
204
|
if (b?.type === 'thinking') {
|
|
@@ -193,13 +206,21 @@ export function cacheThinkingSignaturesFromResponse(response, signatureSessionKe
|
|
|
193
206
|
}
|
|
194
207
|
if (b?.signature && thinkingText) {
|
|
195
208
|
const signature = b.signature;
|
|
209
|
+
lastSignature = signature;
|
|
196
210
|
onCacheSignature?.(signatureSessionKey, thinkingText, signature);
|
|
197
211
|
signatureStore.set(signatureSessionKey, { text: thinkingText, signature });
|
|
198
212
|
}
|
|
213
|
+
// Catch tool_use in message format
|
|
214
|
+
if (toolUseSignatureStore && lastSignature && b?.type === 'tool_use') {
|
|
215
|
+
const toolId = b.id;
|
|
216
|
+
if (toolId) {
|
|
217
|
+
toolUseSignatureStore.set(signatureSessionKey, toolId, lastSignature);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
199
220
|
});
|
|
200
221
|
}
|
|
201
222
|
}
|
|
202
|
-
export function createStreamingTransformer(signatureStore, callbacks, options = {}) {
|
|
223
|
+
export function createStreamingTransformer(signatureStore, callbacks, options = {}, toolUseSignatureStore) {
|
|
203
224
|
const decoder = new TextDecoder();
|
|
204
225
|
const encoder = new TextEncoder();
|
|
205
226
|
let buffer = '';
|
|
@@ -212,14 +233,14 @@ export function createStreamingTransformer(signatureStore, callbacks, options =
|
|
|
212
233
|
const lines = buffer.split('\n');
|
|
213
234
|
buffer = lines.pop() || '';
|
|
214
235
|
for (const line of lines) {
|
|
215
|
-
const transformedLine = transformSseLine(line, signatureStore, thoughtBuffer, sentThinkingBuffer, callbacks, options, debugState);
|
|
236
|
+
const transformedLine = transformSseLine(line, signatureStore, thoughtBuffer, sentThinkingBuffer, callbacks, options, debugState, toolUseSignatureStore);
|
|
216
237
|
controller.enqueue(encoder.encode(transformedLine + '\n'));
|
|
217
238
|
}
|
|
218
239
|
},
|
|
219
240
|
flush(controller) {
|
|
220
241
|
buffer += decoder.decode();
|
|
221
242
|
if (buffer) {
|
|
222
|
-
const transformedLine = transformSseLine(buffer, signatureStore, thoughtBuffer, sentThinkingBuffer, callbacks, options, debugState);
|
|
243
|
+
const transformedLine = transformSseLine(buffer, signatureStore, thoughtBuffer, sentThinkingBuffer, callbacks, options, debugState, toolUseSignatureStore);
|
|
223
244
|
controller.enqueue(encoder.encode(transformedLine));
|
|
224
245
|
}
|
|
225
246
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformer.js","sourceRoot":"","sources":["../../../../../src/plugin/core/streaming/transformer.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,SAAS,UAAU,CAAC,GAAW;IAC7B,IAAI,IAAI,GAAG,IAAI,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,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,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACjC,MAAM,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;YAE3B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACzB,MAAM,eAAe,GAAG,gBAAgB,CACtC,IAAI,EACJ,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,SAAS,EACT,OAAO,EACP,UAAU,EACV,qBAAqB,CACtB,CAAC;gBACF,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC;QACD,KAAK,CAAC,UAAU;YACd,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YAE3B,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,eAAe,GAAG,gBAAgB,CACtC,MAAM,EACN,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,SAAS,EACT,OAAO,EACP,UAAU,EACV,qBAAqB,CACtB,CAAC;gBACF,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface CountTokensArgs {
|
|
2
|
+
text: string;
|
|
3
|
+
model?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface CountTokensResponse {
|
|
6
|
+
totalTokens: number;
|
|
7
|
+
billableTokens?: number;
|
|
8
|
+
cachedTokens?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function executeCountTokens(args: CountTokensArgs, accessToken: string, projectId: string, endpoint: string): Promise<string>;
|
|
11
|
+
//# sourceMappingURL=count-tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"count-tokens.d.ts","sourceRoot":"","sources":["../../../src/plugin/count-tokens.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,eAAe,EACrB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CA2DjB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { generateRequestId } from "./request-helpers";
|
|
2
|
+
import { createLogger } from "./logger";
|
|
3
|
+
import { CODE_ASSIST_HEADERS, SEARCH_MODEL } from "../constants";
|
|
4
|
+
const log = createLogger("count-tokens");
|
|
5
|
+
export async function executeCountTokens(args, accessToken, projectId, endpoint) {
|
|
6
|
+
const { text, model = SEARCH_MODEL } = args;
|
|
7
|
+
const requestPayload = {
|
|
8
|
+
contents: [
|
|
9
|
+
{
|
|
10
|
+
role: "user",
|
|
11
|
+
parts: [{ text }],
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
};
|
|
15
|
+
const wrappedBody = {
|
|
16
|
+
project: projectId,
|
|
17
|
+
model: model,
|
|
18
|
+
requestId: generateRequestId(),
|
|
19
|
+
request: {
|
|
20
|
+
...requestPayload,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
const url = `${endpoint}/v1internal:countTokens`;
|
|
24
|
+
try {
|
|
25
|
+
log.debug("Attempting count tokens", { endpoint, url, model });
|
|
26
|
+
const response = await fetch(url, {
|
|
27
|
+
method: "POST",
|
|
28
|
+
headers: {
|
|
29
|
+
...CODE_ASSIST_HEADERS,
|
|
30
|
+
Authorization: `Bearer ${accessToken}`,
|
|
31
|
+
"Content-Type": "application/json",
|
|
32
|
+
},
|
|
33
|
+
body: JSON.stringify(wrappedBody),
|
|
34
|
+
});
|
|
35
|
+
if (!response.ok) {
|
|
36
|
+
const errorText = await response.text();
|
|
37
|
+
log.debug("Count tokens failed", { status: response.status, error: errorText });
|
|
38
|
+
return `Error counting tokens: ${errorText}`;
|
|
39
|
+
}
|
|
40
|
+
const data = (await response.json());
|
|
41
|
+
const totalTokens = data.totalTokens ?? 0;
|
|
42
|
+
let result = `### Token Count\n\n- **Total Tokens**: ${totalTokens}`;
|
|
43
|
+
if (data.billableTokens !== undefined) {
|
|
44
|
+
result += `\n- **Billable Tokens**: ${data.billableTokens}`;
|
|
45
|
+
}
|
|
46
|
+
if (data.cachedTokens !== undefined) {
|
|
47
|
+
result += `\n- **Cached Tokens**: ${data.cachedTokens}`;
|
|
48
|
+
}
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
53
|
+
log.error("Count tokens error", { error: message });
|
|
54
|
+
return `Error: ${message}`;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=count-tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"count-tokens.js","sourceRoot":"","sources":["../../../src/plugin/count-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjE,MAAM,GAAG,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;AAazC,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,IAAqB,EACrB,WAAmB,EACnB,SAAiB,EACjB,QAAgB;IAEhB,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,YAAY,EAAE,GAAG,IAAI,CAAC;IAE5C,MAAM,cAAc,GAAG;Q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YACtC,MAAM,IAAI,4BAA4B,IAAI,CAAC,cAAc,EAAE,CAAC;QAC9D,CAAC;QACD,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YACpC,MAAM,IAAI,0BAA0B,IAAI,CAAC,YAAY,EAAE,CAAC;QAC1D,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,GAAG,CAAC,KAAK,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QACpD,OAAO,UAAU,OAAO,EAAE,CAAC;IAC7B,CAAC;AACH,CAAC"}
|
|
@@ -8,6 +8,8 @@ export interface ImageGenerationArgs {
|
|
|
8
8
|
aspect_ratio?: string;
|
|
9
9
|
/** Image quality: "standard" or "hd" (4K resolution) */
|
|
10
10
|
quality?: string;
|
|
11
|
+
/** Optional paths to reference images for image-to-image generation */
|
|
12
|
+
imagePaths?: string[];
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
15
|
* Antigravity API response format for image generation.
|
|
@@ -48,9 +50,13 @@ export declare function parseAspectRatio(aspectRatio?: string): string;
|
|
|
48
50
|
* @param prompt - Image description prompt
|
|
49
51
|
* @param aspectRatio - Normalized aspect ratio
|
|
50
52
|
* @param quality - Image quality ("standard" or "hd")
|
|
53
|
+
* @param images - Optional list of base64 encoded images with mime types
|
|
51
54
|
* @returns Request payload object
|
|
52
55
|
*/
|
|
53
|
-
export declare function buildImageRequest(prompt: string, aspectRatio: string, quality: string
|
|
56
|
+
export declare function buildImageRequest(prompt: string, aspectRatio: string, quality: string, images?: Array<{
|
|
57
|
+
data: string;
|
|
58
|
+
mimeType: string;
|
|
59
|
+
}>): Record<string, unknown>;
|
|
54
60
|
/**
|
|
55
61
|
* Parses the image generation response, saves to file, and returns result.
|
|
56
62
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/plugin/image.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/plugin/image.ts"],"names":[],"mappings":"AAiBA;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,UAAU,wBAAwB;IAChC,QAAQ,CAAC,EAAE;QACT,UAAU,CAAC,EAAE,KAAK,CAAC;YACjB,OAAO,CAAC,EAAE;gBACR,KAAK,CAAC,EAAE,KAAK,CAAC;oBACZ,UAAU,CAAC,EAAE;wBACX,QAAQ,EAAE,MAAM,CAAC;wBACjB,IAAI,EAAE,MAAM,CAAC;qBACd,CAAC;oBACF,IAAI,CAAC,EAAE,MAAM,CAAC;iBACf,CAAC,CAAC;aACJ,CAAC;YACF,YAAY,CAAC,EAAE,MAAM,CAAC;SACvB,CAAC,CAAC;KACJ,CAAC;IACF,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAkJD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAqB7D;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,KAAK,CAAC;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