@herbertgao/pi-extensions 2026.9.18 → 2026.9.20
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 +20 -28
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +76 -59
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +76 -59
- package/node_modules/@herbertgao/pi-cc-extensions/assets/readme/preview.webp +0 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +93 -34
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +346 -117
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/core.ts +6 -36
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/index.ts +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/compact-thinking.ts +24 -29
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/context.ts +330 -360
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/reference/index.ts +56 -108
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/reference/session.ts +97 -15
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/reference/subagent.ts +80 -45
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/flush-docked-bash.ts +36 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer-layout.ts +229 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer.ts +479 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/startup-header.ts +92 -61
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/working-message.ts +75 -40
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/index.ts +19 -3
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +1080 -229
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +232 -259
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +42 -41
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/markdown-enhance.ts +8 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/hover.ts +2 -7
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +277 -113
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/layout.ts +15 -6
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/packets.ts +18 -72
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/scroll.ts +61 -26
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/ansi-utils.ts +25 -57
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-component.ts +125 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-edit-render.ts +227 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-header.ts +136 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-highlight.ts +115 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-inline.ts +324 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-layout.ts +762 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-limits.ts +152 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-palette.ts +410 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-parse.ts +535 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-presentation.ts +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-renderer.ts +21 -3219
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-text.ts +44 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-write-render.ts +568 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/index.ts +47 -10
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/line-width-safety.ts +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/write-execution.ts +1 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +145 -190
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/mcp-title.ts +39 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{message-display.ts → tool/message-display.ts} +24 -90
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/names.ts +426 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/result.ts +90 -132
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{show-more-hint.ts → tool/show-more-hint.ts} +10 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/transcript-refresh.ts +8 -26
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/ansi-color.ts +44 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/ansi-text.ts +76 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/component-tree.ts +34 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/format.ts +28 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/fullscreen-detect.ts +51 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/patch-keys.ts +124 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/sgr-mouse.ts +70 -0
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +8 -8
- package/node_modules/pi-antigravity/README.md +29 -6
- package/node_modules/pi-antigravity/package.json +12 -7
- package/node_modules/pi-antigravity/src/auth/accounts.ts +327 -0
- package/node_modules/pi-antigravity/src/auth/index.ts +9 -0
- package/node_modules/pi-antigravity/src/client/client.ts +1 -1
- package/node_modules/pi-antigravity/src/image/image.ts +4 -4
- package/node_modules/pi-antigravity/src/index.ts +203 -13
- package/node_modules/pi-antigravity/src/search/index.ts +1 -0
- package/node_modules/pi-antigravity/src/search/search.ts +325 -0
- package/node_modules/pi-antigravity/src/stream/stream.ts +191 -14
- package/node_modules/pi-antigravity/src/types/enums.ts +45 -36
- package/node_modules/pi-antigravity/src/types/types.ts +5 -12
- package/node_modules/pi-antigravity/src/utils/http.ts +7 -2
- package/node_modules/pi-antigravity/src/utils/util.ts +31 -3
- package/node_modules/pi-typesafe/README.md +2 -0
- package/node_modules/pi-typesafe/package.json +2 -1
- package/node_modules/pi-web-access/CHANGELOG.md +72 -0
- package/node_modules/pi-web-access/README.md +34 -13
- package/node_modules/pi-web-access/chrome-cookies.ts +79 -25
- package/node_modules/pi-web-access/curator-page.ts +5 -1
- package/node_modules/pi-web-access/curator-server.ts +2 -0
- package/node_modules/pi-web-access/dist/index.js +1337 -1009
- package/node_modules/pi-web-access/exa.ts +20 -52
- package/node_modules/pi-web-access/extract.ts +41 -4
- package/node_modules/pi-web-access/gemini-search.ts +12 -4
- package/node_modules/pi-web-access/index.ts +29 -37
- package/node_modules/pi-web-access/openai-search.ts +35 -7
- package/node_modules/pi-web-access/package.json +6 -5
- package/node_modules/pi-web-access/page-query.ts +2 -2
- package/node_modules/pi-web-access/query-rewrite.ts +2 -3
- package/node_modules/pi-web-access/ssrf-protection.ts +27 -10
- package/node_modules/pi-web-access/storage.ts +48 -77
- package/node_modules/pi-web-access/summary-model-scope.ts +6 -77
- package/node_modules/pi-web-access/summary-review.ts +3 -4
- package/node_modules/pi-web-access/tavily.ts +67 -20
- package/node_modules/pi-web-access/tool-activation.ts +53 -33
- package/node_modules/pi-web-access/utils.ts +1 -1
- package/node_modules/pi-web-access/you.ts +164 -0
- package/node_modules/pi-web-access/zai.ts +161 -0
- package/package.json +7 -11
- package/node_modules/@herbertgao/pi-cc-extensions/assets/readme/hero.en.svg +0 -101
- package/node_modules/@herbertgao/pi-cc-extensions/assets/readme/hero.svg +0 -101
- package/node_modules/@herbertgao/pi-cc-extensions/assets/readme/welcome.webp +0 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/render-utils.ts +0 -5
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/types.ts +0 -30
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/write-display-utils.ts +0 -12
- package/node_modules/pi-footer/CHANGELOG.md +0 -145
- package/node_modules/pi-footer/LICENSE +0 -21
- package/node_modules/pi-footer/README.md +0 -354
- package/node_modules/pi-footer/package.json +0 -68
- package/node_modules/pi-footer/src/cache.ts +0 -106
- package/node_modules/pi-footer/src/colors.ts +0 -237
- package/node_modules/pi-footer/src/config.ts +0 -202
- package/node_modules/pi-footer/src/event-widgets.ts +0 -41
- package/node_modules/pi-footer/src/extension-statuses.ts +0 -102
- package/node_modules/pi-footer/src/git.ts +0 -135
- package/node_modules/pi-footer/src/index.ts +0 -268
- package/node_modules/pi-footer/src/metrics.ts +0 -141
- package/node_modules/pi-footer/src/presets.ts +0 -383
- package/node_modules/pi-footer/src/render.ts +0 -114
- package/node_modules/pi-footer/src/separators.ts +0 -52
- package/node_modules/pi-footer/src/types.ts +0 -122
- package/node_modules/pi-footer/src/ui/color-level-confirm.ts +0 -22
- package/node_modules/pi-footer/src/ui/color-options.ts +0 -195
- package/node_modules/pi-footer/src/ui/config-lifecycle.ts +0 -61
- package/node_modules/pi-footer/src/ui/edit-colors.ts +0 -13
- package/node_modules/pi-footer/src/ui/events.ts +0 -35
- package/node_modules/pi-footer/src/ui/extension-status-picker.ts +0 -60
- package/node_modules/pi-footer/src/ui/extension-statuses.ts +0 -73
- package/node_modules/pi-footer/src/ui/fields.ts +0 -252
- package/node_modules/pi-footer/src/ui/global-menu.ts +0 -126
- package/node_modules/pi-footer/src/ui/helpers.ts +0 -44
- package/node_modules/pi-footer/src/ui/layout.ts +0 -17
- package/node_modules/pi-footer/src/ui/line-list.ts +0 -19
- package/node_modules/pi-footer/src/ui/model.ts +0 -64
- package/node_modules/pi-footer/src/ui/navigation.ts +0 -29
- package/node_modules/pi-footer/src/ui/option-edit.ts +0 -93
- package/node_modules/pi-footer/src/ui/overlay-render.ts +0 -103
- package/node_modules/pi-footer/src/ui/screen-context.ts +0 -18
- package/node_modules/pi-footer/src/ui/screen-controller.ts +0 -27
- package/node_modules/pi-footer/src/ui/screen-render.ts +0 -32
- package/node_modules/pi-footer/src/ui/screen-state.ts +0 -20
- package/node_modules/pi-footer/src/ui/screen.ts +0 -243
- package/node_modules/pi-footer/src/ui/screens/add-widget.ts +0 -92
- package/node_modules/pi-footer/src/ui/screens/confirm-exit.ts +0 -52
- package/node_modules/pi-footer/src/ui/screens/controller.ts +0 -12
- package/node_modules/pi-footer/src/ui/screens/edit-colors.ts +0 -68
- package/node_modules/pi-footer/src/ui/screens/edit-widget.ts +0 -115
- package/node_modules/pi-footer/src/ui/screens/extension-status-row.ts +0 -61
- package/node_modules/pi-footer/src/ui/screens/global.ts +0 -75
- package/node_modules/pi-footer/src/ui/screens/line-list.ts +0 -108
- package/node_modules/pi-footer/src/ui/screens/main.ts +0 -99
- package/node_modules/pi-footer/src/ui/screens/terminal.ts +0 -121
- package/node_modules/pi-footer/src/ui/screens/widget-list.ts +0 -154
- package/node_modules/pi-footer/src/ui/terminal-menu.ts +0 -32
- package/node_modules/pi-footer/src/ui/theme.ts +0 -48
- package/node_modules/pi-footer/src/ui/title-bar.ts +0 -100
- package/node_modules/pi-footer/src/ui/widget-actions.ts +0 -76
- package/node_modules/pi-footer/src/ui.ts +0 -66
- package/node_modules/pi-footer/src/widgets/context.ts +0 -28
- package/node_modules/pi-footer/src/widgets/core/active-tools.ts +0 -17
- package/node_modules/pi-footer/src/widgets/core/context-window.ts +0 -24
- package/node_modules/pi-footer/src/widgets/core/cwd-basename.ts +0 -19
- package/node_modules/pi-footer/src/widgets/core/cwd.ts +0 -108
- package/node_modules/pi-footer/src/widgets/core/event.ts +0 -34
- package/node_modules/pi-footer/src/widgets/core/external-status.ts +0 -102
- package/node_modules/pi-footer/src/widgets/core/model-provider.ts +0 -20
- package/node_modules/pi-footer/src/widgets/core/model.ts +0 -35
- package/node_modules/pi-footer/src/widgets/core/provider.ts +0 -17
- package/node_modules/pi-footer/src/widgets/core/session-name.ts +0 -17
- package/node_modules/pi-footer/src/widgets/core/text-verbosity.ts +0 -17
- package/node_modules/pi-footer/src/widgets/core/thinking-level.ts +0 -17
- package/node_modules/pi-footer/src/widgets/git/ahead-behind.ts +0 -17
- package/node_modules/pi-footer/src/widgets/git/branch.ts +0 -81
- package/node_modules/pi-footer/src/widgets/git/clean.ts +0 -19
- package/node_modules/pi-footer/src/widgets/git/deletions.ts +0 -17
- package/node_modules/pi-footer/src/widgets/git/diff.ts +0 -38
- package/node_modules/pi-footer/src/widgets/git/insertions.ts +0 -17
- package/node_modules/pi-footer/src/widgets/git/remote.ts +0 -17
- package/node_modules/pi-footer/src/widgets/git/root.ts +0 -17
- package/node_modules/pi-footer/src/widgets/git/sha.ts +0 -17
- package/node_modules/pi-footer/src/widgets/git/staged.ts +0 -17
- package/node_modules/pi-footer/src/widgets/git/status.ts +0 -19
- package/node_modules/pi-footer/src/widgets/git/unstaged.ts +0 -17
- package/node_modules/pi-footer/src/widgets/git/untracked.ts +0 -17
- package/node_modules/pi-footer/src/widgets/instance.ts +0 -118
- package/node_modules/pi-footer/src/widgets/layout/custom-text.ts +0 -18
- package/node_modules/pi-footer/src/widgets/layout/flex-separator.ts +0 -32
- package/node_modules/pi-footer/src/widgets/layout/separator.ts +0 -57
- package/node_modules/pi-footer/src/widgets/layout/spacer.ts +0 -31
- package/node_modules/pi-footer/src/widgets/options.ts +0 -122
- package/node_modules/pi-footer/src/widgets/project/runtime.ts +0 -361
- package/node_modules/pi-footer/src/widgets/registry.ts +0 -223
- package/node_modules/pi-footer/src/widgets/session/assistant-messages.ts +0 -17
- package/node_modules/pi-footer/src/widgets/session/compactions.ts +0 -17
- package/node_modules/pi-footer/src/widgets/session/elapsed.ts +0 -18
- package/node_modules/pi-footer/src/widgets/session/last-activity.ts +0 -18
- package/node_modules/pi-footer/src/widgets/session/messages.ts +0 -19
- package/node_modules/pi-footer/src/widgets/session/session-id.ts +0 -17
- package/node_modules/pi-footer/src/widgets/session/session-start.ts +0 -18
- package/node_modules/pi-footer/src/widgets/session/tool-results.ts +0 -17
- package/node_modules/pi-footer/src/widgets/session/total-messages.ts +0 -19
- package/node_modules/pi-footer/src/widgets/session/total-time.ts +0 -18
- package/node_modules/pi-footer/src/widgets/session/user-messages.ts +0 -17
- package/node_modules/pi-footer/src/widgets/store.ts +0 -26
- package/node_modules/pi-footer/src/widgets/tokens/cache-hit-rate.ts +0 -55
- package/node_modules/pi-footer/src/widgets/tokens/cache-read.ts +0 -18
- package/node_modules/pi-footer/src/widgets/tokens/cache-write.ts +0 -18
- package/node_modules/pi-footer/src/widgets/tokens/context-bar.ts +0 -108
- package/node_modules/pi-footer/src/widgets/tokens/context-length.ts +0 -26
- package/node_modules/pi-footer/src/widgets/tokens/context-remaining.ts +0 -29
- package/node_modules/pi-footer/src/widgets/tokens/context.ts +0 -29
- package/node_modules/pi-footer/src/widgets/tokens/cost.ts +0 -51
- package/node_modules/pi-footer/src/widgets/tokens/input-speed.ts +0 -25
- package/node_modules/pi-footer/src/widgets/tokens/input-tokens.ts +0 -18
- package/node_modules/pi-footer/src/widgets/tokens/output-speed.ts +0 -25
- package/node_modules/pi-footer/src/widgets/tokens/output-tokens.ts +0 -18
- package/node_modules/pi-footer/src/widgets/tokens/tokens.ts +0 -20
- package/node_modules/pi-footer/src/widgets/tokens/total-speed.ts +0 -25
- package/node_modules/pi-footer/src/widgets/tokens/total-tokens.ts +0 -18
- package/node_modules/pi-footer/src/widgets/types.ts +0 -181
- package/node_modules/pi-footer/src/widgets/utils/colors.ts +0 -11
- package/node_modules/pi-footer/src/widgets/utils/context.ts +0 -112
- package/node_modules/pi-footer/src/widgets/utils/session.ts +0 -19
- package/node_modules/pi-footer/src/widgets/utils/token-format.ts +0 -78
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
2
|
+
import { sanitizeToolResultText } from "./tool-result-sanitize.ts";
|
|
3
|
+
|
|
4
|
+
/** 毫秒 → "1h 2m 3s"/"2m 3s"/"3s";低于 1 秒返回 ""(省略)。 */
|
|
5
|
+
export function formatDuration(ms: number): string {
|
|
6
|
+
const totalSec = Math.floor(ms / 1000);
|
|
7
|
+
if (totalSec < 1) return "";
|
|
8
|
+
const hours = Math.floor(totalSec / 3600);
|
|
9
|
+
const minutes = Math.floor((totalSec % 3600) / 60);
|
|
10
|
+
const seconds = totalSec % 60;
|
|
11
|
+
if (hours > 0) return `${hours}h ${minutes}m ${seconds}s`;
|
|
12
|
+
if (minutes > 0) return `${minutes}m ${seconds}s`;
|
|
13
|
+
return `${seconds}s`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** 文本单行化:去换行空白,超宽截断加省略号。 */
|
|
17
|
+
export function oneLine(value: unknown, max = 96): string {
|
|
18
|
+
const text = sanitizeToolResultText(String(value ?? ""), 4096)
|
|
19
|
+
.replace(/\s+/g, " ")
|
|
20
|
+
.trim();
|
|
21
|
+
return text.length > max ? `${text.slice(0, max - 1)}…` : text;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** 把一行文本补齐到固定可见宽度,超宽时截断并追加省略号。 */
|
|
25
|
+
export function padLine(text: string, width: number): string {
|
|
26
|
+
const truncated = truncateToWidth(text, width, "…");
|
|
27
|
+
return truncated + " ".repeat(Math.max(0, width - visibleWidth(truncated)));
|
|
28
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { TuiMainScreen } from "@earendil-works/pi-tui";
|
|
2
|
+
import { MAIN_SCREEN_DO_RENDER_PATCH, patchRegistry } from "./patch-keys.ts";
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* 官方 0.84+ 的 tui 引用是惰性 Proxy(createInteractiveTuiReference):
|
|
3
6
|
* 函数属性每次 get 都返回新包装,执行时才解析到当前实现。
|
|
@@ -9,3 +12,51 @@ export function isLazyProxyTui(tui: any): boolean {
|
|
|
9
12
|
const probe = tui.requestRender;
|
|
10
13
|
return typeof probe === "function" && probe !== tui.requestRender;
|
|
11
14
|
}
|
|
15
|
+
|
|
16
|
+
type MainScreenDoRenderPatch = {
|
|
17
|
+
active: boolean;
|
|
18
|
+
original: (lines: string[]) => string[];
|
|
19
|
+
installed: (lines: string[]) => string[];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* regular(TuiMainScreen)模式的 doRender 走差分绘制:一旦第一个变化行落在
|
|
24
|
+
* previousViewportTop 之上(终端写不进 scrollback 的区域),只能
|
|
25
|
+
* fullRender(true)——\x1b[2J\x1b[H\x1b[3J 清屏并清掉整段 scrollback。
|
|
26
|
+
* compact 直播式回合的摘要行动画与流式正文渲染在回合工具卡/diff 面板上方;
|
|
27
|
+
* diff 面板一落地把下方内容撑过屏高,之后每帧重绘都命中该分支:scrollback
|
|
28
|
+
* 被反复清空,滚动条回弹、视口钉住,直到输出结束才恢复。
|
|
29
|
+
*
|
|
30
|
+
* 视口上方的行本就无法重写,只剩「清回滚重打」与「scrollback 保留旧文本」
|
|
31
|
+
* 两条路。这里选后者:applyLineResets 是差分比较前最后一个拿到整帧的环节,
|
|
32
|
+
* 把 previousLines 的视口上方前缀直接对齐新帧,差分只看到可写区域,照常增量
|
|
33
|
+
* 绘制。代价仅是 scrollback 里那几行停留在最后一次实际写入的内容。
|
|
34
|
+
*/
|
|
35
|
+
export function installMainScreenDoRenderPatch(): void {
|
|
36
|
+
const prototype = TuiMainScreen.prototype as any;
|
|
37
|
+
if (typeof prototype?.applyLineResets !== "function") return;
|
|
38
|
+
const previous = patchRegistry.get<MainScreenDoRenderPatch>(MAIN_SCREEN_DO_RENDER_PATCH);
|
|
39
|
+
if (previous) previous.active = false;
|
|
40
|
+
const original =
|
|
41
|
+
previous && prototype.applyLineResets === previous.installed
|
|
42
|
+
? previous.original
|
|
43
|
+
: prototype.applyLineResets;
|
|
44
|
+
const patch: MainScreenDoRenderPatch = {
|
|
45
|
+
active: true,
|
|
46
|
+
original,
|
|
47
|
+
installed(this: any, lines: string[]) {
|
|
48
|
+
const result = original.call(this, lines);
|
|
49
|
+
if (!patch.active) return result;
|
|
50
|
+
const prev = this.previousLines;
|
|
51
|
+
if (!Array.isArray(prev)) return result;
|
|
52
|
+
const top = Math.min(
|
|
53
|
+
Math.max(0, Math.floor(Number(this.previousViewportTop) || 0)),
|
|
54
|
+
result.length,
|
|
55
|
+
);
|
|
56
|
+
for (let i = 0; i < top; i++) prev[i] = result[i];
|
|
57
|
+
return result;
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
prototype.applyLineResets = patch.installed;
|
|
61
|
+
patchRegistry.install(MAIN_SCREEN_DO_RENDER_PATCH, patch);
|
|
62
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ccstyle 补丁所有权与跨模块协调键的单一来源(single source of truth)。
|
|
3
|
+
*
|
|
4
|
+
* 全部使用 Symbol.for(全局注册表):/reload 后新模块实例拿到的是同一个 symbol,
|
|
5
|
+
* 这是跨 reload 识别/让渡补丁所有权的关键。切勿把这些 Symbol.for 改成模块局部 Symbol。
|
|
6
|
+
*
|
|
7
|
+
* 两类用途:
|
|
8
|
+
* 1. globalThis 槽位:安装补丁时写 host[KEY] = patch,dispose 时按所有权判断还原。
|
|
9
|
+
* 2. 实例/函数标记:把补丁包装器或组件实例标记在某个 symbol 属性上,供跨模块识别。
|
|
10
|
+
*
|
|
11
|
+
* PatchRegistry 把第 1 类的读写收口为带所有权语义的 install/dispose 生命周期;
|
|
12
|
+
* 底层仍是 globalThis[symbol],因此外部(含测试)直接读 globalThis 槽不受影响。
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
// ── compact / compact-thinking 协调 ──
|
|
16
|
+
export const COMPACT_MODE_PATCH_KEY = Symbol.for("pi.ccstyle.compact-mode-patch");
|
|
17
|
+
export const COMPACT_THINKING_PATCH_KEY = Symbol.for("pi.ccstyle.compact-thinking-update");
|
|
18
|
+
export const PROTOTYPE_ORIGINAL_KEY = Symbol.for("pi.ccstyle.prototype-original");
|
|
19
|
+
export const COMPACT_THINKING_OWNER = Symbol.for("pi.ccstyle.compact-thinking-owner");
|
|
20
|
+
|
|
21
|
+
// ── assistant 展开状态(实例标记) ──
|
|
22
|
+
export const ASSISTANT_SET_EXPANDED_KEY = Symbol.for("pi.ccstyle.compact-assistant-set-expanded");
|
|
23
|
+
export const ASSISTANT_TOGGLE_ROUND_KEY = Symbol.for("pi.ccstyle.compact-assistant-toggle-round");
|
|
24
|
+
export const ASSISTANT_REENTRY_KEY = Symbol.for("pi.ccstyle.compact-assistant-reentry");
|
|
25
|
+
|
|
26
|
+
// ── 工具渲染补丁 ──
|
|
27
|
+
export const GLOBAL_TOOL_RENDER_PATCH = Symbol.for("pi.ccstyle.global-tool-render-patch");
|
|
28
|
+
export const COMPONENT_TOOL_RENDER_MODE = Symbol.for("pi.ccstyle.component-tool-render-mode");
|
|
29
|
+
export const TOOL_EXPANDED_BACKGROUND_PATCH = Symbol.for(
|
|
30
|
+
"pi.ccstyle.tool-expanded-background-patch",
|
|
31
|
+
);
|
|
32
|
+
// write 归属:注册期确认一次,渲染期据此决定是否提供 rich diff。
|
|
33
|
+
export const WRITE_OWNERSHIP_SLOT = Symbol.for("pi.ccstyle.write-ownership");
|
|
34
|
+
|
|
35
|
+
// ── 消息组件补丁 ──
|
|
36
|
+
export const MESSAGE_DISPLAY_PATCH = Symbol.for("pi.ccstyle.message-display-patch");
|
|
37
|
+
|
|
38
|
+
// ── 工具分组 ──
|
|
39
|
+
export const TOOL_GROUPING_PATCH_KEY = Symbol.for("pi.ccstyle.tool-grouping-patch");
|
|
40
|
+
export const TOOL_GROUPING_PARENT_KEY = Symbol.for("pi.ccstyle.tool-grouping-parent");
|
|
41
|
+
export const TOOL_GROUPING_GENERATION_KEY = Symbol.for("pi.ccstyle.tool-grouping-generation");
|
|
42
|
+
|
|
43
|
+
// ── regular 主屏渲染补丁 ──
|
|
44
|
+
export const MAIN_SCREEN_DO_RENDER_PATCH = Symbol.for("pi.ccstyle.main-screen-do-render-patch");
|
|
45
|
+
|
|
46
|
+
// ── 鼠标交互 ──
|
|
47
|
+
export const TOOL_MOUSE_OWNER_KEY = Symbol.for("pi.ccstyle.tool-mouse-owner");
|
|
48
|
+
export const TOOL_MOUSE_TUI_SLOT = Symbol.for("pi.ccstyle.tool-mouse-tui");
|
|
49
|
+
export const SCROLL_BUTTON_STATE_SLOT = Symbol.for("pi.ccstyle.scroll-button-state");
|
|
50
|
+
export const OFFICIAL_SCROLL_TO_END_KEY = Symbol.for("pi.ccstyle.official-scroll-to-end");
|
|
51
|
+
export const FLUSH_DOCKED_BASH_PATCH = Symbol.for("pi.ccstyle.flush-docked-bash-patch");
|
|
52
|
+
export const EARLY_STARTUP_HEADER_PATCH = Symbol.for("pi.ccstyle.early-startup-header-patch");
|
|
53
|
+
export const EARLY_STARTUP_HEADER_SWAP_KEY = Symbol.for("pi.ccstyle.early-startup-header-swap");
|
|
54
|
+
export const TOOL_HOVER_STATE_KEY = Symbol.for("pi.ccstyle.tool-hover-state");
|
|
55
|
+
|
|
56
|
+
// ── rich diff 组件标记 ──
|
|
57
|
+
export const RICH_DIFF_COMPONENT = Symbol.for("pi.ccstyle.rich-diff-component");
|
|
58
|
+
|
|
59
|
+
// ── PatchRegistry:所有权生命周期统一收口 ──
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* host 上的补丁槽位读写器。把散落各处的
|
|
63
|
+
* `host[KEY] = patch` / `if (host[KEY] === patch) delete host[KEY]` 收口为
|
|
64
|
+
* 带所有权语义的 install/dispose 生命周期:
|
|
65
|
+
*
|
|
66
|
+
* - install:覆盖写入并返回被替换的旧值(不自动让旧值失效——部分安装器
|
|
67
|
+
* 需要先读旧补丁以链接下游方法,由调用方决定如何 inactivate)。
|
|
68
|
+
* - dispose:所有权守卫删除——仅当槽位仍 === 该值才删除,防止 /reload 后
|
|
69
|
+
* 旧模块误删新模块的补丁。
|
|
70
|
+
* - owns:判断槽位是否仍由某值持有(恒等比较)。
|
|
71
|
+
* - ensure:惰性状态槽(??= 语义),用于无所有权的跨模块共享状态。
|
|
72
|
+
*/
|
|
73
|
+
export class PatchRegistry {
|
|
74
|
+
readonly host: Record<PropertyKey, unknown>;
|
|
75
|
+
|
|
76
|
+
constructor(
|
|
77
|
+
host: Record<PropertyKey, unknown> = globalThis as unknown as Record<PropertyKey, unknown>,
|
|
78
|
+
) {
|
|
79
|
+
this.host = host;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** 读取槽位当前值。 */
|
|
83
|
+
get<T = unknown>(key: symbol): T | undefined {
|
|
84
|
+
return this.host[key] as T | undefined;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** 是否仍由 value 持有(恒等比较)。 */
|
|
88
|
+
owns(key: symbol, value: unknown): boolean {
|
|
89
|
+
return this.host[key] === value;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** 覆盖写入并返回被替换的旧值;不自动让旧值失效。 */
|
|
93
|
+
install<T = unknown>(key: symbol, value: T): T | undefined {
|
|
94
|
+
const previous = this.host[key] as T | undefined;
|
|
95
|
+
this.host[key] = value;
|
|
96
|
+
return previous;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** 所有权守卫删除:仅当槽位仍 === value 时删除。返回是否删除。 */
|
|
100
|
+
dispose(key: symbol, value: unknown): boolean {
|
|
101
|
+
if (!this.owns(key, value)) return false;
|
|
102
|
+
delete this.host[key];
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** 惰性槽位:无值(null/undefined)时用 init() 初始化并缓存。 */
|
|
107
|
+
ensure<T>(key: symbol, init: () => T): T {
|
|
108
|
+
const current = this.host[key];
|
|
109
|
+
if (current !== null && current !== undefined) return current as T;
|
|
110
|
+
const value = init();
|
|
111
|
+
this.host[key] = value;
|
|
112
|
+
return value;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** 无条件删除槽位(不判断所有权)。返回是否实际删除了键。 */
|
|
116
|
+
delete(key: symbol): boolean {
|
|
117
|
+
if (!(key in this.host)) return false;
|
|
118
|
+
delete this.host[key];
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** 全局单例:host 固定为 globalThis,跨 /reload 与 jiti 重载稳定。 */
|
|
124
|
+
export const patchRegistry = new PatchRegistry();
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SGR 鼠标协议解析(共享)。
|
|
3
|
+
*
|
|
4
|
+
* 收敛 feature/_util.ts 的单包解析与 renderer/mouse/packets.ts 的批量解析。
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** SGR 鼠标协议包(code;col;row + M/m 终结符)。 */
|
|
8
|
+
export type SgrMousePacket = {
|
|
9
|
+
code: number;
|
|
10
|
+
col: number;
|
|
11
|
+
row: number;
|
|
12
|
+
final: "M" | "m";
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** 解析单个完整 SGR 鼠标包(整段数据必须恰好是一个包)。 */
|
|
16
|
+
export function parseSgrMousePacket(data: string): SgrMousePacket | null {
|
|
17
|
+
const match = data.match(/^\x1b\[<(\d+);(\d+);(\d+)([Mm])$/);
|
|
18
|
+
if (!match) return null;
|
|
19
|
+
return {
|
|
20
|
+
code: Number(match[1]),
|
|
21
|
+
col: Number(match[2]),
|
|
22
|
+
row: Number(match[3]),
|
|
23
|
+
final: match[4] as "M" | "m",
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 解析整段终端输入为 SGR 鼠标包序列;数据必须完全由连续 SGR 包组成
|
|
29
|
+
* (夹杂其他字节返回 null,交由常规输入链处理)。
|
|
30
|
+
*/
|
|
31
|
+
export function parseSgrMousePackets(data: string): SgrMousePacket[] | null {
|
|
32
|
+
const pattern = /\x1b\[<(\d+);(\d+);(\d+)([Mm])/g;
|
|
33
|
+
const packets: SgrMousePacket[] = [];
|
|
34
|
+
let offset = 0;
|
|
35
|
+
|
|
36
|
+
for (const match of data.matchAll(pattern)) {
|
|
37
|
+
if (match.index !== offset) return null;
|
|
38
|
+
offset = match.index + match[0].length;
|
|
39
|
+
packets.push({
|
|
40
|
+
code: Number(match[1]),
|
|
41
|
+
col: Number(match[2]),
|
|
42
|
+
row: Number(match[3]),
|
|
43
|
+
final: match[4] as "M" | "m",
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return packets.length > 0 && offset === data.length ? packets : null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** 是否为左键按下(排除修饰键、32 表示 motion 事件)。 */
|
|
51
|
+
export function isSgrLeftPress(packet: SgrMousePacket): boolean {
|
|
52
|
+
const baseButton = mouseBaseButton(packet.code);
|
|
53
|
+
return packet.final === "M" && baseButton === 0 && (packet.code & 32) === 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** 是否为左键松开。 */
|
|
57
|
+
export function isSgrLeftRelease(packet: SgrMousePacket): boolean {
|
|
58
|
+
const baseButton = mouseBaseButton(packet.code);
|
|
59
|
+
return packet.final === "m" && baseButton === 0 && (packet.code & 32) === 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** 无按键按住的指针移动(DECSET 1003 的 35)。左键拖动(32,文本选区)不是 hover。 */
|
|
63
|
+
export function isSgrIdleMotion(packet: SgrMousePacket): boolean {
|
|
64
|
+
return packet.final === "M" && (packet.code & 32) !== 0 && mouseBaseButton(packet.code) === 3;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** 剥离修饰键位(4/8/16/32:shift/meta/ctrl/motion),得到基础按键码。 */
|
|
68
|
+
export function mouseBaseButton(code: number): number {
|
|
69
|
+
return code & ~(4 | 8 | 16 | 32);
|
|
70
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@herbertgao/pi-cc-extensions",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "A Pi productivity suite with Claude Code-style UI, context inspection, and agent/session references",
|
|
6
6
|
"type": "module",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"./themes/cc-dark.json",
|
|
37
37
|
"./themes/cc-light.json"
|
|
38
38
|
],
|
|
39
|
-
"image": "https://raw.githubusercontent.com/HerbertGao/pi-extensions/master/packages/pi-cc-extensions/assets/readme/
|
|
40
|
-
"video": "https://github.com/
|
|
39
|
+
"image": "https://raw.githubusercontent.com/HerbertGao/pi-extensions/master/packages/pi-cc-extensions/assets/readme/preview.webp",
|
|
40
|
+
"video": "https://github.com/minuque/pi-cc-extensions/releases/download/v0.9.4/demo.mp4"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
|
-
"test": "node
|
|
44
|
-
"typecheck": "
|
|
43
|
+
"test": "node scripts/test.mjs",
|
|
44
|
+
"typecheck": "tsc --noEmit",
|
|
45
45
|
"format": "biome format --write .",
|
|
46
46
|
"format:check": "biome format ."
|
|
47
47
|
},
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
},
|
|
70
70
|
"x-upstream": {
|
|
71
71
|
"package": "pi-cc-extensions",
|
|
72
|
-
"version": "0.
|
|
73
|
-
"reviewedVersion": "0.9.
|
|
72
|
+
"version": "0.9.9",
|
|
73
|
+
"reviewedVersion": "0.9.9",
|
|
74
74
|
"repository": "https://github.com/minuque/pi-cc-extensions",
|
|
75
|
-
"commit": "
|
|
75
|
+
"commit": "17d294bcdc5e9a7e68771f0c550440ed22738457"
|
|
76
76
|
}
|
|
77
77
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# pi-antigravity
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/pi-antigravity)
|
|
4
|
+
[](https://www.npmjs.com/package/pi-antigravity)
|
|
4
5
|
[](LICENSE)
|
|
5
6
|
[](https://github.com/sponsors/Rahularya01)
|
|
6
7
|
|
|
@@ -44,6 +45,8 @@ Or install the latest repository version:
|
|
|
44
45
|
pi install git:github.com/Rahularya01/pi-antigravity
|
|
45
46
|
```
|
|
46
47
|
|
|
48
|
+
On Oh My Pi, install the same package with `omp plugin install npm:pi-antigravity`.
|
|
49
|
+
|
|
47
50
|
Restart Pi (or run `/reload`) after installation. To update the npm package later, use `pi update npm:pi-antigravity`.
|
|
48
51
|
|
|
49
52
|
## Quick start
|
|
@@ -58,6 +61,17 @@ Restart Pi (or run `/reload`) after installation. To update the npm package late
|
|
|
58
61
|
|
|
59
62
|
4. Start working. If a request fails, run `/antigravity.doctor` for sanitized diagnostics.
|
|
60
63
|
|
|
64
|
+
To link another account without losing the existing one, run `/login antigravity`
|
|
65
|
+
again and complete Google sign-in with the other account. Manage linked accounts with:
|
|
66
|
+
|
|
67
|
+
```text
|
|
68
|
+
/antigravity.accounts
|
|
69
|
+
/antigravity.accounts switch <index|email>
|
|
70
|
+
/antigravity.accounts remove <index|email>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
On a hard quota wall (HTTP 429 with a reset hint), the provider automatically tries the next linked account.
|
|
74
|
+
|
|
61
75
|
## Authentication and credential safety
|
|
62
76
|
|
|
63
77
|
The provider uses the OAuth 2.0 Authorization Code flow with PKCE, so credentials are only ever exchanged with Google — never typed into Pi.
|
|
@@ -65,8 +79,9 @@ The provider uses the OAuth 2.0 Authorization Code flow with PKCE, so credential
|
|
|
65
79
|
1. `/login antigravity` opens Google sign-in and starts a temporary callback listener at `http://localhost:51121/oauth-callback`.
|
|
66
80
|
2. After you approve access, Pi exchanges the callback code for tokens and stores the provider credentials in Pi's auth store (normally `~/.pi/agent/auth.json`).
|
|
67
81
|
3. Pi refreshes access tokens automatically when they expire — you shouldn't need to sign in again unless a token is revoked.
|
|
82
|
+
4. Successful logins and token rotations are also kept in `~/.pi/agent/antigravity-accounts.json` with owner-only permissions so linked accounts can be switched without re-authenticating.
|
|
68
83
|
|
|
69
|
-
The callback listener binds only to a loopback host, so it isn't reachable from outside your machine. The auth
|
|
84
|
+
The callback listener binds only to a loopback host, so it isn't reachable from outside your machine. The auth and account files it writes to contain sensitive access and refresh tokens: **do not commit them, paste them into issues, or share their contents.**
|
|
70
85
|
|
|
71
86
|
Signing in requests these Google OAuth scopes:
|
|
72
87
|
|
|
@@ -90,15 +105,19 @@ Review these permissions before approving access. If your credentials expire or
|
|
|
90
105
|
| `/model antigravity/<model-id>` | Choose a registered Antigravity model. |
|
|
91
106
|
| `/antigravity.usage` | Show the server-reported shared quota groups and reset times. |
|
|
92
107
|
| `/antigravity.models` | List available runtime models, remaining shared-pool quota, and capabilities. |
|
|
108
|
+
| `/antigravity.accounts` | List linked accounts; use `switch` or `remove` with an index or email to manage them. |
|
|
93
109
|
| `/antigravity.models all` | Include tab/chat models normally hidden from the model list. |
|
|
94
110
|
| `/antigravity.refresh` | Force refresh the dynamic model catalog from Antigravity. |
|
|
95
111
|
| `/antigravity.doctor` | Show sanitized provider diagnostics, including the endpoint, status, and resolved runtime model. |
|
|
96
112
|
| `/antigravity.image <prompt>` | Generate an image via Antigravity and save it under `.pi/generated-images/`. Optional `--ratio 16:9`, `--model`, `--path`. |
|
|
113
|
+
| `/antigravity.search <query>` | Search the web using Google Search Grounding via Antigravity. Optional `--thinking`, `--url <url>`. |
|
|
97
114
|
|
|
98
115
|
Model availability, entitlement, quota groups, and resets are returned by the service and can differ by account. The quota percentage shown for a model can represent a shared pool, not a private per-model allowance.
|
|
99
116
|
|
|
100
117
|
The extension also registers a `generate_image` tool the model can call. Images are written inside the project directory (default `.pi/generated-images/`). Image models such as `gemini-3-pro-image` are account-dependent; `/antigravity.image` falls back to other advertised Gemini image IDs on 404.
|
|
101
118
|
|
|
119
|
+
It also registers a `google_search` tool allowing models to perform real-time web search and URL analysis using Google Search Grounding over Cloud Code Assist (powered by `gemini-3-flash` with dynamic fallback). It supports optional lead agent directives (`instruction`), specific target URLs (`urls`), and deep reasoning (`thinking: true`).
|
|
120
|
+
|
|
102
121
|
## Models and routing
|
|
103
122
|
|
|
104
123
|
After you sign in, the provider refreshes its catalog from Antigravity (`fetchAvailableModels`) and groups runtime thinking variants into public Pi model IDs. Newly enabled models — for example a new Gemini Flash generation — become selectable after that refresh without waiting for an extension release. A last-known-good cache is kept for offline/cold start; the static table below is only the conservative fallback and a routing reference.
|
|
@@ -154,13 +173,13 @@ All primary environment variables start with `ANTIGRAVITY_`. The legacy `NOAGY_`
|
|
|
154
173
|
| `ANTIGRAVITY_CLIENT_ID` | Use a custom Google OAuth client ID. |
|
|
155
174
|
| `ANTIGRAVITY_CLIENT_SECRET` | Use a custom Google OAuth client secret. Keep it out of source control and shell history. |
|
|
156
175
|
| `ANTIGRAVITY_NO_KEEPALIVE` | Set to `1` to skip the keep-alive connection pool. |
|
|
157
|
-
| `ANTIGRAVITY_NO_PREWARM` | Set to `1` to skip the TLS pre-warm request made
|
|
176
|
+
| `ANTIGRAVITY_NO_PREWARM` | Set to `1` to skip the TLS pre-warm request made on the first Antigravity request. |
|
|
158
177
|
|
|
159
178
|
By default, the provider tries `https://daily-cloudcode-pa.googleapis.com`, then the sandbox host, then `https://cloudcode-pa.googleapis.com`. Prefer the built-in OAuth client unless you have a reason to use your own credentials.
|
|
160
179
|
|
|
161
180
|
### Latency
|
|
162
181
|
|
|
163
|
-
Provider requests reuse a keep-alive connection pool when the runtime supports it, so consecutive turns do not repeat the DNS, TCP, and TLS handshake. When `HTTP_PROXY`, `HTTPS_PROXY`, or `ALL_PROXY` is set, that pool is skipped so Pi's proxy-aware dispatcher is used instead. The connection is
|
|
182
|
+
Provider requests reuse a keep-alive connection pool when the runtime supports it, so consecutive turns do not repeat the DNS, TCP, and TLS handshake. When `HTTP_PROXY`, `HTTPS_PROXY`, or `ALL_PROXY` is set, that pool is skipped so Pi's proxy-aware dispatcher is used instead. The connection is opened on the first Antigravity request rather than at Pi startup, so other extensions are not stalled by an unauthenticated handshake. For the lowest time-to-first-token, pick a fast runtime: `gemini-3.8-flash` with reasoning off routes to `gemini-3.8-flash-low` at thinking level `LOW`. Setting `ANTIGRAVITY_PROJECT_ID` also removes the project-discovery round-trip when credentials do not already carry a project ID.
|
|
164
183
|
|
|
165
184
|
## Troubleshooting
|
|
166
185
|
|
|
@@ -173,16 +192,20 @@ Provider requests reuse a keep-alive connection pool when the runtime supports i
|
|
|
173
192
|
- **Claude/GPT tool-call schema error:** Upgrade to the latest package release. The provider adapts Pi's JSON Schema tool definitions for the Cloud Code Assist custom-tool bridge.
|
|
174
193
|
- **Quota or rate limit:** Run `/antigravity.usage`. A `429` response usually indicates quota or rate limiting; changing models may still draw from the same shared pool.
|
|
175
194
|
- **Need a safe diagnostic:** `/antigravity.doctor` redacts recognized secrets from its error output. Still review output before sharing it publicly.
|
|
195
|
+
- **Oh My Pi says `registerApiProvider` is not exported:** Upgrade to 0.8.1 or later. Older builds statically import a Pi compat export that Oh My Pi's bundled runtime does not provide. The provider still registers through `pi.registerProvider` on that host.
|
|
176
196
|
|
|
177
197
|
## Development
|
|
178
198
|
|
|
179
|
-
This repo uses [
|
|
199
|
+
This repo uses [Yarn 4](https://yarnpkg.com/) via Corepack for install, scripts, and CI. The published extension itself runs on Node (Pi's CLI).
|
|
180
200
|
|
|
181
201
|
```bash
|
|
182
|
-
|
|
183
|
-
|
|
202
|
+
corepack enable
|
|
203
|
+
yarn install
|
|
204
|
+
yarn check
|
|
184
205
|
```
|
|
185
206
|
|
|
207
|
+
Installs are hardened against common supply-chain attacks: lifecycle scripts are off, lockfile checksums must match the npm registry, and package versions younger than three days are rejected. Do not add a second registry or enable `enableScripts` without a review.
|
|
208
|
+
|
|
186
209
|
The package declares its Pi extension in `package.json` under `pi.extensions`. See the [Pi package documentation](https://pi.dev/docs/latest/packages) for package installation, manifest, and gallery conventions.
|
|
187
210
|
|
|
188
211
|
## Support the project
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-antigravity",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Personal Antigravity / Cloud Code Assist provider for Pi Coding Agent",
|
|
5
5
|
"author": "Rahul Arya",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,18 +28,22 @@
|
|
|
28
28
|
"src",
|
|
29
29
|
"tsconfig.json"
|
|
30
30
|
],
|
|
31
|
-
"packageManager": "
|
|
31
|
+
"packageManager": "yarn@4.18.0+sha512.fcb8716fe7cd0eece141ffc18b92193a9df9204c1ba83189c288835223fc0bbe64af473bab0d5e9927a7daeb5caf2bb07eb2787cc9338ca040ea125f2a1f2f7e",
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=22.15.0"
|
|
34
|
+
},
|
|
32
35
|
"scripts": {
|
|
33
36
|
"typecheck": "tsc --noEmit",
|
|
34
37
|
"lint": "eslint src",
|
|
35
38
|
"lint:fix": "eslint src --fix",
|
|
36
39
|
"format": "prettier --write .",
|
|
37
40
|
"format:check": "prettier --check .",
|
|
38
|
-
"security-check": "
|
|
39
|
-
"test": "
|
|
40
|
-
"smoke:tools": "
|
|
41
|
-
"smoke:models": "
|
|
42
|
-
"
|
|
41
|
+
"security-check": "node scripts/run-ts.mjs scripts/security-check.ts",
|
|
42
|
+
"test": "node scripts/run-ts.mjs scripts/test-model-routing.ts && node scripts/run-ts.mjs scripts/test-model-discovery.ts && node scripts/run-ts.mjs scripts/test-usage-formatter.ts && node scripts/run-ts.mjs scripts/test-stream-sse.ts && node scripts/run-ts.mjs scripts/test-stream-header-deadline.ts && node scripts/run-ts.mjs scripts/test-http-proxy.ts && node scripts/run-ts.mjs scripts/test-image-gen.ts && node scripts/run-ts.mjs scripts/test-transcript-context.ts && node scripts/run-ts.mjs scripts/test-accounts.ts && node scripts/run-ts.mjs scripts/test-search.ts",
|
|
43
|
+
"smoke:tools": "node scripts/run-ts.mjs scripts/smoke-tool-schema.ts",
|
|
44
|
+
"smoke:models": "node scripts/run-ts.mjs scripts/smoke-all-models.mjs",
|
|
45
|
+
"audit": "yarn npm audit --environment production --recursive && yarn npm audit --severity high --all --recursive",
|
|
46
|
+
"check": "yarn typecheck && yarn lint && yarn format:check && yarn security-check && yarn test && yarn audit"
|
|
43
47
|
},
|
|
44
48
|
"pi": {
|
|
45
49
|
"extensions": [
|
|
@@ -52,6 +56,7 @@
|
|
|
52
56
|
},
|
|
53
57
|
"devDependencies": {
|
|
54
58
|
"@earendil-works/pi-ai": "^0.84.2",
|
|
59
|
+
"@earendil-works/pi-coding-agent": "^0.84.2",
|
|
55
60
|
"@eslint/js": "^10.0.1",
|
|
56
61
|
"@types/node": "^26.1.1",
|
|
57
62
|
"eslint": "^10.7.0",
|