forked from EduCraft/curriculum-project-hub
fix(hub): stamp CheckMark/CrossMark when agent run finishes (v0.0.41) (#21)
This commit is contained in:
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@paradigm/hub",
|
||||
"version": "0.0.40",
|
||||
"version": "0.0.41",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@paradigm/hub",
|
||||
"version": "0.0.40",
|
||||
"version": "0.0.41",
|
||||
"dependencies": {
|
||||
"@alicloud/credentials": "^2.4.5",
|
||||
"@alicloud/docmind-api20220711": "^1.4.15",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@paradigm/hub",
|
||||
"version": "0.0.40",
|
||||
"version": "0.0.41",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"engines": {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
* Sends a "processing" reaction immediately, then streams a single
|
||||
* interactive card through the full agent run lifecycle: thinking → tool
|
||||
* calls (with trace panel) → streaming answer text → final card. The card
|
||||
* calls (with trace panel) → streaming answer text → final card. On finish,
|
||||
* replaces Typing with CheckMark (success) or CrossMark (failure). The card
|
||||
* shows a collapsible tool-use panel, a collapsible reasoning panel, and
|
||||
* the markdown answer text. Throttled to ~2.5 patches/sec to avoid
|
||||
* spamming the Feishu API.
|
||||
@@ -680,7 +681,16 @@ export function makeTriggerHandler(deps: TriggerDeps): TriggerHandler {
|
||||
initializedSkills: [...(result.initializedSkillIds ?? [])],
|
||||
},
|
||||
});
|
||||
await removeProcessingReaction();
|
||||
// Mirror the start "Typing" reaction: drop processing, then stamp a
|
||||
// terminal emoji so teachers see done/failed without reading the card.
|
||||
const removedProcessingReaction = await removeProcessingReaction();
|
||||
if (removedProcessingReaction) {
|
||||
await addReaction(
|
||||
rt,
|
||||
msg.message_id,
|
||||
outcome.isError ? "CrossMark" : "CheckMark",
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch(async (e) => {
|
||||
const removedProcessingReaction = await removeProcessingReaction();
|
||||
|
||||
@@ -52,7 +52,7 @@ describe("Feishu reactions", () => {
|
||||
await expect(removeReaction(rt, "message-1", "reaction-1")).resolves.toBe(false);
|
||||
});
|
||||
|
||||
it("adds Typing on start and removes it on success", async () => {
|
||||
it("adds Typing on start and replaces it with CheckMark on success", async () => {
|
||||
const run = deferred<RunResult>();
|
||||
const rt = mockRuntime();
|
||||
const runAgent = vi.fn((req: RunRequest) => {
|
||||
@@ -71,6 +71,7 @@ describe("Feishu reactions", () => {
|
||||
expect(rt.reactionRequests).toEqual([
|
||||
{ kind: "add", messageId: "message-1", emoji: "Typing", reactionId: "reaction-1" },
|
||||
{ kind: "remove", messageId: "message-1", reactionId: "reaction-1" },
|
||||
{ kind: "add", messageId: "message-1", emoji: "CheckMark", reactionId: "reaction-2" },
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user