publishport-opencli 1.0.19 → 1.0.21
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/cli-manifest.json +35 -0
- package/clis/12306/me.js +2 -2
- package/clis/12306/orders.js +3 -3
- package/clis/12306/passengers.js +3 -3
- package/clis/12306/price.js +1 -1
- package/clis/12306/stations.js +1 -1
- package/clis/12306/train.js +1 -1
- package/clis/12306/trains.js +1 -1
- package/clis/12306/utils.js +1 -1
- package/clis/1688/download.js +1 -1
- package/clis/1688/item.js +4 -4
- package/clis/1688/search.js +4 -4
- package/clis/1688/store.js +4 -4
- package/clis/1point3acres/forum.js +1 -1
- package/clis/1point3acres/forums.js +1 -1
- package/clis/1point3acres/notifications.js +1 -1
- package/clis/1point3acres/search.js +1 -1
- package/clis/1point3acres/thread.js +2 -2
- package/clis/1point3acres/user.js +1 -1
- package/clis/1point3acres/utils.js +2 -2
- package/clis/36kr/article.js +2 -2
- package/clis/36kr/hot.js +2 -2
- package/clis/36kr/news.js +1 -1
- package/clis/36kr/search.js +2 -2
- package/clis/51job/company.js +2 -2
- package/clis/51job/detail.js +2 -2
- package/clis/51job/hot.js +1 -1
- package/clis/51job/search.js +1 -1
- package/clis/51job/utils.js +7 -7
- package/clis/_atlassian/shared.js +9 -9
- package/clis/_shared/article/auth.js +4 -4
- package/clis/_shared/article/douban-md2draft.js +4 -4
- package/clis/_shared/article/format.js +1 -1
- package/clis/_shared/article/images.js +7 -7
- package/clis/_shared/article/login.js +1 -1
- package/clis/_shared/article/publish.js +11 -11
- package/clis/_shared/common.js +1 -1
- package/clis/_shared/content-guard.js +1 -1
- package/clis/_shared/desktop-commands.js +1 -1
- package/clis/_shared/file-inject.js +12 -12
- package/clis/_shared/self-hosted-sites.js +2 -2
- package/clis/_shared/site-auth.js +1 -1
- package/clis/_shared/token-auth.js +2 -2
- package/clis/_shared/video-publish.js +9 -9
- package/clis/amazon/offer.js +3 -3
- package/clis/amazon/product.js +5 -5
- package/clis/amazon/shared.js +6 -6
- package/clis/antigravity/_actions.js +13 -13
- package/clis/antigravity/audit-extras.js +10 -10
- package/clis/antigravity/delete.js +1 -1
- package/clis/antigravity/model.js +6 -6
- package/clis/antigravity/new.js +2 -2
- package/clis/antigravity/read.js +2 -2
- package/clis/antigravity/rename.js +1 -1
- package/clis/antigravity/send.js +3 -3
- package/clis/antigravity/serve.js +17 -17
- package/clis/antigravity/storage.js +6 -6
- package/clis/antigravity/watch.js +2 -2
- package/clis/apple-podcasts/episodes.js +1 -1
- package/clis/apple-podcasts/top.js +1 -1
- package/clis/apple-podcasts/utils.js +1 -1
- package/clis/archive/item.js +1 -1
- package/clis/archive/search.js +1 -1
- package/clis/archive/snapshots.js +1 -1
- package/clis/archive/wayback.js +1 -1
- package/clis/arxiv/author.js +1 -1
- package/clis/arxiv/utils.js +1 -1
- package/clis/autohome/brand.js +1 -1
- package/clis/autohome/score.js +1 -1
- package/clis/autohome/utils.js +1 -1
- package/clis/baijiahao/article.js +1 -1
- package/clis/baijiahao/lists.js +1 -1
- package/clis/baijiahao/login.js +1 -1
- package/clis/baijiahao/publish.js +9 -9
- package/clis/baijiahao/stats.js +1 -1
- package/clis/baijiahao/whoami.js +1 -1
- package/clis/band/bands.js +2 -2
- package/clis/band/mentions.js +2 -2
- package/clis/band/post.js +4 -4
- package/clis/band/posts.js +3 -3
- package/clis/barchart/flow.js +3 -3
- package/clis/barchart/greeks.js +2 -2
- package/clis/barchart/quote.js +3 -3
- package/clis/bbc/news.js +1 -1
- package/clis/bbc/topic.js +1 -1
- package/clis/bbc/utils.js +1 -1
- package/clis/bilibili/article.js +1 -1
- package/clis/bilibili/categories.js +1 -1
- package/clis/bilibili/coin.js +1 -1
- package/clis/bilibili/comment-del.js +1 -1
- package/clis/bilibili/comment-like.js +1 -1
- package/clis/bilibili/comment.js +1 -1
- package/clis/bilibili/comments.js +1 -1
- package/clis/bilibili/dm-list.js +1 -1
- package/clis/bilibili/dm-read.js +1 -1
- package/clis/bilibili/dm-send.js +1 -1
- package/clis/bilibili/download.js +2 -2
- package/clis/bilibili/drafts.js +1 -1
- package/clis/bilibili/dynamic-post.js +3 -3
- package/clis/bilibili/favorite-add.js +1 -1
- package/clis/bilibili/favorite.js +1 -1
- package/clis/bilibili/feed.js +2 -2
- package/clis/bilibili/follow.js +1 -1
- package/clis/bilibili/following.js +1 -1
- package/clis/bilibili/like.js +1 -1
- package/clis/bilibili/partitions.js +1 -1
- package/clis/bilibili/stats.js +1 -1
- package/clis/bilibili/subtitle.js +3 -3
- package/clis/bilibili/summary.js +1 -1
- package/clis/bilibili/topics.js +1 -1
- package/clis/bilibili/unfollow.js +1 -1
- package/clis/bilibili/upload.js +1 -1
- package/clis/bilibili/utils.js +10 -10
- package/clis/bilibili/video-drafts.js +1 -1
- package/clis/bilibili/video.js +1 -1
- package/clis/bloomberg/businessweek.js +4 -4
- package/clis/bloomberg/news.js +2 -2
- package/clis/bloomberg/utils.js +13 -13
- package/clis/bluesky/post.js +1 -1
- package/clis/bluesky/shared.js +11 -11
- package/clis/bluesky/whoami.js +1 -1
- package/clis/booking/search.js +2 -2
- package/clis/boss/accept.js +1 -1
- package/clis/boss/applied.js +1 -1
- package/clis/boss/auth.js +1 -1
- package/clis/boss/batchgreet.js +1 -1
- package/clis/boss/bossinfo.js +1 -1
- package/clis/boss/chatlist.js +1 -1
- package/clis/boss/chatmsg.js +1 -1
- package/clis/boss/cities.js +1 -1
- package/clis/boss/detail.js +1 -1
- package/clis/boss/exchange.js +1 -1
- package/clis/boss/greet.js +1 -1
- package/clis/boss/interviews.js +1 -1
- package/clis/boss/invite.js +1 -1
- package/clis/boss/joblist.js +1 -1
- package/clis/boss/mark.js +1 -1
- package/clis/boss/me.js +2 -2
- package/clis/boss/recommend.js +1 -1
- package/clis/boss/resumedelete.js +1 -1
- package/clis/boss/resumelist.js +1 -1
- package/clis/boss/resumeupload.js +11 -11
- package/clis/boss/search.js +1 -1
- package/clis/boss/send.js +1 -1
- package/clis/boss/sendresume.js +1 -1
- package/clis/boss/stats.js +1 -1
- package/clis/boss/unread.js +1 -1
- package/clis/boss/utils.js +13 -13
- package/clis/chaoxing/assignments.js +1 -1
- package/clis/chaoxing/exams.js +1 -1
- package/clis/chaoxing/utils.js +9 -9
- package/clis/chatgpt/ask.js +1 -1
- package/clis/chatgpt/auth.js +2 -2
- package/clis/chatgpt/detail.js +1 -1
- package/clis/chatgpt/image.js +1 -1
- package/clis/chatgpt/read.js +1 -1
- package/clis/chatgpt/send.js +1 -1
- package/clis/chatgpt/utils.js +59 -59
- package/clis/chatgpt-app/ask.js +1 -1
- package/clis/chatgpt-app/send.js +1 -1
- package/clis/chatwise/model.js +6 -6
- package/clis/chess/analyze.js +1 -1
- package/clis/chess/game.js +1 -1
- package/clis/chess/games.js +1 -1
- package/clis/chess/stats.js +1 -1
- package/clis/chess/utils.js +1 -1
- package/clis/claude/ask.js +2 -2
- package/clis/claude/detail.js +1 -1
- package/clis/claude/new.js +1 -1
- package/clis/claude/read.js +1 -1
- package/clis/claude/send.js +1 -1
- package/clis/claude/utils.js +23 -23
- package/clis/cnblogs/article.js +1 -1
- package/clis/cnblogs/login.js +1 -1
- package/clis/cnblogs/stats.js +7 -7
- package/clis/cnblogs/whoami.js +1 -1
- package/clis/codex/_actions.js +3 -3
- package/clis/codex/archive.js +1 -1
- package/clis/codex/ask.js +6 -6
- package/clis/codex/model.js +8 -8
- package/clis/codex/pin.js +1 -1
- package/clis/codex/rename.js +4 -4
- package/clis/codex/send.js +3 -3
- package/clis/codex/sidebar.js +1 -1
- package/clis/coingecko/categories.js +1 -1
- package/clis/coingecko/coin.js +1 -1
- package/clis/coingecko/derivatives.js +1 -1
- package/clis/coingecko/exchanges.js +1 -1
- package/clis/coingecko/global.js +1 -1
- package/clis/coingecko/trending.js +1 -1
- package/clis/confluence/search.js +1 -1
- package/clis/coupang/product.js +3 -3
- package/clis/coupang/utils.js +1 -1
- package/clis/crates/crate.js +1 -1
- package/clis/crates/search.js +1 -1
- package/clis/crates/utils.js +1 -1
- package/clis/csdn/article.js +13 -13
- package/clis/csdn/columns.js +1 -1
- package/clis/csdn/login.js +1 -1
- package/clis/csdn/stats.js +4 -4
- package/clis/csdn/whoami.js +1 -1
- package/clis/cto51/article.js +1 -1
- package/clis/cto51/whoami.js +1 -1
- package/clis/ctrip/flight.js +2 -2
- package/clis/ctrip/hotel-search.js +3 -3
- package/clis/ctrip/hotel-suggest.js +1 -1
- package/clis/ctrip/search.js +1 -1
- package/clis/ctrip/utils.js +6 -6
- package/clis/cursor/ask.js +5 -5
- package/clis/cursor/composer.js +2 -2
- package/clis/cursor/model.js +4 -4
- package/clis/cursor/send.js +2 -2
- package/clis/dblp/author.js +1 -1
- package/clis/dblp/paper.js +1 -1
- package/clis/dblp/search.js +1 -1
- package/clis/dblp/utils.js +1 -1
- package/clis/dblp/venue.js +1 -1
- package/clis/deepseek/ask.js +1 -1
- package/clis/deepseek/auth.js +2 -2
- package/clis/deepseek/detail.js +1 -1
- package/clis/deepseek/new.js +1 -1
- package/clis/deepseek/read.js +1 -1
- package/clis/deepseek/send.js +7 -7
- package/clis/deepseek/utils.js +25 -25
- package/clis/defillama/protocol.js +1 -1
- package/clis/defillama/protocols.js +1 -1
- package/clis/defillama/utils.js +1 -1
- package/clis/devto/auth.js +2 -2
- package/clis/devto/latest.js +1 -1
- package/clis/devto/publish.js +5 -5
- package/clis/devto/read.js +2 -2
- package/clis/devto/stats.js +3 -3
- package/clis/dianping/auth.js +2 -2
- package/clis/dianping/cityResolver.js +2 -2
- package/clis/dianping/search.js +1 -1
- package/clis/dianping/shop.js +1 -1
- package/clis/dianping/utils.js +1 -1
- package/clis/discord-app/delete.js +3 -3
- package/clis/discord-app/read.js +1 -1
- package/clis/discord-app/thread-read.js +1 -1
- package/clis/discord-web/auth.js +2 -2
- package/clis/discord-web/send.js +5 -5
- package/clis/dockerhub/image.js +1 -1
- package/clis/dockerhub/search.js +1 -1
- package/clis/dockerhub/utils.js +1 -1
- package/clis/dongchedi/koubei.js +1 -1
- package/clis/dongchedi/models.js +1 -1
- package/clis/dongchedi/score.js +1 -1
- package/clis/dongchedi/search.js +1 -1
- package/clis/dongchedi/series.js +1 -1
- package/clis/dongchedi/specs.js +1 -1
- package/clis/dongchedi/utils.js +1 -1
- package/clis/douban/article.js +3 -3
- package/clis/douban/auth.js +2 -2
- package/clis/douban/download.js +1 -1
- package/clis/douban/utils.js +23 -23
- package/clis/doubao/auth.js +3 -3
- package/clis/doubao/utils.js +39 -39
- package/clis/doubao-app/ask.js +1 -1
- package/clis/doubao-app/utils.js +4 -4
- package/clis/douyin/_shared/browser-fetch.js +7 -7
- package/clis/douyin/_shared/draft-cache.js +1 -1
- package/clis/douyin/_shared/imagex-upload.js +1 -1
- package/clis/douyin/_shared/sts2.js +1 -1
- package/clis/douyin/_shared/text-extra.js +1 -1
- package/clis/douyin/_shared/tos-upload.js +4 -4
- package/clis/douyin/_shared/transcode.js +1 -1
- package/clis/douyin/_shared/vod-upload.js +4 -4
- package/clis/douyin/draft.js +18 -18
- package/clis/douyin/drafts.js +1 -1
- package/clis/douyin/publish-image.js +12 -12
- package/clis/douyin/publish.js +9 -9
- package/clis/douyin/search.js +3 -3
- package/clis/douyin/videos.js +1 -1
- package/clis/eastmoney/_secid.js +1 -1
- package/clis/eastmoney/announcement.js +1 -1
- package/clis/eastmoney/article.js +1 -1
- package/clis/eastmoney/convertible.js +1 -1
- package/clis/eastmoney/etf.js +1 -1
- package/clis/eastmoney/holders.js +1 -1
- package/clis/eastmoney/index-board.js +1 -1
- package/clis/eastmoney/kline.js +1 -1
- package/clis/eastmoney/kuaixun.js +1 -1
- package/clis/eastmoney/longhu.js +1 -1
- package/clis/eastmoney/money-flow.js +1 -1
- package/clis/eastmoney/northbound.js +1 -1
- package/clis/eastmoney/quote.js +1 -1
- package/clis/eastmoney/rank.js +1 -1
- package/clis/eastmoney/sectors.js +1 -1
- package/clis/endoflife/product.js +1 -1
- package/clis/endoflife/utils.js +1 -1
- package/clis/facebook/comment.js +8 -8
- package/clis/facebook/feed.js +4 -4
- package/clis/facebook/like.js +5 -5
- package/clis/facebook/notifications.js +3 -3
- package/clis/facebook/post.js +11 -11
- package/clis/facebook/search.js +3 -3
- package/clis/flathub/app.js +1 -1
- package/clis/flathub/search.js +1 -1
- package/clis/flathub/utils.js +1 -1
- package/clis/flomo/memos.js +1 -1
- package/clis/gemini/deep-research-result.js +4 -4
- package/clis/gemini/deep-research.js +1 -1
- package/clis/gemini/detail.js +1 -1
- package/clis/gemini/history.js +1 -1
- package/clis/gemini/image.js +2 -2
- package/clis/gemini/status.js +1 -1
- package/clis/gemini/utils.js +43 -43
- package/clis/geogebra/hexagon.js +1 -1
- package/clis/geogebra/info.js +3 -3
- package/clis/geogebra/triangle.js +1 -1
- package/clis/geogebra/utils.js +11 -11
- package/clis/ghost/login.js +1 -1
- package/clis/ghost/shared.js +2 -2
- package/clis/gitee/auth.js +2 -2
- package/clis/github-trending/repos.js +1 -1
- package/clis/google/news.js +1 -1
- package/clis/google/search.js +2 -2
- package/clis/google/suggest.js +1 -1
- package/clis/google/trends.js +1 -1
- package/clis/google/utils.js +1 -1
- package/clis/goproxy/module.js +1 -1
- package/clis/goproxy/utils.js +1 -1
- package/clis/goproxy/versions.js +1 -1
- package/clis/gov-policy/recent.js +2 -2
- package/clis/gov-policy/search.js +2 -2
- package/clis/grok/ask.js +1 -1
- package/clis/grok/detail.js +1 -1
- package/clis/grok/image.js +8 -8
- package/clis/grok/pin.js +1 -1
- package/clis/grok/send.js +1 -1
- package/clis/grok/status.js +1 -1
- package/clis/grok/utils.js +21 -21
- package/clis/guazi/browse.js +1 -1
- package/clis/guazi/car.js +1 -1
- package/clis/guazi/utils.js +1 -1
- package/clis/hackernews/auth.js +2 -2
- package/clis/hackernews/comment.js +8 -8
- package/clis/hackernews/read.js +7 -7
- package/clis/hackernews/submit.js +7 -7
- package/clis/hashnode/auth.js +3 -3
- package/clis/hashnode/publish.js +14 -14
- package/clis/hf/auth.js +2 -2
- package/clis/hf/models.js +1 -1
- package/clis/hf/paper.js +1 -1
- package/clis/hf/spaces.js +1 -1
- package/clis/hf/top.js +1 -1
- package/clis/homebrew/cask.js +1 -1
- package/clis/homebrew/formula.js +1 -1
- package/clis/homebrew/popular.js +1 -1
- package/clis/homebrew/utils.js +1 -1
- package/clis/huodongxing/events.js +1 -1
- package/clis/hupu/detail.js +4 -4
- package/clis/hupu/hot.js +3 -3
- package/clis/hupu/reply.js +1 -1
- package/clis/hupu/search.js +1 -1
- package/clis/hupu/unlike.js +1 -1
- package/clis/hupu/utils.js +10 -10
- package/clis/imdb/person.js +2 -2
- package/clis/imdb/reviews.js +3 -3
- package/clis/imdb/search.js +2 -2
- package/clis/imdb/title.js +1 -1
- package/clis/imdb/top.js +1 -1
- package/clis/imdb/trending.js +1 -1
- package/clis/imdb/utils.js +13 -13
- package/clis/imooc/article.js +6 -6
- package/clis/imooc/login.js +1 -1
- package/clis/imooc/whoami.js +1 -1
- package/clis/indeed/job.js +2 -2
- package/clis/indeed/search.js +2 -2
- package/clis/indeed/utils.js +1 -1
- package/clis/infoq/article.js +2 -2
- package/clis/infoq/login.js +1 -1
- package/clis/infoq/whoami.js +1 -1
- package/clis/instagram/_shared/private-publish.js +4 -4
- package/clis/instagram/_shared/protocol-capture.js +9 -9
- package/clis/instagram/detail.js +3 -3
- package/clis/instagram/post.js +25 -25
- package/clis/instagram/reel.js +18 -18
- package/clis/instagram/story.js +4 -4
- package/clis/instagram/user.js +2 -2
- package/clis/jd/item.js +65 -65
- package/clis/jianshu/article.js +1 -1
- package/clis/jianshu/login.js +1 -1
- package/clis/jianshu/notebooks.js +1 -1
- package/clis/jianshu/whoami.js +1 -1
- package/clis/jianyu/search.js +6 -6
- package/clis/jianyu/shared/procurement-contract.js +1 -1
- package/clis/jike/api.js +6 -6
- package/clis/jike/auth.js +3 -3
- package/clis/jike/comment.js +1 -1
- package/clis/jike/create.js +6 -6
- package/clis/jike/feed.js +3 -3
- package/clis/jike/like.js +1 -1
- package/clis/jike/notifications.js +3 -3
- package/clis/jike/repost.js +13 -13
- package/clis/jike/search.js +3 -3
- package/clis/jimeng/auth.js +2 -2
- package/clis/jimeng/generate.js +10 -10
- package/clis/jira/shared.js +1 -1
- package/clis/juejin/article.js +4 -4
- package/clis/juejin/categories.js +1 -1
- package/clis/juejin/hot.js +1 -1
- package/clis/juejin/login.js +1 -1
- package/clis/juejin/recommend.js +1 -1
- package/clis/juejin/stats.js +3 -3
- package/clis/juejin/tags.js +1 -1
- package/clis/juejin/utils.js +1 -1
- package/clis/juejin/whoami.js +1 -1
- package/clis/ke/utils.js +4 -4
- package/clis/kimi/_utils.js +7 -7
- package/clis/kimi/audit-extras.js +14 -14
- package/clis/kimi/auth.js +3 -3
- package/clis/kimi/chat.js +15 -15
- package/clis/kimi/storage.js +5 -5
- package/clis/kimi/ui.js +13 -13
- package/clis/kimi/usage.js +3 -3
- package/clis/kuaishou/auth.js +1 -1
- package/clis/kuaishou/publish.js +6 -6
- package/clis/lesswrong/_helpers.js +5 -5
- package/clis/lesswrong/comments.js +5 -5
- package/clis/lichess/top.js +1 -1
- package/clis/lichess/user.js +1 -1
- package/clis/lichess/utils.js +1 -1
- package/clis/linkedin/comment.js +1 -1
- package/clis/linkedin/connect.js +11 -11
- package/clis/linkedin/create.js +5 -5
- package/clis/linkedin/follow.js +1 -1
- package/clis/linkedin/inbox.js +1 -1
- package/clis/linkedin/job-detail.js +3 -3
- package/clis/linkedin/like.js +1 -1
- package/clis/linkedin/notifications.js +1 -1
- package/clis/linkedin/people-search.js +1 -1
- package/clis/linkedin/post-comments.js +1 -1
- package/clis/linkedin/post-detail.js +1 -1
- package/clis/linkedin/profile-analytics.js +1 -1
- package/clis/linkedin/profile-api.js +13 -13
- package/clis/linkedin/profile-experience.js +1 -1
- package/clis/linkedin/profile-projects.js +1 -1
- package/clis/linkedin/profile-read.js +3 -3
- package/clis/linkedin/reply.js +1 -1
- package/clis/linkedin/repost.js +1 -1
- package/clis/linkedin/safe-send.js +8 -8
- package/clis/linkedin/salesnav-inbox.js +5 -5
- package/clis/linkedin/salesnav-message.js +3 -3
- package/clis/linkedin/salesnav-search.js +4 -4
- package/clis/linkedin/salesnav-thread.js +1 -1
- package/clis/linkedin/search-api.js +3 -3
- package/clis/linkedin/search.js +8 -8
- package/clis/linkedin/social-api.js +31 -31
- package/clis/linkedin/timeline.js +3 -3
- package/clis/linkedin-learning/search.js +2 -2
- package/clis/linkedin-learning/trending.js +2 -2
- package/clis/linux-do/feed.js +4 -4
- package/clis/linux-do/topic-content.js +8 -8
- package/clis/lobsters/domain.js +1 -1
- package/clis/lobsters/read.js +7 -7
- package/clis/maimai/auth.js +2 -2
- package/clis/maimai/search-talents.js +4 -4
- package/clis/manus/_utils.js +1 -1
- package/clis/mastodon/login.js +1 -1
- package/clis/mastodon/post.js +1 -1
- package/clis/mastodon/shared.js +12 -12
- package/clis/mastodon/whoami.js +1 -1
- package/clis/maven/artifact.js +1 -1
- package/clis/maven/search.js +1 -1
- package/clis/maven/utils.js +1 -1
- package/clis/mdn/search.js +1 -1
- package/clis/medium/article.js +5 -5
- package/clis/medium/login.js +1 -1
- package/clis/medium/stats.js +3 -3
- package/clis/medium/tag.js +1 -1
- package/clis/medium/whoami.js +1 -1
- package/clis/mubu/notes.js +1 -1
- package/clis/mubu/utils.js +15 -15
- package/clis/note/auth.js +2 -2
- package/clis/note/note-utils.js +2 -2
- package/clis/note/publish.js +8 -8
- package/clis/notebooklm/add-source.js +8 -8
- package/clis/notebooklm/create.js +1 -1
- package/clis/notebooklm/generate-slides.js +1 -1
- package/clis/notebooklm/notes-get.js +1 -1
- package/clis/notebooklm/rpc.js +8 -8
- package/clis/notebooklm/source-fulltext.js +1 -1
- package/clis/notebooklm/utils.js +10 -10
- package/clis/nowcoder/auth.js +2 -2
- package/clis/nowcoder/comment.js +1 -1
- package/clis/nowcoder/comments.js +1 -1
- package/clis/nowcoder/dm-list.js +1 -1
- package/clis/nowcoder/dm-read.js +1 -1
- package/clis/nowcoder/dm-send.js +1 -1
- package/clis/nowcoder/drafts.js +1 -1
- package/clis/nowcoder/inbox.js +1 -1
- package/clis/nowcoder/like.js +1 -1
- package/clis/nowcoder/my.js +1 -1
- package/clis/nowcoder/post.js +1 -1
- package/clis/nowcoder/utils.js +13 -13
- package/clis/npm/downloads.js +1 -1
- package/clis/npm/package.js +1 -1
- package/clis/npm/search.js +1 -1
- package/clis/npm/utils.js +1 -1
- package/clis/nuget/package.js +1 -1
- package/clis/nuget/search.js +1 -1
- package/clis/nuget/utils.js +1 -1
- package/clis/nvd/cve.js +1 -1
- package/clis/oeis/search.js +1 -1
- package/clis/oeis/sequence.js +1 -1
- package/clis/oeis/utils.js +1 -1
- package/clis/ones/common.js +6 -6
- package/clis/ones/enrich-tasks.js +1 -1
- package/clis/ones/my-tasks.js +1 -1
- package/clis/ones/resolve-labels.js +1 -1
- package/clis/ones/task-helpers.js +1 -1
- package/clis/ones/task.js +1 -1
- package/clis/ones/worklog.js +7 -7
- package/clis/openalex/search.js +1 -1
- package/clis/openalex/utils.js +1 -1
- package/clis/openalex/work.js +1 -1
- package/clis/openfda/drug-label.js +1 -1
- package/clis/openfda/food-recall.js +1 -1
- package/clis/openfda/utils.js +1 -1
- package/clis/openreview/author.js +1 -1
- package/clis/openreview/paper.js +1 -1
- package/clis/openreview/reviews.js +3 -3
- package/clis/openreview/search.js +1 -1
- package/clis/openreview/utils.js +1 -1
- package/clis/openreview/venue.js +1 -1
- package/clis/oschina/article.js +1 -1
- package/clis/oschina/catalogs.js +1 -1
- package/clis/oschina/login.js +1 -1
- package/clis/oschina/stats.js +6 -6
- package/clis/oschina/whoami.js +1 -1
- package/clis/osv/query.js +1 -1
- package/clis/osv/utils.js +1 -1
- package/clis/osv/vulnerability.js +1 -1
- package/clis/packagist/package.js +1 -1
- package/clis/packagist/search.js +1 -1
- package/clis/packagist/utils.js +1 -1
- package/clis/pinterest/api.js +1 -1
- package/clis/pinterest/auth.js +1 -1
- package/clis/pinterest/boards.js +1 -1
- package/clis/pinterest/client.js +6 -6
- package/clis/pinterest/publish.js +5 -5
- package/clis/pixiv/auth.js +2 -2
- package/clis/pixiv/download.js +1 -1
- package/clis/pixiv/illusts.js +1 -1
- package/clis/pixiv/search.js +1 -1
- package/clis/pixiv/utils.js +3 -3
- package/clis/powerchina/auth.js +2 -2
- package/clis/powerchina/search.js +1 -1
- package/clis/producthunt/browse.js +2 -2
- package/clis/producthunt/hot.js +2 -2
- package/clis/producthunt/posts.js +1 -1
- package/clis/producthunt/today.js +1 -1
- package/clis/producthunt/utils.js +1 -1
- package/clis/pypi/downloads.js +1 -1
- package/clis/pypi/package.js +1 -1
- package/clis/pypi/utils.js +1 -1
- package/clis/qiita/auth.js +1 -1
- package/clis/qiita/gql.js +6 -6
- package/clis/qiita/publish.js +4 -4
- package/clis/qiita/stats.js +4 -4
- package/clis/qoder/_utils.js +16 -16
- package/clis/qoder/composer.js +1 -1
- package/clis/qoder/quest.js +1 -1
- package/clis/qoder/ui.js +14 -14
- package/clis/quark/auth.js +2 -2
- package/clis/quark/utils.js +2 -2
- package/clis/quora/answer-comments.js +3 -3
- package/clis/quora/create-answer.js +4 -4
- package/clis/quora/create-question.js +3 -3
- package/clis/quora/shared.js +17 -17
- package/clis/quora/whoami.js +1 -1
- package/clis/qwen/ask.js +1 -1
- package/clis/qwen/auth.js +3 -3
- package/clis/qwen/detail.js +1 -1
- package/clis/qwen/image.js +5 -5
- package/clis/qwen/status.js +1 -1
- package/clis/qwen/utils.js +16 -16
- package/clis/reddit/home.js +3 -3
- package/clis/reddit/read.js +10 -10
- package/clis/reddit/reply.js +4 -4
- package/clis/reddit/submit.js +11 -11
- package/clis/reddit/subreddit-info.js +3 -3
- package/clis/reddit/subscribed.js +4 -4
- package/clis/reddit/whoami.js +2 -2
- package/clis/rednote/comments.js +1 -1
- package/clis/rednote/download.js +1 -1
- package/clis/rednote/feed.js +1 -1
- package/clis/rednote/note.js +1 -1
- package/clis/rednote/notifications.js +2 -2
- package/clis/rednote/search.js +2 -2
- package/clis/rest-countries/country.js +1 -1
- package/clis/rest-countries/region.js +1 -1
- package/clis/rest-countries/utils.js +1 -1
- package/clis/reuters/article-detail.js +1 -1
- package/clis/reuters/auth.js +3 -3
- package/clis/reuters/search.js +1 -1
- package/clis/reuters/utils.js +4 -4
- package/clis/rfc/rfc.js +1 -1
- package/clis/rfc/utils.js +1 -1
- package/clis/rubygems/gem.js +1 -1
- package/clis/rubygems/search.js +1 -1
- package/clis/rubygems/utils.js +1 -1
- package/clis/segmentfault/article.js +3 -3
- package/clis/segmentfault/channels.js +1 -1
- package/clis/segmentfault/login.js +1 -1
- package/clis/segmentfault/stats.js +4 -4
- package/clis/segmentfault/tags.js +1 -1
- package/clis/segmentfault/whoami.js +1 -1
- package/clis/semanticscholar/citations.js +1 -1
- package/clis/semanticscholar/paper.js +1 -1
- package/clis/semanticscholar/recommendations.js +1 -1
- package/clis/semanticscholar/search.js +1 -1
- package/clis/semanticscholar/utils.js +1 -1
- package/clis/sinafinance/news.js +1 -1
- package/clis/sinafinance/stock-rank.js +1 -1
- package/clis/sinafinance/stock.js +1 -1
- package/clis/slock/attachment-download.js +1 -1
- package/clis/slock/attachment-upload.js +7 -7
- package/clis/slock/attachment-url.js +1 -1
- package/clis/slock/auth-verify.js +1 -1
- package/clis/slock/bookmark-add.js +1 -1
- package/clis/slock/bookmark-remove.js +1 -1
- package/clis/slock/channel-action.js +1 -1
- package/clis/slock/channel-create.js +1 -1
- package/clis/slock/channel-files.js +1 -1
- package/clis/slock/channel-list.js +1 -1
- package/clis/slock/channel-mark.js +1 -1
- package/clis/slock/channel-members.js +1 -1
- package/clis/slock/channel-unarchive.js +1 -1
- package/clis/slock/dm-list.js +1 -1
- package/clis/slock/errors.js +1 -1
- package/clis/slock/in-page.js +28 -28
- package/clis/slock/inbox-done.js +5 -5
- package/clis/slock/inbox.js +1 -1
- package/clis/slock/message-read.js +22 -22
- package/clis/slock/message-search.js +10 -10
- package/clis/slock/message-send.js +25 -25
- package/clis/slock/reaction-add.js +1 -1
- package/clis/slock/reaction-remove.js +1 -1
- package/clis/slock/resolve.js +1 -1
- package/clis/slock/server-list.js +2 -2
- package/clis/slock/task-claim.js +4 -4
- package/clis/slock/task-convert.js +13 -13
- package/clis/slock/task-create.js +1 -1
- package/clis/slock/task-delete.js +5 -5
- package/clis/slock/task-get.js +5 -5
- package/clis/slock/task-list-server.js +4 -4
- package/clis/slock/task-list.js +5 -5
- package/clis/slock/task-status.js +3 -3
- package/clis/slock/task-unclaim.js +3 -3
- package/clis/slock/thread-follow.js +1 -1
- package/clis/slock/thread-state.js +1 -1
- package/clis/slock/unread-summary.js +5 -5
- package/clis/slock/whoami.js +1 -1
- package/clis/smzdm/search.js +3 -3
- package/clis/sohu/article.js +1 -1
- package/clis/sohu/attributes.js +1 -1
- package/clis/sohu/categories.js +1 -1
- package/clis/sohu/channels.js +1 -1
- package/clis/sohu/columns.js +1 -1
- package/clis/sohu/login.js +1 -1
- package/clis/sohu/stats.js +3 -3
- package/clis/sohu/topics.js +1 -1
- package/clis/sohu/whoami.js +1 -1
- package/clis/spotify/spotify.js +1 -1
- package/clis/stackoverflow/read.js +6 -6
- package/clis/stackoverflow/related.js +1 -1
- package/clis/stackoverflow/tag.js +1 -1
- package/clis/stackoverflow/user.js +1 -1
- package/clis/stackoverflow/utils.js +1 -1
- package/clis/steam/app.js +1 -1
- package/clis/steam/search.js +1 -1
- package/clis/steam/utils.js +1 -1
- package/clis/substack/auth.js +2 -2
- package/clis/substack/post-utils.js +2 -2
- package/clis/substack/publish.js +5 -5
- package/clis/suno/auth.js +2 -2
- package/clis/suno/download.js +5 -5
- package/clis/suno/generate.js +3 -3
- package/clis/suno/list.js +1 -1
- package/clis/suno/status.js +1 -1
- package/clis/suno/utils.js +29 -29
- package/clis/telegram/send.js +7 -7
- package/clis/telegram/shared.js +2 -2
- package/clis/telegram/whoami.js +1 -1
- package/clis/test-utils.js +1 -1
- package/clis/threads/post.js +23 -23
- package/clis/threads/shared.js +3 -3
- package/clis/threads/whoami.js +1 -1
- package/clis/tieba/hot.js +3 -3
- package/clis/tieba/posts.js +1 -1
- package/clis/tieba/read.js +2 -2
- package/clis/tieba/search.js +3 -3
- package/clis/tieba/utils.js +1 -1
- package/clis/tiktok/comment.js +2 -2
- package/clis/tiktok/creator-videos.js +3 -3
- package/clis/tiktok/explore.js +3 -3
- package/clis/tiktok/follow.js +8 -8
- package/clis/tiktok/following.js +4 -4
- package/clis/tiktok/friends.js +7 -7
- package/clis/tiktok/live.js +3 -3
- package/clis/tiktok/notifications.js +6 -6
- package/clis/tiktok/publish.js +16 -16
- package/clis/tiktok/unfollow.js +4 -4
- package/clis/tiktok/user.js +2 -2
- package/clis/tiktok/utils.js +1 -1
- package/clis/toutiao/article.js +1 -1
- package/clis/toutiao/articles.js +2 -2
- package/clis/toutiao/auth.js +2 -2
- package/clis/toutiao/hot.js +1 -1
- package/clis/toutiao/recommend.js +1 -1
- package/clis/toutiao/utils.js +2 -2
- package/clis/trae-solo/_actions.js +4 -4
- package/clis/trae-solo/_fs.js +5 -5
- package/clis/trae-solo/_state.js +2 -2
- package/clis/trae-solo/automation.js +4 -4
- package/clis/trae-solo/mode.js +4 -4
- package/clis/trae-solo/model.js +4 -4
- package/clis/trae-solo/renderer-storage.js +4 -4
- package/clis/trae-solo/settings.js +1 -1
- package/clis/trae-solo/skill-fs.js +1 -1
- package/clis/trae-solo/skill.js +12 -12
- package/clis/trae-solo/state-fs.js +2 -2
- package/clis/trae-solo/task-fs.js +5 -5
- package/clis/trae-solo/workspaces-fs.js +1 -1
- package/clis/tumblr/auth.js +2 -2
- package/clis/tumblr/publish.js +3 -3
- package/clis/tvmaze/search.js +1 -1
- package/clis/tvmaze/show.js +1 -1
- package/clis/tvmaze/utils.js +1 -1
- package/clis/twitter/accept.js +7 -7
- package/clis/twitter/article.js +7 -7
- package/clis/twitter/bookmark-folder.js +3 -3
- package/clis/twitter/bookmark-folders.js +3 -3
- package/clis/twitter/bookmarks.js +4 -4
- package/clis/twitter/delete.js +5 -5
- package/clis/twitter/device-follow.js +3 -3
- package/clis/twitter/dm-list.js +1 -1
- package/clis/twitter/dm-read.js +1 -1
- package/clis/twitter/dm-send.js +5 -5
- package/clis/twitter/dm-shared.js +3 -3
- package/clis/twitter/download.js +6 -6
- package/clis/twitter/followers.js +5 -5
- package/clis/twitter/following.js +2 -2
- package/clis/twitter/like.js +3 -3
- package/clis/twitter/likes.js +8 -8
- package/clis/twitter/list-add-core.js +9 -9
- package/clis/twitter/list-create.js +5 -5
- package/clis/twitter/list-remove-core.js +9 -9
- package/clis/twitter/list-tweets.js +7 -7
- package/clis/twitter/lists.js +6 -6
- package/clis/twitter/notifications.js +2 -2
- package/clis/twitter/post.js +24 -24
- package/clis/twitter/profile.js +7 -7
- package/clis/twitter/quote.js +7 -7
- package/clis/twitter/reply-dm.js +7 -7
- package/clis/twitter/reply.js +12 -12
- package/clis/twitter/retweet.js +3 -3
- package/clis/twitter/scheduled-delete.js +3 -3
- package/clis/twitter/scheduled-list.js +2 -2
- package/clis/twitter/scheduled-utils.js +3 -3
- package/clis/twitter/search.js +5 -5
- package/clis/twitter/shared.js +6 -6
- package/clis/twitter/thread.js +4 -4
- package/clis/twitter/timeline.js +3 -3
- package/clis/twitter/trending.js +2 -2
- package/clis/twitter/tweets.js +11 -11
- package/clis/twitter/unlike.js +3 -3
- package/clis/twitter/unretweet.js +3 -3
- package/clis/twitter/utils.js +6 -6
- package/clis/upwork/detail.js +2 -2
- package/clis/upwork/feed.js +2 -2
- package/clis/upwork/search.js +2 -2
- package/clis/upwork/utils.js +1 -1
- package/clis/v2ex/auth.js +2 -2
- package/clis/v2ex/daily.js +3 -3
- package/clis/v2ex/me.js +2 -2
- package/clis/v2ex/notifications.js +2 -2
- package/clis/vk/post.js +1 -1
- package/clis/vk/shared.js +2 -2
- package/clis/vk/whoami.js +1 -1
- package/clis/web/read.js +8 -8
- package/clis/wechat-channels/auth.js +2 -2
- package/clis/wechat-channels/publish.js +30 -30
- package/clis/weibo/article.js +1 -1
- package/clis/weibo/auth.js +3 -3
- package/clis/weibo/comments.js +1 -1
- package/clis/weibo/delete.js +2 -2
- package/clis/weibo/feed.js +3 -3
- package/clis/weibo/hot.js +1 -1
- package/clis/weibo/publish.js +10 -10
- package/clis/weibo/search.js +2 -2
- package/clis/weibo/user-posts.js +3 -3
- package/clis/weibo/user.js +2 -2
- package/clis/weibo/utils.js +3 -3
- package/clis/weixin/article.js +1 -1
- package/clis/weixin/create-draft.js +26 -26
- package/clis/weixin/download.js +2 -2
- package/clis/weixin/login.js +1 -1
- package/clis/weixin/search.js +2 -2
- package/clis/weixin/stats.js +3 -3
- package/clis/weixin/whoami.js +1 -1
- package/clis/weread/ai-outline.js +2 -2
- package/clis/weread/book-search.js +2 -2
- package/clis/weread/book.js +2 -2
- package/clis/weread/notebooks.js +1 -1
- package/clis/weread/search.js +1 -1
- package/clis/weread/shelf.js +1 -1
- package/clis/weread/utils.js +6 -6
- package/clis/weread-official/book.js +1 -1
- package/clis/weread-official/discover.js +1 -1
- package/clis/weread-official/list-apis.js +1 -1
- package/clis/weread-official/notes.js +1 -1
- package/clis/weread-official/readdata.js +1 -1
- package/clis/weread-official/review.js +1 -1
- package/clis/weread-official/search.js +1 -1
- package/clis/weread-official/shelf.js +1 -1
- package/clis/weread-official/utils.js +1 -1
- package/clis/wikidata/entity.js +1 -1
- package/clis/wikidata/search.js +1 -1
- package/clis/wikidata/utils.js +1 -1
- package/clis/wikipedia/page.js +1 -1
- package/clis/wikipedia/trending.js +1 -1
- package/clis/wikipedia/utils.js +1 -1
- package/clis/wordpress/login.js +1 -1
- package/clis/wordpress/publish.js +1 -1
- package/clis/wordpress/shared.js +3 -3
- package/clis/wordpress/whoami.js +1 -1
- package/clis/woshipm/article.js +1 -1
- package/clis/woshipm/login.js +1 -1
- package/clis/woshipm/stats.js +4 -4
- package/clis/woshipm/whoami.js +1 -1
- package/clis/wttr/current.js +1 -1
- package/clis/wttr/forecast.js +1 -1
- package/clis/wttr/utils.js +1 -1
- package/clis/xianyu/collect.js +1 -1
- package/clis/xianyu/inbox.js +1 -1
- package/clis/xianyu/item-stats.js +2 -2
- package/clis/xianyu/location.js +1 -1
- package/clis/xianyu/manage.js +1 -1
- package/clis/xianyu/messages.js +1 -1
- package/clis/xianyu/mtop.js +5 -5
- package/clis/xianyu/order.js +1 -1
- package/clis/xianyu/promote-stats.js +2 -2
- package/clis/xianyu/publish.js +17 -17
- package/clis/xianyu/rate.js +1 -1
- package/clis/xianyu/reply.js +1 -1
- package/clis/xianyu/search.js +8 -8
- package/clis/xianyu/seller-data.js +1 -1
- package/clis/xianyu/seller-list.js +1 -1
- package/clis/xianyu/user.js +1 -1
- package/clis/xiaoe/catalog.js +2 -2
- package/clis/xiaoe/content.js +2 -2
- package/clis/xiaoe/courses.js +2 -2
- package/clis/xiaohongshu/ask.js +6 -6
- package/clis/xiaohongshu/comments.js +6 -6
- package/clis/xiaohongshu/creator-note-detail.js +7 -7
- package/clis/xiaohongshu/creator-notes-summary.js +1 -1
- package/clis/xiaohongshu/creator-notes.js +13 -13
- package/clis/xiaohongshu/creator-profile.js +2 -2
- package/clis/xiaohongshu/creator-stats.js +2 -2
- package/clis/xiaohongshu/delete-note.js +7 -7
- package/clis/xiaohongshu/download.js +4 -4
- package/clis/xiaohongshu/feed.js +2 -2
- package/clis/xiaohongshu/follow.js +3 -3
- package/clis/xiaohongshu/human.js +3 -3
- package/clis/xiaohongshu/note-helpers.js +1 -1
- package/clis/xiaohongshu/note.js +2 -2
- package/clis/xiaohongshu/notifications.js +1 -1
- package/clis/xiaohongshu/publish-video.js +8 -8
- package/clis/xiaohongshu/publish.js +59 -59
- package/clis/xiaohongshu/search.js +8 -8
- package/clis/xiaohongshu/unfollow.js +4 -4
- package/clis/xiaohongshu/user-helpers.js +1 -1
- package/clis/xiaohongshu/user.js +2 -2
- package/clis/xiaoyuzhou/auth.js +3 -3
- package/clis/xiaoyuzhou/download.js +1 -1
- package/clis/xiaoyuzhou/utils.js +1 -1
- package/clis/xueqiu/article.js +4 -4
- package/clis/xueqiu/comments.js +4 -4
- package/clis/xueqiu/danjuan-utils.js +4 -4
- package/clis/xueqiu/earnings-date.js +1 -1
- package/clis/xueqiu/events.js +3 -3
- package/clis/xueqiu/hashtags.js +3 -3
- package/clis/xueqiu/stocks.js +3 -3
- package/clis/xueqiu/users.js +3 -3
- package/clis/xueqiu/utils.js +3 -3
- package/clis/yahoo-finance/quote.js +1 -1
- package/clis/yollomi/background.js +1 -1
- package/clis/yollomi/edit.js +1 -1
- package/clis/yollomi/face-swap.js +1 -1
- package/clis/yollomi/generate.js +1 -1
- package/clis/yollomi/object-remover.js +1 -1
- package/clis/yollomi/remove-bg.js +1 -1
- package/clis/yollomi/restore.js +1 -1
- package/clis/yollomi/try-on.js +1 -1
- package/clis/yollomi/upload.js +4 -4
- package/clis/yollomi/upscale.js +1 -1
- package/clis/yollomi/utils.js +4 -4
- package/clis/yollomi/video.js +1 -1
- package/clis/youtube/channel.js +4 -4
- package/clis/youtube/feed.js +2 -2
- package/clis/youtube/like.js +5 -5
- package/clis/youtube/playlist.js +7 -7
- package/clis/youtube/publish.js +11 -11
- package/clis/youtube/search.js +3 -3
- package/clis/youtube/subscribe.js +7 -7
- package/clis/youtube/subscriptions.js +1 -1
- package/clis/youtube/transcript-group.js +2 -2
- package/clis/youtube/transcript.js +13 -13
- package/clis/youtube/unlike.js +5 -5
- package/clis/youtube/unsubscribe.js +7 -7
- package/clis/youtube/utils.js +3 -3
- package/clis/youtube/video.js +4 -4
- package/clis/youtube/watch-later.js +2 -2
- package/clis/yuanbao/ask.js +18 -18
- package/clis/yuanbao/detail.js +1 -1
- package/clis/yuanbao/read.js +1 -1
- package/clis/yuanbao/shared.js +9 -9
- package/clis/yuanbao/status.js +1 -1
- package/clis/yuque/article.js +1 -1
- package/clis/yuque/whoami.js +1 -1
- package/clis/zhihu/answer-comments.js +2 -2
- package/clis/zhihu/answer-detail.js +3 -3
- package/clis/zhihu/answer.js +1 -1
- package/clis/zhihu/article-transform.js +1 -1
- package/clis/zhihu/article.js +1 -1
- package/clis/zhihu/auth.js +2 -2
- package/clis/zhihu/collection.js +3 -3
- package/clis/zhihu/collections.js +3 -3
- package/clis/zhihu/download.js +2 -2
- package/clis/zhihu/image-profile.js +6 -6
- package/clis/zhihu/paginate.js +3 -3
- package/clis/zhihu/pin.js +4 -4
- package/clis/zhihu/question.js +3 -3
- package/clis/zhihu/recommend.js +3 -3
- package/clis/zhihu/search.js +3 -3
- package/clis/zhihu/stats.js +3 -3
- package/clis/zhihu/user-arg.js +1 -1
- package/clis/zhihu/write-shared.js +7 -7
- package/clis/zlibrary/utils.js +6 -6
- package/clis/zsxq/auth.js +3 -3
- package/clis/zsxq/search.js +1 -1
- package/clis/zsxq/topic.js +1 -1
- package/clis/zsxq/utils.js +5 -5
- package/dist/src/adapter-source.js +1 -1
- package/dist/src/browser/analyze.js +1 -1
- package/dist/src/browser/article-extract.js +2 -2
- package/dist/src/browser/ax-snapshot.js +2 -2
- package/dist/src/browser/base-page.js +25 -25
- package/dist/src/browser/bridge.js +1 -1
- package/dist/src/browser/cdp.js +1 -1
- package/dist/src/browser/daemon-client.js +1 -1
- package/dist/src/browser/daemon-lifecycle.js +7 -7
- package/dist/src/browser/dom-helpers.js +35 -35
- package/dist/src/browser/dom-snapshot.js +19 -19
- package/dist/src/browser/errors.js +3 -3
- package/dist/src/browser/extract.js +5 -5
- package/dist/src/browser/find.js +13 -13
- package/dist/src/browser/fingerprint.js +2 -2
- package/dist/src/browser/html-tree.js +6 -6
- package/dist/src/browser/managed-chrome.js +1 -1
- package/dist/src/browser/network-cache.js +1 -1
- package/dist/src/browser/network-key.js +1 -1
- package/dist/src/browser/page.js +7 -7
- package/dist/src/browser/profile.js +2 -2
- package/dist/src/browser/proxy-test.js +8 -8
- package/dist/src/browser/shape-filter.js +1 -1
- package/dist/src/browser/shape.js +1 -1
- package/dist/src/browser/stealth.js +3 -3
- package/dist/src/browser/tabs.js +2 -2
- package/dist/src/browser/target-errors.js +1 -1
- package/dist/src/browser/target-resolver.js +23 -23
- package/dist/src/browser/trace.js +2 -2
- package/dist/src/browser/utils.js +1 -1
- package/dist/src/browser/verify-fixture.js +2 -2
- package/dist/src/browser-session-lock.js +1 -1
- package/dist/src/build-manifest.js +11 -11
- package/dist/src/capabilityRouting.js +1 -1
- package/dist/src/cli-argv-preprocess.js +1 -1
- package/dist/src/cli.js +32 -32
- package/dist/src/commanderAdapter.js +3 -3
- package/dist/src/commands/auth.js +3 -3
- package/dist/src/commands/daemon.js +1 -1
- package/dist/src/completion-fast.js +1 -1
- package/dist/src/completion.js +1 -1
- package/dist/src/constants.js +1 -1
- package/dist/src/convention-audit.js +2 -2
- package/dist/src/daemon-utils.js +1 -1
- package/dist/src/daemon.js +1 -1
- package/dist/src/discovery.js +2 -2
- package/dist/src/doctor.js +9 -9
- package/dist/src/download/article-download.js +15 -15
- package/dist/src/download/index.js +4 -4
- package/dist/src/download/media-download.js +1 -1
- package/dist/src/download/progress.js +3 -3
- package/dist/src/electron-apps.js +1 -1
- package/dist/src/errors.js +2 -2
- package/dist/src/execution.js +2 -2
- package/dist/src/external.js +1 -1
- package/dist/src/help.js +8 -8
- package/dist/src/hooks.js +1 -1
- package/dist/src/interceptor.js +21 -21
- package/dist/src/launcher.js +7 -7
- package/dist/src/logger.js +8 -8
- package/dist/src/main.js +7 -7
- package/dist/src/observation/artifact.js +5 -5
- package/dist/src/observation/retention.js +1 -1
- package/dist/src/output.js +2 -2
- package/dist/src/package-paths.js +1 -1
- package/dist/src/pipeline/executor.js +1 -1
- package/dist/src/pipeline/registry.js +1 -1
- package/dist/src/pipeline/steps/browser.js +1 -1
- package/dist/src/pipeline/steps/download.js +1 -1
- package/dist/src/pipeline/steps/fetch.js +6 -6
- package/dist/src/pipeline/steps/intercept.js +1 -1
- package/dist/src/pipeline/steps/tap.js +17 -17
- package/dist/src/pipeline/steps/transform.js +1 -1
- package/dist/src/pipeline/template.js +1 -1
- package/dist/src/plugin-manifest.js +1 -1
- package/dist/src/plugin-scaffold.js +19 -19
- package/dist/src/plugin.js +12 -12
- package/dist/src/rate-limit.js +1 -1
- package/dist/src/registry.js +1 -1
- package/dist/src/runtime-detect.js +1 -1
- package/dist/src/runtime.js +1 -1
- package/dist/src/scripts/framework.js +1 -1
- package/dist/src/scripts/interact.js +1 -1
- package/dist/src/scripts/store.js +1 -1
- package/dist/src/serialization.js +2 -2
- package/dist/src/session-lease.js +1 -1
- package/dist/src/snapshotFormatter.js +2 -2
- package/dist/src/tui.js +12 -12
- package/dist/src/user-runtime.js +1 -1
- package/dist/src/utils.d.ts +12 -0
- package/dist/src/utils.js +4 -4
- package/dist/src/validate.js +2 -2
- package/dist/src/verify.js +2 -2
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{spawn as
|
|
2
|
-
`),"utf8")}finally{if(
|
|
3
|
-
${Object.entries(
|
|
1
|
+
import{spawn as T}from"node:child_process";import*as i from"node:fs";import*as g from"node:path";import*as N from"node:os";import{Readable as j,Transform as C}from"node:stream";import{pipeline as D}from"node:stream/promises";import{URL as S}from"node:url";import{isBinaryInstalled as F}from"../external.js";import{getErrorMessage as O}from"../errors.js";import{fetchWithNodeNetwork as I}from"../node-network.js";import{log as W}from"../logger.js";export function checkYtdlp(){return F("yt-dlp")}const M=["youtube.com","youtu.be","bilibili.com","twitter.com","x.com","tiktok.com","vimeo.com","twitch.tv"];function v(t){let e;try{e=new S(t).hostname.toLowerCase()}catch{return!1}return M.some((r)=>e===r||e.endsWith(`.${r}`))}const R=new Set([".jpg",".jpeg",".png",".gif",".webp",".svg",".ico",".bmp",".avif"]),A=new Set([".mp4",".webm",".avi",".mov",".mkv",".flv",".m3u8",".ts"]),L=new Set([".html",".htm",".json",".xml",".txt",".md",".markdown"]);export function detectContentType(t,e){if(e){if(e.startsWith("image/"))return"image";if(e.startsWith("video/"))return"video";if(e.startsWith("text/")||e.includes("json")||e.includes("xml"))return"document"}let r="";try{r=g.extname(new S(t).pathname).toLowerCase()}catch{return"binary"}if(R.has(r))return"image";if(A.has(r))return"video";if(v(t))return"video";if(L.has(r))return"document";return"binary"}export function requiresYtdlp(t){return v(t)}export async function httpDownload(t,e,r={},o=0){const{cookies:s,headers:c={},timeout:l=30000,onProgress:a,maxRedirects:p=10}=r,d={"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",...c};if(s)d.Cookie=s;const h=`${e}.tmp`,w=async()=>{try{await i.promises.rm(h,{force:!0})}catch{}},b=new AbortController,u=setTimeout(()=>b.abort(),l);try{const n=await I(t,{headers:d,signal:b.signal,redirect:"manual"});clearTimeout(u);if(n.status>=300&&n.status<400){const y=n.headers.get("location");if(y){if(o>=p)return{success:!1,size:0,error:`Too many redirects (> ${p})`};const x=resolveRedirectUrl(t,y),k=new S(t).hostname,_=new S(x).hostname,z=k===_?r:{...r,cookies:void 0,headers:U(r.headers)};return httpDownload(x,e,z,o+1)}}if(n.status!==200)return{success:!1,size:0,error:`HTTP ${n.status}`};if(!n.body)return{success:!1,size:0,error:"Empty response body"};const f=parseInt(n.headers.get("content-length")||"0",10);let m=0;const E=new C({transform(y,x,k){m+=y.length;if(a)a(m,f);k(null,y)}});try{await i.promises.mkdir(g.dirname(e),{recursive:!0});await D(j.fromWeb(n.body),E,i.createWriteStream(h));await i.promises.rename(h,e);return{success:!0,size:m}}catch(y){await w();return{success:!1,size:0,error:O(y)}}}catch(n){clearTimeout(u);await w();return{success:!1,size:0,error:n instanceof Error?n.message:String(n)}}}export function resolveRedirectUrl(t,e){return new S(e,t).toString()}function U(t){if(!t)return t;return Object.fromEntries(Object.entries(t).filter(([e])=>e.toLowerCase()!=="cookie"))}export function exportCookiesToNetscape(t,e){const r=["# Netscape HTTP Cookie File","# https://curl.se/docs/http-cookies.html","# This is a generated file! Do not edit.",""];for(const s of t){const c=s.domain.startsWith(".")?s.domain:`.${s.domain}`,l="TRUE",a=s.path||"/",p=s.secure?"TRUE":"FALSE",d=typeof s.expirationDate==="number"&&s.expirationDate>0?Math.floor(s.expirationDate):Math.floor(Date.now()/1000)+31536000,h=s.name.replace(/[\t\n\r]/g,""),w=s.value.replace(/[\t\n\r]/g,"");r.push(`${c} ${l} ${a} ${p} ${d} ${h} ${w}`)}i.mkdirSync(g.dirname(e),{recursive:!0});let o;try{o=i.openSync(e,i.constants.O_WRONLY|i.constants.O_CREAT|i.constants.O_TRUNC,384);i.fchmodSync(o,384);i.writeFileSync(o,r.join(`
|
|
2
|
+
`),"utf8")}finally{if(o!==void 0)i.closeSync(o)}}export function formatCookieHeader(t){return t.map((e)=>`${e.name}=${e.value}`).join("; ")}export async function ytdlpDownload(t,e,r={}){const{cookiesFile:o,format:s="best",extraArgs:c=[],onProgress:l}=r;if(!checkYtdlp())return{success:!1,size:0,error:"yt-dlp not installed. Install with: pip install yt-dlp"};return new Promise((a)=>{const p=g.dirname(e);i.mkdirSync(p,{recursive:!0});const d=[t,"-o",e,"-f",s,"--no-playlist","--progress"];if(o)if(i.existsSync(o))d.push("--cookies",o);else{W.warn(`[download] Cookies file not found: ${o}, falling back to browser cookies`);d.push("--cookies-from-browser","chrome")}else d.push("--cookies-from-browser","chrome");d.push(...c);const h=T("yt-dlp",d,{stdio:["ignore","pipe","pipe"]});let w=0,b="";h.stderr.on("data",(u)=>{const n=u.toString();b+=n;const f=n.match(/(\d+\.?\d*)%/);if(f&&l){const m=parseFloat(f[1]);if(m>w){w=m;l(m)}}});h.stdout.on("data",(u)=>{const f=u.toString().match(/(\d+\.?\d*)%/);if(f&&l){const m=parseFloat(f[1]);if(m>w){w=m;l(m)}}});h.on("close",(u)=>{if(u===0&&i.existsSync(e)){const n=i.statSync(e);a({success:!0,size:n.size})}else{const n=i.readdirSync(p).filter((f)=>f.startsWith(g.basename(e,g.extname(e))));if(n.length>0){const f=g.join(p,n[0]),m=i.statSync(f);a({success:!0,size:m.size})}else a({success:!1,size:0,error:b.slice(0,200)||`Exit code ${u}`})}});h.on("error",(u)=>{a({success:!1,size:0,error:u.message})})})}export async function saveDocument(t,e,r="markdown",o){try{const s=g.dirname(e);i.mkdirSync(s,{recursive:!0});let c;if(r==="json")c=JSON.stringify({...o,content:t},null,2);else if(r==="markdown")c=(o?`---
|
|
3
|
+
${Object.entries(o).map(([a,p])=>`${a}: ${JSON.stringify(p)}`).join(`
|
|
4
4
|
`)}
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
`:"")+
|
|
7
|
+
`:"")+t;else c=t;i.writeFileSync(e,c,"utf-8");return{success:!0,size:Buffer.byteLength(c,"utf-8")}}catch(s){return{success:!1,size:0,error:O(s)}}}export function sanitizeFilename(t,e=200){return t.replace(/[<>:"/\\|?*\x00-\x1f]/g,"_").replace(/\s+/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,"").slice(0,e)}export function generateFilename(t,e,r){try{const o=new S(t),s=o.pathname,c=g.basename(s);if(c&&c!=="/"&&c.includes("."))return sanitizeFilename(c);const l=r||H(t),a=o.hostname.replace(/^www\./,"");return sanitizeFilename(`${a}_${e+1}${l}`)}catch{const o=r||".bin";return`download_${e+1}${o}`}}function H(t){switch(detectContentType(t)){case"image":return".jpg";case"video":return".mp4";case"document":return".md";default:return".bin"}}export function getTempDir(){return g.join(N.tmpdir(),"opencli-download")}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as u from"node:fs";import*as r from"node:path";import{getErrorMessage as N}from"../errors.js";import{httpDownload as T,ytdlpDownload as M,checkYtdlp as _,getTempDir as A,exportCookiesToNetscape as B,sanitizeFilename as E}from"./index.js";import{DownloadProgressTracker as V,formatBytes as z}from"./progress.js";export async function downloadMedia(s,n){const{output:d,subdir:l,cookies:w,browserCookies:a,timeout:f,filenamePrefix:h="download",ytdlpExtraArgs:D=[],verbose:F=!0}=n;if(!s||s.length===0)return[{index:0,type:"-",status:"failed",size:"No media found"}];const k=l?r.join(d,l):d;u.mkdirSync(k,{recursive:!0});const S=_();let c;if(s.some((e)=>e.type==="video-tweet"||e.type==="video-ytdlp")&&a&&a.length>0){const e=A();u.mkdirSync(e,{recursive:!0});c=r.join(e,`media_cookies_${Date.now()}.txt`);B(a,c)}const p=new V(s.length,F),m=[];try{for(let e=0;e<s.length;e++){const o=s[e],x=o.type!=="image",Y=x?"mp4":"jpg",v=q(o.filename,h,e+1,Y),b=r.join(k,v),i=p.onFileStart(v,e);try{let t;if((o.type==="video-tweet"||o.type==="video-ytdlp")&&S)t=await M(o.url,b,{cookiesFile:c,extraArgs:D,onProgress:(g)=>{if(i)i.update(g,100)}});else{const g=f||(x?60000:30000);t=await T(o.url,b,{cookies:w,timeout:g,onProgress:(j,C)=>{if(i)i.update(j,C)}})}if(i)i.complete(t.success,t.success?z(t.size):void 0);p.onFileComplete(t.success);m.push({index:e+1,type:o.type==="video-tweet"||o.type==="video-ytdlp"?"video":o.type,status:t.success?"success":"failed",size:t.success?z(t.size):t.error||"unknown error"})}catch(t){const y=N(t);if(i)i.fail(y);p.onFileComplete(!1);m.push({index:e+1,type:o.type,status:"failed",size:y})}}}finally{p.finish();if(c&&u.existsSync(c))u.unlinkSync(c)}return m}function q(s,n,d,l){const a=`${P(r.basename(r.win32.basename(n)))||"download"}_${d}.${l}`;if(!s)return a;const f=r.basename(r.win32.basename(s));return P(f)||a}function P(s){const n=E(s);return n&&n!=="."&&n!==".."?n:""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export function formatBytes(
|
|
2
|
-
`)},fail(
|
|
3
|
-
`)}}}function
|
|
1
|
+
export function formatBytes(t){if(!Number.isFinite(t)||t<1)return"0 B";const e=1024,r=["B","KB","MB","GB","TB"],s=Math.min(r.length-1,Math.floor(Math.log(t)/Math.log(e)));return`${(t/Math.pow(e,s)).toFixed(1)} ${r[s]}`}export function formatDuration(t){if(t<1000)return`${t}ms`;const e=Math.floor(t/1000);if(e<60)return`${e}s`;const r=Math.floor(e/60);if(r<60){const o=e%60;return o>0?`${r}m ${o}s`:`${r}m`}const s=Math.floor(r/60),n=r%60;return n>0?`${s}h ${n}m`:`${s}h`}export function createProgressBar(t,e,r){const s=`[${e+1}/${r}]`,n=t.length>40?t.slice(0,37)+"...":t;return{update(o,i,a){const c=l(i>0?Math.round(o/i*100):0),h=d(c),p=i>0?formatBytes(i):"",u=a?` ${a}`:"";process.stderr.write(`\r${s} ${n} ${h} ${c}% ${p}${u}`)},complete(o,i){const a=o?"✓":"✗",c=i?` ${i}`:"";process.stderr.write(`\r${s} ${a} ${n}${c}
|
|
2
|
+
`)},fail(o){process.stderr.write(`\r${s} ✗ ${n} ${o}
|
|
3
|
+
`)}}}function l(t){if(!Number.isFinite(t))return 0;return Math.max(0,Math.min(100,t))}function d(t,e=20){const r=Math.round(t/100*e),s=e-r;return"█".repeat(r)+"░".repeat(s)}export class DownloadProgressTracker{completed=0;failed=0;skipped=0;total;startTime;verbose;constructor(t,e=!0){this.total=t;this.startTime=Date.now();this.verbose=e}onFileStart(t,e){if(!this.verbose)return null;return createProgressBar(t,e,this.total)}onFileComplete(t,e=!1){if(e)this.skipped++;else if(t)this.completed++;else this.failed++}getSummary(){const t=formatDuration(Date.now()-this.startTime),e=[];if(this.completed>0)e.push(`${this.completed} downloaded`);if(this.skipped>0)e.push(`${this.skipped} skipped`);if(this.failed>0)e.push(`${this.failed} failed`);return`${e.join(", ")} in ${t}`}finish(){if(this.verbose)process.stderr.write(`
|
|
4
4
|
Download complete: ${this.getSummary()}
|
|
5
5
|
`)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as s from"node:fs";import*as n from"node:path";import*as c from"node:os";import i from"js-yaml";export const builtinApps={cursor:{port:9226,processName:"Cursor",bundleId:"com.todesktop.runtime.Cursor",displayName:"Cursor"},codex:{port:9238,processName:"Codex",bundleId:"com.openai.codex",displayName:"Codex"},chatwise:{port:9228,processName:"ChatWise",bundleId:"com.chatwise.app",displayName:"ChatWise"},"discord-app":{port:9232,processName:"Discord",bundleId:"com.discord.app",displayName:"Discord"},"doubao-app":{port:9225,processName:"Doubao",bundleId:"com.volcengine.doubao",displayName:"Doubao"},antigravity:{port:9234,processName:"Antigravity",executableNames:["Electron","Antigravity"],bundleId:"dev.antigravity.app",displayName:"Antigravity"},"chatgpt-app":{port:9236,processName:"ChatGPT",bundleId:"com.openai.chat",displayName:"ChatGPT"},qoder:{port:9237,processName:"Qoder",executableNames:["Electron"],bundleId:"com.qoder.ide",displayName:"Qoder"},"trae-solo":{port:9235,processName:"TRAE SOLO",executableNames:["Electron","TRAE SOLO"],bundleId:"com.trae.solo.app",displayName:"Trae SOLO"},"trae-cn":{port:39240,processName:"Trae CN",executableNames:["Electron"],bundleId:"cn.trae.app",displayName:"Trae CN"}};export function loadApps(e){const o={...builtinApps};if(e){for(const[a,p]of Object.entries(e))if(!(a in o))o[a]=p}return o}let r=null;function t(){if(r)return r;let e;try{const o=n.join(c.homedir(),".ppcli","apps.yaml");if(s.existsSync(o)){const a=s.readFileSync(o,"utf-8");e=i.load(a)?.apps}}catch{}r=loadApps(e);return r}export function getElectronApp(e){return t()[e]}export function isElectronApp(e){return e in t()}export function getAllElectronApps(){return t()}export function _resetRegistry(){r=null}
|
package/dist/src/errors.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const EXIT_CODES={SUCCESS:0,GENERIC_ERROR:1,USAGE_ERROR:2,EMPTY_RESULT:66,SERVICE_UNAVAIL:69,TEMPFAIL:75,NOPERM:77,CONFIG_ERROR:78,INTERRUPTED:130};export class CliError extends Error{code;hint;exitCode;constructor(
|
|
2
|
-
`)}return String(
|
|
1
|
+
export const EXIT_CODES={SUCCESS:0,GENERIC_ERROR:1,USAGE_ERROR:2,EMPTY_RESULT:66,SERVICE_UNAVAIL:69,TEMPFAIL:75,NOPERM:77,CONFIG_ERROR:78,INTERRUPTED:130};export class CliError extends Error{code;hint;exitCode;constructor(e,t,n,o=EXIT_CODES.GENERIC_ERROR){super(t);this.name=new.target.name;this.code=e;this.hint=n;this.exitCode=o}}const r=Symbol.for("ppcli.traceReceipt");export function attachTraceReceipt(e,t){if(!e||typeof e!=="object"&&typeof e!=="function")return;try{Object.defineProperty(e,r,{value:t,enumerable:!1,configurable:!0})}catch{}}export function getTraceReceipt(e){if(!e||typeof e!=="object"&&typeof e!=="function")return;return e[r]}export class BrowserConnectError extends CliError{kind;constructor(e,t,n="unknown"){super("BROWSER_CONNECT",e,t,EXIT_CODES.SERVICE_UNAVAIL);this.kind=n}}export class CommandExecutionError extends CliError{constructor(e,t){super("COMMAND_EXEC",e,t,EXIT_CODES.GENERIC_ERROR)}}export class ConfigError extends CliError{constructor(e,t){super("CONFIG",e,t,EXIT_CODES.CONFIG_ERROR)}}export class AuthRequiredError extends CliError{domain;constructor(e,t){super("AUTH_REQUIRED",t??`Not logged in to ${e}`,`Please open Chrome or Chromium and log in to https://${e}`,EXIT_CODES.NOPERM);this.domain=e}}export class TimeoutError extends CliError{constructor(e,t,n){super("TIMEOUT",`${e} timed out after ${t}s`,n??"Try again, or increase timeout with --timeout <seconds> (or OPENCLI_BROWSER_COMMAND_TIMEOUT for the global default)",EXIT_CODES.TEMPFAIL)}}export class RateLimitError extends CliError{constructor(e,t,n){const o=c(t);super("RATE_LIMITED",`Rate limit exceeded for ${e}`,`Retry after ${o}. To change this limit, edit ${n}.`,EXIT_CODES.TEMPFAIL)}}export class ArgumentError extends CliError{constructor(e,t){super("ARGUMENT",e,t,EXIT_CODES.USAGE_ERROR)}}export class SessionBusyError extends CliError{constructor(e,t){super("SESSION_BUSY",e,t,EXIT_CODES.TEMPFAIL)}}export class EmptyResultError extends CliError{constructor(e,t){super("EMPTY_RESULT",`${e} returned no data`,t??"This usually means the target genuinely has no matching content — "+"an empty result is a valid answer, not a failure, and can be relied on (e.g. no comments found = this account has not commented there). Only suspect a broken adapter or expired login if you have other evidence that content should be there.",EXIT_CODES.EMPTY_RESULT)}}export function adapterLoadError(e,t){return new CliError("ADAPTER_LOAD",e,t,EXIT_CODES.SERVICE_UNAVAIL)}export function selectorError(e,t){return new CliError("SELECTOR",`Could not find element: ${e}`,t??"The page UI may have changed. Please report this issue.",EXIT_CODES.GENERIC_ERROR)}export class PluginError extends CliError{constructor(e,t){super("PLUGIN",e,t,EXIT_CODES.GENERIC_ERROR)}}function c(e){const t=Math.max(0,Math.ceil(e));if(t<1000)return`${t}ms`;const n=Math.ceil(t/1000);if(n<60)return`${n}s`;const o=Math.ceil(n/60);if(o<60)return`${o}m`;return`${Math.ceil(o/60)}h`}export class LoginWallError extends CliError{status;url;bodyPreview;constructor(e,t,n,o,s){super("LOGIN_WALL",e,s??"The server returned an HTML page instead of JSON — likely a login wall, rate limit, or WAF challenge. Try re-logging in via your browser, or wait a few minutes before retrying.",EXIT_CODES.NOPERM);this.status=t;this.url=n;this.bodyPreview=o}}export function getErrorMessage(e){return e instanceof Error?e.message:String(e)}function a(e,t=0){if(t>10)return"(cause chain truncated)";if(e instanceof Error){const n=[e.message];if(e.cause)n.push(` caused by: ${a(e.cause,t+1)}`);return n.join(`
|
|
2
|
+
`)}return String(e)}export function toEnvelope(e){const t=e instanceof Error&&e.cause?a(e.cause):void 0,n=getTraceReceipt(e),o=n?{traceId:n.traceId,dir:n.traceDir,summaryPath:n.summaryPath,receiptPath:n.receiptPath,status:n.status}:void 0;if(e instanceof CliError)return{ok:!1,error:{code:e.code,message:e.message,...e.hint?{help:e.hint}:{},exitCode:e.exitCode,...t?{cause:t}:{}},...o?{trace:o}:{}};return{ok:!1,error:{code:"UNKNOWN",message:getErrorMessage(e),exitCode:EXIT_CODES.GENERIC_ERROR,...t?{cause:t}:{}},...o?{trace:o}:{}}}
|
package/dist/src/execution.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{getRegistry as
|
|
2
|
-
`);try{
|
|
1
|
+
import{getRegistry as oe,fullName as g}from"./registry.js";import{pathToFileURL as ie}from"node:url";import*as se from"node:crypto";import*as N from"node:fs";import*as j from"node:os";import*as M from"node:path";import{executePipeline as V}from"./pipeline/index.js";import{adapterLoadError as ae,ArgumentError as d,CommandExecutionError as x,SessionBusyError as ce,attachTraceReceipt as ue,getErrorMessage as D}from"./errors.js";import{shouldUseBrowserSession as le}from"./capabilityRouting.js";import{getBrowserFactory as fe,browserSession as me,runWithTimeout as G,DEFAULT_BROWSER_COMMAND_TIMEOUT as de}from"./runtime.js";import{withBrowserSessionLockIf as pe}from"./browser-session-lock.js";import{resolveProfile as he}from"./browser/profile.js";import{ensureManagedChrome as we}from"./browser/managed-chrome.js";import{generateFingerprintJs as ge}from"./browser/fingerprint.js";import{CDPBridge as ye}from"./browser/index.js";import{clearDaemonRunContext as ve,generateRunId as Se,isUnknownOutcomeError as J,releaseSiteSessionLease as K,setDaemonCommandTimeoutSeconds as be,setDaemonRunContext as Q}from"./browser/daemon-client.js";import{emitHook as k}from"./hooks.js";import{setContentBaseDir as $e}from"./utils.js";import{log as X}from"./logger.js";import{isElectronApp as Ee}from"./electron-apps.js";import{probeCDP as Pe,resolveElectronEndpoint as xe}from"./launcher.js";import{ObservationSession as Ae,exportObservationSession as Ce}from"./observation/index.js";import{resolveAdapterSourcePath as Te}from"./adapter-source.js";const S=new Map,B=new Map,Re=`${j.homedir()}/.ppcli/clis/`;function Ie(e){if(e===void 0||e===null||e===""||e==="off")return"off";if(e==="on"||e==="retain-on-failure")return e;throw new d(`--trace must be one of: off, on, retain-on-failure. Received: "${String(e)}"`)}export function coerceAndValidateArgs(e,t){const r={...t};for(const n of e){const o=r[n.name];if(n.required&&(o===void 0||o===null||o===""))throw new d(`Argument "${n.name}" is required.`,n.help??`Provide a value for --${n.name}`);if(o!==void 0&&o!==null){if(n.type==="int"||n.type==="number"){const f=Number(o);if(Number.isNaN(f))throw new d(`Argument "${n.name}" must be a valid number. Received: "${o}"`);r[n.name]=f}else if(n.type==="boolean"||n.type==="bool")if(typeof o==="string"){const f=o.toLowerCase();if(f==="true"||f==="1")r[n.name]=!0;else if(f==="false"||f==="0")r[n.name]=!1;else throw new d(`Argument "${n.name}" must be a boolean (true/false). Received: "${o}"`)}else r[n.name]=Boolean(o);const s=r[n.name];if(n.choices&&n.choices.length>0){if(!n.choices.map(String).includes(String(s)))throw new d(`Argument "${n.name}" must be one of: ${n.choices.join(", ")}. Received: "${s}"`)}}else if(n.default!==void 0)r[n.name]=n.default}return r}async function U(e,t,r,n){const o=e;if(o._lazy&&o._modulePath){const s=o._modulePath;if(s.startsWith(Re)&&S.has(s))try{const m=N.statSync(s),i=B.get(s);if(i!==void 0&&m.mtimeMs!==i)S.delete(s)}catch{}if(!S.has(s)){const m=ie(s).href,w=import(B.has(s)?`${m}?t=${Date.now()}`:m).then(()=>{try{B.set(s,N.statSync(s).mtimeMs)}catch{}},(p)=>{S.delete(s);throw ae(`Failed to load adapter module ${s}: ${D(p)}`,"Check that the adapter file exists and has no syntax errors.")});S.set(s,w)}await S.get(s);const u=oe().get(g(e));if(u?.func)return Y(u,t,r,n);if(u?.pipeline)return V(t,u.pipeline,{args:r,debug:n})}if(e.func)return Y(e,t,r,n);if(e.pipeline)return V(t,e.pipeline,{args:r,debug:n});throw new x(`Command ${g(e)} has no func or pipeline`,"This is likely a bug in the adapter definition. Please report this issue.")}function Y(e,t,r,n){if(e.browser===!1)return e.func(r,n);if(!t)throw new x(`Command ${g(e)} requires a browser session but none was provided`);return e.func(t,r,n)}function Ne(e){if(e.navigateBefore===!1)return null;if(typeof e.navigateBefore==="string")return e.navigateBefore;return null}function Me(e,t){if(!e||!t)return!1;try{const r=new URL(e).hostname;return r===t||r.endsWith(`.${t}`)}catch{return!1}}function De(e,t){if(!t)return!1;try{const r=new URL(e),n=r.hostname===t||r.hostname.endsWith(`.${t}`),o=r.pathname===""||r.pathname==="/";return n&&o&&r.search===""&&r.hash===""}catch{return!1}}async function ke(e,t,r,n){if(r!=="persistent"||!e.domain)return!0;if(!De(n,e.domain))return!0;const o=await t.getCurrentUrl?.().catch(()=>null);return!Me(o,e.domain)}export async function executeCommand(e,t,r=!1,n={}){let o;try{o=n.prepared?t:prepareCommandArgs(e,t)}catch(i){if(i instanceof d)throw i;throw new d(D(i))}const s=qe(e,o);be(s);const f=Ie(n.trace),u={command:g(e),args:o,startedAt:Date.now()};await k("onBeforeExecute",u);let m;try{if(le(e)){const i=Ee(e.site),w=he(n.profile),p=!i&&w.kind==="managed"?w:null;let P;const A=Le(e.defaultWindowMode??"background",n.windowMode);let F,W;if(p){P=await we(p.name,p.entry,{windowMode:A});const c=p.entry.fingerprint;if(c?.enabled)F=ge(c);const a=p.entry.proxy;if(a?.username)W={username:a.username,password:a.password??""}}else if(i){const c=process.env.OPENCLI_CDP_ENDPOINT;if(c){const a=Number(new URL(c).port);if(!await Pe(a))throw new x(`CDP not reachable at ${c}`,"Check that the app is running with --remote-debugging-port and the endpoint is correct.");P=c}else P=await xe(e.site)}const re=p?ye:fe(e.site),L=!p&&w.kind==="extension"?w.contextId:void 0,ne=e,b=_e(e,n.siteSession),C=Oe(e,b),q=We(b,n.keepTab),y=b==="persistent"&&e.access==="write"?{runId:Se(),session:C}:null;if(y)Q({runId:y.runId,command:g(e),access:"write"});let z,H=!1,T=null;try{m=await pe(A!=="foreground",()=>me(re,async(c)=>{const a=f==="off"?null:new Ae({scope:{contextId:L??p?.name,session:C,target:c.getActivePage?.(),site:e.site,command:g(e),adapterSourcePath:Te(ne)}});if(a){a.record({stream:"action",name:"command",phase:"start",data:{args:o}});await c.startNetworkCapture?.().catch(()=>!1)}const h=Ne(e);if(h&&await ke(e,c,b,h)){a?.record({stream:"action",name:"pre_navigate",phase:"start",data:{url:h}});try{await c.goto(h);a?.record({stream:"action",name:"pre_navigate",phase:"end",data:{url:h}})}catch(l){if(l instanceof ce)throw l;a?.record({stream:"action",name:"pre_navigate",phase:"error",data:{url:h,error:l instanceof Error?l.message:String(l)}});const v=new x(`Pre-navigation to ${h} failed: ${l instanceof Error?l.message:l}`,"Check that the site is reachable and the browser extension is running.");v.cause=l;if(a&&(f==="on"||f==="retain-on-failure")){a.record({stream:"error",message:v.message,stack:v.stack,code:v.code,hint:v.hint});await _(a,c).catch(()=>{});O(a,"failure",v,n.onTraceExport)}throw v}}const E=s!==null?s+Z:de,R=U(e,c,o,r);T=R;let I=!1;R.then(()=>{I=!0},()=>{I=!0});try{const l=await G(R,{timeout:E,label:g(e),hint:te(e,s)});a?.record({stream:"action",name:"command",phase:"end"});if(a&&f==="on"){await _(a,c).catch(()=>{});O(a,"success",void 0,n.onTraceExport)}if(!q)await c.closeWindow?.().catch(()=>{});return l}catch(l){if(!I)H=!0;if(a){a.record({stream:"action",name:"command",phase:"error",data:{error:l instanceof Error?l.message:String(l)}});a.record({stream:"error",message:l instanceof Error?l.message:String(l),stack:l instanceof Error?l.stack:void 0});if(f==="on"||f==="retain-on-failure"){await _(a,c).catch(()=>{});O(a,"failure",l,n.onTraceExport)}}if(!q)await c.closeWindow?.().catch(()=>{});throw l}},{session:C,cdpEndpoint:P,contextId:L,windowMode:A,surface:"adapter",siteSession:b,initScript:F,proxyAuth:W}),p?.name)}catch(c){z=c;throw c}finally{if(y)if(H&&T){const{runId:c,session:a}=y,h=(E)=>{ve(c);if(!J(E))K({runId:c,session:a,surface:"adapter"})};T.then(()=>h(),(E)=>h(E))}else{Q(null);if(!J(z))await K({runId:y.runId,session:y.session,surface:"adapter"})}}}else if(s!==null){const i=s+Z;m=await G(U(e,null,o,r),{timeout:i,label:g(e),hint:te(e,s)})}else m=await U(e,null,o,r)}catch(i){u.error=i;u.finishedAt=Date.now();await k("onAfterExecute",u);throw i}u.finishedAt=Date.now();await k("onAfterExecute",u,m);return m}async function _(e,t){const r=t.getActivePage?.()??e.scope.target,[n,o,s,f,u]=await Promise.all([t.getCurrentUrl?.().catch(()=>null)??Promise.resolve(null),t.snapshot().catch(()=>{return}),t.readNetworkCapture?.().catch(()=>[])??Promise.resolve([]),t.consoleMessages("all").catch(()=>[]),t.screenshot({format:"png"}).catch(()=>{return})]);if(o!==void 0||n!==void 0)e.record({stream:"state",url:n,target:r,snapshot:o,label:"final"});for(const m of Array.isArray(s)?s:[]){const i=m;e.record({stream:"network",url:String(i.url??""),method:typeof i.method==="string"?i.method:void 0,status:typeof i.responseStatus==="number"?i.responseStatus:void 0,contentType:typeof i.responseContentType==="string"?i.responseContentType:void 0,size:typeof i.responseBodyFullSize==="number"?i.responseBodyFullSize:void 0,requestHeaders:i.requestHeaders,responseHeaders:i.responseHeaders,requestBody:i.requestBodyPreview,responseBody:i.responsePreview,ts:typeof i.timestamp==="number"?i.timestamp:void 0})}for(const m of Array.isArray(f)?f:[])if(m&&typeof m==="object"){const i=m;e.record({stream:"console",level:String(i.type??i.level??"log"),text:String(i.text??i.message??""),ts:typeof i.timestamp==="number"?i.timestamp:void 0})}else e.record({stream:"console",level:"log",text:String(m)});if(typeof u==="string"&&u)e.record({stream:"screenshot",format:"png",data:u,label:"final"})}function O(e,t,r,n){try{const o=Ce(e,{error:r,status:t});if(t==="failure"&&r!==void 0)ue(r,o.receipt);else process.stderr.write(`ppcli trace artifact: ${o.dir}
|
|
2
|
+
`);try{n?.(o)}catch(s){X.warn(`[trace] Trace export callback failed: ${s instanceof Error?s.message:String(s)}`)}return o}catch(o){X.warn(`[trace] Failed to export trace artifact: ${o instanceof Error?o.message:String(o)}`);return}}export function resolveFileBackedArg(e,t){const r=e.args.find((u)=>u.fromFile);if(!r)return;const n=typeof r.fromFile==="string"?r.fromFile:"file",o=r.positional?`<${r.name}>`:`--${r.name}`,s=t[n]==null?"":String(t[n]).trim(),f=t[r.name]==null?"":String(t[r.name]);if(s){if(f.trim())throw new d(`${o} 和 --${n} 只能二选一,不能同时给`);const u=M.resolve(s.startsWith("~/")?M.join(j.homedir(),s.slice(2)):s);let m;try{m=N.readFileSync(u,"utf-8")}catch(w){throw new d(`--${n} 指向的文件读不到: ${u}(${D(w)})`)}const i=m.trim();if(!i)throw new d(`--${n} 指向的文件内容为空: ${u}`);t[r.name]=i;$e(M.dirname(u));return}if(!f.trim()&&r.requiredUnlessFile)throw new d(`缺少 ${r.name}:${o} 或 --${n} 给其一`)}export function prepareCommandArgs(e,t){const r=coerceAndValidateArgs(e.args,t);resolveFileBackedArg(e,r);e.validateArgs?.(r);return r}const Z=30;function Be(e){if(e===void 0||e===null||e==="")return null;if(e==="ephemeral"||e==="persistent")return e;throw new d(`--site-session must be one of: ephemeral, persistent. Received: "${String(e)}"`)}function Ue(){const e=process.env.PUBLISHPORT_SITE_SESSION;if(e==="persistent"||e==="ephemeral")return e;return null}function _e(e,t){return Be(t)??Ue()??e.siteSession??"persistent"}function Oe(e,t){if(t==="persistent")return`site:${e.site}`;return`site:${e.site}:${se.randomUUID()}`}function Fe(e,t){if(t===void 0||t==="")return null;if(t==="true")return!0;if(t==="false")return!1;throw new d(`${e} must be one of: true, false. Received: "${String(t)}"`)}function We(e,t){if(e==="persistent")return!0;return Fe("--keep-tab",t)??!1}function ee(e,t){if(t===void 0||t==="")return null;if(t==="foreground"||t==="background")return t;throw new d(`${e} must be one of: foreground, background. Received: "${String(t)}"`)}function Le(e="background",t){return ee("--window",t)??ee("OPENCLI_WINDOW",process.env.OPENCLI_WINDOW)??e}function te(e,t){const r=e.access==="write"?"⚠️ 这是写操作,超时不代表没写成功——请求可能已经到达平台。禁止直接重试:"+"先用该平台的列表/统计命令(stats / lists / articles 等)按标题回查,确认没写进去再重发。 ":"";if(t!==null)return`${r}Pass a higher --timeout value (currently ${t}s)`;if(e.args.some((n)=>n.name==="timeout"))return`${r}Try again, or pass a higher --timeout <seconds>`;return r+"This command has no --timeout option. Retry once; if it keeps timing out, "+"the page or browser bridge is likely stuck — have the user reopen the PublishPort client. "+"The global default can be raised with OPENCLI_BROWSER_COMMAND_TIMEOUT."}function qe(e,t){if(!e.args.some((o)=>o.name==="timeout"))return null;const r=t.timeout;if(r===void 0||r===null||r==="")throw new d(`Argument "timeout" must be a positive integer. Received: "${String(r)}"`);const n=Number(r);if(!Number.isInteger(n)||n<=0)throw new d(`Argument "timeout" must be a positive integer. Received: "${String(r)}"`);return n}
|
package/dist/src/external.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as l from"node:fs";import*as u from"node:path";import*as c from"node:os";import{fileURLToPath as g}from"node:url";import{spawnSync as x,execFileSync as h}from"node:child_process";import m from"js-yaml";import{log as i}from"./logger.js";import{EXIT_CODES as d,getErrorMessage as y}from"./errors.js";import{enforceRateLimit as I}from"./rate-limit.js";const S=u.dirname(g(import.meta.url));function w(){const e=c.homedir();return u.join(e,".ppcli","external-clis.yaml")}let f=null;export function loadExternalClis(){if(f)return f;const e=new Map,r=u.resolve(S,"external-clis.yaml");try{if(l.existsSync(r)){const s=l.readFileSync(r,"utf8"),t=m.load(s)||[];for(const o of t)e.set(o.name,o)}}catch(s){i.warn(`Failed to parse built-in external-clis.yaml: ${y(s)}`)}const n=w();try{if(l.existsSync(n)){const s=l.readFileSync(n,"utf8"),t=m.load(s)||[];for(const o of t)e.set(o.name,o)}}catch(s){i.warn(`Failed to parse user external-clis.yaml: ${y(s)}`)}f=Array.from(e.values()).sort((s,t)=>s.name.localeCompare(t.name));return f}export function isBinaryInstalled(e){try{const r=c.platform()==="win32";h(r?"where":"which",[e],{stdio:"ignore"});return!0}catch{return!1}}export function getInstallCmd(e){if(!e)return null;const r=c.platform();if(r==="darwin"&&e.mac)return e.mac;if(r==="linux"&&e.linux)return e.linux;if(r==="win32"&&e.windows)return e.windows;if(e.default)return e.default;return null}export function formatExternalCliLabel(e){return e.package&&e.package!==e.name?`${e.name}(${e.package})`:e.name}export function parseCommand(e){if(/&&|\|\|?|;|[><`$#\n\r]|\$\(/.test(e))throw Error(`Install command contains unsafe shell operators and cannot be executed securely: "${e}". Please install the tool manually.`);const n=[],s=/(?:"([^"]*)")|(?:'([^']*)')|(\S+)/g;let t;while((t=s.exec(e))!==null)n.push(t[1]??t[2]??t[3]);if(n.length===0)throw Error("Install command is empty.");const[o,...a]=n;return{binary:o,args:a}}function R(e,r){const n=r instanceof Error?r.code:void 0;return c.platform()==="win32"&&!u.extname(e)&&n==="ENOENT"}function C(e){const{binary:r,args:n}=parseCommand(e);try{h(r,n,{stdio:"inherit"})}catch(s){if(R(r,s)){h(`${r}.cmd`,n,{stdio:"inherit"});return}throw s}}export function installExternalCli(e){if(!e.install){i.error(`No auto-install command configured for '${e.name}'.`);i.info(`Please install '${e.binary}' manually.`);return!1}const r=getInstallCmd(e.install);if(!r){i.error(`No install command for your platform (${c.platform()}) for '${e.name}'.`);if(e.homepage)i.info(`See: ${e.homepage}`);return!1}i.info(`'${e.name}' is not installed. Auto-installing...`);i.verbose(`$ ${r}`);try{C(r);i.success(`Installed '${e.name}' successfully.`);return!0}catch(n){i.error(`Failed to install '${e.name}': ${y(n)}`);return!1}}export function executeExternalCli(e,r,n){const t=(n??loadExternalClis()).find((a)=>a.name===e);if(!t)throw Error(`External CLI '${e}' not found in registry.`);I(e);if(!isBinaryInstalled(t.binary)){if(!installExternalCli(t)){process.exitCode=d.SERVICE_UNAVAIL;return}}const o=N(t.binary,r);if(o.error){i.error(`Failed to execute '${t.binary}': ${o.error.message}`);process.exitCode=d.GENERIC_ERROR;return}if(o.status!==null)process.exitCode=o.status;else if(o.signal){const a=o.signal;process.exitCode=a==="SIGINT"?d.INTERRUPTED:c.constants.signals[a]?128+c.constants.signals[a]:d.GENERIC_ERROR}}function b(e){if(e!==""&&!/[\s"^&|<>%()]/.test(e))return e;return`"${e.replace(/"/g,'""')}"`}function N(e,r){const n=x(e,r,{stdio:"inherit"}),s=n.error?.code;if(c.platform()==="win32"&&(s==="EINVAL"||s==="ENOENT")){const t=[e,...r].map(b).join(" ");return x(t,{stdio:"inherit",shell:!0})}return n}export function registerExternalCli(e,r){const n=w(),s=u.dirname(n);if(!l.existsSync(s))l.mkdirSync(s,{recursive:!0});let t=[];if(l.existsSync(n))try{const p=l.readFileSync(n,"utf8");t=m.load(p)||[]}catch{}const o=t.findIndex((p)=>p.name===e),a={name:e,binary:r?.binary||e};if(r?.description)a.description=r.description;if(r?.install)a.install={default:r.install};if(o>=0){t[o]={...t[o],...a};i.success(`Updated '${e}' in user registry.`)}else{t.push(a);i.success(`Registered '${e}' in user registry.`)}const E=m.dump(t,{indent:2,sortKeys:!0});l.writeFileSync(n,E,"utf8");f=null;i.verbose(n)}
|
package/dist/src/help.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
`;return
|
|
3
|
-
`)}function
|
|
4
|
-
`)}function H(
|
|
5
|
-
`)}export function formatBrowserCommonOptionsHelpText(){const
|
|
6
|
-
`)}export function formatSiteHelpText(
|
|
7
|
-
`)}export function formatCommandHelpText(
|
|
8
|
-
`)}export function installStructuredHelp(
|
|
1
|
+
import P from"js-yaml";import{fullName as v}from"./registry.js";import{formatCommandExample as O}from"./serialization.js";const b=[{flags:"-f, --format <fmt>",name:"format",help:"Output format: table, plain, json, yaml, md, csv",default:"table",choices:["table","plain","json","yaml","md","csv"]},{flags:"--trace <mode>",name:"trace",help:"Trace capture: off, on, retain-on-failure",default:"off",choices:["off","on","retain-on-failure"]},{flags:"-v, --verbose",name:"verbose",help:"Debug output",default:!1},{flags:"-h, --help",name:"help",help:"display help for command"}],f=[{flags:"--window <mode>",name:"window",help:"Browser window mode: foreground or background",choices:["foreground","background"]},{flags:"--site-session <mode>",name:"site-session",help:"Adapter site session lifecycle: ephemeral or persistent",choices:["ephemeral","persistent"]},{flags:"--keep-tab <bool>",name:"keep-tab",help:"Keep the browser tab lease after the command finishes",choices:["true","false"]}];function x(e){const n=e?.toLowerCase();if(n==="yaml"||n==="yml")return"yaml";if(n==="json")return"json";return}export function getRequestedHelpFormat(e=process.argv){for(let n=0;n<e.length;n++){const t=e[n];if(t==="-f"||t==="--format")return x(e[n+1]);if(t.startsWith("--format="))return x(t.slice(9));if(t.startsWith("-f")&&t.length>2)return x(t.slice(2))}return}export function renderStructuredHelp(e,n){if(n==="json")return`${JSON.stringify(e,null,2)}
|
|
2
|
+
`;return P.dump(e,{sortKeys:!1,lineWidth:120,noRefs:!0})}export function wrapCommaList(e,n={}){const t=Math.max(n.width??process.stdout.columns??100,40),s=n.indent??" ",o=[...e].sort((m,d)=>m.localeCompare(d)),a=[];let i=s;o.forEach((m,d)=>{const g=`${m}${d<o.length-1?",":""}`,_=i===s?"":" ";if(i.length+_.length+g.length>t&&i.trim()){a.push(i);i=`${s}${g}`}else i+=`${_}${g}`});if(i.trim())a.push(i);return a.join(`
|
|
3
|
+
`)}function D(e){if(e==="::1"||e==="[::1]")return!0;const n=e.split(".");if(n.length!==4)return!1;return n.every((t)=>/^\d+$/.test(t)&&Number(t)>=0&&Number(t)<=255)&&Number(n[0])===127}export function classifyAdapter(e){if(!e)return"site";if(D(e))return"app";return e.includes(".")?"site":"app"}function C(e,n){if(n.length===0)return[];return[`${e} (${n.length}):`,wrapCommaList(n),""]}export function formatRootAdapterHelpText(e){if(e.external.length+e.apps.length+e.sites.length===0)return"";const t=[""];t.push(...C("External CLIs",e.external.map((s)=>s.label)));t.push(...C("App adapters",e.apps));t.push(...C("Site adapters",e.sites));t.push("Run 'ppcli list' for full command details, or 'ppcli <site> --help' to inspect one site.");t.push("Agent tip: use 'ppcli <site> --help -f yaml' for all command args/options in one structured response.");t.push("");return t.join(`
|
|
4
|
+
`)}function H(e){return{name:e.name,...e.type&&e.type!=="string"?{type:e.type}:{},...e.positional?{positional:!0}:{},...e.required?{required:!0}:{},...e.valueRequired?{valueRequired:!0}:{},...e.default!==void 0?{default:e.default}:{},...e.choices?.length?{choices:e.choices}:{},...e.help?{help:e.help}:{}}}function p(e){return{name:e.name,flags:e.flags,help:e.help,..."default"in e?{default:e.default}:{},..."choices"in e?{choices:e.choices}:{}}}function M(e){return{name:e.name(),...e.required?{required:!0}:{},...e.variadic?{variadic:!0}:{},...e.description?{help:e.description}:{},...e.defaultValue!==void 0?{default:e.defaultValue}:{},...e.argChoices?.length?{choices:[...e.argChoices]}:{}}}function F(e){if(e.hidden)return null;return{name:e.attributeName(),flags:e.flags,...e.description?{help:e.description}:{},...e.required?{takes_value:"required"}:{},...e.optional?{takes_value:"optional"}:{},...e.mandatory?{required:!0}:{},...e.defaultValue!==void 0?{default:e.defaultValue}:{},...e.argChoices?.length?{choices:[...e.argChoices]}:{},...e.negate?{negate:!0}:{}}}function r(e){return e.map(F).filter((n)=>n!==null)}export function leadingPositionalFromUsage(e){const n=e._usage;if(!n)return null;const t=n.match(/^\s*(<[^>]+>)/);return t?t[1]:null}function l(e){const n=[];let t=e;while(t){const s=t.name();if(s){n.push(s);const o=leadingPositionalFromUsage(t);if(o&&n.length>1)n.splice(n.length-1,0,o)}t=t.parent}return n.reverse()}function u(e,n){const t=l(e);return l(n).slice(t.length).filter((o)=>!/^<.+>$/.test(o))}function j(e){if(e.commands.length===0)return[e];return e.commands.flatMap((n)=>j(n))}function q(e){return e.commands.flatMap((n)=>[n,...q(n)])}function k(e){return e.map((n)=>{const t=`${n.name()}${n.variadic?"...":""}`;return n.required?`<${t}>`:`[${t}]`}).join(" ")}function L(e,n={}){const t=l(e).join(" "),s=k(e.registeredArguments),a=r(e.options).length>0||(n.namespaceRoot?r(n.namespaceRoot.options).length>0:!1)||(n.globalCommand?r(n.globalCommand.options).length>0:!1)?" [options]":"";return`${t}${s?` ${s}`:""}${a}`}function w(e,n,t={}){return{name:u(e,n).join(" "),command:l(n).join(" "),usage:L(n,{namespaceRoot:e,globalCommand:t.globalCommand}),description:n.description(),...n.aliases().length?{aliases:n.aliases()}:{},positionals:n.registeredArguments.map(M),command_options:r(n.options)}}export function commanderNamespaceHelpData(e,n={}){const t=j(e).filter((i)=>i!==e).sort((i,m)=>u(e,i).join(" ").localeCompare(u(e,m).join(" "))),s=l(e).join(" "),o=e._usage,a=o?`${s} ${o}`:`${s} <command> [args] [options]`;return{namespace:e.name(),command:s,usage:a,description:n.description??e.description(),command_count:t.length,commands:t.map((i)=>w(e,i,n)),namespace_options:r(e.options),...n.globalCommand?{global_options:r(n.globalCommand.options)}:{},structured_help:{formats:["yaml","json"],usage:`${s} --help -f yaml`}}}export function commanderCommandHelpData(e,n,t={}){return{namespace:e.name(),...w(e,n,t),namespace_options:r(e.options),...t.globalCommand?{global_options:r(t.globalCommand.options)}:{},structured_help:{formats:["yaml","json"],usage:`${l(n).join(" ")} --help -f yaml`}}}export function commanderGroupHelpData(e,n,t={}){const s=j(n).filter((o)=>o!==n).sort((o,a)=>u(e,o).join(" ").localeCompare(u(e,a).join(" ")));return{namespace:e.name(),group:u(e,n).join(" "),command:l(n).join(" "),usage:`${l(n).join(" ")} <command> [args] [options]`,description:n.description(),command_count:s.length,commands:s.map((o)=>w(e,o,t)),namespace_options:r(e.options),...t.globalCommand?{global_options:r(t.globalCommand.options)}:{},structured_help:{formats:["yaml","json"],usage:`${l(n).join(" ")} --help -f yaml`}}}export function installCommanderNamespaceStructuredHelp(e,n={}){installStructuredHelp(e,()=>commanderNamespaceHelpData(e,n));for(const t of q(e))if(t.commands.length>0)installStructuredHelp(t,()=>commanderGroupHelpData(e,t,n));else installStructuredHelp(t,()=>commanderCommandHelpData(e,t,n))}function h(e){return e.args.filter((n)=>n.positional)}function y(e){return e.args.filter((n)=>!n.positional)}function A(e){return e.map((n)=>n.required?`<${n.name}>`:`[${n.name}]`).join(" ")}function E(e){if(e.required||e.valueRequired)return`--${e.name} <value>`;return`--${e.name} [value]`}export function formatCommandListTerm(e){const n=A(h(e)),t=y(e).length>0?" [options]":"";return`${e.name}${n?` ${n}`:""}${t}`}function T(e){const n=A(h(e));return`ppcli ${e.site} ${e.name}${n?` ${n}`:""} [options]`}function S(e){return{name:e.name,command:`ppcli ${e.site} ${e.name}`,usage:T(e),access:e.access,description:e.description,browser:!!e.browser,...e.domain?{domain:e.domain}:{},...e.aliases?.length?{aliases:e.aliases}:{},positionals:h(e).map(H),command_options:y(e).map(H),...e.browser?{browser_common_options:f.map(p)}:{},example:O(e),...e.siteSession?{siteSession:e.siteSession}:{},...e.defaultFormat?{defaultFormat:e.defaultFormat}:{},...e.columns?.length?{columns:e.columns}:{}}}export function rootHelpData(e,n){const t=new Set([...n.external.map((a)=>a.name),...n.apps,...n.sites]),s=e.commands.filter((a)=>!t.has(a.name())).map((a)=>({name:a.name(),description:a.description()})),o=(a,i)=>a.localeCompare(i);return{name:e.name(),description:e.description(),commands:s,external_clis:{count:n.external.length,clis:n.external.map((a)=>a.name).sort(o),display:n.external.map((a)=>a.label).sort(o)},app_adapters:{count:n.apps.length,apps:[...n.apps].sort(o)},site_adapters:{count:n.sites.length,sites:[...n.sites].sort(o)},next:["ppcli <site> --help -f yaml","ppcli list -f yaml","ppcli <site> <command> -f yaml"]}}export function siteHelpData(e,n){const t=[...new Map(n.map((s)=>[v(s),s])).values()].sort((s,o)=>s.name.localeCompare(o.name));return{site:e,command_count:t.length,commands:t.map((s)=>S(s)),common_options:b.map(p),...t.some((s)=>s.browser)?{browser_common_options:f.map(p)}:{},next:[`ppcli ${e} <command> --help -f yaml`,`ppcli ${e} <command> -f yaml`]}}export function commandHelpData(e){return{site:e.site,...S(e),common_options:b.map(p),...e.browser?{browser_common_options:f.map(p)}:{},output_formats:["table","plain","yaml","json","md","csv"]}}function c(e){if(e.length===0)return[];const n=Math.min(Math.max(...e.map(([t])=>t.length)),34);return e.map(([t,s])=>` ${t.padEnd(n+2)}${s}`)}function N(e){const n=[];if(e.help)n.push(e.help);if(e.default!==void 0)n.push(`default: ${e.default}`);if(e.choices?.length)n.push(`choices: ${e.choices.join(", ")}`);return n.join(" ")}export function formatCommonOptionsHelpText(){const e=b.map((n)=>{const t=[n.help];if("default"in n)t.push(`default: ${n.default}`);if("choices"in n)t.push(`choices: ${n.choices.join(", ")}`);return[n.flags,t.join(" ")]});return["Common options:",...c(e)].join(`
|
|
5
|
+
`)}export function formatBrowserCommonOptionsHelpText(){const e=f.map((n)=>{const t=[n.help];if("choices"in n)t.push(`choices: ${n.choices.join(", ")}`);return[n.flags,t.join(" ")]});return["Browser common options:",...c(e)].join(`
|
|
6
|
+
`)}export function formatSiteHelpText(e,n){const t=[...new Map(n.map((o)=>[v(o),o])).values()].sort((o,a)=>o.name.localeCompare(a.name));return[`Usage: ppcli ${e} <command> [args] [options]`,"",wrapCommaList(t.map((o)=>o.name),{indent:""}),"","Commands:",...c(t.map((o)=>[formatCommandListTerm(o),formatSiteCommandDescription(o)])),"",formatCommonOptionsHelpText(),...t.some((o)=>o.browser)?["",formatBrowserCommonOptionsHelpText()]:[],"",`Agent tip: use 'ppcli ${e} --help -f yaml' to get all command args/options in one structured response.`,""].join(`
|
|
7
|
+
`)}export function formatCommandHelpText(e){const n=[`Usage: ${T(e)}`,"",e.description,""],t=h(e).map((a)=>[a.name,N(a)]);if(t.length)n.push("Arguments:",...c(t),"");const s=y(e).map((a)=>[E(a),N(a)]);if(s.length)n.push("Command options:",...c(s),"");n.push(formatCommonOptionsHelpText(),"");if(e.browser)n.push(formatBrowserCommonOptionsHelpText(),"");const o=[];o.push(`Access: ${e.access}`);o.push(`Browser: ${e.browser?"yes":"no"}`);if(e.domain)o.push(`Domain: ${e.domain}`);if(e.defaultFormat)o.push(`Default format: ${e.defaultFormat}`);if(e.aliases?.length)o.push(`Aliases: ${e.aliases.join(", ")}`);n.push(o.join(" | "));n.push(`Example: ${O(e)}`);if(e.columns?.length)n.push(`Output columns: ${e.columns.join(", ")}`);n.push("Agent tip: use '--help -f yaml' for structured args/options.");n.push("");return n.join(`
|
|
8
|
+
`)}export function installStructuredHelp(e,n,t){const s=e.helpInformation.bind(e);e.helpInformation=(o)=>{const a=getRequestedHelpFormat();if(a)return renderStructuredHelp(n(),a);const i=typeof t==="function"?t():t??"";return s(o)+i}}export function formatSiteCommandDescription(e){return`${e.access==="write"?"[write]":"[read]"} ${e.description}`}
|
package/dist/src/hooks.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{log as
|
|
1
|
+
import{log as s}from"./logger.js";const n=globalThis.__opencli_hooks__??=new Map;function i(o,e){const t=n.get(o)??[];if(t.includes(e))return;t.push(e);n.set(o,t)}export function onStartup(o){i("onStartup",o)}export function onBeforeExecute(o){i("onBeforeExecute",o)}export function onAfterExecute(o){i("onAfterExecute",o)}export async function emitHook(o,e,t){const r=n.get(o);if(!r||r.length===0)return;for(const f of r)try{await f(e,t)}catch(c){s.warn(`Hook ${o} handler failed: ${c instanceof Error?c.message:String(c)}`)}}export function clearAllHooks(){n.clear()}
|
package/dist/src/interceptor.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const
|
|
1
|
+
const c=`
|
|
2
2
|
function __defHidden(obj, key, val) {
|
|
3
3
|
try {
|
|
4
4
|
Object.defineProperty(obj, key, { value: val, writable: true, enumerable: false, configurable: true });
|
|
5
5
|
} catch { obj[key] = val; }
|
|
6
|
-
}`,
|
|
6
|
+
}`,i=`
|
|
7
7
|
function __disguise(fn, name) {
|
|
8
8
|
const nativeStr = 'function ' + name + '() { [native code] }';
|
|
9
9
|
// Override toString on the instance AND patch Function.prototype.toString
|
|
@@ -25,17 +25,17 @@ const J=`
|
|
|
25
25
|
_patchedFns.set(fn, nativeStr);
|
|
26
26
|
try { Object.defineProperty(fn, 'name', { value: name, configurable: true }); } catch {}
|
|
27
27
|
return fn;
|
|
28
|
-
}`;export function generateInterceptorJs(
|
|
28
|
+
}`;export function generateInterceptorJs(t,o={}){const e=o.arrayName??"__opencli_intercepted",r=o.patchGuard??"__opencli_interceptor_patched",n=`${r}_pattern`;return`
|
|
29
29
|
() => {
|
|
30
|
-
${
|
|
31
|
-
${
|
|
30
|
+
${c}
|
|
31
|
+
${i}
|
|
32
32
|
|
|
33
|
-
if (!window.${
|
|
34
|
-
if (!window.${
|
|
35
|
-
__defHidden(window, '${
|
|
36
|
-
const __checkMatch = (url) => window.${
|
|
33
|
+
if (!window.${e}) __defHidden(window, '${e}', []);
|
|
34
|
+
if (!window.${e}_errors) __defHidden(window, '${e}_errors', []);
|
|
35
|
+
__defHidden(window, '${n}', ${t});
|
|
36
|
+
const __checkMatch = (url) => window.${n} && url.includes(window.${n});
|
|
37
37
|
|
|
38
|
-
if (!window.${
|
|
38
|
+
if (!window.${r}) {
|
|
39
39
|
// ── Patch fetch ──
|
|
40
40
|
const __origFetch = window.fetch;
|
|
41
41
|
window.fetch = __disguise(async function(...args) {
|
|
@@ -46,8 +46,8 @@ const J=`
|
|
|
46
46
|
try {
|
|
47
47
|
const clone = response.clone();
|
|
48
48
|
const json = await clone.json();
|
|
49
|
-
window.${
|
|
50
|
-
} catch(e) { window.${
|
|
49
|
+
window.${e}.push(json);
|
|
50
|
+
} catch(e) { window.${e}_errors.push({ url: reqUrl, error: String(e) }); }
|
|
51
51
|
}
|
|
52
52
|
return response;
|
|
53
53
|
}, 'fetch');
|
|
@@ -64,28 +64,28 @@ const J=`
|
|
|
64
64
|
if (__checkMatch(this.__iurl)) {
|
|
65
65
|
this.addEventListener('load', function() {
|
|
66
66
|
try {
|
|
67
|
-
window.${
|
|
68
|
-
} catch(e) { window.${
|
|
67
|
+
window.${e}.push(JSON.parse(this.responseText));
|
|
68
|
+
} catch(e) { window.${e}_errors.push({ url: this.__iurl, error: String(e) }); }
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
return __origSend.apply(this, arguments);
|
|
72
72
|
}, 'send');
|
|
73
73
|
|
|
74
|
-
__defHidden(window, '${
|
|
74
|
+
__defHidden(window, '${r}', true);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
`}export function generateReadInterceptedJs(
|
|
77
|
+
`}export function generateReadInterceptedJs(t="__opencli_intercepted"){return`
|
|
78
78
|
() => {
|
|
79
|
-
const data = window.${
|
|
80
|
-
window.${
|
|
79
|
+
const data = window.${t} || [];
|
|
80
|
+
window.${t} = [];
|
|
81
81
|
return data;
|
|
82
82
|
}
|
|
83
|
-
`}export function generateTapInterceptorJs(
|
|
83
|
+
`}export function generateTapInterceptorJs(t){return{setupVar:`
|
|
84
84
|
let captured = null;
|
|
85
85
|
let captureResolve;
|
|
86
86
|
const capturePromise = new Promise(r => { captureResolve = r; });
|
|
87
|
-
const capturePattern = ${
|
|
88
|
-
${
|
|
87
|
+
const capturePattern = ${t};
|
|
88
|
+
${i}
|
|
89
89
|
`,capturedVar:"captured",promiseVar:"capturePromise",resolveVar:"captureResolve",fetchPatch:`
|
|
90
90
|
const origFetch = window.fetch;
|
|
91
91
|
window.fetch = __disguise(async function(...fetchArgs) {
|
package/dist/src/launcher.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{execFileSync as
|
|
2
|
-
${
|
|
3
|
-
`+` • Set OPENCLI_CDP_ENDPOINT=http://127.0.0.1:${
|
|
4
|
-
`+` • Or just re-run the command once ${
|
|
5
|
-
`);await killProcess(
|
|
6
|
-
`);await
|
|
7
|
-
`);return
|
|
1
|
+
import{execFileSync as u,spawn as f}from"node:child_process";import{request as w}from"node:http";import*as m from"node:path";import{getElectronApp as g}from"./electron-apps.js";import{confirmPrompt as b}from"./tui.js";import{CommandExecutionError as s}from"./errors.js";import{log as l}from"./logger.js";const x=500,d=15000,y=2000,C=3000;export function probeCDP(t,n=y){return new Promise((e)=>{const o=w({hostname:"127.0.0.1",port:t,path:"/json",method:"GET",timeout:n},(a)=>{a.resume();e(a.statusCode!==void 0&&a.statusCode>=200&&a.statusCode<300)});o.on("error",()=>e(!1));o.on("timeout",()=>{o.destroy();e(!1)});o.end()})}export function detectProcess(t){if(process.platform==="win32")return!1;try{u("pgrep",["-x",t],{encoding:"utf-8",stdio:"pipe"});return!0}catch{return!1}}export async function killProcess(t){if(process.platform==="win32")return;try{u("pkill",["-x",t],{stdio:"pipe"})}catch{}const n=Date.now()+C;while(Date.now()<n){if(!detectProcess(t))return;await new Promise((e)=>setTimeout(e,200))}try{u("pkill",["-9","-x",t],{stdio:"pipe"})}catch{}}export function discoverAppPath(t){if(process.platform!=="darwin")return null;try{return u("osascript",["-e",`POSIX path of (path to application "${t}")`],{encoding:"utf-8",stdio:"pipe",timeout:5000}).trim().replace(/\/$/,"")}catch{return null}}function E(t,n){return`${t}/Contents/MacOS/${n}`}function P(t,n){return t instanceof s&&t.message.startsWith(`Could not launch ${n}: executable not found at `)}export function resolveExecutableCandidates(t,n){const e=n.executableNames?.length?n.executableNames:[n.processName];return[...new Set(e)].map((o)=>E(t,o))}export async function launchDetachedApp(t,n,e,o){await new Promise((a,r)=>{const i=f(t,n,{detached:!0,stdio:"ignore",...o?{env:{...process.env,...o}}:{}}),c=(p)=>{if(p.code==="ENOENT"){r(new s(`Could not launch ${e}: executable not found at ${t}`,`Install ${e}, reinstall it, or register a custom app path in ~/.ppcli/apps.yaml`));return}r(new s(`Failed to launch ${e}`,p.message))};i.once("error",c);i.once("spawn",()=>{i.off("error",c);i.unref();a()})})}export async function launchElectronApp(t,n,e,o){const a=resolveExecutableCandidates(t,n);let r;for(const i of a){l.debug(`[launcher] Launching: ${i} ${e.join(" ")}`);try{await launchDetachedApp(i,e,o);return}catch(c){if(P(c,o)){r=c;continue}throw c}}if(a.length>1)throw new s(`Could not launch ${o}: no compatible executable found in ${m.join(t,"Contents","MacOS")}`,`Tried: ${a.map((i)=>m.basename(i)).join(", ")}. Install ${o}, reinstall it, or register a custom app path in ~/.ppcli/apps.yaml`);throw r??new s(`Could not launch ${o}`,`Install ${o}, reinstall it, or register a custom app path in ~/.ppcli/apps.yaml`)}export function electronLaunchArgs(t,n=[]){return[`--remote-debugging-port=${t}`,"--remote-allow-origins=*",...n]}function D(t,n){return`Start ${t} manually with --remote-debugging-port=${n} --remote-allow-origins=*, then either:`}async function _(t){const n=Date.now()+d;while(Date.now()<n){if(await probeCDP(t,1000))return;await new Promise((e)=>setTimeout(e,x))}throw new s(`App launched but CDP not available on port ${t} after ${d/1000}s`,"The app may be slow to start. Try running the command again.")}export async function resolveElectronEndpoint(t){const n=g(t);if(!n)throw new s(`No Electron app registered for site "${t}"`,"Register the app in ~/.ppcli/apps.yaml or check the site name.");const{port:e,processName:o,displayName:a}=n,r=a??o,i=`http://127.0.0.1:${e}`;l.debug(`[launcher] Probing CDP on port ${e}...`);if(await probeCDP(e)){l.debug(`[launcher] CDP already available on port ${e}`);return i}if(process.platform!=="darwin")throw new s(`${r} is not reachable on CDP port ${e}.`,`Auto-launch is not yet supported on ${process.platform}.
|
|
2
|
+
${D(r,e)}
|
|
3
|
+
`+` • Set OPENCLI_CDP_ENDPOINT=http://127.0.0.1:${e}
|
|
4
|
+
`+` • Or just re-run the command once ${r} is listening on port ${e}.`);if(detectProcess(o)){l.debug(`[launcher] ${r} is running but CDP not available`);if(!await b(`${r} is running but CDP is not enabled. Restart with debug port?`,!0))throw new s(`${r} needs to be restarted with CDP enabled.`,`Manually restart: kill the app and relaunch with --remote-debugging-port=${e} --remote-allow-origins=*`);process.stderr.write(` Restarting ${r}...
|
|
5
|
+
`);await killProcess(o)}const p=discoverAppPath(r);if(!p)throw new s(`Could not find ${r} on this machine.`,`Install ${r} or register a custom path in ~/.ppcli/apps.yaml`);const h=electronLaunchArgs(e,n.extraArgs??[]);await launchElectronApp(p,n,h,r);process.stderr.write(` Waiting for ${r} on port ${e}...
|
|
6
|
+
`);await _(e);process.stderr.write(` Connected to ${r} on port ${e}.
|
|
7
|
+
`);return i}
|
package/dist/src/logger.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function
|
|
2
|
-
`)},status(
|
|
3
|
-
`)},success(
|
|
4
|
-
`)},warn(
|
|
5
|
-
`)},error(
|
|
6
|
-
`)},verbose(
|
|
7
|
-
`)},debug(
|
|
8
|
-
`)},stepResult(
|
|
1
|
+
function o(){return!!process.env.OPENCLI_VERBOSE}export const log={info(r){process.stderr.write(`ℹ ${r}
|
|
2
|
+
`)},status(r){process.stderr.write(`${r}
|
|
3
|
+
`)},success(r){process.stderr.write(`${r}
|
|
4
|
+
`)},warn(r){process.stderr.write(`⚠ ${r}
|
|
5
|
+
`)},error(r){process.stderr.write(`✖ ${r}
|
|
6
|
+
`)},verbose(r){if(o())process.stderr.write(`[verbose] ${r}
|
|
7
|
+
`)},debug(r){this.verbose(r)},step(r,e,s,t=""){process.stderr.write(` [${r}/${e}] ${s}${t}
|
|
8
|
+
`)},stepResult(r){process.stderr.write(` → ${r}
|
|
9
9
|
`)}};
|