@studious-lms/server 1.3.0 → 1.4.1

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 (77) hide show
  1. package/dist/models/class.d.ts +24 -2
  2. package/dist/models/class.d.ts.map +1 -1
  3. package/dist/models/class.js +180 -81
  4. package/dist/models/class.js.map +1 -1
  5. package/dist/models/worksheet.d.ts +34 -34
  6. package/dist/pipelines/aiLabChat.d.ts +61 -2
  7. package/dist/pipelines/aiLabChat.d.ts.map +1 -1
  8. package/dist/pipelines/aiLabChat.js +204 -172
  9. package/dist/pipelines/aiLabChat.js.map +1 -1
  10. package/dist/pipelines/aiLabChatContract.d.ts +413 -0
  11. package/dist/pipelines/aiLabChatContract.d.ts.map +1 -0
  12. package/dist/pipelines/aiLabChatContract.js +74 -0
  13. package/dist/pipelines/aiLabChatContract.js.map +1 -0
  14. package/dist/pipelines/gradeWorksheet.d.ts +4 -4
  15. package/dist/pipelines/labChatPrompt.d.ts +2 -0
  16. package/dist/pipelines/labChatPrompt.d.ts.map +1 -0
  17. package/dist/pipelines/labChatPrompt.js +72 -0
  18. package/dist/pipelines/labChatPrompt.js.map +1 -0
  19. package/dist/routers/_app.d.ts +284 -56
  20. package/dist/routers/_app.d.ts.map +1 -1
  21. package/dist/routers/_app.js +4 -2
  22. package/dist/routers/_app.js.map +1 -1
  23. package/dist/routers/class.d.ts +24 -3
  24. package/dist/routers/class.d.ts.map +1 -1
  25. package/dist/routers/class.js +3 -3
  26. package/dist/routers/class.js.map +1 -1
  27. package/dist/routers/labChat.d.ts +10 -1
  28. package/dist/routers/labChat.d.ts.map +1 -1
  29. package/dist/routers/labChat.js +6 -3
  30. package/dist/routers/labChat.js.map +1 -1
  31. package/dist/routers/message.d.ts +11 -0
  32. package/dist/routers/message.d.ts.map +1 -1
  33. package/dist/routers/message.js +10 -3
  34. package/dist/routers/message.js.map +1 -1
  35. package/dist/routers/studentProgress.d.ts +75 -0
  36. package/dist/routers/studentProgress.d.ts.map +1 -0
  37. package/dist/routers/studentProgress.js +33 -0
  38. package/dist/routers/studentProgress.js.map +1 -0
  39. package/dist/routers/worksheet.d.ts +24 -24
  40. package/dist/services/class.d.ts +24 -2
  41. package/dist/services/class.d.ts.map +1 -1
  42. package/dist/services/class.js +18 -6
  43. package/dist/services/class.js.map +1 -1
  44. package/dist/services/labChat.d.ts +5 -1
  45. package/dist/services/labChat.d.ts.map +1 -1
  46. package/dist/services/labChat.js +112 -4
  47. package/dist/services/labChat.js.map +1 -1
  48. package/dist/services/message.d.ts +8 -0
  49. package/dist/services/message.d.ts.map +1 -1
  50. package/dist/services/message.js +116 -2
  51. package/dist/services/message.js.map +1 -1
  52. package/dist/services/studentProgress.d.ts +45 -0
  53. package/dist/services/studentProgress.d.ts.map +1 -0
  54. package/dist/services/studentProgress.js +291 -0
  55. package/dist/services/studentProgress.js.map +1 -0
  56. package/dist/services/worksheet.d.ts +18 -18
  57. package/package.json +2 -2
  58. package/prisma/schema.prisma +1 -1
  59. package/sentry.properties +3 -0
  60. package/src/models/class.ts +189 -84
  61. package/src/pipelines/aiLabChat.ts +246 -184
  62. package/src/pipelines/aiLabChatContract.ts +75 -0
  63. package/src/pipelines/labChatPrompt.ts +68 -0
  64. package/src/routers/_app.ts +4 -2
  65. package/src/routers/class.ts +1 -1
  66. package/src/routers/labChat.ts +7 -0
  67. package/src/routers/message.ts +13 -0
  68. package/src/routers/studentProgress.ts +47 -0
  69. package/src/services/class.ts +14 -7
  70. package/src/services/labChat.ts +120 -5
  71. package/src/services/message.ts +142 -0
  72. package/src/services/studentProgress.ts +390 -0
  73. package/tests/lib/aiLabChatContract.test.ts +32 -0
  74. package/tests/pipelines/aiLabChat.test.ts +95 -0
  75. package/tests/routers/studentProgress.test.ts +283 -0
  76. package/tests/utils/aiLabChatPrompt.test.ts +18 -0
  77. package/vitest.unit.config.ts +7 -1
