@eliceio/cdk-cli 0.1.0-alpha.2 → 0.1.0-alpha.4

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 (103) hide show
  1. package/README.md +263 -191
  2. package/es/cli.js +93 -33
  3. package/es/commands/build/index.d.ts +1 -1
  4. package/es/commands/build/index.js +21 -12
  5. package/es/commands/check/index.d.ts +11 -2
  6. package/es/commands/check/index.js +51 -5
  7. package/es/commands/create/index.d.ts +6 -0
  8. package/es/commands/create/index.js +56 -8
  9. package/es/commands/create/install.d.ts +17 -0
  10. package/es/commands/create/install.js +53 -0
  11. package/es/commands/create/scaffold.d.ts +6 -1
  12. package/es/commands/create/scaffold.js +27 -17
  13. package/es/commands/dev/index.d.ts +1 -1
  14. package/es/commands/dev/index.js +6 -2
  15. package/es/commands/doctor/index.d.ts +21 -0
  16. package/es/commands/doctor/index.js +255 -38
  17. package/es/commands/mcp/index.d.ts +134 -0
  18. package/es/commands/mcp/index.js +399 -0
  19. package/es/commands/setup/index.d.ts +40 -0
  20. package/es/commands/setup/index.js +157 -0
  21. package/es/commands/skill/index.d.ts +2 -5
  22. package/es/commands/skill/index.js +1 -29
  23. package/es/core/collect.d.ts +5 -2
  24. package/es/core/config.d.ts +141 -31
  25. package/es/core/config.js +341 -59
  26. package/es/core/manifest.d.ts +2 -1
  27. package/es/core/manifest.js +2 -1
  28. package/es/core/minify.js +2 -2
  29. package/es/core/prepare.d.ts +18 -2
  30. package/es/core/prepare.js +47 -18
  31. package/es/core/project-check.d.ts +26 -0
  32. package/es/core/project-check.js +53 -0
  33. package/es/core/sandbox.js +2 -2
  34. package/es/core/sdk.d.ts +39 -0
  35. package/es/core/sdk.js +95 -0
  36. package/es/core/templates.d.ts +25 -0
  37. package/es/core/templates.js +41 -0
  38. package/es/dev/grading.d.ts +14 -7
  39. package/es/dev/grading.js +27 -13
  40. package/es/dev/host-page.d.ts +1 -1
  41. package/es/dev/host-page.js +34 -34
  42. package/es/dev/mock-api.d.ts +19 -4
  43. package/es/dev/mock-api.js +75 -9
  44. package/es/dev/server.d.ts +7 -0
  45. package/es/dev/server.js +112 -32
  46. package/es/rules/check.js +95 -10
  47. package/es/rules/index.d.ts +1 -1
  48. package/es/rules/index.js +1 -1
  49. package/es/rules/manifest.d.ts +23 -9
  50. package/es/rules/manifest.js +60 -35
  51. package/es/rules/node.js +3 -1
  52. package/es/rules/semver.d.ts +5 -0
  53. package/es/rules/semver.js +32 -0
  54. package/es/rules/types.d.ts +38 -7
  55. package/es/rules.json.js +2 -2
  56. package/es/test-packages.d.ts +7 -0
  57. package/guides/content-development.md +150 -55
  58. package/package.json +3 -3
  59. package/rules.json +77 -7
  60. package/skills/_shared/always.md +4 -2
  61. package/skills/elice-content-check/SKILL.md +3 -1
  62. package/skills/elice-content-create/SKILL.md +5 -4
  63. package/skills/elice-content-migrate/SKILL.md +2 -2
  64. package/skills/elice-content-publish/SKILL.md +23 -0
  65. package/templates/_shared/lib/cdk-mock.d.ts +21 -3
  66. package/templates/_shared/lib/cdk-mock.js +241 -82
  67. package/templates/_shared/lib/elice-content.css +204 -0
  68. package/templates/_shared/lib/elice-content.d.ts +115 -6
  69. package/templates/_shared/lib/elice-content.js +656 -43
  70. package/templates/blank/README.md +19 -7
  71. package/templates/blank/completion.html +15 -0
  72. package/templates/blank/gitignore +1 -0
  73. package/templates/blank/metadata.json +11 -0
  74. package/templates/blank/package.json +13 -0
  75. package/templates/blank/screens/completion.js +7 -0
  76. package/templates/blank/screens/edit.js +3 -0
  77. package/templates/blank/screens/instructor.js +12 -5
  78. package/templates/blank/screens/learn.js +16 -11
  79. package/templates/blank/template.json +6 -0
  80. package/templates/quiz/README.md +41 -31
  81. package/templates/quiz/core/behaviors.d.ts +5 -0
  82. package/templates/quiz/core/behaviors.js +12 -0
  83. package/templates/quiz/core/editor.d.ts +12 -1
  84. package/templates/quiz/core/editor.js +28 -5
  85. package/templates/quiz/core/model.d.ts +41 -1
  86. package/templates/quiz/core/model.js +272 -5
  87. package/templates/quiz/gitignore +1 -0
  88. package/templates/quiz/metadata.json +11 -0
  89. package/templates/quiz/package.json +13 -0
  90. package/templates/quiz/screens/edit.js +176 -46
  91. package/templates/quiz/screens/instructor.js +18 -12
  92. package/templates/quiz/screens/learn.js +43 -38
  93. package/templates/quiz/styles.css +47 -0
  94. package/templates/quiz/template.json +6 -0
  95. package/templates/quiz/ui/templates/edit.d.ts +3 -0
  96. package/templates/quiz/ui/templates/edit.js +53 -14
  97. package/templates/quiz/ui/texts.js +56 -29
  98. package/templates/_shared/lib/cdk.js +0 -3
  99. package/templates/blank/content.json +0 -4
  100. package/templates/blank/elice.config.json +0 -12
  101. package/templates/quiz/content.json +0 -81
  102. package/templates/quiz/elice.config.json +0 -14
  103. package/templates/quiz/grading.json +0 -13
