























@@ -125,54 +125,56 @@ describe("buildChannelTurnContext", () => {
125125},
126126});
127127128-expect(ctx).toEqual(
129-expect.objectContaining({
130-Body: "[User One] hello",
131-BodyForAgent: "hello",
132-RawBody: "hello",
133-CommandBody: "/status",
134-BodyForCommands: "/status",
135-From: "test:user:u1",
136-To: "test:room:room-1",
137-SessionKey: "agent:main:test:group:room-1",
138-AccountId: "acct",
139-ParentSessionKey: "agent:main:test:group",
140-ModelParentSessionKey: "agent:main:test:model",
141-MessageSid: "msg-1",
142-ReplyToId: "root-1",
143-ReplyToBody: "quoted",
144-ReplyToSender: "Quoted User",
145-MediaPath: "/tmp/image.png",
146-MediaUrl: "/tmp/image.png",
147-MediaType: "image/png",
148-MediaPaths: ["/tmp/image.png"],
149-MediaUrls: ["/tmp/image.png", "https://example.test/audio.mp3"],
150-MediaTypes: ["image/png", "audio/mpeg"],
151-MediaTranscribedIndexes: [1],
152-ChatType: "group",
153-ConversationLabel: "Room One",
154-GroupSubject: "Room One",
155-GroupSpace: "workspace",
156-GroupSystemPrompt: "group prompt",
157-SenderName: "User One",
158-SenderId: "u1",
159-SenderUsername: "userone",
160-SenderTag: "User#0001",
161-MemberRoleIds: ["admin"],
162-Timestamp: 123,
163-Provider: "test-provider",
164-Surface: "test-surface",
165-WasMentioned: true,
166-CommandAuthorized: true,
167-MessageThreadId: "thread-1",
168-NativeChannelId: "native-room-1",
169-OriginatingChannel: "test",
170-OriginatingTo: "test:room:room-1",
171-ThreadStarterBody: "thread starter",
172-ThreadHistoryBody: "thread history",
173-ThreadLabel: "thread label",
174-}),
175-);
128+const expectedFields = {
129+Body: "[User One] hello",
130+BodyForAgent: "hello",
131+RawBody: "hello",
132+CommandBody: "/status",
133+BodyForCommands: "/status",
134+From: "test:user:u1",
135+To: "test:room:room-1",
136+SessionKey: "agent:main:test:group:room-1",
137+AccountId: "acct",
138+ParentSessionKey: "agent:main:test:group",
139+ModelParentSessionKey: "agent:main:test:model",
140+MessageSid: "msg-1",
141+ReplyToId: "root-1",
142+ReplyToBody: "quoted",
143+ReplyToSender: "Quoted User",
144+MediaPath: "/tmp/image.png",
145+MediaUrl: "/tmp/image.png",
146+MediaType: "image/png",
147+MediaPaths: ["/tmp/image.png"],
148+MediaUrls: ["/tmp/image.png", "https://example.test/audio.mp3"],
149+MediaTypes: ["image/png", "audio/mpeg"],
150+MediaTranscribedIndexes: [1],
151+ChatType: "group",
152+ConversationLabel: "Room One",
153+GroupSubject: "Room One",
154+GroupSpace: "workspace",
155+GroupSystemPrompt: "group prompt",
156+SenderName: "User One",
157+SenderId: "u1",
158+SenderUsername: "userone",
159+SenderTag: "User#0001",
160+MemberRoleIds: ["admin"],
161+Timestamp: 123,
162+Provider: "test-provider",
163+Surface: "test-surface",
164+WasMentioned: true,
165+CommandAuthorized: true,
166+MessageThreadId: "thread-1",
167+NativeChannelId: "native-room-1",
168+OriginatingChannel: "test",
169+OriginatingTo: "test:room:room-1",
170+ThreadStarterBody: "thread starter",
171+ThreadHistoryBody: "thread history",
172+ThreadLabel: "thread label",
173+} as const;
174+175+for (const [key, value] of Object.entries(expectedFields)) {
176+expect(ctx[key as keyof typeof ctx]).toEqual(value);
177+}
176178});
177179178180it("filters supplemental context with channel visibility policy", () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。