egatari 0.6.17 → 0.6.19
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/CHANGELOG.md +68 -1
- package/README.ja.md +14 -13
- package/README.md +2 -1
- package/components.lock.json +153 -54
- package/components2.lock.json +1001 -1
- package/kit/build.mjs +1 -1
- package/kit/check-messages.mjs +9 -0
- package/kit/check.mjs +8 -0
- package/kit/core/bookmark.mjs +28 -0
- package/kit/core/build-core.mjs +5 -3
- package/kit/core/check-parity.mjs +6 -0
- package/kit/core/check-rules.mjs +4 -3
- package/kit/core/check-source.mjs +10 -1
- package/kit/core/checks.mjs +79 -0
- package/kit/core/find-replace.mjs +170 -0
- package/kit/core/format.mjs +4 -1
- package/kit/core/image-insert.mjs +197 -0
- package/kit/core/image-size.mjs +1 -1
- package/kit/core/layout-scan.mjs +1 -1
- package/kit/core/llm-fix.mjs +1 -1
- package/kit/core/llm-pack-assemble.mjs +40 -67
- package/kit/core/llm-pack-data.mjs +882 -52
- package/kit/core/llm-pack.mjs +6 -4
- package/kit/core/llm-request.mjs +2 -2
- package/kit/core/new-deck-pack.mjs +38 -44
- package/kit/core/new-deck.mjs +82 -74
- package/kit/core/part-labels.mjs +3 -0
- package/kit/core/portable.mjs +5 -2
- package/kit/core/purposes.mjs +9 -3
- package/kit/core/sample-info.mjs +17 -3
- package/kit/core/scorm.mjs +30 -6
- package/kit/core/script-unclosed.mjs +49 -0
- package/kit/core/slide-ops.mjs +27 -1
- package/kit/core/tate-mix.mjs +25 -0
- package/kit/core/template-text.mjs +2 -0
- package/kit/core/theme-derive.mjs +56 -17
- package/kit/core/theme-shapes.mjs +15 -1
- package/kit/deck.js +124 -6
- package/kit/instruction-version.json +1 -1
- package/kit/layouts.css +8 -0
- package/kit/llm-pack.mjs +5 -7
- package/kit/panes.js +17 -1
- package/kit/player.json +1 -1
- package/kit/player.lock.json +2 -2
- package/kit/presenter.js +36 -4
- package/kit/tools.js +54 -2
- package/kit/track.js +46 -5
- package/package.json +1 -1
- package/server/editor-ui.js +21 -1
- package/vendor/components/CATALOG.md +25 -22
- package/vendor/components/sha256/038f9d32c89c8212ab25d6e3180023b6fe024a53053ab2ef1443ecab92e3ce43/index.js +205 -0
- package/vendor/components/sha256/07479cb6e5194a01b2a8a9029f3646060f0dbb673f2737d2132738af2eb379e5/README.en.md +44 -0
- package/vendor/components/sha256/07479cb6e5194a01b2a8a9029f3646060f0dbb673f2737d2132738af2eb379e5/index.js +306 -0
- package/vendor/components/sha256/077678d8b14a8065c4f74a9fe1669728c68a0f763bfdca18b304f5c3d863632a/README.en.md +54 -0
- package/vendor/components/sha256/077678d8b14a8065c4f74a9fe1669728c68a0f763bfdca18b304f5c3d863632a/index.js +470 -0
- package/vendor/components/sha256/0840322bf51eeb3c8188ce21ad70af17c13974ac0151065a39c430a3813ee07f/README.en.md +23 -0
- package/vendor/components/sha256/0840322bf51eeb3c8188ce21ad70af17c13974ac0151065a39c430a3813ee07f/index.js +289 -0
- package/vendor/components/sha256/0c25d49d23529879054737aa181951519fe585c4728fd505e0e3c8869953eac7/index.js +934 -0
- package/vendor/components/sha256/0dd302b82925f35743a893d5c271898ada3659aa0de2d3249ef45936aad10ae0/LICENSE-strokesvg.txt +115 -0
- package/vendor/components/sha256/0dd302b82925f35743a893d5c271898ada3659aa0de2d3249ef45936aad10ae0/OFL.txt +93 -0
- package/vendor/components/sha256/0dd302b82925f35743a893d5c271898ada3659aa0de2d3249ef45936aad10ae0/index.js +755 -0
- package/vendor/components/sha256/0dd302b82925f35743a893d5c271898ada3659aa0de2d3249ef45936aad10ae0/strokes-CHANGES.md +20 -0
- package/vendor/components/sha256/0e9e92df8d70eb6d9fcf10916c361769c7cd37baacece8d7eb96bbbc7fbcf942/README.en.md +25 -0
- package/vendor/components/sha256/0e9e92df8d70eb6d9fcf10916c361769c7cd37baacece8d7eb96bbbc7fbcf942/index.js +317 -0
- package/vendor/components/sha256/12ef6a11055407f5cddc40154a49cf2737b0786429fe0fcc94ee1d8245597b40/index.js +244 -0
- package/vendor/components/sha256/13c9ce43396b2f5693ce430a924dae4ddcd1e8a4ad0c9b9e724ff52acb874d0c/index.js +354 -0
- package/vendor/components/sha256/15306d854d67d52ca2b1d66135f0d3296882e6b21fd85c029399b8077c8a7f9d/README.en.md +34 -0
- package/vendor/components/sha256/15306d854d67d52ca2b1d66135f0d3296882e6b21fd85c029399b8077c8a7f9d/index.js +398 -0
- package/vendor/components/sha256/1a0f21def0efbbdef64461cafa40f3883bc7f7122adf79d01f09ca4a245e5dcb/index.js +465 -0
- package/vendor/components/sha256/208175d05b37d326855fad792b10137f785e5d05d91a2cde119d0dbd69d2ed98/index.js +100 -0
- package/vendor/components/sha256/218d88998b70f0732c18d91ccc238b2d63f6b0aaa483883b83685a25468f214a/README.en.md +34 -0
- package/vendor/components/sha256/218d88998b70f0732c18d91ccc238b2d63f6b0aaa483883b83685a25468f214a/index.js +246 -0
- package/vendor/components/sha256/2579bcb46b6525902763cd15a2e08fc5ebd9a2695cdaba63438e5b47907a47e0/README.en.md +24 -0
- package/vendor/components/sha256/2579bcb46b6525902763cd15a2e08fc5ebd9a2695cdaba63438e5b47907a47e0/index.js +554 -0
- package/vendor/components/sha256/277ac772315f93737a094cd0f0842726f2435d352d9a90822aebfe0d5d7e79a1/README.en.md +23 -0
- package/vendor/components/sha256/277ac772315f93737a094cd0f0842726f2435d352d9a90822aebfe0d5d7e79a1/index.js +294 -0
- package/vendor/components/sha256/2787e410e533e4ad48b0a3c2b652579cf5797f9c51fcf32f5478212a7acef95f/README.en.md +28 -0
- package/vendor/components/sha256/2787e410e533e4ad48b0a3c2b652579cf5797f9c51fcf32f5478212a7acef95f/index.js +214 -0
- package/vendor/components/sha256/2a011338d0fc3c77e102eaa57cde2b6e3726bc279f133174b0b8c9a654263cbc/index.js +824 -0
- package/vendor/components/sha256/2fce5ab0c31dca0aa1586a2c69237870a9cce46c0bc6ab7392c27968d016bd15/index.js +75 -0
- package/vendor/components/sha256/3417efe4722f569690563d9abcea8b144db2f8fa97b83cf0118fb3a34cd4cb2b/README.en.md +23 -0
- package/vendor/components/sha256/3417efe4722f569690563d9abcea8b144db2f8fa97b83cf0118fb3a34cd4cb2b/index.js +150 -0
- package/vendor/components/sha256/3a7962fa87c670447eed54aca08604ef03cd26bf2c334b4667190060e6a17965/README.en.md +18 -0
- package/vendor/components/sha256/3a7962fa87c670447eed54aca08604ef03cd26bf2c334b4667190060e6a17965/index.js +279 -0
- package/vendor/components/sha256/3be5f64deb1951327b614b29a9b632878fab362687c76e3f48f3af1d1ebbb1cf/README.en.md +47 -0
- package/vendor/components/sha256/3be5f64deb1951327b614b29a9b632878fab362687c76e3f48f3af1d1ebbb1cf/index.js +223 -0
- package/vendor/components/sha256/42450c6b36404d66641568f6d6f55e42a4a036d4d9cdf308f709464913b32fe9/README.en.md +42 -0
- package/vendor/components/sha256/42450c6b36404d66641568f6d6f55e42a4a036d4d9cdf308f709464913b32fe9/index.js +272 -0
- package/vendor/components/sha256/45cea6c1abfb3467e3e3dbe7fec58647716999a0c39cf7163531ae389f898d29/README.en.md +30 -0
- package/vendor/components/sha256/45cea6c1abfb3467e3e3dbe7fec58647716999a0c39cf7163531ae389f898d29/index.js +305 -0
- package/vendor/components/sha256/4c8cae404d551a1bb021e8345af5aa45d4f412f13497aa84b142f11a29a365dc/index.js +124 -0
- package/vendor/components/sha256/5521b5b40a43c48c5ae5a50ce87afb3d47bb23b133b16841086d8322364cdd5e/README.en.md +23 -0
- package/vendor/components/sha256/5521b5b40a43c48c5ae5a50ce87afb3d47bb23b133b16841086d8322364cdd5e/index.js +120 -0
- package/vendor/components/sha256/5fe30fd7a84b937a1325d8af2b8e437211efae82ab46d5a433bc4ef07bcaef11/README.en.md +18 -0
- package/vendor/components/sha256/5fe30fd7a84b937a1325d8af2b8e437211efae82ab46d5a433bc4ef07bcaef11/index.js +243 -0
- package/vendor/components/sha256/631f4c4b90c9a41c0f26c9600d5cf2d6447251d04a20f08f48a85aeb4cb0f6fb/index.js +107 -0
- package/vendor/components/sha256/6749f44ed6476a05d4e3026373c188a0e1a19b77a5836579813f62a1477ac35e/README.en.md +31 -0
- package/vendor/components/sha256/6749f44ed6476a05d4e3026373c188a0e1a19b77a5836579813f62a1477ac35e/index.js +271 -0
- package/vendor/components/sha256/701f1deef79fe05eeb18e1119e5a5c4d60a9dfe265e93a4dff79223bc598dbf0/index.js +521 -0
- package/vendor/components/sha256/711cf58fa946c9c0abc953b2f695d02bf5a5a7f73851b09f834e894baf88be38/index.js +122 -0
- package/vendor/components/sha256/728576c57a5ccb39531ad4cb8074fce95480f01603a77dbf57dca0e52199f7c4/index.js +37 -0
- package/vendor/components/sha256/73edc74a2dc4a63b717106c1c1572967b6d306270574e9635d032de16c8ada72/README.en.md +18 -0
- package/vendor/components/sha256/73edc74a2dc4a63b717106c1c1572967b6d306270574e9635d032de16c8ada72/index.js +382 -0
- package/vendor/components/sha256/76bdb63c3e5e14fbb4816bc9f235490817bb5d7be990a826f5077aa08226702c/index.js +162 -0
- package/vendor/components/sha256/7a5adf73fc053b9f2ca56643b5683b42589edb0f63c845ecb7ae7e6b87eccc30/README.en.md +51 -0
- package/vendor/components/sha256/7a5adf73fc053b9f2ca56643b5683b42589edb0f63c845ecb7ae7e6b87eccc30/index.js +230 -0
- package/vendor/components/sha256/7ab483e7fb05f646b062340d70f2749d070b4f64fed7acc0b8a7754d9ef9fded/README.en.md +26 -0
- package/vendor/components/sha256/7ab483e7fb05f646b062340d70f2749d070b4f64fed7acc0b8a7754d9ef9fded/index.js +322 -0
- package/vendor/components/sha256/7af6e5e6dffb618b39f27d883c691ca128f3af06040ee505e75c79c678bfdcfe/README.en.md +18 -0
- package/vendor/components/sha256/7af6e5e6dffb618b39f27d883c691ca128f3af06040ee505e75c79c678bfdcfe/index.js +103 -0
- package/vendor/components/sha256/7c7b0373cfd38fd5ecb4169021e0b908f0a17be1a29b14f85dd89fdb92e7bf81/README.en.md +44 -0
- package/vendor/components/sha256/7c7b0373cfd38fd5ecb4169021e0b908f0a17be1a29b14f85dd89fdb92e7bf81/index.js +306 -0
- package/vendor/components/sha256/7dea2c3728b85122b04515aa06ab198657529e7cd101b9ab34d4ecb2905ce94e/fixtures/ABCJS-ADAPTER.md +101 -0
- package/vendor/components/sha256/7dea2c3728b85122b04515aa06ab198657529e7cd101b9ab34d4ecb2905ce94e/fixtures/LICENSE-abcjs.txt +21 -0
- package/vendor/components/sha256/7dea2c3728b85122b04515aa06ab198657529e7cd101b9ab34d4ecb2905ce94e/fixtures/chords.json +89 -0
- package/vendor/components/sha256/7dea2c3728b85122b04515aa06ab198657529e7cd101b9ab34d4ecb2905ce94e/fixtures/doremi.json +261 -0
- package/vendor/components/sha256/7dea2c3728b85122b04515aa06ab198657529e7cd101b9ab34d4ecb2905ce94e/fixtures/extras.json +192 -0
- package/vendor/components/sha256/7dea2c3728b85122b04515aa06ab198657529e7cd101b9ab34d4ecb2905ce94e/fixtures/kaeru.json +521 -0
- package/vendor/components/sha256/7dea2c3728b85122b04515aa06ab198657529e7cd101b9ab34d4ecb2905ce94e/fixtures/rhythm.json +248 -0
- package/vendor/components/sha256/7dea2c3728b85122b04515aa06ab198657529e7cd101b9ab34d4ecb2905ce94e/fixtures/ties.json +360 -0
- package/vendor/components/sha256/7dea2c3728b85122b04515aa06ab198657529e7cd101b9ab34d4ecb2905ce94e/index.js +508 -0
- package/vendor/components/sha256/832556ea9c82c292a3ba9e1b332f2405c5c2f969ff8157c91ed80226ec8ac62e/README.en.md +22 -0
- package/vendor/components/sha256/832556ea9c82c292a3ba9e1b332f2405c5c2f969ff8157c91ed80226ec8ac62e/index.js +145 -0
- package/vendor/components/sha256/8a4b6dce84d7a69aaafeb75c1c572fe7904fd49e3169c1c85851ccaeae2a7b11/index.js +41 -0
- package/vendor/components/sha256/8bb511cb90902bc7721e59ca08685b26adbf33539e36a4a45172485d6d3d455b/index.js +250 -0
- package/vendor/components/sha256/8db9c936c36b79b9e3b2be37639487b15502a6937f411ed714621a8091437e9b/README.en.md +21 -0
- package/vendor/components/sha256/8db9c936c36b79b9e3b2be37639487b15502a6937f411ed714621a8091437e9b/index.js +108 -0
- package/vendor/components/sha256/8e5e90c90cb6b06a790b0420e43d79d7da663f1cc19ff06d381ec849b4a8fc57/index.js +312 -0
- package/vendor/components/sha256/939bdae590ebed3d182b0c9940a35b6c03872505bfa242341990a81cae02fd06/README.en.md +34 -0
- package/vendor/components/sha256/939bdae590ebed3d182b0c9940a35b6c03872505bfa242341990a81cae02fd06/index.js +397 -0
- package/vendor/components/sha256/9c5dd0bc0c3279c5f0fea3fdb9d0735870880aef96e8bbf9ecdd77dff0f5ddc8/README.en.md +44 -0
- package/vendor/components/sha256/9c5dd0bc0c3279c5f0fea3fdb9d0735870880aef96e8bbf9ecdd77dff0f5ddc8/index.js +551 -0
- package/vendor/components/sha256/a1c2b2fa06e4229815ab82a9202c266ec887a67632a175854c7d136a92389ca3/index.js +69 -0
- package/vendor/components/sha256/a5b032657720d3beb64f0b3699954e13b0eb985f36161b9ae046c83fd6048ff5/README.en.md +18 -0
- package/vendor/components/sha256/a5b032657720d3beb64f0b3699954e13b0eb985f36161b9ae046c83fd6048ff5/index.js +382 -0
- package/vendor/components/sha256/a7c4282db79d46557bdbaf84ca519606dc46f3c23455db4a26f663453f85813c/README.en.md +38 -0
- package/vendor/components/sha256/a7c4282db79d46557bdbaf84ca519606dc46f3c23455db4a26f663453f85813c/index.js +414 -0
- package/vendor/components/sha256/aac2f8a23cb1b606e9635061cb288f006588c80a7258540cae846ae677f55ff5/index.js +238 -0
- package/vendor/components/sha256/ace7e82e866b577ad42bbc4b64e11bae18982e3236aadceb6c2e6c20f41234cf/README.en.md +45 -0
- package/vendor/components/sha256/ace7e82e866b577ad42bbc4b64e11bae18982e3236aadceb6c2e6c20f41234cf/index.js +211 -0
- package/vendor/components/sha256/aeb0b9b5991a5c1df7191c397780a699f2c7310123ca210a58486c0a23e44006/index.js +342 -0
- package/vendor/components/sha256/af3355efd6739a56c6cb53990100f41703361c475c123b9b2762421c68509036/index.js +315 -0
- package/vendor/components/sha256/b10183a66b58b827a1410cf8b0117af567647684464d5777529dc66f0cea343a/LICENSE-tabler.txt +21 -0
- package/vendor/components/sha256/b10183a66b58b827a1410cf8b0117af567647684464d5777529dc66f0cea343a/index.js +4868 -0
- package/vendor/components/sha256/b10183a66b58b827a1410cf8b0117af567647684464d5777529dc66f0cea343a/names.txt +4808 -0
- package/vendor/components/sha256/b348ea64cc19632df96a91dfd7c435e4a62095aede72b504d03537be70d6d930/index.js +606 -0
- package/vendor/components/sha256/b53bfa03d1e9feb3cb492f440bf9d100c96eb4fe6b76c42b512a56e9158829cd/index.js +351 -0
- package/vendor/components/sha256/b9443e1cdac4850b1ead9f8449a3061678bbb77fbc53eb9b23d01e1cf50750c3/index.js +619 -0
- package/vendor/components/sha256/bc1e2a02c959ac203819d03c0d25b3776a6a9a4290aae860b26cbbe3d29e876d/index.js +268 -0
- package/vendor/components/sha256/beeb180c0e2250bb04490b092c0a235cae47fca2ed1de2d9ef078a5c14b1a963/index.js +429 -0
- package/vendor/components/sha256/c5fd7713e55e96d75824a21146c0251896d7d9dd028b4d169191433135a97981/index.js +200 -0
- package/vendor/components/sha256/c61987e9994940fc668ed8a010e575ee52027b54ed9c5dd1cc9fdf67649092b3/index.js +404 -0
- package/vendor/components/sha256/ccc8bfe174b6903ec254dfef4f5d1c614271ea39963649add7fcb8d83c081eba/index.js +278 -0
- package/vendor/components/sha256/da267bc65fde0a9279127d5a82f6c253ad74984da6fb11391f00604ad9ffe80d/index.js +93 -0
- package/vendor/components/sha256/dea36cd7010991a572ef394ee32b5e17564aeff09d3ec4ed3820d7e43c9a58be/index.js +484 -0
- package/vendor/components/sha256/df3fdb2aed487d4f6e60a8abab1fe0d1e9fa2a4193fd162edf3c384ea8db5a1b/index.js +180 -0
- package/vendor/components/sha256/e27d517f39eb554c7a9ecea7b59fcf1d347c4deeb3fe2250797aa233bfb7e2b0/index.js +747 -0
- package/vendor/components/sha256/e31f6b058503f7980597c89b3e964c512ee08de7cba3fa99904d499abbb5d0e8/README.en.md +20 -0
- package/vendor/components/sha256/e31f6b058503f7980597c89b3e964c512ee08de7cba3fa99904d499abbb5d0e8/index.js +310 -0
- package/vendor/components/sha256/f4100076a37dbde6046d85969d651feffc925bd984ffe9f333ea9bd2b6816918/README.en.md +30 -0
- package/vendor/components/sha256/f4100076a37dbde6046d85969d651feffc925bd984ffe9f333ea9bd2b6816918/index.js +192 -0
- package/vendor/components/sha256/fa6442fa3c5082cf161c29308fe0ecbd85fa33e8e4bad08c12e7961b46b1365b/README.en.md +24 -0
- package/vendor/components/sha256/fa6442fa3c5082cf161c29308fe0ecbd85fa33e8e4bad08c12e7961b46b1365b/index.js +214 -0
- package/vendor/components-2/manifest-2.16.0.json +2919 -0
- package/vendor/components-2/manifest-2.17.0.json +2852 -0
- package/vendor/components-2/manifest-2.18.0.json +3182 -0
- package/vendor/components-2/manifest-2.20.0.json +3217 -0
- package/vendor/components-2/manifest-2.21.0.json +3220 -0
- package/vendor/egatari-spec/SOURCE.json +2 -2
- package/vendor/egatari-spec/schema/deck-meta.schema.json +3 -0
- package/vendor/egatari-spec/schema/egatari-metadata.schema.json +6 -0
package/kit/core/llm-pack.mjs
CHANGED
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
// TIERS パーツの段と束(パーツライブラリ 2.0 の manifest から。{catalogue, parts: {タグ: {tier, set?, purposes}}, purposes}。
|
|
28
28
|
// 新規作成 ④ のパーツの一覧:kit/core/new-deck.mjs)
|
|
29
29
|
// loadedParts(sets, plan) その束で組み立てに入る部品(標準と、選んだ束の部品。有料のプランでは paidOnly の部品も)
|
|
30
|
-
// trimCandidates・fitPlan・fitPack
|
|
31
|
-
//
|
|
30
|
+
// trimCandidates・fitPlan・fitPack 無料のプランの束の指示を目安に収める(中核の 4 つを短く → 専門のパーツを外す候補に)。コマンド(kit/llm-pack.mjs)が使う
|
|
31
|
+
// rankedOpts(described, named, plan)・rankedPack(order, plan, {textOf, capBytes}) 順位で組む指示(新規作成 ④):上から説明を載せ、上限を越える手前で止め、残りは表に名前だけ
|
|
32
32
|
// partsPackOpts(tags, plan, {short, full}) 選んだパーツだけの指示の組み立ての引数 {sets, exclude, plan, short?, full?}(buildPack・packWithRequest に渡す。
|
|
33
33
|
// 選んだ専門のパーツの束を入れ、選ばないパーツは除く。プランは詳しさだけを変える。short:無料のプランで中核の 4 つも短く)
|
|
34
34
|
import { PACK } from './llm-pack-data.mjs';
|
|
35
|
-
import { assemble, normalizeSets as norm, commonOf, partOf, requestOf, membersOf, langOf, partSpans, PACK_CAP_KB, PAID_PACK_KB, FREE_PASTE_UNITS, pasteUnits, fitSize, PLANS, FREE_CORE, STANDARD, briefParts, planName, trimCandidates as trimCandidatesOf, SINGLE_SET_DROP_ORDER, fitPlan as fitPlanOf, fitPack as fitPackOf,
|
|
35
|
+
import { assemble, normalizeSets as norm, commonOf, partOf, requestOf, membersOf, langOf, partSpans, PACK_CAP_KB, PAID_PACK_KB, FREE_PASTE_UNITS, pasteUnits, fitSize, PLANS, FREE_CORE, STANDARD, briefParts, planName, trimCandidates as trimCandidatesOf, SINGLE_SET_DROP_ORDER, fitPlan as fitPlanOf, fitPack as fitPackOf, packOptsOf, rankedOpts as rankedOptsOf, rankedPack as rankedPackOf } from './llm-pack-assemble.mjs';
|
|
36
36
|
|
|
37
37
|
export { assemble, PACK_CAP_KB, PAID_PACK_KB, FREE_PASTE_UNITS, pasteUnits, fitSize, PLANS, FREE_CORE, STANDARD, SINGLE_SET_DROP_ORDER };
|
|
38
38
|
export const BRIEF = briefParts(PACK, 'free'); // 無料のプランで一覧の 1 行だけの標準の部品
|
|
@@ -45,11 +45,13 @@ export function loadedParts(sets = [], plan = 'free') {
|
|
|
45
45
|
return Object.keys(PACK.en.components).sort().filter((t) => { const c = PACK.en.components[t]; return (c.set === STANDARD && (!c.paidOnly || plan === 'paid')) || ss.includes(c.set); });
|
|
46
46
|
}
|
|
47
47
|
export const partsPackOpts = (tags, plan = 'free', opts = {}) => packOptsOf(PACK, tags, plan, opts);
|
|
48
|
+
// 順位で組む指示(新規作成 ④。本体は kit/core/llm-pack-assemble.mjs の rankedOpts・rankedPack。材料はこの指示の PACK)
|
|
49
|
+
export const rankedOpts = (described, named, plan = 'free') => rankedOptsOf(PACK, described, named, plan);
|
|
50
|
+
export const rankedPack = (order, plan, opts) => rankedPackOf(PACK, order, plan, opts);
|
|
48
51
|
// 目安に収める(本体は kit/core/llm-pack-assemble.mjs。材料はこの指示の PACK)
|
|
49
52
|
export const trimCandidates = trimCandidatesOf;
|
|
50
53
|
export const fitPlan = (ticked, plan, opts) => fitPlanOf(PACK, ticked, plan, opts);
|
|
51
54
|
export const fitPack = (ticked, plan, opts) => fitPackOf(PACK, ticked, plan, opts);
|
|
52
|
-
export const fitSample = (ticked, plan, opts) => fitSampleOf(PACK, ticked, plan, opts);
|
|
53
55
|
|
|
54
56
|
export const PACK_VERSION = PACK.version; // 指示のバージョン(指示のはじめの「Pack version」の行と同じ。tools/make-llm-guide.mjs が材料から決める)
|
|
55
57
|
|
package/kit/core/llm-request.mjs
CHANGED
|
@@ -48,8 +48,8 @@ export function filledRequest({ kind = 'A', values = {} } = {}, lang = 'en') {
|
|
|
48
48
|
return [`# ${F.title}`, `**${s.head}**`, s.text, rows.join('\n')].filter(Boolean).join('\n\n') + '\n';
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export function packWithRequest({ sets = [], lang = 'en', request = null, exclude = [], off = [], plan = 'free', short = false, full = null } = {}) {
|
|
51
|
+
export function packWithRequest({ sets = [], lang = 'en', request = null, exclude = [], off = [], plan = 'free', short = false, full = null, named = null } = {}) {
|
|
52
52
|
const tail = request ? String(request).trim() : requestOf(PACK, lang);
|
|
53
|
-
const parts = [...packParts(PACK, { sets, lang, exclude, off, plan, short, full }), tail].filter(Boolean);
|
|
53
|
+
const parts = [...packParts(PACK, { sets, lang, exclude, off, plan, short, full, named }), tail].filter(Boolean);
|
|
54
54
|
return parts.join('\n\n') + '\n';
|
|
55
55
|
}
|
|
@@ -4,23 +4,22 @@
|
|
|
4
4
|
// REQUEST_WORDS[lang] 頼みたいことの欄に入れる言葉(長さ・言語・話す人・テーマの行・内容の見出し)。画面の言葉(app/llm.js の X)もこれを使う
|
|
5
5
|
// newDeckRequest({kind, values, theme, category, subcategory, sample, useStructure, content, outlineN, lang})
|
|
6
6
|
// → 頼みたいことの節(記入欄 → テーマの行 → 場面・構成の型・見せ方 → サンプルに本があれば 1 行 → サンプルの構成 → 内容 → 2 回に分けて頼む節)
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
// fromSamplePack({sample, title, lang, plan, second, useStructure}) → {text, bytes, short, shortened, dropped, ownShortened, over, tags, full, candidates, request}。
|
|
17
|
-
// 「このサンプルを参考に作る」で ② だけを書いて(second:{title, content})④ で写すもの(無料のプランも有料のプランも[候補を外す]の後)
|
|
7
|
+
// packText({described, named, plan, lang, request}) → 写す指示の全文(順位で組む指示。kit/core/llm-pack-assemble.mjs の rankedOpts)
|
|
8
|
+
// newDeckPack({order, plan, lang, request}) → {text, bytes, described, named, over}(handoff #43 ④:順位 order の上から説明を載せ、上限を越える手前で止め、
|
|
9
|
+
// 残りは言いたいことの表に名前だけ。軽量(free)も詳細(paid)も同じ。上限は capKb、大きさは fitSize)
|
|
10
|
+
// sampleProblems(obj) → sample.json の誤り(validateSample に、分類・パーツ・ラベルを照らしたもの。テーマは誤りにしない)
|
|
11
|
+
// sampleTheme(theme)・fromSampleStart(sample) → 引き継ぐテーマ(同梱の選べるテーマだけ。ほかは default)・① ③ ④ の答え
|
|
12
|
+
// sampleChoice(sample, {title, content, lang}) → {purposes, subjects, school, audience, order}:サンプルから始めたときの ④(サンプルの伝えたいこと・題材・読み手、
|
|
13
|
+
// ② の言葉から推した題材を足す。順位はサンプルのパーツが先)
|
|
14
|
+
// fromSamplePack({sample, lang, plan, second, useStructure}) → {text, bytes, described, named, over, request}。
|
|
15
|
+
// 「このサンプルを参考に作る」で ② だけを書いて(second:{title, content})④ で写すもの(コマンドの --from-sample と同じバイト)
|
|
18
16
|
import { filledRequest, packWithRequest } from './llm-request.mjs';
|
|
19
|
-
import { CATEGORIES, partsList,
|
|
20
|
-
import {
|
|
17
|
+
import { CATEGORIES, partsList, choiceRequest, capKb, rankParts, guessSubjects, asksSchool, audienceOf, SCHOOL_AUDIENCES, subjectChoices } from './new-deck.mjs';
|
|
18
|
+
import { rankedOpts, rankedPack, packSize } from './llm-pack.mjs';
|
|
21
19
|
import { sampleStructureRequest, validateSample } from './sample-info.mjs';
|
|
22
20
|
import { outlineRequest, slideCountOf, OUTLINE_OVER } from './llm-outline.mjs';
|
|
23
21
|
import { CHOOSABLE } from './themes-list.mjs';
|
|
22
|
+
import { PACK } from './llm-pack-data.mjs';
|
|
24
23
|
import { plural } from './plural.mjs';
|
|
25
24
|
|
|
26
25
|
export const REQUEST_WORDS = Object.freeze({
|
|
@@ -61,31 +60,22 @@ export function newDeckRequest({ kind = 'A', values = {}, theme, category = null
|
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
const LISTED = () => partsList(null).flatMap((g) => g.parts);
|
|
64
|
-
export function sampleTicks(sample, rec = []) {
|
|
65
|
-
const want = new Set([...initialParts(rec), ...(sample ? sample.parts : [])]);
|
|
66
|
-
return LISTED().filter((t) => want.has(t));
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export const packText = ({ tags, plan = 'free', lang = 'en', request, short = false, full = null }) => packWithRequest({ ...partsPackOpts(tags, plan, { short, full }), lang, request });
|
|
70
63
|
|
|
71
|
-
export
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
if (trim) {
|
|
76
|
-
const f = fitPack(tags, plan, { sizeOf, capBytes, keep });
|
|
77
|
-
const text = packText({ tags: f.tags, plan, lang, request, short: f.short });
|
|
78
|
-
return { text, bytes: packSize(text), short: f.short, candidates: [], dropped: f.dropped, over: f.over, tags: f.tags };
|
|
79
|
-
}
|
|
80
|
-
const f = fitPlan(tags, plan, { sizeOf, capBytes, keep });
|
|
81
|
-
const text = packText({ tags, plan, lang, request, short: f.short });
|
|
82
|
-
const bytes = packSize(text), over = fitSize(text, plan) > capBytes;
|
|
83
|
-
return { text, bytes, short: f.short, candidates: over ? f.candidates : [], dropped: [], over, tags };
|
|
64
|
+
export const packText = ({ described, named, plan = 'free', lang = 'en', request }) => packWithRequest({ ...rankedOpts(described, named, plan), lang, request });
|
|
65
|
+
export function newDeckPack({ order, plan = 'free', lang = 'en', request }) {
|
|
66
|
+
const f = rankedPack(order, plan, { textOf: (opts) => packWithRequest({ ...opts, lang, request }), capBytes: capKb(plan) * 1024 });
|
|
67
|
+
return { text: f.text, bytes: packSize(f.text), described: f.described, named: f.named, over: f.over };
|
|
84
68
|
}
|
|
85
69
|
|
|
70
|
+
// サンプルのラベルの id(伝えたいこと・題材・読み手):同梱のパーツ集の manifest から作った材料(PACK.tiers)のもの。一覧のない古い材料では形だけ確かめる
|
|
71
|
+
export function sampleLabels() {
|
|
72
|
+
const t = PACK.tiers || {};
|
|
73
|
+
const ids = (xs) => (Array.isArray(xs) ? xs.map((x) => x.id) : null);
|
|
74
|
+
return { purposes: ids(t.purposes), subjects: ids(t.subjects), audiences: ids(t.audiences) };
|
|
75
|
+
}
|
|
86
76
|
export function sampleProblems(obj) {
|
|
87
77
|
// テーマは誤りにしない:同梱でないテーマ(教材の中だけのテーマなど)は、引き継ぐときに default にする(sampleTheme)
|
|
88
|
-
return validateSample(obj, { categories: CATEGORIES, parts: LISTED() });
|
|
78
|
+
return validateSample(obj, { categories: CATEGORIES, parts: LISTED(), labels: sampleLabels() });
|
|
89
79
|
}
|
|
90
80
|
|
|
91
81
|
// 「このサンプルを参考に作る」で引き継ぐテーマ:同梱のテーマで新しく選べるもの(CHOOSABLE。kit/core/themes-list.mjs。編集アプリの ③ の一覧と同じ)だけ。
|
|
@@ -94,6 +84,19 @@ export function sampleProblems(obj) {
|
|
|
94
84
|
export const sampleTheme = (theme) => (CHOOSABLE.some((t) => t.name === theme) ? theme : 'default');
|
|
95
85
|
// サンプルから新規作成を始めるときの ① ③ の答え(編集アプリの app/llm.js が使う):{category, subcategory, theme}
|
|
96
86
|
export const fromSampleStart = (sample) => ({ category: sample.category, subcategory: sample.subcategory ?? null, theme: sampleTheme(sample.theme) });
|
|
87
|
+
// サンプルから始めたときの ④:サンプルの伝えたいこと・題材(と、② の言葉に当たった題材)・読み手(授業(小・中・高)はサンプルの読み手のうち学校のもの)。
|
|
88
|
+
// 順位はサンプルのパーツが一番上(handoff #43 ④)
|
|
89
|
+
export function sampleChoice(sample, { title = '', content = '', lang = 'en' } = {}) {
|
|
90
|
+
// 題材は ④ で選べるもの(reserved でない題材)だけ:まだ選べない題材(医療など)は順位に入れない(編集アプリの印と同じ)
|
|
91
|
+
const offered = subjectChoices().map((x) => x.id);
|
|
92
|
+
const own = (Array.isArray(sample.subjects) ? sample.subjects : []).filter((x) => offered.includes(x));
|
|
93
|
+
const guessed = guessSubjects({ text: [title, content, ''].join('\n'), lang }).map((g) => g.subject);
|
|
94
|
+
const subjects = offered.filter((x) => own.includes(x) || guessed.includes(x));
|
|
95
|
+
const purposes = Array.isArray(sample.purposes) ? [...sample.purposes] : [];
|
|
96
|
+
const school = asksSchool(sample.category, sample.subcategory ?? null) ? (Array.isArray(sample.audiences) ? sample.audiences : []).find((a) => SCHOOL_AUDIENCES.includes(a)) || null : null;
|
|
97
|
+
const audience = audienceOf(sample.category, sample.subcategory ?? null, school);
|
|
98
|
+
return { purposes, subjects, school, audience, order: rankParts({ purposes, subjects, audience, first: Array.isArray(sample.parts) ? sample.parts : [] }) };
|
|
99
|
+
}
|
|
97
100
|
|
|
98
101
|
// 「このサンプルを参考に作る」:① ③ ④ はサンプルから、② は second(タイトルと内容。ほかの項目は AI に任せる。言語は画面の言語、話す人は 1 人)。
|
|
99
102
|
// sample には title(サンプルの題名)も入れる
|
|
@@ -102,15 +105,6 @@ export function fromSamplePack({ sample, lang = 'en', plan = 'free', second = {}
|
|
|
102
105
|
const title = String(second.title || ''), content = String(second.content || '').trim();
|
|
103
106
|
const values = { title, audience: '', length: '', language: w.langReq[lang] || '', speakers: w.speakersReq[1], wishes: '' };
|
|
104
107
|
const request = newDeckRequest({ kind: 'A', values, theme: sampleTheme(sample.theme), category: sample.category, subcategory: sample.subcategory, sample, useStructure, content, outlineN: longOf(values.length), lang });
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
const f = samplePackFit({ tags, plan, lang, request, own: sample.parts });
|
|
108
|
-
return { text: f.text, bytes: packSize(f.text), short: f.short, shortened: f.shortened, dropped: f.dropped, ownShortened: f.ownShortened, over: f.over, tags: f.tags, full: f.full, candidates: [], request };
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export function samplePackFit({ tags, plan = 'free', lang = 'en', request, own = [] }) {
|
|
112
|
-
// 目安に照らす大きさは fitSize(無料のプランは 45 KB と貼り付けの長さ 31,000 の近いほう)
|
|
113
|
-
const sizeOf = (t, full) => fitSize(packText({ tags: t, plan, lang, request, full }), plan);
|
|
114
|
-
const f = fitSample(tags, plan, { sizeOf, capBytes: capKb(plan) * 1024, own });
|
|
115
|
-
return { ...f, sizeOf, text: packText({ tags: f.tags, plan, lang, request, full: f.full }) };
|
|
108
|
+
const { order } = sampleChoice(sample, { title, content, lang });
|
|
109
|
+
return { ...newDeckPack({ order, plan, lang, request }), request };
|
|
116
110
|
}
|
package/kit/core/new-deck.mjs
CHANGED
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
// 新規作成の選び方(backlog #99・#124、handoff/parts-map-2026-10-24.html の 7・9、handoff/parts-tiers-2026-10-27.md §2
|
|
1
|
+
// 新規作成の選び方(backlog #99・#124、handoff/parts-map-2026-10-24.html の 7・9、handoff/parts-tiers-2026-10-27.md §2、handoff #43 ④)と、教材のシード値(format spec §8.4、backlog #104)。
|
|
2
2
|
// Node にもブラウザにも依存しない(純粋な ESM)。画面は app/llm.js
|
|
3
3
|
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// プランが変えるのは指示の大きさの上限(capKb)と詳しさ(無料のプランは中核の 4 つのほかの標準のパーツを一覧の 1 行だけに。kit/core/llm-pack.mjs の partsPackOpts)。
|
|
9
|
-
// 選べる数は限らない。越えたら外す候補を出す:trimCandidates。
|
|
4
|
+
// ④(handoff #43、作者の決定 2026-11-19):パーツに印を付けず、ラベルを選ぶ。伝えたいこと(札。いくつでも・なしでも)→ 題材(任意。② の言葉から推して先に印)→
|
|
5
|
+
// 学校(① が授業(小・中・高)のときだけ。ほかは ① から読み手を決める:audienceOf)→ どの AI に貼るか(軽量・詳細)。
|
|
6
|
+
// ラベルの id と名前はパーツ集の manifest から(PACK.tiers の purposes・subjects・audiences。Studio に一覧を書かない)。
|
|
7
|
+
// 指示はパーツの順位(rankParts)で組む:上から説明を載せ、上限を越える手前で止め、残りは言いたいことの表に名前だけ(kit/core/new-deck-pack.mjs の newDeckPack)
|
|
10
8
|
//
|
|
11
9
|
// CATEGORIES [{id, label: {en, ja}, subs: [{id, label, structure, show}], structure?, show?}]
|
|
12
10
|
// SET_LABELS [{set, label: {en, ja}, inside: {en, ja}}](スライドの挿入の「指示の全体も付ける」の束の名前。新規作成では使わない)
|
|
13
|
-
// SUBJECT_SETS
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
// plan が 'free' なら、有料のプランの指示にだけ入るパーツ(paidOnly)を出さない(plan なしは全部)
|
|
18
|
-
// paidOnly(tag) → 有料のプランの指示にだけ入るパーツか(受け皿のない束のパーツ。tools/make-llm-guide.mjs の hasReceiver)
|
|
19
|
-
// recommend({sub, text, lang}) → [{set, sub?, word?}](おすすめの束と理由。小分類が先、それから言葉。束ごとに 1 つ)
|
|
20
|
-
// initialParts(rec) → 初めに選んでおくパーツ(標準の全部とおすすめの束のパーツ。一覧の順)
|
|
11
|
+
// SUBJECT_SETS 教科の形の束(partsList の並び)
|
|
12
|
+
// partsList(sub, plan) → [{id, label: {ja, en}, parts: [タグ]}](パーツを伝えたいことでまとめた一覧。サンプルの確かめとパーツの絵が使う。④ には出さない)
|
|
13
|
+
// paidOnly(tag) → 受け皿のない束のパーツか(tools/make-llm-guide.mjs の hasReceiver。順位で組む指示では、どちらのプランでも順位どおり)
|
|
14
|
+
// initialParts(rec) → 標準のパーツ全部と、rec([{set}])の束のパーツ(コマンドの束の指示と比べる試験が使う)
|
|
21
15
|
// partsOfSet(set) → 束のパーツ(一覧に出るものだけ)
|
|
22
|
-
//
|
|
16
|
+
// purposeTiles() → ④ の札:tile が 'own' で reserved でない伝えたいこと [{id, label}](manifest の順)
|
|
17
|
+
// subjectChoices() → ④ の題材:reserved でない題材 [{id, label}]
|
|
18
|
+
// guessSubjects({text, lang}) → [{subject, word}](② の言葉に当たった題材と、当たった言葉。題材の順)
|
|
19
|
+
// SCHOOL_AUDIENCES・asksSchool(category, sub) 授業(小・中・高)だけ「どの学校向けですか」(小中・高校)
|
|
20
|
+
// audienceOf(category, sub, school) → 読み手の id | null(授業(小・中・高)は school、大学の講義・研究発表は大学、研修・ビジネスは社会人、手引きは一般、その他はなし)
|
|
21
|
+
// rankParts({purposes, subjects, audience, usage, first}) → パーツの順位 [タグ](特殊の段を除くすべて)。
|
|
22
|
+
// ① 伝えたいことが合うか(2 値。札の into も含む)② 題材が合うか ③ 読み手が合うか ④ サンプルで使う数(usage。既定は PACK.tiers.usage)、名前の順。
|
|
23
|
+
// 題材か読み手のラベルがあって選んだものを含まないパーツは、合わないパーツとして、ほかのパーツの後ろ(伝えたいことが合っても)。
|
|
24
|
+
// first(サンプルから始めたときのサンプルのパーツ)は、この順のまま一番上に
|
|
25
|
+
// usageOf(samples) → {タグ: サンプルの数}(sample.json の parts から。PACK.tiers.usage と同じ数え方)
|
|
26
|
+
// AI_PLANS・DEFAULT_PLAN どの AI に貼るか:'free'(無料の AI・わからない=軽量の指示。既定)| 'paid'(有料の AI・ファイルで渡す=詳細の指示)
|
|
23
27
|
// planOf(choice) → 'free' | 'paid'(ない・知らない値は 'free')
|
|
24
|
-
// capKb(plan) 指示の大きさの上限(KB。kit/core/llm-pack.mjs の PACK_CAP_KB
|
|
25
|
-
// trimCandidates
|
|
26
|
-
// fitPlan(ticked, plan, {sizeOf, capBytes}) → {short, candidates}:無料のプランで越えたら、まず中核の 4 つの説明を短くし(short)、
|
|
27
|
-
// それでも越えれば専門のパーツだけを外す候補に(標準のパーツは外さない)。kit/core/llm-pack.mjs から出し直す
|
|
28
|
+
// capKb(plan) 指示の大きさの上限(KB。kit/core/llm-pack.mjs の PACK_CAP_KB。画面には出さない)
|
|
29
|
+
// trimCandidates・fitPlan コマンドの束の指示を目安に収める(kit/core/llm-pack.mjs)
|
|
28
30
|
// choiceRequest(choice, P, lang) 頼みたいことの後ろに付ける節(場面・構成の型・見せ方と、choice.purposesOff があれば外した伝えたいこと。P は PURPOSES)。何もなければ ''。
|
|
29
31
|
// 外した伝えたいことの行が名前を出す部品は choice.parts(指示に入るパーツ)にあるものだけ
|
|
30
32
|
// 「その他」は何も書かず、小分類の「この中にない」(subcategory: null)は場面の行だけ(構成の型・見せ方は書かない)
|
|
31
33
|
// withChoice(configText, choice) egatari.json の studio.newDeck に選んだものを書く(kit/core/config-file.mjs の updateConfig。ほかの項目はバイトのまま)
|
|
32
|
-
// choiceOf(configText) → studio.newDeck | null
|
|
33
|
-
// choice の形:{plan, category, subcategory,
|
|
34
|
-
//
|
|
34
|
+
// choiceOf(configText) → studio.newDeck | null(前の記録の parts は読まない)
|
|
35
|
+
// choice の形:{plan, category, subcategory, purposes: [id], subjects: [id], audience: id | null, fromSample?}(category・subcategory は id か null。
|
|
36
|
+
// fromSample は始めたサンプルの名前。前の記録(parts・subjects・tools・purposesOff)は読むだけで、新しく書くものには入れない)
|
|
35
37
|
//
|
|
36
38
|
// 見せ方(variant。format spec §8.4)は名前だけで選ぶ。教材のシード値(data-egatari-seed)はなくなった:書かない。前の原稿にあれば、そのまま残す(誰も読まない)
|
|
37
39
|
import { updateConfig, merge, configObject } from './config-file.mjs';
|
|
@@ -115,45 +117,8 @@ export const SET_LABELS = [
|
|
|
115
117
|
export const SUBJECT_SETS = ['maps', 'kokugo', 'english', 'music'];
|
|
116
118
|
const SUBJECT_GROUP = { id: 'subject', label: { ja: '教科の形', en: 'For specific subjects' } };
|
|
117
119
|
const OTHER_GROUP = { id: 'other', label: { ja: 'その他', en: 'Other' } };
|
|
118
|
-
//
|
|
119
|
-
export const SUB_SETS = Object.freeze({
|
|
120
|
-
lecture: ['stats'], training: ['tools'], conference: ['stats'], seminar: ['stats'],
|
|
121
|
-
report: ['business'], proposal: ['business'], pitch: ['business'], info: ['maps'],
|
|
122
|
-
});
|
|
120
|
+
// 授業(小・中・高)は partsList で教科の形を一番上に
|
|
123
121
|
const SUBJECT_FIRST = ['class'];
|
|
124
|
-
// 言葉の表(§2.4)。日本語は字の並びで、英語は語の切れ目で探す(大文字・小文字は区別しない)。
|
|
125
|
-
// 1 字の言葉は、ほかの語の一部に当たりやすいので除く並びを添える({w, not}:not は前後にあればその所は当たりにしない)。毎晩の評価で当たり外れを測って直す
|
|
126
|
-
export const WORDS = Object.freeze({
|
|
127
|
-
ja: {
|
|
128
|
-
stats: ['分布', '統計', 'データ', 'ヒストグラム', '箱ひげ', '相関', 'ベイズ', '推定', '検定'],
|
|
129
|
-
data: ['データサイエンス', '情報I', '情報Ⅰ', 'プログラミング', '交差検証', '信頼区間', '標本抽出', '確率変数', '期待値'],
|
|
130
|
-
math: ['筆算', 'わり算', '割り算', 'かけ算', '掛け算', '分数', '割合', '数直線', 'テープ図', '関数'],
|
|
131
|
-
maps: ['地図', '都道府県', '地方', '世界', { w: '国', not: ['国語'] }, '人口', '地域'],
|
|
132
|
-
kokugo: ['国語', '漢文', '漢詩', '古文', '現代文', '評論', '小説', '書き順', 'ひらがな'],
|
|
133
|
-
english: ['英文', '文型', '英語', { w: '句', not: ['俳句', '語句', '文句', '句読点'] }, { w: '節', not: ['季節', '関節', '節約', '節分', '調節'] }, '関係詞'],
|
|
134
|
-
music: ['音階', '和音', { w: 'コード', not: ['ソースコード', 'バーコード', 'QRコード', 'コーディング'] }, '鍵盤', '楽譜'],
|
|
135
|
-
business: ['市場', 'KPI', '売上', '事業', 'ピッチ'],
|
|
136
|
-
tools: ['タイマー', 'ワークショップ', '演習時間', 'グループワーク'],
|
|
137
|
-
// 束 algo(部品庫 2.10.0、d5 11/15):「グラフ」単独は棒グラフ・円グラフに当たるので入れない。小分類からは推さない(SUB_SETS にない)
|
|
138
|
-
// 部品庫 2.12 の m-network 2.1.0(グラフィカルモデル・パス図・HMM のトレリス)も束 algo。統計・機械学習の授業でも言葉ですすめる(d5 11/15)
|
|
139
|
-
algo: ['探索', '最短経路', '巡回セールスマン', 'グラフ理論', 'グラフの探索', 'アルゴリズム', '幅優先', 'ダイクストラ', 'グラフィカルモデル', 'パス図', '構造方程式', 'ベイジアンネットワーク', '隠れマルコフ', 'HMM', 'マルコフ連鎖', '因果ダイアグラム'],
|
|
140
|
-
// 束 ml(部品庫 2.12・2.13:m-nnet・m-classify2d・m-contour、backlog #219)。小分類からは推さない。「等高線」は地図にも当たるので入れない
|
|
141
|
-
ml: ['機械学習', 'ニューラルネット', 'パーセプトロン', '深層学習', 'ディープラーニング', '活性化関数', '勾配降下', 'ロジスティック回帰', 'サポートベクター', 'SVM', '決定木', 'k 平均', 'k平均', 'k-means', '近傍法', '損失関数', '分類器', 'scikit-learn'],
|
|
142
|
-
},
|
|
143
|
-
en: {
|
|
144
|
-
stats: ['distribution', 'distributions', 'statistics', 'statistical', 'data', 'histogram', 'histograms', 'box plot', 'box plots', 'correlation', 'Bayes', 'Bayesian', 'estimation', 'hypothesis test', 'hypothesis testing'],
|
|
145
|
-
data: ['data science', 'programming', 'cross-validation', 'confidence interval', 'confidence intervals', 'sampling', 'random variable', 'random variables', 'expected value'],
|
|
146
|
-
math: ['long division', 'column addition', 'multiplication', 'division', 'fraction', 'fractions', 'ratio', 'ratios', 'percentage', 'percentages', 'number line', 'tape diagram', 'function', 'functions'],
|
|
147
|
-
maps: ['map', 'maps', 'prefecture', 'prefectures', 'region', 'regions', 'world', 'country', 'countries', 'population'],
|
|
148
|
-
kokugo: ['kanbun', 'kobun', 'kanshi', 'classical Japanese', 'classical Chinese', 'stroke order', 'hiragana', 'katakana', 'kanji'],
|
|
149
|
-
english: ['English grammar', 'sentence structure', 'sentence pattern', 'sentence patterns', 'phrase', 'phrases', 'clause', 'clauses', 'relative pronoun', 'relative pronouns'],
|
|
150
|
-
music: ['musical scale', 'major scale', 'minor scale', 'chord', 'chords', 'keyboard', 'piano', 'sheet music', 'musical score'],
|
|
151
|
-
business: ['market', 'markets', 'KPI', 'KPIs', 'sales', 'revenue', 'business', 'pitch'],
|
|
152
|
-
tools: ['timer', 'workshop', 'exercise time', 'group work'],
|
|
153
|
-
algo: ['graph search', 'graph theory', 'breadth-first search', 'BFS', 'shortest path', 'traveling salesman', 'TSP', 'algorithm', 'algorithms', 'Dijkstra', 'graphical model', 'path diagram', 'structural equation', 'Bayesian network', 'hidden Markov', 'HMM', 'Markov chain', 'causal diagram'],
|
|
154
|
-
ml: ['machine learning', 'neural network', 'neural networks', 'perceptron', 'deep learning', 'activation function', 'gradient descent', 'logistic regression', 'support vector', 'SVM', 'decision tree', 'decision trees', 'k-means', 'nearest neighbor', 'nearest neighbors', 'loss function', 'classifier', 'classifiers', 'scikit-learn'],
|
|
155
|
-
},
|
|
156
|
-
});
|
|
157
122
|
|
|
158
123
|
const PARTS = TIERS.parts;
|
|
159
124
|
const shown = (t) => PARTS[t] && PARTS[t].tier !== 'extra';
|
|
@@ -179,7 +144,6 @@ export function partsList(sub, plan) {
|
|
|
179
144
|
}
|
|
180
145
|
const LISTED = () => partsList(null).flatMap((g) => g.parts);
|
|
181
146
|
export const partsOfSet = (set) => LISTED().filter((t) => PARTS[t].set === set);
|
|
182
|
-
const SETS = () => [...new Set(LISTED().map((t) => PARTS[t].set).filter(Boolean))];
|
|
183
147
|
|
|
184
148
|
const esc = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
185
149
|
// 言葉が text のどこかに(除く並びの中でなく)あれば、その言葉を返す
|
|
@@ -193,21 +157,12 @@ function findWord(text, word, lang) {
|
|
|
193
157
|
}
|
|
194
158
|
return null;
|
|
195
159
|
}
|
|
196
|
-
export function recommend({ sub = null, text = '', lang = 'ja' } = {}) {
|
|
197
|
-
const L = lang === 'en' ? 'en' : 'ja', t = String(text || ''), have = SETS(), out = [];
|
|
198
|
-
for (const set of SUB_SETS[sub] || []) if (have.includes(set)) out.push({ set, sub });
|
|
199
|
-
for (const [set, words] of Object.entries(WORDS[L])) {
|
|
200
|
-
if (!have.includes(set) || out.some((r) => r.set === set)) continue;
|
|
201
|
-
for (const w of words) { const hit = findWord(t, w, L); if (hit) { out.push({ set, word: hit }); break; } }
|
|
202
|
-
}
|
|
203
|
-
return out;
|
|
204
|
-
}
|
|
205
160
|
export function initialParts(rec = []) {
|
|
206
161
|
const sets = new Set(rec.map((r) => r.set));
|
|
207
162
|
return LISTED().filter((t) => PARTS[t].tier === 'standard' || sets.has(PARTS[t].set));
|
|
208
163
|
}
|
|
209
164
|
|
|
210
|
-
//
|
|
165
|
+
// どの AI に貼るか(無料の AI・わからない=軽量の指示、有料の AI・ファイルで渡す=詳細の指示)。変えるのは指示の大きさの上限だけ(順位で組む。画面に上限は出さない)
|
|
211
166
|
export const AI_PLANS = ['free', 'paid'];
|
|
212
167
|
export const DEFAULT_PLAN = 'free';
|
|
213
168
|
export const planOf = (choice) => (choice && choice.plan === 'paid' ? 'paid' : DEFAULT_PLAN);
|
|
@@ -215,6 +170,54 @@ export const capKb = (plan) => (plan === 'paid' ? PACK_CAP_KB.paid : PACK_CAP_KB
|
|
|
215
170
|
// 外す候補(trimCandidates)と目安に収める決め方(fitPlan)は kit/core/llm-pack.mjs にある(コマンドの kit/llm-pack.mjs と同じ関数)
|
|
216
171
|
export { trimCandidates, fitPlan } from './llm-pack.mjs';
|
|
217
172
|
|
|
173
|
+
// ---------------------------------------------------------------- ④ ラベル(handoff #43、作者の決定 2026-11-19)
|
|
174
|
+
const known = (xs) => (Array.isArray(xs) ? xs : []);
|
|
175
|
+
export const purposeTiles = () => known(TIERS.purposes).filter((p) => p.tile === 'own' && !p.reserved).map((p) => ({ id: p.id, label: p.label }));
|
|
176
|
+
export const subjectChoices = () => known(TIERS.subjects).filter((x) => !x.reserved).map((x) => ({ id: x.id, label: x.label, ...(x.keywords ? { keywords: x.keywords } : {}) }));
|
|
177
|
+
const audienceIds = () => known(TIERS.audiences).filter((x) => !x.reserved).map((x) => x.id);
|
|
178
|
+
export function guessSubjects({ text = '', lang = 'ja' } = {}) {
|
|
179
|
+
const L = lang === 'en' ? 'en' : 'ja', t = String(text || ''), out = [];
|
|
180
|
+
for (const s of subjectChoices()) {
|
|
181
|
+
// 推す語はパーツ集の manifest の subjects[].keywords(PACK.tiers.subjects。日本語は字の並び、英語は語の切れ目、1 字の語は {w, not}。handoff #69)
|
|
182
|
+
for (const w of ((s.keywords && s.keywords[L]) || [])) { const hit = findWord(t, w, L); if (hit) { out.push({ subject: s.id, word: hit }); break; } }
|
|
183
|
+
}
|
|
184
|
+
return out;
|
|
185
|
+
}
|
|
186
|
+
// 読み手:授業(小・中・高)だけ学校を聞く(小中・高校)。ほかは ① から(その他・この中にないはなし)。PACK.tiers.audiences にない id は使わない
|
|
187
|
+
export const SCHOOL_AUDIENCES = Object.freeze(['primary-junior', 'high-school']);
|
|
188
|
+
export const asksSchool = (category, sub) => category === 'teaching' && sub === 'class';
|
|
189
|
+
const AUDIENCE_OF_SUB = Object.freeze({ lecture: 'university', training: 'working-adult' });
|
|
190
|
+
const AUDIENCE_OF_CAT = Object.freeze({ research: 'university', business: 'working-adult', guides: 'general' });
|
|
191
|
+
export function audienceOf(category, sub, school = null) {
|
|
192
|
+
const ids = audienceIds();
|
|
193
|
+
const id = asksSchool(category, sub) ? (SCHOOL_AUDIENCES.includes(school) ? school : null)
|
|
194
|
+
: category === 'teaching' ? AUDIENCE_OF_SUB[sub] || null : AUDIENCE_OF_CAT[category] || null;
|
|
195
|
+
return id && ids.includes(id) ? id : null;
|
|
196
|
+
}
|
|
197
|
+
export function usageOf(samples = []) {
|
|
198
|
+
const n = {};
|
|
199
|
+
for (const s of samples) for (const t of new Set((s && Array.isArray(s.parts) ? s.parts : []).filter((x) => typeof x === 'string'))) n[t] = (n[t] || 0) + 1;
|
|
200
|
+
return n;
|
|
201
|
+
}
|
|
202
|
+
// 順位(作者の決定 2026-11-19):合わない(題材か読み手のラベルがあり、選んだものを含まない)パーツは後ろ。その中と外で、伝えたいこと → 題材 → 読み手 → サンプルで使う数 → 名前
|
|
203
|
+
export function rankParts({ purposes = [], subjects = [], audience = null, usage = TIERS.usage || {}, first = [] } = {}) {
|
|
204
|
+
const want = new Set(purposes);
|
|
205
|
+
for (const p of known(TIERS.purposes)) if (p.into && want.has(p.into)) want.add(p.id); // 札に入る id(順位 → 比べる)
|
|
206
|
+
const subs = new Set(subjects);
|
|
207
|
+
const tags = Object.keys(PARTS).filter((t) => PARTS[t].tier !== 'extra' && PACK.en.components[t]);
|
|
208
|
+
const key = (t) => {
|
|
209
|
+
const c = PARTS[t], ps = c.purposes || [], ss = c.subjects || [], as = c.audiences || [];
|
|
210
|
+
const subHit = ss.some((x) => subs.has(x)), audHit = !!audience && as.includes(audience);
|
|
211
|
+
const conflict = (subs.size > 0 && ss.length > 0 && !subHit) || (!!audience && as.length > 0 && !audHit);
|
|
212
|
+
return [conflict ? 1 : 0, ps.some((x) => want.has(x)) ? 0 : 1, subHit ? 0 : 1, audHit ? 0 : 1, -(usage[t] || 0)];
|
|
213
|
+
};
|
|
214
|
+
const keys = Object.fromEntries(tags.map((t) => [t, key(t)]));
|
|
215
|
+
const cmp = (a, b) => { for (let i = 0; i < 5; i++) if (keys[a][i] !== keys[b][i]) return keys[a][i] - keys[b][i]; return a < b ? -1 : a > b ? 1 : 0; };
|
|
216
|
+
const order = tags.sort(cmp);
|
|
217
|
+
const top = new Set(first);
|
|
218
|
+
return [...order.filter((t) => top.has(t)), ...order.filter((t) => !top.has(t))];
|
|
219
|
+
}
|
|
220
|
+
|
|
218
221
|
const catOf = (id) => CATEGORIES.find((c) => c.id === id) || null;
|
|
219
222
|
export function subOf(category, sub) { const c = catOf(category); return (c && c.subs.find((s) => s.id === sub)) || null; }
|
|
220
223
|
|
|
@@ -245,12 +248,16 @@ export function choiceRequest(choice, P, lang) {
|
|
|
245
248
|
}
|
|
246
249
|
|
|
247
250
|
const isObj = (v) => v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
251
|
+
const ids = (xs, list) => list.map((x) => x.id).filter((id) => known(xs).includes(id));
|
|
248
252
|
const clean = (choice) => ({
|
|
249
253
|
v: 1,
|
|
250
254
|
plan: planOf(choice),
|
|
251
255
|
category: catOf(choice.category) ? choice.category : null,
|
|
252
256
|
subcategory: subOf(choice.category, choice.subcategory) ? choice.subcategory : null,
|
|
253
|
-
|
|
257
|
+
// ④ のラベル(manifest の順。知らない id は書かない)。読み手は ① と学校から決めたもの
|
|
258
|
+
purposes: ids(choice.purposes, known(TIERS.purposes)),
|
|
259
|
+
subjects: ids(choice.subjects, known(TIERS.subjects)),
|
|
260
|
+
audience: audienceIds().includes(choice.audience) ? choice.audience : null,
|
|
254
261
|
// サンプルから始めたなら、そのサンプルの名前(examples/<名前>。backlog #130)
|
|
255
262
|
...(typeof choice.fromSample === 'string' && /^[a-z0-9][a-z0-9-]{0,63}$/.test(choice.fromSample) ? { fromSample: choice.fromSample } : {}),
|
|
256
263
|
});
|
|
@@ -262,5 +269,6 @@ export function choiceOf(configText) {
|
|
|
262
269
|
try { c = configObject(configText); } catch { return null; }
|
|
263
270
|
const n = isObj(c.studio) ? c.studio.newDeck : null;
|
|
264
271
|
if (!isObj(n) || n.v !== 1) return null;
|
|
265
|
-
|
|
272
|
+
const { parts, ...rest } = n; // 前の記録のパーツの一覧(④ が印だったころ)は読まない
|
|
273
|
+
return { ...rest, plan: planOf(n) }; // plan のない前の記録は無料のプラン
|
|
266
274
|
}
|
package/kit/core/part-labels.mjs
CHANGED
|
@@ -73,6 +73,9 @@ const LOCAL = {
|
|
|
73
73
|
'm-contour': { icon: 'heatmap', desc: { ja: '2 変数の関数の等高線と勾配、勾配降下法の道', en: 'Contours of a two-variable function, its gradient and a descent path' } },
|
|
74
74
|
'm-ctable': { icon: 'compare', desc: { ja: '分散分析表・分割表を計算のステップごとに埋める', en: 'ANOVA and contingency tables, filled in step by step' } },
|
|
75
75
|
'm-vector': { icon: 'matrix', desc: { ja: '平面のベクトルと 2 × 2 の行列の変換を 1 ステップずつ', en: 'Plane vectors and 2 × 2 matrix maps, one step at a time' } },
|
|
76
|
+
'm-contrast': { icon: 'compare', desc: { ja: '問いごとに従来の答えと本研究の答えを並べて、研究の位置づけを示す', en: 'Positions the work by setting earlier answers and this work side by side, question by question' } },
|
|
77
|
+
'm-matrix': { icon: 'compare', desc: { ja: '研究の位置づけを、2 本の軸の表か研究 × 要素の表でステップごとに埋める', en: 'Positions studies in a two-axis table or a studies × elements table, filled step by step' } },
|
|
78
|
+
'm-scroll': { icon: 'timeline', desc: { ja: '縦に長い図を枠に入れ、ステップごとに決めた所までスクロールする', en: 'A tall figure in a fixed frame, scrolled to set places step by step' } },
|
|
76
79
|
};
|
|
77
80
|
// 名前は manifest の display を先に。display だけあって表にない部品も名前を出す(絵は汎用)
|
|
78
81
|
export const PART_LABELS = Object.freeze(Object.fromEntries([...Object.keys(LOCAL), ...Object.keys(MANIFEST_NAMES).filter((t) => !LOCAL[t])]
|
package/kit/core/portable.mjs
CHANGED
|
@@ -578,6 +578,7 @@ function completionCheck(c, w, e) {
|
|
|
578
578
|
if (own(c, 'played') && c.played !== true) e.push(`${w}.played: not true`);
|
|
579
579
|
if (own(c, 'visitedFraction') && !(typeof c.visitedFraction === 'number' && c.visitedFraction > 0 && c.visitedFraction <= 1)) e.push(`${w}.visitedFraction: not in (0, 1]`);
|
|
580
580
|
if (own(c, 'reachedEnd') && c.reachedEnd !== true) e.push(`${w}.reachedEnd: not true`);
|
|
581
|
+
if (own(c, 'checks') && c.checks !== 'answered' && c.checks !== 'correct') e.push(`${w}.checks: not "answered" or "correct"`);
|
|
581
582
|
}
|
|
582
583
|
// 実行系の deck-meta(仕様の写し(FORMAT.VENDOR_DIR)の schema/deck-meta.schema.json)
|
|
583
584
|
// opts.preDraft:1.0 の形より前の草案の文書(player がない。§7.1)を読むとき、player がないことは問わない(読むのは今までどおり。書くものは必ず持つ)
|
|
@@ -1502,8 +1503,10 @@ function carryUnknown(index, carry, opts) {
|
|
|
1502
1503
|
// player は写さない:作り直しは再生器を替える(§4.1)ので、前の再生器の記録の項目はこの再生器のことではない
|
|
1503
1504
|
for (const k of ['version', 'contracts', 'generator']) copyUnknown(index[k], carry[k], KNOWN[k]);
|
|
1504
1505
|
if (isObj(carry.metadata)) {
|
|
1505
|
-
// 知っている項目でも、この書き手が作らなかったもの(ほかの書き手が書いた description
|
|
1506
|
-
|
|
1506
|
+
// 知っている項目でも、この書き手が作らなかったもの(ほかの書き手が書いた description など)は残す。
|
|
1507
|
+
// 権利の表示と作成者(license・copyright・attribution・creators)は写さない:開いたときに設定のファイルへ写してあり(folderConfig)、
|
|
1508
|
+
// 設定のファイルにないのは消したということ(「ファイルの情報…」の「ライセンスを付けない」・空の欄。handoff #88)。写すと deck-meta と食い違う
|
|
1509
|
+
for (const k of Object.keys(carry.metadata)) if (k !== 'derivedFrom' && !DECK_META_RIGHTS.includes(k) && !own(index.metadata, k)) index.metadata[k] = carry.metadata[k];
|
|
1507
1510
|
if (!opts.identity) {
|
|
1508
1511
|
if (own(carry.metadata, 'derivedFrom')) index.metadata.derivedFrom = carry.metadata.derivedFrom;
|
|
1509
1512
|
else delete index.metadata.derivedFrom;
|
package/kit/core/purposes.mjs
CHANGED
|
@@ -148,12 +148,14 @@ export function componentsOff(off, P) {
|
|
|
148
148
|
|
|
149
149
|
const cell = (s) => String(s).replace(/\|/g, '\\|');
|
|
150
150
|
// parts:材料の部品 [{tag, set}](set は 'standard' か束の名前)。sets:入っている束(null ならすべて)
|
|
151
|
-
export function purposesTable(P, parts, lang, src, { exclude = [], sets = null, off = [] } = {}) {
|
|
151
|
+
export function purposesTable(P, parts, lang, src, { exclude = [], sets = null, off = [], named = null } = {}) {
|
|
152
152
|
const L = lang === 'ja' ? 'ja' : 'en';
|
|
153
153
|
const ex = new Set(exclude), offs = new Set(off);
|
|
154
154
|
const inPack = (c) => c.set === 'standard' || !sets || sets.includes(c.set);
|
|
155
155
|
const usable = parts.filter((c) => !ex.has(c.tag));
|
|
156
|
-
|
|
156
|
+
// named:名前だけ載せる部品(順位で組む指示。説明はない。表の下の 1 文が「使わない」と言う)
|
|
157
|
+
const byName = new Set((named || []).filter((t) => parts.some((c) => c.tag === t)));
|
|
158
|
+
const here = new Set([...usable.filter(inPack).map((c) => c.tag), ...byName]);
|
|
157
159
|
const elsewhere = usable.filter((c) => !inPack(c));
|
|
158
160
|
const part = (id, t) => {
|
|
159
161
|
const note = NOTES[`${id}:${t}`];
|
|
@@ -179,6 +181,10 @@ export function purposesTable(P, parts, lang, src, { exclude = [], sets = null,
|
|
|
179
181
|
const other = elsewhere.length ? '\n\n' + (L === 'ja'
|
|
180
182
|
? `この指示に入っていないパーツもある。使わない。合いそうなら、何を見せたいかを 1 行のメモで伝える(作成者が新規作成でパーツを追加できる)`
|
|
181
183
|
: `Some parts are not included in these instructions. Do not use them; if one would fit, say in a one-line note what you would show (the author can add parts when making a new file).`) : '';
|
|
184
|
+
// 名前だけの部品(今の「入っていないパーツ」の決まりと同じ:使わない。合いそうなら 1 行のメモで。作者の決定 2026-11-19)
|
|
185
|
+
const nameOnly = byName.size ? '\n\n' + (L === 'ja'
|
|
186
|
+
? `この表には、名前だけで説明のないパーツもある。使わない。合いそうなら、何を見せたいかを 1 行のメモで伝える(作成者が新規作成で選び直すと、説明が入る)`
|
|
187
|
+
: `Some parts in this table have only their name and no description in these instructions. Do not use them; if one would fit, say in a one-line note what you would show (the author can choose differently when making a new file to get its description).`) : '';
|
|
182
188
|
const url = src ? '\n\n' + (L === 'ja' ? `各パーツの説明(バージョンを固定):${src}<名前>/README.md(名前は \`m-\` を除いたもの)` : `Each part's description (pinned version): ${src}<name>/README.md (the name without \`m-\`)`) : '';
|
|
183
|
-
return head + '\n' + rows.join('\n') + other + url;
|
|
189
|
+
return head + '\n' + rows.join('\n') + other + nameOnly + url;
|
|
184
190
|
}
|
package/kit/core/sample-info.mjs
CHANGED
|
@@ -12,21 +12,24 @@
|
|
|
12
12
|
// book 本があるか
|
|
13
13
|
// lang サンプルの言語('ja' | 'en')
|
|
14
14
|
// rights {license, attribution}(ライセンスの SPDX の名前(CC-BY-4.0 が基本)と、作った人の表示)
|
|
15
|
+
// purposes 伝えたいことの id(なくてもよい。空の配列も可)。subjects 題材の id、audiences 読み手の id(同じ。空=どれにも合う)。
|
|
16
|
+
// id の一覧はパーツ集の manifest のもの(Studio に書かない。handoff #43)
|
|
15
17
|
//
|
|
16
|
-
// validateSample(obj, {categories, parts}) → 誤りの一覧([{path, code}]。空なら正しい)。categories・parts
|
|
18
|
+
// validateSample(obj, {categories, parts, labels}) → 誤りの一覧([{path, code}]。空なら正しい)。categories・parts・labels({purposes, subjects, audiences} の id の配列)は確かめる相手(なければ形だけ)
|
|
17
19
|
// sampleStructureRequest(sample, title, lang) → 指示の「頼みたいこと」の後ろに添える節(構成と見せ方に倣う。lang は画面の言語、見出しと言いたいことはサンプルの言語のまま)
|
|
18
20
|
// SAMPLE_LIMITS 構成の行の数と字数の上限(指示を約 300 トークンに収める。無料のプランの上限のため)
|
|
19
21
|
|
|
20
22
|
export const SAMPLE_VERSION = 1;
|
|
21
23
|
export const SAMPLE_LANGS = ['ja', 'en'];
|
|
22
24
|
export const SAMPLE_LIMITS = Object.freeze({ rows: 16, heading: 80, point: 100, structureChars: 1100, request: 600, attribution: 200 });
|
|
23
|
-
const
|
|
25
|
+
export const LABEL_KEYS = ['purposes', 'subjects', 'audiences'];
|
|
26
|
+
const KEYS = ['v', 'request', 'category', 'subcategory', ...LABEL_KEYS, 'theme', 'parts', 'structure', 'book', 'lang', 'rights'];
|
|
24
27
|
|
|
25
28
|
const isObj = (v) => v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
26
29
|
const str = (v) => typeof v === 'string' && v.trim() !== '' && v === v.trim() && !/[\u0000-\u001f\u007f]/.test(v);
|
|
27
30
|
const len = (s) => [...s].length;
|
|
28
31
|
|
|
29
|
-
export function validateSample(obj, { categories = null, parts = null } = {}) {
|
|
32
|
+
export function validateSample(obj, { categories = null, parts = null, labels = null } = {}) {
|
|
30
33
|
const errs = [];
|
|
31
34
|
const bad = (path, code) => errs.push({ path, code });
|
|
32
35
|
if (!isObj(obj)) { bad('', 'not-object'); return errs; }
|
|
@@ -43,6 +46,17 @@ export function validateSample(obj, { categories = null, parts = null } = {}) {
|
|
|
43
46
|
}
|
|
44
47
|
if (!('subcategory' in obj)) bad('subcategory', 'missing');
|
|
45
48
|
else if (obj.subcategory !== null && !str(obj.subcategory)) bad('subcategory', 'not-text');
|
|
49
|
+
for (const key of LABEL_KEYS) {
|
|
50
|
+
if (!(key in obj)) continue;
|
|
51
|
+
if (!Array.isArray(obj[key])) { bad(key, 'not-array'); continue; }
|
|
52
|
+
const seen = new Set(), known = labels && labels[key];
|
|
53
|
+
obj[key].forEach((id, i) => {
|
|
54
|
+
if (typeof id !== 'string' || !/^[a-z0-9][a-z0-9-]*$/.test(id)) bad(`${key}[${i}]`, 'not-id');
|
|
55
|
+
else if (seen.has(id)) bad(`${key}[${i}]`, 'duplicate');
|
|
56
|
+
else if (known && !known.includes(id)) bad(`${key}[${i}]`, 'unknown');
|
|
57
|
+
seen.add(id);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
46
60
|
if (!str(obj.theme) || !/^[a-z0-9][a-z0-9-]*$/.test(obj.theme)) bad('theme', 'not-name');
|
|
47
61
|
if (!Array.isArray(obj.parts)) bad('parts', 'not-array');
|
|
48
62
|
else {
|
package/kit/core/scorm.mjs
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
// LMS 用の SCORM 1.2 の包み(spec bindings/scorm12.md §1):再生専用の Egatari ファイルを、そのまま index.html として 1 つの SCO の zip に入れる。
|
|
2
2
|
// node: も fs も使わない(CLI の build --scorm と編集アプリの「エクスポート ▸ LMS 用(SCORM)…」が同じバイトを作る)
|
|
3
3
|
//
|
|
4
|
-
// scormPackage(html) → { zip: Uint8Array, manifest, docId, title, steps, completion }
|
|
4
|
+
// scormPackage(html, { checks }?) → { zip: Uint8Array, manifest, docId, title, steps, completion }
|
|
5
5
|
// html:再生専用の Egatari ファイル(kit/core/portable.mjs の playOnly の出力)。バイトを変えずに index.html にする
|
|
6
|
+
// checks:確認問題の条件(format spec §9.2 completion.checks)を、包む前に再生専用の写しの deck-meta.completion に書く。
|
|
7
|
+
// "answered" | "correct" で書き、null で消す。省けば(undefined)写しのまま。書いた写しを、バイトを変えずに index.html にする
|
|
8
|
+
// withChecks(html, checks) → deck-meta.completion.checks を書き換えた再生専用の写し(上の checks と同じ。ほかはバイトのまま)
|
|
6
9
|
// scormManifest({ docId, title }) → imsmanifest.xml の文字列(包み方 §1 の形のまま)
|
|
7
10
|
// SCORM_EXT:書き出す zip の拡張子(名前は kit/core/export-name.mjs の exportName(題名, 既定, SCORM_EXT))
|
|
8
11
|
//
|
|
@@ -10,10 +13,12 @@
|
|
|
10
13
|
// 再開データ(cmi.suspend_data、3 つの bitset)が 4096 字を超えうる(§2.2。数えると 8064 ステップより多いとき。包み方の「about 3000」は控えめに過ぎる)・索引を持つ(編集できる Egatari ファイル。再生専用にしてから包む)
|
|
11
14
|
//
|
|
12
15
|
// 終えた判定(§3)は再生器(kit/track.js)が deck-meta.completion から決め、cmi.core.lesson_status を completed にする。
|
|
13
|
-
//
|
|
14
|
-
//
|
|
16
|
+
// 確認問題(パーツの問い、format spec §8.4 ctx.answer)があれば、再生器が点数(cmi.core.score.raw、正解した割合)も送る(§2.1)。
|
|
17
|
+
// 包みの側には何も書かない:adlcp:masteryscore は点数と比べて passed / failed を決めるためのもので、確認問題は理解の確認で
|
|
18
|
+
// 試験ではない(§2.1:passed / failed は使わない。答えはファイルの中にあり、学習者の端末で判定する。成績は LMS の小テストで)
|
|
15
19
|
import { writeZip } from './zip-write.mjs';
|
|
16
20
|
import { scanDocument, readDeckMeta } from './portable.mjs';
|
|
21
|
+
import { jsonScript } from './build-core.mjs';
|
|
17
22
|
import { FORMAT } from './format.mjs';
|
|
18
23
|
|
|
19
24
|
export const SCORM_EXT = '.scorm.zip';
|
|
@@ -80,8 +85,9 @@ export function stepCount(html) {
|
|
|
80
85
|
return Math.max(keys.size, narr);
|
|
81
86
|
}
|
|
82
87
|
|
|
83
|
-
export function scormPackage(html) {
|
|
88
|
+
export function scormPackage(html, opts = {}) {
|
|
84
89
|
if (typeof html !== 'string') fail('scorm-not-egatari', 'not an Egatari file');
|
|
90
|
+
if (opts.checks !== undefined) html = withChecks(html, opts.checks);
|
|
85
91
|
const scan = scanDocument(html);
|
|
86
92
|
const meta = readDeckMeta(scan);
|
|
87
93
|
if (!meta || meta.format !== FORMAT.FORMAT_ID) fail('scorm-not-egatari', `not a ${FORMAT.DISPLAY_NAME} file (no deck-meta with format "${FORMAT.FORMAT_ID}")`);
|
|
@@ -96,14 +102,32 @@ export function scormPackage(html) {
|
|
|
96
102
|
return { zip, manifest, docId: meta.docId, title, steps, completion: meta.completion || null };
|
|
97
103
|
}
|
|
98
104
|
|
|
105
|
+
// 再生専用の写しの deck-meta.completion.checks を書き換える(checks:"answered" | "correct" | null)。ほかの項目と、deck-meta の外はバイトのまま。
|
|
106
|
+
// completion がほかに何も持たなくなったら completion ごと消す({} は規則のない completion:schema が断る)
|
|
107
|
+
export const CHECKS = Object.freeze(['answered', 'correct']);
|
|
108
|
+
export function withChecks(html, checks) {
|
|
109
|
+
if (checks !== null && !CHECKS.includes(checks)) throw new TypeError(`checks: not one of ${CHECKS.join(', ')} or null`);
|
|
110
|
+
const scan = scanDocument(html);
|
|
111
|
+
const meta = readDeckMeta(scan), el = scan.byId.get('deck-meta');
|
|
112
|
+
if (!meta || meta.format !== FORMAT.FORMAT_ID || !el || el.start == null) fail('scorm-not-egatari', `not a ${FORMAT.DISPLAY_NAME} file (no deck-meta with format "${FORMAT.FORMAT_ID}")`);
|
|
113
|
+
const c = meta.completion && typeof meta.completion === 'object' && !Array.isArray(meta.completion) ? { ...meta.completion } : {};
|
|
114
|
+
if ((c.checks ?? null) === checks) return html;
|
|
115
|
+
if (checks) c.checks = checks; else delete c.checks;
|
|
116
|
+
const nm = { ...meta };
|
|
117
|
+
if (Object.keys(c).length) nm.completion = c; else delete nm.completion;
|
|
118
|
+
return html.slice(0, el.start) + jsonScript('deck-meta', nm) + html.slice(el.end);
|
|
119
|
+
}
|
|
120
|
+
|
|
99
121
|
// 終えた判定(deck-meta.completion、format spec §9.2)を平たい言葉で。編集アプリの窓と CLI の出力が使う
|
|
100
|
-
// kind:'all' | 'fraction' | 'end'、percent(fraction のとき)、played
|
|
122
|
+
// kind:'all' | 'fraction' | 'end'、percent(fraction のとき)、played(再生したステップだけを数える)、
|
|
123
|
+
// checks:確認問題の条件(null | 'answered' | 'correct')
|
|
101
124
|
export function completionRule(c) {
|
|
102
|
-
const r = { kind: 'all', percent: 100, played: false };
|
|
125
|
+
const r = { kind: 'all', percent: 100, played: false, checks: null };
|
|
103
126
|
if (c && typeof c === 'object') {
|
|
104
127
|
if (c.reachedEnd === true) r.kind = 'end';
|
|
105
128
|
else if (typeof c.visitedFraction === 'number' && c.visitedFraction > 0 && c.visitedFraction < 1) { r.kind = 'fraction'; r.percent = Math.round(c.visitedFraction * 1000) / 10; }
|
|
106
129
|
if (c.played === true) r.played = true;
|
|
130
|
+
if (CHECKS.includes(c.checks)) r.checks = c.checks;
|
|
107
131
|
}
|
|
108
132
|
return r;
|
|
109
133
|
}
|