bingocode 1.0.40 → 1.1.42

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 (63) hide show
  1. package/bin/bingo-win.cjs +2 -1
  2. package/bin/bingocode-win.cjs +2 -1
  3. package/bin/claude-win.cjs +2 -1
  4. package/bun.lock +1716 -0
  5. package/package.json +14 -2
  6. package/src/server/config/providers.yaml +1 -1
  7. package/src/server/proxy/transform/anthropicToOpenaiChat.ts +23 -9
  8. package/adapters/README.md +0 -87
  9. package/adapters/common/__tests__/chat-queue.test.ts +0 -61
  10. package/adapters/common/__tests__/format.test.ts +0 -148
  11. package/adapters/common/__tests__/http-client.test.ts +0 -105
  12. package/adapters/common/__tests__/message-buffer.test.ts +0 -84
  13. package/adapters/common/__tests__/message-dedup.test.ts +0 -57
  14. package/adapters/common/__tests__/session-store.test.ts +0 -62
  15. package/adapters/common/__tests__/ws-bridge.test.ts +0 -177
  16. package/adapters/common/attachment/__tests__/attachment-limits.test.ts +0 -52
  17. package/adapters/common/attachment/__tests__/attachment-store.test.ts +0 -108
  18. package/adapters/common/attachment/__tests__/image-block-watcher.test.ts +0 -115
  19. package/adapters/common/attachment/attachment-limits.ts +0 -58
  20. package/adapters/common/attachment/attachment-store.ts +0 -121
  21. package/adapters/common/attachment/attachment-types.ts +0 -29
  22. package/adapters/common/attachment/image-block-watcher.ts +0 -94
  23. package/adapters/common/chat-queue.ts +0 -24
  24. package/adapters/common/config.ts +0 -96
  25. package/adapters/common/format.ts +0 -229
  26. package/adapters/common/http-client.ts +0 -107
  27. package/adapters/common/message-buffer.ts +0 -91
  28. package/adapters/common/message-dedup.ts +0 -57
  29. package/adapters/common/pairing.ts +0 -149
  30. package/adapters/common/session-store.ts +0 -60
  31. package/adapters/common/ws-bridge.ts +0 -282
  32. package/adapters/feishu/__tests__/card-errors.test.ts +0 -194
  33. package/adapters/feishu/__tests__/cardkit.test.ts +0 -295
  34. package/adapters/feishu/__tests__/extract-payload.test.ts +0 -77
  35. package/adapters/feishu/__tests__/feishu.test.ts +0 -907
  36. package/adapters/feishu/__tests__/flush-controller.test.ts +0 -290
  37. package/adapters/feishu/__tests__/markdown-style.test.ts +0 -353
  38. package/adapters/feishu/__tests__/media.test.ts +0 -120
  39. package/adapters/feishu/__tests__/streaming-card.test.ts +0 -914
  40. package/adapters/feishu/card-errors.ts +0 -151
  41. package/adapters/feishu/cardkit.ts +0 -294
  42. package/adapters/feishu/extract-payload.ts +0 -95
  43. package/adapters/feishu/flush-controller.ts +0 -149
  44. package/adapters/feishu/index.ts +0 -1275
  45. package/adapters/feishu/markdown-style.ts +0 -212
  46. package/adapters/feishu/media.ts +0 -176
  47. package/adapters/feishu/streaming-card.ts +0 -612
  48. package/adapters/package.json +0 -23
  49. package/adapters/telegram/__tests__/media.test.ts +0 -86
  50. package/adapters/telegram/__tests__/telegram.test.ts +0 -115
  51. package/adapters/telegram/index.ts +0 -754
  52. package/adapters/telegram/media.ts +0 -89
  53. package/adapters/tsconfig.json +0 -18
  54. package/runtime/mac_helper.py +0 -775
  55. package/runtime/requirements-win.txt +0 -7
  56. package/runtime/requirements.txt +0 -6
  57. package/runtime/test_helpers.py +0 -322
  58. package/runtime/win_helper.py +0 -723
  59. package/scripts/count-app-loc.ts +0 -256
  60. package/scripts/release.ts +0 -130
  61. package/start-cli.bat +0 -7
  62. package/stubs/ant-claude-for-chrome-mcp.ts +0 -24
  63. package/stubs/color-diff-napi.ts +0 -45
