@celljs/ta-reflex 0.0.0-stage → 4.37.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/README.en.md +28 -0
- package/README.md +27 -2
- package/extension/index.mjs +976 -0
- package/host/index.mjs +1942 -0
- package/package.json +72 -4
- package/web/index.js +2232 -0
package/README.en.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# @celljs/ta-reflex
|
|
2
|
+
|
|
3
|
+
[中文](./README.md)
|
|
4
|
+
|
|
5
|
+
A built-in package of Ta: live hands, fast and slow. What changes fast (a game, a canvas, a page that keeps changing) is worked frame by frame by a little program on the page, faster than a person; the model only gives the intent and is woken only by what matters. Design: [ta-reflex.md](../../docs/design/ta-reflex.md).
|
|
6
|
+
|
|
7
|
+
## How it works
|
|
8
|
+
|
|
9
|
+
- **Targets**: what is registered on the page. Games (`pi.ui.Game` / `pi.ui.Game3D`, when the game gives `observe`) and the browser of the workbench (Ta Desktop) are registered by Ta; an extension registers its own with `pi.targets.register({ id, kind, title, tier, actions, observe, act })`.
|
|
10
|
+
- **Programs**: `aim` (point at what moves and press), `track` (follow without pressing), `watch` (wait for something to show) of the library, or a `step(observation, intent, memory, ctx)` Ta writes, which runs in a worker of its own with no network and is stopped when a step takes over 250 ms.
|
|
11
|
+
- **Falling back**: running programs is L2; a page that cannot start a worker runs the library's only; where no program runs, `reflex_batch` does many steps in one call (L1); with no page of Ta open it is L0, step by step as before. When the intent runs out, the program fails again and again or the target goes, the run waits for the model by itself, and a game that can wait waits too.
|
|
12
|
+
|
|
13
|
+
## Tools
|
|
14
|
+
|
|
15
|
+
| Tool | What it does |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| `reflex_targets()` | The targets on the page, the library, and the level this device reaches |
|
|
18
|
+
| `reflex_start({ target, use? \| code?, intent? })` | Starts a run: its id, level, and what the target shows now |
|
|
19
|
+
| `reflex_intent({ run, intent? })` | A new intent at once; without one, only how it is |
|
|
20
|
+
| `reflex_program({ run, use? \| code? })` | Another program; one that does not load leaves the old one going |
|
|
21
|
+
| `reflex_batch({ target, steps })` | Many steps in one call: actions, waits, waits till something shows |
|
|
22
|
+
| `reflex_stop({ run })` | Stops it, with its summary: time, steps, actions, step time P50/P95, events and errors |
|
|
23
|
+
|
|
24
|
+
What a program escalates goes back to the conversation that started the run through a gate (`deliverAs: 'steer'`): at most once in 2 s, up to 10 s while it is busy, back down when quiet.
|
|
25
|
+
|
|
26
|
+
## Switches
|
|
27
|
+
|
|
28
|
+
Settings → Live hands: **Aim** (off: no `aim` in the library) and **Ta's own programs** (off: the library only). The whole package can be turned off among the extensions. A run going on shows a line above the message box, "Ta is working … live", with Stop.
|
package/README.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @celljs/ta-reflex
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[English](./README.en.md)
|
|
4
|
+
|
|
5
|
+
Ta 的内置包:实时操作,快慢双系统。变化很快的东西(游戏、画布、不停变化的页面),由页面上的一个小程序逐帧去做,反应比人快;模型只给意图,只在要紧的时候被叫醒。设计见 [ta-reflex.md](../../docs/design/ta-reflex.md)。
|
|
6
|
+
|
|
7
|
+
## 怎么用
|
|
8
|
+
|
|
9
|
+
- **操作对象**:页面上登记了的东西。游戏(`pi.ui.Game` / `pi.ui.Game3D`,游戏给出 `observe`)、工作台浏览器(Ta 桌面版)由 Ta 自己登记;扩展用 `pi.targets.register({ id, kind, title, tier, actions, observe, act })` 登记自己的。
|
|
10
|
+
- **程序**:程序库里的 `aim`(瞄准并按下)、`track`(跟随不按)、`watch`(等某样东西出现),或 Ta 自己写的 `step(observation, intent, memory, ctx)`,在独立 Worker 里跑、不能联网,一步超过 250 ms 就停掉。
|
|
11
|
+
- **降级**:能跑程序是 L2;页面起不了 Worker 时只能用程序库;不能跑程序时用 `reflex_batch` 一次做多步(L1);没有打开 Ta 的页面就是 L0,照旧一步一看。意图过期、程序连续出错、对象消失时,运行自动停下等模型,能暂停的游戏一起暂停。
|
|
12
|
+
|
|
13
|
+
## 工具
|
|
14
|
+
|
|
15
|
+
| 工具 | 做什么 |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| `reflex_targets()` | 页面上能实时操作的对象、程序库,以及这台设备能到第几级 |
|
|
18
|
+
| `reflex_start({ target, use? \| code?, intent? })` | 接上对象开始跑,返回运行 id、级别和对象此刻的样子 |
|
|
19
|
+
| `reflex_intent({ run, intent? })` | 立即换意图;不给意图就只看状态 |
|
|
20
|
+
| `reflex_program({ run, use? \| code? })` | 换程序,加载失败时旧程序照常跑 |
|
|
21
|
+
| `reflex_batch({ target, steps })` | 一次做多步:动作、等待毫秒、等到出现某样东西 |
|
|
22
|
+
| `reflex_stop({ run })` | 停下,返回摘要:时长、步数、动作数、每步耗时 P50/P95、事件与错误 |
|
|
23
|
+
|
|
24
|
+
程序上报的事件经门控送回发起的对话(`deliverAs: 'steer'`),默认至多每 2 秒一次,忙时自动放宽到 10 秒,安静时收回。
|
|
25
|
+
|
|
26
|
+
## 开关
|
|
27
|
+
|
|
28
|
+
设置 → 实时操作:**瞄准**(关掉后程序库没有 `aim`)、**Ta 自己写的程序**(关掉后只用程序库)。整个包可在扩展里关掉。正在运行的会在输入框上方显示一行"Ta 正在实时操作 …",点"停止"即停。
|