@@ -0,0 +1,26 @@
1
+ import { type ContentConfig } from './config.js';
2
+ import type { CheckOptions } from '../rules/index.js';
3
+ /**
4
+ * 프로젝트에 남은 옛 파일 (ADR 0011): elice.config.json · grading.json(프로젝트 맨 위) · content.json(원본 폴더).
5
+ * 경로는 프로젝트 기준 (`/` 구분)
6
+ */
7
+ export declare function findLegacyFiles(projectDir: string, config: ContentConfig): Promise<string[]>;
8
+ /**
9
+ * 옛 lib/cdk.js 복사본 (ADR 0010 최종 결정): package.json에 @eliceio/cdk가 없는데 원본에 lib/cdk.js가 있으면 그 경로
10
+ * (프로젝트 기준). build는 복사본을 그대로 넣고 sdk.lib-copy로 옮기는 법을 알린다
11
+ */
12
+ export declare function findLegacySdkCopy(projectDir: string, config: ContentConfig): Promise<string | undefined>;
13
+ /**
14
+ * 프로젝트(ecdk 프로젝트 폴더)를 검사할 때 build · dev · doctor · check가 함께 쓰는 검사 옵션.
15
+ * 파일은 prepareContent가 만든 zip 내용(원본)이고, 모듈 묶기는 build가 하므로 module-src는 보지 않는다.
16
+ * 프로젝트에만 있는 정보(예: 남은 옛 파일, 템플릿 목록)를 검사에 더할 때는 이 함수에만 더한다.
17
+ * 그래야 `ecdk check <프로젝트>`와 `ecdk build` 결과가 어긋나지 않는다.
18
+ *
19
+ * `ecdk dev`가 쓰는 상태(.ecdk/settings.json · completion.json)는 보지 않는다: build · check 결과가 dev에서 무엇을
20
+ * 저장했는지에 따라 달라지지 않게. templates: 이 CLI가 가진 템플릿 · 버전 (build.template-unknown).
21
+ * legacyFiles: 남은 옛 파일 (project.legacy-file, elice.config.json · content.json · grading.json).
22
+ * legacySdkCopy: 옛 lib/cdk.js 복사본 (sdk.lib-copy)
23
+ */
24
+ export declare function projectCheckOptions(projectDir: string, config: ContentConfig, extra?: {
25
+ zipBytes?: number | undefined;
26
+ }): Promise<CheckOptions>;
@@ -0,0 +1,53 @@
1
+ import { access } from 'node:fs/promises';
2
+ import { posix, join } from 'node:path';
3
+ import { LEGACY_FILES } from './config.js';
4
+ import { SDK_ZIP_PATH, readProjectSdk } from './sdk.js';
5
+ import { knownTemplates } from './templates.js';
6
+
7
+ const exists = p => access(p).then(() => true, () => false);
8
+ /**
9
+ * 프로젝트에 남은 옛 파일 (ADR 0011): elice.config.json · grading.json(프로젝트 맨 위) · content.json(원본 폴더).
10
+ * 경로는 프로젝트 기준 (`/` 구분)
11
+ */
12
+ async function findLegacyFiles(projectDir, config) {
13
+ const found = [];
14
+ if (await exists(join(projectDir, LEGACY_FILES.config))) found.push(LEGACY_FILES.config);
15
+ const content = posix.join(config.root.replace(/\\/g, '/'), LEGACY_FILES.content);
16
+ if (await exists(join(projectDir, content))) found.push(content);
17
+ if (await exists(join(projectDir, LEGACY_FILES.grading))) found.push(LEGACY_FILES.grading);
18
+ return found;
19
+ }
20
+ /**
21
+ * 옛 lib/cdk.js 복사본 (ADR 0010 최종 결정): package.json에 @eliceio/cdk가 없는데 원본에 lib/cdk.js가 있으면 그 경로
22
+ * (프로젝트 기준). build는 복사본을 그대로 넣고 sdk.lib-copy로 옮기는 법을 알린다
23
+ */
24
+ async function findLegacySdkCopy(projectDir, config) {
25
+ const path = posix.join(config.root.replace(/\\/g, '/'), SDK_ZIP_PATH);
26
+ if (!(await exists(join(projectDir, path)))) return undefined;
27
+ return (await readProjectSdk(projectDir)) === null ? path : undefined;
28
+ }
29
+ /**
30
+ * 프로젝트(ecdk 프로젝트 폴더)를 검사할 때 build · dev · doctor · check가 함께 쓰는 검사 옵션.
31
+ * 파일은 prepareContent가 만든 zip 내용(원본)이고, 모듈 묶기는 build가 하므로 module-src는 보지 않는다.
32
+ * 프로젝트에만 있는 정보(예: 남은 옛 파일, 템플릿 목록)를 검사에 더할 때는 이 함수에만 더한다.
33
+ * 그래야 `ecdk check <프로젝트>`와 `ecdk build` 결과가 어긋나지 않는다.
34
+ *
35
+ * `ecdk dev`가 쓰는 상태(.ecdk/settings.json · completion.json)는 보지 않는다: build · check 결과가 dev에서 무엇을
36
+ * 저장했는지에 따라 달라지지 않게. templates: 이 CLI가 가진 템플릿 · 버전 (build.template-unknown).
37
+ * legacyFiles: 남은 옛 파일 (project.legacy-file, elice.config.json · content.json · grading.json).
38
+ * legacySdkCopy: 옛 lib/cdk.js 복사본 (sdk.lib-copy)
39
+ */
40
+ async function projectCheckOptions(projectDir, config, extra = {}) {
41
+ return {
42
+ input: 'zip',
43
+ bundlesModules: true,
44
+ templates: knownTemplates(),
45
+ legacyFiles: await findLegacyFiles(projectDir, config),
46
+ legacySdkCopy: await findLegacySdkCopy(projectDir, config),
47
+ ...(extra.zipBytes !== undefined ? {
48
+ zipBytes: extra.zipBytes
49
+ } : {})
50
+ };
51
+ }
52
+
53
+ export { findLegacyFiles, findLegacySdkCopy, projectCheckOptions };
@@ -7,13 +7,13 @@ import { rules } from '../rules/spec.js';
7
7
  /**
8
8
  * LXP는 자료를 origin이 `null`인 sandbox iframe(`allow-scripts`)에서 열고, 자료 파일 서버는
9
9
  * `Access-Control-Allow-Origin`을 주지 않는다. 그래서 CORS 모드로 받는 요청이 모두 막힌다:
10
- * `<script type="module" src>` · 그 안의 `import` · `import()` · `fetch('content.json')`.
10
+ * `<script type="module" src>` · 그 안의 `import` · `import()` · `fetch('data.json')`.
11
11
  * (일반 `<script src>` · `<link rel="stylesheet">` · `<img>`는 CORS를 쓰지 않아 그대로 된다.)
12
12
  *
13
13
  * build는 zip에 넣기 전에 HTML마다:
14
14
  * - `<script type="module" src="상대경로">`를 esbuild로 하나로 묶어 `<script type="module">` 본문으로 넣는다
15
15
  * (zip 안 파일만 묶음. `import.meta.url`은 원래 파일 주소로 바꿔 상대경로 계산이 그대로 맞게).
16
- * - zip 안 JSON(metadata.json 제외)을 페이지에 넣고 `fetch`가 그 주소를 받으면 넣어 둔 내용을 돌려준다.
16
+ * - zip 안 JSON(metadata.json 제외, 작성자가 넣은 데이터 파일)을 페이지에 넣고 `fetch`가 그 주소를 받으면 넣어 둔 내용을 돌려준다.
17
17
  * 원본 JS · JSON 파일은 zip에 그대로 둔다 (`ecdk dev` · 다른 참조용).
18
18
  */