@@ -1,89 +0,0 @@
1
- /**
2
- * Telegram media service — wraps grammY download/upload helpers.
3
- *
4
- * Telegram file download flow:
5
- * 1. bot.api.getFile(file_id) → { file_path }
6
- * 2. GET https://api.telegram.org/file/bot<token>/<file_path>
7
- */
8
-
9
- import { InputFile, type Bot } from 'grammy'
10
- import { AttachmentStore } from '../common/attachment/attachment-store.js'
11
- import type { LocalAttachment } from '../common/attachment/attachment-types.js'
12
-
13
- function extOf(fileName?: string): string {
14
- if (!fileName) return ''
15
- const m = /\.([^./\\]+)$/.exec(fileName)
16
- return m ? m[1]!.toLowerCase() : ''
17
- }
18
-
19
- function classifyKind(mime: string | undefined, fileName: string): 'image' | 'file' {
20
- if (mime?.startsWith('image/')) return 'image'
21
- const ext = extOf(fileName)
22
- if (['jpg', 'jpeg', 'png', 'gif', 'webp', 'heic'].includes(ext)) return 'image'
23
- return 'file'
24
- }
25
-
26
- export interface DownloadHint {
27
- fileName?: string
28
- mimeType?: string
29
- }
30
-
31
- export class TelegramMediaService {
32
- constructor(
33
- private readonly bot: Bot,
34
- private readonly store: AttachmentStore,
35
- ) {}
36
-
37
- async downloadFile(
38
- fileId: string,
39
- sessionId: string,
40
- hint: DownloadHint = {},
41
- ): Promise<LocalAttachment> {
42
- const file = await this.bot.api.getFile(fileId)
43
- if (!file.file_path) {
44
- throw new Error(`[TelegramMedia] getFile returned no file_path for ${fileId}`)
45
- }
46
- const token = (this.bot as unknown as { token: string }).token
47
- const url = `https://api.telegram.org/file/bot${token}/${file.file_path}`
48
- const resp = await fetch(url)
49
- if (!resp.ok) {
50
- throw new Error(`[TelegramMedia] fetch failed: ${resp.status} ${resp.statusText}`)
51
- }
52
- const buffer = Buffer.from(await resp.arrayBuffer())
53
- const mime = hint.mimeType ?? resp.headers.get('content-type') ?? undefined
54
- const fallbackName = file.file_path.split('/').pop() || fileId
55
- const name = hint.fileName ?? fallbackName
56
- const kind = classifyKind(mime, name)
57
- const target = this.store.resolvePath('telegram', sessionId, name)
58
- await this.store.write(target, buffer)
59
- return {
60
- kind,
61
- name,
62
- path: target,
63
- size: buffer.length,
64
- mimeType: mime ?? (kind === 'image' ? 'image/png' : 'application/octet-stream'),
65
- buffer,
66
- }
67
- }
68
-
69
- async sendPhoto(chatId: number, buffer: Buffer, caption?: string): Promise<void> {
70
- await this.bot.api.sendPhoto(
71
- chatId,
72
- new InputFile(buffer),
73
- caption ? { caption } : undefined,
74
- )
75
- }
76
-
77
- async sendDocument(
78
- chatId: number,
79
- buffer: Buffer,
80
- fileName: string,
81
- caption?: string,
82
- ): Promise<void> {
83
- await this.bot.api.sendDocument(
84
- chatId,
85
- new InputFile(buffer, fileName),
86
- caption ? { caption } : undefined,
87
- )
88
- }
89
- }
@@ -1,18 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ESNext",
4
- "module": "ESNext",
5
- "moduleResolution": "bundler",
6
- "strict": true,
7
- "esModuleInterop": true,
8
- "skipLibCheck": true,
9
- "types": ["bun-types"],
10
- "outDir": "dist",
11
- "rootDir": ".",
12
- "paths": {
13
- "@server/*": ["../src/server/*"]
14
- }
15
- },
16
- "include": ["**/*.ts"],
17
- "exclude": ["node_modules", "dist"]
18
- }