@jackwener/opencli 1.5.5 → 1.5.7
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/CHANGELOG.md +26 -0
- package/README.md +31 -4
- package/README.zh-CN.md +40 -5
- package/SKILL.md +1 -1
- package/dist/browser/cdp.d.ts +1 -0
- package/dist/browser/cdp.js +30 -27
- package/dist/browser/daemon-client.d.ts +11 -1
- package/dist/browser/daemon-client.js +3 -0
- package/dist/browser/dom-helpers.js +1 -0
- package/dist/browser/dom-helpers.test.js +14 -1
- package/dist/browser/mcp.js +18 -13
- package/dist/browser/page.d.ts +6 -0
- package/dist/browser/page.js +37 -2
- package/dist/browser/page.test.d.ts +1 -0
- package/dist/browser/page.test.js +44 -0
- package/dist/browser/stealth.js +198 -0
- package/dist/browser/stealth.test.d.ts +1 -0
- package/dist/browser/stealth.test.js +134 -0
- package/dist/browser.test.js +1 -1
- package/dist/build-manifest.d.ts +1 -0
- package/dist/build-manifest.js +5 -1
- package/dist/build-manifest.test.js +2 -0
- package/dist/cli-manifest.json +1821 -252
- package/dist/cli.js +20 -3
- package/dist/clis/antigravity/serve.d.ts +1 -1
- package/dist/clis/antigravity/serve.js +5 -8
- package/dist/clis/band/bands.d.ts +1 -0
- package/dist/clis/band/bands.js +72 -0
- package/dist/clis/band/mentions.d.ts +1 -0
- package/dist/clis/band/mentions.js +127 -0
- package/dist/clis/band/post.d.ts +1 -0
- package/dist/clis/band/post.js +175 -0
- package/dist/clis/band/posts.d.ts +1 -0
- package/dist/clis/band/posts.js +94 -0
- package/dist/clis/bilibili/subtitle.js +4 -0
- package/dist/clis/bilibili/subtitle.test.d.ts +1 -0
- package/dist/clis/bilibili/subtitle.test.js +48 -0
- package/dist/clis/chatwise/ask.js +0 -2
- package/dist/clis/chatwise/export.js +0 -2
- package/dist/clis/chatwise/history.js +0 -2
- package/dist/clis/chatwise/model.js +0 -2
- package/dist/clis/chatwise/new.js +1 -2
- package/dist/clis/chatwise/read.js +0 -2
- package/dist/clis/chatwise/screenshot.js +1 -2
- package/dist/clis/chatwise/send.js +0 -2
- package/dist/clis/chatwise/status.js +1 -2
- package/dist/clis/ctrip/search.d.ts +13 -0
- package/dist/clis/ctrip/search.js +73 -48
- package/dist/clis/ctrip/search.test.d.ts +1 -0
- package/dist/clis/ctrip/search.test.js +64 -0
- package/dist/clis/doubao/detail.d.ts +1 -0
- package/dist/clis/doubao/detail.js +33 -0
- package/dist/clis/doubao/detail.test.d.ts +1 -0
- package/dist/clis/doubao/detail.test.js +42 -0
- package/dist/clis/doubao/history.d.ts +1 -0
- package/dist/clis/doubao/history.js +28 -0
- package/dist/clis/doubao/history.test.d.ts +1 -0
- package/dist/clis/doubao/history.test.js +37 -0
- package/dist/clis/doubao/meeting-summary.d.ts +1 -0
- package/dist/clis/doubao/meeting-summary.js +39 -0
- package/dist/clis/doubao/meeting-transcript.d.ts +1 -0
- package/dist/clis/doubao/meeting-transcript.js +36 -0
- package/dist/clis/doubao/utils.d.ts +27 -0
- package/dist/clis/doubao/utils.js +317 -0
- package/dist/clis/doubao/utils.test.d.ts +1 -0
- package/dist/clis/doubao/utils.test.js +24 -0
- package/dist/clis/douyin/_shared/public-api.d.ts +33 -0
- package/dist/clis/douyin/_shared/public-api.js +29 -0
- package/dist/clis/douyin/_shared/sts2.js +8 -2
- package/dist/clis/douyin/_shared/sts2.test.d.ts +1 -0
- package/dist/clis/douyin/_shared/sts2.test.js +27 -0
- package/dist/clis/douyin/activities.js +4 -2
- package/dist/clis/douyin/activities.test.js +34 -1
- package/dist/clis/douyin/collections.js +1 -1
- package/dist/clis/douyin/collections.test.js +24 -2
- package/dist/clis/douyin/draft.d.ts +8 -11
- package/dist/clis/douyin/draft.js +302 -185
- package/dist/clis/douyin/draft.test.d.ts +1 -1
- package/dist/clis/douyin/draft.test.js +357 -2
- package/dist/clis/douyin/hashtag.js +9 -2
- package/dist/clis/douyin/hashtag.test.js +35 -2
- package/dist/clis/douyin/profile.js +1 -1
- package/dist/clis/douyin/profile.test.js +36 -1
- package/dist/clis/douyin/user-videos.d.ts +5 -0
- package/dist/clis/douyin/user-videos.js +74 -0
- package/dist/clis/douyin/user-videos.test.d.ts +1 -0
- package/dist/clis/douyin/user-videos.test.js +108 -0
- package/dist/clis/douyin/videos.js +22 -5
- package/dist/clis/douyin/videos.test.js +45 -2
- package/dist/clis/facebook/search.test.d.ts +5 -0
- package/dist/clis/facebook/search.test.js +60 -0
- package/dist/clis/facebook/search.yaml +4 -3
- package/dist/clis/instagram/download.d.ts +16 -0
- package/dist/clis/instagram/download.js +225 -0
- package/dist/clis/instagram/download.test.d.ts +1 -0
- package/dist/clis/instagram/download.test.js +118 -0
- package/dist/clis/notebooklm/bind-current.d.ts +1 -0
- package/dist/clis/notebooklm/bind-current.js +29 -0
- package/dist/clis/notebooklm/bind-current.test.d.ts +1 -0
- package/dist/clis/notebooklm/bind-current.test.js +35 -0
- package/dist/clis/notebooklm/binding.test.d.ts +1 -0
- package/dist/clis/notebooklm/binding.test.js +44 -0
- package/dist/clis/notebooklm/compat.test.d.ts +3 -0
- package/dist/clis/notebooklm/compat.test.js +16 -0
- package/dist/clis/notebooklm/current.d.ts +1 -0
- package/dist/clis/notebooklm/current.js +28 -0
- package/dist/clis/notebooklm/get.d.ts +1 -0
- package/dist/clis/notebooklm/get.js +37 -0
- package/dist/clis/notebooklm/history.d.ts +1 -0
- package/dist/clis/notebooklm/history.js +25 -0
- package/dist/clis/notebooklm/history.test.d.ts +1 -0
- package/dist/clis/notebooklm/history.test.js +58 -0
- package/dist/clis/notebooklm/list.d.ts +1 -0
- package/dist/clis/notebooklm/list.js +35 -0
- package/dist/clis/notebooklm/note-list.d.ts +1 -0
- package/dist/clis/notebooklm/note-list.js +28 -0
- package/dist/clis/notebooklm/note-list.test.d.ts +1 -0
- package/dist/clis/notebooklm/note-list.test.js +56 -0
- package/dist/clis/notebooklm/notes-get.d.ts +1 -0
- package/dist/clis/notebooklm/notes-get.js +47 -0
- package/dist/clis/notebooklm/notes-get.test.d.ts +1 -0
- package/dist/clis/notebooklm/notes-get.test.js +72 -0
- package/dist/clis/notebooklm/rpc.d.ts +36 -0
- package/dist/clis/notebooklm/rpc.js +189 -0
- package/dist/clis/notebooklm/rpc.test.d.ts +1 -0
- package/dist/clis/notebooklm/rpc.test.js +105 -0
- package/dist/clis/notebooklm/shared.d.ts +87 -0
- package/dist/clis/notebooklm/shared.js +3 -0
- package/dist/clis/notebooklm/source-fulltext.d.ts +1 -0
- package/dist/clis/notebooklm/source-fulltext.js +44 -0
- package/dist/clis/notebooklm/source-fulltext.test.d.ts +1 -0
- package/dist/clis/notebooklm/source-fulltext.test.js +106 -0
- package/dist/clis/notebooklm/source-get.d.ts +1 -0
- package/dist/clis/notebooklm/source-get.js +40 -0
- package/dist/clis/notebooklm/source-get.test.d.ts +1 -0
- package/dist/clis/notebooklm/source-get.test.js +84 -0
- package/dist/clis/notebooklm/source-guide.d.ts +1 -0
- package/dist/clis/notebooklm/source-guide.js +44 -0
- package/dist/clis/notebooklm/source-guide.test.d.ts +1 -0
- package/dist/clis/notebooklm/source-guide.test.js +104 -0
- package/dist/clis/notebooklm/source-list.d.ts +1 -0
- package/dist/clis/notebooklm/source-list.js +30 -0
- package/dist/clis/notebooklm/status.d.ts +1 -0
- package/dist/clis/notebooklm/status.js +31 -0
- package/dist/clis/notebooklm/summary.d.ts +1 -0
- package/dist/clis/notebooklm/summary.js +30 -0
- package/dist/clis/notebooklm/summary.test.d.ts +1 -0
- package/dist/clis/notebooklm/summary.test.js +78 -0
- package/dist/clis/notebooklm/utils.d.ts +37 -0
- package/dist/clis/notebooklm/utils.js +739 -0
- package/dist/clis/notebooklm/utils.test.d.ts +1 -0
- package/dist/clis/notebooklm/utils.test.js +390 -0
- package/dist/clis/ones/common.d.ts +32 -0
- package/dist/clis/ones/common.js +144 -0
- package/dist/clis/ones/enrich-tasks.d.ts +5 -0
- package/dist/clis/ones/enrich-tasks.js +37 -0
- package/dist/clis/ones/login.d.ts +1 -0
- package/dist/clis/ones/login.js +80 -0
- package/dist/clis/ones/logout.d.ts +1 -0
- package/dist/clis/ones/logout.js +17 -0
- package/dist/clis/ones/me.d.ts +1 -0
- package/dist/clis/ones/me.js +30 -0
- package/dist/clis/ones/my-tasks.d.ts +1 -0
- package/dist/clis/ones/my-tasks.js +120 -0
- package/dist/clis/ones/resolve-labels.d.ts +10 -0
- package/dist/clis/ones/resolve-labels.js +64 -0
- package/dist/clis/ones/task-helpers.d.ts +29 -0
- package/dist/clis/ones/task-helpers.js +212 -0
- package/dist/clis/ones/task-helpers.test.d.ts +1 -0
- package/dist/clis/ones/task-helpers.test.js +12 -0
- package/dist/clis/ones/task.d.ts +1 -0
- package/dist/clis/ones/task.js +66 -0
- package/dist/clis/ones/tasks.d.ts +1 -0
- package/dist/clis/ones/tasks.js +79 -0
- package/dist/clis/ones/token-info.d.ts +1 -0
- package/dist/clis/ones/token-info.js +42 -0
- package/dist/clis/ones/worklog.d.ts +11 -0
- package/dist/clis/ones/worklog.js +267 -0
- package/dist/clis/ones/worklog.test.d.ts +1 -0
- package/dist/clis/ones/worklog.test.js +20 -0
- package/dist/clis/spotify/spotify.d.ts +1 -0
- package/dist/clis/spotify/spotify.js +316 -0
- package/dist/clis/spotify/utils.d.ts +21 -0
- package/dist/clis/spotify/utils.js +66 -0
- package/dist/clis/spotify/utils.test.d.ts +1 -0
- package/dist/clis/spotify/utils.test.js +67 -0
- package/dist/clis/substack/utils.d.ts +4 -0
- package/dist/clis/substack/utils.js +8 -2
- package/dist/clis/substack/utils.test.d.ts +1 -0
- package/dist/clis/substack/utils.test.js +46 -0
- package/dist/clis/tieba/commands.test.d.ts +4 -0
- package/dist/clis/tieba/commands.test.js +79 -0
- package/dist/clis/tieba/hot.d.ts +1 -0
- package/dist/clis/tieba/hot.js +48 -0
- package/dist/clis/tieba/posts.d.ts +1 -0
- package/dist/clis/tieba/posts.js +85 -0
- package/dist/clis/tieba/read.d.ts +1 -0
- package/dist/clis/tieba/read.js +140 -0
- package/dist/clis/tieba/search.d.ts +1 -0
- package/dist/clis/tieba/search.js +108 -0
- package/dist/clis/tieba/utils.d.ts +101 -0
- package/dist/clis/tieba/utils.js +240 -0
- package/dist/clis/tieba/utils.test.d.ts +1 -0
- package/dist/clis/tieba/utils.test.js +290 -0
- package/dist/clis/v2ex/hot.yaml +4 -1
- package/dist/clis/v2ex/latest.yaml +4 -1
- package/dist/clis/v2ex/topic.yaml +6 -1
- package/dist/clis/weixin/download.d.ts +9 -0
- package/dist/clis/weixin/download.js +76 -6
- package/dist/clis/weread/book.js +206 -13
- package/dist/clis/weread/commands.test.js +331 -0
- package/dist/clis/weread/private-api-regression.test.d.ts +1 -0
- package/dist/{weread-private-api-regression.test.js → clis/weread/private-api-regression.test.js} +92 -30
- package/dist/clis/weread/search-regression.test.d.ts +1 -0
- package/dist/clis/weread/search-regression.test.js +407 -0
- package/dist/clis/weread/search.js +143 -7
- package/dist/clis/weread/shelf.js +13 -95
- package/dist/clis/weread/utils.d.ts +56 -0
- package/dist/clis/weread/utils.js +234 -7
- package/dist/clis/weread/utils.test.js +71 -1
- package/dist/clis/xiaohongshu/comments.d.ts +3 -0
- package/dist/clis/xiaohongshu/comments.js +76 -17
- package/dist/clis/xiaohongshu/comments.test.js +70 -9
- package/dist/clis/xiaohongshu/download.d.ts +4 -1
- package/dist/clis/xiaohongshu/download.js +83 -22
- package/dist/clis/xiaohongshu/download.test.d.ts +1 -0
- package/dist/clis/xiaohongshu/download.test.js +75 -0
- package/dist/clis/xiaohongshu/note-helpers.d.ts +12 -0
- package/dist/clis/xiaohongshu/note-helpers.js +23 -0
- package/dist/clis/xiaohongshu/note.d.ts +7 -0
- package/dist/clis/xiaohongshu/note.js +76 -0
- package/dist/clis/xiaohongshu/note.test.d.ts +1 -0
- package/dist/clis/xiaohongshu/note.test.js +136 -0
- package/dist/clis/xiaohongshu/publish.d.ts +1 -1
- package/dist/clis/xiaohongshu/publish.js +78 -31
- package/dist/clis/xiaohongshu/publish.test.js +66 -1
- package/dist/clis/xiaohongshu/search.js +9 -0
- package/dist/clis/xiaohongshu/search.test.js +10 -4
- package/dist/clis/xiaohongshu/user-helpers.d.ts +1 -0
- package/dist/clis/xiaohongshu/user-helpers.js +2 -0
- package/dist/clis/xiaohongshu/user-helpers.test.js +18 -0
- package/dist/clis/xueqiu/comments.d.ts +118 -0
- package/dist/clis/xueqiu/comments.js +354 -0
- package/dist/clis/xueqiu/comments.test.d.ts +1 -0
- package/dist/clis/xueqiu/comments.test.js +696 -0
- package/dist/clis/youtube/search.js +57 -17
- package/dist/clis/youtube/transcript.js +2 -4
- package/dist/clis/youtube/utils.d.ts +9 -0
- package/dist/clis/youtube/utils.js +67 -3
- package/dist/clis/youtube/utils.test.d.ts +1 -0
- package/dist/clis/youtube/utils.test.js +37 -0
- package/dist/clis/youtube/video.js +16 -15
- package/dist/clis/zhihu/question.js +19 -17
- package/dist/clis/zhihu/question.test.d.ts +1 -0
- package/dist/clis/zhihu/question.test.js +54 -0
- package/dist/clis/zsxq/dynamics.d.ts +1 -0
- package/dist/clis/zsxq/dynamics.js +47 -0
- package/dist/clis/zsxq/groups.d.ts +1 -0
- package/dist/clis/zsxq/groups.js +32 -0
- package/dist/clis/zsxq/search.d.ts +1 -0
- package/dist/clis/zsxq/search.js +43 -0
- package/dist/clis/zsxq/search.test.d.ts +1 -0
- package/dist/clis/zsxq/search.test.js +24 -0
- package/dist/clis/zsxq/topic.d.ts +1 -0
- package/dist/clis/zsxq/topic.js +47 -0
- package/dist/clis/zsxq/topic.test.d.ts +1 -0
- package/dist/clis/zsxq/topic.test.js +29 -0
- package/dist/clis/zsxq/topics.d.ts +1 -0
- package/dist/clis/zsxq/topics.js +25 -0
- package/dist/clis/zsxq/topics.test.d.ts +1 -0
- package/dist/clis/zsxq/topics.test.js +24 -0
- package/dist/clis/zsxq/utils.d.ts +97 -0
- package/dist/clis/zsxq/utils.js +230 -0
- package/dist/commanderAdapter.js +10 -1
- package/dist/commanderAdapter.test.js +64 -0
- package/dist/commands/daemon.d.ts +9 -0
- package/dist/commands/daemon.js +124 -0
- package/dist/commands/daemon.test.d.ts +1 -0
- package/dist/commands/daemon.test.js +185 -0
- package/dist/completion.js +3 -1
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +2 -0
- package/dist/daemon.d.ts +1 -1
- package/dist/daemon.js +25 -14
- package/dist/daemon.test.d.ts +1 -0
- package/dist/daemon.test.js +65 -0
- package/dist/discovery.d.ts +9 -0
- package/dist/discovery.js +47 -2
- package/dist/electron-apps.d.ts +29 -0
- package/dist/electron-apps.js +65 -0
- package/dist/electron-apps.test.d.ts +1 -0
- package/dist/electron-apps.test.js +43 -0
- package/dist/engine.test.js +41 -9
- package/dist/execution.js +20 -16
- package/dist/external-clis.yaml +17 -0
- package/dist/idle-manager.d.ts +19 -0
- package/dist/idle-manager.js +54 -0
- package/dist/launcher.d.ts +36 -0
- package/dist/launcher.js +152 -0
- package/dist/launcher.test.d.ts +1 -0
- package/dist/launcher.test.js +57 -0
- package/dist/main.js +3 -3
- package/dist/registry.d.ts +1 -0
- package/dist/registry.js +31 -3
- package/dist/registry.test.js +13 -0
- package/dist/runtime.d.ts +5 -3
- package/dist/runtime.js +12 -5
- package/dist/serialization.d.ts +1 -0
- package/dist/serialization.js +3 -0
- package/dist/serialization.test.js +17 -1
- package/dist/tui.d.ts +7 -0
- package/dist/tui.js +52 -0
- package/dist/tui.test.d.ts +1 -0
- package/dist/tui.test.js +19 -0
- package/dist/types.d.ts +5 -0
- package/dist/weixin-download.test.js +14 -0
- package/docs/.vitepress/config.mts +4 -0
- package/docs/adapters/browser/band.md +63 -0
- package/docs/adapters/browser/notebooklm.md +69 -0
- package/docs/adapters/browser/ones.md +59 -0
- package/docs/adapters/browser/spotify.md +62 -0
- package/docs/adapters/browser/tieba.md +45 -0
- package/docs/adapters/browser/xiaohongshu.md +19 -10
- package/docs/adapters/browser/xueqiu.md +5 -0
- package/docs/adapters/browser/zsxq.md +49 -0
- package/docs/adapters/index.md +67 -63
- package/docs/adapters-doc/ones.md +32 -0
- package/docs/guide/browser-bridge.md +12 -0
- package/docs/guide/troubleshooting.md +9 -4
- package/docs/superpowers/plans/2026-03-31-daemon-lifecycle-redesign.md +857 -0
- package/docs/superpowers/specs/2026-03-31-daemon-lifecycle-redesign.md +208 -0
- package/docs/zh/guide/browser-bridge.md +12 -0
- package/extension/dist/background.js +794 -513
- package/extension/src/background.test.ts +202 -2
- package/extension/src/background.ts +189 -10
- package/extension/src/cdp.ts +54 -0
- package/extension/src/protocol.ts +11 -5
- package/package.json +1 -1
- package/scripts/postinstall.js +16 -0
- package/src/browser/cdp.ts +24 -17
- package/src/browser/daemon-client.ts +11 -1
- package/src/browser/dom-helpers.test.ts +15 -1
- package/src/browser/dom-helpers.ts +1 -0
- package/src/browser/mcp.ts +18 -13
- package/src/browser/page.test.ts +58 -0
- package/src/browser/page.ts +34 -2
- package/src/browser/stealth.test.ts +153 -0
- package/src/browser/stealth.ts +198 -0
- package/src/browser.test.ts +1 -1
- package/src/build-manifest.test.ts +2 -0
- package/src/build-manifest.ts +6 -1
- package/src/cli.ts +21 -3
- package/src/clis/antigravity/SKILL.md +3 -12
- package/src/clis/antigravity/serve.ts +5 -10
- package/src/clis/band/bands.ts +76 -0
- package/src/clis/band/mentions.ts +134 -0
- package/src/clis/band/post.ts +187 -0
- package/src/clis/band/posts.ts +106 -0
- package/src/clis/bilibili/subtitle.test.ts +60 -0
- package/src/clis/bilibili/subtitle.ts +4 -0
- package/src/clis/chatwise/ask.ts +0 -2
- package/src/clis/chatwise/export.ts +0 -2
- package/src/clis/chatwise/history.ts +0 -2
- package/src/clis/chatwise/model.ts +0 -2
- package/src/clis/chatwise/new.ts +1 -2
- package/src/clis/chatwise/read.ts +0 -2
- package/src/clis/chatwise/screenshot.ts +1 -2
- package/src/clis/chatwise/send.ts +0 -2
- package/src/clis/chatwise/status.ts +1 -2
- package/src/clis/ctrip/search.test.ts +73 -0
- package/src/clis/ctrip/search.ts +97 -47
- package/src/clis/doubao/detail.test.ts +53 -0
- package/src/clis/doubao/detail.ts +41 -0
- package/src/clis/doubao/history.test.ts +45 -0
- package/src/clis/doubao/history.ts +32 -0
- package/src/clis/doubao/meeting-summary.ts +53 -0
- package/src/clis/doubao/meeting-transcript.ts +48 -0
- package/src/clis/doubao/utils.test.ts +45 -0
- package/src/clis/doubao/utils.ts +371 -0
- package/src/clis/douyin/_shared/public-api.ts +84 -0
- package/src/clis/douyin/_shared/sts2.test.ts +31 -0
- package/src/clis/douyin/_shared/sts2.ts +11 -3
- package/src/clis/douyin/activities.test.ts +41 -1
- package/src/clis/douyin/activities.ts +12 -3
- package/src/clis/douyin/collections.test.ts +35 -2
- package/src/clis/douyin/collections.ts +1 -1
- package/src/clis/douyin/draft.test.ts +444 -2
- package/src/clis/douyin/draft.ts +382 -218
- package/src/clis/douyin/hashtag.test.ts +42 -2
- package/src/clis/douyin/hashtag.ts +11 -3
- package/src/clis/douyin/profile.test.ts +43 -1
- package/src/clis/douyin/profile.ts +9 -2
- package/src/clis/douyin/user-videos.test.ts +122 -0
- package/src/clis/douyin/user-videos.ts +101 -0
- package/src/clis/douyin/videos.test.ts +52 -2
- package/src/clis/douyin/videos.ts +49 -15
- package/src/clis/facebook/search.test.ts +70 -0
- package/src/clis/facebook/search.yaml +4 -3
- package/src/clis/instagram/download.test.ts +159 -0
- package/src/clis/instagram/download.ts +286 -0
- package/src/clis/notebooklm/bind-current.test.ts +43 -0
- package/src/clis/notebooklm/bind-current.ts +36 -0
- package/src/clis/notebooklm/binding.test.ts +53 -0
- package/src/clis/notebooklm/compat.test.ts +19 -0
- package/src/clis/notebooklm/current.ts +38 -0
- package/src/clis/notebooklm/get.ts +53 -0
- package/src/clis/notebooklm/history.test.ts +70 -0
- package/src/clis/notebooklm/history.ts +36 -0
- package/src/clis/notebooklm/list.ts +40 -0
- package/src/clis/notebooklm/note-list.test.ts +64 -0
- package/src/clis/notebooklm/note-list.ts +42 -0
- package/src/clis/notebooklm/notes-get.test.ts +88 -0
- package/src/clis/notebooklm/notes-get.ts +67 -0
- package/src/clis/notebooklm/rpc.test.ts +126 -0
- package/src/clis/notebooklm/rpc.ts +286 -0
- package/src/clis/notebooklm/shared.ts +98 -0
- package/src/clis/notebooklm/source-fulltext.test.ts +123 -0
- package/src/clis/notebooklm/source-fulltext.ts +69 -0
- package/src/clis/notebooklm/source-get.test.ts +100 -0
- package/src/clis/notebooklm/source-get.ts +60 -0
- package/src/clis/notebooklm/source-guide.test.ts +121 -0
- package/src/clis/notebooklm/source-guide.ts +69 -0
- package/src/clis/notebooklm/source-list.ts +45 -0
- package/src/clis/notebooklm/status.ts +34 -0
- package/src/clis/notebooklm/summary.test.ts +94 -0
- package/src/clis/notebooklm/summary.ts +45 -0
- package/src/clis/notebooklm/utils.test.ts +446 -0
- package/src/clis/notebooklm/utils.ts +893 -0
- package/src/clis/ones/common.ts +187 -0
- package/src/clis/ones/enrich-tasks.ts +47 -0
- package/src/clis/ones/login.ts +103 -0
- package/src/clis/ones/logout.ts +19 -0
- package/src/clis/ones/me.ts +34 -0
- package/src/clis/ones/my-tasks.ts +148 -0
- package/src/clis/ones/resolve-labels.ts +80 -0
- package/src/clis/ones/task-helpers.test.ts +14 -0
- package/src/clis/ones/task-helpers.ts +214 -0
- package/src/clis/ones/task.ts +79 -0
- package/src/clis/ones/tasks.ts +92 -0
- package/src/clis/ones/token-info.ts +46 -0
- package/src/clis/ones/worklog.test.ts +24 -0
- package/src/clis/ones/worklog.ts +306 -0
- package/src/clis/spotify/spotify.ts +328 -0
- package/src/clis/spotify/utils.test.ts +87 -0
- package/src/clis/spotify/utils.ts +92 -0
- package/src/clis/substack/utils.test.ts +54 -0
- package/src/clis/substack/utils.ts +10 -2
- package/src/clis/tieba/commands.test.ts +86 -0
- package/src/clis/tieba/hot.ts +52 -0
- package/src/clis/tieba/posts.ts +108 -0
- package/src/clis/tieba/read.ts +158 -0
- package/src/clis/tieba/search.ts +119 -0
- package/src/clis/tieba/utils.test.ts +322 -0
- package/src/clis/tieba/utils.ts +348 -0
- package/src/clis/v2ex/hot.yaml +4 -1
- package/src/clis/v2ex/latest.yaml +4 -1
- package/src/clis/v2ex/topic.yaml +6 -1
- package/src/clis/weixin/download.ts +95 -6
- package/src/clis/weread/book.ts +256 -13
- package/src/clis/weread/commands.test.ts +409 -0
- package/src/{weread-private-api-regression.test.ts → clis/weread/private-api-regression.test.ts} +108 -30
- package/src/clis/weread/search-regression.test.ts +440 -0
- package/src/clis/weread/search.ts +189 -9
- package/src/clis/weread/shelf.ts +20 -122
- package/src/clis/weread/utils.test.ts +81 -1
- package/src/clis/weread/utils.ts +293 -7
- package/src/clis/xiaohongshu/comments.test.ts +85 -9
- package/src/clis/xiaohongshu/comments.ts +76 -17
- package/src/clis/xiaohongshu/download.test.ts +96 -0
- package/src/clis/xiaohongshu/download.ts +83 -22
- package/src/clis/xiaohongshu/note-helpers.ts +25 -0
- package/src/clis/xiaohongshu/note.test.ts +164 -0
- package/src/clis/xiaohongshu/note.ts +86 -0
- package/src/clis/xiaohongshu/publish.test.ts +79 -1
- package/src/clis/xiaohongshu/publish.ts +84 -30
- package/src/clis/xiaohongshu/search.test.ts +11 -4
- package/src/clis/xiaohongshu/search.ts +13 -0
- package/src/clis/xiaohongshu/user-helpers.test.ts +23 -0
- package/src/clis/xiaohongshu/user-helpers.ts +4 -0
- package/src/clis/xueqiu/comments.test.ts +823 -0
- package/src/clis/xueqiu/comments.ts +461 -0
- package/src/clis/youtube/search.ts +57 -17
- package/src/clis/youtube/transcript.ts +2 -4
- package/src/clis/youtube/utils.test.ts +43 -0
- package/src/clis/youtube/utils.ts +69 -0
- package/src/clis/youtube/video.ts +16 -15
- package/src/clis/zhihu/question.test.ts +71 -0
- package/src/clis/zhihu/question.ts +27 -15
- package/src/clis/zsxq/dynamics.ts +60 -0
- package/src/clis/zsxq/groups.ts +41 -0
- package/src/clis/zsxq/search.test.ts +29 -0
- package/src/clis/zsxq/search.ts +54 -0
- package/src/clis/zsxq/topic.test.ts +34 -0
- package/src/clis/zsxq/topic.ts +68 -0
- package/src/clis/zsxq/topics.test.ts +29 -0
- package/src/clis/zsxq/topics.ts +36 -0
- package/src/clis/zsxq/utils.ts +351 -0
- package/src/commanderAdapter.test.ts +77 -0
- package/src/commanderAdapter.ts +8 -1
- package/src/commands/daemon.test.ts +238 -0
- package/src/commands/daemon.ts +135 -0
- package/src/completion.ts +2 -1
- package/src/constants.ts +3 -0
- package/src/daemon.test.ts +88 -0
- package/src/daemon.ts +26 -14
- package/src/discovery.ts +52 -2
- package/src/electron-apps.test.ts +50 -0
- package/src/electron-apps.ts +89 -0
- package/src/engine.test.ts +45 -9
- package/src/execution.ts +24 -19
- package/src/external-clis.yaml +17 -0
- package/src/idle-manager.ts +60 -0
- package/src/launcher.test.ts +67 -0
- package/src/launcher.ts +185 -0
- package/src/main.ts +3 -2
- package/src/registry.test.ts +15 -0
- package/src/registry.ts +32 -3
- package/src/runtime.ts +13 -7
- package/src/serialization.test.ts +19 -1
- package/src/serialization.ts +2 -0
- package/src/tui.test.ts +23 -0
- package/src/tui.ts +65 -0
- package/src/types.ts +5 -0
- package/src/weixin-download.test.ts +27 -0
- package/tests/e2e/band-auth.test.ts +20 -0
- package/tests/e2e/browser-auth-helpers.ts +18 -0
- package/tests/e2e/browser-auth.test.ts +35 -47
- package/tests/e2e/browser-public-extended.test.ts +6 -2
- package/tests/e2e/browser-public.test.ts +288 -0
- package/tests/e2e/management.test.ts +1 -1
- package/tests/e2e/plugin-management.test.ts +1 -1
- package/vitest.config.ts +1 -0
- package/chatwise-opencli.ps1 +0 -82
- package/dist/clis/chatwise/shared.d.ts +0 -2
- package/dist/clis/chatwise/shared.js +0 -6
- package/dist/weread-private-api-regression.test.d.ts +0 -1
- package/dist/weread-search-regression.test.d.ts +0 -1
- package/dist/weread-search-regression.test.js +0 -39
- package/src/clis/chatwise/shared.ts +0 -8
- package/src/weread-search-regression.test.ts +0 -44
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
mockListNotebooklmHistoryViaRpc,
|
|
5
|
+
mockGetNotebooklmPageState,
|
|
6
|
+
mockRequireNotebooklmSession,
|
|
7
|
+
} = vi.hoisted(() => ({
|
|
8
|
+
mockListNotebooklmHistoryViaRpc: vi.fn(),
|
|
9
|
+
mockGetNotebooklmPageState: vi.fn(),
|
|
10
|
+
mockRequireNotebooklmSession: vi.fn(),
|
|
11
|
+
}));
|
|
12
|
+
|
|
13
|
+
vi.mock('./utils.js', async () => {
|
|
14
|
+
const actual = await vi.importActual<typeof import('./utils.js')>('./utils.js');
|
|
15
|
+
return {
|
|
16
|
+
...actual,
|
|
17
|
+
getNotebooklmPageState: mockGetNotebooklmPageState,
|
|
18
|
+
listNotebooklmHistoryViaRpc: mockListNotebooklmHistoryViaRpc,
|
|
19
|
+
requireNotebooklmSession: mockRequireNotebooklmSession,
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
import { getRegistry } from '../../registry.js';
|
|
24
|
+
import './history.js';
|
|
25
|
+
|
|
26
|
+
describe('notebooklm history', () => {
|
|
27
|
+
const history = getRegistry().get('notebooklm/history');
|
|
28
|
+
|
|
29
|
+
beforeEach(() => {
|
|
30
|
+
mockListNotebooklmHistoryViaRpc.mockReset();
|
|
31
|
+
mockGetNotebooklmPageState.mockReset();
|
|
32
|
+
mockRequireNotebooklmSession.mockReset();
|
|
33
|
+
mockRequireNotebooklmSession.mockResolvedValue(undefined);
|
|
34
|
+
mockGetNotebooklmPageState.mockResolvedValue({
|
|
35
|
+
url: 'https://notebooklm.google.com/notebook/nb-demo',
|
|
36
|
+
title: 'Browser Automation',
|
|
37
|
+
hostname: 'notebooklm.google.com',
|
|
38
|
+
kind: 'notebook',
|
|
39
|
+
notebookId: 'nb-demo',
|
|
40
|
+
loginRequired: false,
|
|
41
|
+
notebookCount: 1,
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('lists notebook history threads from the browser rpc', async () => {
|
|
46
|
+
mockListNotebooklmHistoryViaRpc.mockResolvedValue([
|
|
47
|
+
{
|
|
48
|
+
notebook_id: 'nb-demo',
|
|
49
|
+
thread_id: '28e0f2cb-4591-45a3-a661-7653666f7c78',
|
|
50
|
+
item_count: 0,
|
|
51
|
+
preview: 'Summarize this notebook',
|
|
52
|
+
url: 'https://notebooklm.google.com/notebook/nb-demo',
|
|
53
|
+
source: 'rpc',
|
|
54
|
+
},
|
|
55
|
+
]);
|
|
56
|
+
|
|
57
|
+
const result = await history!.func!({} as any, {});
|
|
58
|
+
|
|
59
|
+
expect(result).toEqual([
|
|
60
|
+
{
|
|
61
|
+
notebook_id: 'nb-demo',
|
|
62
|
+
thread_id: '28e0f2cb-4591-45a3-a661-7653666f7c78',
|
|
63
|
+
item_count: 0,
|
|
64
|
+
preview: 'Summarize this notebook',
|
|
65
|
+
url: 'https://notebooklm.google.com/notebook/nb-demo',
|
|
66
|
+
source: 'rpc',
|
|
67
|
+
},
|
|
68
|
+
]);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { cli, Strategy } from '../../registry.js';
|
|
2
|
+
import type { IPage } from '../../types.js';
|
|
3
|
+
import { EmptyResultError } from '../../errors.js';
|
|
4
|
+
import { NOTEBOOKLM_DOMAIN, NOTEBOOKLM_SITE } from './shared.js';
|
|
5
|
+
import {
|
|
6
|
+
ensureNotebooklmNotebookBinding,
|
|
7
|
+
getNotebooklmPageState,
|
|
8
|
+
listNotebooklmHistoryViaRpc,
|
|
9
|
+
requireNotebooklmSession,
|
|
10
|
+
} from './utils.js';
|
|
11
|
+
|
|
12
|
+
cli({
|
|
13
|
+
site: NOTEBOOKLM_SITE,
|
|
14
|
+
name: 'history',
|
|
15
|
+
description: 'List NotebookLM conversation history threads in the current notebook',
|
|
16
|
+
domain: NOTEBOOKLM_DOMAIN,
|
|
17
|
+
strategy: Strategy.COOKIE,
|
|
18
|
+
browser: true,
|
|
19
|
+
navigateBefore: false,
|
|
20
|
+
args: [],
|
|
21
|
+
columns: ['thread_id', 'item_count', 'preview', 'source', 'notebook_id', 'url'],
|
|
22
|
+
func: async (page: IPage) => {
|
|
23
|
+
await ensureNotebooklmNotebookBinding(page);
|
|
24
|
+
await requireNotebooklmSession(page);
|
|
25
|
+
const state = await getNotebooklmPageState(page);
|
|
26
|
+
if (state.kind !== 'notebook') {
|
|
27
|
+
throw new EmptyResultError(
|
|
28
|
+
'opencli notebooklm history',
|
|
29
|
+
'Open a specific NotebookLM notebook tab first, then retry.',
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const rows = await listNotebooklmHistoryViaRpc(page);
|
|
34
|
+
return rows;
|
|
35
|
+
},
|
|
36
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { cli, Strategy } from '../../registry.js';
|
|
2
|
+
import { AuthRequiredError } from '../../errors.js';
|
|
3
|
+
import type { IPage } from '../../types.js';
|
|
4
|
+
import { NOTEBOOKLM_DOMAIN, NOTEBOOKLM_SITE } from './shared.js';
|
|
5
|
+
import {
|
|
6
|
+
ensureNotebooklmHome,
|
|
7
|
+
listNotebooklmLinks,
|
|
8
|
+
listNotebooklmViaRpc,
|
|
9
|
+
readCurrentNotebooklm,
|
|
10
|
+
requireNotebooklmSession,
|
|
11
|
+
} from './utils.js';
|
|
12
|
+
|
|
13
|
+
cli({
|
|
14
|
+
site: NOTEBOOKLM_SITE,
|
|
15
|
+
name: 'list',
|
|
16
|
+
description: 'List NotebookLM notebooks via in-page batchexecute RPC in the current logged-in session',
|
|
17
|
+
domain: NOTEBOOKLM_DOMAIN,
|
|
18
|
+
strategy: Strategy.COOKIE,
|
|
19
|
+
browser: true,
|
|
20
|
+
navigateBefore: false,
|
|
21
|
+
args: [],
|
|
22
|
+
columns: ['title', 'id', 'is_owner', 'created_at', 'source', 'url'],
|
|
23
|
+
func: async (page: IPage) => {
|
|
24
|
+
const currentFallback = await readCurrentNotebooklm(page).catch(() => null);
|
|
25
|
+
await ensureNotebooklmHome(page);
|
|
26
|
+
await requireNotebooklmSession(page);
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
const rpcRows = await listNotebooklmViaRpc(page);
|
|
30
|
+
if (rpcRows.length > 0) return rpcRows;
|
|
31
|
+
} catch (error) {
|
|
32
|
+
if (error instanceof AuthRequiredError) throw error;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const domRows = await listNotebooklmLinks(page);
|
|
36
|
+
if (domRows.length > 0) return domRows;
|
|
37
|
+
if (currentFallback) return [currentFallback];
|
|
38
|
+
return [];
|
|
39
|
+
},
|
|
40
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
|
|
3
|
+
const { mockListNotebooklmNotesFromPage, mockGetNotebooklmPageState, mockRequireNotebooklmSession } = vi.hoisted(() => ({
|
|
4
|
+
mockListNotebooklmNotesFromPage: vi.fn(),
|
|
5
|
+
mockGetNotebooklmPageState: vi.fn(),
|
|
6
|
+
mockRequireNotebooklmSession: vi.fn(),
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
vi.mock('./utils.js', async () => {
|
|
10
|
+
const actual = await vi.importActual<typeof import('./utils.js')>('./utils.js');
|
|
11
|
+
return {
|
|
12
|
+
...actual,
|
|
13
|
+
getNotebooklmPageState: mockGetNotebooklmPageState,
|
|
14
|
+
listNotebooklmNotesFromPage: mockListNotebooklmNotesFromPage,
|
|
15
|
+
requireNotebooklmSession: mockRequireNotebooklmSession,
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
import { getRegistry } from '../../registry.js';
|
|
20
|
+
import './note-list.js';
|
|
21
|
+
|
|
22
|
+
describe('notebooklm note-list', () => {
|
|
23
|
+
const command = getRegistry().get('notebooklm/note-list');
|
|
24
|
+
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
mockListNotebooklmNotesFromPage.mockReset();
|
|
27
|
+
mockGetNotebooklmPageState.mockReset();
|
|
28
|
+
mockRequireNotebooklmSession.mockReset();
|
|
29
|
+
mockRequireNotebooklmSession.mockResolvedValue(undefined);
|
|
30
|
+
mockGetNotebooklmPageState.mockResolvedValue({
|
|
31
|
+
url: 'https://notebooklm.google.com/notebook/nb-demo',
|
|
32
|
+
title: 'Browser Automation',
|
|
33
|
+
hostname: 'notebooklm.google.com',
|
|
34
|
+
kind: 'notebook',
|
|
35
|
+
notebookId: 'nb-demo',
|
|
36
|
+
loginRequired: false,
|
|
37
|
+
notebookCount: 1,
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('lists notebook notes from the Studio panel', async () => {
|
|
42
|
+
mockListNotebooklmNotesFromPage.mockResolvedValue([
|
|
43
|
+
{
|
|
44
|
+
notebook_id: 'nb-demo',
|
|
45
|
+
title: '新建笔记',
|
|
46
|
+
created_at: '6 分钟前',
|
|
47
|
+
url: 'https://notebooklm.google.com/notebook/nb-demo',
|
|
48
|
+
source: 'studio-list',
|
|
49
|
+
},
|
|
50
|
+
]);
|
|
51
|
+
|
|
52
|
+
const result = await command!.func!({} as any, {});
|
|
53
|
+
|
|
54
|
+
expect(result).toEqual([
|
|
55
|
+
{
|
|
56
|
+
notebook_id: 'nb-demo',
|
|
57
|
+
title: '新建笔记',
|
|
58
|
+
created_at: '6 分钟前',
|
|
59
|
+
url: 'https://notebooklm.google.com/notebook/nb-demo',
|
|
60
|
+
source: 'studio-list',
|
|
61
|
+
},
|
|
62
|
+
]);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { cli, Strategy } from '../../registry.js';
|
|
2
|
+
import type { IPage } from '../../types.js';
|
|
3
|
+
import { EmptyResultError } from '../../errors.js';
|
|
4
|
+
import { NOTEBOOKLM_DOMAIN, NOTEBOOKLM_SITE } from './shared.js';
|
|
5
|
+
import {
|
|
6
|
+
ensureNotebooklmNotebookBinding,
|
|
7
|
+
getNotebooklmPageState,
|
|
8
|
+
listNotebooklmNotesFromPage,
|
|
9
|
+
requireNotebooklmSession,
|
|
10
|
+
} from './utils.js';
|
|
11
|
+
|
|
12
|
+
cli({
|
|
13
|
+
site: NOTEBOOKLM_SITE,
|
|
14
|
+
name: 'note-list',
|
|
15
|
+
aliases: ['notes-list'],
|
|
16
|
+
description: 'List saved notes from the Studio panel of the current NotebookLM notebook',
|
|
17
|
+
domain: NOTEBOOKLM_DOMAIN,
|
|
18
|
+
strategy: Strategy.COOKIE,
|
|
19
|
+
browser: true,
|
|
20
|
+
navigateBefore: false,
|
|
21
|
+
args: [],
|
|
22
|
+
columns: ['title', 'created_at', 'source', 'url'],
|
|
23
|
+
func: async (page: IPage) => {
|
|
24
|
+
await ensureNotebooklmNotebookBinding(page);
|
|
25
|
+
await requireNotebooklmSession(page);
|
|
26
|
+
const state = await getNotebooklmPageState(page);
|
|
27
|
+
if (state.kind !== 'notebook') {
|
|
28
|
+
throw new EmptyResultError(
|
|
29
|
+
'opencli notebooklm note-list',
|
|
30
|
+
'Open a specific NotebookLM notebook tab first, then retry.',
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const rows = await listNotebooklmNotesFromPage(page);
|
|
35
|
+
if (rows.length > 0) return rows;
|
|
36
|
+
|
|
37
|
+
throw new EmptyResultError(
|
|
38
|
+
'opencli notebooklm note-list',
|
|
39
|
+
'No NotebookLM notes are visible in the Studio panel. Reload the notebook page or close the note editor and retry.',
|
|
40
|
+
);
|
|
41
|
+
},
|
|
42
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
mockListNotebooklmNotesFromPage,
|
|
5
|
+
mockReadNotebooklmVisibleNoteFromPage,
|
|
6
|
+
mockGetNotebooklmPageState,
|
|
7
|
+
mockRequireNotebooklmSession,
|
|
8
|
+
} = vi.hoisted(() => ({
|
|
9
|
+
mockListNotebooklmNotesFromPage: vi.fn(),
|
|
10
|
+
mockReadNotebooklmVisibleNoteFromPage: vi.fn(),
|
|
11
|
+
mockGetNotebooklmPageState: vi.fn(),
|
|
12
|
+
mockRequireNotebooklmSession: vi.fn(),
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
vi.mock('./utils.js', async () => {
|
|
16
|
+
const actual = await vi.importActual<typeof import('./utils.js')>('./utils.js');
|
|
17
|
+
return {
|
|
18
|
+
...actual,
|
|
19
|
+
listNotebooklmNotesFromPage: mockListNotebooklmNotesFromPage,
|
|
20
|
+
readNotebooklmVisibleNoteFromPage: mockReadNotebooklmVisibleNoteFromPage,
|
|
21
|
+
getNotebooklmPageState: mockGetNotebooklmPageState,
|
|
22
|
+
requireNotebooklmSession: mockRequireNotebooklmSession,
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
import { getRegistry } from '../../registry.js';
|
|
27
|
+
import { CliError } from '../../errors.js';
|
|
28
|
+
import './notes-get.js';
|
|
29
|
+
|
|
30
|
+
describe('notebooklm notes-get', () => {
|
|
31
|
+
const command = getRegistry().get('notebooklm/notes-get');
|
|
32
|
+
|
|
33
|
+
beforeEach(() => {
|
|
34
|
+
mockListNotebooklmNotesFromPage.mockReset();
|
|
35
|
+
mockReadNotebooklmVisibleNoteFromPage.mockReset();
|
|
36
|
+
mockGetNotebooklmPageState.mockReset();
|
|
37
|
+
mockRequireNotebooklmSession.mockReset();
|
|
38
|
+
mockRequireNotebooklmSession.mockResolvedValue(undefined);
|
|
39
|
+
mockGetNotebooklmPageState.mockResolvedValue({
|
|
40
|
+
url: 'https://notebooklm.google.com/notebook/nb-demo',
|
|
41
|
+
title: 'Browser Automation',
|
|
42
|
+
hostname: 'notebooklm.google.com',
|
|
43
|
+
kind: 'notebook',
|
|
44
|
+
notebookId: 'nb-demo',
|
|
45
|
+
loginRequired: false,
|
|
46
|
+
notebookCount: 1,
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('returns the currently visible note editor content when the title matches', async () => {
|
|
51
|
+
mockReadNotebooklmVisibleNoteFromPage.mockResolvedValue({
|
|
52
|
+
notebook_id: 'nb-demo',
|
|
53
|
+
title: '新建笔记',
|
|
54
|
+
content: '第一段\\n第二段',
|
|
55
|
+
url: 'https://notebooklm.google.com/notebook/nb-demo',
|
|
56
|
+
source: 'studio-editor',
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const result = await command!.func!({} as any, { note: '新建笔记' });
|
|
60
|
+
|
|
61
|
+
expect(result).toEqual([
|
|
62
|
+
{
|
|
63
|
+
notebook_id: 'nb-demo',
|
|
64
|
+
title: '新建笔记',
|
|
65
|
+
content: '第一段\\n第二段',
|
|
66
|
+
url: 'https://notebooklm.google.com/notebook/nb-demo',
|
|
67
|
+
source: 'studio-editor',
|
|
68
|
+
},
|
|
69
|
+
]);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('explains the current visible-note limitation when the target note is listed but not open', async () => {
|
|
73
|
+
mockReadNotebooklmVisibleNoteFromPage.mockResolvedValue(null);
|
|
74
|
+
mockListNotebooklmNotesFromPage.mockResolvedValue([
|
|
75
|
+
{
|
|
76
|
+
notebook_id: 'nb-demo',
|
|
77
|
+
title: '新建笔记',
|
|
78
|
+
created_at: '6 分钟前',
|
|
79
|
+
url: 'https://notebooklm.google.com/notebook/nb-demo',
|
|
80
|
+
source: 'studio-list',
|
|
81
|
+
},
|
|
82
|
+
]);
|
|
83
|
+
|
|
84
|
+
await expect(command!.func!({} as any, { note: '新建笔记' })).rejects.toMatchObject({
|
|
85
|
+
hint: expect.stringMatching(/currently reads note content only from the visible note editor/i),
|
|
86
|
+
} satisfies Partial<CliError>);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { cli, Strategy } from '../../registry.js';
|
|
2
|
+
import type { IPage } from '../../types.js';
|
|
3
|
+
import { EmptyResultError } from '../../errors.js';
|
|
4
|
+
import { NOTEBOOKLM_DOMAIN, NOTEBOOKLM_SITE } from './shared.js';
|
|
5
|
+
import {
|
|
6
|
+
ensureNotebooklmNotebookBinding,
|
|
7
|
+
findNotebooklmNoteRow,
|
|
8
|
+
getNotebooklmPageState,
|
|
9
|
+
listNotebooklmNotesFromPage,
|
|
10
|
+
readNotebooklmVisibleNoteFromPage,
|
|
11
|
+
requireNotebooklmSession,
|
|
12
|
+
} from './utils.js';
|
|
13
|
+
|
|
14
|
+
function matchesNoteTitle(title: string, query: string): boolean {
|
|
15
|
+
const needle = query.trim().toLowerCase();
|
|
16
|
+
if (!needle) return false;
|
|
17
|
+
const normalized = title.trim().toLowerCase();
|
|
18
|
+
return normalized === needle || normalized.includes(needle);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
cli({
|
|
22
|
+
site: NOTEBOOKLM_SITE,
|
|
23
|
+
name: 'notes-get',
|
|
24
|
+
description: 'Get one note from the current NotebookLM notebook by title from the visible note editor',
|
|
25
|
+
domain: NOTEBOOKLM_DOMAIN,
|
|
26
|
+
strategy: Strategy.COOKIE,
|
|
27
|
+
browser: true,
|
|
28
|
+
navigateBefore: false,
|
|
29
|
+
args: [
|
|
30
|
+
{
|
|
31
|
+
name: 'note',
|
|
32
|
+
positional: true,
|
|
33
|
+
required: true,
|
|
34
|
+
help: 'Note title or id from the current notebook',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
columns: ['title', 'content', 'source', 'url'],
|
|
38
|
+
func: async (page: IPage, kwargs) => {
|
|
39
|
+
await ensureNotebooklmNotebookBinding(page);
|
|
40
|
+
await requireNotebooklmSession(page);
|
|
41
|
+
const state = await getNotebooklmPageState(page);
|
|
42
|
+
if (state.kind !== 'notebook') {
|
|
43
|
+
throw new EmptyResultError(
|
|
44
|
+
'opencli notebooklm notes-get',
|
|
45
|
+
'Open a specific NotebookLM notebook tab first, then retry.',
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const query = typeof kwargs.note === 'string' ? kwargs.note : String(kwargs.note ?? '');
|
|
50
|
+
const visible = await readNotebooklmVisibleNoteFromPage(page);
|
|
51
|
+
if (visible && matchesNoteTitle(visible.title, query)) return [visible];
|
|
52
|
+
|
|
53
|
+
const rows = await listNotebooklmNotesFromPage(page);
|
|
54
|
+
const listed = findNotebooklmNoteRow(rows, query);
|
|
55
|
+
if (listed) {
|
|
56
|
+
throw new EmptyResultError(
|
|
57
|
+
'opencli notebooklm notes-get',
|
|
58
|
+
`Note "${query}" is listed in Studio, but opencli currently reads note content only from the visible note editor. Open that note in NotebookLM, then retry.`,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
throw new EmptyResultError(
|
|
63
|
+
'opencli notebooklm notes-get',
|
|
64
|
+
`Note "${query}" was not found in the current notebook.`,
|
|
65
|
+
);
|
|
66
|
+
},
|
|
67
|
+
});
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { AuthRequiredError } from '../../errors.js';
|
|
3
|
+
import type { IPage } from '../../types.js';
|
|
4
|
+
import {
|
|
5
|
+
buildNotebooklmRpcBody,
|
|
6
|
+
extractNotebooklmRpcResult,
|
|
7
|
+
getNotebooklmPageAuth,
|
|
8
|
+
parseNotebooklmChunkedResponse,
|
|
9
|
+
} from './rpc.js';
|
|
10
|
+
|
|
11
|
+
describe('notebooklm rpc transport', () => {
|
|
12
|
+
it('extracts auth tokens from the page html via page evaluation', async () => {
|
|
13
|
+
const page = {
|
|
14
|
+
evaluate: vi.fn(async (script: string) => {
|
|
15
|
+
expect(script).toContain('document.documentElement.innerHTML');
|
|
16
|
+
return {
|
|
17
|
+
html: '<html>"SNlM0e":"csrf-123","FdrFJe":"sess-456"</html>',
|
|
18
|
+
sourcePath: '/',
|
|
19
|
+
};
|
|
20
|
+
}),
|
|
21
|
+
} as unknown as IPage;
|
|
22
|
+
|
|
23
|
+
await expect(getNotebooklmPageAuth(page)).resolves.toEqual({
|
|
24
|
+
csrfToken: 'csrf-123',
|
|
25
|
+
sessionId: 'sess-456',
|
|
26
|
+
sourcePath: '/',
|
|
27
|
+
});
|
|
28
|
+
expect(page.evaluate).toHaveBeenCalledTimes(1);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('falls back to WIZ_global_data tokens when html regex data is missing', async () => {
|
|
32
|
+
const page = {
|
|
33
|
+
evaluate: vi.fn(async () => ({
|
|
34
|
+
html: '<html><body>NotebookLM</body></html>',
|
|
35
|
+
sourcePath: '/notebook/nb-demo',
|
|
36
|
+
readyState: 'complete',
|
|
37
|
+
csrfToken: 'csrf-wiz',
|
|
38
|
+
sessionId: 'sess-wiz',
|
|
39
|
+
})),
|
|
40
|
+
} as unknown as IPage;
|
|
41
|
+
|
|
42
|
+
await expect(getNotebooklmPageAuth(page)).resolves.toEqual({
|
|
43
|
+
csrfToken: 'csrf-wiz',
|
|
44
|
+
sessionId: 'sess-wiz',
|
|
45
|
+
sourcePath: '/notebook/nb-demo',
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('retries token extraction once when the first probe returns no tokens', async () => {
|
|
50
|
+
const page = {
|
|
51
|
+
evaluate: vi.fn()
|
|
52
|
+
.mockResolvedValueOnce({
|
|
53
|
+
html: '<html><body>Loading…</body></html>',
|
|
54
|
+
sourcePath: '/notebook/nb-demo',
|
|
55
|
+
readyState: 'interactive',
|
|
56
|
+
csrfToken: '',
|
|
57
|
+
sessionId: '',
|
|
58
|
+
})
|
|
59
|
+
.mockResolvedValueOnce({
|
|
60
|
+
html: '<html>"SNlM0e":"csrf-123","FdrFJe":"sess-456"</html>',
|
|
61
|
+
sourcePath: '/notebook/nb-demo',
|
|
62
|
+
readyState: 'complete',
|
|
63
|
+
csrfToken: '',
|
|
64
|
+
sessionId: '',
|
|
65
|
+
}),
|
|
66
|
+
wait: vi.fn(async () => undefined),
|
|
67
|
+
} as unknown as IPage;
|
|
68
|
+
|
|
69
|
+
await expect(getNotebooklmPageAuth(page)).resolves.toEqual({
|
|
70
|
+
csrfToken: 'csrf-123',
|
|
71
|
+
sessionId: 'sess-456',
|
|
72
|
+
sourcePath: '/notebook/nb-demo',
|
|
73
|
+
});
|
|
74
|
+
expect(page.evaluate).toHaveBeenCalledTimes(2);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('builds the rpc body with the expected notebooklm payload shape', () => {
|
|
78
|
+
const body = buildNotebooklmRpcBody('wXbhsf', [null, 1, null, [2]], 'csrf-123');
|
|
79
|
+
|
|
80
|
+
expect(body).toContain('f.req=');
|
|
81
|
+
expect(body).toContain('at=csrf-123');
|
|
82
|
+
expect(body.endsWith('&')).toBe(true);
|
|
83
|
+
expect(decodeURIComponent(body)).toContain('"[null,1,null,[2]]"');
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('parses chunked batchexecute responses into json chunks', () => {
|
|
87
|
+
const raw = `)]}'\n107\n[["wrb.fr","wXbhsf","[[[\\\"Notebook One\\\",null,\\\"nb1\\\",null,null,[null,false,null,null,null,[1704067200]]]]]"]]`;
|
|
88
|
+
const chunks = parseNotebooklmChunkedResponse(raw);
|
|
89
|
+
|
|
90
|
+
expect(chunks).toHaveLength(1);
|
|
91
|
+
expect(Array.isArray(chunks[0])).toBe(true);
|
|
92
|
+
expect(chunks[0]).toEqual([
|
|
93
|
+
[
|
|
94
|
+
'wrb.fr',
|
|
95
|
+
'wXbhsf',
|
|
96
|
+
'[[["Notebook One",null,"nb1",null,null,[null,false,null,null,null,[1704067200]]]]]',
|
|
97
|
+
],
|
|
98
|
+
]);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('extracts the rpc payload from wrb.fr responses', () => {
|
|
102
|
+
const raw = `)]}'\n107\n[["wrb.fr","wXbhsf","[[[\\\"Notebook One\\\",null,\\\"nb1\\\",null,null,[null,false,null,null,null,[1704067200]]]]]"]]`;
|
|
103
|
+
|
|
104
|
+
const result = extractNotebooklmRpcResult(raw, 'wXbhsf');
|
|
105
|
+
|
|
106
|
+
expect(result).toEqual([
|
|
107
|
+
[
|
|
108
|
+
['Notebook One', null, 'nb1', null, null, [null, false, null, null, null, [1704067200]]],
|
|
109
|
+
],
|
|
110
|
+
]);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it('classifies auth errors as AuthRequiredError', () => {
|
|
114
|
+
const raw = `)]}'\n25\n[["er",null,null,null,null,401,"generic"]]`;
|
|
115
|
+
|
|
116
|
+
expect(() => extractNotebooklmRpcResult(raw, 'wXbhsf')).toThrow(AuthRequiredError);
|
|
117
|
+
|
|
118
|
+
try {
|
|
119
|
+
extractNotebooklmRpcResult(raw, 'wXbhsf');
|
|
120
|
+
} catch (error) {
|
|
121
|
+
expect(error).toBeInstanceOf(AuthRequiredError);
|
|
122
|
+
expect((error as AuthRequiredError).domain).toBe('notebooklm.google.com');
|
|
123
|
+
expect((error as AuthRequiredError).code).toBe('AUTH_REQUIRED');
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
});
|