@aiti-ai/aiti-attach-agent 0.1.8 → 0.1.9

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 CHANGED
@@ -1,48 +1,38 @@
1
1
  # @aiti-ai/aiti-attach-agent
2
2
 
3
- > Socket 附着已运行 agent 进程 —— 连接 pi TUI bridge;支持环境变量全自动(PI_WEB_BRIDGE_AUTO=1 任何 CLI 会话自动上桥);followUp 排队回显 + 图片附件透传 + 空闲超时退出
3
+ > Socket-attaches to already running agent processes — connects the pi TUI bridge; supports full automation via environment variables (PI_WEB_BRIDGE_AUTO=1 auto-bridges any CLI session); followUp queue echo + image attachment passthrough + idle timeout exit
4
4
 
5
- ## 来源 · Origin
5
+ English · [简体中文](./README.zh-CN.md)
6
6
 
7
- 本包是 **aiti** 生态的组成部分——以 [pi](https://pi.dev) 为引擎的个人 AI 开发工作台与本地调试注入生态:**aiti-agent**(自托管 Web 工作台,基于开源项目 [pi-web](https://github.com/aiti-ai/pi-web) 构建,浏览器为主操作面)+ 各开发工具内的调试注入(aiti-devtools)+ 丰富的扩展体系。
7
+ ## About aiti
8
8
 
9
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
10
 
11
- - 工作台 / workbench: <https://github.com/aiti-ai/pi-web>
12
- - 生态仓库 / monorepo: <https://github.com/aiti-ai/aiti-ai>
13
- - 官网 / site: <https://aiti.pw>
11
+ - Workbench (aiti-agent, built on pi-web): <https://github.com/aiti-ai/pi-web>
12
+ - Ecosystem monorepo: <https://github.com/aiti-ai/aiti-ai>
13
+ - Site: <https://aiti.pw>
14
14
 
15
- ## 功能定位(中文)
15
+ Category: Multi-agent backends · Tags: `attach` · `socket` · `tui` · `session` · `multi-agent`
16
16
 
17
- Socket 附着已运行 agent 进程 —— 连接 pi TUI bridge;支持环境变量全自动(PI_WEB_BRIDGE_AUTO=1 任何 CLI 会话自动上桥);followUp 排队回显 + 图片附件透传 + 空闲超时退出
17
+ ## Install
18
18
 
19
- 多 agent 后端 · tags: `attach` · `socket` · `tui` · `session` · `multi-agent`
19
+ Bundled with **aiti-agent** (`@aiti-ai/pi-web`) — enable it from the in-app extension manager (ExtMan / App Center).
20
20
 
21
- ## Positioning (English)
21
+ Manual install: place this package at `~/.pi/web/extensions/aiti-attach-agent/` and reload pi-web.
22
22
 
23
- Socket-attaches to already running agent processes — connects the pi TUI bridge; supports full automation via environment variables (PI_WEB_BRIDGE_AUTO=1 auto-bridges any CLI session); followUp queue echo + image attachment passthrough + idle timeout exit
24
-
25
- ## 安装 / 部署
26
-
27
- pi-web 端(本包)随 pi-web 部署:
28
-
29
- ```bash
30
- # 部署到 ~/.pi/web/extensions/aiti-attach-agent/ 后 reload
31
- ```
32
-
33
- pi TUI 端(配对包,`/web` 命令 + 自动桥)独立发布为 pi 包,在 pi 里安装:
23
+ The pi TUI side is a separate standalone pi package (the `/web` command + auto-bridge). Install it inside pi:
34
24
 
35
25
  ```bash
36
- pi install @aiti-ai/pi-web-bridge
26
+ pi install npm:@aiti-ai/pi-web-bridge
37
27
  ```
38
28
 
39
- 两侧配对关系:TUI 端起 socket 桥并写 `~/.pi/agent/bridge-registry.json`,本包(pi-web 端)打开会话时查注册表命中即 attach 到该 socket(单写者规则——会话文件仍由 pi 进程独占写入)。`PI_WEB_BRIDGE_AUTO=1` 时 TUI 端每个会话自动上桥,免 `/web`。
29
+ Pairing: the TUI side runs the socket bridge and writes `~/.pi/agent/bridge-registry.json`; when this extension (the pi-web side) opens a session it looks up the registry and attaches to that socket (single-writer rule — the session file remains exclusively owned by the pi process). With `PI_WEB_BRIDGE_AUTO=1`, every TUI session bridges automatically — no `/web` needed.
40
30
 
41
- ## 文档 · Documentation
31
+ ## Documentation
42
32
 
43
- - 中文完整文档(aiti-docs): <https://aiti.pw/extensions/aiti-attach-agent.html>
44
- - English docs: <https://aiti.pw/en/extensions/aiti-attach-agent.html>
45
- - 扩展注册表 / registry: <https://aiti.pw/extensions.html> · machine-readable <https://aiti.pw/extensions.json>
33
+ - Documentation (English): <https://aiti.pw/en/extensions/aiti-attach-agent.html>
34
+ - 文档(中文): <https://aiti.pw/extensions/aiti-attach-agent.html>
35
+ - Extension registry: <https://aiti.pw/extensions.html> · machine-readable <https://aiti.pw/extensions.json>
46
36
 
47
37
  ## License
48
38
 
@@ -0,0 +1,39 @@
1
+ # @aiti-ai/aiti-attach-agent
2
+
3
+ > Socket 附着已运行 agent 进程 —— 连接 pi TUI bridge;支持环境变量全自动(PI_WEB_BRIDGE_AUTO=1 任何 CLI 会话自动上桥);followUp 排队回显 + 图片附件透传 + 空闲超时退出
4
+
5
+ [English](./README.md) · 简体中文
6
+
7
+ ## 关于 aiti
8
+
9
+ 本包是 **aiti** 生态的组成部分——以 [pi](https://pi.dev) 为引擎的个人 AI 开发工作台与本地调试注入生态:**aiti-agent**(自托管 Web 工作台,基于开源项目 [pi-web](https://github.com/aiti-ai/pi-web) 构建,浏览器为主操作面)+ 各开发工具内的调试注入(aiti-devtools)+ 丰富的扩展体系。
10
+
11
+ - 工作台(aiti-agent,基于 pi-web): <https://github.com/aiti-ai/pi-web>
12
+ - 生态仓库: <https://github.com/aiti-ai/aiti-ai>
13
+ - 官网: <https://aiti.pw>
14
+
15
+ 分类: 多 agent 后端 · tags: `attach` · `socket` · `tui` · `session` · `multi-agent`
16
+
17
+ ## 安装
18
+
19
+ 随 **aiti-agent**(`@aiti-ai/pi-web`)捆绑发行——在工作台内的扩展管理器(ExtMan / 应用中心)启用即可。
20
+
21
+ 手动安装:把本包放到 `~/.pi/web/extensions/aiti-attach-agent/` 后 reload。
22
+
23
+ pi TUI 端(配对包,`/web` 命令 + 自动桥)独立发布为 pi 包,在 pi 里安装:
24
+
25
+ ```bash
26
+ pi install npm:@aiti-ai/pi-web-bridge
27
+ ```
28
+
29
+ 两侧配对关系:TUI 端起 socket 桥并写 `~/.pi/agent/bridge-registry.json`,本包(pi-web 端)打开会话时查注册表命中即 attach 到该 socket(单写者规则——会话文件仍由 pi 进程独占写入)。`PI_WEB_BRIDGE_AUTO=1` 时 TUI 端每个会话自动上桥,免 `/web`。
30
+
31
+ ## 文档
32
+
33
+ - 中文文档: <https://aiti.pw/extensions/aiti-attach-agent.html>
34
+ - Documentation (English): <https://aiti.pw/en/extensions/aiti-attach-agent.html>
35
+ - 扩展注册表: <https://aiti.pw/extensions.html> · machine-readable <https://aiti.pw/extensions.json>
36
+
37
+ ## 许可证
38
+
39
+ MIT
package/dev-pack.mjs CHANGED
@@ -77,7 +77,7 @@ export function agentsMdTemplate(extId) {
77
77
 
78
78
  /** 默认 tools/build.mjs(esbuild 单包零配置;扩展自带 tools/build.mjs 则不走到这里)。 */
79
79
  function buildMjsTemplate(extId, extRoot, clientOut, entryRel) {
80
- const repoHint = "/home/pi/workspace/aiti-ai"; // 现场构建探测源码仓 node_modules 用(三机各不同,缺失时走 npm exec)
80
+ // No hardcoded checkout path: candidates are resolved at run time (see repoCandidates below).
81
81
  return `/**
82
82
  * ${extId} · 现场构建入口(dev-pack 默认模板,esbuild 单包零配置)
83
83
  * 用法:node tools/build.mjs
@@ -96,12 +96,25 @@ const entryRel = ${JSON.stringify(entryRel || "")};
96
96
 
97
97
  // esbuild 解析:部署目录 node_modules → 源码仓 node_modules(本机开发场景)→ PATH 上的 esbuild → npm exec 现拉。
98
98
  // 注意:node_modules/esbuild/bin/esbuild 是原生二进制(ELF/Mach-O),必须直接执行(不能当 JS 跑)。
99
+ // Checkout roots are discovered by walking up from the extension dir (a root has node_modules/),
100
+ // plus AITI_REPO_ROOT when set — no machine-specific absolute paths baked into generated files.
101
+ function repoCandidates() {
102
+ const out = [];
103
+ if (process.env.AITI_REPO_ROOT) out.push(process.env.AITI_REPO_ROOT.split(pathSep).join("/") + "/node_modules/esbuild/bin/esbuild");
104
+ let d = extRoot;
105
+ for (let i = 0; i < 8; i++) {
106
+ out.push(d.split(pathSep).join("/") + "/node_modules/esbuild/bin/esbuild");
107
+ const up = dirname(d);
108
+ if (up === d) break;
109
+ d = up;
110
+ }
111
+ return out;
112
+ }
99
113
  function findEsbuild() {
100
114
  const home = (process.env.HOME || process.env.USERPROFILE || "").split(pathSep).join("/");
101
115
  const candidates = [
102
116
  extRoot + "/node_modules/esbuild/bin/esbuild",
103
- home + "/workspace/aiti-ai/node_modules/esbuild/bin/esbuild",
104
- "C:/workspace/aiti-ai/node_modules/esbuild/bin/esbuild", // windows dev box(源码在 D 盘)
117
+ ...repoCandidates(),
105
118
  ];
106
119
  for (const c of candidates) {
107
120
  if (!existsSync(c)) continue;
package/index.ts CHANGED
@@ -446,12 +446,24 @@ const recycleApi = createSessionRecycleApi({
446
446
  export default {
447
447
  id: "aiti-attach-agent",
448
448
  name: "Session Attach (socket 附着后端)",
449
- version: "0.1.0",
450
449
  icon: "🔌",
451
450
 
452
451
  // G1:aiti_bridge_req 转发的桥工具白名单(缺省只读子集;* = 全量)
453
452
  features: [hostToolsAllowFeature()],
454
453
 
454
+
455
+ ui: {
456
+ // English manifest-text overrides (name/description/feature labels); zh source lives in the manifest.
457
+ i18n: {
458
+ "zh-CN": {
459
+ "ext.displayName": "附着会话后端",
460
+ },
461
+ en: {
462
+ "ext.displayName": "Attach Session Backend",
463
+ },
464
+ },
465
+ },
466
+
455
467
  server: {
456
468
  startup(ctx: {
457
469
  sessionProviders: {
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@aiti-ai/aiti-attach-agent",
3
- "version": "0.1.8",
4
- "description": "Socket-attached agent backend — connect pi-web to a running agent process (pi TUI bridge)",
3
+ "version": "0.1.9",
4
+ "description": "; supports full automation via environment variables (PI_WEB_BRIDGE_AUTO=1 auto-bridges any CLI session); followUp queue echo + image attachment passthrough + idle time",
5
5
  "soul": "不抢方向盘——agent 已经在跑,附着上去看就好。",
6
6
  "aitiExtProtocol": "1.0",
7
7
  "dependencies": {
8
- "@aiti-ai/ext-shared": "^0.1.4"
8
+ "@aiti-ai/ext-shared": "^0.1.12"
9
9
  },
10
10
  "license": "MIT",
11
- "contentHash": "768bbc3abc7a5acd",
11
+ "contentHash": "ac4e03aa001d0c09",
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "git+https://github.com/aiti-ai/aiti-ai.git",
package/tools/deploy.mjs CHANGED
@@ -30,7 +30,7 @@ import { notifyReconcile } from "../../_shared/reconcile-deps.mjs";
30
30
 
31
31
  const here = dirname(fileURLToPath(import.meta.url));
32
32
  const pkg = resolve(here, ".."); // pi-web-ext/aiti-attach-agent
33
- const repo = resolve(pkg, "..", ".."); // pi-work 仓库根
33
+ const repo = resolve(pkg, "..", ".."); // repo root
34
34
  const coreBridge = resolve(repo, "packages", "aiti-devtools-core", "src", "bridge.ts");
35
35
  const piPkg = resolve(repo, "packages", "aiti-devtools-pi");
36
36
  const bundleSrc = resolve(piPkg, "dist", "aiti-devtools-pi.js");