@things-factory/ai-assistant 10.1.277 → 10.1.278
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/utils/addressed-draft.test.ts +2 -2
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/utils/addressed-draft.test.js +2 -2
- package/dist-client/utils/addressed-draft.test.js.map +1 -1
- package/dist-server/service/assistant-mode/mode-categories.js +2 -2
- package/dist-server/service/assistant-mode/mode-categories.js.map +1 -1
- package/dist-server/service/chat-message/message-doors.d.ts +6 -10
- package/dist-server/service/chat-message/message-doors.js +5 -12
- package/dist-server/service/chat-message/message-doors.js.map +1 -1
- package/dist-server/service/data-read/read-target.d.ts +3 -4
- package/dist-server/service/data-read/read-target.js.map +1 -1
- package/dist-server/service/people/person-subject.d.ts +9 -5
- package/dist-server/service/people/person-subject.js +14 -19
- package/dist-server/service/people/person-subject.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/server/service/assistant-mode/mode-categories.ts +2 -2
- package/server/service/assistant-mode/mode-front.test.ts +5 -3
- package/server/service/chat-message/message-doors.test.ts +3 -3
- package/server/service/chat-message/message-doors.ts +8 -13
- package/server/service/chat-session-participant/invite-notification.test.ts +1 -1
- package/server/service/data-read/read-target.ts +3 -4
- package/server/service/people/person-subject.test.ts +15 -17
- package/server/service/people/person-subject.ts +14 -19
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.278",
|
|
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.278",
|
|
40
|
+
"@things-factory/apptool-base": "^10.1.278",
|
|
41
|
+
"@things-factory/attachment-base": "^10.1.278",
|
|
42
|
+
"@things-factory/auth-base": "^10.1.278",
|
|
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.278",
|
|
45
|
+
"@things-factory/setting-base": "^10.1.278",
|
|
46
|
+
"@things-factory/shell": "^10.1.278",
|
|
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": "dc8920fe1a0b85e87b0069951b0ef2bd8e9bb99e"
|
|
63
63
|
}
|
|
@@ -126,8 +126,8 @@ export function screenTargetKeys(mode: FrontMode, screen: TurnScreen, routeOf: (
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
129
|
+
* Pages that prioritize this tool or card. Include a card's editing page so assistant draft requests can
|
|
130
|
+
* use it directly.
|
|
131
131
|
*/
|
|
132
132
|
function pagesOfKey(mode: FrontMode, key: string, routeOf: (key: string) => string | undefined): string[] {
|
|
133
133
|
const card = (mode.entryTargets ?? []).includes(key) ? entryTargetOf(key)?.screen : undefined
|
|
@@ -145,7 +145,9 @@ describe('a whole answer about any record is in front on their screens', () => {
|
|
|
145
145
|
})
|
|
146
146
|
})
|
|
147
147
|
|
|
148
|
-
/*
|
|
148
|
+
/*
|
|
149
|
+
* Prioritize the weekly-report reader and line-entry card on the personal report page.
|
|
150
|
+
*/
|
|
149
151
|
describe('a page puts in front the cards seen on it and the reads that name it', () => {
|
|
150
152
|
const line = {
|
|
151
153
|
key: 'office.weekly-report-line',
|
|
@@ -165,12 +167,12 @@ describe('a page puts in front the cards seen on it and the reads that name it',
|
|
|
165
167
|
declareDetailRead(week as any)
|
|
166
168
|
})
|
|
167
169
|
|
|
168
|
-
it(
|
|
170
|
+
it("prioritizes the weekly-report reader and line-entry card on the personal report page", () => {
|
|
169
171
|
expect(screenTargetKeys(writing, { page: 'my-weekly-report' })).toEqual(['office.my-weekly-report', 'office.weekly-report-line'])
|
|
170
172
|
expect(modeFrontCategories(writing, { page: 'my-weekly-report' })).toEqual(expect.arrayContaining(['data-read:office.my-weekly-report', 'data-entry:office.weekly-report-line']))
|
|
171
173
|
})
|
|
172
174
|
|
|
173
|
-
it('
|
|
175
|
+
it('not on another page, nor for a mode that does not read or enter them', () => {
|
|
174
176
|
expect(screenTargetKeys(writing, { page: 'cash-transaction-list' })).toEqual(['office.cash-transaction'])
|
|
175
177
|
expect(screenTargetKeys(mode, { page: 'my-weekly-report' })).toEqual([])
|
|
176
178
|
})
|
|
@@ -32,7 +32,7 @@ describe('message doors', () => {
|
|
|
32
32
|
expect(await passesRow(doors, doorGate(async () => true))).toBe(false)
|
|
33
33
|
})
|
|
34
34
|
|
|
35
|
-
it(
|
|
35
|
+
it("excludes openTools from data-read privileges when determining answer visibility", async () => {
|
|
36
36
|
const doorsOf = (name: string) => ({ readOfficeMyWeeklyReport: ['Query.myWeeklyReport'] } as any)[name]
|
|
37
37
|
const doors = doorsForAnswer([{ name: 'openTools', outcome: 'ok' }, { name: 'readOfficeMyWeeklyReport', outcome: 'ok' }], doorsOf)
|
|
38
38
|
|
|
@@ -40,7 +40,7 @@ describe('message doors', () => {
|
|
|
40
40
|
expect(await passesRow(doors, doorGate(async door => door === 'Query.myWeeklyReport'))).toBe(true)
|
|
41
41
|
})
|
|
42
42
|
|
|
43
|
-
it(
|
|
43
|
+
it("excludes rejected or failed tool calls from answer visibility requirements", () => {
|
|
44
44
|
const doorsOf = (name: string) =>
|
|
45
45
|
({ queryOrganizationEmployee: ['Query.employees'], readOfficeMyWeeklyReport: ['Query.myWeeklyReport'] } as any)[name]
|
|
46
46
|
|
|
@@ -56,7 +56,7 @@ describe('message doors', () => {
|
|
|
56
56
|
).toEqual(['Query.myWeeklyReport'])
|
|
57
57
|
})
|
|
58
58
|
|
|
59
|
-
it(
|
|
59
|
+
it("retains privileges for successful reads even when another call to the same tool fails", () => {
|
|
60
60
|
const doorsOf = () => ['Query.employees']
|
|
61
61
|
expect(
|
|
62
62
|
doorsForAnswer(
|
|
@@ -28,29 +28,24 @@ import { OPEN_TOOLS } from '@things-factory/ai-client-base'
|
|
|
28
28
|
/** 문 이름으로 보이지 않는 값 — 등록되지 않은 도구가 답에 끼었을 때. */
|
|
29
29
|
const UNRESOLVED = 'unresolved:'
|
|
30
30
|
|
|
31
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Tool name and completion status recorded by the agent loop for one answer.
|
|
33
|
+
*/
|
|
32
34
|
export interface AnswerToolUse {
|
|
33
35
|
name: string
|
|
34
36
|
outcome?: string
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* 운영: 직원 목록 조회가 거절된 답이 묻는 사람에게 가려짐).
|
|
40
|
+
* Rejected and failed calls contain no retrieved data. Exclude their privileges so the requesting user can
|
|
41
|
+
* still read the refusal or error.
|
|
41
42
|
*/
|
|
42
43
|
const READ_NOTHING = new Set(['rejected', 'error'])
|
|
43
44
|
|
|
44
45
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* 아래 규칙대로 두면 아무도 못 지나는 자리가 되어, 꺼내기를 쓴 답은 묻는 사람 본인까지 누구도 못
|
|
49
|
-
* 읽었다(2026-11-12 운영: 가려진 답 22건 중 19건).
|
|
50
|
-
*
|
|
51
|
-
* 등록기에 없는 도구가 값을 읽고 답에 끼면 그 도구가 무엇을 읽었는지 알 길이 없다. 그때 `[]`(누구나
|
|
52
|
-
* 읽는 답)로 적으면 모르는 값이 공개된다. 아무도 못 지나는 이름을 적어 **가려지는 쪽**으로 넘어뜨리고,
|
|
53
|
-
* 이름에 원인을 실어 둔다.
|
|
46
|
+
* Collect unique, sorted privileges from successful data-reading tools. openTools only exposes tool
|
|
47
|
+
* definitions and adds no data privilege. Unknown tools that returned data produce an ungrantable
|
|
48
|
+
* requirement so their output is hidden by default.
|
|
54
49
|
*/
|
|
55
50
|
export function doorsForAnswer(usages: readonly AnswerToolUse[], doorsOf: (name: string) => string[] | undefined): string[] {
|
|
56
51
|
const doors = new Set<string>()
|
|
@@ -45,7 +45,7 @@ describe('an invite outside a board', () => {
|
|
|
45
45
|
})
|
|
46
46
|
|
|
47
47
|
describe('sendInviteNotification — one kept notice', () => {
|
|
48
|
-
test('
|
|
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
50
|
await sendInviteNotification(notice => void sent.push(notice), ['u1', 'u2'], { name: 'Kim' }, 'pricing', 'board-7')
|
|
51
51
|
expect(sent).toHaveLength(1)
|
|
@@ -208,10 +208,9 @@ export interface DetailRead {
|
|
|
208
208
|
*/
|
|
209
209
|
axes?: string[]
|
|
210
210
|
/**
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
*/
|
|
211
|
+
* Application routes that prioritize this tool through ConversationCategory.frontPages. Single-record
|
|
212
|
+
* readers may have no list page of their own.
|
|
213
|
+
*/
|
|
215
214
|
frontPages?: string[]
|
|
216
215
|
/**
|
|
217
216
|
* The lists the answer holds, each a table of typed columns - what a dashboard card may draw from a one-answer read
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* a group with them in it. The model is told whose records answer and how such a conversation is held. Asking about
|
|
6
|
-
* oneself is an ordinary conversation.
|
|
2
|
+
* SQLite integration tests for person-anchored conversation creation and updates. Conversations about
|
|
3
|
+
* another person remain groups containing that person. Self-anchored conversations use ordinary visibility
|
|
4
|
+
* rules. Verify the model context includes record sources and person-conversation constraints.
|
|
7
5
|
*/
|
|
8
6
|
import type { DataSource } from 'typeorm'
|
|
9
7
|
|
|
@@ -72,12 +70,12 @@ describe('who a conversation is about', () => {
|
|
|
72
70
|
expect(personOfAnchor('subject', 'person:')).toBeUndefined()
|
|
73
71
|
})
|
|
74
72
|
|
|
75
|
-
it('
|
|
73
|
+
it('asking about someone seats them in a group; asking about oneself seats nobody', () => {
|
|
76
74
|
expect(personSeatOf('subject', 'person:u-1', { id: 'u-2' })).toEqual({ userId: 'u-1', visibility: 'group' })
|
|
77
75
|
expect(personSeatOf('subject', 'person:u-1', { id: 'u-1' })).toBeUndefined()
|
|
78
76
|
})
|
|
79
77
|
|
|
80
|
-
it('
|
|
78
|
+
it('it stays a group with them in it; a conversation about oneself is free', () => {
|
|
81
79
|
const room = { anchorType: 'subject', anchorId: 'person:u-1', creatorId: 'u-2' }
|
|
82
80
|
expect(personRoomRefusal(room, { visibility: 'private' })).toBe('person-room-group-only')
|
|
83
81
|
expect(personRoomRefusal(room, { visibility: 'open' })).toBe('person-room-group-only')
|
|
@@ -88,33 +86,33 @@ describe('who a conversation is about', () => {
|
|
|
88
86
|
})
|
|
89
87
|
})
|
|
90
88
|
|
|
91
|
-
describe(
|
|
92
|
-
it('
|
|
89
|
+
describe("conversation entry points", () => {
|
|
90
|
+
it('a conversation opened on someone is a group with them seated as a member', async () => {
|
|
93
91
|
const session = await doors.createAISession('subject', about(employee), undefined, as(manager))
|
|
94
92
|
expect(session.visibility).toBe('group')
|
|
95
93
|
expect(await seats(session)).toEqual([[employee.id, 'member'], [manager.id, 'owner']].sort())
|
|
96
94
|
})
|
|
97
95
|
|
|
98
|
-
it(
|
|
96
|
+
it("reuses the existing group for the same subject", async () => {
|
|
99
97
|
const session = await doors.startAISession('subject', about(colleague), as(manager))
|
|
100
98
|
expect(session.visibility).toBe('group')
|
|
101
99
|
expect(await seats(session)).toEqual([[colleague.id, 'member'], [manager.id, 'owner']].sort())
|
|
102
100
|
})
|
|
103
101
|
|
|
104
|
-
it('
|
|
102
|
+
it('a conversation about oneself is private and seats nobody else', async () => {
|
|
105
103
|
const session = await doors.createAISession('subject', about(employee), undefined, as(employee))
|
|
106
104
|
expect(session.visibility).toBe('private')
|
|
107
105
|
expect(await seats(session)).toEqual([[employee.id, 'owner']])
|
|
108
106
|
})
|
|
109
107
|
|
|
110
|
-
it('
|
|
108
|
+
it('it cannot be made private or open', async () => {
|
|
111
109
|
const session = await doors.createAISession('subject', about(employee), undefined, as(manager))
|
|
112
110
|
await expect(doors.setSessionVisibility(session.id, 'private', as(manager))).rejects.toThrow(/stays a group/)
|
|
113
111
|
await expect(doors.setSessionVisibility(session.id, 'open', as(manager))).rejects.toThrow(/stays a group/)
|
|
114
112
|
expect(await seats(session)).toContainEqual([employee.id, 'member'])
|
|
115
113
|
})
|
|
116
114
|
|
|
117
|
-
it('
|
|
115
|
+
it('the person is neither sent out nor leaves; someone else brought in can be', async () => {
|
|
118
116
|
const session = await doors.createAISession('subject', about(employee), undefined, as(manager))
|
|
119
117
|
await doors.inviteToAISession(session.id, [colleague.id], as(manager))
|
|
120
118
|
await expect(doors.removeFromAISession(session.id, employee.id, as(manager))).rejects.toThrow(/always reads it/)
|
|
@@ -123,7 +121,7 @@ describe('the doors', () => {
|
|
|
123
121
|
expect(await seats(session)).toContainEqual([employee.id, 'member'])
|
|
124
122
|
})
|
|
125
123
|
|
|
126
|
-
it('
|
|
124
|
+
it('the screen is told who stays, so it offers no button to send them out', async () => {
|
|
127
125
|
const session = await doors.createAISession('subject', about(employee), undefined, as(manager))
|
|
128
126
|
expect(await doors.keptInAISession(session.id, as(manager))).toBe(employee.id)
|
|
129
127
|
const own = await doors.createAISession('subject', about(manager), undefined, as(manager))
|
|
@@ -132,7 +130,7 @@ describe('the doors', () => {
|
|
|
132
130
|
expect(await doors.keptInAISession(general.id, as(manager))).toBeNull()
|
|
133
131
|
})
|
|
134
132
|
|
|
135
|
-
it('
|
|
133
|
+
it('what the person says to the room is told to the modules that wait for it, with who spoke', async () => {
|
|
136
134
|
const heard: any[] = []
|
|
137
135
|
const stop = onRoomTurn((turn: any) => {
|
|
138
136
|
heard.push([turn.user.id, turn.session.anchorId, turn.message.content])
|
|
@@ -145,8 +143,8 @@ describe('the doors', () => {
|
|
|
145
143
|
})
|
|
146
144
|
})
|
|
147
145
|
|
|
148
|
-
describe(
|
|
149
|
-
it('
|
|
146
|
+
describe("person-conversation model context", () => {
|
|
147
|
+
it('the person by name, with how a conversation about someone is held', async () => {
|
|
150
148
|
const line = await openSubjectLine({ anchorType: 'subject', anchorId: about(employee), domain, state: as(manager).state })
|
|
151
149
|
expect(line).toContain('"employee"')
|
|
152
150
|
expect(line).toContain(PERSON_GUIDANCE)
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
/*
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* when each was written; their character, intent, mood and ability are never guessed; nobody speaks as them; what
|
|
8
|
-
* binds them goes to them as a to-do (`guidance`).
|
|
9
|
-
* · the person sits in it. A conversation about someone is a group the person always reads - nothing is asked of
|
|
10
|
-
* their records out of their sight (`personSeatOf`, the doors that open a conversation).
|
|
11
|
-
* · it stays a group with them in it - neither open to the whole domain nor private, and they are not sent out
|
|
12
|
-
* (`personRoomRefusal`).
|
|
13
|
-
*
|
|
14
|
-
* Asking about oneself is an ordinary conversation: nobody else is seated and the rules about speaking for someone do
|
|
15
|
-
* not apply.
|
|
2
|
+
* Centralize rules for sessions anchored to subject / person:<user id> (ADR-0200). Identify the person in
|
|
3
|
+
* model context and require record sources and timestamps; do not infer personality, intent, mood or
|
|
4
|
+
* ability, or speak on their behalf. Add the subject as a participant and preserve group visibility and
|
|
5
|
+
* membership. Requests requiring their decision become assigned tasks. Self-anchored sessions use ordinary
|
|
6
|
+
* conversation rules.
|
|
16
7
|
*/
|
|
17
8
|
import { User } from '@things-factory/auth-base'
|
|
18
9
|
import { entersDomainAsAssignee } from '@things-factory/auth-base/dist-server/utils/get-domain-users.js'
|
|
@@ -24,7 +15,9 @@ import { entryToolName } from '../data-entry/entry-target.js'
|
|
|
24
15
|
/** The 360 kind of a person - auth-ui's `person`. */
|
|
25
16
|
export const PERSON_AXIS = 'person'
|
|
26
17
|
|
|
27
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Response-request card registered by worklist to create an assigned task (ADR-0200).
|
|
20
|
+
*/
|
|
28
21
|
export const PERSON_QUESTION_KEY = 'worklist.person-question'
|
|
29
22
|
|
|
30
23
|
/** The person a conversation is about, by its anchor - `undefined` when it is about no one. */
|
|
@@ -34,15 +27,17 @@ export function personOfAnchor(anchorType: string | null | undefined, anchorId:
|
|
|
34
27
|
}
|
|
35
28
|
|
|
36
29
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
30
|
+
* Add the subject user to a new group conversation unless the creator is the subject. Private sessions have
|
|
31
|
+
* no additional participants; public sessions are domain-readable.
|
|
39
32
|
*/
|
|
40
33
|
export function personSeatOf(anchorType: string | null | undefined, anchorId: string | null | undefined, starter: { id?: string } | null | undefined): { userId: string; visibility: 'group' } | undefined {
|
|
41
34
|
const userId = personOfAnchor(anchorType, anchorId)
|
|
42
35
|
return userId && userId !== starter?.id ? { userId, visibility: 'group' } : undefined
|
|
43
36
|
}
|
|
44
37
|
|
|
45
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* Return the reason a person-conversation update is invalid, or no reason when allowed.
|
|
40
|
+
*/
|
|
46
41
|
export function personRoomRefusal(
|
|
47
42
|
session: { anchorType?: string | null; anchorId?: string | null; creatorId?: string | null },
|
|
48
43
|
change: { visibility?: string; removing?: string }
|
|
@@ -61,7 +56,7 @@ export const PERSON_ROOM_REFUSALS: Record<string, string> = {
|
|
|
61
56
|
}
|
|
62
57
|
|
|
63
58
|
/**
|
|
64
|
-
*
|
|
59
|
+
* Model guidance appended after the subject name on each conversation turn.
|
|
65
60
|
*/
|
|
66
61
|
export const PERSON_GUIDANCE = [
|
|
67
62
|
'This conversation is about that person, and they read it. Rules:',
|