@lightupai/polaris 0.0.13 → 0.0.14
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/package.json +1 -1
- package/src/slack/format.ts +4 -4
- package/tests/format.test.ts +2 -1
package/package.json
CHANGED
package/src/slack/format.ts
CHANGED
|
@@ -39,7 +39,7 @@ export function formatEventForSlack(event: PolarisEvent): SlackMessage | null {
|
|
|
39
39
|
case "Stop": {
|
|
40
40
|
const response = payload.stop_response || payload.last_assistant_message;
|
|
41
41
|
if (!response) return null;
|
|
42
|
-
return formatAgentResponse(event.session, response);
|
|
42
|
+
return formatAgentResponse(event.sender, event.session, response);
|
|
43
43
|
}
|
|
44
44
|
case "PreToolUse":
|
|
45
45
|
case "PostToolUse":
|
|
@@ -83,13 +83,13 @@ function formatUserPrompt(sender: string, session: string, prompt: string): Slac
|
|
|
83
83
|
|
|
84
84
|
// --- Agent response ---
|
|
85
85
|
|
|
86
|
-
function formatAgentResponse(session: string, response: string): SlackMessage | null {
|
|
86
|
+
function formatAgentResponse(sender: string, session: string, response: string): SlackMessage | null {
|
|
87
87
|
if (!response) return null;
|
|
88
88
|
return {
|
|
89
89
|
text: toMrkdwn(response),
|
|
90
90
|
blocks: [{ type: "section", text: { type: "mrkdwn", text: toMrkdwn(response) } }],
|
|
91
|
-
username:
|
|
92
|
-
icon_emoji:
|
|
91
|
+
username: `${displayName(sender)} (${session})`,
|
|
92
|
+
icon_emoji: personaIcon(sender),
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
|
package/tests/format.test.ts
CHANGED
|
@@ -31,10 +31,11 @@ describe("formatEventForSlack", () => {
|
|
|
31
31
|
|
|
32
32
|
test("agent response: robot persona with session", () => {
|
|
33
33
|
const result = formatEventForSlack(makeEvent({
|
|
34
|
+
sender: "agent:claude",
|
|
34
35
|
payload: { hook_event_name: "Stop", session_id: "s1", stop_response: "Created auth.ts" },
|
|
35
36
|
}));
|
|
36
37
|
expect(result).not.toBeNull();
|
|
37
|
-
expect(result!.username).toBe("Agent (fxm)");
|
|
38
|
+
expect(result!.username).toBe("Agent: Claude (fxm)");
|
|
38
39
|
expect(result!.icon_emoji).toBe(":robot_face:");
|
|
39
40
|
expect(result!.text).toContain("Created auth.ts");
|
|
40
41
|
});
|