shuadouyin 0.3.5 → 0.4.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/.dy-build-commit CHANGED
@@ -1 +1 @@
1
- 74b35764d458acaeeff44eaef3fe9e9a99941ac8
1
+ d9528376f4f68e7e7414bc7968f619267fd656b4
package/CHANGELOG.md ADDED
@@ -0,0 +1,44 @@
1
+ # Changelog
2
+
3
+ ## 0.4.1 — 2026-10-31
4
+
5
+ ### 文档
6
+
7
+ - README 加了两张图:一张能力总览,一张六格流程示意。两种语言共用同一组。
8
+ - 图片不随 npm 包发布。它们是给 GitHub 页面看的,装包的人用不到,带上会把包从 343 kB 撑到 4.5 MB。
9
+
10
+ ## 0.4.0 — 2026-10-31
11
+
12
+ ### 新增
13
+
14
+ - `chat recall` — 撤回自己发的一条私信。平台窗口是 3 分钟;超时后菜单里还有「撤回」但服务端会拒,所以它读响应而不是猜时间。没有二次确认,因此要 `--request-id`。
15
+ - `chat inbox` — 谁在等我回。未读徽标不可靠(打开会话就清),所以按「最后一句是不是对方说的」判断,并把对方分享的作品 id 放进 `shared_works`。
16
+ - `browse checkpoint` — 每批一条:走了哪条路、看到什么、每个交付条件是什么状态、下一步去哪里。进度从这些记录推导,不采信调用方的自述。
17
+ - `browse start --text-file` — 一轮要交付什么、按什么标准判、什么时候停。写一次不能改,改条件就是换一轮。
18
+ - `browse end --outcome` — `completed` 要求 checkpoint 真的达标,否则拒绝;`partial` 是诚实的交付。
19
+ - `persona show` — 按段读取人格,每段带 `complete`。`context show` 从头截断,人格的「身份与声音」在后面,预算不够时会静静切掉。
20
+ - `auth grant` / `auth revoke` / `auth grants` — 记住某个人可以做什么,带期限、每日上限和撤销记录。不是开关。
21
+
22
+ ### 改进
23
+
24
+ - `page facts --selector` 只返回问到的标记:4440 → 618 字节。
25
+ - `chat read` 不再复述上一条读到的消息内容:8832 → 4215 字节。
26
+ - `comment list` 去掉每行重复的作品 id 和恒为 false 的布尔:2689 → 1849 字节。
27
+ - `video digest` 不传 `--frames` 时按时长采样。之前两个默认值叠起来,让它从来没生效过。
28
+ - 每个页面命令的返回会带 `persona` 字段,提醒这一轮还没读人格、读的是旧版本、或从没读过。
29
+ - 三个预设各带一组同一事实的对照示例,说明这个声音在四种场景下怎么说话。
30
+
31
+ ### 修复
32
+
33
+ - `chat read` 只读视口内的消息。真实群 13 条只返回 7 条,**漏掉的全是别人说的**。
34
+ - `chat inbox` 把「新到旧」的数组当成「旧到新」,`awaiting_reply` 一直是反的。
35
+ - 分享卡的作品 id 读不出来:`parsedContent` 是 getter,而 `own()` 故意拒绝 accessor。
36
+ - `comment list` 和 `comment replies` 的关联信息移到结果顶层,不再每行重复。
37
+
38
+ ### 移除
39
+
40
+ - `src/operations/actions.ts` — 提案/批准模型,从未被任何命令或模块引用。它的每日额度已由 `social goal` 和 `auth grant` 覆盖。
41
+
42
+ ## 0.3.5 及更早
43
+
44
+ 版本号在这一版之前没有随功能推进,所以更早的提交没有对应的版本记录。用 `dy update --check` 的 `commit` 字段判断新旧。
package/README.en.md CHANGED
@@ -5,196 +5,185 @@
5
5
 
6
6
  <div align="center">
7
7
 
8
- # ShuaDouyin
8
+ # ShuaDouyin · 刷抖音
9
9
 
10
- **An agent that browses Douyin with a persona and a memory. Open source.**
10
+ <img src="docs/assets/shuadouyin-hero.png" alt="ShuaDouyin: browsing and search, comments and reactions, chat and sharing, live rooms, relationships, persona and memory" width="100%" />
11
11
 
12
- Browsing, comments, direct messages, live rooms, memory — one local CLI that
13
- leaves the judgement to whatever agent is driving it.
12
+ **Let your AI Agent use Douyin with a persona and a memory.**
14
13
 
