@eliceio/cdk-cli 1.6.0-entryqa.0 → 1.6.0-entryqa.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eliceio/cdk-cli",
3
- "version": "1.6.0-entryqa.0",
3
+ "version": "1.6.0-entryqa.1",
4
4
  "description": "교육자용 Custom HTML 콘텐츠 CLI",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -46,7 +46,7 @@
46
46
  "rollup": "^4.0.0",
47
47
  "tslib": "^2.6.1",
48
48
  "typescript": "~5.9.3",
49
- "@eliceio/cdk": "^1.6.0-entryqa.0"
49
+ "@eliceio/cdk": "^1.6.0-entryqa.1"
50
50
  },
51
51
  "scripts": {
52
52
  "prebuild": "del-cli \"buildcache/*\" \"es/*\"",
@@ -37,7 +37,7 @@ Read or watch / change values and observe (simulation, visualization) / follow s
37
37
  - **`entry` (Entry template only, two modes)**: `{ "type": "entry", "mode": "general", "answer_project": { "enc": "gzip+base64", "data": "…" } }` (compared with the answer project, 0 or 100; no other keys) or `{ "type": "entry", "mode": "ai", "answer_project": {…}, "rubrics": [{ "object": "ik8o", "criteria": "…", "score": 100 }] }` (`object` is an object id of the answer project — there is no whole-project criterion, `""` or an unknown id is rejected with 422 `entry_rubric_object_not_found`; the AI mode also needs `settings.entry.startProject`, and the general answer project needs at least one script or global list, else 422 `entry_answer_project_empty`; 1–10 criteria of 1–1,000 characters, integer scores 1–100 summing to 100; `question_results` and `grading_feedback.criteria` per criterion, in the submit response and in the submission history). The Entry template's edit screen saves it; do not write it by hand.
38
38
  - **Choosing between `pattern` and `partial_pattern` is the person's call.** For a material with several questions, ask: "모두 맞혀야 100점" (`pattern`) or "문항별 부분 점수" (`partial_pattern`). For partial scores, take the per-question scores from the person or from the planning material; if neither gives them, use an equal score and say so in the summary (the quiz template's automatic score is `ceil(100 / questions)` each, 3 → 34 · 34 · 34; the kit's `splitScores` sums to exactly 100, 3 → 33 · 33 · 34). In the quiz template the author can also change the grader and the scores on the edit screen. Scores are integers 0–100 summing to at least 100 (usually exactly 100). Students must answer every question before they submit (the quiz blocks an unanswered question), so a skipped question cannot score 0 by design.
39
39
  - **Regexes run on the server in Python `re`**, not JavaScript: for a case-insensitive match put `(?i)` at the very start (`(?i)^(paris|파리)$`); the kit, `ecdk dev` and the local mock turn a leading `(?i)` · `(?s)` · `(?m)` into the JS flag. Avoid what the two engines read differently: `\w` · `\d` · `\b` match Unicode (Korean letters, full-width digits) in Python but only ASCII in JS, so write the characters out (`[0-9]`, `[가-힣A-Za-z]`); named groups are `(?P<name>…)` in Python and `(?<name>…)` in JS (do not use them); lookbehind must be fixed-width in Python; inline flags anywhere but the start fail in both. The generated keys (escaped literals, `(?:…|…)`, `^…$`) mean the same in both.
40
- - **The completion policy is picked in LXP**, not in the project: the publish skill proposes it from this table and sets it with the upload after the person agrees (graded: the quiz template or settings with `grading` → `on_graded`; the survey template → `on_access` (decided 2026-11-25; may change; it still submits with `useSubmit`); other submits without grading → `on_submit`; no submission → `on_access`), or the instructor chooses it in the '설정' panel at the top of the LXP edit page, which applies at once (ADR 0012). `on_graded` needs `settings.grading` saved first, so it goes in the same save as settings with `grading`, or later. Do not write it in `metadata.json` (the old `completionPolicies` and `screens.completionPolicy` are ignored with the warning `manifest.completion-policies-ignored`, and `ecdk build` leaves them out of the zip). The content can read the current policy (SDK `material.completionPolicy`) but never sets it. Build what the suggested policy needs: a submission (`useSubmit`) for `on_submit` · `on_graded`, and the grading saved on the edit screen for `on_graded`. The server rejects `on_graded` without `settings.grading` (`MATERIAL_GRADING_REQUIRED`). The edit screen never sends a policy.
40
+ - **The completion policy is picked in LXP**, not in the project: the publish skill proposes it from this table and sets it with the upload after the person agrees (graded: the quiz template or settings with `grading` → `on_graded`; the survey template → `on_access` (decided 2026-11-25; may change; it still submits with `useSubmit`); other submits without grading → `on_submit`; no submission → `on_access`), or the instructor chooses it in the '설정' panel at the top of the LXP edit page, which applies at once (ADR 0012). The templates carry a default that the server sets when the template is applied to a page that has never been saved (quiz `on_graded`; survey, document and video `on_access`); a saved page keeps its policy. `on_graded` needs `settings.grading` saved first, so it goes in the same save as settings with `grading`, or later. Do not write it in `metadata.json` (the old `completionPolicies` and `screens.completionPolicy` are ignored with the warning `manifest.completion-policies-ignored`, and `ecdk build` leaves them out of the zip). The content can read the current policy (SDK `material.completionPolicy`) but never sets it. Build what the suggested policy needs: a submission (`useSubmit`) for `on_submit` · `on_graded`, and the grading saved on the edit screen for `on_graded`. The server rejects `on_graded` without `settings.grading` (`MATERIAL_GRADING_REQUIRED`). The edit screen never sends a policy.
41
41
  - **Only `on_graded` grades.** `on_submit` completes on any submission and does not grade, even with saved answers: the submission comes back `is_correct: null`, `score: 100`, and the kit shows "제출했어요.". `on_access` completes on open. A quiz with `on_submit` shows no score; that is the policy, not broken grading.
42
42
  - Custom HTML does not use manual grading (`manual`) or no grading (`none`). With `pattern` there is no per-question grading: every question must be right for 100 (use `partial_pattern` for a score per question). Changing the answers does not regrade past submissions.
43
43
  - Answers never go in the zip (`metadata.json` · data JSON · code), and there is no answer file in the project: answers exist only in `settings.grading`, saved on the edit screen. The old `gradingTypes` field is gone (2026-11-10): `ecdk build` warns when it is still in `metadata.json` or an old `elice.config.json`. A grading with the 11-10 policy and grader fields is rejected with how to rewrite it.
@@ -64,7 +64,7 @@ Next time, read it, confirm the page with the person as above (기관 · 과목
64
64
 
65
65
  **Completion policy** (2026-11-12: the upload can set it)
66
66
 
67
- The completion policy is not in the project or the zip (ADR 0012): it is a setting of the LXP page, independent of versions, and it applies as soon as it is set. The publish skill proposes one and sets it with the save after the person agrees, when the save tool takes it. Detect support like `settings`: use `completion_policy` only when the input schema of `save_draft` (or `update_material`) lists it in `payload`. If no tool has it, tell the person after saving which one to pick in the '설정' panel opened from the top of the LXP edit page (choosing applies at once).
67
+ The completion policy is not in the project or the zip (ADR 0012): it is a setting of the LXP page, independent of versions, and it applies as soon as it is set. The publish skill proposes one and sets it with the save after the person agrees, when the save tool takes it. Detect support like `settings`: use `completion_policy` only when the input schema of `save_draft` (or `update_material`) lists it in `payload`. If no tool has it, tell the person after saving which one to pick in the '설정' panel opened from the top of the LXP edit page (choosing applies at once). The templates carry a default that the server sets when the template is applied to a page that has never been saved (quiz `on_graded`; survey, document and video `on_access`); a saved page keeps its policy, so still check `get_material` and propose as below.
68
68
 
69
69
  | The material | Propose |
70
70
  | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "title": "PDF/PPT",
5
5
  "description": "PDF, PPT 문서를 올립니다",
6
6
  "catalog": {
@@ -8,6 +8,7 @@
8
8
  "icon": "pdf",
9
9
  "sortOrder": 10,
10
10
  "thumbnailUrl": "https://static.elice.io/elice-material/custom/templates/document/thumbnail.png",
11
- "previewUrl": "https://static.elice.io/elice-material/custom/templates/document/preview.png"
11
+ "previewUrl": "https://static.elice.io/elice-material/custom/templates/document/preview.png",
12
+ "defaultCompletionPolicy": "on_access"
12
13
  }
13
14
  }
@@ -2,8 +2,8 @@
2
2
 
3
3
  Elice Custom HTML 학습자료 프로젝트입니다 (엔트리 템플릿). 엔트리 워크스페이스를 학습자료 안에 iframe으로 띄워 블록 코딩을 합니다.
4
4
 
5
- - 편집 화면: 위에서 언어(블록 코딩, 엔트리파이썬)를 고르고, '시작 화면' 탭에서 학생이 처음 볼 작품을, '채점 설정' 탭에서 채점 방식(일반 채점, AI 채점)과 정답 작품, AI 채점 기준을 만들어 저장합니다.
6
- - 학생 화면: 저장한 작품 또는 시작 화면 작품을 열고, 바뀌면 자동 저장합니다. '제출하기'로 작품을 내면 서버가 채점하고, 아래 줄에 최종 제출 점수와 시간이 보입니다. 일반 채점이면 '올바르게 작성했어요' · '틀렸어요. 다시 해보세요.', AI 채점이면 'AI 채점' 표시와 'AI 피드백 보기'(기준별 피드백)가 보입니다.
5
+ - 편집 화면: 위에서 언어(블록 코딩, 엔트리파이썬)를 고르고, '시작 화면' 탭에서 학생이 처음 볼 작품을, '채점 설정' 탭에서 정답 작품을 만든 뒤 그 아래에서 채점 방식(일반 채점, AI 채점)과 AI 채점 기준을 정해 저장합니다. 작품 아래 줄 오른쪽 칩에 설정 전체 용량(최대 64KB)이 보입니다.
6
+ - 학생 화면: 저장한 작품 또는 시작 화면 작품을 열고, 바뀌면 자동 저장합니다. '제출하기'로 작품을 내면 서버가 채점하고, 아래 줄에 '최종 제출 : 점수 (날짜 시각)'이 보입니다. 일반 채점이면 '올바르게 작성했어요' · '틀렸어요. 다시 해보세요.', AI 채점이면 'AI 채점' 표시와 'AI 피드백 보기'(기준별 피드백)가 보입니다.
7
7
 
8
8
  > **운영 LXP에서는 아직 워크스페이스가 뜨지 않습니다.** 학습자료의 콘텐츠 보안 정책(CSP)이 다른 주소를 iframe으로 띄우지 못하게 막고 있어서, 서버 CSP의 `frame-src`에 워크스페이스 주소(`https://entry-workspace.elice.io`)가 들어가야 뜹니다. 그 전에는 워크스페이스 자리에 "엔트리를 열 수 없습니다" 안내가 보입니다. `ecdk dev`에서는 로컬 워크스페이스로 확인할 수 있습니다 (아래 "로컬에서 확인").
9
9
 
@@ -11,7 +11,7 @@ Elice Custom HTML 학습자료 프로젝트입니다 (엔트리 템플릿). 엔
11
11
 
12
12
  | 파일 | 화면 |
13
13
  | --- | --- |
14
- | `screens/learn.js`, `index.html` | 학생 화면 (워크스페이스, 아래 줄: 저장 표시, 채점 결과, 최종 제출 점수와 시간, AI 채점 표시, AI 피드백, 제출하기) |
14
+ | `screens/learn.js`, `index.html` | 학생 화면 (워크스페이스, 아래 줄: 저장 표시, 채점 결과, 최종 제출 점수와 시각, AI 채점 표시, AI 피드백, 제출하기) |
15
15
  | `screens/edit.js`, `edit.html` | 내용 편집 화면. 언어 선택과 탭 카드('시작 화면', '채점 설정')에 패널을 그리고 키트 저장 바로 저장 |
16
16
  | `screens/edit/panels/` | 편집 화면 패널. 새 기능은 패널 파일 하나와 `index.js` 목록에 한 줄 |
17
17
  | `ui/` | 모양: 크기와 색(`theme.css`), 문구(`texts.js`), 마크업(`templates/`) |
@@ -62,7 +62,7 @@ ws.onChange(() => autosave.schedule()); // 블록이 바뀔 때마다
62
62
  편집 화면 '채점 설정' 탭에서 저장한 채점 설정(`settings.grading`)으로 서버가 채점합니다. 정답 작품과 기준은 학생 화면에 내려가지 않습니다.
63
63
 
64
64
  - 일반 채점: 정답 작품과 비교해 0점 또는 100점. 학생 화면에 '올바르게 작성했어요' · '틀렸어요. 다시 해보세요.'(LXP 문구). 정답 작품에 블록(또는 전역 리스트)이 하나도 없으면 저장을 막습니다 (아무도 100점을 받을 수 없음, 서버도 422 `entry_answer_project_empty`).
65
- - AI 채점: 기준(오브젝트, 채점 기준, 부분 점수)마다 AI가 부분 점수를 줍니다. 기준은 1~10개, 부분 점수는 1~100 정수이고 합이 100점이어야 저장됩니다. 오브젝트 목록은 **정답 작품**의 오브젝트이고(정답 작품은 시작 화면을 복사해 시작하므로 학생 작품과 같은 id), 기준마다 오브젝트를 하나 골라야 합니다. 작품 전체("공통") 기준은 없습니다: 고르지 않았거나 정답 작품에 없는 오브젝트면 저장을 막습니다(서버도 422 `entry_rubric_object_not_found`). AI 채점은 시작 화면 작품도 있어야 저장됩니다(서버 422 `entry_project_invalid`). 학생 화면은 'AI 채점' 표시, 제출 뒤 "AI가 채점하고 있어요. 최대 45초 걸릴 수 있어요."를 보여 줍니다.
65
+ - AI 채점: 기준(오브젝트, 채점 기준, 부분 점수)마다 AI가 부분 점수를 줍니다. 기준은 1~10개, 부분 점수는 1~100 정수이고 합이 100점이어야 저장됩니다. '자동 배점'은 기준 수로 100점을 정수로 나눠 채웁니다 (나머지는 마지막 기준에, 예: 3개면 33 · 33 · 34). 저장을 눌렀을 때 빈 칸이나 총점 문제는 칸 아래에 빨간 글로 보입니다. 오브젝트 목록은 **정답 작품**의 오브젝트이고(정답 작품은 시작 화면을 복사해 시작하므로 학생 작품과 같은 id), 기준마다 오브젝트를 하나 골라야 합니다. 작품 전체("공통") 기준은 없습니다: 고르지 않았거나 정답 작품에 없는 오브젝트면 저장을 막습니다(서버도 422 `entry_rubric_object_not_found`). AI 채점은 시작 화면 작품도 있어야 저장됩니다(서버 422 `entry_project_invalid`). 학생 화면은 'AI 채점' 표시, 제출 뒤 "AI가 채점하고 있습니다. 최대 45초 걸릴 수 있습니다."를 보여 줍니다.
66
66
  - AI 채점 자료에서 저장했던 시작 화면을 바꾸면 '시작 화면' 탭에 경고가 보입니다 (막지 않음). 이미 공개한 자료면 학생 작품이 바뀐 시작 화면과 같을 때 '아직 풀지 않음'(0점)이 되고, 이미 시작한 학생은 옛 화면에서 출발해 채점이 틀릴 수 있습니다. SDK가 공개 여부를 알려 주지 않아 시작 화면을 저장한 적이 있으면 보입니다.
67
67
  - '채점 설정' 탭을 처음 열면 정답 작품 워크스페이스가 저장된 정답, 없으면 지금 시작 화면 작품으로 열립니다. 탭을 열지 않은 새 자료는 채점 설정 없이 저장되고(점수 '--'), AI 채점은 정답 작품이 있어야 저장됩니다.
68
68
  - 서버가 저장을 거절하면(422) 키트가 서버 코드를 한국어 문구로 보여 줍니다. 제출이 너무 크거나 복잡하면(422 `project_too_large` · `project_too_complex`) "작품이 너무 커요…", AI 채점 실패(502) · 크레딧 없음(409)은 키트 문구입니다.
@@ -75,11 +75,10 @@ ws.onChange(() => autosave.schedule()); // 블록이 바뀔 때마다
75
75
 
76
76
  학습자료는 LXP 안에서 제한된 iframe(sandbox)으로 열리고, 그 안에 띄운 워크스페이스도 같은 제한을 받습니다. 지금 LXP 엔트리는 이 제한 밖에서 돌아서 생기지 않던 일입니다.
77
77
 
78
+ LXP 학습자료 iframe에 `allow-downloads` · `allow-popups` · `allow-modals`가 들어간 LXP에서는 `.ent` 내려받기 · 오브젝트 내보내기 · 확인 창 · 도움말 새 창은 됩니다. `ecdk dev`는 아직 예전 sandbox라 여기서는 막힐 수 있습니다. 남은 제한:
79
+
78
80
  | 기능 | 결과 | 필요한 것 |
79
81
  | --- | --- | --- |
80
- | `.ent` 내려받기, 오브젝트 내보내기 | 내려받아지지 않음 | 샌드박스 `allow-downloads` |
81
- | 확인 창, 알림 창 (예: 처음부터 다시) | 뜨지 않음 (확인 창은 늘 취소) | 샌드박스 `allow-modals` |
82
- | 도움말, 새 창 링크 | 열리지 않음 | 샌드박스 `allow-popups` |
83
82
  | AI 채점 기준의 오브젝트 그림 (편집 화면) | 빈 칸으로 보임 (워크스페이스 출처 그림을 콘텐츠 CSP `img-src`가 막아 띄우지 않음) | 서버 CSP `img-src`에 워크스페이스 출처 |
84
83
  | 카메라, 마이크 같은 기기 권한 | LXP가 학습자료 iframe에 준 권한까지만 | LXP iframe `allow` |
85
84
 
@@ -36,6 +36,7 @@ export declare function buildGrading(
36
36
  value: { mode: string; rubrics: RubricRow[] },
37
37
  answerProject: Packed | null
38
38
  ): EntryGrading | null;
39
+ export declare function equalScores(count: number): number[];
39
40
  export declare function rubricTotal(rubrics: RubricRow[]): number;
40
41
  export declare function rubricsProblem(
41
42
  rubrics: RubricRow[]
@@ -64,6 +64,20 @@ export function buildGrading(value, answerProject) {
64
64
  };
65
65
  }
66
66
 
67
+ /**
68
+ * 자동 배점: 기준 count개에 100점을 정수로 고르게 나눈 점수들 (합은 늘 100). 나머지는 앞 기준부터 1점씩
69
+ * (나머지는 마지막 기준에, 예: 3개 → 33 · 33 · 34, 6개 → 16 · 16 · 16 · 16 · 16 · 20). count가 1~10이 아니면 빈 배열
70
+ * @param {number} count
71
+ * @returns {number[]}
72
+ */
73
+ export function equalScores(count) {
74
+ if (!Number.isInteger(count) || count < 1 || count > RUBRIC_LIMITS.max) return [];
75
+ const base = Math.floor(RUBRIC_LIMITS.total / count);
76
+ const rest = RUBRIC_LIMITS.total - base * count;
77
+ // 연주님 디자인: 나머지는 마지막 기준에 몰아 줌 (3개 → 33 · 33 · 34)
78
+ return Array.from({ length: count }, (_, i) => base + (i === count - 1 ? rest : 0));
79
+ }
80
+
67
81
  /** 부분 점수 합 (빈 칸은 0) */
68
82
  export const rubricTotal = rubrics => rubrics.reduce((sum, r) => sum + (r.score ?? 0), 0);
69
83
 
@@ -16,11 +16,11 @@
16
16
  | --- | --- | --- | --- | --- | --- |
17
17
  | 시작 화면 작품 | `settings.entry.startProject` | 교육자, 편집 화면 '시작 화면' 탭 + 저장 버튼. 저장 직전에 워크스페이스에서 작품을 꺼냄(`TO_GET_PROJECT`), 워크스페이스 안 "저장하기"로 받은 작품이 있으면 그것 | `{ enc: 'gzip+base64', data }` (CompressionStream이 없으면 `{ enc: 'json', data }`) | settings 전체 64KB. 편집 화면이 저장 전에 크기를 보여 주고 넘으면 막음 | 모든 화면 (학생도 받음). 정답을 넣지 않음 |
18
18
  | 언어 선택 | `settings.entry.preference.workspaceMode` | 교육자, 편집 화면 "언어 선택" | `'block'` 또는 `'python'` (모르는 값은 `'block'`) | settings 전체 64KB | 모든 화면. 학생 화면이 워크스페이스 `GET_ELICE_PREFERENCE` 답으로 줌 |
19
- | 채점 방식 · 정답 작품 · AI 채점 기준 | `settings.grading` | 교육자, 편집 화면 '채점 설정' 탭 + 저장 버튼 (키트 `useSave`의 `getGrading`). 정답 작품은 탭을 연 뒤 저장 직전에 꺼냄. 탭을 열지 않으면 저장돼 있던 정답을 그대로 둠. 정답 작품이 없으면(새 자료에서 탭을 열지 않음) 채점 설정을 저장하지 않음, AI 채점이면 저장을 막음. 저장 전 검사(서버 422와 같은 규칙): AI는 시작 화면 작품이 있어야 하고 기준마다 정답 작품에 있는 오브젝트를 골라야 함, 일반은 정답 작품에 블록 묶음이나 전역 리스트가 하나 이상 | 일반 `{ type: 'entry', mode: 'general', answer_project: { enc, data } }` · AI `{ type: 'entry', mode: 'ai', answer_project, rubrics: [{ object, criteria, score }] }` (`object`는 정답 작품에 있는 엔트리 오브젝트 id, 작품 전체 기준은 없음(`''` · 없는 id는 서버 422 `entry_rubric_object_not_found`) · 기준 1~10개 · `criteria` 1~1,000자 · `score` 1~100 정수 · 합 100) | settings 전체 64KB (크기 줄은 grading까지 잼) | 편집 화면과 서버만. 서버가 학생 · 튜터 · 교육자 화면에는 내려주지 않음 (`ecdk dev` 흉내 서버도 같음) |
19
+ | 채점 방식 · 정답 작품 · AI 채점 기준 | `settings.grading` | 교육자, 편집 화면 '채점 설정' 탭 + 저장 버튼 (키트 `useSave`의 `getGrading`). 정답 작품은 탭을 연 뒤 저장 직전에 꺼냄. 탭을 열지 않으면 저장돼 있던 정답을 그대로 둠. 정답 작품이 없으면(새 자료에서 탭을 열지 않음) 채점 설정을 저장하지 않음, AI 채점이면 저장을 막음. 저장 전 검사(서버 422와 같은 규칙): AI는 시작 화면 작품이 있어야 하고 기준마다 정답 작품에 있는 오브젝트를 골라야 함, 일반은 정답 작품에 블록 묶음이나 전역 리스트가 하나 이상 | 일반 `{ type: 'entry', mode: 'general', answer_project: { enc, data } }` · AI `{ type: 'entry', mode: 'ai', answer_project, rubrics: [{ object, criteria, score }] }` (`object`는 정답 작품에 있는 엔트리 오브젝트 id, 작품 전체 기준은 없음(`''` · 없는 id는 서버 422 `entry_rubric_object_not_found`) · 기준 1~10개 · `criteria` 1~1,000자 · `score` 1~100 정수 · 합 100) | settings 전체 64KB (용량 칩은 grading까지 잼) | 편집 화면과 서버만. 서버가 학생 · 튜터 · 교육자 화면에는 내려주지 않음 (`ecdk dev` 흉내 서버도 같음) |
20
20
  | 그 밖의 settings 키 | `settings.*`, `settings.entry.*` 중 패널이 모르는 칸 | AI나 MCP, 다른 도구 | 그대로 | settings 전체 64KB | 모든 화면. 편집 화면 저장이 지우지 않고 그대로 둠 (`settings.entry.grading` · `settings.entry.answerProject`는 정답이 학생에게 가지 않게 저장 때 뺌) |
21
21
  | 학생 작품 (진행 중) | kvstore key `entry` | 학생. 블록이 바뀌면(`UPDATED_PROJECT`) 2초 모았다가 작품을 꺼내 저장, 워크스페이스 "저장하기"(`SAVE_PROJECT`)는 바로, 제출한 뒤에도 한 번 | `{ v: 1, savedAt: ISO 시각, project: { enc, data } }` | 512KB (넘으면 저장하지 않고 "자동 저장 실패" 표시) | 학생 본인, 튜터링(읽기만) |
22
22
  | 제출 작품 | 제출 답 (서버 제출 기록) | 학생, 제출 버튼 | `{ v: 1, project: { enc, data } }` | 64KB (넘으면 제출을 막고 안내) | 학생 본인 기록, 교육자 제출 목록 |
23
- | 제출 결과 | 제출 기록 (서버) | 서버, 제출 때 `settings.grading`으로 채점 (없으면 점수 없음) | 점수 · 정답 여부 · AI 채점 피드백 `grading_feedback { message, criteria: [{ feedback }] }` (AI 채점만 글이 있음, 기준 순서. 일반은 `{ message: '', criteria: [] }`) | 없음 | 학생 화면이 `app.lastSubmission()`으로 최종 제출 점수 · 시간 · 일반 채점 결과 문구 · 피드백(`gradingFeedback`)을 읽음. 제출 직후는 submit 결과(새 SDK는 `gradingFeedback`도, 옛 SDK는 기록에서 다시 읽음) |
23
+ | 제출 결과 | 제출 기록 (서버) | 서버, 제출 때 `settings.grading`으로 채점 (없으면 점수 없음) | 점수 · 정답 여부 · AI 채점 피드백 `grading_feedback { message, criteria: [{ feedback }] }` (AI 채점만 글이 있음, 기준 순서. 일반은 `{ message: '', criteria: [] }`) | 없음 | 학생 화면이 `app.lastSubmission()`으로 최종 제출 점수 · 시각 · 일반 채점 결과 문구 · 피드백(`gradingFeedback`)을 읽음. 제출 직후는 submit 결과(새 SDK는 `gradingFeedback`도, 옛 SDK는 기록에서 다시 읽음) |
24
24
  | 채점 방식 (학생 화면) | 서버 `/me`의 `grading_mode` → SDK `material.gradingMode` → 키트 `app.gradingMode` | 서버 (`settings.grading.mode`) | `'general'` · `'ai'` · `null`(다른 채점 · 편집 화면 · draft · 옛 서버 · 옛 SDK) | 없음 | 학생 화면이 'AI 채점' 표시 · 기다림 문구 · 일반 채점 문구를 고를 때 |
25
25
  | 워크스페이스 임시 저장 | 워크스페이스 출처의 브라우저 저장소 | 워크스페이스가 스스로 | 엔트리 작품 JSON | 브라우저마다 | 워크스페이스만. 이 학습자료는 읽지 못함 |
26
26
  | 그림, 소리 (작품에 올린 것) | 엔트리 서버 (워크스페이스가 대신 올림) | 교육자나 학생, 워크스페이스 안 | 작품 JSON에는 주소만 | 엔트리 서버 규칙 | 작품을 여는 사람 |
@@ -1,17 +1,23 @@
1
1
  // 패널: 채점 방식 ('채점 설정' 탭). 일반 채점 · AI 채점과 AI 채점 기준(오브젝트 · 채점 기준 · 부분 점수)을 고릅니다.
2
2
  // secret: settings.grading에 저장합니다 (학생에게 안 감). 모양은 core/grading.js, 정답 작품은 answer-project.js 패널.
3
- // 화면 배치: 채점 방식 줄은 탭 위쪽, AI 채점 기준은 정답 작품 워크스페이스 아래 (styles.css의 order).
3
+ // 화면 배치: 정답 작품 워크스페이스 → 채점 방식 줄 → AI 채점 기준 상자 (styles.css의 order). 정답 블록을 만든 뒤 채점 방식을 고르는 흐름.
4
+ // 검사: 저장을 누르면 칸마다 아래에 빨간 글(오브젝트 · 채점 기준 · 점수, 마지막 줄 점수 칸에 총점)을 띄우고 첫 칸으로 옮기며,
5
+ // 저장 바에는 요약 한 줄. 그 뒤로는 고칠 때마다 다시 그림. 총점이 100을 넘으면 저장 전에도 보임.
4
6
  // 오브젝트 목록은 정답 작품에서 받습니다(ctx.objects: 정답 작품 워크스페이스의 TO_GET_OBJECTS, 띄우기 전이면 저장된 정답 → 시작 화면).
5
7
  // 정답 작품은 시작 화면을 복사해 시작하므로 학생 작품과 같은 오브젝트 id를 가집니다. 작품 전체("공통") 기준은 없습니다(서버가 받지 않음):
6
8
  // 새 줄은 오브젝트를 고르지 않은 채로 시작하고, 고르지 않거나 정답 작품에 없는 오브젝트면 저장을 막습니다.
7
9
  import { html } from '../../../core/dom.js';
8
- import { readGrading, RUBRIC_LIMITS, rubricsProblem } from '../../../core/grading.js';
10
+ import { equalScores, readGrading, RUBRIC_LIMITS, rubricTotal, rubricsProblem } from '../../../core/grading.js';
9
11
  import { texts } from '../../../ui/texts.js';
10
12
 
11
13
  const t = texts.edit.grading;
14
+ const fe = t.fieldErrors;
12
15
  /** 아직 고르지 않은 오브젝트 칸 */
13
16
  const UNSET = '';
14
17
  const emptyRow = () => ({ object: UNSET, criteria: '', score: null });
18
+ /** 그린 패널과 validate를 잇는 것 (패널은 화면에 하나): 칸 아래 오류를 띄우고 첫 칸으로 옮김. 오류가 있으면 true */
19
+ const view = { reveal: null };
20
+ const reduceMotion = () => globalThis.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;
15
21
 
16
22
  /** 요소 만들기: class · on* (이벤트) · 그 밖은 속성. false · null 속성과 null 자식은 뺌 */
17
23
  function node(tag, attrs = {}, ...children) {
@@ -81,7 +87,7 @@ const icon = {
81
87
  >
82
88
  <path d="m6 9 6 6 6-6" /></svg
83
89
  ></span>`,
84
- down: () =>
90
+ sparkle: () =>
85
91
  html`<span aria-hidden="true"
86
92
  ><svg
87
93
  width="16"
@@ -90,10 +96,10 @@ const icon = {
90
96
  fill="none"
91
97
  stroke="currentColor"
92
98
  stroke-width="2"
93
- stroke-linecap="round"
94
99
  stroke-linejoin="round"
95
100
  >
96
- <path d="M12 5v14M6 13l6 6 6-6" /></svg
101
+ <path d="M10 3l1.9 5.1L17 10l-5.1 1.9L10 17l-1.9-5.1L3 10l5.1-1.9z" />
102
+ <path d="M18 14l.9 2.1L21 17l-2.1.9L18 20l-.9-2.1L15 17l2.1-.9z" /></svg
97
103
  ></span>`,
98
104
  caret: () =>
99
105
  html`<span class="en-select-caret" aria-hidden="true"
@@ -139,7 +145,7 @@ export default {
139
145
  const get = () => ctx.value;
140
146
  const update = patch => ctx.set({ ...get(), ...patch });
141
147
 
142
- // 채점 방식 줄: 일반 채점 · AI 채점 + (AI일 때) 아래 기준으로 가는 링크
148
+ // 채점 방식 줄 (정답 작품 아래): 일반 채점 · AI 채점 + 완료 정책 안내
143
149
  const modeCard = (mode, label) =>
144
150
  node(
145
151
  'label',
@@ -158,20 +164,6 @@ export default {
158
164
  }),
159
165
  node('span', { class: 'en-radio-card-title' }, label)
160
166
  );
161
- const hint = node(
162
- 'button',
163
- {
164
- type: 'button',
165
- class: 'en-hint-link',
166
- onclick: () => {
167
- const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches;
168
- ai.scrollIntoView({ behavior: reduce ? 'auto' : 'smooth', block: 'start' });
169
- ai.querySelector('button, input')?.focus({ preventScroll: true });
170
- },
171
- },
172
- node('span', {}, t.aiHint),
173
- icon.down()
174
- );
175
167
  const modeRow = node(
176
168
  'div',
177
169
  { class: 'en-grading-mode' },
@@ -183,7 +175,6 @@ export default {
183
175
  modeCard('general', t.modes.general),
184
176
  modeCard('ai', t.modes.ai)
185
177
  ),
186
- hint,
187
178
  // 완료 정책 안내: 채점 결과로 완료하려면 LXP 설정에서 '답안 확인 후 완료'(on_graded)
188
179
  node('p', { class: 'en-grading-note' }, icon.info(), node('span', {}, t.policyNote))
189
180
  );
@@ -223,16 +214,31 @@ export default {
223
214
  document.addEventListener('keydown', e => e.key === 'Escape' && togglePopover(false));
224
215
 
225
216
  const required = () => node('span', { class: 'en-required', 'aria-hidden': 'true' }, '*');
217
+ // 부분 점수 안내: 마우스를 올리거나 포커스하면 말풍선
218
+ const tooltip = node(
219
+ 'span',
220
+ { class: 'en-tooltip', role: 'tooltip', id: 'en-score-tip', hidden: true },
221
+ t.scoreInfo
222
+ );
223
+ const showTip = on => {
224
+ tooltip.hidden = !on;
225
+ };
226
226
  const scoreInfo = node(
227
227
  'span',
228
228
  {
229
229
  class: 'en-info',
230
230
  role: 'img',
231
231
  'aria-label': t.scoreInfo,
232
- title: t.scoreInfo,
232
+ 'aria-describedby': 'en-score-tip',
233
233
  tabindex: '0',
234
+ onmouseenter: () => showTip(true),
235
+ onmouseleave: () => showTip(false),
236
+ onfocus: () => showTip(true),
237
+ onblur: () => showTip(false),
238
+ onkeydown: e => e.key === 'Escape' && showTip(false),
234
239
  },
235
- icon.info()
240
+ icon.info(),
241
+ tooltip
236
242
  );
237
243
  const list = node('div', { class: 'en-criteria' });
238
244
  const addButton = node(
@@ -241,6 +247,13 @@ export default {
241
247
  icon.plus(),
242
248
  node('span', {}, t.add)
243
249
  );
250
+ // 자동 배점: 기준 수로 100점을 고르게 나눔 (core/grading.js equalScores)
251
+ const autoButton = node(
252
+ 'button',
253
+ { type: 'button', class: 'en-link-button en-auto-button', onclick: () => autoScore() },
254
+ icon.sparkle(),
255
+ node('span', {}, t.autoScore)
256
+ );
244
257
  const ai = node(
245
258
  'div',
246
259
  { class: 'en-ai' },
@@ -260,14 +273,14 @@ export default {
260
273
  { class: 'en-criteria-form' },
261
274
  node(
262
275
  'div',
263
- { class: 'en-criteria-head', 'aria-hidden': 'true' },
276
+ { class: 'en-criteria-head' },
264
277
  node('span', {}, t.columns.object, required()),
265
278
  node('span', {}, t.columns.criterion, required()),
266
279
  node('span', {}, t.columns.score, required(), scoreInfo),
267
280
  node('span', {})
268
281
  ),
269
282
  list,
270
- addButton
283
+ node('div', { class: 'en-criteria-actions' }, addButton, autoButton)
271
284
  )
272
285
  );
273
286
 
@@ -407,25 +420,103 @@ export default {
407
420
  return node('div', { class: 'en-select' }, button, menu);
408
421
  };
409
422
 
410
- const updateRow = (index, patch) =>
423
+ const updateRow = (index, patch) => {
411
424
  update({ rubrics: get().rubrics.map((r, i) => (i === index ? { ...r, ...patch } : r)) });
425
+ paintErrors();
426
+ };
412
427
  const addRow = () => {
413
428
  if (get().rubrics.length >= RUBRIC_LIMITS.max) return;
414
429
  update({ rubrics: [...get().rubrics, emptyRow()] });
415
430
  paintRows();
416
- list.lastElementChild?.querySelector('.en-select-button')?.focus();
431
+ cells.at(-1)?.selectButton.focus();
417
432
  };
418
433
  const removeRow = index => {
419
434
  if (index === 0 || get().rubrics.length <= 1) return;
420
435
  update({ rubrics: get().rubrics.filter((_, i) => i !== index) });
421
436
  paintRows();
422
437
  };
438
+ /** 자동 배점: 기준 수로 100점을 고르게 (합은 늘 100, 나머지는 앞 기준부터) */
439
+ const autoScore = () => {
440
+ const scores = equalScores(get().rubrics.length);
441
+ if (!scores.length) return;
442
+ update({ rubrics: get().rubrics.map((r, i) => ({ ...r, score: scores[i] })) });
443
+ paintRows();
444
+ };
445
+
446
+ // 칸 아래 오류: 저장을 누른 뒤부터(revealed) 칸마다. 총점이 100을 넘는 것은 늘 (마지막 줄 점수 칸 아래)
447
+ let revealed = false;
448
+ /** 줄마다 칸 요소 { selectBox, selectButton, selectMessage, criteria, criteriaMessage, scoreBox, score, scoreMessage } */
449
+ let cells = [];
450
+ const errorLine = () => node('p', { class: 'en-field-error', hidden: true });
451
+ /** 줄마다 칸의 문제 (문구, 없으면 '') */
452
+ const rowProblems = () => {
453
+ const rows = get().rubrics;
454
+ const total = rubricTotal(rows);
455
+ const filled = rows.length > 0 && rows.every(r => r.score !== null);
456
+ return rows.map((r, i) => {
457
+ const last = i === rows.length - 1;
458
+ const scoreOk = Number.isInteger(r.score) && r.score >= RUBRIC_LIMITS.scoreMin && r.score <= RUBRIC_LIMITS.total;
459
+ let totalError = '';
460
+ if (last && total > RUBRIC_LIMITS.total) totalError = fe.over;
461
+ else if (last && revealed && filled && total !== RUBRIC_LIMITS.total) totalError = fe.under;
462
+ const object =
463
+ r.object === UNSET ? fe.object : loaded && !objectOf(r.object) ? fe.unknownObject : '';
464
+ return {
465
+ object: revealed ? object : '',
466
+ criteria: revealed && !r.criteria.trim() ? fe.criterion : '',
467
+ score: revealed && r.score === null ? fe.score : revealed && !scoreOk ? fe.scoreRange(RUBRIC_LIMITS.scoreMin, RUBRIC_LIMITS.total) : '',
468
+ total: totalError,
469
+ };
470
+ });
471
+ };
472
+ const mark = (box, message, text, invalid, input) => {
473
+ box.dataset.invalid = String(invalid);
474
+ message.textContent = text;
475
+ message.hidden = !text;
476
+ input.setAttribute('aria-invalid', String(invalid));
477
+ };
478
+ function paintErrors() {
479
+ const problems = rowProblems();
480
+ cells.forEach((c, i) => {
481
+ const p = problems[i];
482
+ if (!p) return;
483
+ mark(c.selectBox, c.selectMessage, p.object, Boolean(p.object), c.selectButton);
484
+ mark(c.criteria, c.criteriaMessage, p.criteria, Boolean(p.criteria), c.criteria);
485
+ mark(c.scoreBox, c.scoreMessage, p.score || p.total, Boolean(p.score || p.total), c.score);
486
+ });
487
+ }
488
+ /** 저장 직전 (validate): 오류를 띄우고 첫 문제 칸으로 옮김. 문제가 있으면 true */
489
+ view.reveal = () => {
490
+ if (get().mode !== 'ai') return false;
491
+ if (!get().rubrics.length) {
492
+ update({ rubrics: [emptyRow()] });
493
+ paintRows();
494
+ }
495
+ revealed = true;
496
+ paintErrors();
497
+ const problems = rowProblems();
498
+ let target = null;
499
+ problems.forEach((p, i) => {
500
+ if (target) return;
501
+ if (p.object) target = cells[i].selectButton;
502
+ else if (p.criteria) target = cells[i].criteria;
503
+ else if (p.score || p.total) target = cells[i].score;
504
+ });
505
+ if (!target) return false;
506
+ ctx.showTab?.();
507
+ requestAnimationFrame(() => {
508
+ ai.scrollIntoView?.({ behavior: reduceMotion() ? 'auto' : 'smooth', block: 'start' });
509
+ target.focus({ preventScroll: true });
510
+ });
511
+ return true;
512
+ };
423
513
 
424
514
  /** 오브젝트 칸마다 다시 그리기 (오브젝트 이름 · 그림을 받은 뒤) */
425
515
  let repaints = [];
426
516
  function paintRows() {
427
517
  const rows = get().rubrics;
428
518
  repaints = [];
519
+ cells = [];
429
520
  list.replaceChildren(
430
521
  ...rows.map((row, index) => {
431
522
  const criteria = node('input', {
@@ -452,6 +543,24 @@ export default {
452
543
  updateRow(index, { score: Number.isInteger(n) ? n : null });
453
544
  },
454
545
  });
546
+ const scoreBox = node(
547
+ 'label',
548
+ { class: 'en-field en-score-field' },
549
+ score,
550
+ node('span', { class: 'en-unit' }, t.unit)
551
+ );
552
+ const selectBox = objectSelect(index);
553
+ const cell = {
554
+ selectBox,
555
+ selectButton: selectBox.querySelector('button'),
556
+ selectMessage: errorLine(),
557
+ criteria,
558
+ criteriaMessage: errorLine(),
559
+ scoreBox,
560
+ score,
561
+ scoreMessage: errorLine(),
562
+ };
563
+ cells.push(cell);
455
564
  // 첫 줄은 지우지 않음 (기준은 하나 이상): 자리만 둠
456
565
  const remove =
457
566
  index === 0
@@ -473,44 +582,46 @@ export default {
473
582
  return node(
474
583
  'div',
475
584
  { class: 'en-criterion' },
476
- objectSelect(index),
477
- criteria,
478
- node(
479
- 'label',
480
- { class: 'en-field en-score-field' },
481
- score,
482
- node('span', { class: 'en-unit' }, t.unit)
483
- ),
585
+ node('div', { class: 'en-cell' }, selectBox, cell.selectMessage),
586
+ node('div', { class: 'en-cell' }, criteria, cell.criteriaMessage),
587
+ node('div', { class: 'en-cell' }, scoreBox, cell.scoreMessage),
484
588
  remove
485
589
  );
486
590
  })
487
591
  );
488
592
  addButton.disabled = rows.length >= RUBRIC_LIMITS.max;
593
+ autoButton.disabled = rows.length < 1;
594
+ paintErrors();
489
595
  }
490
596
 
491
- /** 방식에 맞게 보이기. AI로 바꿨는데 기준이 없으면 빈 줄 하나 */
597
+ /** 방식에 맞게 보이기. AI로 바꿨는데 기준이 없으면 빈 줄 하나, 바꾼 뒤에는 기준 상자가 보이게 스크롤 */
492
598
  function showMode(changed = false) {
493
599
  const isAi = get().mode === 'ai';
494
- hint.style.visibility = isAi ? 'visible' : 'hidden';
495
600
  ai.hidden = !isAi;
496
601
  if (changed && isAi && !get().rubrics.length) update({ rubrics: [emptyRow()] });
497
602
  if (isAi) paintRows();
603
+ if (changed && isAi)
604
+ requestAnimationFrame(() =>
605
+ ai.scrollIntoView?.({ behavior: reduceMotion() ? 'auto' : 'smooth', block: 'nearest' })
606
+ );
498
607
  }
499
608
 
500
609
  el.append(modeRow, ai);
501
610
  showMode();
502
- // 오브젝트 이름 · 그림을 받으면 다시 그림 (저장된 기준의 오브젝트 이름)
503
- void loadObjects().then(() => repaints.forEach(repaint => repaint()));
611
+ // 오브젝트 이름 · 그림을 받으면 다시 그림 (저장된 기준의 오브젝트 이름 · 없는 오브젝트 표시)
612
+ void loadObjects().then(() => {
613
+ repaints.forEach(repaint => repaint());
614
+ paintErrors();
615
+ });
504
616
  },
617
+ /** AI 채점 기준 검사. 칸 문제는 칸 아래에 띄우고 저장 바에는 요약 한 줄 */
505
618
  validate(value) {
506
619
  if (value.mode !== 'ai') return true;
620
+ const shown = view.reveal?.() ?? false;
507
621
  const problem = rubricsProblem(value.rubrics);
508
- if (!problem) return true;
509
- if (problem.code === 'total') return t.errors.total(problem.total, RUBRIC_LIMITS.total);
510
- if (problem.code === 'score')
511
- return t.errors.score(RUBRIC_LIMITS.scoreMin, RUBRIC_LIMITS.total);
622
+ if (!problem) return shown ? t.errors.summary : true;
512
623
  if (problem.code === 'tooLong') return t.errors.tooLong(RUBRIC_LIMITS.criteriaMax);
513
624
  if (problem.code === 'tooMany') return t.errors.tooMany(RUBRIC_LIMITS.max);
514
- return t.errors[problem.code];
625
+ return t.errors.summary;
515
626
  },
516
627
  };
@@ -29,7 +29,25 @@ export default {
29
29
  if (input.checked) ctx.set({ workspaceMode: input.value });
30
30
  });
31
31
  }
32
- const info = html`<p class="ec-muted">${t.info}</p>`;
32
+ // 안내 한 줄: 파란 정보 아이콘 + 글 (바꾸면 워크스페이스를 다시 엶)
33
+ const info = html`<div class="en-alert" role="status">
34
+ <span class="en-alert-icon" aria-hidden="true"
35
+ ><svg
36
+ width="20"
37
+ height="20"
38
+ viewBox="0 0 24 24"
39
+ fill="none"
40
+ stroke="currentColor"
41
+ stroke-width="1.75"
42
+ stroke-linecap="round"
43
+ stroke-linejoin="round"
44
+ >
45
+ <circle cx="12" cy="12" r="9.25" />
46
+ <path d="M12 11v6" />
47
+ <circle cx="12" cy="7.75" r="0.6" fill="currentColor" /></svg
48
+ ></span>
49
+ <span>${t.info}</span>
50
+ </div>`;
33
51
  el.append(group, info);
34
52
  },
35
53
  toPreference(value) {