@things-factory/ai-assistant 10.1.269 → 10.1.271
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.
- package/client/setup-assistant-dock.ts +30 -15
- package/dist-client/setup-assistant-dock.js +30 -15
- package/dist-client/setup-assistant-dock.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/assistant-chat-resolver.js +1 -1
- package/dist-server/service/assistant-chat-resolver.js.map +1 -1
- package/dist-server/service/chat-session-participant/invite-notification.d.ts +20 -4
- package/dist-server/service/chat-session-participant/invite-notification.js +17 -12
- package/dist-server/service/chat-session-participant/invite-notification.js.map +1 -1
- package/dist-server/service/chat-session-resolver.js +1 -1
- package/dist-server/service/chat-session-resolver.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/server/service/assistant-chat-resolver.ts +1 -1
- package/server/service/chat-session/group-room.test.ts +4 -4
- package/server/service/chat-session-participant/invite-notification.test.ts +12 -12
- package/server/service/chat-session-participant/invite-notification.ts +25 -11
- package/server/service/chat-session-resolver.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/ai-assistant",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.271",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"things-factory": true,
|
|
6
6
|
"author": "heartyoh",
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"@operato/shell": "^10.29.69",
|
|
37
37
|
"@operato/styles": "^10.0.0",
|
|
38
38
|
"@operato/utils": "^10.29.76",
|
|
39
|
-
"@things-factory/ai-client-base": "^10.1.
|
|
40
|
-
"@things-factory/apptool-base": "^10.1.
|
|
41
|
-
"@things-factory/attachment-base": "^10.1.
|
|
42
|
-
"@things-factory/auth-base": "^10.1.
|
|
39
|
+
"@things-factory/ai-client-base": "^10.1.271",
|
|
40
|
+
"@things-factory/apptool-base": "^10.1.270",
|
|
41
|
+
"@things-factory/attachment-base": "^10.1.271",
|
|
42
|
+
"@things-factory/auth-base": "^10.1.271",
|
|
43
43
|
"@things-factory/env": "^10.1.149",
|
|
44
|
-
"@things-factory/help": "^10.1.
|
|
45
|
-
"@things-factory/setting-base": "^10.1.
|
|
46
|
-
"@things-factory/shell": "^10.1.
|
|
44
|
+
"@things-factory/help": "^10.1.270",
|
|
45
|
+
"@things-factory/setting-base": "^10.1.271",
|
|
46
|
+
"@things-factory/shell": "^10.1.270",
|
|
47
47
|
"dompurify": "^3.0.0",
|
|
48
48
|
"exceljs": "4.2.0",
|
|
49
49
|
"graphql-scalars": "^1.22.0",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"copyfiles": "^2.4.1",
|
|
60
60
|
"rimraf": "^5.0.0"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "843bc2608d8c89348ced871777535966758927db"
|
|
63
63
|
}
|
|
@@ -395,7 +395,7 @@ export class AssistantChatResolver {
|
|
|
395
395
|
visibility: (session as any).visibility
|
|
396
396
|
})
|
|
397
397
|
/* 편지가 못 갔다고 방에 들어온 사실이 취소되지는 않는다(`sendInviteNotification`). */
|
|
398
|
-
await sendInviteNotification((context.state as any)?.
|
|
398
|
+
await sendInviteNotification((context.state as any)?.sendNotice, invite.invited, user, (session as any)?.name, undefined, requestTranslator(context))
|
|
399
399
|
|
|
400
400
|
publishChatMessage({ domainId: domain.id, sessionId: session.id, message: saved } as any)
|
|
401
401
|
publishSessionActivity({
|
|
@@ -41,8 +41,8 @@ let enteredAs: string[]
|
|
|
41
41
|
const doors = new ChatSessionResolver()
|
|
42
42
|
const entry = new EntryProposalResolver()
|
|
43
43
|
|
|
44
|
-
/** A request as that person - the state a door reads. `
|
|
45
|
-
const as = (user: any) => ({ state: { domain, user,
|
|
44
|
+
/** A request as that person - the state a door reads. `sendNotice` (notification) keeps what an invite sends. */
|
|
45
|
+
const as = (user: any) => ({ state: { domain, user, sendNotice: (notice: any) => notices.push({ receivers: notice.receivers.map((one: any) => one.id), body: notice.words('ko').body }) } }) as any
|
|
46
46
|
|
|
47
47
|
beforeAll(async () => {
|
|
48
48
|
db = new TypeOrmDataSource({
|
|
@@ -131,7 +131,7 @@ describe('a group conversation', () => {
|
|
|
131
131
|
|
|
132
132
|
it('★ the owner brings someone in - they are told, and from then on they read and write', async () => {
|
|
133
133
|
expect(await doors.inviteToAISession(session.id, [guest.id], as(owner))).toEqual([guest.id])
|
|
134
|
-
expect(notices
|
|
134
|
+
expect(notices).toHaveLength(1)
|
|
135
135
|
expect(notices[0].receivers).toEqual([guest.id])
|
|
136
136
|
expect(notices[0].body).toContain('pricing')
|
|
137
137
|
|
|
@@ -163,7 +163,7 @@ describe('a group conversation', () => {
|
|
|
163
163
|
it("the owner's mention seats, as the invite does", async () => {
|
|
164
164
|
await doors.sayToRoom(session.id, `see @guest{userId:${guest.id}}`, undefined, as(owner))
|
|
165
165
|
expect(await roomHears(guest)).toBe(true)
|
|
166
|
-
expect(notices.map(n => n.receivers)).toEqual([[guest.id]
|
|
166
|
+
expect(notices.map(n => n.receivers)).toEqual([[guest.id]])
|
|
167
167
|
})
|
|
168
168
|
|
|
169
169
|
it('a person outside the domain is not seated', async () => {
|
|
@@ -44,23 +44,23 @@ describe('an invite outside a board', () => {
|
|
|
44
44
|
})
|
|
45
45
|
})
|
|
46
46
|
|
|
47
|
-
describe('sendInviteNotification —
|
|
48
|
-
test('★ the invite
|
|
47
|
+
describe('sendInviteNotification — one kept notice', () => {
|
|
48
|
+
test('★ the invite is one notice to the people seated, kept by notification, at the board when there is one', async () => {
|
|
49
49
|
const sent: any[] = []
|
|
50
|
-
await sendInviteNotification(
|
|
51
|
-
expect(sent
|
|
52
|
-
expect(sent.
|
|
50
|
+
await sendInviteNotification(notice => void sent.push(notice), ['u1', 'u2'], { name: 'Kim' }, 'pricing', 'board-7')
|
|
51
|
+
expect(sent).toHaveLength(1)
|
|
52
|
+
expect(sent[0]).toMatchObject({ type: 'board-collab-invite', receivers: [{ id: 'u1' }, { id: 'u2' }], address: 'board-modeller/board-7' })
|
|
53
|
+
expect(sent[0].words('ko')).toMatchObject({ subject: 'Board collaboration invite', summary: 'Kim invited you to collaborate on a board.' })
|
|
53
54
|
})
|
|
54
55
|
|
|
55
|
-
test('a
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (payload.mode === 'foreground') throw new Error('down')
|
|
59
|
-
sent.push(payload)
|
|
56
|
+
test('a notice that fails does not undo the seat, and nobody to tell sends nothing', async () => {
|
|
57
|
+
await sendInviteNotification(() => {
|
|
58
|
+
throw new Error('down')
|
|
60
59
|
}, ['u1'], null)
|
|
61
|
-
|
|
62
|
-
await sendInviteNotification(
|
|
60
|
+
const sent: any[] = []
|
|
61
|
+
await sendInviteNotification(notice => void sent.push(notice), [], null)
|
|
63
62
|
await sendInviteNotification(undefined, ['u1'], null)
|
|
63
|
+
expect(sent).toEqual([])
|
|
64
64
|
})
|
|
65
65
|
})
|
|
66
66
|
|
|
@@ -76,15 +76,24 @@ export function buildInviteNotification(
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
/** notification's `sendNotice` (ADR-0164 amendment 1) - the request state carries it when notification is loaded. */
|
|
80
|
+
export type SendNotice = (notice: {
|
|
81
|
+
type: string
|
|
82
|
+
receivers: { id: string }[]
|
|
83
|
+
words: (lng: string) => { subject: string; summary: string; body: string; action: string; note: string }
|
|
84
|
+
address: string
|
|
85
|
+
label: string
|
|
86
|
+
}) => unknown
|
|
87
|
+
|
|
79
88
|
/**
|
|
80
|
-
* Tell the people just seated -
|
|
81
|
-
*
|
|
82
|
-
*
|
|
89
|
+
* Tell the people just seated - kept for each of them, so their inbox has it on every device, live to the screens they
|
|
90
|
+
* have open and by web push (notification's `sendNotice`). Until 2026-11-11 the invite went as a live signal and a
|
|
91
|
+
* push only: one not looking at the app when invited never saw it in the inbox.
|
|
83
92
|
*
|
|
84
93
|
* A letter that does not arrive does not undo the seat - the roster is the record, the notice only tells of it.
|
|
85
94
|
*/
|
|
86
95
|
export async function sendInviteNotification(
|
|
87
|
-
|
|
96
|
+
sendNotice: SendNotice | undefined,
|
|
88
97
|
userIds: string[],
|
|
89
98
|
inviter: Inviter | undefined | null,
|
|
90
99
|
sessionName?: string | null,
|
|
@@ -93,12 +102,17 @@ export async function sendInviteNotification(
|
|
|
93
102
|
t?: InviteTranslate
|
|
94
103
|
): Promise<void> {
|
|
95
104
|
const payload = buildInviteNotification(userIds, boardId, inviter, sessionName, t)
|
|
96
|
-
if (!payload ||
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
/* the
|
|
102
|
-
|
|
105
|
+
if (!payload || typeof sendNotice !== 'function') return
|
|
106
|
+
try {
|
|
107
|
+
await sendNotice({
|
|
108
|
+
type: payload.type,
|
|
109
|
+
receivers: payload.receivers.map(id => ({ id })),
|
|
110
|
+
/* the inviting request's language - the people of one domain read one (see above) */
|
|
111
|
+
words: () => ({ subject: payload.title, summary: payload.body, body: payload.body, action: payload.title, note: '' }),
|
|
112
|
+
address: payload.url ?? '',
|
|
113
|
+
label: `${payload.type} to ${payload.receivers.length}`
|
|
114
|
+
})
|
|
115
|
+
} catch {
|
|
116
|
+
/* the seat stands */
|
|
103
117
|
}
|
|
104
118
|
}
|
|
@@ -41,7 +41,7 @@ const inboxReads = new WeakMap<object, Map<string, Promise<any[]>>>()
|
|
|
41
41
|
|
|
42
42
|
/** 초대 알림 — 발송은 호스트의 기전을 그대로 쓴다(`sendInviteNotification`, 문 셋이 같은 한 곳). */
|
|
43
43
|
async function notifyInvited(context: any, invited: string[], inviter: any, sessionName?: string): Promise<void> {
|
|
44
|
-
await sendInviteNotification(context.state?.
|
|
44
|
+
await sendInviteNotification((context.state as any)?.sendNotice, invited, inviter, sessionName, undefined, requestTranslator(context))
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/**
|