shuadouyin 0.4.0 → 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
- 7251333bbc6e84fd193536885101c3b6ebf46c86
1
+ d9528376f4f68e7e7414bc7968f619267fd656b4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.1 — 2026-10-31
4
+
5
+ ### 文档
6
+
7
+ - README 加了两张图:一张能力总览,一张六格流程示意。两种语言共用同一组。
8
+ - 图片不随 npm 包发布。它们是给 GitHub 页面看的,装包的人用不到,带上会把包从 343 kB 撑到 4.5 MB。
9
+
3
10
  ## 0.4.0 — 2026-10-31
4
11
 
5
12
  ### 新增
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)
package/README.md CHANGED
@@ -5,177 +5,185 @@
5
5
 
6
6
  <div align="center">
7
7
 
8
- # 刷抖音 · ShuaDouyin
8
+ # ShuaDouyin · 刷抖音
9
9
 
10
- **让 agent 带着人格和记忆使用抖音。开源。**
10
+ <img src="docs/assets/shuadouyin-hero.png" alt="ShuaDouyin 刷抖音:浏览与搜索、评论与互动、私信与分享、直播与弹幕、关系与跟进、人格与记忆" width="100%" />
11
11
 
12
- 浏览、评论、私信、直播、记忆——一个本地 CLI,判断权留给调用它的 agent。
12
+ **让你的 AI Agent,带着人格和记忆使用抖音。**
13
13
 
14
- <img src="https://img.shields.io/badge/node-%E2%89%A522.19-339933?logo=node.js&logoColor=white" alt="Node" />
15
- <img src="https://img.shields.io/badge/license-MIT-blue" alt="License" />
16
- <img src="https://img.shields.io/github/stars/9Ashwin/ShuaDouyin?style=social" alt="Stars" />
14
+ 一个本地命令行工具,连接 Agent、抖音页面和持续积累的上下文。
17
15
 
