@hachej/boring-ask-user 0.1.13

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.
@@ -0,0 +1,305 @@
1
+ // src/shared/constants.ts
2
+ var ASK_USER_PLUGIN_ID = "ask-user";
3
+ var ASK_USER_PANEL_ID = "ask-user.questions";
4
+ var ASK_USER_PANEL_TITLE = "Questions";
5
+ var ASK_USER_SURFACE_KIND = "questions";
6
+ var ASK_USER_COMMAND_KINDS = {
7
+ SUBMIT: "questions.submit",
8
+ CANCEL: "questions.cancel"
9
+ };
10
+ var ASK_USER_UI_STATE_SLOTS = {
11
+ PENDING: "questions.pending"
12
+ };
13
+ var ASK_USER_SCHEMA_LIMITS = {
14
+ maxFields: 8,
15
+ maxOptionsPerField: 50,
16
+ maxFieldNameLength: 64,
17
+ maxTitleLength: 200,
18
+ maxLabelLength: 160,
19
+ maxHelpTextLength: 500,
20
+ maxContextLength: 4e3,
21
+ maxSerializedSchemaBytes: 32e3,
22
+ maxFreeformAnswerLength: 4e3,
23
+ minTimeoutMs: 1e3,
24
+ maxTimeoutMs: 30 * 6e4,
25
+ defaultTimeoutMs: 10 * 6e4
26
+ };
27
+ var ASK_USER_FIELD_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9_-]{0,63}$/;
28
+ var ASK_USER_RESERVED_FIELD_NAMES = /* @__PURE__ */ new Set([
29
+ "__proto__",
30
+ "prototype",
31
+ "constructor"
32
+ ]);
33
+
34
+ // src/shared/error-codes.ts
35
+ var ASK_USER_ERROR_CODES = {
36
+ PENDING_EXISTS: "ASK_USER_PENDING_EXISTS",
37
+ QUESTION_NOT_FOUND: "ASK_USER_QUESTION_NOT_FOUND",
38
+ QUESTION_ABANDONED: "ASK_USER_QUESTION_ABANDONED",
39
+ QUESTION_NOT_READY: "ASK_USER_QUESTION_NOT_READY",
40
+ SCHEMA_INVALID: "ASK_USER_SCHEMA_INVALID",
41
+ ANSWER_INVALID: "ASK_USER_ANSWER_INVALID",
42
+ SESSION_MISMATCH: "ASK_USER_SESSION_MISMATCH",
43
+ UI_UNAVAILABLE: "ASK_USER_UI_UNAVAILABLE",
44
+ ALREADY_ANSWERED: "ASK_USER_ALREADY_ANSWERED",
45
+ ALREADY_CANCELLED: "ASK_USER_ALREADY_CANCELLED",
46
+ UNAUTHORIZED: "ASK_USER_UNAUTHORIZED",
47
+ UI_ACK_TIMEOUT: "ASK_USER_UI_ACK_TIMEOUT",
48
+ RATE_LIMITED: "ASK_USER_RATE_LIMITED",
49
+ RUNTIME_UNAVAILABLE: "ASK_USER_RUNTIME_UNAVAILABLE"
50
+ };
51
+ var ASK_USER_ERROR_CODE_VALUES = Object.values(ASK_USER_ERROR_CODES);
52
+
53
+ // src/shared/schema.ts
54
+ import { z } from "zod";
55
+ var isoStringSchema = z.string().min(1);
56
+ var fieldNameSchema = z.string().regex(ASK_USER_FIELD_NAME_PATTERN, "field name must match ^[A-Za-z][A-Za-z0-9_-]{0,63}$").refine((name) => !ASK_USER_RESERVED_FIELD_NAMES.has(name), "field name is reserved");
57
+ var boundedString = (max) => z.string().max(max);
58
+ var optionalBoundedString = (max) => boundedString(max).optional();
59
+ var askUserOptionSchema = z.object({
60
+ value: z.string().min(1).max(ASK_USER_SCHEMA_LIMITS.maxLabelLength),
61
+ label: boundedString(ASK_USER_SCHEMA_LIMITS.maxLabelLength),
62
+ description: optionalBoundedString(ASK_USER_SCHEMA_LIMITS.maxHelpTextLength)
63
+ }).strict();
64
+ var baseFieldSchema = {
65
+ name: fieldNameSchema,
66
+ label: boundedString(ASK_USER_SCHEMA_LIMITS.maxLabelLength),
67
+ required: z.boolean().optional(),
68
+ helpText: optionalBoundedString(ASK_USER_SCHEMA_LIMITS.maxHelpTextLength)
69
+ };
70
+ function safePattern(pattern) {
71
+ try {
72
+ if (/\\[1-9]/.test(pattern)) return false;
73
+ if (/\(\?([=!<]|<=|<!)/.test(pattern)) return false;
74
+ new RegExp(pattern);
75
+ return true;
76
+ } catch {
77
+ return false;
78
+ }
79
+ }
80
+ var textFieldSchema = z.object({
81
+ type: z.literal("text"),
82
+ ...baseFieldSchema,
83
+ placeholder: optionalBoundedString(ASK_USER_SCHEMA_LIMITS.maxLabelLength),
84
+ defaultValue: optionalBoundedString(ASK_USER_SCHEMA_LIMITS.maxFreeformAnswerLength),
85
+ minLength: z.number().int().min(0).max(ASK_USER_SCHEMA_LIMITS.maxFreeformAnswerLength).optional(),
86
+ maxLength: z.number().int().min(0).max(ASK_USER_SCHEMA_LIMITS.maxFreeformAnswerLength).optional(),
87
+ pattern: z.string().max(512).refine(safePattern, "pattern must be safe and valid").optional()
88
+ }).strict().superRefine((field, ctx) => {
89
+ if (field.minLength !== void 0 && field.maxLength !== void 0 && field.minLength > field.maxLength) {
90
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["minLength"], message: "minLength must be <= maxLength" });
91
+ }
92
+ if (field.defaultValue !== void 0) {
93
+ if (field.minLength !== void 0 && field.defaultValue.length < field.minLength) {
94
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["defaultValue"], message: "defaultValue shorter than minLength" });
95
+ }
96
+ if (field.maxLength !== void 0 && field.defaultValue.length > field.maxLength) {
97
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["defaultValue"], message: "defaultValue longer than maxLength" });
98
+ }
99
+ }
100
+ });
101
+ var textareaFieldSchema = z.object({
102
+ type: z.literal("textarea"),
103
+ ...baseFieldSchema,
104
+ placeholder: optionalBoundedString(ASK_USER_SCHEMA_LIMITS.maxLabelLength),
105
+ defaultValue: optionalBoundedString(ASK_USER_SCHEMA_LIMITS.maxFreeformAnswerLength),
106
+ minLength: z.number().int().min(0).max(ASK_USER_SCHEMA_LIMITS.maxFreeformAnswerLength).optional(),
107
+ maxLength: z.number().int().min(0).max(ASK_USER_SCHEMA_LIMITS.maxFreeformAnswerLength).optional()
108
+ }).strict().superRefine((field, ctx) => {
109
+ if (field.minLength !== void 0 && field.maxLength !== void 0 && field.minLength > field.maxLength) {
110
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["minLength"], message: "minLength must be <= maxLength" });
111
+ }
112
+ });
113
+ function optionsRefinement(field, ctx) {
114
+ const seen = /* @__PURE__ */ new Set();
115
+ for (let i = 0; i < field.options.length; i++) {
116
+ const value = field.options[i]?.value;
117
+ if (seen.has(value)) {
118
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["options", i, "value"], message: "duplicate option value" });
119
+ }
120
+ seen.add(value);
121
+ }
122
+ if (field.defaultValue !== void 0 && !seen.has(field.defaultValue)) {
123
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["defaultValue"], message: "defaultValue must reference an option value" });
124
+ }
125
+ }
126
+ var selectFieldSchema = z.object({
127
+ type: z.literal("select"),
128
+ ...baseFieldSchema,
129
+ options: z.array(askUserOptionSchema).min(2).max(ASK_USER_SCHEMA_LIMITS.maxOptionsPerField),
130
+ defaultValue: z.string().optional()
131
+ }).strict().superRefine(optionsRefinement);
132
+ var radioFieldSchema = z.object({
133
+ type: z.literal("radio"),
134
+ ...baseFieldSchema,
135
+ options: z.array(askUserOptionSchema).min(2).max(ASK_USER_SCHEMA_LIMITS.maxOptionsPerField),
136
+ defaultValue: z.string().optional()
137
+ }).strict().superRefine(optionsRefinement);
138
+ var multiselectFieldSchema = z.object({
139
+ type: z.literal("multiselect"),
140
+ ...baseFieldSchema,
141
+ options: z.array(askUserOptionSchema).min(1).max(ASK_USER_SCHEMA_LIMITS.maxOptionsPerField),
142
+ defaultValue: z.array(z.string()).optional(),
143
+ minSelections: z.number().int().min(0).optional(),
144
+ maxSelections: z.number().int().min(0).optional()
145
+ }).strict().superRefine((field, ctx) => {
146
+ const values = /* @__PURE__ */ new Set();
147
+ for (let i = 0; i < field.options.length; i++) {
148
+ const value = field.options[i]?.value;
149
+ if (values.has(value)) {
150
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["options", i, "value"], message: "duplicate option value" });
151
+ }
152
+ values.add(value);
153
+ }
154
+ if (field.defaultValue) {
155
+ for (const value of field.defaultValue) {
156
+ if (!values.has(value)) {
157
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["defaultValue"], message: "defaultValue must reference option values" });
158
+ }
159
+ }
160
+ }
161
+ if (field.minSelections !== void 0 && field.maxSelections !== void 0 && field.minSelections > field.maxSelections) {
162
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["minSelections"], message: "minSelections must be <= maxSelections" });
163
+ }
164
+ if (field.maxSelections !== void 0 && field.maxSelections > field.options.length) {
165
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["maxSelections"], message: "maxSelections must be <= options.length" });
166
+ }
167
+ });
168
+ var checkboxFieldSchema = z.object({
169
+ type: z.literal("checkbox"),
170
+ name: fieldNameSchema,
171
+ label: boundedString(ASK_USER_SCHEMA_LIMITS.maxLabelLength),
172
+ defaultValue: z.boolean().optional(),
173
+ helpText: optionalBoundedString(ASK_USER_SCHEMA_LIMITS.maxHelpTextLength)
174
+ }).strict();
175
+ var numberFieldSchema = z.object({
176
+ type: z.literal("number"),
177
+ ...baseFieldSchema,
178
+ defaultValue: z.number().finite().optional(),
179
+ placeholder: optionalBoundedString(ASK_USER_SCHEMA_LIMITS.maxLabelLength),
180
+ min: z.number().finite().optional(),
181
+ max: z.number().finite().optional(),
182
+ step: z.number().finite().positive().optional(),
183
+ integer: z.boolean().optional()
184
+ }).strict().superRefine((field, ctx) => {
185
+ if (field.min !== void 0 && field.max !== void 0 && field.min > field.max) {
186
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["min"], message: "min must be <= max" });
187
+ }
188
+ if (field.defaultValue !== void 0) {
189
+ if (field.integer && !Number.isInteger(field.defaultValue)) {
190
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["defaultValue"], message: "defaultValue must be an integer" });
191
+ }
192
+ if (field.min !== void 0 && field.defaultValue < field.min) {
193
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["defaultValue"], message: "defaultValue must be >= min" });
194
+ }
195
+ if (field.max !== void 0 && field.defaultValue > field.max) {
196
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["defaultValue"], message: "defaultValue must be <= max" });
197
+ }
198
+ }
199
+ });
200
+ var AskUserFieldSchema = z.union([
201
+ textFieldSchema,
202
+ textareaFieldSchema,
203
+ selectFieldSchema,
204
+ multiselectFieldSchema,
205
+ checkboxFieldSchema,
206
+ radioFieldSchema,
207
+ numberFieldSchema
208
+ ]);
209
+ var AskUserFormSchemaSchema = z.object({
210
+ wireVersion: z.literal(1),
211
+ fields: z.array(AskUserFieldSchema).min(1).max(ASK_USER_SCHEMA_LIMITS.maxFields),
212
+ submitLabel: optionalBoundedString(ASK_USER_SCHEMA_LIMITS.maxLabelLength)
213
+ }).strict().superRefine((schema, ctx) => {
214
+ const names = /* @__PURE__ */ new Set();
215
+ for (let i = 0; i < schema.fields.length; i++) {
216
+ const name = schema.fields[i]?.name;
217
+ if (names.has(name)) {
218
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["fields", i, "name"], message: "duplicate field name" });
219
+ }
220
+ names.add(name);
221
+ }
222
+ if (serializedSize(schema) > ASK_USER_SCHEMA_LIMITS.maxSerializedSchemaBytes) {
223
+ ctx.addIssue({ code: z.ZodIssueCode.custom, message: "schema exceeds max serialized size" });
224
+ }
225
+ });
226
+ var AskUserToolInputSchema = z.object({
227
+ title: boundedString(ASK_USER_SCHEMA_LIMITS.maxTitleLength).min(1),
228
+ context: optionalBoundedString(ASK_USER_SCHEMA_LIMITS.maxContextLength),
229
+ schema: AskUserFormSchemaSchema,
230
+ timeoutMs: z.number().int().min(ASK_USER_SCHEMA_LIMITS.minTimeoutMs).max(ASK_USER_SCHEMA_LIMITS.maxTimeoutMs).optional()
231
+ }).strict();
232
+ var AskUserRequestSchema = z.object({
233
+ sessionId: z.string().min(1),
234
+ title: boundedString(ASK_USER_SCHEMA_LIMITS.maxTitleLength).optional(),
235
+ context: optionalBoundedString(ASK_USER_SCHEMA_LIMITS.maxContextLength),
236
+ schema: AskUserFormSchemaSchema.optional(),
237
+ timeoutMs: z.number().int().min(ASK_USER_SCHEMA_LIMITS.minTimeoutMs).max(ASK_USER_SCHEMA_LIMITS.maxTimeoutMs).optional()
238
+ }).strict();
239
+ var AskUserAnswerValueSchema = z.union([
240
+ z.string().max(ASK_USER_SCHEMA_LIMITS.maxFreeformAnswerLength),
241
+ z.array(z.string()).max(ASK_USER_SCHEMA_LIMITS.maxOptionsPerField),
242
+ z.boolean(),
243
+ z.number().finite(),
244
+ z.null()
245
+ ]);
246
+ var AskUserAnswerSchema = z.object({
247
+ questionId: z.string().min(1),
248
+ sessionId: z.string().min(1),
249
+ values: z.record(fieldNameSchema, AskUserAnswerValueSchema),
250
+ submittedAt: isoStringSchema
251
+ }).strict();
252
+ var commandParamsBase = {
253
+ questionId: z.string().min(1),
254
+ sessionId: z.string().min(1)
255
+ };
256
+ var QuestionsSubmitCommandSchema = z.object({
257
+ kind: z.literal(ASK_USER_COMMAND_KINDS.SUBMIT),
258
+ params: z.object({
259
+ ...commandParamsBase,
260
+ answerToken: z.string().min(1),
261
+ values: z.record(fieldNameSchema, AskUserAnswerValueSchema)
262
+ }).strict()
263
+ }).strict();
264
+ var QuestionsCancelCommandSchema = z.object({
265
+ kind: z.literal(ASK_USER_COMMAND_KINDS.CANCEL),
266
+ params: z.object({ ...commandParamsBase, answerToken: z.string().min(1) }).strict()
267
+ }).strict();
268
+ var QuestionsCommandSchema = z.discriminatedUnion("kind", [
269
+ QuestionsSubmitCommandSchema,
270
+ QuestionsCancelCommandSchema
271
+ ]);
272
+ function serializedSize(value) {
273
+ return new TextEncoder().encode(JSON.stringify(value)).length;
274
+ }
275
+ function validateAskUserFormSchema(value) {
276
+ return AskUserFormSchemaSchema.safeParse(value);
277
+ }
278
+ function validateAskUserToolInput(value) {
279
+ return AskUserToolInputSchema.safeParse(value);
280
+ }
281
+ export {
282
+ ASK_USER_COMMAND_KINDS,
283
+ ASK_USER_ERROR_CODES,
284
+ ASK_USER_ERROR_CODE_VALUES,
285
+ ASK_USER_FIELD_NAME_PATTERN,
286
+ ASK_USER_PANEL_ID,
287
+ ASK_USER_PANEL_TITLE,
288
+ ASK_USER_PLUGIN_ID,
289
+ ASK_USER_RESERVED_FIELD_NAMES,
290
+ ASK_USER_SCHEMA_LIMITS,
291
+ ASK_USER_SURFACE_KIND,
292
+ ASK_USER_UI_STATE_SLOTS,
293
+ AskUserAnswerSchema,
294
+ AskUserAnswerValueSchema,
295
+ AskUserFieldSchema,
296
+ AskUserFormSchemaSchema,
297
+ AskUserRequestSchema,
298
+ AskUserToolInputSchema,
299
+ QuestionsCancelCommandSchema,
300
+ QuestionsCommandSchema,
301
+ QuestionsSubmitCommandSchema,
302
+ serializedSize,
303
+ validateAskUserFormSchema,
304
+ validateAskUserToolInput
305
+ };
@@ -0,0 +1,193 @@
1
+ declare const ASK_USER_PLUGIN_ID: "ask-user";
2
+ declare const ASK_USER_PANEL_ID: "ask-user.questions";
3
+ declare const ASK_USER_PANEL_TITLE: "Questions";
4
+ declare const ASK_USER_SURFACE_KIND: "questions";
5
+ declare const ASK_USER_COMMAND_KINDS: {
6
+ readonly SUBMIT: "questions.submit";
7
+ readonly CANCEL: "questions.cancel";
8
+ };
9
+ declare const ASK_USER_UI_STATE_SLOTS: {
10
+ readonly PENDING: "questions.pending";
11
+ };
12
+ declare const ASK_USER_SCHEMA_LIMITS: {
13
+ readonly maxFields: 8;
14
+ readonly maxOptionsPerField: 50;
15
+ readonly maxFieldNameLength: 64;
16
+ readonly maxTitleLength: 200;
17
+ readonly maxLabelLength: 160;
18
+ readonly maxHelpTextLength: 500;
19
+ readonly maxContextLength: 4000;
20
+ readonly maxSerializedSchemaBytes: 32000;
21
+ readonly maxFreeformAnswerLength: 4000;
22
+ readonly minTimeoutMs: 1000;
23
+ readonly maxTimeoutMs: number;
24
+ readonly defaultTimeoutMs: number;
25
+ };
26
+ declare const ASK_USER_FIELD_NAME_PATTERN: RegExp;
27
+ declare const ASK_USER_RESERVED_FIELD_NAMES: Set<string>;
28
+
29
+ type AskUserOption = {
30
+ value: string;
31
+ label: string;
32
+ description?: string;
33
+ };
34
+ type AskUserField = {
35
+ type: "text";
36
+ name: string;
37
+ label: string;
38
+ required?: boolean;
39
+ placeholder?: string;
40
+ defaultValue?: string;
41
+ helpText?: string;
42
+ minLength?: number;
43
+ maxLength?: number;
44
+ pattern?: string;
45
+ } | {
46
+ type: "textarea";
47
+ name: string;
48
+ label: string;
49
+ required?: boolean;
50
+ placeholder?: string;
51
+ defaultValue?: string;
52
+ helpText?: string;
53
+ minLength?: number;
54
+ maxLength?: number;
55
+ } | {
56
+ type: "select";
57
+ name: string;
58
+ label: string;
59
+ required?: boolean;
60
+ options: AskUserOption[];
61
+ defaultValue?: string;
62
+ helpText?: string;
63
+ } | {
64
+ type: "multiselect";
65
+ name: string;
66
+ label: string;
67
+ required?: boolean;
68
+ options: AskUserOption[];
69
+ defaultValue?: string[];
70
+ helpText?: string;
71
+ minSelections?: number;
72
+ maxSelections?: number;
73
+ } | {
74
+ type: "checkbox";
75
+ name: string;
76
+ label: string;
77
+ defaultValue?: boolean;
78
+ helpText?: string;
79
+ } | {
80
+ type: "radio";
81
+ name: string;
82
+ label: string;
83
+ required?: boolean;
84
+ options: AskUserOption[];
85
+ defaultValue?: string;
86
+ helpText?: string;
87
+ } | {
88
+ type: "number";
89
+ name: string;
90
+ label: string;
91
+ required?: boolean;
92
+ defaultValue?: number;
93
+ placeholder?: string;
94
+ helpText?: string;
95
+ min?: number;
96
+ max?: number;
97
+ step?: number;
98
+ integer?: boolean;
99
+ };
100
+ type AskUserFormSchema = {
101
+ wireVersion: 1;
102
+ fields: AskUserField[];
103
+ submitLabel?: string;
104
+ };
105
+ type AskUserRequest = {
106
+ sessionId: string;
107
+ title?: string;
108
+ context?: string;
109
+ schema?: AskUserFormSchema;
110
+ timeoutMs?: number;
111
+ };
112
+ type AskUserToolInput = {
113
+ title: string;
114
+ context?: string;
115
+ schema: AskUserFormSchema;
116
+ timeoutMs?: number;
117
+ };
118
+ type AskUserQuestionStatus = "ready" | "answered" | "cancelled" | "abandoned";
119
+ type AskUserQuestion = {
120
+ questionId: string;
121
+ sessionId: string;
122
+ ownerPrincipalId: string;
123
+ status: AskUserQuestionStatus;
124
+ title?: string;
125
+ context?: string;
126
+ schema?: AskUserFormSchema;
127
+ answerToken: string;
128
+ createdAt: string;
129
+ updatedAt: string;
130
+ };
131
+ type AskUserAnswerValue = string | string[] | boolean | number | null;
132
+ type AskUserAnswer = {
133
+ questionId: string;
134
+ sessionId: string;
135
+ values: Record<string, AskUserAnswerValue>;
136
+ submittedAt: string;
137
+ };
138
+ type AskUserCancelReason = "user_cancelled" | "timeout" | "aborted" | "ui_unavailable" | "abandoned" | "rate_limited" | "runtime_unavailable";
139
+ type AskUserToolResult = {
140
+ status: "answered";
141
+ answer: AskUserAnswer;
142
+ } | {
143
+ status: "cancelled";
144
+ questionId: string;
145
+ sessionId: string;
146
+ reason: AskUserCancelReason;
147
+ };
148
+ type QuestionsSubmitCommand = {
149
+ kind: typeof ASK_USER_COMMAND_KINDS.SUBMIT;
150
+ params: {
151
+ questionId: string;
152
+ sessionId: string;
153
+ answerToken: string;
154
+ values: Record<string, AskUserAnswerValue>;
155
+ };
156
+ };
157
+ type QuestionsCancelCommand = {
158
+ kind: typeof ASK_USER_COMMAND_KINDS.CANCEL;
159
+ params: {
160
+ questionId: string;
161
+ sessionId: string;
162
+ answerToken: string;
163
+ };
164
+ };
165
+ type QuestionsCommand = QuestionsSubmitCommand | QuestionsCancelCommand;
166
+ type AskUserTranscriptEvent = {
167
+ type: "created";
168
+ question: AskUserQuestion;
169
+ at: string;
170
+ } | {
171
+ type: "ready";
172
+ questionId: string;
173
+ sessionId: string;
174
+ schema: AskUserFormSchema;
175
+ at: string;
176
+ } | {
177
+ type: "answered";
178
+ answer: AskUserAnswer;
179
+ at: string;
180
+ } | {
181
+ type: "cancelled";
182
+ questionId: string;
183
+ sessionId: string;
184
+ reason: AskUserCancelReason;
185
+ at: string;
186
+ } | {
187
+ type: "abandoned";
188
+ questionId: string;
189
+ sessionId: string;
190
+ at: string;
191
+ };
192
+
193
+ export { type AskUserQuestion as A, type QuestionsCommand as Q, type AskUserAnswer as a, type AskUserTranscriptEvent as b, type AskUserToolResult as c, type AskUserCancelReason as d, type AskUserRequest as e, type AskUserField as f, type AskUserAnswerValue as g, ASK_USER_PLUGIN_ID as h, ASK_USER_COMMAND_KINDS as i, ASK_USER_FIELD_NAME_PATTERN as j, ASK_USER_PANEL_ID as k, ASK_USER_PANEL_TITLE as l, ASK_USER_RESERVED_FIELD_NAMES as m, ASK_USER_SCHEMA_LIMITS as n, ASK_USER_SURFACE_KIND as o, ASK_USER_UI_STATE_SLOTS as p, type AskUserFormSchema as q, type AskUserOption as r, type AskUserQuestionStatus as s, type AskUserToolInput as t, type QuestionsCancelCommand as u, type QuestionsSubmitCommand as v };
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "@hachej/boring-ask-user",
3
+ "version": "0.1.13",
4
+ "type": "module",
5
+ "private": false,
6
+ "description": "Ask-user plugin for Boring workspace — surfaces agent questions to the user and streams answers back.",
7
+ "boring": {
8
+ "id": "ask-user",
9
+ "label": "Questions",
10
+ "front": "dist/front/index.js",
11
+ "server": "dist/server/index.js"
12
+ },
13
+ "pi": {
14
+ "systemPrompt": "Use the ask-user tool when you need a decision, confirmation, or freeform input from the user before continuing. The user answers via the Questions panel and the tool resolves with their response."
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/front/index.d.ts",
22
+ "import": "./dist/front/index.js"
23
+ },
24
+ "./front": {
25
+ "types": "./dist/front/index.d.ts",
26
+ "import": "./dist/front/index.js"
27
+ },
28
+ "./server": {
29
+ "types": "./dist/server/index.d.ts",
30
+ "import": "./dist/server/index.js"
31
+ },
32
+ "./shared": {
33
+ "types": "./dist/shared/index.d.ts",
34
+ "import": "./dist/shared/index.js"
35
+ },
36
+ "./package.json": "./package.json"
37
+ },
38
+ "sideEffects": false,
39
+ "scripts": {
40
+ "build": "pnpm --filter @hachej/boring-ui-kit build && pnpm --filter @hachej/boring-workspace build && tsup",
41
+ "typecheck": "pnpm --filter @hachej/boring-ui-kit build && pnpm --filter @hachej/boring-workspace build && tsc --noEmit",
42
+ "test": "pnpm --filter @hachej/boring-ui-kit build && vitest run",
43
+ "lint": "pnpm run typecheck",
44
+ "clean": "rm -rf dist .tsbuildinfo"
45
+ },
46
+ "peerDependencies": {
47
+ "@hachej/boring-workspace": "workspace:*",
48
+ "react": "^18.0.0 || ^19.0.0",
49
+ "react-dom": "^18.0.0 || ^19.0.0"
50
+ },
51
+ "dependencies": {
52
+ "@hachej/boring-ui-kit": "workspace:*",
53
+ "fastify": "^5.3.3",
54
+ "lucide-react": "^1.8.0",
55
+ "zod": "^3.23.0"
56
+ },
57
+ "devDependencies": {
58
+ "@hachej/boring-workspace": "workspace:*",
59
+ "@testing-library/jest-dom": "^6.9.1",
60
+ "@testing-library/react": "^16.3.0",
61
+ "@types/node": "^22.0.0",
62
+ "@types/react": "^19.0.0",
63
+ "@types/react-dom": "^19.0.0",
64
+ "@vitejs/plugin-react": "^4.0.0",
65
+ "jsdom": "^29.0.2",
66
+ "react": "^19.0.0",
67
+ "react-dom": "^19.0.0",
68
+ "tsup": "^8.4.0",
69
+ "typescript": "~5.9.3",
70
+ "vitest": "^3.1.3"
71
+ }
72
+ }