@task-mcp/shared 1.0.6 → 1.0.8

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 (41) hide show
  1. package/dist/schemas/inbox.d.ts +49 -18
  2. package/dist/schemas/inbox.d.ts.map +1 -1
  3. package/dist/schemas/inbox.js +16 -16
  4. package/dist/schemas/inbox.js.map +1 -1
  5. package/dist/schemas/index.d.ts +2 -1
  6. package/dist/schemas/index.d.ts.map +1 -1
  7. package/dist/schemas/index.js +2 -0
  8. package/dist/schemas/index.js.map +1 -1
  9. package/dist/schemas/project.d.ts +164 -42
  10. package/dist/schemas/project.d.ts.map +1 -1
  11. package/dist/schemas/project.js +41 -33
  12. package/dist/schemas/project.js.map +1 -1
  13. package/dist/schemas/response-format.d.ts +76 -2
  14. package/dist/schemas/response-format.d.ts.map +1 -1
  15. package/dist/schemas/response-format.js +3 -2
  16. package/dist/schemas/response-format.js.map +1 -1
  17. package/dist/schemas/response-schema.d.ts +307 -0
  18. package/dist/schemas/response-schema.d.ts.map +1 -0
  19. package/dist/schemas/response-schema.js +75 -0
  20. package/dist/schemas/response-schema.js.map +1 -0
  21. package/dist/schemas/response-schema.test.d.ts +2 -0
  22. package/dist/schemas/response-schema.test.d.ts.map +1 -0
  23. package/dist/schemas/response-schema.test.js +256 -0
  24. package/dist/schemas/response-schema.test.js.map +1 -0
  25. package/dist/schemas/task.d.ts +588 -147
  26. package/dist/schemas/task.d.ts.map +1 -1
  27. package/dist/schemas/task.js +114 -88
  28. package/dist/schemas/task.js.map +1 -1
  29. package/dist/schemas/view.d.ts +128 -37
  30. package/dist/schemas/view.d.ts.map +1 -1
  31. package/dist/schemas/view.js +38 -24
  32. package/dist/schemas/view.js.map +1 -1
  33. package/package.json +2 -2
  34. package/src/schemas/inbox.ts +20 -20
  35. package/src/schemas/index.ts +23 -0
  36. package/src/schemas/project.ts +46 -40
  37. package/src/schemas/response-format.ts +99 -3
  38. package/src/schemas/response-schema.test.ts +314 -0
  39. package/src/schemas/response-schema.ts +92 -0
  40. package/src/schemas/task.ts +128 -110
  41. package/src/schemas/view.ts +43 -33
