@orbit-labs-ai/pi-antigravity 0.0.1 → 0.0.2

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/CHANGELOG.md CHANGED
@@ -1,6 +1,20 @@
1
1
  # Changelog
2
2
 
3
- English | [简体中文](CHANGELOG.zh-CN.md)
3
+ English | [简体中文](./CHANGELOG.zh-CN.md)
4
+
5
+ ## 0.0.2 — 2026-12-02
6
+
7
+ ### Added
8
+
9
+ - `npm run link-host-types` runs the existing host-type linker, so an editor or language server resolves the Pi SDK through `tsconfig.json`.
10
+
11
+ ### Fixed
12
+
13
+ - Move three argument helpers of the ACP activity renderer (`callIdArg`, `acpFileArg`, `acpQueryArg`) out of the middle of its `switch` to module level. They had been declared after a `return` inside the `tool_start` case; behavior is unchanged, and the `tool_start` case now ends where it returns.
14
+
15
+ ### Changed
16
+
17
+ - Clear the remaining lint findings without changing behavior: loops that cancel or settle entries walk a named snapshot of the collection, an unused generation counter and an unused file flag are removed, a redundant empty-list check is dropped, and the shadow tool's parameters are typed `unknown`.
4
18
 
5
19
  ## 0.0.1 — 2026-12-02
6
20
 
@@ -1,6 +1,20 @@
1
1
  # 更新日志
2
2
 
3
- [English](CHANGELOG.md) | 简体中文
3
+ [English](./CHANGELOG.md) | 简体中文
4
+
5
+ ## 0.0.2 — 2026-12-02
6
+
7
+ ### 新增
8
+
9
+ - 新增 `npm run link-host-types`,调用已有的宿主类型链接脚本,让编辑器或语言服务器通过 `tsconfig.json` 解析 Pi SDK。
10
+
11
+ ### 修复
12
+
13
+ - 把 ACP 活动渲染器 `switch` 中间的三个参数辅助函数(`callIdArg`、`acpFileArg`、`acpQueryArg`)移到模块层级。它们此前声明在 `tool_start` 分支的 `return` 之后;行为不变,`tool_start` 分支现在在返回处结束。
14
+
15
+ ### 变更
16
+
17
+ - 清除剩余静态检查问题,行为不变:会取消或结算条目的循环改为遍历集合的具名快照,删除未使用的代数计数器和文件标志,去掉多余的空列表判断,影子工具的参数类型改为 `unknown`。
4
18
 
5
19
  ## 0.0.1 — 2026-12-02
6
20
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Pi Antigravity
2
2
 
3
- English | [简体中文](README.zh-CN.md)
3
+ English | [简体中文](./README.zh-CN.md)
4
4
 
