@mrclrchtr/supi-prompt-improver 11.3.0 → 12.0.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/CHANGELOG.md +4 -0
- package/node_modules/@mrclrchtr/supi-ask-user/CHANGELOG.md +9 -0
- package/node_modules/@mrclrchtr/supi-ask-user/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-ask-user/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-ask-user/src/form-api.ts +5 -4
- package/node_modules/@mrclrchtr/supi-ask-user/src/schema.ts +66 -54
- package/node_modules/@mrclrchtr/supi-ask-user/src/tool/ask_user/spec.ts +6 -0
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [12.0.0]
|
|
4
|
+
|
|
5
|
+
- **Breaking:** `ask_user` rejects unknown fields on the form, its questions, and their options instead of ignoring them.
|
|
6
|
+
- `ask_user` now declares read-only tool annotations, so permission extensions that read `pi.getAllTools()` do not ask for confirmation before showing a form ([#582](https://github.com/mrclrchtr/supi/issues/582)).
|
|
7
|
+
|
|
8
|
+
## [11.4.0]
|
|
9
|
+
|
|
10
|
+
- Overlay forms now report Pi as waiting for your answer on terminals that show program status, like inline forms.
|
|
11
|
+
|
|
3
12
|
## [11.3.0]
|
|
4
13
|
|
|
5
14
|
- Added package-specific release notes for structured questions and reusable decision forms.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrclrchtr/supi-ask-user",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"description": "Structured choice and text forms for agent-user decisions",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"!__tests__"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@mrclrchtr/supi-core": "
|
|
36
|
+
"@mrclrchtr/supi-core": "12.0.0"
|
|
37
37
|
},
|
|
38
38
|
"bundledDependencies": [
|
|
39
39
|
"@mrclrchtr/supi-core"
|
|
@@ -52,7 +52,7 @@ export interface OpenAskUserFormOptions {
|
|
|
52
52
|
*
|
|
53
53
|
* This API does not persist results, label transcript entries, or abort a Pi
|
|
54
54
|
* agent turn. It uses Pi's editor area by default and one shared lock for all callers.
|
|
55
|
-
* Inline forms report that Pi is waiting for an answer
|
|
55
|
+
* Inline and overlay forms report that Pi is waiting for an answer until the form closes.
|
|
56
56
|
*/
|
|
57
57
|
export async function openAskUserForm(
|
|
58
58
|
questionnaire: NormalizedQuestionnaire,
|
|
@@ -85,9 +85,10 @@ export async function openAskUserForm(
|
|
|
85
85
|
options.onAcquire?.();
|
|
86
86
|
return factory(tui, theme, keybindings, done);
|
|
87
87
|
},
|
|
88
|
-
|
|
89
|
-
? { overlay: true }
|
|
90
|
-
|
|
88
|
+
{
|
|
89
|
+
...(options.overlay ? { overlay: true } : {}),
|
|
90
|
+
blocked: { kind: "question", message: "Waiting for your answer" },
|
|
91
|
+
},
|
|
91
92
|
),
|
|
92
93
|
},
|
|
93
94
|
signal: options.signal,
|
|
@@ -3,21 +3,24 @@
|
|
|
3
3
|
import { type Static, Type } from "typebox";
|
|
4
4
|
import { ASK_USER_LIMITS } from "./types.ts";
|
|
5
5
|
|
|
6
|
-
const OptionSchema = Type.Object(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Type.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Type.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
const OptionSchema = Type.Object(
|
|
7
|
+
{
|
|
8
|
+
value: Type.String({ description: "Unique returned id" }),
|
|
9
|
+
label: Type.String({ description: "Displayed label" }),
|
|
10
|
+
description: Type.Optional(
|
|
11
|
+
Type.String({
|
|
12
|
+
description: "Optional helper text",
|
|
13
|
+
}),
|
|
14
|
+
),
|
|
15
|
+
details: Type.Optional(
|
|
16
|
+
Type.String({
|
|
17
|
+
description:
|
|
18
|
+
"Extended details shown when focused — trade-offs, code snippets, or consequences",
|
|
19
|
+
}),
|
|
20
|
+
),
|
|
21
|
+
},
|
|
22
|
+
{ additionalProperties: false },
|
|
23
|
+
);
|
|
21
24
|
|
|
22
25
|
const ChoiceOptionCount = {
|
|
23
26
|
minItems: ASK_USER_LIMITS.minChoiceOptions,
|
|
@@ -28,51 +31,60 @@ const QuestionCount = {
|
|
|
28
31
|
maxItems: ASK_USER_LIMITS.maxQuestions,
|
|
29
32
|
} as const;
|
|
30
33
|
|
|
31
|
-
const ChoiceQuestionSchema = Type.Object(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
multi: Type.Optional(
|
|
41
|
-
Type.Boolean({
|
|
42
|
-
default: false,
|
|
43
|
-
description: "Allow multiple selections",
|
|
44
|
-
}),
|
|
45
|
-
),
|
|
46
|
-
recommendation: Type.Optional(
|
|
47
|
-
Type.Union([Type.String(), Type.Array(Type.String())], {
|
|
48
|
-
description: "Recommended value(s): single string, multi array",
|
|
34
|
+
const ChoiceQuestionSchema = Type.Object(
|
|
35
|
+
{
|
|
36
|
+
type: Type.Literal("choice"),
|
|
37
|
+
id: Type.String({ description: "Unique question id" }),
|
|
38
|
+
header: Type.String({ description: "Short label" }),
|
|
39
|
+
prompt: Type.String({ description: "Question text" }),
|
|
40
|
+
options: Type.Array(OptionSchema, {
|
|
41
|
+
description: "Each option requires `label` (shown text) and a unique `value` (returned id).",
|
|
42
|
+
...ChoiceOptionCount,
|
|
49
43
|
}),
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
multi: Type.Optional(
|
|
45
|
+
Type.Boolean({
|
|
46
|
+
default: false,
|
|
47
|
+
description: "Allow multiple selections",
|
|
48
|
+
}),
|
|
49
|
+
),
|
|
50
|
+
recommendation: Type.Optional(
|
|
51
|
+
Type.Union([Type.String(), Type.Array(Type.String())], {
|
|
52
|
+
description: "Recommended value(s): single string, multi array",
|
|
53
|
+
}),
|
|
54
|
+
),
|
|
55
|
+
},
|
|
56
|
+
{ additionalProperties: false },
|
|
57
|
+
);
|
|
52
58
|
|
|
53
|
-
const TextQuestionSchema = Type.Object(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
})
|
|
59
|
+
const TextQuestionSchema = Type.Object(
|
|
60
|
+
{
|
|
61
|
+
type: Type.Literal("text"),
|
|
62
|
+
id: Type.String({ description: "Unique question id" }),
|
|
63
|
+
header: Type.String({ description: "Short label" }),
|
|
64
|
+
prompt: Type.String({ description: "Question text" }),
|
|
65
|
+
recommendation: Type.Optional(Type.String({ description: "Suggested text" })),
|
|
66
|
+
placeholder: Type.Optional(Type.String({ description: "Editor placeholder" })),
|
|
67
|
+
},
|
|
68
|
+
{ additionalProperties: false },
|
|
69
|
+
);
|
|
61
70
|
|
|
62
71
|
const QuestionSchema = Type.Union([ChoiceQuestionSchema, TextQuestionSchema]);
|
|
63
72
|
|
|
64
|
-
export const AskUserParamsSchema = Type.Object(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
Type.
|
|
68
|
-
|
|
73
|
+
export const AskUserParamsSchema = Type.Object(
|
|
74
|
+
{
|
|
75
|
+
title: Type.Optional(Type.String({ description: "Optional title" })),
|
|
76
|
+
intro: Type.Optional(
|
|
77
|
+
Type.String({
|
|
78
|
+
description: "Optional context",
|
|
79
|
+
}),
|
|
80
|
+
),
|
|
81
|
+
questions: Type.Array(QuestionSchema, {
|
|
82
|
+
description: "1-10 related questions for one decision",
|
|
83
|
+
...QuestionCount,
|
|
69
84
|
}),
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
...QuestionCount,
|
|
74
|
-
}),
|
|
75
|
-
});
|
|
85
|
+
},
|
|
86
|
+
{ additionalProperties: false },
|
|
87
|
+
);
|
|
76
88
|
|
|
77
89
|
export type AskUserParams = Static<typeof AskUserParamsSchema>;
|
|
78
90
|
export type ExternalQuestion = Static<typeof QuestionSchema>;
|
|
@@ -7,6 +7,12 @@ export const ASK_USER_TOOL_LABEL = "Ask User";
|
|
|
7
7
|
export const askUserSpec = {
|
|
8
8
|
name: ASK_USER_TOOL_NAME,
|
|
9
9
|
label: ASK_USER_TOOL_LABEL,
|
|
10
|
+
annotations: {
|
|
11
|
+
readOnlyHint: true,
|
|
12
|
+
destructiveHint: false,
|
|
13
|
+
idempotentHint: true,
|
|
14
|
+
openWorldHint: false,
|
|
15
|
+
},
|
|
10
16
|
parameters: AskUserParamsSchema,
|
|
11
17
|
// Keep user forms out of nested tool calls.
|
|
12
18
|
exposure: "model-only",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrclrchtr/supi-prompt-improver",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"description": "Command-based prompt improvement with user-approved drafts",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
]
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@mrclrchtr/supi-ask-user": "
|
|
47
|
-
"@mrclrchtr/supi-core": "
|
|
46
|
+
"@mrclrchtr/supi-ask-user": "12.0.0",
|
|
47
|
+
"@mrclrchtr/supi-core": "12.0.0"
|
|
48
48
|
},
|
|
49
49
|
"bundledDependencies": [
|
|
50
50
|
"@mrclrchtr/supi-ask-user",
|