@@ -0,0 +1,307 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Response Schema
4
+ *
5
+ * Standardized formats for AI agents to ask questions, make suggestions,
6
+ * or request confirmation from users.
7
+ */
8
+ export declare const ResponseType: z.ZodEnum<["question", "suggestion", "confirmation"]>;
9
+ export type ResponseType = z.infer<typeof ResponseType>;
10
+ export declare const ResponsePriority: z.ZodEnum<["low", "medium", "high", "critical"]>;
11
+ export type ResponsePriority = z.infer<typeof ResponsePriority>;
12
+ export declare const ResponseOption: z.ZodObject<{
13
+ label: z.ZodString;
14
+ value: z.ZodString;
15
+ description: z.ZodOptional<z.ZodString>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ label: string;
18
+ value: string;
19
+ description?: string | undefined;
20
+ }, {
21
+ label: string;
22
+ value: string;
23
+ description?: string | undefined;
24
+ }>;
25
+ export type ResponseOption = z.infer<typeof ResponseOption>;
26
+ export declare const QuestionResponse: z.ZodObject<{
27
+ message: z.ZodString;
28
+ context: z.ZodOptional<z.ZodString>;
29
+ priority: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
30
+ } & {
31
+ type: z.ZodLiteral<"question">;
32
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
33
+ label: z.ZodString;
34
+ value: z.ZodString;
35
+ description: z.ZodOptional<z.ZodString>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ label: string;
38
+ value: string;
39
+ description?: string | undefined;
40
+ }, {
41
+ label: string;
42
+ value: string;
43
+ description?: string | undefined;
44
+ }>, "many">>;
45
+ defaultOption: z.ZodOptional<z.ZodString>;
46
+ }, "strip", z.ZodTypeAny, {
47
+ message: string;
48
+ type: "question";
49
+ options?: {
50
+ label: string;
51
+ value: string;
52
+ description?: string | undefined;
53
+ }[] | undefined;
54
+ context?: string | undefined;
55
+ priority?: "low" | "medium" | "high" | "critical" | undefined;
56
+ defaultOption?: string | undefined;
57
+ }, {
58
+ message: string;
59
+ type: "question";
60
+ options?: {
61
+ label: string;
62
+ value: string;
63
+ description?: string | undefined;
64
+ }[] | undefined;
65
+ context?: string | undefined;
66
+ priority?: "low" | "medium" | "high" | "critical" | undefined;
67
+ defaultOption?: string | undefined;
68
+ }>;
69
+ export type QuestionResponse = z.infer<typeof QuestionResponse>;
70
+ export declare const SuggestionResponse: z.ZodObject<{
71
+ message: z.ZodString;
72
+ context: z.ZodOptional<z.ZodString>;
73
+ priority: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
74
+ } & {
75
+ type: z.ZodLiteral<"suggestion">;
76
+ options: z.ZodArray<z.ZodObject<{
77
+ label: z.ZodString;
78
+ value: z.ZodString;
79
+ description: z.ZodOptional<z.ZodString>;
80
+ }, "strip", z.ZodTypeAny, {
81
+ label: string;
82
+ value: string;
83
+ description?: string | undefined;
84
+ }, {
85
+ label: string;
86
+ value: string;
87
+ description?: string | undefined;
88
+ }>, "many">;
89
+ reasoning: z.ZodOptional<z.ZodString>;
90
+ }, "strip", z.ZodTypeAny, {
91
+ message: string;
92
+ options: {
93
+ label: string;
94
+ value: string;
95
+ description?: string | undefined;
96
+ }[];
97
+ type: "suggestion";
98
+ context?: string | undefined;
99
+ priority?: "low" | "medium" | "high" | "critical" | undefined;
100
+ reasoning?: string | undefined;
101
+ }, {
102
+ message: string;
103
+ options: {
104
+ label: string;
105
+ value: string;
106
+ description?: string | undefined;
107
+ }[];
108
+ type: "suggestion";
109
+ context?: string | undefined;
110
+ priority?: "low" | "medium" | "high" | "critical" | undefined;
111
+ reasoning?: string | undefined;
112
+ }>;
113
+ export type SuggestionResponse = z.infer<typeof SuggestionResponse>;
114
+ export declare const ConfirmationResponse: z.ZodObject<{
115
+ message: z.ZodString;
116
+ context: z.ZodOptional<z.ZodString>;
117
+ priority: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
118
+ } & {
119
+ type: z.ZodLiteral<"confirmation">;
120
+ action: z.ZodString;
121
+ consequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
122
+ defaultConfirm: z.ZodOptional<z.ZodBoolean>;
123
+ }, "strip", z.ZodTypeAny, {
124
+ message: string;
125
+ type: "confirmation";
126
+ action: string;
127
+ context?: string | undefined;
128
+ priority?: "low" | "medium" | "high" | "critical" | undefined;
129
+ consequences?: string[] | undefined;
130
+ defaultConfirm?: boolean | undefined;
131
+ }, {
132
+ message: string;
133
+ type: "confirmation";
134
+ action: string;
135
+ context?: string | undefined;
136
+ priority?: "low" | "medium" | "high" | "critical" | undefined;
137
+ consequences?: string[] | undefined;
138
+ defaultConfirm?: boolean | undefined;
139
+ }>;
140
+ export type ConfirmationResponse = z.infer<typeof ConfirmationResponse>;
141
+ export declare const AgentResponse: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
142
+ message: z.ZodString;
143
+ context: z.ZodOptional<z.ZodString>;
144
+ priority: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
145
+ } & {
146
+ type: z.ZodLiteral<"question">;
147
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
148
+ label: z.ZodString;
149
+ value: z.ZodString;
150
+ description: z.ZodOptional<z.ZodString>;
151
+ }, "strip", z.ZodTypeAny, {
152
+ label: string;
153
+ value: string;
154
+ description?: string | undefined;
155
+ }, {
156
+ label: string;
157
+ value: string;
158
+ description?: string | undefined;
159
+ }>, "many">>;
160
+ defaultOption: z.ZodOptional<z.ZodString>;
161
+ }, "strip", z.ZodTypeAny, {
162
+ message: string;
163
+ type: "question";
164
+ options?: {
165
+ label: string;
166
+ value: string;
167
+ description?: string | undefined;
168
+ }[] | undefined;
169
+ context?: string | undefined;
170
+ priority?: "low" | "medium" | "high" | "critical" | undefined;
171
+ defaultOption?: string | undefined;
172
+ }, {
173
+ message: string;
174
+ type: "question";
175
+ options?: {
176
+ label: string;
177
+ value: string;
178
+ description?: string | undefined;
179
+ }[] | undefined;
180
+ context?: string | undefined;
181
+ priority?: "low" | "medium" | "high" | "critical" | undefined;
182
+ defaultOption?: string | undefined;
183
+ }>, z.ZodObject<{
184
+ message: z.ZodString;
185
+ context: z.ZodOptional<z.ZodString>;
186
+ priority: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
187
+ } & {
188
+ type: z.ZodLiteral<"suggestion">;
189
+ options: z.ZodArray<z.ZodObject<{
190
+ label: z.ZodString;
191
+ value: z.ZodString;
192
+ description: z.ZodOptional<z.ZodString>;
193
+ }, "strip", z.ZodTypeAny, {
194
+ label: string;
195
+ value: string;
196
+ description?: string | undefined;
197
+ }, {
198
+ label: string;
199
+ value: string;
200
+ description?: string | undefined;
201
+ }>, "many">;
202
+ reasoning: z.ZodOptional<z.ZodString>;
203
+ }, "strip", z.ZodTypeAny, {
204
+ message: string;
205
+ options: {
206
+ label: string;
207
+ value: string;
208
+ description?: string | undefined;
209
+ }[];
210
+ type: "suggestion";
211
+ context?: string | undefined;
212
+ priority?: "low" | "medium" | "high" | "critical" | undefined;
213
+ reasoning?: string | undefined;
214
+ }, {
215
+ message: string;
216
+ options: {
217
+ label: string;
218
+ value: string;
219
+ description?: string | undefined;
220
+ }[];
221
+ type: "suggestion";
222
+ context?: string | undefined;
223
+ priority?: "low" | "medium" | "high" | "critical" | undefined;
224
+ reasoning?: string | undefined;
225
+ }>, z.ZodObject<{
226
+ message: z.ZodString;
227
+ context: z.ZodOptional<z.ZodString>;
228
+ priority: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
229
+ } & {
230
+ type: z.ZodLiteral<"confirmation">;
231
+ action: z.ZodString;
232
+ consequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
233
+ defaultConfirm: z.ZodOptional<z.ZodBoolean>;
234
+ }, "strip", z.ZodTypeAny, {
235
+ message: string;
236
+ type: "confirmation";
237
+ action: string;
238
+ context?: string | undefined;
239
+ priority?: "low" | "medium" | "high" | "critical" | undefined;
240
+ consequences?: string[] | undefined;
241
+ defaultConfirm?: boolean | undefined;
242
+ }, {
243
+ message: string;
244
+ type: "confirmation";
245
+ action: string;
246
+ context?: string | undefined;
247
+ priority?: "low" | "medium" | "high" | "critical" | undefined;
248
+ consequences?: string[] | undefined;
249
+ defaultConfirm?: boolean | undefined;
250
+ }>]>;
251
+ export type AgentResponse = z.infer<typeof AgentResponse>;
252
+ export declare const GenerateResponseInput: z.ZodObject<{
253
+ type: z.ZodEnum<["question", "suggestion", "confirmation"]>;
254
+ message: z.ZodString;
255
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
256
+ label: z.ZodString;
257
+ value: z.ZodString;
258
+ description: z.ZodOptional<z.ZodString>;
259
+ }, "strip", z.ZodTypeAny, {
260
+ label: string;
261
+ value: string;
262
+ description?: string | undefined;
263
+ }, {
264
+ label: string;
265
+ value: string;
266
+ description?: string | undefined;
267
+ }>, "many">>;
268
+ context: z.ZodOptional<z.ZodString>;
269
+ priority: z.ZodDefault<z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>>;
270
+ action: z.ZodOptional<z.ZodString>;
271
+ consequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
272
+ reasoning: z.ZodOptional<z.ZodString>;
273
+ defaultOption: z.ZodOptional<z.ZodString>;
274
+ defaultConfirm: z.ZodOptional<z.ZodBoolean>;
275
+ }, "strip", z.ZodTypeAny, {
276
+ message: string;
277
+ type: "question" | "suggestion" | "confirmation";
278
+ priority: "low" | "medium" | "high" | "critical";
279
+ options?: {
280
+ label: string;
281
+ value: string;
282
+ description?: string | undefined;
283
+ }[] | undefined;
284
+ context?: string | undefined;
285
+ defaultOption?: string | undefined;
286
+ reasoning?: string | undefined;
287
+ action?: string | undefined;
288
+ consequences?: string[] | undefined;
289
+ defaultConfirm?: boolean | undefined;
290
+ }, {
291
+ message: string;
292
+ type: "question" | "suggestion" | "confirmation";
293
+ options?: {
294
+ label: string;
295
+ value: string;
296
+ description?: string | undefined;
297
+ }[] | undefined;
298
+ context?: string | undefined;
299
+ priority?: "low" | "medium" | "high" | "critical" | undefined;
300
+ defaultOption?: string | undefined;
301
+ reasoning?: string | undefined;
302
+ action?: string | undefined;
303
+ consequences?: string[] | undefined;
304
+ defaultConfirm?: boolean | undefined;
305
+ }>;
306
+ export type GenerateResponseInput = z.infer<typeof GenerateResponseInput>;
307
+ //# sourceMappingURL=response-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-schema.d.ts","sourceRoot":"","sources":["../../src/schemas/response-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AAGH,eAAO,MAAM,YAAY,uDAAqD,CAAC;AAC/E,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAGxD,eAAO,MAAM,gBAAgB,kDAAgD,CAAC;AAC9E,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAGhE,eAAO,MAAM,cAAc;;;;;;;;;;;;EAIzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAW5D,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAGhE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAGpE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;EAO/B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAGxE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAG1D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBhC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,75 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Response Schema
4
+ *
5
+ * Standardized formats for AI agents to ask questions, make suggestions,
6
+ * or request confirmation from users.
7
+ */
8
+ // Response types
9
+ export const ResponseType = z.enum(["question", "suggestion", "confirmation"]);
10
+ // Priority level for responses
11
+ export const ResponsePriority = z.enum(["low", "medium", "high", "critical"]);
12
+ // Option for multiple choice responses
13
+ export const ResponseOption = z.object({
14
+ label: z.string().describe("Display text for the option"),
15
+ value: z.string().describe("Value to return when selected"),
16
+ description: z.string().optional().describe("Additional explanation"),
17
+ });
18
+ // Base response schema
19
+ const BaseResponse = z.object({
20
+ type: ResponseType.describe("Type of response: question, suggestion, or confirmation"),
21
+ message: z.string().describe("Main message to display to user"),
22
+ context: z.string().optional().describe("Additional context or explanation"),
23
+ priority: ResponsePriority.optional().describe("Urgency/importance of response (default: medium)"),
24
+ });
25
+ // Question response - for clarification
26
+ export const QuestionResponse = BaseResponse.extend({
27
+ type: z.literal("question"),
28
+ options: z.array(ResponseOption).optional()
29
+ .describe("Multiple choice options (omit for free-form answer)"),
30
+ defaultOption: z.string().optional()
31
+ .describe("Default option value if user provides no input"),
32
+ });
33
+ // Suggestion response - for recommendations
34
+ export const SuggestionResponse = BaseResponse.extend({
35
+ type: z.literal("suggestion"),
36
+ options: z.array(ResponseOption).min(1)
37
+ .describe("Suggested options for user to choose from"),
38
+ reasoning: z.string().optional()
39
+ .describe("Explanation of why these suggestions were made"),
40
+ });
41
+ // Confirmation response - for explicit approval
42
+ export const ConfirmationResponse = BaseResponse.extend({
43
+ type: z.literal("confirmation"),
44
+ action: z.string().describe("Action that will be taken if confirmed"),
45
+ consequences: z.array(z.string()).optional()
46
+ .describe("List of effects or changes that will occur"),
47
+ defaultConfirm: z.boolean().optional()
48
+ .describe("Default choice if user provides no input (default: false)"),
49
+ });
50
+ // Union type for all response types
51
+ export const AgentResponse = z.discriminatedUnion("type", [
52
+ QuestionResponse,
53
+ SuggestionResponse,
54
+ ConfirmationResponse,
55
+ ]);
56
+ // Input schema for generating responses
57
+ export const GenerateResponseInput = z.object({
58
+ type: ResponseType.describe("Type of response to generate"),
59
+ message: z.string().describe("Main message"),
60
+ options: z.array(ResponseOption).optional()
61
+ .describe("Options for question/suggestion types"),
62
+ context: z.string().optional(),
63
+ priority: ResponsePriority.optional().default("medium"),
64
+ action: z.string().optional()
65
+ .describe("Action description (for confirmation type)"),
66
+ consequences: z.array(z.string()).optional()
67
+ .describe("Consequences list (for confirmation type)"),
68
+ reasoning: z.string().optional()
69
+ .describe("Reasoning explanation (for suggestion type)"),
70
+ defaultOption: z.string().optional()
71
+ .describe("Default option value (for question type)"),
72
+ defaultConfirm: z.boolean().optional()
73
+ .describe("Default confirmation choice (for confirmation type)"),
74
+ });
75
+ //# sourceMappingURL=response-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-schema.js","sourceRoot":"","sources":["../../src/schemas/response-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AAEH,iBAAiB;AACjB,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,UAA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AO,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;SACxC,QAAQ,CAAC,uCAAuC,CAAC;IACpD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,QAAQ,EAAE,gBAAgB,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;IACvD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SAC1B,QAAQ,CAAC,4CAA4C,CAAC;IACzD,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;SACzC,QAAQ,CAAC,2CAA2C,CAAC;IACxD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SAC7B,QAAQ,CAAC,6CAA6C,CAAC;IAC1D,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SACjC,QAAQ,CAAC,0CAA0C,CAAC;IACvD,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;SACnC,QAAQ,CAAC,qDAAqD,CAAC;CACnE,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=response-schema.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-schema.test.d.ts","sourceRoot":"","sources":["../../src/schemas/response-schema.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,256 @@
1
+ import { describe, expect, it } from "bun:test";
2
+ import { ResponseType, ResponsePriority, ResponseOption, QuestionResponse, SuggestionResponse, ConfirmationResponse, GenerateResponseInput, } from "./response-schema.js";
3
+ describe("Response Schema", () => {
4
+ describe("ResponseType", () => {
5
+ it("should accept valid response types", () => {
6
+ expect(() => ResponseType.parse("question")).not.toThrow();
7
+ expect(() => ResponseType.parse("suggestion")).not.toThrow();
8
+ expect(() => ResponseType.parse("confirmation")).not.toThrow();
9
+ });
10
+ it("should reject invalid response types", () => {
11
+ expect(() => ResponseType.parse("invalid")).toThrow();
12
+ expect(() => ResponseType.parse("ask")).toThrow();
13
+ });
14
+ });
15
+ describe("ResponsePriority", () => {
16
+ it("should accept valid priority levels", () => {
17
+ expect(() => ResponsePriority.parse("low")).not.toThrow();
18
+ expect(() => ResponsePriority.parse("medium")).not.toThrow();
19
+ expect(() => ResponsePriority.parse("high")).not.toThrow();
20
+ expect(() => ResponsePriority.parse("critical")).not.toThrow();
21
+ });
22
+ it("should reject invalid priority levels", () => {
23
+ expect(() => ResponsePriority.parse("urgent")).toThrow();
24
+ expect(() => ResponsePriority.parse("normal")).toThrow();
25
+ });
26
+ });
27
+ describe("ResponseOption", () => {
28
+ it("should validate option with all fields", () => {
29
+ const option = {
30
+ label: "High Priority",
31
+ value: "high",
32
+ description: "For urgent tasks",
33
+ };
34
+ expect(() => ResponseOption.parse(option)).not.toThrow();
35
+ const parsed = ResponseOption.parse(option);
36
+ expect(parsed.label).toBe("High Priority");
37
+ expect(parsed.value).toBe("high");
38
+ expect(parsed.description).toBe("For urgent tasks");
39
+ });
40
+ it("should validate option without description", () => {
41
+ const option = {
42
+ label: "Low Priority",
43
+ value: "low",
44
+ };
45
+ expect(() => ResponseOption.parse(option)).not.toThrow();
46
+ const parsed = ResponseOption.parse(option);
47
+ expect(parsed.label).toBe("Low Priority");
48
+ expect(parsed.value).toBe("low");
49
+ expect(parsed.description).toBeUndefined();
50
+ });
51
+ it("should reject option without required fields", () => {
52
+ expect(() => ResponseOption.parse({ label: "Test" })).toThrow();
53
+ expect(() => ResponseOption.parse({ value: "test" })).toThrow();
54
+ expect(() => ResponseOption.parse({})).toThrow();
55
+ });
56
+ });
57
+ describe("QuestionResponse", () => {
58
+ it("should validate question with all fields", () => {
59
+ const question = {
60
+ type: "question",
61
+ message: "What should we do?",
62
+ context: "Need clarification on approach",
63
+ priority: "high",
64
+ options: [
65
+ { label: "Option A", value: "a" },
66
+ { label: "Option B", value: "b" },
67
+ ],
68
+ defaultOption: "a",
69
+ };
70
+ expect(() => QuestionResponse.parse(question)).not.toThrow();
71
+ const parsed = QuestionResponse.parse(question);
72
+ expect(parsed.type).toBe("question");
73
+ expect(parsed.message).toBe("What should we do?");
74
+ expect(parsed.options).toHaveLength(2);
75
+ expect(parsed.defaultOption).toBe("a");
76
+ });
77
+ it("should validate question with minimal fields", () => {
78
+ const question = {
79
+ type: "question",
80
+ message: "Proceed?",
81
+ };
82
+ expect(() => QuestionResponse.parse(question)).not.toThrow();
83
+ const parsed = QuestionResponse.parse(question);
84
+ expect(parsed.type).toBe("question");
85
+ expect(parsed.message).toBe("Proceed?");
86
+ expect(parsed.context).toBeUndefined();
87
+ expect(parsed.options).toBeUndefined();
88
+ });
89
+ it("should reject question without message", () => {
90
+ expect(() => QuestionResponse.parse({ type: "question" })).toThrow();
91
+ });
92
+ it("should reject question with wrong type", () => {
93
+ expect(() => QuestionResponse.parse({
94
+ type: "suggestion",
95
+ message: "Test",
96
+ })).toThrow();
97
+ });
98
+ });
99
+ describe("SuggestionResponse", () => {
100
+ it("should validate suggestion with all fields", () => {
101
+ const suggestion = {
102
+ type: "suggestion",
103
+ message: "Consider breaking down this task",
104
+ context: "Task is complex",
105
+ priority: "medium",
106
+ options: [
107
+ { label: "3 subtasks", value: "sub_3" },
108
+ { label: "5 subtasks", value: "sub_5" },
109
+ ],
110
+ reasoning: "Based on complexity analysis",
111
+ };
112
+ expect(() => SuggestionResponse.parse(suggestion)).not.toThrow();
113
+ const parsed = SuggestionResponse.parse(suggestion);
114
+ expect(parsed.type).toBe("suggestion");
115
+ expect(parsed.options).toHaveLength(2);
116
+ expect(parsed.reasoning).toBe("Based on complexity analysis");
117
+ });
118
+ it("should validate suggestion with minimal fields", () => {
119
+ const suggestion = {
120
+ type: "suggestion",
121
+ message: "Try this",
122
+ options: [{ label: "Do it", value: "yes" }],
123
+ };
124
+ expect(() => SuggestionResponse.parse(suggestion)).not.toThrow();
125
+ const parsed = SuggestionResponse.parse(suggestion);
126
+ expect(parsed.options).toHaveLength(1);
127
+ });
128
+ it("should reject suggestion without options", () => {
129
+ expect(() => SuggestionResponse.parse({
130
+ type: "suggestion",
131
+ message: "Test",
132
+ })).toThrow();
133
+ });
134
+ it("should reject suggestion with empty options array", () => {
135
+ expect(() => SuggestionResponse.parse({
136
+ type: "suggestion",
137
+ message: "Test",
138
+ options: [],
139
+ })).toThrow();
140
+ });
141
+ });
142
+ describe("ConfirmationResponse", () => {
143
+ it("should validate confirmation with all fields", () => {
144
+ const confirmation = {
145
+ type: "confirmation",
146
+ message: "Are you sure?",
147
+ action: "Delete all completed tasks",
148
+ context: "This operation is irreversible",
149
+ priority: "critical",
150
+ consequences: ["10 tasks will be removed", "Cannot be undone"],
151
+ defaultConfirm: false,
152
+ };
153
+ expect(() => ConfirmationResponse.parse(confirmation)).not.toThrow();
154
+ const parsed = ConfirmationResponse.parse(confirmation);
155
+ expect(parsed.type).toBe("confirmation");
156
+ expect(parsed.action).toBe("Delete all completed tasks");
157
+ expect(parsed.consequences).toHaveLength(2);
158
+ expect(parsed.defaultConfirm).toBe(false);
159
+ });
160
+ it("should validate confirmation with minimal fields", () => {
161
+ const confirmation = {
162
+ type: "confirmation",
163
+ message: "Delete this?",
164
+ action: "Delete task",
165
+ };
166
+ expect(() => ConfirmationResponse.parse(confirmation)).not.toThrow();
167
+ const parsed = ConfirmationResponse.parse(confirmation);
168
+ expect(parsed.action).toBe("Delete task");
169
+ expect(parsed.consequences).toBeUndefined();
170
+ });
171
+ it("should reject confirmation without action", () => {
172
+ expect(() => ConfirmationResponse.parse({
173
+ type: "confirmation",
174
+ message: "Confirm?",
175
+ })).toThrow();
176
+ });
177
+ it("should reject confirmation without message", () => {
178
+ expect(() => ConfirmationResponse.parse({
179
+ type: "confirmation",
180
+ action: "Do something",
181
+ })).toThrow();
182
+ });
183
+ });
184
+ describe("GenerateResponseInput", () => {
185
+ it("should validate input for question type", () => {
186
+ const input = {
187
+ type: "question",
188
+ message: "What to do?",
189
+ options: [{ label: "Yes", value: "yes" }],
190
+ defaultOption: "yes",
191
+ };
192
+ expect(() => GenerateResponseInput.parse(input)).not.toThrow();
193
+ const parsed = GenerateResponseInput.parse(input);
194
+ expect(parsed.type).toBe("question");
195
+ });
196
+ it("should validate input for suggestion type", () => {
197
+ const input = {
198
+ type: "suggestion",
199
+ message: "Try this",
200
+ options: [{ label: "Option", value: "opt" }],
201
+ reasoning: "Because reasons",
202
+ };
203
+ expect(() => GenerateResponseInput.parse(input)).not.toThrow();
204
+ });
205
+ it("should validate input for confirmation type", () => {
206
+ const input = {
207
+ type: "confirmation",
208
+ message: "Sure?",
209
+ action: "Delete",
210
+ consequences: ["Gone forever"],
211
+ defaultConfirm: false,
212
+ };
213
+ expect(() => GenerateResponseInput.parse(input)).not.toThrow();
214
+ });
215
+ it("should use default priority of medium", () => {
216
+ const input = {
217
+ type: "question",
218
+ message: "Test?",
219
+ };
220
+ const parsed = GenerateResponseInput.parse(input);
221
+ expect(parsed.priority).toBe("medium");
222
+ });
223
+ it("should allow custom priority", () => {
224
+ const input = {
225
+ type: "question",
226
+ message: "Test?",
227
+ priority: "critical",
228
+ };
229
+ const parsed = GenerateResponseInput.parse(input);
230
+ expect(parsed.priority).toBe("critical");
231
+ });
232
+ });
233
+ describe("Type discrimination", () => {
234
+ it("should differentiate response types at compile time", () => {
235
+ const question = {
236
+ type: "question",
237
+ message: "Test",
238
+ };
239
+ const suggestion = {
240
+ type: "suggestion",
241
+ message: "Test",
242
+ options: [{ label: "A", value: "a" }],
243
+ };
244
+ const confirmation = {
245
+ type: "confirmation",
246
+ message: "Test",
247
+ action: "Do it",
248
+ };
249
+ // TypeScript should allow this
250
+ expect(question.type).toBe("question");
251
+ expect(suggestion.type).toBe("suggestion");
252
+ expect(confirmation.type).toBe("confirmation");
253
+ });
254
+ });
255
+ });
256
+ //# sourceMappingURL=response-schema.test.js.map