5
5
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](../../LICENSE)
6
6
  [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D22.19-339933?logo=node.js&logoColor=white)](https://nodejs.org/)
@@ -28,14 +28,14 @@ Pi Antigravity (`@orbit-labs-ai/pi-antigravity`) registers Antigravity (`agy`) m
28
28
 
29
29
  ## Installation
30
30
 
31
- Keep the live installation outside a branch-switching git checkout (for example under `~/.local/share/orbit-tools/pi-antigravity-0.0.1`).
31
+ Keep the live installation outside a branch-switching git checkout (for example under `~/.local/share/orbit-tools/pi-antigravity-0.0.2`).
32
32
 
33
33
  ### Option 1: Local Versioned Snapshot (Recommended for Orbit Tools)
34
34
 
35
35
  ```sh
36
- mkdir -p ~/.local/share/orbit-tools/pi-antigravity-0.0.1
37
- # Copy Pi/pi-antigravity from the Orbit Tools 0.0.1 release or checkout, then:
38
- cd ~/.local/share/orbit-tools/pi-antigravity-0.0.1
36
+ mkdir -p ~/.local/share/orbit-tools/pi-antigravity-0.0.2
37
+ # Copy Pi/pi-antigravity from the Orbit Tools 0.0.2 release or checkout, then:
38
+ cd ~/.local/share/orbit-tools/pi-antigravity-0.0.2
39
39
  npm ci --omit=dev --ignore-scripts --legacy-peer-deps
40
40
  ```
41
41
 
@@ -44,7 +44,7 @@ Add the path to `~/.pi/agent/settings.json` under `packages` (and remove any pre
44
44
  ```json
45
45
  {
46
46
  "packages": [
47
- "/Users/<you>/.local/share/orbit-tools/pi-antigravity-0.0.1"
47
+ "/Users/<you>/.local/share/orbit-tools/pi-antigravity-0.0.2"
48
48
  ]
49
49
  }
50
50
  ```
@@ -52,7 +52,7 @@ Add the path to `~/.pi/agent/settings.json` under `packages` (and remove any pre
52
52
  ### Option 2: npm Package
53
53
 
54
54
  ```sh
55
- pi install npm:@orbit-labs-ai/pi-antigravity@0.0.1
55
+ pi install npm:@orbit-labs-ai/pi-antigravity@0.0.2
56
56
  ```
57
57
 
58
58
  Restart Pi or run `/reload`, then pick an `antigravity/*` model via `/model` or inspect health with `/agy doctor`.
@@ -124,13 +124,14 @@ npm audit --omit=dev
124
124
  ```
125
125
 
126
126
  - `npm run typecheck` resolves the installed Pi SDK (via `PI_SDK_PATH` or `~/.pi/agent/install/current-version`) and runs strict TypeScript checks across `src/` and `extensions/`.
127
+ - `npm run link-host-types` links that Pi SDK and the type packages it ships into `node_modules/`, so an editor or language server resolves the host imports through `tsconfig.json`. The links are local and ignored by Git; `npm ci` removes them, so run it again afterwards.
127
128
  - `npm test` runs offline unit tests covering mid-turn steering delivery (`test/steering.test.mjs`), runtime/schema/migration behavior (`test/runtime.test.mjs`), and dry-run packaging/documentation checks (`test/package.test.mjs`). No paid API calls are made by `npm test`.
128
129
  - **Known limitations**: When `agy` completes a turn using only internal thinking or native tools without calling any bridged Pi tool, Pi itself keeps steering messages queued until turn end (matching standard Pi behavior for all providers). Mid-turn injection applies whenever Pi drains steering after a bridged tool round-trip.
129
130
 
130
131
  ## Uninstall and Cleanup
131
132
 
132
133
  1. Remove the package path (or `npm:@orbit-labs-ai/pi-antigravity`) from `~/.pi/agent/settings.json` and restart Pi or run `/reload`.
133
- 2. Delete the local install directory `~/.local/share/orbit-tools/pi-antigravity-0.0.1`.
134
+ 2. Delete the local install directory `~/.local/share/orbit-tools/pi-antigravity-0.0.2`.
134
135
  3. Optionally remove state and logs: `~/.pi/agent/pi-antigravity/` and `~/.pi/extensions-data/orbit-labs-ai/pi-antigravity/`.
135
136
 
136
137
  ## License
package/README.zh-CN.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Pi Antigravity
2
2
 
3
- [English](README.md) | 简体中文
3
+ [English](./README.md) | 简体中文
4
4
 
5
5
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](../../LICENSE)
6
6
  [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D22.19-339933?logo=node.js&logoColor=white)](https://nodejs.org/)
@@ -28,14 +28,14 @@ Pi Antigravity(`@orbit-labs-ai/pi-antigravity`)在 Pi 中通过官方 Antigr
28
28
 
29
29
  ## 安装与快速开始
30
30
 
31
- 建议将生产运行的插件副本放在独立目录(不要直接指向频繁切换分支的 Git 工作区),例如 `~/.local/share/orbit-tools/pi-antigravity-0.0.1`。
31
+ 建议将生产运行的插件副本放在独立目录(不要直接指向频繁切换分支的 Git 工作区),例如 `~/.local/share/orbit-tools/pi-antigravity-0.0.2`。
32
32
 
33
33
  ### 方式一:本地版本化快照安装(Orbit Tools 推荐)
34
34
 
35
35
  ```sh
36
- mkdir -p ~/.local/share/orbit-tools/pi-antigravity-0.0.1
37
- # 从 Orbit Tools 0.0.1 发布版或检出目录复制 Pi/pi-antigravity 后执行:
38
- cd ~/.local/share/orbit-tools/pi-antigravity-0.0.1
36
+ mkdir -p ~/.local/share/orbit-tools/pi-antigravity-0.0.2
37
+ # 从 Orbit Tools 0.0.2 发布版或检出目录复制 Pi/pi-antigravity 后执行:
38
+ cd ~/.local/share/orbit-tools/pi-antigravity-0.0.2
39
39
  npm ci --omit=dev --ignore-scripts --legacy-peer-deps
40
40
  ```
41
41
 
@@ -44,7 +44,7 @@ npm ci --omit=dev --ignore-scripts --legacy-peer-deps
44
44
  ```json
45
45
  {
46
46
  "packages": [
47
- "/Users/<你的用户名>/.local/share/orbit-tools/pi-antigravity-0.0.1"
47
+ "/Users/<你的用户名>/.local/share/orbit-tools/pi-antigravity-0.0.2"
48
48
  ]
49
49
  }
50
50
  ```
@@ -52,7 +52,7 @@ npm ci --omit=dev --ignore-scripts --legacy-peer-deps
52
52
  ### 方式二:npm 安装
53
53
 
54
54
  ```sh
55
- pi install npm:@orbit-labs-ai/pi-antigravity@0.0.1
55
+ pi install npm:@orbit-labs-ai/pi-antigravity@0.0.2
56
56
  ```
57
57
 
58
58
  重启 Pi 或执行 `/reload`,通过 `/model` 选择 `antigravity/*` 模型,或运行 `/agy doctor` 查看状态。
@@ -124,13 +124,14 @@ npm audit --omit=dev
124
124
  ```
125
125
 
126
126
  - `npm run typecheck` 自动解析已安装的 Pi SDK(通过 `PI_SDK_PATH` 或 `~/.pi/agent/install/current-version`)并对 `src/` 与 `extensions/` 执行严格 TypeScript 检查。
127
+ - `npm run link-host-types` 把该 Pi SDK 及其附带的类型包链接到 `node_modules/`,让编辑器或语言服务器通过 `tsconfig.json` 解析宿主导入。这些链接只在本机,Git 会忽略;`npm ci` 会删除它们,之后请重新运行。
127
128
  - `npm test` 运行离线自动化测试,覆盖实时 mid-turn steering 注入(`test/steering.test.mjs`)、运行时/schema 克隆/配置迁移(`test/runtime.test.mjs`)及打包与文档完整性检查(`test/package.test.mjs`),不触发付费模型调用。
128
129
  - **已知边界**:当 `agy` 仅使用内部思考或原生工具完成整个回合、未触发任何 Pi 桥接工具调用时,Pi 会像对待其他所有 provider 一样将 steering 消息排队至本轮结束;只要触发了桥接工具往返,Pi 在工具返回后排入的 steering 消息都会实时回合中注入。
129
130
 
130
131
  ## 卸载与清理
131
132
 
132
133
  1. 从 `~/.pi/agent/settings.json` 中移除该插件路径(或 `npm:@orbit-labs-ai/pi-antigravity`),然后重启 Pi 或执行 `/reload`。
133
- 2. 删除本地安装目录 `~/.local/share/orbit-tools/pi-antigravity-0.0.1`。
134
+ 2. 删除本地安装目录 `~/.local/share/orbit-tools/pi-antigravity-0.0.2`。
134
135
  3. 如需清理状态与日志,可删除 `~/.pi/agent/pi-antigravity/` 与 `~/.pi/extensions-data/orbit-labs-ai/pi-antigravity/`。
135
136
 
136
137
  ## 许可证
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbit-labs-ai/pi-antigravity",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -47,6 +47,7 @@
47
47
  "scripts": {
48
48
  "check": "node scripts/typecheck.mjs",
49
49
  "typecheck": "node scripts/typecheck.mjs",
50
+ "link-host-types": "node scripts/link-host-types.mjs",
50
51
  "test": "node --test test/*.test.mjs",
51
52
  "test:package": "node --test test/package.test.mjs"
52
53
  },
@@ -367,9 +367,11 @@ export class AcpConnection {
367
367
  // digest), then the text question last (it refers to everything before
368
368
  // it). Shapes per the ACP v1 content-block schema; embeddedContext is
369
369
  // advertised in promptCapabilities (verified run 5).
370
- const blocks: Array<Record<string, unknown>> = [
371
- ...images.map((i) => ({ type: "image", data: i.data, mimeType: i.mimeType })),
372
- ];
370
+ const blocks: Array<Record<string, unknown>> = images.map((i) => ({
371
+ type: "image",
372
+ data: i.data,
373
+ mimeType: i.mimeType,
374
+ }));
373
375
  if (contextBlock) {
374
376
  blocks.push({
375
377
  type: "resource",
@@ -402,7 +404,9 @@ export class AcpConnection {
402
404
  cancel(sessionId: string): void {
403
405
  if (!this.#rpc || !this.alive) throw new Error("ACP connection is not running");
404
406
  this.#rpc.notify("session/cancel", { sessionId });
405
- for (const cancel of [...this.#permissionPending]) cancel();
407
+ // Each cancel removes itself from the set, so walk a snapshot.
408
+ const pending = [...this.#permissionPending];
409
+ for (const cancel of pending) cancel();
406
410
  }
407
411
 
408
412
  async closeSession(sessionId: string): Promise<void> {
package/src/acp/driver.ts CHANGED
@@ -148,7 +148,6 @@ export class AcpDriver implements TurnDriver {
148
148
  #opts: AcpDriverOptions;
149
149
  #state: DriverState = "idle";
150
150
  #conn: AcpConnection | undefined;
151
- #generation = 0;
152
151
  #active: ActiveTurn | undefined;
153
152
  #queueTail: Promise<void> = Promise.resolve();
154
153
  #lifecycle: string[] = [];
@@ -683,7 +682,6 @@ export class AcpDriver implements TurnDriver {
683
682
 
684
683
  #ensureConnection(request: DriverTurnRequest): Promise<AcpConnection> {
685
684
  if (this.#conn?.alive) return Promise.resolve(this.#conn);
686
- this.#generation += 1;
687
685
  this.#state = "starting";
688
686
  this.#stats.spawns += 1;
689
687
  const conn = new AcpConnection({
@@ -40,6 +40,8 @@ export const GATE_MARKER = "__agyGate";
40
40
  * Stripped before delegating to the real builtin. */
41
41
  export const MARKER_FIELDS = [GATE_MARKER, "__agyTicket", "__agyTool"] as const;
42
42
 
43
+ // Any registered tool, whatever its schema: Pi's own ToolDefinition defaults its state to `any`.
44
+ // pi-lens-ignore: no-any-type
43
45
  export type AnyToolDefinition = ToolDefinition<any, any, any>;
44
46
 
45
47
  export interface GateDecision {
@@ -155,7 +157,7 @@ export function mapNativeToShadow(name: string, args: Record<string, unknown>):
155
157
  });
156
158
  // Fail closed: a path with no resolvable chunk is a shadow edit
157
159
  // carrying no change information - deny instead of parking it.
158
- if (edits.length === 0 || edits.every((e) => e.oldText === "" && e.newText === "")) return null;
160
+ if (edits.every((e) => e.oldText === "" && e.newText === "")) return null;
159
161
  return { shadow: "edit", input: { path, edits } };
160
162
  }
161
163
  default:
@@ -180,9 +182,9 @@ export interface ShadowOptions {
180
182
  export function createShadowTool(base: AnyToolDefinition, policy: GatePolicy, opts: ShadowOptions = {}): AnyToolDefinition {
181
183
  const execute = async (
182
184
  toolCallId: string,
183
- params: any,
185
+ params: unknown,
184
186
  signal: AbortSignal | undefined,
185
- onUpdate: AgentToolUpdateCallback<any> | undefined,
187
+ onUpdate: AgentToolUpdateCallback<unknown> | undefined,
186
188
  ctx: ExtensionToolContext,
187
189
  ): Promise<AgentToolResult<unknown>> => {
188
190
  const p = (params ?? {}) as Record<string, unknown>;
@@ -124,7 +124,8 @@ export function armBackgroundWatch(opts: BackgroundWatchOptions): BackgroundWatc
124
124
  prev.task = t;
125
125
  }
126
126
  }
127
- for (const id of [...tracked.keys()]) {
127
+ const trackedIds = [...tracked.keys()];
128
+ for (const id of trackedIds) {
128
129
  if (!seen.has(id)) tracked.delete(id);
129
130
  }
130
131
  if (!everSeen) {
package/src/mcp-server.ts CHANGED
@@ -626,7 +626,9 @@ export async function startMcpServer(
626
626
  close: async () => {
627
627
  // Pending approvals fail closed on shutdown: the hook gets a
628
628
  // terminal deny instead of a 404 on its next poll.
629
- for (const [ticket, p] of [...parks]) {
629
+ // settlePark removes the entry, so walk a snapshot.
630
+ const parked = [...parks];
631
+ for (const [ticket, p] of parked) {
630
632
  if (p.terminal) continue;
631
633
  settlePark(ticket, { allow: false, reason: "approval gate bridge shut down" });
632
634
  }
package/src/provider.ts CHANGED
@@ -1359,7 +1359,9 @@ export class ToolRoundTrips {
1359
1359
 
1360
1360
  failAll(reason: string): void {
1361
1361
  this.clearMidTurnSteer();
1362
- for (const id of [...this.#pending.keys()]) {
1362
+ // Failing an entry removes it from the map, so walk a snapshot.
1363
+ const pendingIds = [...this.#pending.keys()];
1364
+ for (const id of pendingIds) {
1363
1365
  const entry = this.#pending.get(id);
1364
1366
  if (entry?.kind === "approval") {
1365
1367
  this.#failApproval(id, reason, "shutdown");
@@ -1802,6 +1804,31 @@ const ACP_EDIT_TOOLS = ACP_MUTATING_TOOLS;
1802
1804
  * path belongs in the compaction read list (#32). */
1803
1805
  const ACP_READ_TOOLS = new Set(["read_file", "view_file"]);
1804
1806
 
1807
+ /** Bridge callId arg of an MCP tool call (bridge_poll_result requires it). */
1808
+ function callIdArg(args: Record<string, unknown>): string | undefined {
1809
+ const v = args.callId;
1810
+ return typeof v === "string" && v.length > 0 ? v : undefined;
1811
+ }
1812
+
1813
+ /** File-path argument of an ACP tool call (observed: `file_path` on edits,
1814
+ * `AbsolutePath` on view_file). Returns undefined when no path-like arg
1815
+ * exists. */
1816
+ function acpFileArg(args: Record<string, unknown>): string | undefined {
1817
+ for (const [k, v] of Object.entries(args)) {
1818
+ if (typeof v === "string" && v.trim() && /file|path/i.test(k)) return v;
1819
+ }
1820
+ return undefined;
1821
+ }
1822
+
1823
+ /** Search-target argument of an ACP search call (observed: grep_search's
1824
+ * `pattern`, search-family `query`). Returns undefined for other calls. */
1825
+ function acpQueryArg(args: Record<string, unknown>): string | undefined {
1826
+ for (const [k, v] of Object.entries(args)) {
1827
+ if (typeof v === "string" && v.trim() && /query|pattern/i.test(k)) return v;
1828
+ }
1829
+ return undefined;
1830
+ }
1831
+
1805
1832
  export function consumeActivity(
1806
1833
  stream: AssistantMessageEventStream,
1807
1834
  blocks: BlockState,
@@ -1839,31 +1866,6 @@ export function consumeActivity(
1839
1866
  }
1840
1867
  if (looksBackgroundNativeCall(activity.args)) feats.onBackgroundArg?.(activity.args);
1841
1868
  return "continue";
1842
- /** Bridge callId arg of an MCP tool call (bridge_poll_result requires it). */
1843
- function callIdArg(args: Record<string, unknown>): string | undefined {
1844
- const v = args.callId;
1845
- return typeof v === "string" && v.length > 0 ? v : undefined;
1846
- }
1847
-
1848
- /** File-path argument of an ACP tool call (observed: `file_path` on edits,
1849
- * `AbsolutePath` on view_file). Returns undefined when no path-like arg
1850
- * exists. */
1851
- function acpFileArg(args: Record<string, unknown>): string | undefined {
1852
- for (const [k, v] of Object.entries(args)) {
1853
- if (typeof v === "string" && v.trim() && /file|path/i.test(k)) return v;
1854
- }
1855
- return undefined;
1856
- }
1857
-
1858
- /** Search-target argument of an ACP search call (observed: grep_search's
1859
- * `pattern`, search-family `query`). Returns undefined for other calls. */
1860
- function acpQueryArg(args: Record<string, unknown>): string | undefined {
1861
- for (const [k, v] of Object.entries(args)) {
1862
- if (typeof v === "string" && v.trim() && /query|pattern/i.test(k)) return v;
1863
- }
1864
- return undefined;
1865
- }
1866
-
1867
1869
  case "tool_done": {
1868
1870
  // Gate C (ACP): the server already executed the tool; nothing parks.
1869
1871
  // Edit display has TWO paths on ACP:
@@ -65,11 +65,9 @@ export function ensureQueuedMessagesInFile(
65
65
  }
66
66
 
67
67
  let settings: Record<string, unknown> = {};
68
- let fileExists = false;
69
68
 
70
69
  try {
71
70
  const raw = fs.readFileSync(resolvedPath, "utf8");
72
- fileExists = true;
73
71
  let parsed: unknown;
74
72
  try {
75
73
  parsed = JSON.parse(raw);
package/src/version.ts CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  import fs from "node:fs";
6
6
 
7
- const FALLBACK_VERSION = "0.0.1";
7
+ const FALLBACK_VERSION = "0.0.2";
8
8
  let cachedVersion: string | undefined;
9
9
 
10
10
  export function getPackageVersion(): string {