19
19
  const encoder = new TextEncoder();
@@ -0,0 +1,39 @@
1
+ import type { SourceFile } from './collect.js';
2
+ /**
3
+ * SDK(@eliceio/cdk)는 프로젝트 package.json 의존성이다 (ADR 0010 최종 결정). LXP sandbox에는 node_modules가 없으므로
4
+ * build · dev가 설치된 SDK의 UMD 빌드를 zip의 lib/cdk.js로 넣는다 (화면 키트 lib/elice-content.js가 같은 폴더에서 부름).
5
+ * 키트(lib/elice-content.js · .css · cdk-mock.js)는 ecdk create가 복사한 프로젝트 lib/ 그대로다.
6
+ */
7
+ export declare const SDK_PACKAGE = "@eliceio/cdk";
8
+ /** zip 안 SDK 파일 */
9
+ export declare const SDK_ZIP_PATH = "lib/cdk.js";
10
+ export declare const INSTALL_COMMAND = "npm install";
11
+ export declare const UPDATE_COMMAND = "npm update @eliceio/cdk";
12
+ export interface InstalledSdk {
13
+ version: string;
14
+ /** 패키지 폴더 (node_modules/@eliceio/cdk) */
15
+ dir: string;
16
+ }
17
+ export interface ProjectSdk {
18
+ /** package.json dependencies · devDependencies에 적은 범위 (dependencies 우선) */
19
+ range: string;
20
+ /** node_modules에서 찾은 SDK. 없으면 npm install 전 */
21
+ installed?: InstalledSdk | undefined;
22
+ }
23
+ /** package.json에 적은 SDK 범위 (dependencies → devDependencies). 없으면 undefined */
24
+ export declare function declaredSdkRange(pkg: Record<string, unknown> | null): string | undefined;
25
+ /**
26
+ * 프로젝트가 SDK를 패키지로 쓰는지와 설치 상태. package.json에 @eliceio/cdk가 없으면 null
27
+ * (옛 lib/cdk.js 복사본 프로젝트이거나 SDK를 쓰지 않는 자료: build는 원본 그대로)
28
+ */
29
+ export declare function readProjectSdk(projectDir: string): Promise<ProjectSdk | null>;
30
+ /** SDK가 설치되지 않았을 때 문구 */
31
+ export declare function missingSdkMessage(): string;
32
+ /**
33
+ * zip lib/cdk.js 머리말. build.sdk는 이 머리말에서 읽는다 (core/manifest.ts).
34
+ * SDK는 LXP 화면과 postMessage(설정 저장 결과 · 페이지 이동)로 이야기하므로 두 규칙을 이 파일에서만 끈다.
35
+ * 두 규칙은 client 검사라 서버 업로드 검사와는 상관없다
36
+ */
37
+ export declare function sdkHeader(version: string): string;
38
+ /** 설치된 SDK의 UMD 빌드에 머리말을 붙인 zip 파일 lib/cdk.js */
39
+ export declare function sdkZipFile(sdk: InstalledSdk): Promise<SourceFile>;
package/es/core/sdk.js ADDED
@@ -0,0 +1,95 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { join, resolve, dirname } from 'node:path';
3
+
4
+ /**
5
+ * SDK(@eliceio/cdk)는 프로젝트 package.json 의존성이다 (ADR 0010 최종 결정). LXP sandbox에는 node_modules가 없으므로
6
+ * build · dev가 설치된 SDK의 UMD 빌드를 zip의 lib/cdk.js로 넣는다 (화면 키트 lib/elice-content.js가 같은 폴더에서 부름).
7
+ * 키트(lib/elice-content.js · .css · cdk-mock.js)는 ecdk create가 복사한 프로젝트 lib/ 그대로다.
8
+ */
9
+ const SDK_PACKAGE = '@eliceio/cdk';
10
+ /** zip 안 SDK 파일 */
11
+ const SDK_ZIP_PATH = 'lib/cdk.js';
12
+ /** 설치된 SDK 안의 UMD 빌드 */
13
+ const SDK_UMD = 'umd/index.js';
14
+ const INSTALL_COMMAND = 'npm install';
15
+ const UPDATE_COMMAND = `npm update ${SDK_PACKAGE}`;
16
+ async function readJson(path) {
17
+ try {
18
+ const raw = JSON.parse(await readFile(path, 'utf8'));
19
+ return raw && typeof raw === 'object' && !Array.isArray(raw) ? raw : null;
20
+ } catch {
21
+ return null;
22
+ }
23
+ }
24
+ /**
25
+ * Node처럼 프로젝트 폴더부터 위로 올라가며 node_modules/@eliceio/cdk를 찾는다.
26
+ * SDK exports에 ./package.json이 없어 require.resolve 대신 직접 찾는다
27
+ */
28
+ async function findInstalled(from) {
29
+ let cur = resolve(from);
30
+ for (;;) {
31
+ const dir = join(cur, 'node_modules', ...SDK_PACKAGE.split('/'));
32
+ const pkg = await readJson(join(dir, 'package.json'));
33
+ if (pkg && pkg.name === SDK_PACKAGE && typeof pkg.version === 'string') return {
34
+ version: pkg.version,
35
+ dir
36
+ };
37
+ const parent = dirname(cur);
38
+ if (parent === cur) return undefined;
39
+ cur = parent;
40
+ }
41
+ }
42
+ /** package.json에 적은 SDK 범위 (dependencies → devDependencies). 없으면 undefined */
43
+ function declaredSdkRange(pkg) {
44
+ for (const key of ['dependencies', 'devDependencies']) {
45
+ const deps = pkg?.[key];
46
+ if (!deps || typeof deps !== 'object') continue;
47
+ const range = deps[SDK_PACKAGE];
48
+ if (typeof range === 'string') return range;
49
+ }
50
+ return undefined;
51
+ }
52
+ /**
53
+ * 프로젝트가 SDK를 패키지로 쓰는지와 설치 상태. package.json에 @eliceio/cdk가 없으면 null
54
+ * (옛 lib/cdk.js 복사본 프로젝트이거나 SDK를 쓰지 않는 자료: build는 원본 그대로)
55
+ */
56
+ async function readProjectSdk(projectDir) {
57
+ const range = declaredSdkRange(await readJson(join(projectDir, 'package.json')));
58
+ if (range === undefined) return null;
59
+ return {
60
+ range,
61
+ installed: await findInstalled(projectDir)
62
+ };
63
+ }
64
+ /** SDK가 설치되지 않았을 때 문구 */
65
+ function missingSdkMessage() {
66
+ return `${SDK_PACKAGE} 패키지를 찾지 못했습니다 (node_modules에 없음). 프로젝트 폴더에서 ${INSTALL_COMMAND}을 실행해 주세요.`;
67
+ }
68
+ /**
69
+ * zip lib/cdk.js 머리말. build.sdk는 이 머리말에서 읽는다 (core/manifest.ts).
70
+ * SDK는 LXP 화면과 postMessage(설정 저장 결과 · 페이지 이동)로 이야기하므로 두 규칙을 이 파일에서만 끈다.
71
+ * 두 규칙은 client 검사라 서버 업로드 검사와는 상관없다
72
+ */
73
+ function sdkHeader(version) {
74
+ return [`/* ${SDK_PACKAGE} ${version} — UMD. Added by ecdk build from node_modules/${SDK_PACKAGE}; do not edit. */`, '// ecdk-ignore-next-line api.parent-access sec.postmessage-wildcard', ''].join('\n');
75
+ }
76
+ /** 설치된 SDK의 UMD 빌드에 머리말을 붙인 zip 파일 lib/cdk.js */
77
+ async function sdkZipFile(sdk) {
78
+ const umd = join(sdk.dir, ...SDK_UMD.split('/'));
79
+ let data;
80
+ try {
81
+ data = new Uint8Array(await readFile(umd));
82
+ } catch {
83
+ throw new Error(`${SDK_PACKAGE} ${sdk.version}에 UMD 빌드(${SDK_UMD})가 없습니다. ${INSTALL_COMMAND}으로 다시 설치해 주세요.`);
84
+ }
85
+ const head = new TextEncoder().encode(sdkHeader(sdk.version));
86
+ const joined = new Uint8Array(head.byteLength + data.byteLength);
87
+ joined.set(head);
88
+ joined.set(data, head.byteLength);
89
+ return {
90
+ path: SDK_ZIP_PATH,
91
+ data: joined
92
+ };
93
+ }
94
+
95
+ export { INSTALL_COMMAND, SDK_PACKAGE, SDK_ZIP_PATH, UPDATE_COMMAND, declaredSdkRange, missingSdkMessage, readProjectSdk, sdkHeader, sdkZipFile };
@@ -0,0 +1,25 @@
1
+ /** 패키지 루트의 templates/ (es/core/와 src/core/ 모두 두 단계 위) */
2
+ export declare const TEMPLATE_ROOT: string;
3
+ /**
4
+ * 템플릿 한 개의 정보 (`templates/<이름>/template.json`). 템플릿마다 버전을 따로 올린다 (CLI 버전과 별개).
5
+ * 화면 구성 · 완료 정책은 template.json에 다시 적지 않고 템플릿의 metadata.json을 그대로 읽는다 (한 곳만 고치게).
6
+ */
7
+ export interface TemplateInfo {
8
+ name: string;
9
+ version: string;
10
+ title: string;
11
+ description: string;
12
+ /** 템플릿 metadata.json에서 켠 화면 */
13
+ screens: string[];
14
+ /** 템플릿 metadata.json의 completionPolicies (첫 값이 기본, 하나면 고정) */
15
+ completionPolicies?: string[] | undefined;
16
+ }
17
+ /** 이 CLI가 가진 템플릿 (이름 순, 공통 폴더 `_shared` 제외) */
18
+ export declare function listTemplates(root?: string): TemplateInfo[];
19
+ /** 검사 규칙 build.template-unknown에 넘길 { 이름: 버전 } */
20
+ export declare function knownTemplates(root?: string): Record<string, string>;
21
+ /** "quiz@1.0.0" → { name, version } (버전이 없으면 undefined) */
22
+ export declare function parseTemplateRef(ref: string): {
23
+ name: string;
24
+ version?: string | undefined;
25
+ };
@@ -0,0 +1,41 @@
1
+ import { readdirSync, readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ /** 패키지 루트의 templates/ (es/core/와 src/core/ 모두 두 단계 위) */
6
+ const TEMPLATE_ROOT = fileURLToPath(new URL('../../templates', import.meta.url));
7
+ /** 이 CLI가 가진 템플릿 (이름 순, 공통 폴더 `_shared` 제외) */
8
+ function listTemplates(root = TEMPLATE_ROOT) {
9
+ return readdirSync(root, {
10
+ withFileTypes: true
11
+ }).filter(d => d.isDirectory() && !d.name.startsWith('_')).map(d => {
12
+ const meta = JSON.parse(readFileSync(join(root, d.name, 'template.json'), 'utf8'));
13
+ const manifest = JSON.parse(readFileSync(join(root, d.name, 'metadata.json'), 'utf8'));
14
+ return {
15
+ name: meta.name,
16
+ version: meta.version,
17
+ title: meta.title,
18
+ description: meta.description,
19
+ screens: Object.entries(manifest.screens ?? {}).filter(([, s]) => s.enabled === true).map(([name]) => name),
20
+ ...(manifest.completionPolicies ? {
21
+ completionPolicies: manifest.completionPolicies
22
+ } : {})
23
+ };
24
+ }).sort((a, b) => a.name.localeCompare(b.name));
25
+ }
26
+ /** 검사 규칙 build.template-unknown에 넘길 { 이름: 버전 } */
27
+ function knownTemplates(root = TEMPLATE_ROOT) {
28
+ return Object.fromEntries(listTemplates(root).map(t => [t.name, t.version]));
29
+ }
30
+ /** "quiz@1.0.0" → { name, version } (버전이 없으면 undefined) */
31
+ function parseTemplateRef(ref) {
32
+ const at = ref.lastIndexOf('@');
33
+ return at > 0 ? {
34
+ name: ref.slice(0, at),
35
+ version: ref.slice(at + 1)
36
+ } : {
37
+ name: ref
38
+ };
39
+ }
40
+
41
+ export { TEMPLATE_ROOT, knownTemplates, listTemplates, parseTemplateRef };
@@ -1,15 +1,22 @@
1
- import type { GradingConfig } from '../core/config.js';
2
- /** 제출 응답 `{ is_correct, score }` (서버 설계 v25). 채점하지 않는 유형은 둘 다 null */
1
+ import type { LocalGrading } from '../core/config.js';
2
+ /** 제출 응답 `{ is_correct, score }` (서버 설계 v25). 채점하지 않는 정책은 둘 다 null */
3
3
  export interface GradeResult {
4
4
  isCorrect: boolean | null;
5
5
  score: number | null;
6
6
  }
7
7
  /** dev가 rubric(AI) 채점을 흉내 낼 때 돌려주는 점수. 서버는 요청 안에서 채점한다 */
8
8
  export declare const RUBRIC_DEV_SCORE = 80;
9
+ /** 정답 비교에 쓰는 답 문자열: 문자열은 앞뒤 공백을 자르고, 그 밖은 JSON으로 */
10
+ export declare const answerText: (answer: unknown) => string;
11
+ /** pattern: 정답 정규식(문자열 하나)이 답 문자열 전체와 맞는지. 정규식이 틀리거나 없으면 오답 */
12
+ export declare function matchesPattern(answerKey: unknown, answer: unknown): boolean;
9
13
  /**
10
- * elice-material `grading` 흉내 (서버 설계 v25). 채점은 모두 요청 안에서 끝난다 (rubric 포함).
11
- * 템플릿 mock(`lib/cdk-mock.js`의 gradeLocally)과 같은 판정이고,
12
- * pattern exact는 서버처럼 답 전체를 한 번에 비교한다 (부분 점수 없음).
13
- * manual · none 등 자동 채점이 아닌 유형은 `{ isCorrect: null, score: null }`.
14
+ * elice-material 채점 흉내 (ADR 0009: 완료 정책 → 채점 방식 → 점수). 채점은 모두 요청 안에서 끝난다.
15
+ * 템플릿 mock(`lib/cdk-mock.js`의 gradeLocally)과 같은 판정이다.
16
+ * - on_access: 열면 완료, 제출은 점수 없음 `{ null, null }`
17
+ * - on_submit: 제출하면 100
18
+ * - on_graded + pattern: 답 문자열 전체를 정규식 하나로 비교 0 / 100
19
+ * - on_graded + rubric: 흉내 점수 RUBRIC_DEV_SCORE, 통과로 본다 (통과 기준 pass_threshold는 정해지지 않음, G136)
20
+ * - on_graded인데 답(편집 화면이 저장하는 settings.grading)이 아직 없으면 채점할 수 없어 `{ null, null }`
14
21
  */
15
- export declare function grade(grading: GradingConfig | undefined, answer: unknown): GradeResult;
22
+ export declare function grade(local: LocalGrading | undefined, answer: unknown): GradeResult;
package/es/dev/grading.js CHANGED
@@ -1,30 +1,44 @@
1
1
  /** dev가 rubric(AI) 채점을 흉내 낼 때 돌려주는 점수. 서버는 요청 안에서 채점한다 */
2
2
  const RUBRIC_DEV_SCORE = 80;
3
- const normalize = v => typeof v === 'string' ? v.trim().toLowerCase() : Array.isArray(v) ? v.map(normalize).sort() : v && typeof v === 'object' ? Object.fromEntries(Object.keys(v).sort().map(k => [k, normalize(v[k])])) : v;
3
+ /** 정답 비교에 쓰는 답 문자열: 문자열은 앞뒤 공백을 자르고, 그 밖은 JSON으로 */
4
+ const answerText = answer => typeof answer === 'string' ? answer.trim() : JSON.stringify(answer ?? null);
5
+ /** pattern: 정답 정규식(문자열 하나)이 답 문자열 전체와 맞는지. 정규식이 틀리거나 없으면 오답 */
6
+ function matchesPattern(answerKey, answer) {
7
+ if (typeof answerKey !== 'string') return false;
8
+ try {
9
+ return new RegExp(`^(?:${answerKey})$`).test(answerText(answer));
10
+ } catch {
11
+ return false;
12
+ }
13
+ }
4
14
  /**
5
- * elice-material `grading` 흉내 (서버 설계 v25). 채점은 모두 요청 안에서 끝난다 (rubric 포함).
6
- * 템플릿 mock(`lib/cdk-mock.js`의 gradeLocally)과 같은 판정이고,
7
- * pattern exact는 서버처럼 답 전체를 한 번에 비교한다 (부분 점수 없음).
8
- * manual · none 등 자동 채점이 아닌 유형은 `{ isCorrect: null, score: null }`.
15
+ * elice-material 채점 흉내 (ADR 0009: 완료 정책 → 채점 방식 → 점수). 채점은 모두 요청 안에서 끝난다.
16
+ * 템플릿 mock(`lib/cdk-mock.js`의 gradeLocally)과 같은 판정이다.
17
+ * - on_access: 열면 완료, 제출은 점수 없음 `{ null, null }`
18
+ * - on_submit: 제출하면 100
19
+ * - on_graded + pattern: 답 문자열 전체를 정규식 하나로 비교 0 / 100
20
+ * - on_graded + rubric: 흉내 점수 RUBRIC_DEV_SCORE, 통과로 본다 (통과 기준 pass_threshold는 정해지지 않음, G136)
21
+ * - on_graded인데 답(편집 화면이 저장하는 settings.grading)이 아직 없으면 채점할 수 없어 `{ null, null }`
9
22
  */
10
- function grade(grading, answer) {
11
- const type = grading?.type ?? 'on_submit';
12
- if (type === 'on_access') return {
23
+ function grade(local, answer) {
24
+ const policy = local?.completion_policy ?? 'on_submit';
25
+ if (policy === 'on_access') return {
13
26
  isCorrect: null,
14
27
  score: null
15
28
  };
16
- if (type === 'on_submit') return {
29
+ if (policy === 'on_submit') return {
17
30
  isCorrect: true,
18
31
  score: 100
19
32
  };
20
- if (type === 'pattern') {
21
- const ok = grading?.match === 'regex' ? new RegExp(String(grading.answer_key)).test(String(answer)) : JSON.stringify(normalize(answer)) === JSON.stringify(normalize(grading?.answer_key));
33
+ const grading = local?.grading;
34
+ if (grading?.type === 'pattern') {
35
+ const ok = matchesPattern(grading.answer_key, answer);
22
36
  return {
23
37
  isCorrect: ok,
24
38
  score: ok ? 100 : 0
25
39
  };
26
40
  }
27
- if (type === 'rubric') return {
41
+ if (grading?.type === 'rubric') return {
28
42
  isCorrect: true,
29
43
  score: RUBRIC_DEV_SCORE
30
44
  };
@@ -34,4 +48,4 @@ function grade(grading, answer) {
34
48
  };
35
49
  }
36
50
 
37
- export { RUBRIC_DEV_SCORE, grade };
51
+ export { RUBRIC_DEV_SCORE, answerText, grade, matchesPattern };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * LXP 학습 · 편집 페이지 흉내. 보기를 바꾸고 콘텐츠를 sandbox iframe으로 띄우며,
3
- * @eliceio/cdk가 보내는 postMessage(settings-change · navigate-*)를 받아 처리한다
3
+ * @eliceio/cdk가 보내는 postMessage(settings-saved · navigate-*)를 받아 처리한다
4
4
  */
5
5
  export declare function hostPage(opts: {
6
6
  title: string;
@@ -2,7 +2,7 @@ import { DEV_MATERIAL_ID } from './mock-api.js';
2
2
 
3
3
  /**
4
4
  * LXP 학습 · 편집 페이지 흉내. 보기를 바꾸고 콘텐츠를 sandbox iframe으로 띄우며,
5
- * @eliceio/cdk가 보내는 postMessage(settings-change · navigate-*)를 받아 처리한다
5
+ * @eliceio/cdk가 보내는 postMessage(settings-saved · navigate-*)를 받아 처리한다
6
6
  */
7
7
  function hostPage(opts) {
8
8
  return `<!doctype html>
@@ -51,7 +51,6 @@ function hostPage(opts) {
51
51
  <button data-w="100%" aria-pressed="true">데스크톱</button><button data-w="720px">태블릿</button><button data-w="360px">모바일</button>
52
52
  </div>
53
53
  <span class="sep"></span>
54
- <button id="save" hidden disabled title="편집 화면이 saveSettings()로 넘긴 설정을 자료에 저장합니다">저장</button>
55
54
  <button id="reset" title="제출 기록 · 점수 · 완료, 편집 화면에서 저장한 내용을 지우고 처음 들어온 상태로 다시 엽니다">처음 상태로</button>
56
55
  <span class="sep"></span>
57
56
  <details id="sdk-tools">
@@ -62,7 +61,11 @@ function hostPage(opts) {
62
61
  <label><input type="checkbox" id="has-prev" checked>이전 차시 있음</label>
63
62
  <label><input type="checkbox" id="has-next" checked>다음 차시 있음</label>
64
63
  </div>
65
- <div class="tool" role="group" aria-label="저장 전 미리보기" title="LXP 편집 페이지의 미리보기처럼 토큰 없이 학생 화면을 엽니다. settings가 비어 content.json 기본 내용으로 뜨고, 제출은 기록되지 않습니다(늘 100점)">
64
+ <div class="tool" role="group" aria-label="저장 전 편집 화면" title="LXP 편집 페이지에서 zip을 올리고 아직 저장하지 않은 상태의 편집 화면처럼 토큰 없이 엽니다. 저장하면 SDK가 draft_not_saved로 거절합니다">
65
+ <b>저장 전 편집 화면</b> <code>#edit=1</code>
66
+ <button type="button" id="open-edit-draft">열기</button>
67
+ </div>
68
+ <div class="tool" role="group" aria-label="저장 전 미리보기" title="LXP 편집 페이지의 미리보기처럼 토큰 없이 학생 화면을 엽니다. settings가 비어 '아직 내용이 없습니다' 안내가 뜨고(기본 내용 없음), 제출은 기록되지 않습니다(늘 100점)">
66
69
  <b>저장 전 미리보기</b> <code>#preview=1</code>
67
70
  <button type="button" id="open-preview">열기</button>
68
71
  </div>
@@ -76,27 +79,34 @@ function hostPage(opts) {
76
79
  <script type="module">
77
80
  const MATERIAL_ID = ${JSON.stringify(DEV_MATERIAL_ID)};
78
81
  const SDK_SOURCE = 'eliceio-content-sdk';
79
- // [보기, 이름, 화면, 주소 조각]. token은 흉내 서버가 발급, edit는 운영처럼 토큰 없음.
82
+ // [보기, 이름, 화면, 주소 조각]. token은 흉내 서버가 발급. 내용 편집은 LXP처럼 저장된 버전을 edit 토큰으로 연다
80
83
  const SCENARIOS = [
81
84
  ['student', '학생', 'learn', 'token'],
82
85
  ['tutor', '튜터링', 'learn', 'token'],
83
86
  ['instructor', '교육자 화면', 'instructor', 'token'],
84
- ['edit', '내용 편집', 'edit', 'edit=1'],
87
+ ['edit', '내용 편집', 'edit', 'token'],
88
+ // 완료 정책 화면 (ADR 0009): LXP 설정 탭처럼 edit 토큰 + screen=completionPolicy. screens.completionPolicy를 켠
89
+ // 자료에서만 보인다 (퀴즈처럼 completionPolicies가 하나면 없음). 저장하면 .ecdk/completion.json, 채점 방식 · 답은 내용 편집
90
+ ['completionPolicy', '완료 정책', 'completionPolicy', 'token'],
85
91
  ];
86
92
  // 토큰 없는 미리보기(#preview=1)는 settings가 비고 늘 100점이라 학생 보기와 구분이 안 돼 보기 버튼에서 빼고,
87
93
  // SDK 기능 안의 도구로만 연다 (SDK · 키트는 이 상태를 따로 다룸: isDraftPreview, "기록되지 않음" 안내)
88
94
  const PREVIEW = ['preview', '저장 전 미리보기', 'learn', 'preview=1'];
89
- const scenarioOf = (name) => (name === PREVIEW[0] ? PREVIEW : SCENARIOS.find((s) => s[0] === name));
95
+ // 저장 전 업로드의 편집 화면 (토큰 없음): saveSettings가 draft_not_saved로 거절되는 것을 확인할 때
96
+ const EDIT_DRAFT = ['edit-draft', '저장 전 편집 화면', 'edit', 'edit=1'];
97
+ const TOOLS = [PREVIEW, EDIT_DRAFT];
98
+ const scenarioOf = (name) => TOOLS.find((s) => s[0] === name) ?? SCENARIOS.find((s) => s[0] === name);
99
+ // LXP처럼 material API 주소를 fragment로 넘긴다 (키트는 dev에서 __ECDK_DEV__.api를 먼저 쓴다)
100
+ const BASE_URL = encodeURIComponent(location.origin + '/api');
90
101
  const frame = document.getElementById('content');
91
102
  const previewEl = document.getElementById('open-preview');
92
103
  const scenariosEl = document.getElementById('scenarios');
93
- const saveEl = document.getElementById('save');
104
+ const editDraftEl = document.getElementById('open-edit-draft');
94
105
  const messagesEl = document.getElementById('messages');
95
106
  let state = { kind: 'material', entries: {}, contentBase: '' };
96
107
  // 저장소가 막힌 브라우저에서도 화면이 떠야 하므로 sessionStorage는 모두 try로 감싼다
97
108
  let current = 'student';
98
109
  try { current = sessionStorage.getItem('ecdk-scenario') || 'student'; } catch {}
99
- let pendingSettings = null;
100
110
 
101
111
  function note(line) {
102
112
  const lines = (messagesEl.textContent ? messagesEl.textContent.split('\\n') : []).slice(-4);
@@ -112,24 +122,22 @@ function hostPage(opts) {
112
122
  try { sessionStorage.setItem('ecdk-scenario', scenario); } catch {}
113
123
  for (const b of scenariosEl.children) b.setAttribute('aria-pressed', String(b.dataset.scenario === scenario));
114
124
  previewEl.setAttribute('aria-pressed', String(scenario === PREVIEW[0]));
125
+ editDraftEl.setAttribute('aria-pressed', String(scenario === EDIT_DRAFT[0]));
115
126
  const [, label, screen, fragment] = scenarioOf(scenario);
116
127
  const entry = entryOf(screen);
117
- pendingSettings = null;
118
- saveEl.hidden = scenario !== 'edit';
119
- saveEl.disabled = true;
120
128
  // 같은 파일이면 해시만 바뀌어 다시 로드되지 않으므로 매번 쿼리를 바꾼다
121
129
  const url = state.contentBase + entry + '?ecdk=' + Date.now();
122
130
  if (fragment === 'token') {
123
131
  const { token } = await (await fetch('/__ecdk/token?scenario=' + scenario)).json();
124
- frame.src = url + '#token=' + token;
132
+ frame.src = url + '#token=' + token + '&baseUrl=' + BASE_URL + (screen === 'completionPolicy' ? '&screen=completionPolicy' : '');
125
133
  } else {
126
- frame.src = url + '#' + fragment;
134
+ frame.src = url + '#' + fragment + '&baseUrl=' + BASE_URL;
127
135
  }
128
136
  document.getElementById('hint').textContent =
129
- (state.kind === 'description' ? '문제 설명 · ' : '') + entry + ' · ' + (scenario === PREVIEW[0] ? label : scenario);
137
+ (state.kind === 'description' ? '문제 설명 · ' : '') + entry + ' · ' + (TOOLS.some((t) => t[0] === scenario) ? label : scenario);
130
138
  }
131
139
 
132
- // 화면(learn · instructor · edit)은 검사기가 kindModes로 이미 걸러 state.entries에 켠 것만 온다.
140
+ // 화면(learn · instructor · edit · completionPolicy)은 검사기가 kindModes로 이미 걸러 state.entries에 켠 것만 온다.
133
141
  // 문제 설명에는 학생 보기만 둔다: 다른 보기가 있는지는 서버 · LXP와 아직 정하지 않았다 (progress G81)
134
142
  const available = (s) => entryOf(s[2]) && (state.kind !== 'description' || s[0] === 'student');
135
143
  function renderScenarios() {
@@ -139,7 +147,9 @@ function hostPage(opts) {
139
147
  b.onclick = () => open(scenario);
140
148
  return b;
141
149
  }));
142
- const keep = current === PREVIEW[0] ? available(PREVIEW) : SCENARIOS.some((s) => s[0] === current && available(s));
150
+ const tool = TOOLS.find((t) => t[0] === current);
151
+ const keep = tool ? available(tool) : SCENARIOS.some((s) => s[0] === current && available(s));
152
+ editDraftEl.disabled = !available(EDIT_DRAFT);
143
153
  if (!keep) current = 'student';
144
154
  }
145
155
 
@@ -156,11 +166,13 @@ function hostPage(opts) {
156
166
  if (!data || typeof data !== 'object' || data.source !== SDK_SOURCE) return;
157
167
  const payload = data.payload || {};
158
168
  switch (data.type) {
159
- case 'settings-change':
160
- if (current !== 'edit' || !payload.settings || typeof payload.settings !== 'object') return;
161
- pendingSettings = payload.settings;
162
- saveEl.disabled = false;
163
- note('settings-change: ' + JSON.stringify(pendingSettings) + ' (저장을 누르면 자료에 저장)');
169
+ // 편집 화면의 saveSettings 결과. 저장은 콘텐츠가 edit 토큰으로 이미 했고, 편집 페이지는 표시만 한다
170
+ case 'settings-saved':
171
+ note(payload.status === 'saved'
172
+ ? (current === 'completionPolicy'
173
+ ? 'settings-saved: 완료 정책을 저장했습니다 (.ecdk/completion.json). 학생 보기가 이 정책으로 완료 · 채점합니다'
174
+ : 'settings-saved: 저장했습니다. 다른 보기에서 material.settings로 받습니다 (내용 · 채점 방식 · 답은 .ecdk/settings.json)')
175
+ : 'settings-saved: 저장 실패 (' + payload.code + ')');
164
176
  return;
165
177
  case 'navigate-prev':
166
178
  note('navigate-prev: 이전 차시로 이동 (dev는 이동하지 않음)');
@@ -192,19 +204,6 @@ function hostPage(opts) {
192
204
  }
193
205
  });
194
206
 
195
- // 편집 페이지의 자료 저장: 마지막으로 받은 settings를 edit 토큰으로 PATCH
196
- saveEl.onclick = async () => {
197
- if (!pendingSettings) return;
198
- const { token } = await (await fetch('/__ecdk/token?scenario=edit')).json();
199
- const res = await fetch('/api/materials/' + MATERIAL_ID, {
200
- method: 'PATCH',
201
- headers: { Authorization: 'Bearer ' + token, 'Content-Type': 'application/json' },
202
- body: JSON.stringify({ settings: pendingSettings }),
203
- });
204
- note(res.ok ? '저장했습니다. 다른 보기에서 material.settings로 받습니다' : '저장 실패 (' + res.status + ')');
205
- if (res.ok) saveEl.disabled = true;
206
- };
207
-
208
207
  for (const b of document.querySelectorAll('[data-w]')) b.onclick = () => {
209
208
  for (const x of document.querySelectorAll('[data-w]')) x.setAttribute('aria-pressed', String(x === b));
210
209
  frame.style.setProperty('--w', b.dataset.w);
@@ -222,6 +221,7 @@ function hostPage(opts) {
222
221
  toolsEl.querySelector('summary').focus();
223
222
  });
224
223
  previewEl.onclick = () => { toolsEl.open = false; open(PREVIEW[0]); };
224
+ editDraftEl.onclick = () => { toolsEl.open = false; open(EDIT_DRAFT[0]); };
225
225
  document.getElementById('reset').onclick = async () => { await fetch('/__ecdk/reset', { method: 'POST' }); open(current); };
226
226
 
227
227
  state = await (await fetch('/__ecdk/state')).json();
@@ -1,5 +1,5 @@
1
+ import { type CompletionPolicy, type LocalGrading } from '../core/config.js';
1
2
  import type { IncomingMessage, ServerResponse } from 'node:http';
2
- import type { GradingConfig } from '../core/config.js';
3
3
  /**
4
4
  * elice-material API 흉내 (서버 설계 v25, @eliceio/cdk 1.x가 부르는 것만).
5
5
  * 응답은 elib 형식 `{ data, meta }`, 필드는 snake_case. 오류는 `{ data: null, meta: { error } }`.
@@ -20,9 +20,14 @@ export type MaterialViewer = 'student' | 'instructor' | 'tutor';
20
20
  /**
21
21
  * dev 호스트 화면의 보기 (dev 전용). 토큰은 scope + viewer로 바뀐다.
22
22
  * - student · instructor · tutor: `#token=…` (scope learn)
23
- * - edit: 토큰 없이 `#edit=1`. edit 토큰은 호스트의 "저장" 버튼이 PATCH할 때만 쓴다
23
+ * - edit: `#token=…` (scope edit). LXP 편집 페이지처럼 저장된 버전의 편집 화면을 edit 토큰으로 열고,
24
+ * 콘텐츠의 `saveSettings`가 이 토큰으로 바로 PATCH한다 (토큰 없는 `#edit=1` draft는 저장할 수 없음)
25
+ * - completionPolicy: `#token=…&screen=completionPolicy` (scope edit). 완료 정책 화면 (ADR 0009). SDK
26
+ * `saveCompletionPolicy`가 보낸 `PATCH { completion_policy }`를 `.ecdk/completion.json`에 쓴다 (운영은 material_version)
27
+ * 편집 화면의 `saveSettings`가 보낸 settings(내용 + `grading` { type: pattern | rubric })는 통째로 `.ecdk/settings.json`에 쓰고,
28
+ * edit 범위 응답에는 `grading`까지, 학생 · 튜터 · 교육자(learn scope) 응답에는 서버처럼 `grading`을 빼고 준다
24
29
  */
25
- export type DevScenario = 'student' | 'instructor' | 'tutor' | 'edit';
30
+ export type DevScenario = 'student' | 'instructor' | 'tutor' | 'edit' | 'completionPolicy';
26
31
  /** 토큰을 발급하는 보기 */
27
32
  export type TokenScenario = DevScenario;
28
33
  export declare const TOKEN_SCENARIOS: Readonly<Record<DevScenario, {
@@ -46,7 +51,10 @@ interface Result {
46
51
  completed_at: string | null;
47
52
  }
48
53
  export interface MockState {
54
+ /** 저장된 settings 전체 (내용 + grading). ecdk dev는 `.ecdk/settings.json`에서 읽고 저장할 때 씀 */
49
55
  settings: Record<string, unknown>;
56
+ /** 저장할 때마다 올라가는 버전 번호. 응답의 `current_version.id`는 `dev-{n}` */
57
+ version: number;
50
58
  submissions: Submission[];
51
59
  /** 계정별 결과. 자료당 하나이고 버전이 바뀌어도 지우지 않는다 */
52
60
  results: Map<number, Result>;
@@ -56,8 +64,15 @@ export interface MockState {
56
64
  export declare const createState: () => MockState;
57
65
  export interface MockApiOptions {
58
66
  state: MockState;
59
- getGrading: () => GradingConfig | undefined;
67
+ /** 채점에 쓰는 값 (로컬 완료 정책 + 저장한 settings.grading) */
68
+ getGrading: () => LocalGrading | undefined;
69
+ /** 편집 화면이 저장한 settings 전체(내용 + grading)를 `.ecdk/settings.json`에 쓴다 */
70
+ saveSettings?: (settings: Record<string, unknown>) => Promise<void>;
60
71
  getEntries: () => Record<string, string>;
72
+ /** metadata completionPolicies (서버가 metadata를 그대로 돌려준다고 보고 응답에 넣는다, G132) */
73
+ getCompletionPolicies?: () => string[];
74
+ /** 완료 정책 화면이 저장한 completion_policy를 .ecdk/completion.json에 쓴다 */
75
+ saveCompletionPolicy?: (policy: CompletionPolicy) => Promise<void>;
61
76
  onEvent?: (message: string) => void;
62
77
  }
63
78
  /** `/api` 아래 요청을 처리한다 */