askhuman 0.2.0 → 0.4.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/README.md +7 -7
- package/index.d.ts +1 -1
- package/index.js +2 -2
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# askhuman
|
|
2
2
|
|
|
3
|
-
跨平台「Human-in-the-loop」交互工具。命令行 `AskHuman` 在 AI 助手需要确认/补充时弹出窗口(或经 Telegram
|
|
3
|
+
跨平台「Human-in-the-loop」交互工具。命令行 `AskHuman` 在 AI 助手需要确认/补充时弹出窗口(或经 Telegram / 钉钉 / 飞书)收集人类回应,并把结果按固定区块写到 stdout。
|
|
4
4
|
|
|
5
5
|
底层为单一可执行文件(Tauri 2 / Rust)。本 npm 包通过「平台子包」分发:安装时只会拉取与当前平台匹配的一个二进制。
|
|
6
6
|
|
|
@@ -28,7 +28,7 @@ if (!isAvailable()) {
|
|
|
28
28
|
encoding: "utf8",
|
|
29
29
|
});
|
|
30
30
|
if (r.status === 3) {
|
|
31
|
-
// 当前环境无任何可用 channel(GUI
|
|
31
|
+
// 当前环境无任何可用 channel(GUI 打不开且未配置会话型渠道):降级处理
|
|
32
32
|
} else if (r.status === 0) {
|
|
33
33
|
// 成功:解析 r.stdout 的结果区块
|
|
34
34
|
console.log(r.stdout);
|
|
@@ -36,22 +36,22 @@ if (!isAvailable()) {
|
|
|
36
36
|
}
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
`getBinaryPath()` 解析顺序:环境变量 `HUMANINLOOP_BINARY
|
|
39
|
+
`getBinaryPath()` 解析顺序:环境变量 `ASKHUMAN_BINARY`(兼容旧 `HUMANINLOOP_BINARY`)→ 平台子包 → 系统 `PATH`。
|
|
40
40
|
|
|
41
41
|
## 退出码契约
|
|
42
42
|
|
|
43
43
|
| 退出码 | 含义 |
|
|
44
44
|
|---|---|
|
|
45
45
|
| `0` | 成功拿到结果,或用户取消(输出 `[状态]`) |
|
|
46
|
-
| `3` | 无任何可用 channel
|
|
46
|
+
| `3` | 无任何可用 channel(本地弹窗打不开且未配置会话型渠道)——下游应降级 |
|
|
47
47
|
| `1` | 其他异常 |
|
|
48
48
|
|
|
49
|
-
stdout 只含结果区块(`[选择的选项]`/`[用户输入]`/`[图片]`/`[状态]`),所有日志与报错走 stderr。
|
|
49
|
+
stdout 只含结果区块(`[选择的选项]`/`[用户输入]`/`[图片]`/`[文件]`/`[状态]`),所有日志与报错走 stderr。
|
|
50
50
|
|
|
51
51
|
## 平台与系统依赖
|
|
52
52
|
|
|
53
53
|
支持 macOS(arm64/x64)、Windows(x64)、Linux(x64)。
|
|
54
54
|
|
|
55
|
-
> Linux 运行 GUI 弹窗需系统具备 WebKitGTK(如 `libwebkit2gtk-4.1
|
|
55
|
+
> Linux 运行 GUI 弹窗需系统具备 WebKitGTK(如 `libwebkit2gtk-4.1`)。若缺失且配置了会话型渠道(Telegram / 钉钉 / 飞书),会自动改走该渠道;若皆不可用,则以退出码 `3` 提示降级。
|
|
56
56
|
|
|
57
|
-
更多信息见项目仓库:<https://github.com/Naituw/
|
|
57
|
+
更多信息见项目仓库:<https://github.com/Naituw/AskHuman>
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
// 解析当前平台的 AskHuman 二进制路径,供下游程序集成调用。
|
|
4
|
-
// 解析顺序:环境变量 HUMANINLOOP_BINARY
|
|
4
|
+
// 解析顺序:环境变量 ASKHUMAN_BINARY(兼容旧 HUMANINLOOP_BINARY)→ 平台子包 → 系统 PATH。
|
|
5
5
|
|
|
6
6
|
const fs = require("fs");
|
|
7
7
|
const path = require("path");
|
|
@@ -39,7 +39,7 @@ function isExecutableFile(p) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
function fromEnv() {
|
|
42
|
-
const p = process.env.HUMANINLOOP_BINARY;
|
|
42
|
+
const p = process.env.ASKHUMAN_BINARY || process.env.HUMANINLOOP_BINARY;
|
|
43
43
|
return p && fs.existsSync(p) ? p : null;
|
|
44
44
|
}
|
|
45
45
|
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "askhuman",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Human-in-the-loop interaction tool. The `AskHuman` CLI pops up a window (or uses Telegram) to collect human input and prints the result to stdout — usable standalone or as a dependency.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Naituw",
|
|
7
|
-
"homepage": "https://github.com/Naituw/
|
|
7
|
+
"homepage": "https://github.com/Naituw/AskHuman",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/Naituw/
|
|
10
|
+
"url": "git+https://github.com/Naituw/AskHuman.git"
|
|
11
11
|
},
|
|
12
12
|
"type": "commonjs",
|
|
13
13
|
"main": "index.js",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"prompt"
|
|
34
34
|
],
|
|
35
35
|
"optionalDependencies": {
|
|
36
|
-
"@humaninloop/darwin-arm64": "0.
|
|
37
|
-
"@humaninloop/darwin-x64": "0.
|
|
38
|
-
"@humaninloop/win32-x64": "0.
|
|
39
|
-
"@humaninloop/linux-x64": "0.
|
|
36
|
+
"@humaninloop/darwin-arm64": "0.4.0",
|
|
37
|
+
"@humaninloop/darwin-x64": "0.4.0",
|
|
38
|
+
"@humaninloop/win32-x64": "0.4.0",
|
|
39
|
+
"@humaninloop/linux-x64": "0.4.0"
|
|
40
40
|
}
|
|
41
41
|
}
|