@celljs/ta-play 4.38.0 → 4.40.0
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/extension/index.mjs +4 -2
- package/package.json +3 -3
- package/web/index.js +3282 -229
package/extension/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
// ../ta-protocol/esm/common/
|
|
1
|
+
// ../ta-protocol/esm/common/host-cloud-protocol.js
|
|
2
2
|
var TA_CLOUD_OUTPUT_BYTES = 1024 * 1024;
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
// ../ta-protocol/esm/common/ta-extension-host.js
|
|
4
5
|
var TA_HOST_EVENT = "ta:host";
|
|
5
6
|
var TaHostUtil;
|
|
6
7
|
(function(TaHostUtil2) {
|
|
@@ -77,6 +78,7 @@ var PLAY_PROMPT = `When something is better played than read (practice, review,
|
|
|
77
78
|
Make it for them, from what you know of them (their level, the mistakes they made before, what they like, their language), not a generic game: one clear goal, a round of 1 to 3 minutes, feedback at once on each move (why a wrong answer is wrong, and the right one), harder as they do well, a reward they see (stars, a combo, a best score). What it teaches must be right.
|
|
78
79
|
The document: inline <style> and <script> only. It reaches nothing (no network, CDN, web fonts, files, frames or storage): draw with CSS, SVG or canvas, sound with Web Audio. Touch first (pointer events, big targets, no hover, no keyboard needed), filling the frame (100vw by 100vh; the frame's width over its height is <meta name="ta-aspect" content="3/4">, 4/5 without), legible on a phone, light or dark as prefers-color-scheme says; its <title> names it. Under 40 KB, whole and working: no placeholder, nothing left to fill in.
|
|
79
80
|
window.ta is there before the game's scripts: await ta.ready (or ta.on('ready', fn)); ta.me {id, name}; ta.players [{id, name, online, host, self}]; ta.solo; ta.saved, what it kept with ta.save(value) (a best score; localStorage is not kept); ta.finish({score, total, summary, mistakes: [{topic, note}]}) when a round ends: the user may send it to you, and you make the next round from it (harder where they did well, what they missed again in another form).
|
|
81
|
+
What it keeps of its own (cards learned, a deck, progress): ta.put(key, value) and ta.data[key], kept by this device's Ta through the versions of the work. When a model makes it better (new questions each round, feedback on what they typed, a partner to talk to): if (ta.ai) { const text = await ta.ai('…') } (or ta.ai({prompt, system, history: [{role, text}], maxTokens})); the user's own model answers, once they allowed it; it may fail (not allowed, a limit), so catch it and go on without, and play without it where ta.ai is not there.
|
|
80
82
|
A game for several (a class, friends): read the skill ta-play first, which has a whole example. It says <meta name="ta-players" content="2-8">; its players are the members of the group chat it is sent to. ta.state is the state they share: ta.set(key, value) (JSON; the last write wins, so each player writes keys of their own, such as 'score:' + ta.me.id, and the host the rest: the round, the question, the order), ta.on('state', (key, value, by) => …) for the writes of the others; ta.send(data, to?) with ta.on('message', (data, from) => …) for moves that need not stay; ta.on('players', list => …). The host (who sent it, host in ta.players) starts the rounds, the others wait for it, one who joins late reads ta.state; played alone it still works, with one player.
|
|
81
83
|
After the block, a line at most: what it is and how to play.`;
|
|
82
84
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-play",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.40.0",
|
|
4
4
|
"description": "A pi package for Ta: games in replies, made for the one who plays, played alone or together in a group chat",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@celljs/ta-protocol": "4.
|
|
31
|
-
"@celljs/ta-web": "4.
|
|
30
|
+
"@celljs/ta-protocol": "4.40.0",
|
|
31
|
+
"@celljs/ta-web": "4.40.0",
|
|
32
32
|
"@types/react": "^19.3.3"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|