@agimon-ai/doompi-user-feedback 0.0.1-alpha.10 → 0.0.1-alpha.11

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 +79 -36
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,61 +1,104 @@
1
1
  # @agimon-ai/doompi-user-feedback
2
2
 
3
- **Sometimes the agent needs an answer. Make it ask.**
3
+ Structured, blocking user questions for Pi, with an autonomous-Voice handoff.
4
4
 
5
- This package provides the structured `ask_user_question` interaction for Pi. In a normal
6
- terminal session it opens a blocking questionnaire and returns the selected answer to the
7
- agent. The question does not get buried in prose and the turn does not continue on a
8
- guess.
5
+ The `ask_user_question` tool presents concrete options instead of asking the model to continue on a guess.
9
6
 
10
- In autonomous Voice mode there is no modal to click. The extension formats the choices as
11
- plain text, hands them to narration, terminates the turn, and accepts the next spoken reply
12
- as an ordinary user message.
7
+ > **Alpha:** tool and Voice-handoff contracts may change between releases.
13
8
 
14
- This implementation is written for Pi and has no dependency on the old Juicesharp
15
- packages. It keeps the established `rpiv:ask-user:prompt` and `rpiv:ask-user:blocked`
16
- channel names so existing Doompi listeners can migrate without being rewritten.
9
+ ## Requirements
17
10
 
18
- This is part of [Doompi](https://www.npmjs.com/package/@agimon-ai/doompi). The bundled
19
- `ask-user` layer loads it where structured feedback is wanted.
11
+ - Node.js 22.19.0 or newer
12
+ - Pi 0.84.2 and Pi TUI 0.84.2
20
13
 
21
14
  ## Install
22
15
 
23
- ```bash
24
- npm install @agimon-ai/doompi-user-feedback
25
- ```
26
-
27
- ## How it loads
28
-
29
- Put the bare package name in a layer, then add that layer to a major mode:
16
+ Add the package to a DoomPi layer:
30
17
 
31
18
  ```yaml
32
19
  layers:
33
- ask-user:
20
+ feedback:
34
21
  packages: ['@agimon-ai/doompi-user-feedback']
22
+ ```
23
+
24
+ For standalone Pi:
35
25
 
36
- majorMode:
37
- dev:
38
- description: Development mode with structured user clarification.
39
- layers: [ask-user]
26
+ ```bash
27
+ pi install npm:@agimon-ai/doompi-user-feedback
28
+ ```
29
+
30
+ ## Ask a question
31
+
32
+ ```json
33
+ {
34
+ "questions": [
35
+ {
36
+ "header": "Storage",
37
+ "question": "Where should session results be stored?",
38
+ "options": [
39
+ {
40
+ "label": "Project files",
41
+ "description": "Easy to inspect and commit, but visible in the repository."
42
+ },
43
+ {
44
+ "label": "User state",
45
+ "description": "Keeps generated state outside the repository."
46
+ }
47
+ ],
48
+ "multiSelect": false
49
+ }
50
+ ]
51
+ }
40
52
  ```
41
53
 
42
- The package's Pi manifest selects the Pi adapter. The explicit `/extensions/pi` subpath
43
- remains available when an adapter path is required.
54
+ A call accepts 1–4 questions. Each question requires 2–4 options. Headers are at most 16 characters; option labels are at most 60 characters. Use `multiSelect: true` when several choices are valid. An option can include a Markdown `preview` for meaningful visual comparison.
55
+
56
+ The tool result contains readable answer text plus structured `details.answers`; cancellation sets `cancelled: true`. Pressing Escape declines the questionnaire. Do not add an `Other` option because the UI supplies a custom-text row.
57
+
58
+ ## UI, RPC, and headless behavior
59
+
60
+ The tool requires an interactive UI. It uses the TUI questionnaire when available and can use Pi's dialog/RPC UI bridge. A truly headless context returns a structured `no_ui` cancellation rather than waiting forever.
44
61
 
45
- ## Reusable voice handoff
62
+ Questionnaires are coordinated one at a time. Cancellation, session replacement, or shutdown aborts the active prompt and settles queued work.
46
63
 
47
- `@agimon-ai/doompi-user-feedback/voice-question-handoff` exposes the same minor-mode
48
- detection, plain-text formatting, and narration handoff to other tools.
49
- `createVoiceQuestionHandoff()` returns a session-scoped handle; call `dispose()` when its
50
- session ends so subscriptions do not outlive their owner.
64
+ ## Autonomous Voice handoff
51
65
 
52
- Voice results include the readable question, set `terminate: true`, and mark the turn as
53
- waiting for a response. The answer then arrives through the normal user-message path.
66
+ When autonomous Voice mode is active, the extension formats the questions as plain text, requests narration, and returns `terminate: true`. The current turn ends while waiting; the next spoken answer arrives as a normal user message rather than a synthetic questionnaire selection.
67
+
68
+ Reusable integrations can create a session-scoped handoff:
69
+
70
+ ```ts
71
+ import { createVoiceQuestionHandoff } from '@agimon-ai/doompi-user-feedback/voice-question-handoff';
72
+ import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
73
+
74
+ export function installVoiceHandoff(pi: ExtensionAPI, sessionId: string): () => void {
75
+ const handoff = createVoiceQuestionHandoff({
76
+ bus: pi.events,
77
+ source: '@example/review-extension',
78
+ sessionId,
79
+ });
80
+ return () => handoff.dispose();
81
+ }
82
+ ```
83
+
84
+ Always dispose the handle during shutdown.
54
85
 
55
86
  ## Public API
56
87
 
57
- The package exports the extension, event names, reusable voice handoff, and Pi adapter
58
- through supported subpaths.
88
+ ```ts
89
+ import { registerUserFeedbackExtension } from '@agimon-ai/doompi-user-feedback';
90
+ ```
91
+
92
+ Event constants are available through `/events`; the Pi adapter is `/extensions/pi`.
93
+
94
+ ## Development
95
+
96
+ ```bash
97
+ pnpm build
98
+ pnpm typecheck
99
+ pnpm test
100
+ pnpm lint
101
+ ```
59
102
 
60
103
  ## License
61
104
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/doompi-user-feedback",
3
- "version": "0.0.1-alpha.10",
3
+ "version": "0.0.1-alpha.11",
4
4
  "description": "Structured user feedback for DoomPi agents",
5
5
  "keywords": [
6
6
  "ai",
@@ -50,8 +50,8 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "typebox": "1.1.38",
53
- "@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.21",
54
- "@agimon-ai/doompi-ui": "0.0.1-alpha.21"
53
+ "@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.22",
54
+ "@agimon-ai/doompi-ui": "0.0.1-alpha.22"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@earendil-works/pi-coding-agent": "0.84.2",