mirror of
https://github.com/jackwener/OpenCLI.git
synced 2026-09-14 18:25:42 +08:00
57534cf8b3
* docs: add daemon lifecycle redesign spec Replace the aggressive 5-minute idle timeout with a long-lived daemon model that stays running for hours, reducing restart overhead during development cycles. * docs: add daemon lifecycle redesign implementation plan 8-task TDD plan for replacing aggressive 5-minute idle timeout with long-lived daemon model (4h default, dual-condition exit). * feat(daemon): add DEFAULT_DAEMON_IDLE_TIMEOUT constant (4 hours) * feat(daemon): replace fixed 5min timeout with dual-condition idle manager (4h default) * feat(extension): reduce WS reconnect backoff cap from 60s to 5s * feat(daemon): improve CLI connection-waiting UX with progress messages and 200ms polling * feat(daemon): add opencli daemon status/stop/restart commands * test(daemon): add tests for daemon status/stop commands * fix(daemon): address code review issues — stale constant, restart robustness, timer cleanup, test coverage * docs: update daemon documentation for new lifecycle and CLI commands - troubleshooting.md: replace manual curl/pkill with `opencli daemon status/stop/restart` - browser-bridge.md (en/zh): add Daemon Lifecycle section - README.md: add `opencli daemon status` to Quick Start - README.zh-CN.md: add daemon management commands to tips
42 lines
1.9 KiB
TypeScript
42 lines
1.9 KiB
TypeScript
/**
|
|
* Shared constants used across explore, synthesize, and pipeline modules.
|
|
*/
|
|
|
|
/** Default daemon port for HTTP/WebSocket communication with browser extension */
|
|
export const DEFAULT_DAEMON_PORT = 19825;
|
|
|
|
/** Default idle timeout before daemon auto-exits (ms). Override via OPENCLI_DAEMON_TIMEOUT env var. */
|
|
export const DEFAULT_DAEMON_IDLE_TIMEOUT = 4 * 60 * 60 * 1000; // 4 hours
|
|
|
|
/** URL query params that are volatile/ephemeral and should be stripped from patterns */
|
|
export const VOLATILE_PARAMS = new Set([
|
|
'w_rid', 'wts', '_', 'callback', 'timestamp', 't', 'nonce', 'sign',
|
|
]);
|
|
|
|
/** Search-related query parameter names */
|
|
export const SEARCH_PARAMS = new Set([
|
|
'q', 'query', 'keyword', 'search', 'wd', 'kw', 'search_query', 'w',
|
|
]);
|
|
|
|
/** Pagination-related query parameter names */
|
|
export const PAGINATION_PARAMS = new Set([
|
|
'page', 'pn', 'offset', 'cursor', 'next', 'page_num',
|
|
]);
|
|
|
|
/** Limit/page-size query parameter names */
|
|
export const LIMIT_PARAMS = new Set([
|
|
'limit', 'count', 'size', 'per_page', 'page_size', 'ps', 'num',
|
|
]);
|
|
|
|
/** Field role → common API field names mapping */
|
|
export const FIELD_ROLES: Record<string, string[]> = {
|
|
title: ['title', 'name', 'text', 'content', 'desc', 'description', 'headline', 'subject'],
|
|
url: ['url', 'uri', 'link', 'href', 'permalink', 'jump_url', 'web_url', 'share_url'],
|
|
author: ['author', 'username', 'user_name', 'nickname', 'nick', 'owner', 'creator', 'up_name', 'uname'],
|
|
score: ['score', 'hot', 'heat', 'likes', 'like_count', 'view_count', 'views', 'play', 'favorite_count', 'reply_count'],
|
|
time: ['time', 'created_at', 'publish_time', 'pub_time', 'date', 'ctime', 'mtime', 'pubdate', 'created'],
|
|
id: ['id', 'aid', 'bvid', 'mid', 'uid', 'oid', 'note_id', 'item_id'],
|
|
cover: ['cover', 'pic', 'image', 'thumbnail', 'poster', 'avatar'],
|
|
category: ['category', 'tag', 'type', 'tname', 'channel', 'section'],
|
|
};
|