@@ -0,0 +1,74 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7a33c9d9-5e66-5471-8c8b-87f46153e79a")}catch(e){}}();
3
+ import z from "zod";
4
+ export const labChatResponseSchema = z.object({
5
+ text: z.string(),
6
+ worksheetsToCreate: z.array(z.object({
7
+ title: z.string(),
8
+ questions: z.array(z.object({
9
+ type: z.enum(["MULTIPLE_CHOICE", "TRUE_FALSE", "SHORT_ANSWER", "LONG_ANSWER", "MATH_EXPRESSION", "ESSAY"]),
10
+ question: z.string(),
11
+ answer: z.string(),
12
+ options: z.array(z.object({
13
+ id: z.string(),
14
+ text: z.string(),
15
+ isCorrect: z.boolean(),
16
+ })).optional().default([]),
17
+ markScheme: z.array(z.object({
18
+ id: z.string(),
19
+ points: z.number(),
20
+ description: z.string(),
21
+ })).optional().default([]),
22
+ points: z.number().optional().default(0),
23
+ order: z.number(),
24
+ })),
25
+ })).default([]),
26
+ sectionsToCreate: z.array(z.object({
27
+ name: z.string(),
28
+ color: z.string().regex(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),
29
+ })).default([]),
30
+ assignmentsToCreate: z.array(z.object({
31
+ title: z.string(),
32
+ instructions: z.string(),
33
+ dueDate: z.string().datetime(),
34
+ acceptFiles: z.boolean(),
35
+ acceptExtendedResponse: z.boolean(),
36
+ acceptWorksheet: z.boolean(),
37
+ maxGrade: z.number(),
38
+ gradingBoundaryId: z.string().nullable().optional(),
39
+ markSchemeId: z.string().nullable().optional(),
40
+ worksheetIds: z.array(z.string()),
41
+ studentIds: z.array(z.string()),
42
+ sectionId: z.string().nullable().optional(),
43
+ type: z.enum(["HOMEWORK", "QUIZ", "TEST", "PROJECT", "ESSAY", "DISCUSSION", "PRESENTATION", "LAB", "OTHER"]),
44
+ attachments: z.array(z.object({
45
+ id: z.string(),
46
+ })),
47
+ })).nullable().optional(),
48
+ docs: z.array(z.object({
49
+ title: z.string(),
50
+ blocks: z.array(z.object({
51
+ format: z.number().int().min(0).max(12),
52
+ content: z.union([z.string(), z.array(z.string())]),
53
+ metadata: z.object({
54
+ fontSize: z.number().min(6).nullable().optional(),
55
+ lineHeight: z.number().min(0.6).nullable().optional(),
56
+ paragraphSpacing: z.number().min(0).nullable().optional(),
57
+ indentWidth: z.number().min(0).nullable().optional(),
58
+ paddingX: z.number().min(0).nullable().optional(),
59
+ paddingY: z.number().min(0).nullable().optional(),
60
+ font: z.number().int().min(0).max(5).nullable().optional(),
61
+ color: z.string().regex(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),
62
+ background: z.string().regex(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),
63
+ align: z.enum(["left", "center", "right"]).nullable().optional(),
64
+ }).nullable().optional(),
65
+ })),
66
+ })).nullable().optional(),
67
+ });
68
+ export const labChatResponseFormat = `{ "text": string, "docs": null | array, "worksheetsToCreate": array, "sectionsToCreate": array, "assignmentsToCreate": null | array }`;
69
+ export const labChatArrayFieldInstructions = [
70
+ `- "worksheetsToCreate": always output an array. Use [] when there are no worksheets to create.`,
71
+ `- "sectionsToCreate": always output an array. Use [] when there are no sections to create.`,
72
+ ].join("\n");
73
+ //# sourceMappingURL=aiLabChatContract.js.map
74
+ //# debugId=7a33c9d9-5e66-5471-8c8b-87f46153e79a
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aiLabChatContract.js","sources":["pipelines/aiLabChatContract.ts"],"sourceRoot":"/","sourcesContent":["import z from \"zod\";\n\nexport const labChatResponseSchema = z.object({\n text: z.string(),\n worksheetsToCreate: z.array(z.object({\n title: z.string(),\n questions: z.array(z.object({\n type: z.enum([\"MULTIPLE_CHOICE\", \"TRUE_FALSE\", \"SHORT_ANSWER\", \"LONG_ANSWER\", \"MATH_EXPRESSION\", \"ESSAY\"]),\n question: z.string(),\n answer: z.string(),\n options: z.array(z.object({\n id: z.string(),\n text: z.string(),\n isCorrect: z.boolean(),\n })).optional().default([]),\n markScheme: z.array(z.object({\n id: z.string(),\n points: z.number(),\n description: z.string(),\n })).optional().default([]),\n points: z.number().optional().default(0),\n order: z.number(),\n })),\n })).default([]),\n sectionsToCreate: z.array(z.object({\n name: z.string(),\n color: z.string().regex(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),\n })).default([]),\n assignmentsToCreate: z.array(z.object({\n title: z.string(),\n instructions: z.string(),\n dueDate: z.string().datetime(),\n acceptFiles: z.boolean(),\n acceptExtendedResponse: z.boolean(),\n acceptWorksheet: z.boolean(),\n maxGrade: z.number(),\n gradingBoundaryId: z.string().nullable().optional(),\n markSchemeId: z.string().nullable().optional(),\n worksheetIds: z.array(z.string()),\n studentIds: z.array(z.string()),\n sectionId: z.string().nullable().optional(),\n type: z.enum([\"HOMEWORK\", \"QUIZ\", \"TEST\", \"PROJECT\", \"ESSAY\", \"DISCUSSION\", \"PRESENTATION\", \"LAB\", \"OTHER\"]),\n attachments: z.array(z.object({\n id: z.string(),\n })),\n })).nullable().optional(),\n docs: z.array(z.object({\n title: z.string(),\n blocks: z.array(z.object({\n format: z.number().int().min(0).max(12),\n content: z.union([z.string(), z.array(z.string())]),\n metadata: z.object({\n fontSize: z.number().min(6).nullable().optional(),\n lineHeight: z.number().min(0.6).nullable().optional(),\n paragraphSpacing: z.number().min(0).nullable().optional(),\n indentWidth: z.number().min(0).nullable().optional(),\n paddingX: z.number().min(0).nullable().optional(),\n paddingY: z.number().min(0).nullable().optional(),\n font: z.number().int().min(0).max(5).nullable().optional(),\n color: z.string().regex(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),\n background: z.string().regex(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),\n align: z.enum([\"left\", \"center\", \"right\"]).nullable().optional(),\n }).nullable().optional(),\n })),\n })).nullable().optional(),\n});\n\nexport type LabChatResponse = z.infer<typeof labChatResponseSchema>;\n\nexport const labChatResponseFormat = `{ \"text\": string, \"docs\": null | array, \"worksheetsToCreate\": array, \"sectionsToCreate\": array, \"assignmentsToCreate\": null | array }`;\n\nexport const labChatArrayFieldInstructions = [\n `- \"worksheetsToCreate\": always output an array. Use [] when there are no worksheets to create.`,\n `- \"sectionsToCreate\": always output an array. Use [] when there are no sections to create.`,\n].join(\"\\n\");\n"],"names":[],"mappings":";;AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,kBAAkB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;QACnC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;YAC1B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,iBAAiB,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC;YAC1G,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;YACpB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;YAClB,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;gBACxB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;gBACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;gBAChB,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;aACvB,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1B,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;gBAC3B,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;gBACd,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;gBAClB,WAAW,E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c9d9-5e66-5471-8c8b-87f46153e79a"}
@@ -6,12 +6,12 @@ export declare const cancelGradePipeline: (worksheetResponseId: string, workshee
6
6
  updatedAt: Date | null;
7
7
  feedback: string | null;
8
8
  studentId: string;
9
+ points: number;
9
10
  response: string;
10
11
  isCorrect: boolean;
11
12
  markschemeState: import("@prisma/client/runtime/library.js").JsonValue | null;
12
- points: number;
13
- questionId: string;
14
13
  studentWorksheetResponseId: string | null;
14
+ questionId: string;
15
15
  }>;
