aicommunicator-plugin-check 0.2.0 → 0.2.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/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # aicommunicator-plugin-check
2
2
 
3
- AIC(aicommunicator) 플러그인의 manifest 와 묶음 파일(`.tgz`)의 규칙을 확인하는 코드입니다. AIC 코어, `aic` 명령, 플러그인 등록 사이트가 이 패키지 하나를 함께 써서, 셋이 같은 플러그인을 같은 규칙으로 받아들이거나 거절합니다.
3
+ Code that checks the rules for the manifest and the package file (`.tgz`) of AIC (aicommunicator) plugins. The AIC core, the `aic` command, and the plugin registry site all use this one npm package, so the three accept or reject the same plugin by the same rules.
4
4
 
5
- - 다른 패키지에 기대지 않고 Node 내장 모듈(`node:crypto`, `node:zlib`)만 씁니다. Node 22.13 이상에서 돕니다.
6
- - 플러그인 코드를 실행하지 않습니다. manifest 의 글, 묶음 안의 파일 이름과 크기, 설명서와 예제 파일의 글만 봅니다.
7
- - 설계는 aicommunicator 저장소의 `doc/036_plugin_registry_design.md` 에 있고, 설명서와 예제는 `doc/037_plugin_manual_design.md` 에 있습니다.
5
+ - It depends on no other package and uses only built-in Node modules (`node:crypto`, `node:zlib`). It runs on Node 22.13 or later.
6
+ - It does not run plugin code. It only looks at the text of the manifest, the names and sizes of files in the package file, and the text of the manual and sample files.
7
+ - The design is in `doc/036_plugin_registry_design.md` of the aicommunicator repository, and the manual and samples are in `doc/037_plugin_manual_design.md`.
8
8
 
9
9
  ```bash
10
10
  npm install aicommunicator-plugin-check
@@ -14,7 +14,7 @@ npm install aicommunicator-plugin-check
14
14
  import { readBundle, checkBundleForRegistry, BundleError } from 'aicommunicator-plugin-check';
15
15
 
16
16
  try {
17
- const bundle = readBundle(buffer); // .tgz 의 Buffer
17
+ const bundle = readBundle(buffer); // Buffer of the .tgz
18
18
  const problem = checkBundleForRegistry(bundle);
19
19
  if (problem) console.log(problem.code, problem.message);
20
20
  } catch (e) {
@@ -22,37 +22,37 @@ try {
22
22
  }
23
23
  ```
24
24
 
25
- ## 내보내는 것
25
+ ## Exports
26
26
 
27
- | 이름 | 하는 일 |
27
+ | Name | What it does |
28
28
  | --- | --- |
29
- | `PROTOCOL_VERSION` | 코어의 플러그인 계약 버전. 지금 `"0.1"` |
30
- | `checkManifest(manifest)` | 코어가 쓰는 manifest 검사. 틀리면 까닭의 글, 맞으면 `null` |
31
- | `checkForRegistry(manifest)` | `checkManifest` 에 더해 사이트에 올릴 때 필요한 칸(`protocol`, `license`, `title`, `about`)을 본다 |
32
- | `checkBundleForRegistry(bundle)` | `checkForRegistry` 와 `LICENSE` 파일을 본다. 문제가 있으면 `{ code, message }`(code 는 `bad_manifest` 나 `bad_bundle`), 없으면 `null` |
33
- | `readBundle(buffer)` | `.tgz` 를 풀어 규칙(들어갈 수 있는 파일, 5MB, 200개, 묶음 밖 경로, 링크, 설명서와 예제)을 확인하고 `{ manifest, files, sha256, size }` 를 돌려준다. 틀리면 `BundleError` 를 던진다 |
34
- | `BundleError` | `code` 가 `too_large`, `bad_bundle`, `bad_manifest` 가운데 하나다 |
35
- | `packBundle(files)` | 파일 목록으로 `.tgz` 를 만든다. 같은 입력이면 같은 바이트가 나온다 |
36
- | `compareVersions(a, b)` | semver 순서. -1, 0, 1 |
37
- | `satisfies(version, range)` | `1.2.3`, `^1.2.3`, `~1.2.3`, `>=1.2.3` 네 가지 범위. 뜻은 npm 과 같다 |
38
- | `protocolAccepts(range, core?)` | manifest 의 `protocol` 이 코어의 계약 버전을 받는지 |
39
- | `stateId(plugins)`, `canonicalState(plugins)`, `checkState(plugins)` | 플러그인 구성의 상태 id 계산과 목록의 모양 검사 |
40
- | `isPluginId`, `idOwner`, `isVersion`, `isPrerelease`, `isRange`, `isProtocolRange`, `isStateId` | 모양 확인 |
41
- | `bundleFileName`, `bundlePathAllowed`, `sha256Hex` | 묶음 파일 이름, 묶음에 들어갈 수 있는 경로인지, sha256 |
42
- | `BUNDLE_MAX_BYTES`, `BUNDLE_MAX_FILES`, `MAX_DEPENDENCIES`, `STATE_MAX_PLUGINS`, `RESERVED_IDS` | 한도와 쓰지 못하는 id |
43
- | `checkMessageTable(data)` | 외부 연결의 메시지 표(`aic-link-messages/1`) 파일의 바이트를 검사한다. 맞으면 `{ ok: true, table }`, 틀리면 `{ ok: false, problems }` |
44
- | `renderMessage(table, id, values)` | 표에 등록한 메시지 id 와 값을 글로 푼다. 등록하지 않은 id, 값이 틀린 것, 모양이 틀린 id 는 글을 만들지 않고 까닭(`unknown_id`, `bad_values`, `malformed_id`)을 돌려준다 |
45
- | `isMessageId`, `MESSAGE_TABLE_FORMAT`, `MESSAGE_TABLE_MAX_BYTES`, `MESSAGE_TABLE_MAX_MESSAGES`, `MESSAGE_TEXT_MAX` | 메시지 표의 모양 확인과 한도 |
46
- | `docsProblem(manifest, files)` | manifest 의 `manual`(설명서)과 `samples`(예제)가 가리키는 파일이 있는지, 한도와 모양이 맞는지 본다. `readBundle` 이 함께 부른다 |
47
- | `bundleNotices(manifest)` | 거절하지 않고 알리기만 하는 것. 지금은 설명서가 없을 때 한 줄이다 |
48
- | `checkSample(value)`, `parseSample(data)`, `parseManual(data)` | 예제 파일(`aic-sample/1`)의 모양 검사, 예제와 설명서 파일의 글자 한도와 UTF-8 검사 |
49
- | `sampleNarrative(sample, { installed?, self? })`, `samplePluginLines`, `missingPlugins` | 예제를 revision 마다 사람의 말, AI 가 한 일, 화면 변화의 차례 글로 옮기고, 설치되지 않은 플러그인을 알린다 |
50
- | `SAMPLE_FORMAT`, `MANUAL_MAX_CHARS`, `SAMPLE_MAX_CHARS`, `MAX_SAMPLES`, `SAMPLE_WHO` | 예제 형식의 이름, 설명서 50,000자, 예제 하나 200,000자, 예제 다섯 개, 참여자 표기("사람", "AI", "코어") |
51
-
52
- ## 버전
53
-
54
- 검사 규칙을 바꾸면 이 패키지의 버전을 올리고, 등록 사이트가 그 버전을 따라 올립니다. 0 으로 시작하는 동안은 가운데 숫자가 바뀌면 규칙이 호환되지 않게 바뀐 것입니다.
55
-
56
- ## 라이선스
29
+ | `PROTOCOL_VERSION` | The plugin contract version of the core. Now `"0.1"` |
30
+ | `checkManifest(manifest)` | The manifest check the core uses. Returns the reason as text when something is wrong, and `null` when it is fine |
31
+ | `checkForRegistry(manifest)` | On top of `checkManifest`, checks the fields needed to upload to the site (`protocol`, `license`, `title`, `about`) |
32
+ | `checkBundleForRegistry(bundle)` | Checks `checkForRegistry` and the `LICENSE` file. Returns `{ code, message }` (code is `bad_manifest` or `bad_bundle`) when there is a problem, and `null` when there is none |
33
+ | `readBundle(buffer)` | Unpacks a `.tgz`, checks the rules (allowed files, 5MB, 200 files, paths outside the package, links, manual and samples), and returns `{ manifest, files, sha256, size }`. Throws `BundleError` when something is wrong |
34
+ | `BundleError` | `code` is one of `too_large`, `bad_bundle`, `bad_manifest` |
35
+ | `packBundle(files)` | Makes a `.tgz` from a list of files. The same input gives the same bytes |
36
+ | `compareVersions(a, b)` | semver order. -1, 0, 1 |
37
+ | `satisfies(version, range)` | Four kinds of range: `1.2.3`, `^1.2.3`, `~1.2.3`, `>=1.2.3`. The meaning is the same as in npm |
38
+ | `protocolAccepts(range, core?)` | Whether the `protocol` of a manifest accepts the contract version of the core |
39
+ | `stateId(plugins)`, `canonicalState(plugins)`, `checkState(plugins)` | Computes the state id of a plugin setup and checks the shape of the list |
40
+ | `isPluginId`, `idOwner`, `isVersion`, `isPrerelease`, `isRange`, `isProtocolRange`, `isStateId` | Shape checks |
41
+ | `bundleFileName`, `bundlePathAllowed`, `sha256Hex` | The package file name, whether a path may go into a package, sha256 |
42
+ | `BUNDLE_MAX_BYTES`, `BUNDLE_MAX_FILES`, `MAX_DEPENDENCIES`, `STATE_MAX_PLUGINS`, `RESERVED_IDS` | Limits and ids that cannot be used |
43
+ | `checkMessageTable(data)` | Checks the bytes of a message table file (`aic-link-messages/1`) of an external connection. Returns `{ ok: true, table }` when it is fine, and `{ ok: false, problems }` when it is not |
44
+ | `renderMessage(table, id, values)` | Turns a message id registered in the table and its values into text. For an unregistered id, wrong values, or a malformed id, it makes no text and returns the reason (`unknown_id`, `bad_values`, `malformed_id`) |
45
+ | `isMessageId`, `MESSAGE_TABLE_FORMAT`, `MESSAGE_TABLE_MAX_BYTES`, `MESSAGE_TABLE_MAX_MESSAGES`, `MESSAGE_TEXT_MAX` | Shape check and limits of the message table |
46
+ | `docsProblem(manifest, files)` | Checks that the files that `manual` (the manual) and `samples` of the manifest point to exist, and that their limits and shapes are right. `readBundle` calls it too |
47
+ | `bundleNotices(manifest)` | Things it only reports without rejecting. Now one line each when there is no manual or no icon |
48
+ | `checkSample(value)`, `parseSample(data)`, `parseManual(data)` | Shape check of a sample file (`aic-sample/1`), and character limit and UTF-8 checks of sample and manual files |
49
+ | `sampleNarrative(sample, { installed?, self? })`, `samplePluginLines`, `missingPlugins` | Turns a sample into text in order, per revision: what the person said, what the AI did, and the screen changes. Reports plugins that are not installed |
50
+ | `SAMPLE_FORMAT`, `MANUAL_MAX_CHARS`, `SAMPLE_MAX_CHARS`, `MAX_SAMPLES`, `SAMPLE_WHO` | The name of the sample format, the manual limit of 50,000 characters, 200,000 characters per sample, five samples, and how participants are written in the file ("Person", "AI", "Core", with a number such as "Person 2" when there are several of the same kind; older files that wrote "사람" and "코어" are still accepted) |
51
+
52
+ ## Versions
53
+
54
+ When the check rules change, the version of this package goes up, and the registry site follows that version. While the version starts with 0, a change in the middle number means the rules changed in an incompatible way.
55
+
56
+ ## License
57
57
 
