@fadhelhaidar/pi-ask-user 1.0.4 → 1.1.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 +4 -2
- package/dist/chunks/{index-x7fb685n.js → index-n7wxhdmh.js} +77 -1
- package/dist/chunks/index-pen3t92h.js +7 -0
- package/dist/chunks/{questionnaire-session-j2wmt696.js → questionnaire-session-m053x4ka.js} +238 -190
- package/dist/events.d.ts +78 -0
- package/dist/events.js +6 -2
- package/dist/index.d.ts +6 -0
- package/dist/index.js +570 -74
- package/dist/locales/de.json +26 -29
- package/dist/locales/en.json +31 -27
- package/dist/locales/es.json +26 -29
- package/dist/locales/fr.json +26 -29
- package/dist/locales/pt-BR.json +26 -29
- package/dist/locales/pt.json +26 -29
- package/dist/locales/ru.json +26 -29
- package/dist/locales/uk.json +26 -29
- package/dist/locales/zh.json +28 -31
- package/docs/configuration.md +14 -0
- package/docs/hosts.md +48 -4
- package/docs/keyboard.md +33 -13
- package/docs/localization.md +7 -2
- package/docs/tool-schema.md +38 -6
- package/package.json +1 -1
- package/dist/chunks/index-bx2tbz93.js +0 -5
package/dist/events.d.ts
CHANGED
|
@@ -21,6 +21,11 @@
|
|
|
21
21
|
export declare const ASK_USER_PROMPT_EVENT: "rpiv:ask-user:prompt";
|
|
22
22
|
export interface AskUserPromptEventPayload {
|
|
23
23
|
questions: ReadonlyArray<AskUserPromptQuestion>;
|
|
24
|
+
/**
|
|
25
|
+
* The tool call's id — always set. Names this questionnaire on
|
|
26
|
+
* `ASK_USER_BLOCKED_EVENT` and `ASK_USER_ANSWER_EVENT`.
|
|
27
|
+
*/
|
|
28
|
+
toolCallId?: string;
|
|
24
29
|
}
|
|
25
30
|
/**
|
|
26
31
|
* Emitted while the questionnaire is awaiting user input (TUI `ui.custom` and
|
|
@@ -31,6 +36,11 @@ export declare const ASK_USER_BLOCKED_EVENT: "rpiv:ask-user:blocked";
|
|
|
31
36
|
export interface AskUserBlockedEventPayload {
|
|
32
37
|
/** True while input is awaited; false when the wait ends (answer, cancel, or error). */
|
|
33
38
|
active: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* The tool call's id — always set. Several questionnaires can be open at once,
|
|
41
|
+
* so pair `active: false` with the prompt it closes by this id.
|
|
42
|
+
*/
|
|
43
|
+
toolCallId?: string;
|
|
34
44
|
}
|
|
35
45
|
export interface AskUserPromptQuestion {
|
|
36
46
|
/**
|
|
@@ -51,3 +61,71 @@ export interface AskUserPromptOption {
|
|
|
51
61
|
/** True iff the option carries rich preview content (content not shipped). */
|
|
52
62
|
hasPreview: boolean;
|
|
53
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* INBOUND — the only event in this contract the package listens for rather than
|
|
66
|
+
* emits. Answers (or cancels) one open questionnaire without the TUI keystroke
|
|
67
|
+
* path, so a program driving Pi from outside — a pane supervisor, a phone or web
|
|
68
|
+
* bridge, a test harness — need not synthesize keys against a rendered dialog.
|
|
69
|
+
*
|
|
70
|
+
* `toolCallId` names the questionnaire: the id carried by its
|
|
71
|
+
* `ASK_USER_PROMPT_EVENT`. It is accepted from the moment that prompt is emitted
|
|
72
|
+
* (before the dialog is on screen) until the questionnaire closes; the first
|
|
73
|
+
* answer wins, whether typed in the terminal or sent here.
|
|
74
|
+
*
|
|
75
|
+
* Validation is strict and all-or-nothing: every question answered, every index
|
|
76
|
+
* in range, nothing duplicated — or nothing is applied and the dialog stays open.
|
|
77
|
+
* A partially applied answer would reach the model indistinguishable from one
|
|
78
|
+
* the user gave. Unknown fields are ignored (policy rule 2).
|
|
79
|
+
*
|
|
80
|
+
* Every attempt gets one verdict on `ASK_USER_ANSWER_RESULT_EVENT`; this payload
|
|
81
|
+
* carries no callback because payloads must survive JSON serialization.
|
|
82
|
+
*/
|
|
83
|
+
export declare const ASK_USER_ANSWER_EVENT: "rpiv:ask-user:answer";
|
|
84
|
+
export interface AskUserAnswerEventPayload {
|
|
85
|
+
/** The questionnaire to answer — `toolCallId` from its prompt event. */
|
|
86
|
+
toolCallId: string;
|
|
87
|
+
/** Echoed back on the verdict so an emitter can pair it with this request. */
|
|
88
|
+
requestId?: string;
|
|
89
|
+
/** One entry per question. Omitted (or empty) only with `cancel`. */
|
|
90
|
+
answers?: ReadonlyArray<AskUserAnswerEntry>;
|
|
91
|
+
/** Note for the whole questionnaire — what `n` on the Submit tab attaches in the TUI. */
|
|
92
|
+
globalNote?: string;
|
|
93
|
+
/** Decline the questionnaire, as Esc does: the model is told the user declined. */
|
|
94
|
+
cancel?: boolean;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* One question's answer. Single-select takes exactly one of `optionIndexes`
|
|
98
|
+
* (one index) or `text`; multi-select takes either or both, like the TUI's
|
|
99
|
+
* checked options plus its `Type something.` row.
|
|
100
|
+
*/
|
|
101
|
+
export interface AskUserAnswerEntry {
|
|
102
|
+
/** 0-based index into the prompt's `questions`. */
|
|
103
|
+
questionIndex: number;
|
|
104
|
+
/** 0-based, distinct indices into the question's `options`. */
|
|
105
|
+
optionIndexes?: readonly number[];
|
|
106
|
+
/** Custom answer — what the `Type something.` row produces. Must not be blank. */
|
|
107
|
+
text?: string;
|
|
108
|
+
/** Note on this question — what the `n` key attaches in the TUI. */
|
|
109
|
+
notes?: string;
|
|
110
|
+
}
|
|
111
|
+
/** Verdict for an `ASK_USER_ANSWER_EVENT`. One per attempt, accepted or not. */
|
|
112
|
+
export declare const ASK_USER_ANSWER_RESULT_EVENT: "rpiv:ask-user:answer-result";
|
|
113
|
+
/**
|
|
114
|
+
* Why an answer was refused — branch on this, not on `reason`:
|
|
115
|
+
* - `not_found`: no open questionnaire has that `toolCallId` (never opened, or already closed).
|
|
116
|
+
* - `invalid_payload`: a field is missing or has the wrong type.
|
|
117
|
+
* - `invalid_answer`: well-formed, but does not fit the questions (missing, duplicated, out of range).
|
|
118
|
+
* - `unsupported_host`: the questionnaire runs in an RPC host's own dialogs, which cannot be answered here.
|
|
119
|
+
*/
|
|
120
|
+
export type AskUserAnswerRejectCode = "not_found" | "invalid_payload" | "invalid_answer" | "unsupported_host";
|
|
121
|
+
export interface AskUserAnswerResultEventPayload {
|
|
122
|
+
ok: boolean;
|
|
123
|
+
/** Set when `ok` is false. */
|
|
124
|
+
code?: AskUserAnswerRejectCode;
|
|
125
|
+
/** Human-readable detail for logs. Wording may change — do not parse it. */
|
|
126
|
+
reason?: string;
|
|
127
|
+
/** Echoed from the request when it was a string. */
|
|
128
|
+
requestId?: string;
|
|
129
|
+
/** Echoed from the request when it was a string. */
|
|
130
|
+
toolCallId?: string;
|
|
131
|
+
}
|
package/dist/events.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ASK_USER_PROMPT_EVENT2,
|
|
3
|
-
ASK_USER_BLOCKED_EVENT2
|
|
4
|
-
|
|
3
|
+
ASK_USER_BLOCKED_EVENT2,
|
|
4
|
+
ASK_USER_ANSWER_EVENT2,
|
|
5
|
+
ASK_USER_ANSWER_RESULT_EVENT2
|
|
6
|
+
} from "./chunks/index-pen3t92h.js";
|
|
5
7
|
export {
|
|
8
|
+
ASK_USER_ANSWER_EVENT2 as ASK_USER_ANSWER_EVENT,
|
|
9
|
+
ASK_USER_ANSWER_RESULT_EVENT2 as ASK_USER_ANSWER_RESULT_EVENT,
|
|
6
10
|
ASK_USER_BLOCKED_EVENT2 as ASK_USER_BLOCKED_EVENT,
|
|
7
11
|
ASK_USER_PROMPT_EVENT2 as ASK_USER_PROMPT_EVENT
|
|
8
12
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
|
|
3
3
|
export {
|
|
4
|
+
ASK_USER_ANSWER_EVENT,
|
|
5
|
+
ASK_USER_ANSWER_RESULT_EVENT,
|
|
4
6
|
ASK_USER_BLOCKED_EVENT,
|
|
5
7
|
ASK_USER_PROMPT_EVENT,
|
|
8
|
+
type AskUserAnswerEntry,
|
|
9
|
+
type AskUserAnswerEventPayload,
|
|
10
|
+
type AskUserAnswerRejectCode,
|
|
11
|
+
type AskUserAnswerResultEventPayload,
|
|
6
12
|
type AskUserBlockedEventPayload,
|
|
7
13
|
type AskUserPromptEventPayload,
|
|
8
14
|
type AskUserPromptOption,
|