16
16
  export declare const regradeWorksheetPipeline: (worksheetResponseId: string, worksheetQuestionProgressId: string) => Promise<{
17
17
  status: import(".prisma/client").$Enums.GenerationStatus | null;
@@ -20,11 +20,11 @@ export declare const regradeWorksheetPipeline: (worksheetResponseId: string, wor
20
20
  updatedAt: Date | null;
21
21
  feedback: string | null;
22
22
  studentId: string;
23
+ points: number;
23
24
  response: string;
24
25
  isCorrect: boolean;
25
26
  markschemeState: import("@prisma/client/runtime/library.js").JsonValue | null;
26
- points: number;
27
- questionId: string;
28
27
  studentWorksheetResponseId: string | null;
28
+ questionId: string;
29
29
  }>;
30
30
  //# sourceMappingURL=gradeWorksheet.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const buildLabChatSystemPrompt: (context: string) => string;
2
+ //# sourceMappingURL=labChatPrompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labChatPrompt.d.ts","sourceRoot":"/","sources":["pipelines/labChatPrompt.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,GAAI,SAAS,MAAM,KAAG,MAmE0B,CAAC"}
@@ -0,0 +1,72 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="407ec8dc-78cc-534a-bb79-46560641c6a8")}catch(e){}}();
3
+ export const buildLabChatSystemPrompt = (context) => `${context}
4
+
5
+ IMPORTANT INSTRUCTIONS:
6
+ - Use the context information above (subject, topic, difficulty, objectives, etc.) as your foundation
7
+ - A separate CLASS CONTEXT message lists this class's sections, mark schemes, grading boundaries, worksheets, files, and students with their database IDs
8
+ - Do NOT ask teachers about technical details (hex codes, format numbers, IDs, schema fields). Use sensible defaults yourself.
9
+ - Only ask clarifying questions about content or pedagogy (e.g., topic scope, difficulty, number of questions). Never ask "what hex color?" or "which format?"
10
+ - When creating content, make reasonable choices: pick nice default colors, use standard formatting. Teachers care about the content, not implementation.
11
+ - Only output final course materials when you have sufficient details about the content itself
12
+ - Do not use markdown in your responses - use plain text only
13
+ - You are primarily a chatbot - only provide docs/assignments when the teacher explicitly requests them
14
+ - If the request is vague, ask 1-2 high-level clarifying questions (topic, scope, style) - never technical ones
15
+
16
+ CRITICAL: REFERENCING OBJECTS - NAMES vs IDs:
17
+ - In "text": Refer to objects by NAME (e.g., "Unit 1", "Biology Rubric", "Cell_Structure_Worksheet")
18
+ - In "assignmentsToCreate", "worksheetsToCreate", "sectionsToCreate": Use DATABASE IDs from the CLASS CONTEXT
19
+ * sectionId, gradingBoundaryId, markSchemeId, worksheetIds, studentIds, attachments[].id must be real IDs from the context
20
+ * If the class has no sections/mark schemes/grading boundaries, use sectionsToCreate first, or omit optional IDs
21
+
22
+ RESPONSE FORMAT (JSON):
23
+ { "text": string, "docs": null | array, "worksheetsToCreate": array, "sectionsToCreate": array, "assignmentsToCreate": null | array }
24
+
25
+ CRITICAL ARRAY RULES:
26
+ - "worksheetsToCreate" must always be an array. Use [] when there are no worksheets to create.
27
+ - "sectionsToCreate" must always be an array. Use [] when there are no sections to create.
28
+ - Do not return null for "worksheetsToCreate" or "sectionsToCreate".
29
+
30
+ CRITICAL - "text" field rules:
31
+ - "text" must be a SHORT conversational summary (2-4 sentences). Plain text, no markdown.
32
+ - NEVER list assignment/worksheet fields in text (no "Type:", "dueDate:", "worksheetIds:", "sectionId:", etc.)
33
+ - NEVER dump schema or JSON-like output in text. The teacher sees the actual content in UI cards below.
34
+ - Good example: "I've created 4 assignments for Unit 1: Week 1 homework on the worksheet, Week 2 quiz, Week 3 lab activity, and Week 4 review test. You can create them below."
35
+ - Bad example: "Week 1 - Homework. Type: HOMEWORK. dueDate: 2026-03-10. worksheetIds: [...]" - NEVER do this.
36
+
37
+ - "docs": PDF documents when creating course materials (worksheets, handouts, answer keys)
38
+ - "worksheetsToCreate": Worksheets with questions when teacher wants structured assessments. Always return an array.
39
+ - "sectionsToCreate": New sections when the class has none or teacher wants new units. Always return an array.
40
+ - "assignmentsToCreate": Assignments when teacher explicitly requests them. Use IDs from CLASS CONTEXT. The structured data goes HERE only, not in text.
41
+
42
+ WHEN CREATING DOCUMENTS (docs):
43
+ - docs: [ { "title": string, "blocks": [ { "format": 0-12, "content": string | string[], "metadata"?: {...} } ] } ]
44
+ - Format: 0=H1, 1=H2, 2=H3, 3=H4, 4=H5, 5=H6, 6=PARAGRAPH, 7=BULLET, 8=NUMBERED, 9=TABLE, 10=IMAGE, 11=CODE_BLOCK, 12=QUOTE
45
+ - Bullets (7) and Numbered (8): content is array of strings; do NOT include * or 1. 2. 3. - renderer adds them
46
+ - Table (9) and Image (10) not supported - do not emit
47
+ - Colors: use sensible defaults (e.g. "#3B82F6" blue, "#10B981" green) - never ask the teacher
48
+
49
+ WHEN CREATING WORKSHEETS (worksheetsToCreate):
50
+ - Return an array every time, even when empty.
51
+ - Question types: MULTIPLE_CHOICE, TRUE_FALSE, SHORT_ANSWER, LONG_ANSWER, MATH_EXPRESSION, ESSAY
52
+ - For MULTIPLE_CHOICE/TRUE_FALSE: options array with { id, text, isCorrect }
53
+ - For others: options can be empty; answer holds the key
54
+ - markScheme: array of { id, points, description } for rubric items
55
+ - points: total points per question; order: display order
56
+
57
+ WHEN CREATING SECTIONS (sectionsToCreate):
58
+ - Return an array every time, even when empty.
59
+ - Use when class has no sections or teacher wants new units (e.g., "Unit 1", "Chapter 3")
60
+ - color: pick a nice default (e.g. "#3B82F6") - do not ask
61
+
62
+ WHEN CREATING ASSIGNMENTS (assignmentsToCreate):
63
+ - Put ALL assignment data (title, type, dueDate, instructions, worksheetIds, etc.) ONLY in assignmentsToCreate. The "text" field gets a brief friendly summary only.
64
+ - Use IDs from CLASS CONTEXT. If class has no sections, suggest sectionsToCreate first.
65
+ - type: HOMEWORK | QUIZ | TEST | PROJECT | ESSAY | DISCUSSION | PRESENTATION | LAB | OTHER
66
+ - sectionId, gradingBoundaryId, markSchemeId: use from context; omit if class has none (suggest creating first)
67
+ - studentIds: empty array = assign to all; otherwise list specific student IDs
68
+ - worksheetIds: IDs of existing worksheets; empty if using docs-only or new worksheets
69
+ - attachments[].id: file IDs from CLASS CONTEXT (PDFs, documents)
70
+ - acceptFiles, acceptExtendedResponse, acceptWorksheet: set based on assignment type`;
71
+ //# sourceMappingURL=labChatPrompt.js.map
72
+ //# debugId=407ec8dc-78cc-534a-bb79-46560641c6a8
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labChatPrompt.js","sources":["pipelines/labChatPrompt.ts"],"sourceRoot":"/","sourcesContent":["export const buildLabChatSystemPrompt = (context: string): string => `${context}\n\nIMPORTANT INSTRUCTIONS:\n- Use the context information above (subject, topic, difficulty, objectives, etc.) as your foundation\n- A separate CLASS CONTEXT message lists this class's sections, mark schemes, grading boundaries, worksheets, files, and students with their database IDs\n- Do NOT ask teachers about technical details (hex codes, format numbers, IDs, schema fields). Use sensible defaults yourself.\n- Only ask clarifying questions about content or pedagogy (e.g., topic scope, difficulty, number of questions). Never ask \"what hex color?\" or \"which format?\"\n- When creating content, make reasonable choices: pick nice default colors, use standard formatting. Teachers care about the content, not implementation.\n- Only output final course materials when you have sufficient details about the content itself\n- Do not use markdown in your responses - use plain text only\n- You are primarily a chatbot - only provide docs/assignments when the teacher explicitly requests them\n- If the request is vague, ask 1-2 high-level clarifying questions (topic, scope, style) - never technical ones\n\nCRITICAL: REFERENCING OBJECTS - NAMES vs IDs:\n- In \"text\": Refer to objects by NAME (e.g., \"Unit 1\", \"Biology Rubric\", \"Cell_Structure_Worksheet\")\n- In \"assignmentsToCreate\", \"worksheetsToCreate\", \"sectionsToCreate\": Use DATABASE IDs from the CLASS CONTEXT\n * sectionId, gradingBoundaryId, markSchemeId, worksheetIds, studentIds, attachments[].id must be real IDs from the context\n * If the class has no sections/mark schemes/grading boundaries, use sectionsToCreate first, or omit optional IDs\n\nRESPONSE FORMAT (JSON):\n{ \"text\": string, \"docs\": null | array, \"worksheetsToCreate\": array, \"sectionsToCreate\": array, \"assignmentsToCreate\": null | array }\n\nCRITICAL ARRAY RULES:\n- \"worksheetsToCreate\" must always be an array. Use [] when there are no worksheets to create.\n- \"sectionsToCreate\" must always be an array. Use [] when there are no sections to create.\n- Do not return null for \"worksheetsToCreate\" or \"sectionsToCreate\".\n\nCRITICAL - \"text\" field rules:\n- \"text\" must be a SHORT conversational summary (2-4 sentences). Plain text, no markdown.\n- NEVER list assignment/worksheet fields in text (no \"Type:\", \"dueDate:\", \"worksheetIds:\", \"sectionId:\", etc.)\n- NEVER dump schema or JSON-like output in text. The teacher sees the actual content in UI cards below.\n- Good example: \"I've created 4 assignments for Unit 1: Week 1 homework on the worksheet, Week 2 quiz, Week 3 lab activity, and Week 4 review test. You can create them below.\"\n- Bad example: \"Week 1 - Homework. Type: HOMEWORK. dueDate: 2026-03-10. worksheetIds: [...]\" - NEVER do this.\n\n- \"docs\": PDF documents when creating course materials (worksheets, handouts, answer keys)\n- \"worksheetsToCreate\": Worksheets with questions when teacher wants structured assessments. Always return an array.\n- \"sectionsToCreate\": New sections when the class has none or teacher wants new units. Always return an array.\n- \"assignmentsToCreate\": Assignments when teacher explicitly requests them. Use IDs from CLASS CONTEXT. The structured data goes HERE only, not in text.\n\nWHEN CREATING DOCUMENTS (docs):\n- docs: [ { \"title\": string, \"blocks\": [ { \"format\": 0-12, \"content\": string | string[], \"metadata\"?: {...} } ] } ]\n- Format: 0=H1, 1=H2, 2=H3, 3=H4, 4=H5, 5=H6, 6=PARAGRAPH, 7=BULLET, 8=NUMBERED, 9=TABLE, 10=IMAGE, 11=CODE_BLOCK, 12=QUOTE\n- Bullets (7) and Numbered (8): content is array of strings; do NOT include * or 1. 2. 3. - renderer adds them\n- Table (9) and Image (10) not supported - do not emit\n- Colors: use sensible defaults (e.g. \"#3B82F6\" blue, \"#10B981\" green) - never ask the teacher\n\nWHEN CREATING WORKSHEETS (worksheetsToCreate):\n- Return an array every time, even when empty.\n- Question types: MULTIPLE_CHOICE, TRUE_FALSE, SHORT_ANSWER, LONG_ANSWER, MATH_EXPRESSION, ESSAY\n- For MULTIPLE_CHOICE/TRUE_FALSE: options array with { id, text, isCorrect }\n- For others: options can be empty; answer holds the key\n- markScheme: array of { id, points, description } for rubric items\n- points: total points per question; order: display order\n\nWHEN CREATING SECTIONS (sectionsToCreate):\n- Return an array every time, even when empty.\n- Use when class has no sections or teacher wants new units (e.g., \"Unit 1\", \"Chapter 3\")\n- color: pick a nice default (e.g. \"#3B82F6\") - do not ask\n\nWHEN CREATING ASSIGNMENTS (assignmentsToCreate):\n- Put ALL assignment data (title, type, dueDate, instructions, worksheetIds, etc.) ONLY in assignmentsToCreate. The \"text\" field gets a brief friendly summary only.\n- Use IDs from CLASS CONTEXT. If class has no sections, suggest sectionsToCreate first.\n- type: HOMEWORK | QUIZ | TEST | PROJECT | ESSAY | DISCUSSION | PRESENTATION | LAB | OTHER\n- sectionId, gradingBoundaryId, markSchemeId: use from context; omit if class has none (suggest creating first)\n- studentIds: empty array = assign to all; otherwise list specific student IDs\n- worksheetIds: IDs of existing worksheets; empty if using docs-only or new worksheets\n- attachments[].id: file IDs from CLASS CONTEXT (PDFs, documents)\n- acceptFiles, acceptExtendedResponse, acceptWorksheet: set based on assignment type`;\n"],"names":[],"mappings":";;AAAA,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,GAAG,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qFAmEM,CAAC","debug_id":"407ec8dc-78cc-534a-bb79-46560641c6a8"}