58
58
  Apache-2.0
package/dist/bundle.js CHANGED
@@ -44,7 +44,7 @@ export function docsProblem(manifest, files) {
44
44
  if (manifest.manual !== undefined) {
45
45
  const data = files.get(manifest.manual);
46
46
  if (!data)
47
- return `설명서 파일 ${manifest.manual} 이 없다`;
47
+ return `The manual file ${manifest.manual} is missing`;
48
48
  const read = parseManual(data);
49
49
  if (!read.ok)
50
50
  return `${manifest.manual}: ${read.problem}`;
@@ -52,12 +52,12 @@ export function docsProblem(manifest, files) {
52
52
  for (const s of manifest.samples ?? []) {
53
53
  const data = files.get(s.file);
54
54
  if (!data)
55
- return `예제 ${s.id} 의 파일 ${s.file} 이 없다`;
55
+ return `The file ${s.file} of sample ${s.id} is missing`;
56
56
  const read = parseSample(data);
57
57
  if (!read.ok)
58
- return `예제 ${s.id}(${s.file}): ${read.problem}`;
58
+ return `Sample ${s.id} (${s.file}): ${read.problem}`;
59
59
  if (!read.sample.plugins.some((p) => p.package === manifest.id))
60
- return `예제 ${s.id}(${s.file}) 의 plugins 에 이 플러그인 ${manifest.id} 이 없다. 이 플러그인을 쓴 작업을 내보낸다`;
60
+ return `The plugins of sample ${s.id} (${s.file}) do not include this plugin ${manifest.id}. Export a work that uses this plugin`;
61
61
  }
62
62
  return null;
63
63
  }
@@ -67,7 +67,7 @@ export function iconFileProblem(manifest, files) {
67
67
  return null;
68
68
  const data = files.get(manifest.icon);
69
69
  if (!data)
70
- return `아이콘 파일 ${manifest.icon} 이 없다`;
70
+ return `The icon file ${manifest.icon} is missing`;
71
71
  const problem = iconProblem(data);
72
72
  return problem ? `${manifest.icon}: ${problem}` : null;
73
73
  }
@@ -77,8 +77,8 @@ export function iconFileProblem(manifest, files) {
77
77
  */
78
78
  export function bundleNotices(manifest) {
79
79
  return [
80
- ...(manifest.manual === undefined ? ['설명서(manifest 의 manual)가 없다. 등록 사이트는 설명서를 권한다. 없어도 올라간다'] : []),
81
- ...(manifest.icon === undefined ? ['대표 아이콘(manifest 의 icon)이 없다. 플러그인을 고르는 화면은 이름의 첫 글자를 보인다. 없어도 올라간다'] : []),
80
+ ...(manifest.manual === undefined ? ['There is no manual (manual in the manifest). The registry site recommends a manual. The plugin can be uploaded without one'] : []),
81
+ ...(manifest.icon === undefined ? ['There is no icon (icon in the manifest). The screen for choosing plugins shows the first letter of the name instead. The plugin can be uploaded without one'] : []),
82
82
  ];
83
83
  }
84
84
  // ---- ustar ----
@@ -91,7 +91,7 @@ function octal(value, width) {
91
91
  function writeString(buf, offset, width, s) {
92
92
  const bytes = Buffer.from(s, 'utf8');
93
93
  if (bytes.length > width)
94
- throw new BundleError('bad_bundle', `묶음 안의 이름이 너무 길다: ${s}`);
94
+ throw new BundleError('bad_bundle', `A name in the package is too long: ${s}`);
95
95
  bytes.copy(buf, offset);
96
96
  }
97
97
  /** 이름이 100바이트를 넘으면 ustar 의 prefix(155바이트)로 나눈다. */
@@ -104,7 +104,7 @@ function splitName(p) {
104
104
  if (Buffer.byteLength(prefix) <= 155 && Buffer.byteLength(name) <= 100)
105
105
  return { name, prefix };
106
106
  }
107
- throw new BundleError('bad_bundle', `묶음 안의 경로가 너무 길다: ${p}`);
107
+ throw new BundleError('bad_bundle', `A path in the package is too long: ${p}`);
108
108
  }
109
109
  function header(p, size) {
110
110
  const h = Buffer.alloc(BLOCK);
@@ -137,9 +137,9 @@ export function packBundle(files) {
137
137
  const seen = new Set();
138
138
  for (const [p, data] of entries) {
139
139
  if (!isPluginPath(p))
140
- throw new BundleError('bad_bundle', `묶음에 넣을 수 없는 경로다: ${JSON.stringify(p)}`);
140
+ throw new BundleError('bad_bundle', `This path cannot go into a package: ${JSON.stringify(p)}`);
141
141
  if (seen.has(p))
142
- throw new BundleError('bad_bundle', `같은 경로가 둘이다: ${p}`);
142
+ throw new BundleError('bad_bundle', `The same path appears twice: ${p}`);
143
143
  seen.add(p);
144
144
  parts.push(header(p, data.length), data);
145
145
  const pad = (BLOCK - (data.length % BLOCK)) % BLOCK;
@@ -161,12 +161,12 @@ function readString(buf, offset, width) {
161
161
  }
162
162
  function readOctal(buf, offset, width, what) {
163
163
  if (buf[offset] & 0x80)
164
- throw new BundleError('bad_bundle', `묶음의 ${what} 를 읽지 못했다(256진 표기는 받지 않는다)`);
164
+ throw new BundleError('bad_bundle', `Could not read the ${what} of the package (base-256 notation is not accepted)`);
165
165
  const s = readString(buf, offset, width).trim();
166
166
  if (s === '')
167
167
  return 0;
168
168
  if (!/^[0-7]+$/.test(s))
169
- throw new BundleError('bad_bundle', `묶음의 ${what} 가 8진 숫자가 아니다`);
169
+ throw new BundleError('bad_bundle', `The ${what} of the package is not an octal number`);
170
170
  return parseInt(s, 8);
171
171
  }
172
172
  /** pax 머리말의 "길이 key=value\n" 기록에서 path 를 꺼낸다. */
@@ -179,7 +179,7 @@ function paxPath(data) {
179
179
  break;
180
180
  const len = Number(data.subarray(i, space).toString('ascii'));
181
181
  if (!Number.isInteger(len) || len <= 0 || i + len > data.length)
182
- throw new BundleError('bad_bundle', '묶음의 pax 머리말을 읽지 못했다');
182
+ throw new BundleError('bad_bundle', 'Could not read the pax header of the package');
183
183
  const record = data.subarray(space + 1, i + len - 1).toString('utf8');
184
184
  const eq = record.indexOf('=');
185
185
  if (eq > 0 && record.slice(0, eq) === 'path')
@@ -198,7 +198,7 @@ function cleanPath(raw, dir) {
198
198
  if (dir && (p === '' || p === '.'))
199
199
  return '';
200
200
  if (!isPluginPath(p))
201
- throw new BundleError('bad_bundle', `묶음 안의 경로가 플러그인 폴더 안의 상대 경로가 아니다: ${JSON.stringify(raw)}`);
201
+ throw new BundleError('bad_bundle', `A path in the package is not a relative path inside the plugin folder: ${JSON.stringify(raw)}`);
202
202
  return p;
203
203
  }
204
204
  /**
@@ -211,7 +211,7 @@ function cleanPath(raw, dir) {
211
211
  export function readBundle(buffer) {
212
212
  const buf = Buffer.from(buffer.buffer, buffer.byteOffset, buffer.byteLength);
213
213
  if (buf.length > BUNDLE_MAX_BYTES)
214
- throw new BundleError('too_large', `묶음이 ${BUNDLE_MAX_BYTES} 바이트를 넘는다(${buf.length} 바이트)`);
214
+ throw new BundleError('too_large', `The package is over ${BUNDLE_MAX_BYTES} bytes (${buf.length} bytes)`);
215
215
  // 파일 내용의 합은 BUNDLE_MAX_BYTES 까지이고, 머리말과 채움은 파일마다 1,024 바이트를 넘지 않는다
216
216
  const maxTar = BUNDLE_MAX_BYTES + (BUNDLE_MAX_FILES + 8) * BLOCK * 2;
217
217
  let tar;
@@ -220,9 +220,9 @@ export function readBundle(buffer) {
220
220
  }
221
221
  catch (e) {
222
222
  if (e instanceof RangeError || e.code === 'ERR_BUFFER_TOO_LARGE') {
223
- throw new BundleError('too_large', `풀린 묶음이 한도(${BUNDLE_MAX_BYTES} 바이트)를 넘는다`);
223
+ throw new BundleError('too_large', `The unpacked package is over the limit (${BUNDLE_MAX_BYTES} bytes)`);
224
224
  }
225
- throw new BundleError('bad_bundle', `묶음이 gzip 파일이 아니다(${e.message})`);
225
+ throw new BundleError('bad_bundle', `The package is not a gzip file (${e.message})`);
226
226
  }
227
227
  const files = new Map();
228
228
  let total = 0;
@@ -238,14 +238,14 @@ export function readBundle(buffer) {
238
238
  let sum = 0;
239
239
  for (let i = 0; i < BLOCK; i += 1)
240
240
  sum += i >= 148 && i < 156 ? 0x20 : h[i];
241
- if (readOctal(h, 148, 8, '검사합') !== sum)
242
- throw new BundleError('bad_bundle', '묶음의 머리말 검사합이 맞지 않는다');
243
- const size = readOctal(h, 124, 12, '파일 크기');
241
+ if (readOctal(h, 148, 8, 'checksum') !== sum)
242
+ throw new BundleError('bad_bundle', 'The header checksum of the package does not match');
243
+ const size = readOctal(h, 124, 12, 'file size');
244
244
  const type = String.fromCharCode(h[156]);
245
245
  const dataStart = offset + BLOCK;
246
246
  const dataEnd = dataStart + size;
247
247
  if (dataEnd > tar.length)
248
- throw new BundleError('bad_bundle', '묶음이 중간에 끊겼다');
248
+ throw new BundleError('bad_bundle', 'The package is cut off in the middle');
249
249
  const data = tar.subarray(dataStart, dataEnd);
250
250
  offset = dataStart + Math.ceil(size / BLOCK) * BLOCK;
251
251
  if (type === 'x') {
@@ -266,40 +266,40 @@ export function readBundle(buffer) {
266
266
  continue;
267
267
  }
268
268
  if (type !== '0' && type !== '\0')
269
- throw new BundleError('bad_bundle', `묶음에 보통 파일이 아닌 항목이 있다: ${rawName}`);
269
+ throw new BundleError('bad_bundle', `The package has an entry that is not a regular file: ${rawName}`);
270
270
  const p = cleanPath(rawName, false);
271
271
  if (files.has(p))
272
- throw new BundleError('bad_bundle', `묶음에 같은 경로가 둘이다: ${p}`);
272
+ throw new BundleError('bad_bundle', `The package has the same path twice: ${p}`);
273
273
  if (files.size + 1 > BUNDLE_MAX_FILES)
274
- throw new BundleError('too_large', `묶음의 파일이 ${BUNDLE_MAX_FILES}개를 넘는다`);
274
+ throw new BundleError('too_large', `The package has more than ${BUNDLE_MAX_FILES} files`);
275
275
  total += size;
276
276
  if (total > BUNDLE_MAX_BYTES)
277
- throw new BundleError('too_large', `묶음의 파일 크기 합이 ${BUNDLE_MAX_BYTES} 바이트를 넘는다`);
277
+ throw new BundleError('too_large', `The total file size in the package is over ${BUNDLE_MAX_BYTES} bytes`);
278
278
  files.set(p, Buffer.from(data));
279
279
  }
280
280
  if (!ended)
281
- throw new BundleError('bad_bundle', '묶음의 끝 표시가 없다');
281
+ throw new BundleError('bad_bundle', 'The package has no end marker');
282
282
  const manifestFile = files.get('manifest.json');
283
283
  if (!manifestFile)
284
- throw new BundleError('bad_bundle', '묶음에 manifest.json 이 없다');
284
+ throw new BundleError('bad_bundle', 'The package has no manifest.json');
285
285
  let manifest;
286
286
  try {
287
287
  manifest = JSON.parse(manifestFile.toString('utf8'));
288
288
  }
289
289
  catch (e) {
290
- throw new BundleError('bad_manifest', `manifest.json 이 JSON 이 아니다(${e.message})`);
290
+ throw new BundleError('bad_manifest', `manifest.json is not JSON (${e.message})`);
291
291
  }
292
292
  const problem = checkManifest(manifest);
293
293
  if (problem)
294
294
  throw new BundleError('bad_manifest', problem);
295
295
  const m = manifest;
296
296
  if (!files.has(m.logic))
297
- throw new BundleError('bad_bundle', `묶음에 논리 파일 ${m.logic} 이 없다`);
297
+ throw new BundleError('bad_bundle', `The package has no logic file ${m.logic}`);
298
298
  if (m.ui !== undefined && !files.has(m.ui))
299
- throw new BundleError('bad_bundle', `묶음에 화면 파일 ${m.ui} 가 없다`);
299
+ throw new BundleError('bad_bundle', `The package has no screen file ${m.ui}`);
300
300
  const extra = [...files.keys()].filter((p) => !bundlePathAllowed(p, m));
301
301
  if (extra.length > 0) {
302
- throw new BundleError('bad_bundle', `묶음에 넣을 수 없는 파일이 있다: ${extra.join(', ')}. manifest.json, 논리 파일, ui/ 의 파일, LICENSE, README.md, manifest 의 manual 과 samples 가 가리키는 파일만 넣는다`);
302
+ throw new BundleError('bad_bundle', `The package has files that cannot go into it: ${extra.join(', ')}. Only include manifest.json, the logic file, files in ui/, LICENSE, README.md, and the files that manual and samples in the manifest point to`);
303
303
  }
304
304
  const docs = docsProblem(m, files) ?? iconFileProblem(m, files);
305
305
  if (docs)
@@ -314,5 +314,5 @@ export function checkBundleForRegistry(bundle) {
314
314
  const problem = checkForRegistry(bundle.manifest);
315
315
  if (problem)
316
316
  return { code: 'bad_manifest', message: problem };
317
- return bundle.files.has('LICENSE') ? null : { code: 'bad_bundle', message: '사이트에 올리려면 묶음에 LICENSE 파일이 있어야 한다' };
317
+ return bundle.files.has('LICENSE') ? null : { code: 'bad_bundle', message: 'To upload to the site, the package needs a LICENSE file' };
318
318
  }
package/dist/icon.js CHANGED
@@ -24,38 +24,38 @@ function insideOnly(text, pattern) {
24
24
  */
25
25
  export function iconProblem(data) {
26
26
  if (data.length === 0)
27
- return '아이콘 파일이 비어 있다';
27
+ return 'The icon file is empty';
28
28
  if (data.length > ICON_MAX_BYTES)
29
- return `아이콘 파일이 ${ICON_MAX_BYTES.toLocaleString('en-US')} 바이트를 넘는다(${data.length.toLocaleString('en-US')} 바이트)`;
29
+ return `The icon file is over ${ICON_MAX_BYTES.toLocaleString('en-US')} bytes (${data.length.toLocaleString('en-US')} bytes)`;
30
30
  let text;
31
31
  try {
32
32
  text = new TextDecoder('utf-8', { fatal: true }).decode(data);
33
33
  }
34
34
  catch {
35
- return '아이콘 파일이 UTF-8 글이 아니다';
35
+ return 'The icon file is not UTF-8 text';
36
36
  }
37
37
  if (/<!DOCTYPE|<!ENTITY/i.test(text))
38
- return '아이콘에 DOCTYPE 이나 ENTITY 를 넣지 않는다';
38
+ return 'The icon must not contain DOCTYPE or ENTITY';
39
39
  const body = text
40
40
  .replace(new RegExp('^' + String.fromCharCode(0xfeff)), '')
41
41
  .replace(/^\s*<\?xml[^>]*\?>/, '')
42
42
  .replace(/<!--[\s\S]*?-->/g, '');
43
43
  if (!/^\s*<svg[\s>]/i.test(body))
44
- return '아이콘 파일이 <svg 로 시작하는 SVG 가 아니다';
44
+ return 'The icon file is not an SVG that starts with <svg';
45
45
  if (!/<\/svg>\s*$/i.test(body))
46
- return '아이콘 파일이 </svg> 로 끝나지 않는다';
46
+ return 'The icon file does not end with </svg>';
47
47
  const banned = /<\s*(script|foreignObject|iframe|object|embed|audio|video|link|meta|style|animate|animateTransform|animateMotion|set)\b/i.exec(body);
48
48
  if (banned)
49
- return `아이콘에 ${banned[1]} 요소를 넣지 않는다`;
49
+ return `The icon must not contain a ${banned[1]} element`;
50
50
  if (/[\s"'/]on[a-z]+\s*=/i.test(body))
51
- return '아이콘에 이벤트 속성(on...)을 넣지 않는다';
51
+ return 'The icon must not contain event attributes (on...)';
52
52
  if (/javascript\s*:|@import/i.test(body))
53
- return '아이콘에 javascript: 주소나 @import 를 넣지 않는다';
53
+ return 'The icon must not contain javascript: addresses or @import';
54
54
  if (!insideOnly(body, /\b(xlink:href|href|src)\s*=\s*(?:"([^"]*)"|'([^']*)')/gi))
55
- return '아이콘의 href 와 src 는 문서 안의 #id 만 가리킨다(바깥 주소와 data: 주소는 받지 않는다)';
55
+ return 'href and src in the icon may only point to a #id inside the document (outside addresses and data: addresses are not accepted)';
56
56
  for (const m of body.matchAll(/url\(\s*(["']?)([^)"']*)\1\s*\)/gi)) {
57
57
  if (!m[2].trim().startsWith('#'))
58
- return '아이콘의 url() 은 문서 안의 #id 만 가리킨다';
58
+ return 'url() in the icon may only point to a #id inside the document';
59
59
  }
60
60
  return null;
61
61
  }
package/dist/manifest.js CHANGED
@@ -46,17 +46,17 @@ function chars(s) {
46
46
  /** 비어 있지 않은 글이고 한도 안인가. 문제가 있으면 그 설명이다. */
47
47
  function textProblem(where, value, max) {
48
48
  if (typeof value !== 'string' || value.trim() === '')
49
- return `${where} 은 비어 있지 않은 글이어야 한다`;
49
+ return `${where} must be non-empty text`;
50
50
  if (chars(value) > max)
51
- return `${where} 이 ${max.toLocaleString('en-US')}자를 넘는다(${chars(value)}자)`;
51
+ return `${where} is over ${max.toLocaleString('en-US')} characters (${chars(value)} characters)`;
52
52
  return null;
53
53
  }
54
54
  /** 칸을 모두 아는 객체인가. 칸 이름을 잘못 적으면 조용히 빠지므로 모르는 칸은 받지 않는다. */
55
55
  function objectProblem(where, value, known) {
56
56
  if (typeof value !== 'object' || value === null || Array.isArray(value))
57
- return `${where} 은 객체여야 한다`;
57
+ return `${where} must be an object`;
58
58
  const extra = Object.keys(value).filter((k) => !known.includes(k));
59
- return extra.length > 0 ? `${where} 에 모르는 칸이 있다: ${extra.join(', ')}` : null;
59
+ return extra.length > 0 ? `${where} has unknown fields: ${extra.join(', ')}` : null;
60
60
  }
61
61
  function requiresProblem(value) {
62
62
  const problem = objectProblem('requires', value, ['os', 'external']);
@@ -65,18 +65,18 @@ function requiresProblem(value) {
65
65
  const r = value;
66
66
  if (r.os !== undefined && r.os !== 'any') {
67
67
  if (!Array.isArray(r.os) || r.os.length === 0)
68
- return 'requires.os 는 "any" 이거나 windows, macos, linux 의 목록이어야 한다';
68
+ return 'requires.os must be "any" or a list of windows, macos, linux';
69
69
  const bad = r.os.filter((o) => typeof o !== 'string' || !OS_NAMES.includes(o));
70
70
  if (bad.length > 0)
71
- return `requires.os 에 모르는 운영체제가 있다: ${bad.map((o) => JSON.stringify(o)).join(', ')}`;
71
+ return `requires.os has an unknown operating system: ${bad.map((o) => JSON.stringify(o)).join(', ')}`;
72
72
  if (new Set(r.os).size !== r.os.length)
73
- return 'requires.os 에 같은 운영체제가 반복된다';
73
+ return 'requires.os repeats the same operating system';
74
74
  }
75
75
  if (r.external !== undefined) {
76
76
  if (!Array.isArray(r.external))
77
- return 'requires.external 은 바깥 도구의 목록이어야 한다';
77
+ return 'requires.external must be a list of external tools';
78
78
  if (r.external.length > 10)
79
- return `requires.external 은 열 개까지다(${r.external.length}개)`;
79
+ return `requires.external can have up to 10 entries (${r.external.length} given)`;
80
80
  for (const [i, t] of r.external.entries()) {
81
81
  const where = `requires.external[${i}]`;
82
82
  const shape = objectProblem(where, t, ['name', 'kind', 'account', 'install', 'note']);
@@ -87,11 +87,11 @@ function requiresProblem(value) {
87
87
  if (name)
88
88
  return name;
89
89
  if (typeof tool.kind !== 'string' || !TOOL_KINDS.includes(tool.kind))
90
- return `${where}.kind 는 program, web, mcp 가운데 하나여야 한다`;
90
+ return `${where}.kind must be one of program, web, mcp`;
91
91
  if (typeof tool.account !== 'string' || !ACCOUNTS.includes(tool.account))
92
- return `${where}.account 는 none, free, paid 가운데 하나여야 한다`;
92
+ return `${where}.account must be one of none, free, paid`;
93
93
  if (typeof tool.install !== 'boolean')
94
- return `${where}.install 은 참이나 거짓이어야 한다`;
94
+ return `${where}.install must be true or false`;
95
95
  if (tool.note !== undefined) {
96
96
  const note = textProblem(`${where}.note`, tool.note, 200);
97
97
  if (note)
@@ -107,14 +107,14 @@ function requiresProblem(value) {
107
107
  */
108
108
  function manualProblem(m) {
109
109
  if (m.manual !== undefined && (!isPluginPath(m.manual) || !m.manual.endsWith('.md'))) {
110
- return `manual ${JSON.stringify(m.manual)} 는 플러그인 폴더 안의 Markdown 파일(.md) 상대 경로여야 한다(예: docs/manual.md)`;
110
+ return `manual ${JSON.stringify(m.manual)} must be a relative path to a Markdown file (.md) inside the plugin folder (for example docs/manual.md)`;
111
111
  }
112
112
  if (m.samples === undefined)
113
113
  return null;
114
114
  if (!Array.isArray(m.samples))
115
- return 'samples 는 { id, title, about, file } 의 목록이어야 한다';
115
+ return 'samples must be a list of { id, title, about, file }';
116
116
  if (m.samples.length > MAX_SAMPLES)
117
- return `samples 는 다섯 개까지다(${m.samples.length}개)`;
117
+ return `samples can have up to 5 entries (${m.samples.length} given)`;
118
118
  const ids = new Set();
119
119
  const files = new Set();
120
120
  for (const [i, s] of m.samples.entries()) {
@@ -124,16 +124,16 @@ function manualProblem(m) {
124
124
  return shape;
125
125
  const sample = s;
126
126
  if (typeof sample.id !== 'string' || !SAMPLE_ID.test(sample.id))
127
- return `${where}.id 는 영어 소문자, 숫자, - 로 1자에서 40자여야 한다`;
127
+ return `${where}.id must be 1 to 40 characters of lowercase English letters, digits, and -`;
128
128
  const text = textProblem(`${where}.title`, sample.title, 100) ?? textProblem(`${where}.about`, sample.about, 300);
129
129
  if (text)
130
130
  return text;
131
131
  if (!isPluginPath(sample.file) || !sample.file.endsWith('.json'))
132
- return `${where}.file ${JSON.stringify(sample.file)} 는 플러그인 폴더 안의 예제 파일(.json) 상대 경로여야 한다(예: samples/first.json)`;
132
+ return `${where}.file ${JSON.stringify(sample.file)} must be a relative path to a sample file (.json) inside the plugin folder (for example samples/first.json)`;
133
133
  if (ids.has(sample.id))
134
- return `samples 에 같은 id ${sample.id} 가 둘이다`;
134
+ return `samples has the id ${sample.id} twice`;
135
135
  if (files.has(sample.file))
136
- return `samples 에 같은 파일 ${sample.file} 이 둘이다`;
136
+ return `samples has the file ${sample.file} twice`;
137
137
  ids.add(sample.id);
138
138
  files.add(sample.file);
139
139
  }
@@ -141,19 +141,19 @@ function manualProblem(m) {
141
141
  }
142
142
  function dependenciesProblem(id, value) {
143
143
  if (typeof value !== 'object' || value === null || Array.isArray(value))
144
- return 'dependencies 는 { "<id>": "<버전 범위>" } 객체여야 한다';
144
+ return 'dependencies must be an object { "<id>": "<version range>" }';
145
145
  const entries = Object.entries(value);
146
146
  if (entries.length > MAX_DEPENDENCIES)
147
- return `dependencies 는 ${MAX_DEPENDENCIES}개까지다(${entries.length}개)`;
147
+ return `dependencies can have up to ${MAX_DEPENDENCIES} entries (${entries.length} given)`;
148
148
  for (const [dep, range] of entries) {
149
149
  if (!isPluginId(dep))
150
- return `dependencies 의 ${JSON.stringify(dep)} 는 플러그인 id 모양이 아니다`;
150
+ return `${JSON.stringify(dep)} in dependencies is not shaped like a plugin id`;
151
151
  if (RESERVED_IDS.includes(dep))
152
- return `dependencies 에 ${dep} 를 적지 않는다. 코어 안에 든 이름이다`;
152
+ return `Do not list ${dep} in dependencies. It is a name built into the core`;
153
153
  if (dep === id)
154
- return 'dependencies 에 자기 자신을 적지 않는다';
154
+ return 'Do not list the plugin itself in dependencies';
155
155
  if (!isRange(range))
156
- return `dependencies.${dep} 의 ${JSON.stringify(range)} 는 1.2.3, ^1.2.3, ~1.2.3, >=1.2.3 가운데 한 모양이어야 한다`;
156
+ return `${JSON.stringify(range)} in dependencies.${dep} must have one of the shapes 1.2.3, ^1.2.3, ~1.2.3, >=1.2.3`;
157
157
  }
158
158
  return null;
159
159
  }
@@ -163,28 +163,28 @@ function dependenciesProblem(id, value) {
163
163
  */
164
164
  export function checkManifest(manifest) {
165
165
  if (typeof manifest !== 'object' || manifest === null || Array.isArray(manifest))
166
- return 'manifest 는 객체여야 한다';
166
+ return 'manifest must be an object';
167
167
  const m = manifest;
168
168
  for (const key of ['id', 'version', 'logic']) {
169
169
  if (typeof m[key] !== 'string')
170
- return `manifest 에 ${key} 가 없다`;
170
+ return `manifest has no ${key}`;
171
171
  }
172
172
  const id = m.id;
173
173
  if (!isPluginId(id))
174
- return `id ${JSON.stringify(id)} 는 계정이름.플러그인이름 모양이어야 한다. 각 부분은 영어 소문자, 숫자, - 로 2자에서 40자다`;
174
+ return `id ${JSON.stringify(id)} must look like account.plugin-name. Each part is 2 to 40 characters of lowercase English letters, digits, and -`;
175
175
  if (RESERVED_IDS.includes(id))
176
- return `id ${id} 는 코어 안에 든 이름이라 플러그인 id 로 쓰지 않는다`;
176
+ return `id ${id} is a name built into the core, so it cannot be used as a plugin id`;
177
177
  if (!isVersion(m.version))
178
- return `version ${JSON.stringify(m.version)} 는 semver(숫자.숫자.숫자, 뒤에 -미리보기이름 가능)여야 한다`;
178
+ return `version ${JSON.stringify(m.version)} must be semver (number.number.number, optionally followed by -prerelease-name)`;
179
179
  if (typeof m.dataVersion !== 'number' || !Number.isInteger(m.dataVersion) || m.dataVersion < 1)
180
- return 'dataVersion 은 1 이상의 정수여야 한다';
180
+ return 'dataVersion must be an integer of 1 or more';
181
181
  if (!isPluginPath(m.logic))
182
- return `logic ${JSON.stringify(m.logic)} 는 플러그인 폴더 안의 상대 경로여야 한다(.. 과 절대 경로는 받지 않는다)`;
182
+ return `logic ${JSON.stringify(m.logic)} must be a relative path inside the plugin folder (.. and absolute paths are not accepted)`;
183
183
  if (m.ui !== undefined && !isUiPath(m.ui))
184
- return `ui ${JSON.stringify(m.ui)} 는 ui/ 바로 아래의 파일이어야 한다(예: ui/index.html)`;
184
+ return `ui ${JSON.stringify(m.ui)} must be a file directly under ui/ (for example ui/index.html)`;
185
185
  // 아이콘은 코어가 내보내는 ui/ 의 파일이어야 화면이 읽는다. icon.ts 의 isIconPath 와 같은 모양이다(서로 불러오지 않게 여기에 적는다)
186
186
  if (m.icon !== undefined && (!isUiPath(m.icon) || !m.icon.toLowerCase().endsWith('.svg'))) {
187
- return `icon ${JSON.stringify(m.icon)} 는 ui/ 바로 아래의 SVG 파일(.svg)이어야 한다(예: ui/icon.svg)`;
187
+ return `icon ${JSON.stringify(m.icon)} must be an SVG file (.svg) directly under ui/ (for example ui/icon.svg)`;
188
188
  }
189
189
  if (m.title !== undefined) {
190
190
  const problem = textProblem('title', m.title, 100);
@@ -203,9 +203,9 @@ export function checkManifest(manifest) {
203
203
  }
204
204
  if (m.examples !== undefined) {
205
205
  if (!Array.isArray(m.examples))
206
- return 'examples 는 { ask, does } 의 목록이어야 한다';
206
+ return 'examples must be a list of { ask, does }';
207
207
  if (m.examples.length > 5)
208
- return `examples 는 다섯 개까지다(${m.examples.length}개)`;
208
+ return `examples can have up to 5 entries (${m.examples.length} given)`;
209
209
  for (const [i, e] of m.examples.entries()) {
210
210
  const where = `examples[${i}]`;
211
211
  const problem = objectProblem(where, e, ['ask', 'does']) ??
@@ -221,7 +221,7 @@ export function checkManifest(manifest) {
221
221
  return problem;
222
222
  }
223
223
  if (m.protocol !== undefined && !isProtocolRange(m.protocol)) {
224
- return `protocol ${JSON.stringify(m.protocol)} 는 0.<숫자> 모양이어야 한다(예: "0.1")`;
224
+ return `protocol ${JSON.stringify(m.protocol)} must look like 0.<number> (for example "0.1")`;
225
225
  }
226
226
  if (m.dependencies !== undefined) {
227
227
  const problem = dependenciesProblem(id, m.dependencies);
@@ -240,5 +240,5 @@ export function checkForRegistry(manifest) {
240
240
  return problem;
241
241
  const m = manifest;
242
242
  const missing = ['protocol', 'license', 'title', 'about'].filter((k) => m[k] === undefined);
243
- return missing.length > 0 ? `사이트에 올리려면 manifest 에 ${missing.join(', ')} 칸이 있어야 한다` : null;
243
+ return missing.length > 0 ? `To upload to the site, the manifest needs the field(s) ${missing.join(', ')}` : null;
244
244
  }
package/dist/messages.js CHANGED
@@ -55,7 +55,7 @@ function valueEdgeProblems(text) {
55
55
  const beforeOk = before === null || VALUE_EDGE.test(before);
56
56
  const afterOk = after === null || VALUE_EDGE.test(after) || (after === '.' && (end + 1 >= text.length || text[end + 1] === ' '));
57
57
  if (!beforeOk || !afterOk) {
58
- out.push(`{${m[1]}} 의 바로 앞과 뒤는 빈칸이나 문장 부호(, ; ! ? ( ) ' ")여야 한다. 마침표는 문장 끝(뒤가 빈칸이나 글 끝)에만 붙인다`);
58
+ out.push(`The characters right before and after {${m[1]}} must be a space or punctuation (, ; ! ? ( ) ' "). A period may follow it only at the end of a sentence (followed by a space or the end of the text)`);
59
59
  }
60
60
  }
61
61
  return out;
@@ -67,33 +67,33 @@ function valueEdgeProblems(text) {
67
67
  */
68
68
  function textProblems(text, names) {
69
69
  if (typeof text !== 'string' || text === '')
70
- return ['text 는 비어 있지 않은 글이어야 한다'];
70
+ return ['text must be non-empty text'];
71
71
  const out = [];
72
72
  if (text.length > MESSAGE_TEXT_MAX)
73
- out.push(`글이 ${MESSAGE_TEXT_MAX}자를 넘는다(${text.length}자)`);
73
+ out.push(`The text is over ${MESSAGE_TEXT_MAX} characters (${text.length} characters)`);
74
74
  if ([...text].some((c) => c.charCodeAt(0) < 0x20 || c.charCodeAt(0) > 0x7e))
75
- out.push('글에는 눈에 보이는 ASCII(0x20 에서 0x7E)만 쓴다. 줄바꿈과 영어 밖의 글자를 받지 않는다');
75
+ out.push('The text may only use visible ASCII (0x20 to 0x7E). Line breaks and non-English characters are not accepted');
76
76
  if (!/[A-Za-z]/.test(text))
77
- out.push('글은 영어 문장이어야 한다');
77
+ out.push('The text must be an English sentence');
78
78
  if (hasAddress(text))
79
- out.push('글에 주소를 넣지 못한다(://, www., 글자 사이의 마침표, @ 를 받지 않는다)');
79
+ out.push('The text cannot contain addresses (://, www., a period between letters, and @ are not accepted)');
80
80
  if (/[<>[\]`\\]/.test(text))
81
- out.push('글에 < > [ ] 역따옴표 역슬래시를 쓰지 않는다');
81
+ out.push('The text must not use < > [ ] backticks or backslashes');
82
82
  out.push(...valueEdgeProblems(text));
83
83
  const used = new Set();
84
84
  for (const m of text.matchAll(PLACEHOLDER)) {
85
85
  const name = m[1];
86
86
  if (!VALUE_NAME.test(name))
87
- out.push(`{${name}} 은 값의 이름 모양(영어 소문자로 시작, 소문자와 숫자와 _ 로 32자까지)이 아니다`);
87
+ out.push(`{${name}} is not shaped like a value name (starts with a lowercase English letter, up to 32 lowercase letters, digits, and _)`);
88
88
  else if (!names.includes(name))
89
- out.push(`{${name}} 은 values 에 없다`);
89
+ out.push(`{${name}} is not in values`);
90
90
  used.add(name);
91
91
  }
92
92
  if (/[{}]/.test(text.replace(PLACEHOLDER, '')))
93
- out.push('짝이 맞지 않는 { 나 } 가 있다');
93
+ out.push('There is an unmatched { or }');
94
94
  for (const n of names)
95
95
  if (!used.has(n))
96
- out.push(`values 의 ${n} 이 글에 나오지 않는다`);
96
+ out.push(`${n} in values does not appear in the text`);
97
97
  return out;
98
98
  }
99
99
  /** values 의 까닭들. 이름마다 종류 하나이고, enum 은 낱말 목록을 함께 적는다. */
@@ -101,34 +101,34 @@ function valuesProblems(values) {
101
101
  if (values === undefined)
102
102
  return [];
103
103
  if (!isPlainObject(values))
104
- return ['values 는 이름마다 종류를 적은 객체여야 한다'];
104
+ return ['values must be an object that gives a type for each name'];
105
105
  const out = [];
106
106
  for (const [name, spec] of Object.entries(values)) {
107
- const at = `값 ${name}`;
107
+ const at = `value ${name}`;
108
108
  if (!VALUE_NAME.test(name))
109
- out.push(`${at}: 이름은 영어 소문자로 시작하고 소문자와 숫자와 _ 로 32자까지다`);
109
+ out.push(`${at}: the name starts with a lowercase English letter and has up to 32 lowercase letters, digits, and _`);
110
110
  if (!isPlainObject(spec) || !MESSAGE_VALUE_TYPES.includes(spec.type)) {
111
- out.push(`${at}: type 은 ${MESSAGE_VALUE_TYPES.join(', ')} 가운데 하나다. 자유 글 값은 없다`);
111
+ out.push(`${at}: type must be one of ${MESSAGE_VALUE_TYPES.join(', ')}. There is no free text value`);
112
112
  continue;
113
113
  }
114
114
  const extra = Object.keys(spec).filter((k) => k !== 'type' && !(spec.type === 'enum' && k === 'values'));
115
115
  if (extra.length)
116
- out.push(`${at}: 모르는 칸 ${extra.join(', ')}`);
116
+ out.push(`${at}: unknown fields ${extra.join(', ')}`);
117
117
  if (spec.type !== 'enum')
118
118
  continue;
119
119
  const words = spec.values;
120
120
  if (!Array.isArray(words) || words.length === 0 || words.length > MESSAGE_ENUM_MAX_VALUES) {
121
- out.push(`${at}: enum 의 values 는 낱말 1개에서 ${MESSAGE_ENUM_MAX_VALUES}개의 목록이다`);
121
+ out.push(`${at}: the values of an enum must be a list of 1 to ${MESSAGE_ENUM_MAX_VALUES} words`);
122
122
  continue;
123
123
  }
124
124
  for (const w of words) {
125
125
  if (typeof w !== 'string' || w.length > MESSAGE_ENUM_WORD_MAX || !ENUM_WORD.test(w)) {
126
- out.push(`${at}: enum 낱말은 영어 글자와 숫자와 빈칸과 _- 로 ${MESSAGE_ENUM_WORD_MAX}자까지다`);
126
+ out.push(`${at}: an enum word has up to ${MESSAGE_ENUM_WORD_MAX} English letters, digits, spaces, and _-`);
127
127
  break;
128
128
  }
129
129
  }
130
130
  if (new Set(words).size !== words.length)
131
- out.push(`${at}: enum 낱말이 겹친다`);
131
+ out.push(`${at}: enum words repeat`);
132
132
  }
133
133
  return out;
134
134
  }
@@ -139,7 +139,7 @@ function valuesProblems(values) {
139
139
  export function checkMessageTable(data) {
140
140
  const bytes = typeof data === 'string' ? new TextEncoder().encode(data) : data;
141
141
  if (bytes.byteLength > MESSAGE_TABLE_MAX_BYTES)
142
- return { ok: false, problems: [`표 파일이 ${MESSAGE_TABLE_MAX_BYTES} 바이트를 넘는다(${bytes.byteLength} 바이트)`] };
142
+ return { ok: false, problems: [`The table file is over ${MESSAGE_TABLE_MAX_BYTES} bytes (${bytes.byteLength} bytes)`] };
143
143
  let raw;
144
144
  try {
145
145
  const text = new TextDecoder('utf-8', { fatal: true }).decode(bytes);
@@ -147,38 +147,38 @@ export function checkMessageTable(data) {
147
147
  }
148
148
  catch {
149
149
  // 해석기의 글은 파일의 일부를 옮겨 적을 수 있어 까닭은 적지 않는다.
150
- return { ok: false, problems: ['표 파일이 UTF-8 JSON 이 아니다'] };
150
+ return { ok: false, problems: ['The table file is not UTF-8 JSON'] };
151
151
  }
152
152
  if (!isPlainObject(raw))
153
- return { ok: false, problems: ['표는 format, version, messages 를 적은 객체여야 한다'] };
153
+ return { ok: false, problems: ['The table must be an object with format, version, and messages'] };
154
154
  const problems = [];
155
155
  const extra = Object.keys(raw).filter((k) => !['format', 'version', 'messages'].includes(k));
156
156
  if (extra.length)
157
- problems.push(`모르는 칸: ${extra.join(', ')}`);
157
+ problems.push(`Unknown fields: ${extra.join(', ')}`);
158
158
  if (raw.format !== MESSAGE_TABLE_FORMAT)
159
- problems.push(`format 은 ${MESSAGE_TABLE_FORMAT} 이어야 한다`);
159
+ problems.push(`format must be ${MESSAGE_TABLE_FORMAT}`);
160
160
  if (!isVersion(raw.version))
161
- problems.push('version 은 1.0.0 같은 semver 여야 한다');
161
+ problems.push('version must be semver such as 1.0.0');
162
162
  if (!isPlainObject(raw.messages)) {
163
- problems.push('messages 는 메시지 id 마다 글을 적은 객체여야 한다');
163
+ problems.push('messages must be an object that gives text for each message id');
164
164
  return { ok: false, problems };
165
165
  }
166
166
  const entries = Object.entries(raw.messages);
167
167
  if (entries.length === 0)
168
- problems.push('messages 가 비었다');
168
+ problems.push('messages is empty');
169
169
  if (entries.length > MESSAGE_TABLE_MAX_MESSAGES)
170
- problems.push(`메시지가 ${MESSAGE_TABLE_MAX_MESSAGES}개를 넘는다(${entries.length}개)`);
170
+ problems.push(`There are more than ${MESSAGE_TABLE_MAX_MESSAGES} messages (${entries.length})`);
171
171
  for (const [id, def] of entries) {
172
- const at = `메시지 ${MESSAGE_ID.test(id) ? id : '(모양이 틀린 id)'}`;
172
+ const at = `message ${MESSAGE_ID.test(id) ? id : '(malformed id)'}`;
173
173
  if (!MESSAGE_ID.test(id))
174
- problems.push(`${at}: id 는 영어 소문자로 시작하고 소문자와 숫자와 _ 로 64자까지다`);
174
+ problems.push(`${at}: the id starts with a lowercase English letter and has up to 64 lowercase letters, digits, and _`);
175
175
  if (!isPlainObject(def)) {
176
- problems.push(`${at}: text 와 values 를 적은 객체여야 한다`);
176
+ problems.push(`${at}: must be an object with text and values`);
177
177
  continue;
178
178
  }
179
179
  const unknown = Object.keys(def).filter((k) => k !== 'text' && k !== 'values');
180
180
  if (unknown.length)
181
- problems.push(`${at}: 모르는 칸 ${unknown.join(', ')}`);
181
+ problems.push(`${at}: unknown fields ${unknown.join(', ')}`);
182
182
  const vp = valuesProblems(def.values);
183
183
  for (const p of vp)
184
184
  problems.push(`${at}: ${p}`);
@@ -189,7 +189,7 @@ export function checkMessageTable(data) {
189
189
  if (problems.length > 0) {
190
190
  const shown = problems.slice(0, MAX_PROBLEMS);
191
191
  if (problems.length > MAX_PROBLEMS)
192
- shown.push(`그 밖에 ${problems.length - MAX_PROBLEMS}개`);
192
+ shown.push(`${problems.length - MAX_PROBLEMS} more`);
193
193
  return { ok: false, problems: shown };
194
194
  }
195
195
  return { ok: true, table: raw };
package/dist/sample.d.ts CHANGED
@@ -3,7 +3,10 @@ export declare const SAMPLE_FORMAT = "aic-sample/1";
3
3
  export declare const MANUAL_MAX_CHARS = 50000;
4
4
  /** 예제 파일 하나의 한도(글자, 037 7절 4번). */
5
5
  export declare const SAMPLE_MAX_CHARS = 200000;
6
- /** 예제를 쓴 참여자. 실제 이름 대신 "사람", "AI" 이고, 같은 종류가 여럿이면 "사람 2" 처럼 번호를 붙인다. 참여자가 없는 revision 은 "코어" 다. */
6
+ /**
7
+ * 예제를 쓴 참여자. 실제 이름 대신 "Person", "AI" 이고, 같은 종류가 여럿이면 "Person 2" 처럼 번호를 붙인다. 참여자가 없는 revision 은 "Core" 다.
8
+ * 새로 내보내는 파일은 영어로 쓰고, 옛 파일의 "사람", "코어" 도 읽는다(999 4.2절, rawdev 2026-11-30).
9
+ */
7
10
  export declare const SAMPLE_WHO: RegExp;
8
11
  /** 예제가 쓴 플러그인 하나. version 은 그 작업에 적힌 가장 높은 버전이다. */
9
12
  export interface SamplePlugin {
@@ -132,7 +135,7 @@ export declare function charCount(s: string): number;
132
135
  /**
133
136
  * 예제 파일(aic-sample/1)의 검사. 문제의 설명이고 없으면 null 이다. 맨 위 층과 revision 과 원인에 모르는 칸이 있으면 거절한다.
134
137
  * 예제는 실제 작업을 내보낸 것이어야 하고(037 7절 2번), 내보낼 때 지운 것(참여자 이름, 도구, 시각, 연결 정의)이 다시 들어가지
135
- * 않게 하려는 것이다. 참여자는 "사람", "AI", "코어" 로만 적는다.
138
+ * 않게 하려는 것이다. 참여자는 "Person", "AI", "Core" 로만 적는다(옛 파일의 "사람", "코어" 도 받는다).
136
139
  */
137
140
  export declare function checkSample(value: unknown): string | null;
138
141
  /** 예제 파일의 글(바이트)을 풀고 검사한다. 맞으면 { ok: true, sample }, 틀리면 까닭이다. 글자 한도도 본다. */
package/dist/sample.js CHANGED
@@ -7,8 +7,11 @@ export const SAMPLE_FORMAT = 'aic-sample/1';
7
7
  export const MANUAL_MAX_CHARS = 50_000;
8
8
  /** 예제 파일 하나의 한도(글자, 037 7절 4번). */
9
9
  export const SAMPLE_MAX_CHARS = 200_000;
10
- /** 예제를 쓴 참여자. 실제 이름 대신 "사람", "AI" 이고, 같은 종류가 여럿이면 "사람 2" 처럼 번호를 붙인다. 참여자가 없는 revision 은 "코어" 다. */
11
- export const SAMPLE_WHO = /^(사람|AI|코어)( [2-9]| [1-9]\d)?$/;
10
+ /**
11
+ * 예제를 쓴 참여자. 실제 이름 대신 "Person", "AI" 이고, 같은 종류가 여럿이면 "Person 2" 처럼 번호를 붙인다. 참여자가 없는 revision 은 "Core" 다.
12
+ * 새로 내보내는 파일은 영어로 쓰고, 옛 파일의 "사람", "코어" 도 읽는다(999 4.2절, rawdev 2026-11-30).
13
+ */
14
+ export const SAMPLE_WHO = /^(Person|AI|Core|사람|코어)( [2-9]| [1-9]\d)?$/;
12
15
  /** 글자 수(코드 포인트). manifest 의 길이 한도와 같은 방법으로 잰다. */
13
16
  export function charCount(s) {
14
17
  let n = 0;
@@ -24,19 +27,19 @@ const REVISION_KEYS = ['revision', 'who', 'kind', 'cause', 'summary', 'operation
24
27
  const TOP_KEYS = ['format', 'title', 'plugins', 'instances', 'revisions', 'generations', 'transmissions'];
25
28
  function wordsProblem(where, w) {
26
29
  if (!isObject(w) || !isText(w.text) || (w.source !== 'screen' && w.source !== 'relayed_by_ai'))
27
- return `${where} 는 { text, source: "screen" | "relayed_by_ai" } 여야 한다`;
30
+ return `${where} must be { text, source: "screen" | "relayed_by_ai" }`;
28
31
  const extra = extraKeys(w, ['text', 'source']);
29
- return extra.length ? `${where} 에 모르는 칸이 있다: ${extra.join(', ')}` : null;
32
+ return extra.length ? `${where} has unknown fields: ${extra.join(', ')}` : null;
30
33
  }
31
34
  function causeProblem(where, c) {
32
35
  if (!isObject(c))
33
- return `${where} 는 객체여야 한다`;
36
+ return `${where} must be an object`;
34
37
  const extra = extraKeys(c, CAUSE_KEYS);
35
38
  if (extra.length)
36
- return `${where} 에 모르는 칸이 있다: ${extra.join(', ')}. 예제는 aic export-sample 로 내보낸 파일이어야 한다`;
39
+ return `${where} has unknown fields: ${extra.join(', ')}. A sample must be a file exported with aic export-sample`;
37
40
  if (c.humanWords !== undefined) {
38
41
  if (!Array.isArray(c.humanWords))
39
- return `${where}.humanWords 는 목록이어야 한다`;
42
+ return `${where}.humanWords must be a list`;
40
43
  for (const [i, w] of c.humanWords.entries()) {
41
44
  const p = wordsProblem(`${where}.humanWords[${i}]`, w);
42
45
  if (p)
@@ -49,95 +52,95 @@ function causeProblem(where, c) {
49
52
  return p;
50
53
  }
51
54
  if (c.selection !== undefined && (!isObject(c.selection) || (c.selection.kind !== 'artifact' && c.selection.kind !== 'concept'))) {
52
- return `${where}.selection 은 kind 가 artifact 나 concept 인 객체여야 한다`;
55
+ return `${where}.selection must be an object whose kind is artifact or concept`;
53
56
  }
54
57
  if (c.switch !== undefined && (!isObject(c.switch) || !isText(c.switch.from) || !isText(c.switch.to)))
55
- return `${where}.switch 는 { from, to, mode } 여야 한다`;
58
+ return `${where}.switch must be { from, to, mode }`;
56
59
  return null;
57
60
  }
58
61
  /**
59
62
  * 예제 파일(aic-sample/1)의 검사. 문제의 설명이고 없으면 null 이다. 맨 위 층과 revision 과 원인에 모르는 칸이 있으면 거절한다.
60
63
  * 예제는 실제 작업을 내보낸 것이어야 하고(037 7절 2번), 내보낼 때 지운 것(참여자 이름, 도구, 시각, 연결 정의)이 다시 들어가지
61
- * 않게 하려는 것이다. 참여자는 "사람", "AI", "코어" 로만 적는다.
64
+ * 않게 하려는 것이다. 참여자는 "Person", "AI", "Core" 로만 적는다(옛 파일의 "사람", "코어" 도 받는다).
62
65
  */
63
66
  export function checkSample(value) {
64
67
  if (!isObject(value))
65
- return '예제 파일은 JSON 객체여야 한다';
68
+ return 'The sample file must be a JSON object';
66
69
  if (value.format !== SAMPLE_FORMAT)
67
- return `예제 파일의 format 은 "${SAMPLE_FORMAT}" 이어야 한다. aic export-sample 로 내보낸 파일을 쓴다`;
70
+ return `The format of the sample file must be "${SAMPLE_FORMAT}". Use a file exported with aic export-sample`;
68
71
  const extra = extraKeys(value, TOP_KEYS);
69
72
  if (extra.length)
70
- return `예제 파일에 모르는 칸이 있다: ${extra.join(', ')}`;
73
+ return `The sample file has unknown fields: ${extra.join(', ')}`;
71
74
  if (!isText(value.title) || value.title.trim() === '' || charCount(value.title) > 200)
72
- return '예제 파일의 title 은 200자까지의 비어 있지 않은 글이어야 한다';
75
+ return 'The title of the sample file must be non-empty text of up to 200 characters';
73
76
  if (!Array.isArray(value.plugins) || value.plugins.length === 0 || value.plugins.length > 20)
74
- return '예제 파일의 plugins 는 플러그인 한 개에서 스무 개의 목록이어야 한다';
77
+ return 'The plugins of the sample file must be a list of 1 to 20 plugins';
75
78
  const seen = new Set();
76
79
  for (const [i, p] of value.plugins.entries()) {
77
80
  if (!isObject(p) || !isPluginId(p.package) || !isVersion(p.version) || (p.title !== undefined && !isText(p.title)))
78
- return `예제 파일의 plugins[${i}] 는 { package, version, title? } 이고 package 는 플러그인 id, version 은 semver 여야 한다`;
81
+ return `plugins[${i}] of the sample file must be { package, version, title? }, where package is a plugin id and version is semver`;
79
82
  if (seen.has(p.package))
80
- return `예제 파일의 plugins 에 ${p.package} 가 둘이다`;
83
+ return `${p.package} appears twice in the plugins of the sample file`;
81
84
  seen.add(p.package);
82
85
  }
83
86
  if (!Array.isArray(value.instances))
84
- return '예제 파일의 instances 는 목록이어야 한다';
87
+ return 'The instances of the sample file must be a list';
85
88
  for (const [i, s] of value.instances.entries()) {
86
89
  if (!isObject(s) || !isText(s.id) || !isText(s.package))
87
- return `예제 파일의 instances[${i}] 는 { id, package, title?, connection? } 여야 한다`;
90
+ return `instances[${i}] of the sample file must be { id, package, title?, connection? }`;
88
91
  const more = extraKeys(s, ['id', 'package', 'title', 'connection']);
89
92
  if (more.length)
90
- return `예제 파일의 instances[${i}] 에 모르는 칸이 있다: ${more.join(', ')}`;
93
+ return `instances[${i}] of the sample file has unknown fields: ${more.join(', ')}`;
91
94
  }
92
95
  if (!Array.isArray(value.revisions) || value.revisions.length === 0)
93
- return '예제 파일의 revisions 는 revision 하나 이상의 목록이어야 한다';
96
+ return 'The revisions of the sample file must be a list of one or more revisions';
94
97
  for (const [i, r] of value.revisions.entries()) {
95
98
  const where = `revisions[${i}]`;
96
99
  if (!isObject(r))
97
- return `예제 파일의 ${where} 는 객체여야 한다`;
100
+ return `${where} of the sample file must be an object`;
98
101
  const more = extraKeys(r, REVISION_KEYS);
99
102
  if (more.length)
100
- return `예제 파일의 ${where} 에 모르는 칸이 있다: ${more.join(', ')}`;
103
+ return `${where} of the sample file has unknown fields: ${more.join(', ')}`;
101
104
  if (!isText(r.revision) || !isText(r.kind) || !isText(r.summary))
102
- return `예제 파일의 ${where} 에 revision, kind, summary 글이 있어야 한다`;
105
+ return `${where} of the sample file must have revision, kind, and summary text`;
103
106
  if (!isText(r.who) || !SAMPLE_WHO.test(r.who))
104
- return `예제 파일의 ${where}.who 는 "사람", "AI", "코어" 가운데 하나(같은 종류가 여럿이면 "사람 2" 처럼 번호)여야 한다. 참여자의 실제 이름은 넣지 않는다`;
107
+ return `${where}.who of the sample file must be one of "Person", "AI", "Core", with a number such as "Person 2" when there are several of the same kind. Do not put real participant names`;
105
108
  if (r.cause !== undefined) {
106
- const p = causeProblem(`예제 파일의 ${where}.cause`, r.cause);
109
+ const p = causeProblem(`${where}.cause of the sample file`, r.cause);
107
110
  if (p)
108
111
  return p;
109
112
  }
110
113
  if (r.operations !== undefined && (!Array.isArray(r.operations) || r.operations.some((o) => !isObject(o) || !isText(o.op))))
111
- return `예제 파일의 ${where}.operations 는 { op, as?, input? } 의 목록이어야 한다`;
114
+ return `${where}.operations of the sample file must be a list of { op, as?, input? }`;
112
115
  if (!Array.isArray(r.changes) || r.changes.some((c) => !isObject(c) || !isText(c.record) || !isText(c.type)))
113
- return `예제 파일의 ${where}.changes 는 { record, type, owner, before, after } 의 목록이어야 한다`;
116
+ return `${where}.changes of the sample file must be a list of { record, type, owner, before, after }`;
114
117
  }
115
118
  if (value.generations !== undefined) {
116
119
  if (!Array.isArray(value.generations))
117
- return '예제 파일의 generations 는 목록이어야 한다';
120
+ return 'The generations of the sample file must be a list';
118
121
  const texts = (v) => Array.isArray(v) && v.every(isText);
119
122
  for (const [i, g] of value.generations.entries()) {
120
- const where = `예제 파일의 generations[${i}]`;
123
+ const where = `generations[${i}] of the sample file`;
121
124
  if (!isObject(g) || !isText(g.artifact) || !isText(g.who) || !isText(g.medium) || !isText(g.after) || !texts(g.sections))
122
- return `${where} 는 { artifact, who, medium, instance?, scope?, sections, missing?, after } 여야 한다`;
125
+ return `${where} must be { artifact, who, medium, instance?, scope?, sections, missing?, after }`;
123
126
  if (!SAMPLE_WHO.test(g.who))
124
- return `${where}.who 는 "사람", "AI", "코어" 가운데 하나(같은 종류가 여럿이면 번호)여야 한다`;
127
+ return `${where}.who must be one of "Person", "AI", "Core", with a number when there are several of the same kind`;
125
128
  if ((g.instance !== undefined && !isText(g.instance)) || (g.scope !== undefined && !texts(g.scope)) || (g.missing !== undefined && !texts(g.missing)))
126
- return `${where} 의 instance, scope, missing 모양이 맞지 않는다`;
129
+ return `instance, scope, or missing of ${where} has the wrong shape`;
127
130
  const more = extraKeys(g, ['artifact', 'who', 'medium', 'instance', 'scope', 'sections', 'missing', 'after']);
128
131
  if (more.length)
129
- return `${where} 에 모르는 칸이 있다: ${more.join(', ')}. 결과물 본문과 재료 글은 넣지 않는다`;
132
+ return `${where} has unknown fields: ${more.join(', ')}. Do not include artifact bodies or source text`;
130
133
  }
131
134
  }
132
135
  if (value.transmissions !== undefined) {
133
136
  if (!Array.isArray(value.transmissions))
134
- return '예제 파일의 transmissions 는 목록이어야 한다';
137
+ return 'The transmissions of the sample file must be a list';
135
138
  for (const [i, t] of value.transmissions.entries()) {
136
139
  if (!isObject(t) || !isText(t.instance) || (t.kind !== 'send' && t.kind !== 'update') || !isText(t.status))
137
- return `예제 파일의 transmissions[${i}] 는 { instance, kind, status, label? } 여야 한다`;
140
+ return `transmissions[${i}] of the sample file must be { instance, kind, status, label? }`;
138
141
  const more = extraKeys(t, ['instance', 'kind', 'status', 'label']);
139
142
  if (more.length)
140
- return `예제 파일의 transmissions[${i}] 에 모르는 칸이 있다: ${more.join(', ')}. 실행 기록은 요약만 넣는다`;
143
+ return `transmissions[${i}] of the sample file has unknown fields: ${more.join(', ')}. Run records hold only a summary`;
141
144
  }
142
145
  }
143
146
  return null;
@@ -149,17 +152,17 @@ export function parseSample(data) {
149
152
  text = typeof data === 'string' ? data : new TextDecoder('utf-8', { fatal: true }).decode(data);
150
153
  }
151
154
  catch {
152
- return { ok: false, problem: '예제 파일이 UTF-8 글이 아니다' };
155
+ return { ok: false, problem: 'The sample file is not UTF-8 text' };
153
156
  }
154
157
  const n = charCount(text);
155
158
  if (n > SAMPLE_MAX_CHARS)
156
- return { ok: false, problem: `예제 파일이 ${SAMPLE_MAX_CHARS.toLocaleString('en-US')}자를 넘는다(${n.toLocaleString('en-US')}자)` };
159
+ return { ok: false, problem: `The sample file is over ${SAMPLE_MAX_CHARS.toLocaleString('en-US')} characters (${n.toLocaleString('en-US')} characters)` };
157
160
  let value;
158
161
  try {
159
162
  value = JSON.parse(text.replace(/^/, ''));
160
163
  }
161
164
  catch (e) {
162
- return { ok: false, problem: `예제 파일이 JSON 이 아니다(${e.message})` };
165
+ return { ok: false, problem: `The sample file is not JSON (${e.message})` };
163
166
  }
164
167
  const problem = checkSample(value);
165
168
  return problem ? { ok: false, problem } : { ok: true, sample: value };
@@ -171,12 +174,12 @@ export function parseManual(data) {
171
174
  text = typeof data === 'string' ? data : new TextDecoder('utf-8', { fatal: true }).decode(data);
172
175
  }
173
176
  catch {
174
- return { ok: false, problem: '설명서가 UTF-8 글이 아니다' };
177
+ return { ok: false, problem: 'The manual is not UTF-8 text' };
175
178
  }
176
179
  text = text.replace(/^/, '');
177
180
  const n = charCount(text);
178
181
  if (n > MANUAL_MAX_CHARS)
179
- return { ok: false, problem: `설명서가 ${MANUAL_MAX_CHARS.toLocaleString('en-US')}자를 넘는다(${n.toLocaleString('en-US')}자)` };
182
+ return { ok: false, problem: `The manual is over ${MANUAL_MAX_CHARS.toLocaleString('en-US')} characters (${n.toLocaleString('en-US')} characters)` };
180
183
  return { ok: true, text };
181
184
  }
182
185
  /** 쓴 플러그인 하나의 글. 설치되지 않았거나 낮은 버전이면 괄호로 붙인다. */
@@ -186,8 +189,8 @@ function pluginWord(p, installed) {
186
189
  return base;
187
190
  const have = installed(p.package);
188
191
  if (have === null)
189
- return `${base}(설치되지 않음)`;
190
- return have === p.version ? base : `${base}(이 컴퓨터에는 ${have})`;
192
+ return `${base} (not installed)`;
193
+ return have === p.version ? base : `${base} (${have} on this computer)`;
191
194
  }
192
195
  /** 예제가 쓴 플러그인 가운데 이 컴퓨터에 설치되지 않은 것(037 5.2절). */
193
196
  export function missingPlugins(sample, installed) {
@@ -195,11 +198,11 @@ export function missingPlugins(sample, installed) {
195
198
  }
196
199
  /** "쓰는 플러그인" 한 줄과, 설치되지 않은 것이 있으면 "이 예제는 X 도 씁니다(설치되지 않음)." 한 줄. */
197
200
  export function samplePluginLines(sample, installed, self) {
198
- const lines = [`쓰는 플러그인: ${sample.plugins.map((p) => pluginWord(p, installed)).join(', ')}`];
201
+ const lines = [`Plugins used: ${sample.plugins.map((p) => pluginWord(p, installed)).join(', ')}`];
199
202
  if (installed) {
200
203
  const missing = missingPlugins(sample, installed).filter((p) => p !== self);
201
204
  if (missing.length)
202
- lines.push(`이 예제는 ${missing.join(', ')} 도 씁니다(설치되지 않음).`);
205
+ lines.push(`This sample also uses ${missing.join(', ')} (not installed).`);
203
206
  }
204
207
  return lines;
205
208
  }
@@ -212,46 +215,52 @@ function clip(s, max) {
212
215
  return all.length <= max ? s : `${all.slice(0, max).join('')} ...`;
213
216
  }
214
217
  const indentLines = (s, pad) => s.replace(/\r?\n/g, `\n${pad}`);
218
+ /** 파일의 참여자 표기("Person", "AI", "Core" 와 번호)를 읽기 글의 이름으로. 옛 파일의 "사람", "코어" 는 영어 이름으로 옮긴다. */
219
+ function whoWord(who) {
220
+ return who.replace(/^사람/, 'Person').replace(/^코어/, 'Core');
221
+ }
222
+ /** 그 표기가 사람인가. 옛 파일의 "사람" 도 사람이다. */
223
+ const isPersonWho = (who) => /^(Person|사람)/.test(who);
215
224
  function changeWord(c) {
216
- const action = c.before === null || c.before === undefined ? '더함' : c.after === null || c.after === undefined ? '지움' : '고침';
225
+ const action = c.before === null || c.before === undefined ? 'added' : c.after === null || c.after === undefined ? 'removed' : 'changed';
217
226
  return `${c.record} ${c.type} ${action}`;
218
227
  }
219
228
  /** 사람의 말과 선택을 "사람: ..." 줄로. 말한 사람은 revision 을 만든 참여자가 아니라 사람이다. */
220
229
  function causeLines(c, who) {
221
230
  if (!c)
222
231
  return [];
223
- const person = who.startsWith('사람') ? who : '사람';
232
+ const person = isPersonWho(who) ? whoWord(who) : 'Person';
224
233
  const out = [];
225
234
  for (const w of c.humanWords ?? [])
226
- out.push(`${person}${w.source === 'relayed_by_ai' ? '(AI 가 옮겨 적음)' : ''}: "${w.text}"`);
235
+ out.push(`${person}${w.source === 'relayed_by_ai' ? ' (relayed by the AI)' : ''}: "${w.text}"`);
227
236
  const s = c.selection;
228
237
  if (s) {
229
238
  const said = s.said ? `: "${s.said}"` : '';
230
239
  if (s.kind === 'artifact')
231
- out.push(`${person}: 결과물${s.artifact ? ` ${s.artifact}` : ''} 에서 "${clip(s.text ?? '', 200)}" 를 고름${said}`);
240
+ out.push(`${person}: picked "${clip(s.text ?? '', 200)}" in artifact${s.artifact ? ` ${s.artifact}` : ''}${said}`);
232
241
  else
233
- out.push(`${person}: 화면${s.instance ? ` ${s.instance}` : ''} 에서 ${s.records?.length ? s.records.join(', ') : '한 곳'} 을 ${s.role === 'reference' ? '참고로 ' : ''}가리킴${said}`);
242
+ out.push(`${person}: pointed at ${s.records?.length ? s.records.join(', ') : 'one place'} on screen${s.instance ? ` ${s.instance}` : ''}${s.role === 'reference' ? ' as a reference' : ''}${said}`);
234
243
  }
235
244
  if (c.choice)
236
- out.push(`${person}(답): "${c.choice.text}"`);
245
+ out.push(`${person} (answer): "${c.choice.text}"`);
237
246
  return out;
238
247
  }
239
248
  /** 생성 한 줄. 본문은 예제에 없으므로 범위와 구간 이름만 적는다. */
240
249
  function generationLine(g, withBasis) {
241
- const scope = g.scope?.length ? `범위 ${g.scope.join(', ')}` : '범위 전체';
242
- const sections = g.sections.length ? `구간 ${clip(g.sections.join(', '), 300)}` : '구간 없음';
243
- const missing = g.missing?.length ? `, 본문 없는 구간 ${g.missing.join(', ')}` : '';
244
- return `${g.who}: ${withBasis ? `${g.after} 까지의 상태로 ` : '이 상태로 '}결과물 ${g.artifact}(${g.medium}) 을 만듦(${g.instance ? `화면 ${g.instance}, ` : ''}${scope}, ${sections}${missing})`;
250
+ const scope = g.scope?.length ? `scope ${g.scope.join(', ')}` : 'whole scope';
251
+ const sections = g.sections.length ? `sections ${clip(g.sections.join(', '), 300)}` : 'no sections';
252
+ const missing = g.missing?.length ? `, sections without a body ${g.missing.join(', ')}` : '';
253
+ return `${whoWord(g.who)}: made artifact ${g.artifact} (${g.medium}) ${withBasis ? `from the state up to ${g.after}` : 'from this state'} (${g.instance ? `screen ${g.instance}, ` : ''}${scope}, ${sections}${missing})`;
245
254
  }
246
255
  /**
247
256
  * 예제를 읽기 좋은 글로 옮긴다(037 5.3절). revision 마다 "사람: (말)", "AI: (한 일의 요약)", "화면 변화" 를 차례로 적는다. 조작
248
257
  * 원문과 변경의 내용은 넣지 않는다. 그것은 파일 자체(form: json)에 있다. installed 를 주면 설치되지 않은 플러그인을 알린다.
249
258
  */
250
259
  export function sampleNarrative(sample, opts = {}) {
251
- const lines = [`예제 작업: ${sample.title}`, ...samplePluginLines(sample, opts.installed, opts.self)];
260
+ const lines = [`Sample work: ${sample.title}`, ...samplePluginLines(sample, opts.installed, opts.self)];
252
261
  if (sample.instances.length) {
253
- const screens = sample.instances.map((i) => `${i.id} ${i.title ?? i.package}(${i.connection !== undefined ? `외부 연결 ${i.connection}` : i.package})`);
254
- lines.push(`화면: ${screens.join(', ')}`);
262
+ const screens = sample.instances.map((i) => `${i.id} ${i.title ?? i.package}(${i.connection !== undefined ? `external connection ${i.connection}` : i.package})`);
263
+ lines.push(`Screens: ${screens.join(', ')}`);
255
264
  }
256
265
  lines.push('');
257
266
  // 생성은 revision 이 아니므로 그 상태(after)의 revision 아래에 적는다. 그 revision 이 예제에 없으면 끝에 모은다.
@@ -262,10 +271,10 @@ export function sampleNarrative(sample, opts = {}) {
262
271
  sample.revisions.forEach((r, i) => {
263
272
  const head = `${i + 1}. (${r.revision}) `;
264
273
  const pad = ' '.repeat(head.length);
265
- const body = [...causeLines(r.cause, r.who), `${r.who}: ${indentLines(clip(r.summary, SUMMARY_SHOWN), pad)}`];
274
+ const body = [...causeLines(r.cause, r.who), `${whoWord(r.who)}: ${indentLines(clip(r.summary, SUMMARY_SHOWN), pad)}`];
266
275
  if (r.changes.length) {
267
276
  const shown = r.changes.slice(0, CHANGES_SHOWN).map(changeWord);
268
- body.push(`화면 변화: ${shown.join(', ')}${r.changes.length > shown.length ? ` 외 ${r.changes.length - shown.length}개` : ''}`);
277
+ body.push(`Screen changes: ${shown.join(', ')}${r.changes.length > shown.length ? ` and ${r.changes.length - shown.length} more` : ''}`);
269
278
  }
270
279
  for (const g of made.get(r.revision) ?? [])
271
280
  body.push(generationLine(g, false));
@@ -273,14 +282,14 @@ export function sampleNarrative(sample, opts = {}) {
273
282
  });
274
283
  const loose = made.get('') ?? [];
275
284
  if (loose.length) {
276
- lines.push('', '만든 결과물');
285
+ lines.push('', 'Artifacts made');
277
286
  for (const g of loose)
278
287
  lines.push(`- ${generationLine(g, true)}`);
279
288
  }
280
289
  if (sample.transmissions?.length) {
281
- lines.push('', '외부 연결의 실행(요약)');
290
+ lines.push('', 'External connection runs (summary)');
282
291
  for (const t of sample.transmissions)
283
- lines.push(`- ${t.instance} ${t.kind === 'send' ? '보내기' : '갱신'} ${t.status}${t.label ? `(${t.label})` : ''}`);
292
+ lines.push(`- ${t.instance} ${t.kind === 'send' ? 'send' : 'update'} ${t.status}${t.label ? `(${t.label})` : ''}`);
284
293
  }
285
294
  return lines.join('\n');
286
295
  }
package/dist/state.js CHANGED
@@ -12,22 +12,22 @@ export function isStateId(s) {
12
12
  /** 상태 목록의 모양 검사. 문제의 설명이고 없으면 null 이다. 같은 id 가 둘이면 받지 않는다. 한 id 는 한 버전만 설치되기 때문이다. */
13
13
  export function checkState(plugins) {
14
14
  if (!Array.isArray(plugins))
15
- return 'plugins 는 { id, version, sha256 } 의 목록이어야 한다';
15
+ return 'plugins must be a list of { id, version, sha256 }';
16
16
  if (plugins.length > STATE_MAX_PLUGINS)
17
- return `plugins 는 ${STATE_MAX_PLUGINS}개까지다(${plugins.length}개)`;
17
+ return `plugins can have up to ${STATE_MAX_PLUGINS} entries (${plugins.length} given)`;
18
18
  const seen = new Set();
19
19
  for (const [i, e] of plugins.entries()) {
20
20
  if (typeof e !== 'object' || e === null || Array.isArray(e))
21
- return `plugins[${i}] 는 객체여야 한다`;
21
+ return `plugins[${i}] must be an object`;
22
22
  const { id, version, sha256 } = e;
23
23
  if (!isPluginId(id))
24
- return `plugins[${i}].id 가 플러그인 id 모양이 아니다`;
24
+ return `plugins[${i}].id is not shaped like a plugin id`;
25
25
  if (!isVersion(version))
26
- return `plugins[${i}].version 이 semver 가 아니다`;
26
+ return `plugins[${i}].version is not semver`;
27
27
  if (typeof sha256 !== 'string' || !SHA256.test(sha256))
28
- return `plugins[${i}].sha256 은 16진 소문자 64자여야 한다`;
28
+ return `plugins[${i}].sha256 must be 64 lowercase hexadecimal characters`;
29
29
  if (seen.has(id))
30
- return `plugins 에 같은 id ${id} 가 둘이다`;
30
+ return `plugins has the id ${id} twice`;
31
31
  seen.add(id);
32
32
  }
33
33
  return null;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aicommunicator-plugin-check",
3
- "version": "0.2.0",
4
- "description": "AIC(aicommunicator) 플러그인의 manifest 와 묶음 파일(.tgz)의 규칙을 확인하는 코드. AIC 코어, aic 명령, 플러그인 등록 사이트가 함께 쓴다",
3
+ "version": "0.2.1",
4
+ "description": "Checks the rules for the manifest and package file (.tgz) of AIC (aicommunicator) plugins. Shared by the AIC core, the aic command, and the plugin registry site",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "engines": { "node": ">=22.13" },