askhuman 0.4.3 → 0.5.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.
Files changed (2) hide show
  1. package/README.md +28 -20
  2. package/package.json +6 -6
package/README.md CHANGED
@@ -1,17 +1,25 @@
1
1
  # askhuman
2
2
 
3
- 跨平台「Human-in-the-loop」交互工具。命令行 `AskHuman` 在 AI 助手需要确认/补充时弹出窗口(或经 Telegram / 钉钉 / 飞书)收集人类回应,并把结果按固定区块写到 stdout。
3
+ English | [简体中文](https://github.com/Naituw/AskHuman/blob/main/README.md)
4
4
 
5
- 底层为单一可执行文件(Tauri 2 / Rust)。本 npm 包通过「平台子包」分发:安装时只会拉取与当前平台匹配的一个二进制。
5
+ Cross-platform "human-in-the-loop" interaction tool. When an AI assistant is about to end a conversation or needs confirmation, the `AskHuman` CLI pops up a window (or uses Telegram / Slack / DingTalk / Feishu) so you can ask follow-ups, pick options, add text, or attach images — and the result is returned to the AI.
6
6
 
7
- ## 单独使用
7
+ 跨平台「Human-in-the-loop」交互工具。当 AI 助手准备结束对话或需要确认时,命令行 `AskHuman` 弹出窗口(或经 Telegram / Slack / 钉钉 / 飞书),让你继续提问、勾选选项、补充文字或附带图片,并把结果回传给 AI。
8
+
9
+ <p align="center">
10
+ <img src="https://raw.githubusercontent.com/Naituw/AskHuman/main/assets/channels.webp" alt="Reply to your agent from the local popup, Telegram, Slack, DingTalk, or Feishu" width="900">
11
+ </p>
12
+
13
+ Under the hood it's a single executable (Tauri 2 / Rust). This npm package distributes it via per-platform subpackages: installing fetches only the one binary matching your current platform.
14
+
15
+ ## Standalone use
8
16
 
9
17
  ```bash
10
18
  npm i -g askhuman
11
- AskHuman "要不要继续?" -o "继续" -o "停止"
19
+ AskHuman "Continue?" -o "Continue" -o "Stop"
12
20
  ```
13
21
 
14
- ## 作为依赖(程序集成)
22
+ ## As a dependency (programmatic use)
15
23
 
16
24
  ```bash
17
25
  npm i askhuman
@@ -22,36 +30,36 @@ import { getBinaryPath, isAvailable } from "askhuman";
22
30
  import { spawnSync } from "node:child_process";
23
31
 
24
32
  if (!isAvailable()) {
25
- // 二进制未就位:跳过人工确认环节,避免阻塞流程
33
+ // Binary not in place: skip the human-confirmation step to avoid blocking the flow
26
34
  } else {
27
- const r = spawnSync(getBinaryPath(), ["要继续吗?", "-o", "继续", "-o", "停止"], {
35
+ const r = spawnSync(getBinaryPath(), ["Continue?", "-o", "Continue", "-o", "Stop"], {
28
36
  encoding: "utf8",
29
37
  });
30
38
  if (r.status === 3) {
31
- // 当前环境无任何可用 channelGUI 打不开且未配置会话型渠道):降级处理
39
+ // No usable channel in this environment (GUI can't open and no session channel configured): degrade gracefully
32
40
  } else if (r.status === 0) {
33
- // 成功:解析 r.stdout 的结果区块
41
+ // Success: parse the result blocks from r.stdout
34
42
  console.log(r.stdout);
35
43
  }
36
44
  }
37
45
  ```
38
46
 
39
- `getBinaryPath()` 解析顺序:环境变量 `ASKHUMAN_BINARY`(兼容旧 `HUMANINLOOP_BINARY`)→ 平台子包系统 `PATH`。
47
+ `getBinaryPath()` resolution order: env var `ASKHUMAN_BINARY` (legacy `HUMANINLOOP_BINARY` still works) platform subpackage → system `PATH`.
40
48
 
41
- ## 退出码契约
49
+ ## Exit code contract
42
50
 
43
- | 退出码 | 含义 |
51
+ | Exit code | Meaning |
44
52
  |---|---|
45
- | `0` | 成功拿到结果,或用户取消(输出 `[状态]`) |
46
- | `3` | 无任何可用 channel(本地弹窗打不开且未配置会话型渠道)——下游应降级 |
47
- | `1` | 其他异常 |
53
+ | `0` | Got a result, or the user cancelled (emits `[Status]`) |
54
+ | `3` | No usable channel (local popup can't open and no session channel configured) — downstream should degrade |
55
+ | `1` | Other error |
48
56
 
49
- stdout 只含结果区块(`[选择的选项]`/`[用户输入]`/`[图片]`/`[文件]`/`[状态]`),所有日志与报错走 stderr
57
+ stdout contains only the result blocks (`[Selected options]` / `[User input]` / `[Images]` / `[Files]` / `[Status]`); all logs and errors go to stderr.
50
58
 
51
- ## 平台与系统依赖
59
+ ## Platforms and system dependencies
52
60
 
53
- 支持 macOSarm64/x64)、Windowsx64)、Linuxx64)。
61
+ Supports macOS (arm64/x64), Windows (x64), and Linux (x64).
54
62
 
55
- > Linux 运行 GUI 弹窗需系统具备 WebKitGTK(如 `libwebkit2gtk-4.1`)。若缺失且配置了会话型渠道(Telegram / 钉钉 / 飞书),会自动改走该渠道;若皆不可用,则以退出码 `3` 提示降级。
63
+ > Running the GUI popup on Linux needs system WebKitGTK (e.g. `libwebkit2gtk-4.1`). If it's missing and a session-based channel is configured (Telegram / Slack / DingTalk / Feishu), AskHuman uses that channel automatically; if none is available, it signals degradation with exit code `3`.
56
64
 
57
- 更多信息见项目仓库:<https://github.com/Naituw/AskHuman>
65
+ More info in the project repo: <https://github.com/Naituw/AskHuman>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "askhuman",
3
- "version": "0.4.3",
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.",
3
+ "version": "0.5.1",
4
+ "description": "Human-in-the-loop interaction tool. The `AskHuman` CLI pops up a window (or uses Telegram / Slack / DingTalk / Feishu) to collect a human response and return it to the AI — usable standalone or as a dependency.",
5
5
  "license": "MIT",
6
6
  "author": "Naituw",
7
7
  "homepage": "https://github.com/Naituw/AskHuman",
@@ -33,9 +33,9 @@
33
33
  "prompt"
34
34
  ],
35
35
  "optionalDependencies": {
36
- "@humaninloop/darwin-arm64": "0.4.3",
37
- "@humaninloop/darwin-x64": "0.4.3",
38
- "@humaninloop/win32-x64": "0.4.3",
39
- "@humaninloop/linux-x64": "0.4.3"
36
+ "@humaninloop/darwin-arm64": "0.5.1",
37
+ "@humaninloop/darwin-x64": "0.5.1",
38
+ "@humaninloop/win32-x64": "0.5.1",
39
+ "@humaninloop/linux-x64": "0.5.1"
40
40
  }
41
41
  }