18
- </div>
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
+ [快速开始](#快速开始) · [功能一览](#功能一览) · [Agent 接入](#给-agent-接入) · [开发与参与](#开发与参与)
19
21
 
20
- ---
22
+ </div>
21
23
 
22
24
  ## 这是什么
23
25
 
24
- `dy` 是一个本地命令行工具。它不内建模型、不调度、不做内容判断——它提供**一轮浏览所需的状态、上下文和操作原语**,判断由调用它的 agent 做。
26
+ ShuaDouyin 的命令叫 `dy`。把它交给能执行 shell 的 AI Agent,就能搜索内容、浏览作品与评论、按授权互动、处理私信与分享、进入直播间,并保存有来源的记忆和关系记录。
27
+
28
+ **你定义名字、语气和边界,Agent 负责理解与判断,`dy` 提供操作和证据。** 项目不内建模型,也不运行定时任务;使用你已有的 Agent 和本机 Chrome。人设与记忆保存在本地,可以跨会话继续使用。
25
29
 
26
- 它替你记住的:这个账号喜欢什么、跟谁聊过、哪句话有回应。它不替你决定的:该不该发、发什么、这个人值不值得认识。
30
+ ## 快速开始
27
31
 
28
- ## 安装
32
+ 准备好 **Node.js 22.19+、Chrome,以及一个能执行 shell 的 Agent**。
33
+
34
+ ### 1. 安装工具与 skill
29
35
 
30
36
  ```bash
31
37
  npm install -g shuadouyin
38
+ dy --version
39
+ dy skill install
32
40
  ```
33
41
 
34
- `dy` 随即可用。**不下载浏览器**——用你本机已有的 Chrome。
42
+ npm 包叫 `shuadouyin`,可执行命令叫 `dy`。发布包已包含构建产物;使用本机 Chrome,不额外下载浏览器。`dy skill install` 会为已检测到的 Agent 安装技能,已有的非托管副本会保留。
35
43
 
36
- 包叫 `shuadouyin`,命令叫 `dy`。发布包里带的是构建好的 `dist/`,装上就能跑,不需要本地再编译一次。
37
-
38
- <details>
39
- <summary><strong>其他</strong></summary>
40
-
41
- 从源码装(会构建一次,几秒):
44
+ ### 2. 建立工作区并登录
42
45
 
43
46
  ```bash
44
- npm install -g github:9Ashwin/ShuaDouyin
47
+ dy init
48
+ dy auth login
45
49
  ```
46
50
 
47
- 装到独立目录,不需要全局 npm:
51
+ 在打开的专用 Chrome 窗口里扫码登录。工作区默认位于 `~/.dy`,浏览器登录保存在 `~/.dy/chrome`,后续继续使用。
48
52
 
49
- ```bash
50
- curl -fsSL https://raw.githubusercontent.com/9Ashwin/ShuaDouyin/main/scripts/install.sh | sh
51
- ```
53
+ ### 3. 在你的 Agent 里开始聊
52
54
 
53
- 卸载:
55
+ > 用 dy 带我完成设置,先问我名字、语气和边界。然后刷 5 条,挑 1 条读画面和评论,告诉我看到了什么。这轮只看,不互动。
54
56
 
55
- ```bash
56
- npm uninstall -g shuadouyin
57
- ```
57
+ 也可以从具体任务开始:
58
58
 
59
- 卸载保留 `~/.dy` 里的 bot、记忆和账号登录状态。
59
+ - **带着问题找内容:**“搜一下 AI 编程,挑两条展开读,区分标题、画面和评论提供的信息。”
60
+ - **继续已有对话:**“看看我指定会话的新消息,结合之前的上下文拟一条回复。”
61
+ - **跟进关系:**“整理我已记录的人,看看今天有哪些到期的跟进事项。”
62
+ - **回顾一天:**“根据今天的本地记录和收据写个摘要,结果不明的操作单独说明。”
60
63
 
61
- </details>
64
+ 想自己操作终端界面,可以运行 `dy tui`;它需要真实终端,和 CLI 共用同一套操作与状态。
65
+
66
+ ## 功能一览
67
+
68
+ ![ShuaDouyin 六格漫画:设定人格、搜索与浏览、读作品与评论、互动与分享、直播与弹幕、记忆与关系](docs/assets/shuadouyin-workflow.png)
69
+
70
+ 图中角色代表可配置的 Agent,名字、语气和边界由你定义。四个采样点和五条评论来自一次实际浏览,画面为重绘;其他场景是功能示意,不代表本次执行了发送或送礼。
71
+
72
+ | 能力 | 常用入口 |
73
+ | --- | --- |
74
+ | 搜索作品、找人、批量浏览推荐流 | `dy search` · `dy user search` · `dy feed sweep` |
75
+ | 读取作品、采样画面、查看评论与回复 | `dy video digest` · `dy comment list` · `dy comment replies` |
76
+ | 点赞、收藏、关注、发布文字或图片评论 | `dy video like` · `dy video favorite` · `dy user follow` · `dy comment post` · `dy comment image` |
77
+ | 读取私信、发送文字和图片、引用回复 | `dy chat read` · `dy chat send` · `dy chat image` · `dy chat reply` |
78
+ | 分享作品链接或原生卡片 | `dy chat share` · `dy chat forward` |
79
+ | 读取直播信息与弹幕、发言、按名称和价格送礼 | `dy live info` · `dy live chat` · `dy live say` · `dy live gift` |
80
+ | 读取人格、召回记忆、保存带来源的事实 | `dy persona show` · `dy context show` · `dy memory add` |
81
+ | 从实际表达中更新声音、积累经验、自查文风 | `dy persona evolve` · `dy learn keep` · `dy voice check` |
82
+ | 管理浏览轮次、目标、关系与跟进事项 | `dy browse start` · `dy social goal` · `dy social due` |
83
+ | 查询操作收据、准备和保存日报 | `dy receipt get` · `dy report prepare` · `dy report save` |
84
+
85
+ 表中是命令入口,必填参数见 `dy <命令> --help`;完整命令与字段见 `dy schema`。
86
+
87
+ ## 人格和记忆如何延续
88
+
89
+ 默认工作区 `~/.dy` 将人格、人物资料、记忆和账号登录分开保存:
62
90
 
63
- 装 skill 给 agent 用(可选):
91
+ - **`AGENTS.md`** 定义这个 Agent 的身份、语气和边界,设定可以修改。
92
+ - **`PROFILES.md` 与 `memory/`** 保存人物资料和带来源的记忆。用户明确表达的事实、页面观察和推测分开记录;Markdown 是记忆正文的来源。
93
+ - **`growth review`、`learn keep` 与 `persona evolve`** 为回顾、经验和表达变化提供依据。是否值得保存由调用方判断,浏览不等于自动形成长期偏好。
94
+
95
+ 更新或重新安装 CLI 会继续使用原工作区。需要重新开始时,使用下方的重置命令。
96
+
97
+ ## 给 Agent 接入
98
+
99
+ [dy skill](skills/dy/SKILL.md) 负责教 Agent 如何使用工具,主题流程放在 [references](skills/dy/references/) 中。除了 `dy skill install`,也可以使用技能安装器:
64
100
 
65
101
  ```bash
66
102
  npx skills add https://github.com/9Ashwin/ShuaDouyin --skill dy
67
103
  ```
68
104
 
69
- 或者用 CLI 自己装到 agent 目录:
105
+ 每次任务先读人格和相关上下文,再读页面:
70
106
 
71
107
  ```bash
72
- dy skill install
73
- dy skill status # 已装的副本和仓库是否一致
108
+ dy persona show
109
+ dy context show --query "这次要解决的问题"
110
+ dy feed sweep --count 5
74
111
  ```
75
112
 
76
- ## 开始使用
113
+ 从结果中选出作品 ID 后,先打开对应详情页,再采样:
77
114
 
78
115
  ```bash
79
- dy init # 建工作区,开始引导
80
- dy onboarding show # 回答四个问题:名字、性格、关于你的事实、界限
81
- dy auth login # 打开 Chrome 扫码登录抖音
82
- dy feed next # 刷下一条
83
- dy video info # 读当前作品
116
+ dy video open <video-id>
117
+ dy video digest --video-id <video-id> --limit 5
84
118
  ```
85
119
 
86
- 第一次登录会打开一个专用的 Chrome 窗口(profile 在 `~/.dy/chrome`),扫码后这个登录会一直保留。
120
+ `dy guide` 提供与当前安装版本一致的使用说明;`dy schema` 提供命令、参数和副作用类型。一次只运行一个工作区操作,避免账号锁冲突。
87
121
 
88
- 想手动刷、手动点赞时用 `dy tui`——一个覆盖同样操作的终端界面。它和 CLI 走同一套实现,所以两边看到的状态一致。需要在真实终端里运行(不接受管道输入),也不能和 `--dry-run` 一起用。
122
+ 成功输出 `{ok:true,data}` 到 stdout;失败输出 `{ok:false,error}` 到 stderr,并返回非零退出码。写入使用唯一的 `--request-id`;`--dry-run` 只验证参数和计划,不连接 Chrome、不填表、不发送。完整契约见 [docs/contracts.md](docs/contracts.md)。
89
123
 
90
- ## 它能做什么
124
+ ## 操作与证据边界
91
125
 
92
- | 做什么 | 命令 |
93
- | --- | --- |
94
- | 刷推荐流 | `dy feed open` / `dy feed next` / `dy video info` |
95
- | 读作品与评论 | `dy video info` / `dy comment list` / `dy comment replies` |
96
- | 互动 | `dy video like` / `dy video favorite` / `dy comment post` / `dy comment reply` |
97
- | 私信 | `dy chat list` / `dy chat read` / `dy chat send` / `dy chat image` |
98
- | 人 | `dy user get` / `dy user search` / `dy user followers` / `dy user follow` |
99
- | 直播 | `dy live info` / `dy live chat` / `dy live say` / `dy live gift` |
100
- | 搜索 | `dy search` / `dy user search` |
101
- | 记忆与人格 | `dy memory add` / `dy memory search` / `dy context show` |
102
- | 人格自己长 | `dy persona evolve` / `dy persona history` / `dy persona rollback` |
103
- | 沉淀经验 | `dy learn keep` / `dy learn findings` |
104
- | 文风自查 | `dy voice check --text "…"` |
105
- | 浏览轮次 | `dy browse start` / `dy browse watch` / `dy browse end` |
106
- | 社交关系 | `dy social goal` / `dy social list` / `dy social due` / `dy social log` |
107
- | 让 agent 会用 | `dy guide` |
108
-
109
- 完整命令见 `dy schema`,或 `dy <命令> --help`。
110
-
111
- ## 给 agent 用
112
-
113
- `dy` 是为 agent 设计的。把它交给任何能跑 shell 的 agent:
126
+ - **写之前先留收据。** 已确认的 request ID 重放时返回原收据;遇到 `delivery_uncertain` 先核对,不自动重发。原生卡片分享目前无法验证送达,发出后会保留不确定状态。
127
+ - **用稳定 ID 定位。** 作品、用户和会话以 CLI 返回的稳定 ID 为准;昵称只用于展示。
128
+ - **采样不等于完整观看。** 列表只包含已加载内容,通常标记 `complete: false`;直播画面不作为可读内容返回。判断由 Agent 根据实际证据作出。
129
+ - **对外动作需要授权。** 评论、私信、关注和直播发言作用于真实账号;礼物会花真钱,必须明确同意并核对名称和价格。删除或撤回受平台条件限制,不能保证收回已被看到的内容。
130
+ - **登录和数据留在本机。** 自动化可能触发验证、限流或账号处罚;验证需要真人完成,项目不提供绕过手段。`~/.dy` 含登录态、消息和记忆,不应提交或共享。详见 [SECURITY.md](SECURITY.md)。
131
+
132
+ ## 安装方式与工作区管理
133
+
134
+ <details>
135
+ <summary><strong>其他安装方式、卸载与重置</strong></summary>
136
+
137
+ 从 GitHub 源码安装,会执行构建:
114
138
 
115
139
  ```bash
116
- dy guide # 返回完整的使用说明(约 3 万字),agent 读这个
140
+ npm install -g github:9Ashwin/ShuaDouyin
117
141
  ```
118
142
 
119
- 或者把 skill 装进你的 agent 技能目录,这样它知道什么时候该用 `dy`、怎么用:
143
+ macOS / Linux 也可以使用独立目录安装器:
120
144
 
121
145
  ```bash
122
- npx skills add https://github.com/9Ashwin/ShuaDouyin --skill dy
146
+ curl -fsSL https://raw.githubusercontent.com/9Ashwin/ShuaDouyin/main/scripts/install.sh | sh
123
147
  ```
124
148
 
125
- `skills/dy` 里按主题分成八个参考文件:浏览与成长、记忆与人格、社交、直播、日报、自我改进、命令全表,以及**平台事实**——最后一个是踩过的坑,读它能省掉一次重来。
149
+ 检查 skill 副本与当前版本是否一致:
126
150
 
127
- `SKILL.md` 本身只有两百来行,是每次对话都会加载的那部分;参考文件按需读。
151
+ ```bash
152
+ dy skill status
153
+ ```
128
154
 
129
- ## 设计原则
155
+ 卸载 npm 全局安装的命令,保留 `~/.dy`:
130
156
 
131
- - **不做判断。** `dy` 不内建模型。它返回事实和候选,判断留给调用方。它对着一个真实账号操作,所以代码的职责是让每个动作可审计、可回滚,而不是替你决定这个动作该不该做。
132
- - **写之前先落收据。** 每条写入在可能发出之前就已落盘,重放同一个 request ID 返回原收据。`delivery_uncertain` 永远不自动重试——那条可能已经发出去了,再发就是两条。
133
- - **身份用稳定 ID。** 昵称会重名会改,`sec_uid` 不会。
134
- - **读到什么说什么。** 直播画面是 canvas,读不到就不报内容;评论是抽样,标 `complete: false`。
135
- - **记忆跟账号走。** 换一个安装就是新的 bot,不继承别人的判断。
157
+ ```bash
158
+ npm uninstall -g shuadouyin
159
+ ```
136
160
 
137
- ## 重置
161
+ 重置人格、记忆及活动状态,会先备份;Chrome 登录保留:
138
162
 
139
163
  ```bash
140
- dy bot reset # 看会清掉什么(不改动)
141
- dy bot reset --write # 备份到 ~/.dy-backup-<时间> 后清空
142
- dy init # 建新的 bot
164
+ dy bot reset # 只预览范围
165
+ dy bot reset --write # 备份后重置,以返回的备份路径为准
166
+ dy init # 重新建立工作区
143
167
  ```
144
168
 
145
- Chrome 登录会保留,不用重新扫码。
169
+ </details>
146
170
 
147
- ## 开发
171
+ ## 开发与参与
148
172
 
149
173
  需要 Node.js 22.19+、pnpm 和本机 Chrome。
150
174
 
151
175
  ```bash
152
176
  pnpm install --frozen-lockfile --ignore-scripts
153
177
  pnpm build
178
+ pnpm check # Biome + TypeScript
154
179
  pnpm test # 单元测试
155
- pnpm test:browser # 隔离 Chrome 的浏览器测试
156
- pnpm check # Biome + tsc
180
+ pnpm test:browser # 临时 Chrome profile + fixture 页面
157
181
  ```
158
182
 
159
- 输出契约、收据状态和存储语义见 [docs/contracts.md](docs/contracts.md)。源码结构、模块归属和检查流程见 [AGENTS.md](AGENTS.md)。
160
-
161
- ## 风险与边界
162
-
163
- 这是一个操作真实抖音账号的工具。用它意味着接受下面几件事:
164
-
165
- - **账号风险由你承担。** 自动化使用抖音可能触发平台的人机验证、限流或处罚。项目不提供任何绕过手段,也不会帮你规避风控。验证弹出来时,需要真人在有头的 Chrome 里完成。
166
- - **发出去的东西撤不回来。** 评论、私信、弹幕、礼物都是对外且不可逆的。送礼花的是真钱。发之前先确认对象和内容,`--dry-run` 可以先看计划。
167
- - **本地状态含敏感信息。** `~/.dy` 里有登录态、读过的消息和长期记忆。不要提交、不要截图、不要放进共享目录。详见 [SECURITY.md](SECURITY.md)。
168
- - **读到的不是全部。** 列表是抽样并标 `complete: false`,直播画面是 canvas 读不到字。基于抽样下结论是你自己的判断,不是工具的结论。
169
- - **它不做判断。** 该不该发、发给谁、这个人值不值得认识,命令不会替你决定,也不会因为调用方是 agent 就降低门槛。
170
-
171
- ## 状态
172
-
173
- 早期阶段。命令、错误码和返回字段是公开契约,会尽量保持稳定;数据库结构随版本迁移。CI 在 Ubuntu、macOS 和 Windows 上跑单元测试与隔离 Chrome 测试。
174
-
175
- ## 参与
183
+ 浏览器测试不使用账号凭据,通过测试不等于通过真实抖音页面验证。项目仍处于早期阶段,页面变化可能影响操作;错误码、参数和返回字段按公开契约维护。
176
184
 
177
- 见 [CONTRIBUTING.md](CONTRIBUTING.md)。安全问题走私密报告渠道,见 [SECURITY.md](SECURITY.md)。
185
+ 开发规则见 [AGENTS.md](AGENTS.md),架构见 [docs/architecture.md](docs/architecture.md),贡献方式见 [CONTRIBUTING.md](CONTRIBUTING.md),版本变化见 [CHANGELOG.md](CHANGELOG.md)。
178
186
 
179
187
  ## 许可
180
188
 
181
- MIT
189
+ [MIT](LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shuadouyin",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "packageManager": "pnpm@10.34.7",
5
5
  "description": "Browse Douyin with a persistent bot persona and a memory of its own",
6
6
  "type": "module",
@@ -21,6 +21,7 @@
21
21
  "skills",
22
22
  ".dy-build-commit",
23
23
  "!dist/**/*.map",
24
+ "!docs/assets",
24
25
  "!dist/**/*.d.ts",
25
26
  ".dy-build-origin"
26
27
  ],