mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-11-30 16:02:58 +08:00
feat: mac发送能力重构为libtmwechat
- 发送改走本地host, 在微信登录时触发 - 删除旧OneBot及对应UI控制面
This commit is contained in:
1 parent
069d836dea
commit
7268188e40
50 files changed
+2442
-4141
No files matched your search
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* Wire types for the built-in macOS native WeChat runtime
|
||||
* (tm-wechat-host + libtmwechat.dylib), managed by MacWechatRuntimeManager.
|
||||
*
|
||||
* Binding lifecycle is "bind once per WeChat process": frida's unload/detach
|
||||
* inside WeChat is unreliable, so rebind is NOT a product path. When the host
|
||||
* dies while bound, the WeChat process keeps an orphaned agent and must be
|
||||
* restarted before binding again — surfaced as wechatRestartRequired.
|
||||
*/
|
||||
|
||||
export type MacWechatRuntimeLifecycle =
|
||||
| 'stopped' // host not running (or never started)
|
||||
| 'starting' // spawn issued, waiting for /healthz
|
||||
| 'online' // host answering; WeChat NOT touched (lazy)
|
||||
| 'crashed_unbound' // died while unbound — safe to auto-restart
|
||||
| 'crashed_bound' // died while bound — WeChat keeps an orphan agent
|
||||
|
||||
export type MacWechatHostRuntimeState =
|
||||
| 'not_initialized'
|
||||
| 'wechat_not_running'
|
||||
| 'not_logged_in'
|
||||
| 'unsupported_version'
|
||||
| 'initializing'
|
||||
| 'ready'
|
||||
| 'error'
|
||||
| 'unknown'
|
||||
|
||||
export type MacWechatBindingState =
|
||||
| 'unbound'
|
||||
| 'binding'
|
||||
| 'bound'
|
||||
| 'ready'
|
||||
| 'failed'
|
||||
| 'stale'
|
||||
| 'unknown'
|
||||
|
||||
export interface MacWechatRuntimeManifest {
|
||||
runtime: 'tm-wechat-native'
|
||||
version: string
|
||||
platform: 'darwin-arm64'
|
||||
architecture: 'arm64'
|
||||
protocolVersion: number
|
||||
buildCommit: string
|
||||
tmSendSourceSha256: string
|
||||
addressProfileSha256: string
|
||||
supportedWechatVersions: string[]
|
||||
capabilities: Array<'text' | 'image' | 'voice'>
|
||||
}
|
||||
|
||||
export interface MacWechatBindingStatus {
|
||||
runtime: boolean
|
||||
hostPid?: number
|
||||
runtimeState: MacWechatHostRuntimeState
|
||||
runtimeVersion?: string
|
||||
embeddedAgentSha256?: string
|
||||
embeddedAddressProfileSha256?: string
|
||||
abiVersion?: number
|
||||
dylibPath?: string
|
||||
wechatRunning: boolean
|
||||
wechatPid: number
|
||||
wechatVersion?: string
|
||||
supported: boolean
|
||||
supportedVersions?: string
|
||||
bindingState: MacWechatBindingState
|
||||
bound: boolean
|
||||
boundWechatPid: number
|
||||
sessionAttached: boolean
|
||||
scriptLoaded: boolean
|
||||
sendContextReady: boolean
|
||||
canSendText?: boolean
|
||||
canSendImage?: boolean
|
||||
canSendVoice?: boolean
|
||||
attachCount: number
|
||||
lastAttachAt?: string
|
||||
lastDetachReason?: string
|
||||
}
|
||||
|
||||
export interface MacWechatRuntimeSnapshot {
|
||||
lifecycle: MacWechatRuntimeLifecycle
|
||||
/** True when the last host death happened while bound: WeChat must be restarted. */
|
||||
wechatRestartRequired: boolean
|
||||
endpoint: string
|
||||
port: number
|
||||
runtimeDir?: string
|
||||
manifest?: MacWechatRuntimeManifest
|
||||
error?: string
|
||||
binding?: MacWechatBindingStatus
|
||||
}
|
||||
|
||||
export interface MacWechatBindResult {
|
||||
ok: boolean
|
||||
attached: boolean
|
||||
state?: 'wechat_restart_required' | 'runtime_offline' | 'host_error' | 'bad_response'
|
||||
message: string
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
export type PersonalWechatRuntimeState =
|
||||
| 'missing'
|
||||
| 'downloading'
|
||||
| 'ready'
|
||||
| 'invalid'
|
||||
| 'error'
|
||||
| 'unsupported'
|
||||
|
||||
export interface PersonalWechatRuntimeStatus {
|
||||
version: string
|
||||
state: PersonalWechatRuntimeState
|
||||
downloadedBytes: number
|
||||
totalBytes: number
|
||||
progress: number
|
||||
platform: NodeJS.Platform
|
||||
architecture: string
|
||||
supported: boolean
|
||||
removable: boolean
|
||||
directory?: string
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface PersonalWechatRuntimeDownloadResult {
|
||||
success: boolean
|
||||
status: PersonalWechatRuntimeStatus
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface PersonalWechatRuntimeProgressEvent extends PersonalWechatRuntimeStatus {}
|
||||
@@ -20,11 +20,10 @@ export interface PersonalWechatVoiceEncodingEnvironment {
|
||||
ready: boolean
|
||||
checkedAt?: string
|
||||
runtimeReady: boolean
|
||||
runtimeRoot?: string
|
||||
python: PersonalWechatVoiceRuntimeComponent
|
||||
pilk: PersonalWechatVoiceRuntimeComponent
|
||||
ffmpeg: PersonalWechatVoiceRuntimeComponent
|
||||
encoder: 'pilk' | 'go-silk' | 'unavailable'
|
||||
encoder: 'pilk' | 'silk' | 'unavailable'
|
||||
message: string
|
||||
}
|
||||
|
||||
@@ -32,6 +31,4 @@ export interface PersonalWechatVoiceEncodingEnvironmentResult {
|
||||
success: boolean
|
||||
environment: PersonalWechatVoiceEncodingEnvironment
|
||||
error?: string
|
||||
restarted?: boolean
|
||||
restartError?: string
|
||||
}
|
||||
@@ -20,7 +20,6 @@ export interface PersonalWechatSenderStatus {
|
||||
wechatRunning: boolean
|
||||
wechatPid?: number
|
||||
boundWechatPid?: number
|
||||
oneBotPid?: number
|
||||
endpoint: string
|
||||
endpointReady: boolean
|
||||
wechatVersion?: string
|
||||
@@ -80,6 +79,8 @@ export interface PersonalWechatSendTextRequest extends PersonalWechatSendBaseReq
|
||||
export interface PersonalWechatSendImageRequest extends PersonalWechatSendBaseRequest {
|
||||
type: 'image'
|
||||
filePath: string
|
||||
/** 日报图片成功后再发送的文字;undefined 表示普通图片发送,不启用日报序列。 */
|
||||
postfixText?: string
|
||||
}
|
||||
|
||||
export interface PersonalWechatSendVoiceRequest extends PersonalWechatSendBaseRequest {
|
||||
@@ -112,8 +113,12 @@ export interface PersonalWechatSendResult {
|
||||
success: boolean
|
||||
status: PersonalWechatSenderStatus
|
||||
error?: string
|
||||
postfixSent?: boolean
|
||||
postfixError?: string
|
||||
}
|
||||
|
||||
export const DEFAULT_REPORT_IMAGE_POSTFIX_TEXT = '今日日报'
|
||||
|
||||
/** Safe, user-copyable metadata for the most recent voice send attempt. */
|
||||
export interface PersonalWechatVoiceDiagnostic {
|
||||
request_id: string
|
||||
|
||||
@@ -23,6 +23,10 @@ export type WechatActionPurpose =
|
||||
| 'manual_image'
|
||||
/** 用户手动发送文本。 */
|
||||
| 'manual_text'
|
||||
/** 用户确认后的日报图片;进入 automation 队列以复用 3 秒发送间隔。 */
|
||||
| 'manual_report_image'
|
||||
/** 日报图片成功后的后置词;只有图片 sent 后才会创建。 */
|
||||
| 'manual_report_postfix'
|
||||
/**
|
||||
* Automation v1 的两个用途。
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user