@ssk_dev/rpiv-ask-user-question-lean 2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 kunkun9527
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 ADDED
@@ -0,0 +1,59 @@
1
+ # @ssk_dev/rpiv-ask-user-question-lean
2
+
3
+ > **Lean Pi ask-user-question plugin, same functionality — 215 initialization tokens, 83% fewer than the original.**
4
+ > [See my full setup for Pi](https://github.com/kunkun9527/my-lean-pi-setup)
5
+
6
+ [简体中文](README.zh-CN.md)
7
+
8
+ A token-lean Pi wrapper around [`@juicesharp/rpiv-ask-user-question`](https://github.com/juicesharp/rpiv-mono/tree/main/packages/rpiv-ask-user-question). It preserves structured clarification while reducing model-facing metadata.
9
+
10
+ ## What it keeps
11
+
12
+ - The questionnaire UI and RPC fallback.
13
+ - Input validation, events, and lifecycle behavior.
14
+ - Single-select and multi-select questions, recommendation ordering, and useful previews.
15
+
16
+ ## Why it is lean
17
+
18
+ The wrapper keeps the upstream `ask_user_question` runtime but shortens its tool description and prompt guidance and removes repeated schema descriptions. The complete questionnaire behavior still comes from the pinned upstream package.
19
+
20
+ ## Install
21
+
22
+ ```bash
23
+ pi install npm:@ssk_dev/rpiv-ask-user-question-lean
24
+ ```
25
+
26
+ Do not load it together with another `rpiv-ask-user-question` wrapper, or the tool may be registered twice.
27
+
28
+ ## Use
29
+
30
+ The model sees one tool:
31
+
32
+ ```text
33
+ ask_user_question
34
+ ```
35
+
36
+ Use it when a required user decision is unclear. Each call can ask 1–4 structured questions with 2–4 explicit options per question.
37
+
38
+ ## Measured initialization footprint
39
+
40
+ With only this extension enabled, the lean `ask_user_question` tool contributes an estimated **215 tokens** of recurring model-facing initialization context. The pinned upstream `@juicesharp/rpiv-ask-user-question@2.4.0` tool contributes **1,258 tokens** under the same conditions. That is **1,043 fewer tokens (82.9%)**.
41
+
42
+ The measurement used Pi 0.84.4 and `pi-context-view@0.4.3` in a fresh isolated session, excluding Pi built-in tools, skills, context files, messages, and unrelated extensions. Context View estimates text as `ceil(characters / 4)`, so these are reproducible context-footprint estimates rather than exact GPT tokenizer counts. Runtime-only UI and slash commands are not included because they are not sent to the model.
43
+
44
+ ## Versions
45
+
46
+ The upstream runtime is pinned to `@juicesharp/rpiv-ask-user-question@2.4.0`.
47
+
48
+ ## Development
49
+
50
+ ```bash
51
+ npm ci
52
+ npm run check
53
+ ```
54
+
55
+ The test suite uses a local harness and does not open the real questionnaire UI.
56
+
57
+ ## License and upstream
58
+
59
+ MIT. This project wraps the MIT-licensed [`@juicesharp/rpiv-ask-user-question`](https://github.com/juicesharp/rpiv-mono/tree/main/packages/rpiv-ask-user-question).
@@ -0,0 +1,59 @@
1
+ # @ssk_dev/rpiv-ask-user-question-lean
2
+
3
+ > **Lean Pi ask-user-question 插件,功能相同:215 个初始化 tokens,较原插件减少 83%。**
4
+ > **整套配置:** [查看 Pi Lean Setup](https://github.com/kunkun9527/my-lean-pi-setup)
5
+
6
+ [English](README.md)
7
+
8
+ [`@juicesharp/rpiv-ask-user-question`](https://github.com/juicesharp/rpiv-mono/tree/main/packages/rpiv-ask-user-question) 的 token 精简版 Pi 包装层。它保留结构化需求确认能力,同时减少模型可见元数据。
9
+
10
+ ## 保留的能力
11
+
12
+ - 问卷 UI 和 RPC fallback。
13
+ - 输入验证、事件和生命周期行为。
14
+ - 单选、多选、推荐项排序和有用的预览。
15
+
16
+ ## 为什么更精简
17
+
18
+ 包装层保留上游 `ask_user_question` 运行时,但缩短工具描述和提示指引,并删除重复的 schema 描述。完整问卷行为仍由固定版本的上游包提供。
19
+
20
+ ## 安装
21
+
22
+ ```bash
23
+ pi install npm:@ssk_dev/rpiv-ask-user-question-lean
24
+ ```
25
+
26
+ 不要同时加载另一个 `rpiv-ask-user-question` 包装层,否则工具可能被重复注册。
27
+
28
+ ## 使用
29
+
30
+ 模型只看到一个工具:
31
+
32
+ ```text
33
+ ask_user_question
34
+ ```
35
+
36
+ 当必要的用户决策不明确时使用它。每次调用可以询问 1–4 个结构化问题,每个问题提供 2–4 个明确选项。
37
+
38
+ ## 实测初始化上下文占用
39
+
40
+ 仅启用本扩展时,lean `ask_user_question` 工具会贡献约 **215 tokens** 的持续模型可见初始化上下文。相同条件下,固定版本的上游 `@juicesharp/rpiv-ask-user-question@2.4.0` 工具贡献 **1,258 tokens**,即减少 **1,043 tokens(82.9%)**。
41
+
42
+ 测量使用 Pi 0.84.4 和 `pi-context-view@0.4.3`,在全新隔离会话中只启用目标扩展,并排除 Pi 内置工具、skills、context files、消息及无关扩展。Context View 按 `ceil(字符数 / 4)` 估算,因此这些是可复现的上下文占用估值,不是 GPT tokenizer 的精确计数。未计入不会发送给模型的纯运行时 UI 和 slash commands。
43
+
44
+ ## 版本
45
+
46
+ 上游运行时固定为 `@juicesharp/rpiv-ask-user-question@2.4.0`。
47
+
48
+ ## 开发
49
+
50
+ ```bash
51
+ npm ci
52
+ npm run check
53
+ ```
54
+
55
+ 测试套件使用本地 harness,不会打开真实问卷 UI。
56
+
57
+ ## 许可证与上游
58
+
59
+ MIT。本项目包装了采用 MIT 许可证的 [`@juicesharp/rpiv-ask-user-question`](https://github.com/juicesharp/rpiv-mono/tree/main/packages/rpiv-ask-user-question)。
package/index.ts ADDED
@@ -0,0 +1,54 @@
1
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+ import askUserQuestion from "@juicesharp/rpiv-ask-user-question";
3
+
4
+ const TOOL_DESCRIPTION =
5
+ "Ask 1-4 structured questions when a required user decision is unclear.";
6
+
7
+ const PROMPT_SNIPPET = "";
8
+
9
+ const PROMPT_GUIDELINES = [
10
+ "Each question needs 2-4 options. Put recommendations first with (Recommended); never add Other or Type something. Use multiSelect only for nonexclusive choices and preview only for useful single-select visual comparisons.",
11
+ ];
12
+
13
+ function removeSchemaDescriptions(value: unknown, seen = new Set<object>()): void {
14
+ if (value === null || typeof value !== "object" || seen.has(value)) return;
15
+ seen.add(value);
16
+
17
+ const record = value as Record<string, unknown>;
18
+ delete record.description;
19
+ for (const [key, child] of Object.entries(record)) {
20
+ if (key === "properties" && child !== null && typeof child === "object") {
21
+ for (const propertySchema of Object.values(child as Record<string, unknown>)) {
22
+ removeSchemaDescriptions(propertySchema, seen);
23
+ }
24
+ continue;
25
+ }
26
+ removeSchemaDescriptions(child, seen);
27
+ }
28
+ }
29
+
30
+ export default function (pi: ExtensionAPI): void {
31
+ const leanPi = new Proxy(pi, {
32
+ get(target, property) {
33
+ if (property === "registerTool") {
34
+ return (tool: Parameters<ExtensionAPI["registerTool"]>[0]) => {
35
+ if (tool.name === "ask_user_question") {
36
+ removeSchemaDescriptions(tool.parameters);
37
+ return target.registerTool({
38
+ ...tool,
39
+ description: TOOL_DESCRIPTION,
40
+ promptSnippet: PROMPT_SNIPPET,
41
+ promptGuidelines: PROMPT_GUIDELINES,
42
+ });
43
+ }
44
+ return target.registerTool(tool);
45
+ };
46
+ }
47
+
48
+ const member = Reflect.get(target, property, target);
49
+ return typeof member === "function" ? member.bind(target) : member;
50
+ },
51
+ });
52
+
53
+ askUserQuestion(leanPi);
54
+ }
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@ssk_dev/rpiv-ask-user-question-lean",
3
+ "version": "2.4.0",
4
+ "type": "module",
5
+ "description": "Lean Pi ask-user-question plugin, same functionality — 215 initialization tokens, 83% fewer than the original.",
6
+ "license": "MIT",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "author": "kunkun9527",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/kunkun9527/rpiv-ask-user-question-lean.git"
14
+ },
15
+ "homepage": "https://github.com/kunkun9527/rpiv-ask-user-question-lean#readme",
16
+ "bugs": {
17
+ "url": "https://github.com/kunkun9527/rpiv-ask-user-question-lean/issues"
18
+ },
19
+ "keywords": [
20
+ "pi-package",
21
+ "pi-extension",
22
+ "rpiv",
23
+ "ask-user-question",
24
+ "token-efficient"
25
+ ],
26
+ "files": [
27
+ "index.ts",
28
+ "README.md",
29
+ "README.zh-CN.md",
30
+ "LICENSE"
31
+ ],
32
+ "engines": {
33
+ "node": ">=22.19.0"
34
+ },
35
+ "scripts": {
36
+ "test": "node --test tests/*.test.mjs",
37
+ "typecheck": "tsc -p tsconfig.json",
38
+ "check": "npm run typecheck && npm test"
39
+ },
40
+ "dependencies": {
41
+ "@juicesharp/rpiv-ask-user-question": "2.4.0",
42
+ "@juicesharp/rpiv-i18n": "2.7.1"
43
+ },
44
+ "peerDependencies": {
45
+ "@earendil-works/pi-coding-agent": ">=0.84.1 <1.0.0",
46
+ "@earendil-works/pi-tui": ">=0.84.1 <1.0.0"
47
+ },
48
+ "devDependencies": {
49
+ "@earendil-works/pi-coding-agent": "0.84.3",
50
+ "@earendil-works/pi-tui": "0.84.3",
51
+ "jiti": "2.7.0",
52
+ "typescript": "5.9.3"
53
+ },
54
+ "pi": {
55
+ "extensions": [
56
+ "./index.ts"
57
+ ]
58
+ }
59
+ }