@unlinearity/cli-wechat-bridge 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/bin/_run-entry.mjs +2 -8
  2. package/bin/wechat-bridge-claude.mjs +2 -2
  3. package/bin/wechat-bridge-codex.mjs +2 -2
  4. package/bin/wechat-bridge-opencode.mjs +2 -2
  5. package/bin/wechat-bridge-shell.mjs +2 -2
  6. package/bin/wechat-bridge.mjs +2 -2
  7. package/bin/wechat-check-update.mjs +2 -2
  8. package/bin/wechat-claude-start.mjs +2 -2
  9. package/bin/wechat-claude.mjs +2 -2
  10. package/bin/wechat-codex-start.mjs +2 -2
  11. package/bin/wechat-codex.mjs +2 -2
  12. package/bin/wechat-opencode-start.mjs +2 -2
  13. package/bin/wechat-opencode.mjs +2 -2
  14. package/dist/bridge/bridge-adapters.claude.js +829 -0
  15. package/dist/bridge/bridge-adapters.codex.js +2206 -0
  16. package/dist/bridge/bridge-adapters.core.js +668 -0
  17. package/dist/bridge/bridge-adapters.js +26 -0
  18. package/dist/bridge/bridge-adapters.opencode.js +1777 -0
  19. package/dist/bridge/bridge-adapters.shared.js +1098 -0
  20. package/dist/bridge/bridge-adapters.shell.js +363 -0
  21. package/dist/bridge/bridge-controller.js +44 -0
  22. package/dist/bridge/bridge-final-reply.js +31 -0
  23. package/dist/bridge/bridge-process-reaper.js +348 -0
  24. package/dist/bridge/bridge-state.js +356 -0
  25. package/dist/bridge/bridge-types.js +1 -0
  26. package/dist/bridge/bridge-utils.js +1150 -0
  27. package/dist/bridge/claude-hook.js +82 -0
  28. package/dist/bridge/claude-hooks.js +267 -0
  29. package/dist/bridge/wechat-bridge.js +904 -0
  30. package/dist/commands/check-update.js +30 -0
  31. package/dist/companion/codex-panel-link.js +72 -0
  32. package/dist/companion/codex-panel.js +179 -0
  33. package/dist/companion/codex-remote-client.js +117 -0
  34. package/dist/companion/local-companion-link.js +210 -0
  35. package/dist/companion/local-companion-start.js +364 -0
  36. package/dist/companion/local-companion.js +411 -0
  37. package/dist/media/media-types.js +1 -0
  38. package/dist/runtime/create-runtime-host.js +12 -0
  39. package/dist/runtime/legacy-adapter-runtime.js +40 -0
  40. package/dist/runtime/runtime-types.js +5 -0
  41. package/dist/utils/version-checker.js +161 -0
  42. package/dist/wechat/channel-config.js +87 -0
  43. package/dist/wechat/setup.js +184 -0
  44. package/dist/wechat/standalone-bot.js +356 -0
  45. package/dist/wechat/wechat-channel.js +481 -0
  46. package/dist/wechat/wechat-transport.js +870 -0
  47. package/package.json +17 -14
  48. package/src/bridge/bridge-adapters.claude.ts +0 -1047
  49. package/src/bridge/bridge-adapters.codex.ts +0 -2733
  50. package/src/bridge/bridge-adapters.core.ts +0 -877
  51. package/src/bridge/bridge-adapters.opencode.ts +0 -2390
  52. package/src/bridge/bridge-adapters.shared.ts +0 -1647
  53. package/src/bridge/bridge-adapters.shell.ts +0 -456
  54. package/src/bridge/bridge-adapters.ts +0 -30
  55. package/src/bridge/bridge-controller.ts +0 -58
  56. package/src/bridge/bridge-final-reply.ts +0 -56
  57. package/src/bridge/bridge-process-reaper.ts +0 -417
  58. package/src/bridge/bridge-state.ts +0 -520
  59. package/src/bridge/bridge-types.ts +0 -218
  60. package/src/bridge/bridge-utils.ts +0 -1524
  61. package/src/bridge/claude-hook.ts +0 -92
  62. package/src/bridge/claude-hooks.ts +0 -376
  63. package/src/bridge/wechat-bridge.ts +0 -1305
  64. package/src/commands/check-update.ts +0 -46
  65. package/src/companion/codex-panel-link.ts +0 -151
  66. package/src/companion/codex-panel.ts +0 -225
  67. package/src/companion/codex-remote-client.ts +0 -178
  68. package/src/companion/local-companion-link.ts +0 -338
  69. package/src/companion/local-companion-start.ts +0 -520
  70. package/src/companion/local-companion.ts +0 -532
  71. package/src/media/media-types.ts +0 -11
  72. package/src/runtime/create-runtime-host.ts +0 -16
  73. package/src/runtime/legacy-adapter-runtime.ts +0 -55
  74. package/src/runtime/runtime-types.ts +0 -51
  75. package/src/utils/version-checker.ts +0 -197
  76. package/src/wechat/channel-config.ts +0 -141
  77. package/src/wechat/setup.ts +0 -232
  78. package/src/wechat/standalone-bot.ts +0 -483
  79. package/src/wechat/wechat-channel.ts +0 -608
  80. package/src/wechat/wechat-transport.ts +0 -1290
