@celljs/ta-watch 0.0.0-stage → 4.49.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 ADDED
@@ -0,0 +1,15 @@
1
+ # @celljs/ta-watch
2
+
3
+ English | [简体中文](./README.md)
4
+
5
+ The half on the computer of Ta on the Apple Watch: the watch reaches your computer straight through the relay; tap to talk, Ta works on the computer, and its answer shows on the watch and is read aloud. The latest conversations and what waits for you to decide can be read and answered there too. Design: `docs/design/ta-watch.md`.
6
+
7
+ - **Pairing**: in Ta on the iPhone, Settings › Apple Watch › Connect. Only the owner can pair. Each watch has a key of its own, kept in the vault of the computer (this computer only) and in the keychain of the watch.
8
+ - **Renewal**: a watch expires after 30 days; Ta on the iPhone renews it to 30 days on each start, so opening it once a month keeps the watch working.
9
+ - **Removal**: the same row lists the watches paired; one removed has its key stop working at once.
10
+ - **Wire protocol**: `web-src/watch-protocol.ts` is its one source, version 1 frozen: `hello`, `chats`, `chat`, `send`, `stop`, `asks`, `answer`, `hear`. Requests and answers are sealed with AES-256-GCM, out of the relay's sight; one more than 5 minutes off the computer's clock or with an id seen before is refused.
11
+ - **Shared samples**: `fixtures/watch-v1.json` is written by `bun run fixtures`; the TS specs and the Swift of TaWatchKit (`apps/ta-mobile/ios/TaWatchKit`) read the same file, so a protocol changed without writing it again fails both.
12
+
13
+ Methods of its host (`ta call @celljs/ta-watch <method> [json...]`): `list`, `pair`, `renew`, `remove`, for the owner only. The watch's requests come through the relay's HTTP to `<relay>/a/<computer id>/ta-watch/v1`.
14
+
15
+ It works with other packages only through their host methods: ta-voice (`hear`, the dictation of the computer). Turned off, no watch can reach the computer; the pairings are kept.
package/README.md CHANGED
@@ -1,3 +1,15 @@
1
- # Temporary Holding Version
1
+ # @celljs/ta-watch
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [English](./README.en.md) | 简体中文
4
+
5
+ Ta 的 Apple Watch 版在电脑上的那一半:手表经中继直接连到你的电脑,按一下说话,Ta 在电脑上干活,回复显示在表上并读出来;最近的对话、待你决定的事都能在表上看和答。设计见 `docs/design/ta-watch.md`。
6
+
7
+ - **配对**:在 iPhone 上的 Ta 里,设置 →「Apple Watch」→「连接手表」。只有主人能配对。每块手表一把自己的密钥,存在电脑的保险箱(只留本机)和手表的钥匙串里。
8
+ - **续期**:手表 30 天到期;iPhone 上的 Ta 每次打开都会悄悄续到 30 天后,所以一个月里打开过一次就一直能用。
9
+ - **移除**:同一行列出配过的手表,移除后它的密钥立刻失效。
10
+ - **线协议**:`web-src/watch-protocol.ts` 是唯一来源,版本 1 冻结:`hello`、`chats`、`chat`、`send`、`stop`、`asks`、`answer`、`hear`。请求和回答都用 AES-256-GCM 封好,中继看不到内容;时间偏差超过 5 分钟或请求 id 重复的请求一律拒绝。
11
+ - **对拍样例**:`fixtures/watch-v1.json` 由 `bun run fixtures` 生成,TS 单测和 Swift 的 TaWatchKit(`apps/ta-mobile/ios/TaWatchKit`)读同一份,协议改了没重新生成,两边的测试都会失败。
12
+
13
+ 包宿主的方法(`ta call @celljs/ta-watch <方法> [json...]`):`list`、`pair`、`renew`、`remove`,都只给主人用。手表的请求经中继 HTTP 到 `<中继>/a/<电脑 id>/ta-watch/v1`。
14
+
15
+ 它只经别的包的宿主方法协作:ta-voice(`hear`,电脑上的听写)。关掉本包,手表全部连不上,配对数据保留。
@@ -0,0 +1,137 @@
1
+ {
2
+ "note": "Made by bun run fixtures of ta-packages/ta-watch from web-src/watch-fixtures.ts; do not edit (docs/design/ta-watch.md 6).",
3
+ "key": "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8=",
4
+ "device": "AAECAwQFBgcICQoLDA0ODw",
5
+ "keys": {
6
+ "request": "2d4a220b7cc3e830f5c255793a88de4880449145479e621e0a689026effc262f",
7
+ "response": "e3d72970b9cbccfd2aeddbb79159418fee49b8a1ba96059ce571ad21ea2189a9"
8
+ },
9
+ "cases": [
10
+ {
11
+ "method": "hello",
12
+ "nonce": {
13
+ "request": "101112131415161718191a1b",
14
+ "response": "202122232425262728292a2b"
15
+ },
16
+ "request": "{\"v\":1,\"i\":\"req-hello-1\",\"t\":1796000000000,\"m\":\"hello\"}",
17
+ "sealedRequest": "EBESExQVFhcYGRobx+Mkfhat7xhIV7CnbUt/zo31pdNNpkVb40KzXQaEFaQCscsqsVyyuW7LbLzDAoE6AmZrckXHgzpgymxcSYDbPxXNqXI7JhI=",
18
+ "reply": "{\"i\":\"req-hello-1\",\"ok\":true,\"r\":{\"computer\":\"studio\",\"expiresAt\":1798592000000,\"models\":[\"anthropic/claude-opus\"],\"hearing\":true}}",
19
+ "sealedReply": "ICEiIyQlJicoKSorU0WSRN5IIspLRUWWUNO1H4DIMLwZnf1kkohS59iMMbJSY9mVgrVBldGRh/1XM++rlIuhlO3Acg0S30qCvg4Igl20SEZ+Wrb4mR7AdSvp02xu0GaZw0I8aB5Tt+l8ALPSnP/05Ls4DSdsZ1cRLzGPvcDhOhbZM2gghZkFpbNHpxqEHCZOF27J7TYjHgCPj3V1hhaj"
20
+ },
21
+ {
22
+ "method": "chats",
23
+ "nonce": {
24
+ "request": "303132333435363738393a3b",
25
+ "response": "404142434445464748494a4b"
26
+ },
27
+ "request": "{\"v\":1,\"i\":\"req-chats-1\",\"t\":1796000000000,\"m\":\"chats\",\"p\":{\"limit\":3}}",
28
+ "sealedRequest": "MDEyMzQ1Njc4OTo7UDXTJFVu5PXpbI6hAqpUdAxhwQXgKeXeYRNemHnLOXL8SZXRfLJXIiMvyEX5xuUF7c9fktngdbMgyAo0BRCVdp3DhXjPaMNKAs83C6dGwsPAknplwbz6",
29
+ "reply": "{\"i\":\"req-chats-1\",\"ok\":true,\"r\":[{\"file\":\"/s/a.jsonl\",\"title\":\"修登录页\",\"last\":\"改好了,测试都过了。\",\"at\":1795999940000,\"busy\":false,\"asking\":\"要推到 main 吗?\"}]}",
30
+ "sealedReply": "QEFCQ0RFRkdISUpLvBFlArgOQy7y+MApYVJ6IaTMaV5K+n05oqvQCYq2aFN3s5K9bGeKsgl83Y3ErG/78GO3YBh6+TvTtxqm9CTzSfA4ZsbNxhdI8Ol8C3EKdvj6AFsHc9/y8N+wWs0VvwXx0jIyggp1gBLVjeoK5Fk5TmwX/frBZ/c6ztugS6trE+CXXGKQHcr/B3S+JEovwcVN7eJyZtKefoaigqeyIkq7ZcNPWYzWH4JmBFD97IsZg6PmSdn9ndPggjonr8wnjVu2K1Dlq/zQD5o1"
31
+ },
32
+ {
33
+ "method": "chat",
34
+ "nonce": {
35
+ "request": "505152535455565758595a5b",
36
+ "response": "606162636465666768696a6b"
37
+ },
38
+ "request": "{\"v\":1,\"i\":\"req-chat-1\",\"t\":1796000000000,\"m\":\"chat\",\"p\":{\"file\":\"/s/a.jsonl\"}}",
39
+ "sealedRequest": "UFFSU1RVVldYWVpbVsMMDhar2Ij2t8rARD7raSEKA5WX3KpAAj2WT5OQWhcpBXPixQoI7Pz4UaNp0xEUgEuRYeYW7m4DCqzdnyiCH+l/WFPpT7JeC0DKw/2g3W0cnt3YuD2hJ7kpWgN3O8k=",
40
+ "reply": "{\"i\":\"req-chat-1\",\"ok\":true,\"r\":{\"busy\":true,\"lines\":[{\"role\":\"user\",\"text\":\"跑一下测试\"},{\"role\":\"assistant\",\"text\":\"Running the tests…\"}]}}",
41
+ "sealedReply": "YGFiY2RlZmdoaWprFFT0RQmWy5Da2TusjwJsPtN9cLVKfnnek8RHCnirOZpEd6ncqgB8MLKIMbpQyraEEdMkGl9+lTuuqgO4dpvkLAYQ3gBXwPFbQ1rzTPQxbSgwAH9nQP0ZQ7CTynCkDd2asCoCHOY6BGRTf7c0hVVHZF6maZ94oZl37D3MnK/SfTRdgVPMv2lDUXI+xwQKf4IFEv7kae4ywnuwrCgsLcrBXzawBaQ="
42
+ },
43
+ {
44
+ "method": "send",
45
+ "nonce": {
46
+ "request": "707172737475767778797a7b",
47
+ "response": "808182838485868788898a8b"
48
+ },
49
+ "request": "{\"v\":1,\"i\":\"req-send-1\",\"t\":1796000000000,\"m\":\"send\",\"p\":{\"text\":\"ビルドして\",\"model\":\"anthropic/claude-opus\"}}",
50
+ "sealedRequest": "cHFyc3R1dnd4eXp7nQtkXoE9idO+SxJpDHJRL2quDI7BVh38T9RWZR6MQni01MdPflexR5SIcZ3nySnJBH+L77cojMI4stGyu+chIA3wGVdJx79aZo+3mZHl5GitG1lCTOSb6eJhuvtBbrwRX2FdlK3KV3HSLHXTrNTjyYCT9RYVRzew2NzBCfXsnfYWT766",
51
+ "reply": "{\"i\":\"req-send-1\",\"ok\":true,\"r\":{\"file\":\"/s/b.jsonl\"}}",
52
+ "sealedReply": "gIGCg4SFhoeIiYqLU9Gf6sxsL9UchRCA+wN/KOSl5x/6hrJU6vXJocV1/lvC02ww98j1ySiFg6zD22kHp/SjW1i7YF+yXMOToRgcAsXCQLJY+A=="
53
+ },
54
+ {
55
+ "method": "stop",
56
+ "nonce": {
57
+ "request": "909192939495969798999a9b",
58
+ "response": "a0a1a2a3a4a5a6a7a8a9aaab"
59
+ },
60
+ "request": "{\"v\":1,\"i\":\"req-stop-1\",\"t\":1796000000000,\"m\":\"stop\",\"p\":{\"file\":\"/s/b.jsonl\"}}",
61
+ "sealedRequest": "kJGSk5SVlpeYmZqbLUuspy1SlpNLg3lLQxCjSBBy9mvE4fVoo+FHy6qA/TU19vybykHv2Ae3sHoKZzQP3vu+I9vON3v0hL1Feo5lZS6UfJMYL2GK15mux7NDE0UzD5tG/kNxai9K4PfRRLw=",
62
+ "reply": "{\"i\":\"req-stop-1\",\"ok\":true,\"r\":{}}",
63
+ "sealedReply": "oKGio6Slpqeoqaqroyh4ZBQWS4b8/n7Vz0aJYY0w9TLC59DQsD8SbTxUQD4rlgP7GwqTdAwDcfQR0No2CSu+"
64
+ },
65
+ {
66
+ "method": "asks",
67
+ "nonce": {
68
+ "request": "b0b1b2b3b4b5b6b7b8b9babb",
69
+ "response": "c0c1c2c3c4c5c6c7c8c9cacb"
70
+ },
71
+ "request": "{\"v\":1,\"i\":\"req-asks-1\",\"t\":1796000000000,\"m\":\"asks\"}",
72
+ "sealedRequest": "sLGys7S1tre4ubq7aVxR6hm3FQf7mW7aDr/6+K3xiXilFYswNzJJg0q/66FBVyssBw2wPdhJqnKr1yV0sMxI9PeQCHRUZWDyyoJfmlG/BiAu",
73
+ "reply": "{\"i\":\"req-asks-1\",\"ok\":true,\"r\":[{\"file\":\"/s/a.jsonl\",\"title\":\"修登录页\",\"question\":\"要推到 main 吗?\",\"kind\":\"dialog\",\"choices\":[\"yes\",\"no\"]}]}",
74
+ "sealedReply": "wMHCw8TFxsfIycrL9ozsb20ImfPb/sqL7bdFNXguDoyrqOP9eq9TtxYLxfKHHR2x06++BNo7KSeoreXyADe2z4T8DowblGBTGlPx8rNO4hqvxmgXUOedTlpfvJUYQirMWS7BGHcYupSrGcyB2AGcBAwhUMPYGSXOvOPs3cdl7b0vmr8Dnh4YjNOhIifNcpcWbmXf7Zvikyd0OlvbX4XTw83JPKqNLaIHH2P376y8dD4fSYR/rA=="
75
+ },
76
+ {
77
+ "method": "answer",
78
+ "nonce": {
79
+ "request": "d0d1d2d3d4d5d6d7d8d9dadb",
80
+ "response": "e0e1e2e3e4e5e6e7e8e9eaeb"
81
+ },
82
+ "request": "{\"v\":1,\"i\":\"req-answer-1\",\"t\":1796000000000,\"m\":\"answer\",\"p\":{\"file\":\"/s/a.jsonl\",\"answer\":\"yes\"}}",
83
+ "sealedRequest": "0NHS09TV1tfY2drb7j7Q9Abd7u5DOGOotYFer93lHGRW2TwIrY2QXfU6qA0YjDrjEY+regYbcmH3eZ1uG91b2MNtntIGUQ2fbTeSnQZD/ALXIhBqOfHt5gOGrZkxbk84AB3zszVjhBnQCmYXk2lvq99Ua8yqZ1N9Kr2SaCLJ",
84
+ "reply": "{\"i\":\"req-answer-1\",\"ok\":true,\"r\":{\"said\":\"yes\"}}",
85
+ "sealedReply": "4OHi4+Tl5ufo6errpFD0uWwrM2VcGmn7JVOiBmC8nImkDmQOF/7t+67AZ7oIkSD3Si1SrV+Kk5hhHAJJfkCScPWlqe85S9b9/W3867c="
86
+ },
87
+ {
88
+ "method": "hear",
89
+ "nonce": {
90
+ "request": "f0f1f2f3f4f5f6f7f8f9fafb",
91
+ "response": "000102030405060708090a0b"
92
+ },
93
+ "request": "{\"v\":1,\"i\":\"req-hear-1\",\"t\":1796000000000,\"m\":\"hear\",\"p\":{\"audio\":\"AAABAAIAAwA=\"}}",
94
+ "sealedRequest": "8PHy8/T19vf4+fr7CAoh871RAkyU7s1exFf9EWKIyxK9V305dcxJFIg9mR/S1dwrkmEstJaVyT9nVzcgAw1FvTkqkflGHESmicdPkOyzfaOcS5UDLp7SXWwREE+dzXBgTSgL0Nlw6jg9tzYnzac=",
95
+ "reply": "{\"i\":\"req-hear-1\",\"ok\":true,\"r\":{\"text\":\"你好\"}}",
96
+ "sealedReply": "AAECAwQFBgcICQoLz6X50eCwptadqk6OxA5Z1uRklOSPyw+Kg8RlTIzuoFtBt6wSmjb3DwpV8zZZFoV8RPPFFv2Tm1ysi2k7GAdAyCPL"
97
+ },
98
+ {
99
+ "method": "chat",
100
+ "nonce": {
101
+ "request": "101112131415161718191a1b",
102
+ "response": "202122232425262728292a2b"
103
+ },
104
+ "request": "{\"v\":1,\"i\":\"req-fail-1\",\"t\":1796000000000,\"m\":\"chat\",\"p\":{\"file\":\"/s/gone.jsonl\"}}",
105
+ "sealedRequest": "EBESExQVFhcYGRobx+Mkfhat7xhIV7CnbUt/zoPxoNMPulZV7RTlRQ2CG6sEscsqsVyyuW7XYvOMGpl7AmJzPAbHjh97O++ISe0ZxkJ2DJPi94dRl2dyCLXZ+GbsZMkI1wViERoczVP3SBuNNeI=",
106
+ "reply": "{\"i\":\"req-fail-1\",\"ok\":false,\"e\":{\"code\":\"not_found\",\"message\":\"There is no such conversation.\"}}",
107
+ "sealedReply": "ICEiIyQlJicoKSorU0WSRN5IIspLRUuSVdP3A5PGPvEd1OU4h5ZU59iMJrJSY9mVgrxUwp/Wm7AZTvqwlIGs2ePOPQ0Z3EKXvl9z1CvmHAMiQuqyi0CfZWisgChs3maT0Es9OUV8/Od8WvndjrBnV10RJwNCrVffxOOrILU="
108
+ }
109
+ ],
110
+ "refused": [
111
+ {
112
+ "what": "tag changed",
113
+ "direction": "request",
114
+ "sealed": "EBESExQVFhcYGRobx+Mkfhat7xhIV7CnbUt/zo31pdNNpkVb40KzXQaEFaQCscsqsVyyuW7LbLzDAoE6AmZrckXHgzpgymxcSYDbPxXNqXI7JhM="
115
+ },
116
+ {
117
+ "what": "ciphertext changed",
118
+ "direction": "request",
119
+ "sealed": "EBESExQVFhcYGRobxuMkfhat7xhIV7CnbUt/zo31pdNNpkVb40KzXQaEFaQCscsqsVyyuW7LbLzDAoE6AmZrckXHgzpgymxcSYDbPxXNqXI7JhI="
120
+ },
121
+ {
122
+ "what": "a request opened as a response",
123
+ "direction": "response",
124
+ "sealed": "EBESExQVFhcYGRobx+Mkfhat7xhIV7CnbUt/zo31pdNNpkVb40KzXQaEFaQCscsqsVyyuW7LbLzDAoE6AmZrckXHgzpgymxcSYDbPxXNqXI7JhI="
125
+ },
126
+ {
127
+ "what": "sealed for another device",
128
+ "direction": "request",
129
+ "sealed": "AAECAwQFBgcICQoLiyQIUUsHW+/Dgqx28x1om5drmopMcz4R1PRSlmhYveab3W5lld660IJHzD3Jt7j6idtxYYu9nd5M62BYITiIUESzVBE7XWk="
130
+ },
131
+ {
132
+ "what": "too short",
133
+ "direction": "request",
134
+ "sealed": "AAAA"
135
+ }
136
+ ]
137
+ }