bingocode 1.0.27 → 1.0.28

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 (62) hide show
  1. package/package.json +1 -2
  2. package/.github/FUNDING.yml +0 -1
  3. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -44
  4. package/.github/ISSUE_TEMPLATE/config.yml +0 -1
  5. package/.github/ISSUE_TEMPLATE/question.md +0 -40
  6. package/.github/workflows/build-desktop-dev.yml +0 -210
  7. package/.github/workflows/deploy-docs.yml +0 -59
  8. package/.github/workflows/release-desktop.yml +0 -162
  9. package/.spine/user.yaml +0 -5
  10. package/.spine/workspace.yaml +0 -1
  11. package/adapters/common/__tests__/chat-queue.test.ts +0 -61
  12. package/adapters/common/__tests__/format.test.ts +0 -148
  13. package/adapters/common/__tests__/http-client.test.ts +0 -105
  14. package/adapters/common/__tests__/message-buffer.test.ts +0 -84
  15. package/adapters/common/__tests__/message-dedup.test.ts +0 -57
  16. package/adapters/common/__tests__/session-store.test.ts +0 -62
  17. package/adapters/common/__tests__/ws-bridge.test.ts +0 -177
  18. package/adapters/common/attachment/__tests__/attachment-limits.test.ts +0 -52
  19. package/adapters/common/attachment/__tests__/attachment-store.test.ts +0 -108
  20. package/adapters/common/attachment/__tests__/image-block-watcher.test.ts +0 -115
  21. package/adapters/feishu/__tests__/card-errors.test.ts +0 -194
  22. package/adapters/feishu/__tests__/cardkit.test.ts +0 -295
  23. package/adapters/feishu/__tests__/extract-payload.test.ts +0 -77
  24. package/adapters/feishu/__tests__/feishu.test.ts +0 -907
  25. package/adapters/feishu/__tests__/flush-controller.test.ts +0 -290
  26. package/adapters/feishu/__tests__/markdown-style.test.ts +0 -353
  27. package/adapters/feishu/__tests__/media.test.ts +0 -120
  28. package/adapters/feishu/__tests__/streaming-card.test.ts +0 -914
  29. package/adapters/telegram/__tests__/media.test.ts +0 -86
  30. package/adapters/telegram/__tests__/telegram.test.ts +0 -115
  31. package/adapters/tsconfig.json +0 -18
  32. package/bunfig.toml +0 -1
  33. package/preload.ts +0 -30
  34. package/scripts/count-app-loc.ts +0 -256
  35. package/scripts/release.ts +0 -130
  36. package/src/server/__tests__/conversation-service.test.ts +0 -173
  37. package/src/server/__tests__/conversations.test.ts +0 -458
  38. package/src/server/__tests__/cron-scheduler.test.ts +0 -575
  39. package/src/server/__tests__/e2e/business-flow.test.ts +0 -841
  40. package/src/server/__tests__/e2e/full-flow.test.ts +0 -357
  41. package/src/server/__tests__/fixtures/mock-sdk-cli.ts +0 -123
  42. package/src/server/__tests__/haha-oauth-api.test.ts +0 -146
  43. package/src/server/__tests__/haha-oauth-service.test.ts +0 -185
  44. package/src/server/__tests__/providers-real.test.ts +0 -244
  45. package/src/server/__tests__/providers.test.ts +0 -579
  46. package/src/server/__tests__/proxy-streaming.test.ts +0 -317
  47. package/src/server/__tests__/proxy-transform.test.ts +0 -469
  48. package/src/server/__tests__/real-llm-test.ts +0 -526
  49. package/src/server/__tests__/scheduled-tasks.test.ts +0 -371
  50. package/src/server/__tests__/sessions.test.ts +0 -786
  51. package/src/server/__tests__/settings.test.ts +0 -376
  52. package/src/server/__tests__/skills.test.ts +0 -125
  53. package/src/server/__tests__/tasks.test.ts +0 -171
  54. package/src/server/__tests__/team-watcher.test.ts +0 -400
  55. package/src/server/__tests__/teams.test.ts +0 -627
  56. package/src/server/middleware/cors.test.ts +0 -27
  57. package/src/utils/__tests__/cronFrequency.test.ts +0 -153
  58. package/src/utils/__tests__/cronTasks.test.ts +0 -204
  59. package/src/utils/computerUse/permissions.test.ts +0 -44
  60. package/stubs/ant-claude-for-chrome-mcp.ts +0 -24
  61. package/stubs/color-diff-napi.ts +0 -45
  62. package/tsconfig.json +0 -24
@@ -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
- })