@@ -1,218 +0,0 @@
1
- export type BridgeAdapterKind = "codex" | "claude" | "opencode" | "shell";
2
- export type BridgeLifecycleMode = "persistent" | "companion_bound";
3
- export type BridgeTurnOrigin = "wechat" | "local";
4
- export type BridgeSessionSwitchSource = BridgeTurnOrigin | "restore";
5
- export type BridgeSessionSwitchReason =
6
- | "local_follow"
7
- | "local_session_fallback"
8
- | "local_turn"
9
- | "wechat_resume"
10
- | "startup_restore";
11
- export type BridgeThreadSwitchSource = BridgeSessionSwitchSource;
12
- export type BridgeThreadSwitchReason = BridgeSessionSwitchReason;
13
-
14
- export type BridgeWorkerStatus =
15
- | "starting"
16
- | "idle"
17
- | "busy"
18
- | "awaiting_approval"
19
- | "awaiting_input"
20
- | "stopped"
21
- | "error";
22
-
23
- export type BridgeNoticeLevel = "info" | "warning";
24
-
25
- export type ApprovalSource = "shell" | "cli";
26
-
27
- export type ApprovalRequest = {
28
- source: ApprovalSource;
29
- summary: string;
30
- commandPreview: string;
31
- toolName?: string;
32
- detailLabel?: string;
33
- detailPreview?: string;
34
- requestId?: string;
35
- confirmInput?: string;
36
- denyInput?: string;
37
- };
38
-
39
- export type PendingApproval = ApprovalRequest & {
40
- code: string;
41
- createdAt: string;
42
- };
43
-
44
- export type UserInputRequestOption = {
45
- label: string;
46
- description: string;
47
- };
48
-
49
- export type UserInputRequestQuestion = {
50
- id: string;
51
- header: string;
52
- question: string;
53
- isOther: boolean;
54
- isSecret: boolean;
55
- options?: UserInputRequestOption[] | null;
56
- };
57
-
58
- export type UserInputRequest = {
59
- summary: string;
60
- questions: UserInputRequestQuestion[];
61
- };
62
-
63
- export type PendingUserInputRequest = UserInputRequest & {
64
- createdAt: string;
65
- };
66
-
67
- export type BridgeResumeSessionCandidate = {
68
- sessionId: string;
69
- title: string;
70
- lastUpdatedAt: string;
71
- source?: string;
72
- threadId?: string;
73
- };
74
-
75
- export type BridgeResumeThreadCandidate = BridgeResumeSessionCandidate;
76
-
77
- export type BridgeState = {
78
- instanceId: string;
79
- adapter: BridgeAdapterKind;
80
- command: string;
81
- cwd: string;
82
- profile?: string;
83
- bridgeStartedAtMs: number;
84
- authorizedUserId: string;
85
- ignoredBacklogCount: number;
86
- sharedSessionId?: string;
87
- sharedThreadId?: string;
88
- resumeConversationId?: string;
89
- transcriptPath?: string;
90
- pendingConfirmation?: PendingApproval | null;
91
- pendingUserInput?: PendingUserInputRequest | null;
92
- lastActivityAt?: string;
93
- };
94
-
95
- export type BridgeAdapterState = {
96
- kind: BridgeAdapterKind;
97
- status: BridgeWorkerStatus;
98
- pid?: number;
99
- cwd: string;
100
- command: string;
101
- profile?: string;
102
- startedAt?: string;
103
- lastInputAt?: string;
104
- lastOutputAt?: string;
105
- pendingApproval?: ApprovalRequest | null;
106
- sharedSessionId?: string;
107
- sharedThreadId?: string;
108
- activeRuntimeSessionId?: string;
109
- resumeConversationId?: string;
110
- transcriptPath?: string;
111
- lastSessionSwitchAt?: string;
112
- lastSessionSwitchSource?: BridgeSessionSwitchSource;
113
- lastSessionSwitchReason?: BridgeSessionSwitchReason;
114
- lastThreadSwitchAt?: string;
115
- lastThreadSwitchSource?: BridgeThreadSwitchSource;
116
- lastThreadSwitchReason?: BridgeThreadSwitchReason;
117
- activeTurnId?: string;
118
- activeTurnOrigin?: BridgeTurnOrigin;
119
- pendingApprovalOrigin?: BridgeTurnOrigin;
120
- pendingUserInput?: UserInputRequest | null;
121
- pendingUserInputOrigin?: BridgeTurnOrigin;
122
- };
123
-
124
- export type BridgeEvent =
125
- | {
126
- type: "stdout";
127
- text: string;
128
- timestamp: string;
129
- }
130
- | {
131
- type: "stderr";
132
- text: string;
133
- timestamp: string;
134
- }
135
- | {
136
- type: "final_reply";
137
- text: string;
138
- timestamp: string;
139
- }
140
- | {
141
- type: "status";
142
- status: BridgeWorkerStatus;
143
- message?: string;
144
- timestamp: string;
145
- }
146
- | {
147
- type: "notice";
148
- text: string;
149
- level: BridgeNoticeLevel;
150
- timestamp: string;
151
- }
152
- | {
153
- type: "approval_required";
154
- request: ApprovalRequest | PendingApproval;
155
- timestamp: string;
156
- }
157
- | {
158
- type: "user_input_required";
159
- request: UserInputRequest | PendingUserInputRequest;
160
- timestamp: string;
161
- }
162
- | {
163
- type: "mirrored_user_input";
164
- text: string;
165
- timestamp: string;
166
- origin: "local";
167
- }
168
- | {
169
- type: "session_switched";
170
- sessionId: string;
171
- source: BridgeSessionSwitchSource;
172
- reason: BridgeSessionSwitchReason;
173
- timestamp: string;
174
- }
175
- | {
176
- type: "thread_switched";
177
- threadId: string;
178
- source: BridgeThreadSwitchSource;
179
- reason: BridgeThreadSwitchReason;
180
- timestamp: string;
181
- }
182
- | {
183
- type: "task_complete";
184
- exitCode?: number;
185
- summary?: string;
186
- timestamp: string;
187
- }
188
- | {
189
- type: "task_failed";
190
- message: string;
191
- timestamp: string;
192
- }
193
- | {
194
- type: "fatal_error";
195
- message: string;
196
- timestamp: string;
197
- }
198
- | {
199
- type: "shutdown_requested";
200
- reason: "companion_closed" | "companion_reconnect_timeout";
201
- message: string;
202
- exitCode?: number;
203
- timestamp: string;
204
- };
205
-
206
- export interface BridgeAdapter {
207
- setEventSink(sink: (event: BridgeEvent) => void): void;
208
- start(): Promise<void>;
209
- sendInput(text: string): Promise<void>;
210
- listResumeSessions(limit?: number): Promise<BridgeResumeSessionCandidate[]>;
211
- resumeSession(sessionId: string): Promise<void>;
212
- interrupt(): Promise<boolean>;
213
- reset(): Promise<void>;
214
- resolveApproval(action: "confirm" | "deny"): Promise<boolean>;
215
- submitUserInput(answers: Record<string, string[]>): Promise<boolean>;
216
- dispose(): Promise<void>;
217
- getState(): BridgeAdapterState;
218
- }