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,120 +0,0 @@
1
- import { describe, it, expect, beforeEach, afterEach, mock } from 'bun:test'
2
- import * as fs from 'node:fs/promises'
3
- import * as path from 'node:path'
4
- import * as os from 'node:os'
5
- import { FeishuMediaService } from '../media.js'
6
- import { AttachmentStore } from '../../common/attachment/attachment-store.js'
7
-
8
- function makeMockClient() {
9
- return {
10
- im: {
11
- messageResource: {
12
- get: mock(async () => ({
13
- // node-sdk returns an object with a `.writeFile(path)` helper
14
- // that dumps the underlying stream. We fake that here.
15
- writeFile: async (target: string) => {
16
- await fs.writeFile(target, Buffer.from('DOWNLOADED'))
17
- },
18
- })),
19
- },
20
- image: {
21
- create: mock(async (_req: any) => ({
22
- data: { image_key: 'img_fake_123' },
23
- })),
24
- },
25
- file: {
26
- create: mock(async (_req: any) => ({
27
- data: { file_key: 'file_fake_456' },
28
- })),
29
- },
30
- message: {
31
- create: mock(async (_req: any) => ({
32
- data: { message_id: 'om_fake' },
33
- })),
34
- },
35
- },
36
- }
37
- }
38
-
39
- let tmpRoot: string
40
-
41
- beforeEach(async () => {
42
- tmpRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'feishu-media-test-'))
43
- })
44
-
45
- afterEach(async () => {
46
- await fs.rm(tmpRoot, { recursive: true, force: true })
47
- })
48
-
49
- describe('FeishuMediaService', () => {
50
- it('downloadResource writes a local file and returns LocalAttachment', async () => {
51
- const client = makeMockClient()
52
- const store = new AttachmentStore({ root: tmpRoot, retentionMs: 60_000 })
53
- const svc = new FeishuMediaService(client as any, store)
54
- const local = await svc.downloadResource({
55
- messageId: 'om_msg_1',
56
- fileKey: 'img_key_1',
57
- kind: 'image',
58
- fileName: 'cat.png',
59
- sessionId: 'sess-1',
60
- })
61
- expect(local.kind).toBe('image')
62
- expect(local.name).toBe('cat.png')
63
- expect(local.size).toBe('DOWNLOADED'.length)
64
- expect(local.path).toContain(path.join('feishu', 'sess-1'))
65
- const onDisk = await fs.readFile(local.path)
66
- expect(onDisk.toString()).toBe('DOWNLOADED')
67
- expect(client.im.messageResource.get).toHaveBeenCalledTimes(1)
68
- const call = (client.im.messageResource.get as any).mock.calls[0][0]
69
- expect(call.path.message_id).toBe('om_msg_1')
70
- expect(call.path.file_key).toBe('img_key_1')
71
- expect(call.params.type).toBe('image')
72
- })
73
-
74
- it('uploadImage returns an image_key and sends the buffer through', async () => {
75
- const client = makeMockClient()
76
- const store = new AttachmentStore({ root: tmpRoot, retentionMs: 60_000 })
77
- const svc = new FeishuMediaService(client as any, store)
78
- const key = await svc.uploadImage(Buffer.from('PNGDATA'), 'image/png')
79
- expect(key).toBe('img_fake_123')
80
- expect(client.im.image.create).toHaveBeenCalledTimes(1)
81
- const call = (client.im.image.create as any).mock.calls[0][0]
82
- expect(call.data.image_type).toBe('message')
83
- expect(call.data.image).toBeDefined()
84
- })
85
-
86
- it('uploadFile returns a file_key and uses stream file_type mapping', async () => {
87
- const client = makeMockClient()
88
- const store = new AttachmentStore({ root: tmpRoot, retentionMs: 60_000 })
89
- const svc = new FeishuMediaService(client as any, store)
90
- const key = await svc.uploadFile(Buffer.from('PDFDATA'), 'report.pdf')
91
- expect(key).toBe('file_fake_456')
92
- const call = (client.im.file.create as any).mock.calls[0][0]
93
- expect(call.data.file_name).toBe('report.pdf')
94
- expect(call.data.file_type).toBe('pdf')
95
- })
96
-
97
- it('sendImageMessage posts msg_type=image', async () => {
98
- const client = makeMockClient()
99
- const store = new AttachmentStore({ root: tmpRoot, retentionMs: 60_000 })
100
- const svc = new FeishuMediaService(client as any, store)
101
- await svc.sendImageMessage('oc_chat_1', 'img_fake_123')
102
- const call = (client.im.message.create as any).mock.calls[0][0]
103
- expect(call.params.receive_id_type).toBe('chat_id')
104
- expect(call.data.receive_id).toBe('oc_chat_1')
105
- expect(call.data.msg_type).toBe('image')
106
- const content = JSON.parse(call.data.content)
107
- expect(content.image_key).toBe('img_fake_123')
108
- })
109
-
110
- it('sendFileMessage posts msg_type=file', async () => {
111
- const client = makeMockClient()
112
- const store = new AttachmentStore({ root: tmpRoot, retentionMs: 60_000 })
113
- const svc = new FeishuMediaService(client as any, store)
114
- await svc.sendFileMessage('oc_chat_1', 'file_fake_456')
115
- const call = (client.im.message.create as any).mock.calls[0][0]
116
- expect(call.data.msg_type).toBe('file')
117
- const content = JSON.parse(call.data.content)
118
- expect(content.file_key).toBe('file_fake_456')
119
- })
120
- })