15
- <img src="https://img.shields.io/badge/node-%E2%89%A522.19-339933?logo=node.js&logoColor=white" alt="Node" />
16
- <img src="https://img.shields.io/badge/license-MIT-blue" alt="License" />
17
- <img src="https://img.shields.io/github/stars/9Ashwin/ShuaDouyin?style=social" alt="Stars" />
14
+ A local command-line tool connecting your Agent, the Douyin page, and context that lasts.
15
+
16
+ <img src="https://img.shields.io/badge/node-%E2%89%A522.19-339933?logo=node.js&logoColor=white" alt="Node.js 22.19+" />
17
+ <img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT License" />
18
+ <img src="https://img.shields.io/github/stars/9Ashwin/ShuaDouyin?style=social" alt="GitHub Stars" />
19
+
20
+ [Quick start](#quick-start) · [Capabilities](#capabilities) · [Agent integration](#agent-integration) · [Development](#development-and-contributing)
18
21
 
19
22
  </div>
20
23
 
21
- ---
24
+ ## What is this?
25
+
26
+ ShuaDouyin's executable is `dy`. Give it to an AI Agent that can run shell commands to search content, inspect works and comments, interact with your authorization, handle messages and shares, visit live rooms, and keep sourced memories and relationship records.
22
27
 
23
- ## What is this
28
+ **You define the name, voice and boundaries. The Agent interprets and decides; `dy` supplies operations and evidence.** It bundles no model and schedules no tasks. It uses your existing Agent and local Chrome, with persona and memory stored locally across sessions.
24
29
 
25
- `dy` is a local command-line tool. It bundles no model, schedules nothing, and
26
- decides nothing about content — it provides the state, context and primitives
27
- one browsing round needs, and leaves the judgement to the agent calling it.
30
+ ## Quick start
28
31
 
29
- What it remembers for you: what this account likes, who it has talked to, which
30
- lines got an answer. What it will not decide for you: whether to send, what to
31
- say, or whether a person is worth knowing.
32
+ You need **Node.js 22.19+, Chrome, and an Agent that can execute shell commands**.
32
33
 
33
- ## Install
34
+ ### 1. Install the CLI and skill
34
35
 
35
36
  ```bash
36
37
  npm install -g shuadouyin
38
+ dy --version
39
+ dy skill install
37
40
  ```
38
41
 
39
- `dy` is then on your PATH. The package is `shuadouyin` and the command is `dy`;
40
- the published tarball ships a built `dist/`, so nothing compiles on install. The
41
- only requirement is a local Chrome — **no browser is downloaded**.
42
+ The npm package is `shuadouyin`; the command is `dy`. The published package includes the build output and uses your local Chrome, without downloading another browser. The skill installer detects supported Agent directories and preserves existing copies it does not manage.
42
43
 
43
- Installing from source also works, and builds once:
44
+ ### 2. Create the workspace and log in
44
45
 
45
46
  ```bash
46
- npm install -g github:9Ashwin/ShuaDouyin
47
+ dy init
48
+ dy auth login
47
49
  ```
48
50
 
49
- This package is distributed from GitHub, not the npm registry.
51
+ Scan the login QR code in the dedicated Chrome window. The default workspace is `~/.dy`; the browser login persists in `~/.dy/chrome`.
50
52
 
51
- <details>
52
- <summary><strong>Other options</strong></summary>
53
+ ### 3. Start a conversation with your Agent
53
54
 
54
- Into a private directory, without a global npm:
55
+ > Use dy to help me set up a name, voice and boundaries. Then browse five works, pick one to inspect its frames and comments, and tell me what you observed. Only read this round; do not interact.
55
56
 
56
- ```bash
57
- curl -fsSL https://raw.githubusercontent.com/9Ashwin/ShuaDouyin/main/scripts/install.sh | sh
58
- ```
57
+ You can also start with a specific task:
59
58
 
60
- Uninstall:
59
+ - **Research content:** “Search for AI coding, inspect two works, and separate what their titles, frames and comments tell us.”
60
+ - **Continue a conversation:** “Check new messages in the conversation I specify and draft a reply using the earlier context.”
61
+ - **Follow up:** “Review the people I have recorded and list follow-ups due today.”
62
+ - **Review the day:** “Summarize today's local activity and receipts, clearly separating uncertain outcomes.”
61
63
 
62
- ```bash
63
- npm uninstall -g shuadouyin
64
- ```
64
+ For manual terminal use, run `dy tui`. It needs an interactive terminal and shares the CLI's operations and state.
65
65
 
66
- Uninstalling keeps the bot, memories and account login in `~/.dy`.
66
+ ## Capabilities
67
67
 
68
- </details>
68
+ ![Six-panel comic: define a persona, search and browse, inspect works and comments, interact and share, visit live rooms, keep memory and relationships](docs/assets/shuadouyin-workflow.png)
69
+
70
+ The artwork uses Chinese labels. The character represents a configurable Agent, not a fixed persona. Four sample positions and five comments came from an actual browsing run; the scenes are redrawn illustrations. The other panels show capabilities, not messages or gifts sent during that run.
71
+
72
+ | Capability | Common entry points |
73
+ | --- | --- |
74
+ | Search works and people; browse a batch of feed items | `dy search` · `dy user search` · `dy feed sweep` |
75
+ | Read works, sample frames, inspect comments and replies | `dy video digest` · `dy comment list` · `dy comment replies` |
76
+ | Like, favorite, follow, post text or image comments | `dy video like` · `dy video favorite` · `dy user follow` · `dy comment post` · `dy comment image` |
77
+ | Read messages, send text and images, quote a reply | `dy chat read` · `dy chat send` · `dy chat image` · `dy chat reply` |
78
+ | Share a work as a link or native card | `dy chat share` · `dy chat forward` |
79
+ | Read live-room info and chat, speak, send a named and priced gift | `dy live info` · `dy live chat` · `dy live say` · `dy live gift` |
80
+ | Read persona, recall context, save sourced facts | `dy persona show` · `dy context show` · `dy memory add` |
81
+ | Derive voice from actual writing, retain lessons, check wording | `dy persona evolve` · `dy learn keep` · `dy voice check` |
82
+ | Track browsing rounds, goals, relationships and follow-ups | `dy browse start` · `dy social goal` · `dy social due` |
83
+ | Inspect write receipts; prepare and save daily reports | `dy receipt get` · `dy report prepare` · `dy report save` |
84
+
85
+ These are command entry points. Use `dy <command> --help` for required arguments, or `dy schema` for the complete command and field catalog.
86
+
87
+ ## Persona and memory across sessions
69
88
 
70
- Install the skill for an agent (optional):
89
+ The default `~/.dy` workspace separates persona, people records, memory and the browser login:
90
+
91
+ - **`AGENTS.md`** defines the Agent's identity, voice and boundaries. You can revise the settings.
92
+ - **`PROFILES.md` and `memory/`** hold people records and sourced memories. Owner statements, page observations and inferences stay distinct. Markdown is the source of truth for memory bodies.
93
+ - **`growth review`, `learn keep` and `persona evolve`** support reviewing activity, retaining lessons and deriving changes in voice. The caller decides what is worth keeping; a viewed work does not automatically become a lasting preference.
94
+
95
+ Updating or reinstalling the CLI continues to use the existing workspace. Use the reset commands below when you want to start over.
96
+
97
+ ## Agent integration
98
+
99
+ The [dy skill](skills/dy/SKILL.md) teaches Agents to use the tool, with topic-specific workflows in [references](skills/dy/references/). As an alternative to `dy skill install`, use the skills installer:
71
100
 
72
101
  ```bash
73
- dy skill install
102
+ npx skills add https://github.com/9Ashwin/ShuaDouyin --skill dy
74
103
  ```
75
104
 
76
- ## Getting started
105
+ Start each task by reading persona and relevant context:
77
106
 
78
107
  ```bash
79
- dy init # create the workspace, start onboarding
80
- dy onboarding show # four questions: name, voice, facts about you, limits
81
- dy auth login # open Chrome and scan the QR code
82
- dy feed next # next work in the recommended feed
83
- dy video info # read the current work
108
+ dy persona show
109
+ dy context show --query "The question for this task"
110
+ dy feed sweep --count 5
84
111
  ```
85
112
 
86
- The first login opens a dedicated Chrome window whose profile lives in
87
- `~/.dy/chrome`. That login is kept across restarts.
113
+ Choose a work ID from the results, open its detail page, then sample it:
88
114
 
89
- Run `dy tui` when you want to browse and like by hand — a terminal interface
90
- over the same operations. It shares the CLI's implementation, so both see the
91
- same state. It needs a real terminal and refuses `--dry-run`.
115
+ ```bash
116
+ dy video open <video-id>
117
+ dy video digest --video-id <video-id> --limit 5
118
+ ```
92
119
 
93
- ## What it does
120
+ `dy guide` returns instructions matching the installed version; `dy schema` describes commands, arguments and effects. Run one workspace operation at a time to avoid account-lock conflicts.
94
121
 
95
- | Task | Commands |
96
- | --- | --- |
97
- | Browse the feed | `dy feed open` / `dy feed next` / `dy video info` |
98
- | Read works and comments | `dy video info` / `dy comment list` / `dy comment replies` |
99
- | Interact | `dy video like` / `dy video favorite` / `dy comment post` / `dy comment reply` |
100
- | Direct messages | `dy chat list` / `dy chat read` / `dy chat send` / `dy chat image` |
101
- | People | `dy user get` / `dy user search` / `dy user followers` / `dy user follow` |
102
- | Live rooms | `dy live info` / `dy live chat` / `dy live say` / `dy live gift` |
103
- | Search | `dy search` / `dy user search` |
104
- | Memory and persona | `dy memory add` / `dy memory search` / `dy context show` |
105
- | Browsing rounds | `dy browse start` / `dy browse watch` / `dy browse end` |
106
- | Relationships | `dy social goal` / `dy social list` / `dy social due` / `dy social log` |
107
- | Teach an agent to use it | `dy guide` |
122
+ Success emits `{ok:true,data}` to stdout. Failure emits `{ok:false,error}` to stderr and exits nonzero. Writes use a unique `--request-id`. The `--dry-run` option validates input and the plan without connecting to Chrome, filling inputs or sending. See [docs/contracts.md](docs/contracts.md) for the full contract.
108
123
 
109
- See `dy schema` for every command, or `dy <command> --help`.
124
+ ## Actions and evidence
110
125
 
111
- ## For agents
126
+ - **A receipt before dispatch.** Replaying a confirmed request ID returns the saved receipt. Inspect `delivery_uncertain` outcomes instead of automatically resending. Native-card sharing currently cannot verify delivery and keeps dispatched shares uncertain.
127
+ - **Stable identities.** Use the work, user and conversation IDs returned by the CLI. Display names are only labels.
128
+ - **Samples are not full viewing.** Lists contain loaded content and generally report `complete: false`. The live picture is not returned as readable content. The Agent draws conclusions from the evidence it actually has.
129
+ - **External actions need authorization.** Comments, messages, follows and live chat affect a real account. Gifts cost money and require explicit agreement plus a name-and-price check. Deletion and recall depend on platform conditions and cannot guarantee that content was unseen.
130
+ - **Local login and data.** Automation may trigger verification, rate limits or account penalties. A person must complete verification; the project offers no bypass. `~/.dy` contains login state, messages and memories and should not be committed or shared. See [SECURITY.md](SECURITY.md).
131
+
132
+ ## Installation options and workspace management
133
+
134
+ <details>
135
+ <summary><strong>Other installation methods, uninstall and reset</strong></summary>
112
136
 
113
- `dy` is built for an agent to drive. Hand it to anything that can run a shell:
137
+ Install from GitHub source, which runs a build:
114
138
 
115
139
  ```bash
116
- dy guide # the full usage guide (~9000 characters); this is what the agent reads
140
+ npm install -g github:9Ashwin/ShuaDouyin
117
141
  ```
118
142
 
119
- Or install `skills/dy` into your agent's skill directory. It carries five
120
- references: browsing and growth, memory and persona, reports, what to do when
121
- something fails, and **platform facts** — the last one is the record of what
122
- this project got wrong on the real page, and reading it saves repeating that.
123
-
124
- ## Principles
125
-
126
- - **No judgement.** The CLI returns facts and candidates; the caller decides.
127
- It acts on a real account, so the code's job is to make every action auditable
128
- and reversible — not to decide whether the action is appropriate.
129
- - **A receipt before anything leaves.** Every write lands on disk before it can
130
- dispatch, and replaying a request ID returns the original receipt. A
131
- `delivery_uncertain` write is never retried automatically: it may already be
132
- out, and sending again makes two.
133
- - **Identity is a stable id.** Display names collide and change; `sec_uid` does
134
- not.
135
- - **Report what is readable.** The live picture is a canvas with no text layer,
136
- so nothing is claimed about it. Comment lists are sampled and say so.
137
- - **Memory belongs to the account.** A new install is a new bot; it does not
138
- inherit anyone else's conclusions.
139
-
140
- ## Reset
143
+ On macOS / Linux, an installer can use a private installation directory:
141
144
 
142
145
  ```bash
143
- dy bot reset # show what would be cleared
144
- dy bot reset --write # back up to ~/.dy-backup-<time>, then clear
145
- dy init # create a fresh bot
146
+ curl -fsSL https://raw.githubusercontent.com/9Ashwin/ShuaDouyin/main/scripts/install.sh | sh
146
147
  ```
147
148
 
148
- The Chrome login is kept, so no new scan is needed.
149
+ Check installed skill copies against the current version:
149
150
 
150
- ## Development
151
+ ```bash
152
+ dy skill status
153
+ ```
151
154
 
152
- Requires Node.js 22.19+, pnpm, and a local Chrome.
155
+ Remove an npm global installation while retaining `~/.dy`:
153
156
 
154
157
  ```bash
155
- pnpm install --frozen-lockfile --ignore-scripts
156
- pnpm build
157
- pnpm test # unit tests
158
- pnpm test:browser # isolated Chrome tests
159
- pnpm check # Biome + tsc
158
+ npm uninstall -g shuadouyin
160
159
  ```
161
160
 
162
- Output contracts, receipt states and storage semantics are in
163
- [docs/contracts.md](docs/contracts.md). Source layout, module ownership and the
164
- check sequence are in [AGENTS.md](AGENTS.md).
161
+ Reset persona, memories and activity after a backup; keep the Chrome login:
165
162
 
166
- ## Risks and limits
163
+ ```bash
164
+ dy bot reset # preview the scope
165
+ dy bot reset --write # back up and reset; use the returned backup path
166
+ dy init # create the workspace again
167
+ ```
167
168
 
168
- This tool drives a real Douyin account. Using it means accepting the following:
169
+ </details>
169
170
 
170
- - **The account risk is yours.** Automated use of Douyin may trigger human
171
- verification, rate limits or penalties. The project offers no bypass and will
172
- not help you evade them. When a challenge appears, a person has to solve it in
173
- the headed Chrome window.
174
- - **What is sent cannot be taken back.** Comments, direct messages, danmaku and
175
- gifts are public and irreversible, and gifts cost real money. Check the target
176
- and the text first; `--dry-run` shows the plan without acting.
177
- - **Local state is sensitive.** `~/.dy` holds the login, everything that was read
178
- and the long-term memory. Do not commit it, screenshot it or put it somewhere
179
- shared. See [SECURITY.md](SECURITY.md).
180
- - **What you read is not everything.** Lists are sampled and say
181
- `complete: false`; the live picture is a canvas with no text. Concluding from a
182
- sample is your judgement, not the tool's finding.
183
- - **It does not decide.** Whether to send, to whom, or whether a person is worth
184
- knowing is not a decision the commands make, and being driven by an agent does
185
- not lower that bar.
171
+ ## Development and contributing
186
172
 
187
- ## Status
173
+ Requires Node.js 22.19+, pnpm, and local Chrome.
188
174
 
189
- Early. Commands, error codes and response fields are public contracts and are
190
- kept stable; the database schema migrates with each release. CI runs the unit
191
- and isolated-Chrome tests on Ubuntu, macOS and Windows.
175
+ ```bash
176
+ pnpm install --frozen-lockfile --ignore-scripts
177
+ pnpm build
178
+ pnpm check # Biome + TypeScript
179
+ pnpm test # unit tests
180
+ pnpm test:browser # temporary Chrome profile and fixture pages
181
+ ```
192
182
 
193
- ## Contributing
183
+ Browser tests use no account credentials. Passing them does not prove behavior on the real Douyin page. The project is early, and page changes can affect operations; error codes, arguments and response fields are maintained as public contracts.
194
184
 
195
- See [CONTRIBUTING.md](CONTRIBUTING.md). Report security problems privately per
196
- [SECURITY.md](SECURITY.md).
185
+ See [AGENTS.md](AGENTS.md) for development rules, [docs/architecture.md](docs/architecture.md) for the architecture, [CONTRIBUTING.md](CONTRIBUTING.md) to contribute, and [CHANGELOG.md](CHANGELOG.md) for release changes.
197
186
 
198
187
  ## License
199
188
 
200
- MIT
189
+ [MIT](LICENSE)