pi-devin-search 0.1.0 → 0.1.1

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,32 +1,85 @@
1
1
  # pi-devin-search
2
2
 
3
- Native [pi](https://pi.dev) CLI extension for Devin web search and read-only local code search. It does not include a desktop or React UI and does not depend on DeepSeek Harness.
3
+ 适用于 [Pi Coding Agent](https://pi.dev) 的原生扩展,提供基于 Devin 官方接口的联网搜索(`web_search`)与本地代码库只读检索(`code_search`)。
4
4
 
5
- Tested host: `@earendil-works/pi-coding-agent@1.0.3` and `@earendil-works/pi-ai@1.0.3`. Pi supplies those packages and `typebox@1.3.27`; this package lists them as exact peers and does not bundle them. `ignore@7.0.5` is a runtime dependency. The published `dist/extension.js` bundles the search and OAuth core and contains no DSH runtime.
5
+ 本扩展独立运行于 Pi CLI 环境,无需图形界面支持,不依赖 DeepSeek Harness 运行时。
6
+
7
+ ## 功能特性
8
+
9
+ - **联网搜索 (`web_search`)**:通过 Devin 服务检索公开互联网信息并返回结构化引用来源。
10
+ - **本地代码检索 (`code_search`)**:受控只读代码检索,在当前工作区(cwd)内执行有界结构化搜索,支持代码库定位。
11
+ - **标准认证体系**:基于 PKCE 协议实现授权码登录,凭据在本地严格隔离存储。
12
+ - **细粒度工具控制**:支持按需独立启用或禁用特定搜索工具。
13
+
14
+ ## 安装指南
15
+
16
+ ### 从 npm 安装(推荐)
17
+
18
+ 在 Pi 终端中执行:
19
+
20
+ ```bash
21
+ pi install npm:pi-devin-search
22
+ ```
23
+
24
+ ### 本地路径安装(开发与调试)
25
+
26
+ 指定扩展包本地路径安装:
6
27
 
7
28
  ```bash
8
- pi install ./packages/pi-devin-search
9
- # or, after publish: pi install npm:pi-devin-search@0.1.0
29
+ pi install /path/to/dsh-plugin-devin/packages/pi-devin-search
10
30
  ```
11
31
 
12
- ## Commands
32
+ 或在单次会话中临时加载:
33
+
34
+ ```bash
35
+ pi -e /path/to/dsh-plugin-devin/packages/pi-devin-search/dist/extension.js
36
+ ```
37
+
38
+ ## 命令与认证
39
+
40
+ 扩展注册了以下交互管理命令:
41
+
42
+ | 命令 | 说明 |
43
+ | :--- | :--- |
44
+ | `/devin-login` | 发起 PKCE 授权流程。获取授权码后在专用交互输入框中提交。 |
45
+ | `/devin-login local` | 本机环境专用:通过本地临时回调(`127.0.0.1`)完成登录。 |
46
+ | `/devin-status` | 查看当前会话状态及有效期(脱敏展示,不输出敏感令牌)。 |
47
+ | `/devin-settings` | 交互式查看并调整工具启用状态。 |
48
+ | `/devin-settings web on\|off` | 开启或禁用 `web_search` 工具。 |
49
+ | `/devin-settings code on\|off` | 开启或禁用 `code_search` 工具。 |
50
+ | `/devin-logout` | 取消在途请求并删除本地持久化凭据。 |
51
+ | `/devin-cancel` | 取消等待中的登录交互流程。 |
52
+
53
+ > **安全须知**:请勿将授权码直接附加在命令参数或输入在对话内容中。系统会在独立安全的输入界面中接收授权码。
54
+
55
+ ## 工具行为与运行约束
56
+
57
+ - **默认状态**:初次安装或登录后,`web_search` 与 `code_search` 默认均为开启状态。
58
+ - **启动白名单 (`--tools`) 兼容说明**:
59
+ 若启动 Pi 时显式指定了 `--tools` 过滤参数,Pi 将基于全局白名单过滤所有工具(含扩展工具)。此时必须将所需工具显式加入参数,例如:
60
+ ```bash
61
+ pi --tools read,web_search,code_search
62
+ ```
63
+ 修改启动参数需完全重启 Pi 进程生效(`/reload` 不会变更进程级参数白名单)。
64
+ - **代码检索安全沙箱**:
65
+ - 检索范围严格限定在启动 Pi 时的当前工作目录(cwd)以内,禁止跨目录逃逸。
66
+ - 严格遵守目录内 `.gitignore` 规则,自动跳过敏感配置文件(如 `.env`、密钥凭据及私钥证书)与大型二进制文件。
67
+ - 所有工具调用均为只读模式(`readOnlyHint: true`),不具备文件写入与系统命令执行权限。
13
68
 
14
- - `/devin-login` starts PKCE code login. `/devin-login local` uses an optional localhost callback.
15
- - `/devin-status` shows login state without credentials.
16
- - `/devin-logout` cancels in-flight work and deletes the stored session.
17
- - `/devin-cancel` cancels a pending login.
18
- - `/devin-settings` with no arguments opens a selector. `/devin-settings web|code on|off` changes one switch.
69
+ ## 凭据存储与隐私
19
70
 
20
- Do not paste an authorization code into a slash argument. The command rejects anything other than empty or `local` and does not echo the argument. The code prompt uses `ctx.ui.input`. That input is ordinary visible text, not a masked field. Noninteractive print/JSON login is refused. Status uses `ctx.ui.notify` and `setStatus` only, so it does not write tokens to stdout.
71
+ - **存储路径**:`<getAgentDir()>/devin-search/credentials.json`
72
+ - **文件权限**:采用 POSIX `0600` 严格权限模式。不读取 Pi 系统自带的 `auth.json`,与宿主其他凭据完全解耦。
73
+ - **配置持久化**:用户功能配置独立持久化于 `devin-search/settings.json`。
21
74
 
22
- If starting pi with a `--tools` allowlist, include both search tools, for example `--tools read,web_search,code_search`. On pi 1.0.3 the allowlist also applies to extension tools: `--tools read` excludes both searches even if Devin login succeeds. Restart pi after changing this startup flag; `/reload` does not change the allowlist.
75
+ ---
23
76
 
24
- Tools `web_search` and `code_search` are registered at `session_start` after `getAllTools()`. A name already owned by another extension is left unchanged. Both tools are annotated read-only with `openWorldHint: true` because queries and selected code are sent to the Devin cloud. Disabling a tool in settings is enforced inside `execute`, not only by removing it from the active set.
77
+ ## 友情链接
25
78
 
26
- ## Credentials
79
+ [Linux.Do](https://linux.do) — 新的理想型社区
27
80
 
28
- Sessions are stored at `<getAgentDir()>/devin-search/credentials.json`. Temporary writes use `credential-*.tmp`. This package does not read pi `auth.json`, DSH credentials, or project `.pi` trees. There is no cross-process writer lock: in-process writes are serialized, and `rename` is atomic, but two processes can lose updates. Do not share one credential file across processes.
81
+ ---
29
82
 
30
- POSIX mode bits 0700/0600 are applied. They are not an equivalent confidentiality boundary on Windows. After rename, POSIX directory fsync is skipped on Windows so a successful rename is not failed by a POSIX-only directory open. Windows filesystem behavior was not validated in this environment. There is no ACL or keychain store.
83
+ ### License
31
84
 
32
- Settings are independent booleans in `devin-search/settings.json`. They are not secrets.
85
+ [MIT](./LICENSE) — 所有源码、会话记录与凭证默认存储于用户本地,尊重代码主权与数据隐私。
package/dist/extension.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/extension.ts
2
2
  import { getAgentDir } from "@earendil-works/pi-coding-agent";
3
- import { Type } from "@earendil-works/pi-ai";
3
+ import { Type } from "typebox";
4
4
 
5
5
  // ../../src/local.ts
6
6
  import { constants } from "node:fs";
@@ -1881,7 +1881,7 @@ function install(pi, deps = {}) {
1881
1881
  const value = await ctx.ui.input(
1882
1882
  "Devin authorization code",
1883
1883
  "Paste the code. This input is visible, not masked.",
1884
- { signal, timeout: 3e5 }
1884
+ { signal, timeout: 3e5, blockedKind: "auth" }
1885
1885
  );
1886
1886
  if (!value) return fail("cancelled", "Devin operation cancelled or timed out.");
1887
1887
  return value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-devin-search",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Native pi CLI extension for Devin web and local code search",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -19,13 +19,13 @@
19
19
  "ignore": "7.0.5"
20
20
  },
21
21
  "peerDependencies": {
22
- "@earendil-works/pi-ai": "1.0.3",
23
- "@earendil-works/pi-coding-agent": "1.0.3",
22
+ "@earendil-works/pi-ai": ">=1.0.3 <2.0.0",
23
+ "@earendil-works/pi-coding-agent": ">=1.0.3 <2.0.0",
24
24
  "typebox": "1.3.27"
25
25
  },
26
26
  "devDependencies": {
27
- "@earendil-works/pi-ai": "1.0.3",
28
- "@earendil-works/pi-coding-agent": "1.0.3",
27
+ "@earendil-works/pi-ai": "1.6.1",
28
+ "@earendil-works/pi-coding-agent": "1.6.1",
29
29
  "@types/node": "22.19.0",
30
30
  "esbuild": "0.28.2",
31
31
  "typebox": "1.3.27",