@aiti-ai/aiti-devtools-pi 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +38 -2
- package/package.json +30 -4
- package/src/bridge-url.ts +32 -0
- package/src/cockpit.html +1485 -0
- package/src/index.ts +486 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 aiti-ai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,39 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @aiti-ai/aiti-devtools-pi
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> pi(pi.dev CLI)侧扩展:agent 端无状态连接器,复用 aiti-devtools-agent 接线框架,把 pi CLI 会话接入 aiti-devtools。
|
|
4
|
+
|
|
5
|
+
## 来源 · Origin
|
|
6
|
+
|
|
7
|
+
本包是 **aiti** 生态的组成部分——以 [pi](https://pi.dev) 为引擎的个人 AI 开发工作台与本地调试注入生态:**aiti-agent**(自托管 Web 工作台,基于开源项目 [pi-web](https://github.com/aiti-ai/pi-web) 构建,浏览器为主操作面)+ 各开发工具内的调试注入(aiti-devtools)+ 丰富的扩展体系。
|
|
8
|
+
|
|
9
|
+
This package is part of the **aiti** ecosystem — a personal AI development workbench powered by [pi](https://pi.dev): **aiti-agent** (a self-hosted web workbench built on the open-source [pi-web](https://github.com/aiti-ai/pi-web)) plus debug injection into mainstream dev tools (aiti-devtools) and a rich extension system.
|
|
10
|
+
|
|
11
|
+
- 工作台 / workbench: <https://github.com/aiti-ai/pi-web>
|
|
12
|
+
- 生态仓库 / monorepo: <https://github.com/aiti-ai/aiti-ai>
|
|
13
|
+
- 官网 / site: <https://aiti.pw>
|
|
14
|
+
|
|
15
|
+
## 功能定位(中文)
|
|
16
|
+
|
|
17
|
+
pi(pi.dev CLI)侧扩展:agent 端无状态连接器,复用 aiti-devtools-agent 接线框架,把 pi CLI 会话接入 aiti-devtools。
|
|
18
|
+
|
|
19
|
+
## Positioning (English)
|
|
20
|
+
|
|
21
|
+
pi (pi.dev CLI) side extension: stateless agent-side connector reusing the aiti-devtools-agent wiring framework to bring pi CLI sessions into aiti-devtools.
|
|
22
|
+
|
|
23
|
+
## 安装 / 部署
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install -D @aiti-ai/aiti-devtools-pi
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
不同载体的接线方式见文档(多数一行接入)。
|
|
30
|
+
|
|
31
|
+
## 文档 · Documentation
|
|
32
|
+
|
|
33
|
+
- 中文完整文档(aiti-docs): <https://aiti.pw/devtools/>
|
|
34
|
+
- English docs: <https://aiti.pw/en/devtools/>
|
|
35
|
+
- 扩展注册表 / registry: <https://aiti.pw/extensions.html> · machine-readable <https://aiti.pw/extensions.json>
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiti-ai/aiti-devtools-pi",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "aiti-devtools pi 扩展(agent 端无状态连接器)——注册桥 aiti_* 工具 + 会话/推送,桥独立常驻(packages/aiti-bridge)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"files": [
|
|
9
|
+
"src"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "node tools/build.mjs"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@aiti-ai/aiti-devtools-agent": "0.1.0",
|
|
16
|
+
"@aiti-ai/aiti-devtools-core": "^0.3.5"
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
20
|
+
"typebox": "^0.35.0"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/aiti-ai/aiti-ai.git",
|
|
25
|
+
"directory": "packages/aiti-devtools-pi"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/aiti-ai/aiti-ai#readme",
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/aiti-ai/aiti-ai/issues"
|
|
30
|
+
},
|
|
31
|
+
"contentHash": "822269ad46d04428"
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* bridge-url —— 桥地址协商(纯函数,无依赖;aiti-devtools-pi 专用)
|
|
3
|
+
*
|
|
4
|
+
* 背景(2026-09-15 实锤):pi-web 侧 `_shared/agent-spawn-env.ts` 注入的
|
|
5
|
+
* `AITI_BRIDGE_URL = <piWebSelfBase>/api/extensions/aiti-devtools` 是**给
|
|
6
|
+
* aiti-mcp-shim 的「扩展路径签名」形态**(shim 自行归一为 `<extBase>/mcp/mcp`)。
|
|
7
|
+
* 本扩展(AgentBridgeClient)直接拿它当桥 base 会 404:
|
|
8
|
+
* POST <base>/bridge/agent/register → not found: bridge/agent/register
|
|
9
|
+
* (pi-web 扩展路由要求 mcp/ 前缀才进桥:`p[0] === "mcp"`)。
|
|
10
|
+
* 且 bootstrapBridge 会把该值写回 settings.json 形成自固化。
|
|
11
|
+
*
|
|
12
|
+
* 本模块把「一个地址」归一到本扩展需要的桥 base(含 /mcp 段),与 shim 的
|
|
13
|
+
* EXT_PATH_SIG 语义对齐:
|
|
14
|
+
* …/api/extensions/aiti-devtools[/mcp[/mcp]][/…] → …/api/extensions/aiti-devtools/mcp
|
|
15
|
+
* 其余形态(独立桥 …/aiti、裸 origin、非法 URL)原样返回。
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** pi-web 扩展路径签名(与 aiti-mcp-shim 的 EXT_PATH_SIG 同值) */
|
|
19
|
+
export const PI_WEB_EXT_PATH_SIG = "/api/extensions/aiti-devtools";
|
|
20
|
+
|
|
21
|
+
/** 归一为桥 base:识别 pi-web 扩展路径签名 → `<extBase>/mcp`;否则原样返回。 */
|
|
22
|
+
export function normalizeBridgeBase(url: string): string {
|
|
23
|
+
try {
|
|
24
|
+
const u = new URL(url);
|
|
25
|
+
const idx = u.pathname.indexOf(PI_WEB_EXT_PATH_SIG);
|
|
26
|
+
if (idx < 0) return url;
|
|
27
|
+
const extBase = u.origin + u.pathname.slice(0, idx + PI_WEB_EXT_PATH_SIG.length);
|
|
28
|
+
return extBase + "/mcp";
|
|
29
|
+
} catch {
|
|
30
|
+
return url;
|
|
31
|
+
}
|
|
32
|
+
}
|