opencode-avatar 0.3.15 → 0.3.17
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/dist/index.js +20 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13042,13 +13042,26 @@ var AvatarPlugin = async ({ client }) => {
|
|
|
13042
13042
|
}
|
|
13043
13043
|
}
|
|
13044
13044
|
});
|
|
13045
|
-
|
|
13045
|
+
return {
|
|
13046
|
+
tool: {
|
|
13047
|
+
register_avatar_name: registerAvatarNameTool
|
|
13048
|
+
},
|
|
13049
|
+
config: async (input) => {
|
|
13050
|
+
input.experimental ??= {};
|
|
13051
|
+
input.experimental.primary_tools ??= [];
|
|
13052
|
+
input.experimental.primary_tools.push("register_avatar_name");
|
|
13053
|
+
},
|
|
13046
13054
|
"chat.message": async (input, output) => {
|
|
13047
13055
|
const userMessage = output.parts.find((part) => part.type === "text" && part.messageID === input.messageID);
|
|
13048
13056
|
if (userMessage?.text) {}
|
|
13049
13057
|
if (userMessage?.text && !isThinking) {
|
|
13050
13058
|
idleTriggered = false;
|
|
13051
13059
|
isThinking = true;
|
|
13060
|
+
const sessionId = input.sessionID || output.sessionID || currentAgentName || "unknown-session";
|
|
13061
|
+
const trackingName = currentAgentName || sessionId;
|
|
13062
|
+
updateToolUsage(client, trackingName, sessionId, "thinking").catch((err) => {
|
|
13063
|
+
console.error(`[Avatar] Failed to update thinking state:`, err);
|
|
13064
|
+
});
|
|
13052
13065
|
requestAvatarGeneration(THINKING_PROMPT, false).catch(() => {
|
|
13053
13066
|
isThinking = false;
|
|
13054
13067
|
});
|
|
@@ -13056,7 +13069,7 @@ var AvatarPlugin = async ({ client }) => {
|
|
|
13056
13069
|
},
|
|
13057
13070
|
"tool.execute.before": async (input) => {
|
|
13058
13071
|
const toolName = input.tool;
|
|
13059
|
-
const sessionId = input.sessionID || currentAgentName || "unknown";
|
|
13072
|
+
const sessionId = input.sessionID || input.sessionId || currentAgentName || "unknown-session";
|
|
13060
13073
|
const trackingName = currentAgentName || sessionId;
|
|
13061
13074
|
updateToolUsage(client, trackingName, sessionId, toolName).catch((err) => {
|
|
13062
13075
|
console.error(`[Avatar] Failed to update tool usage:`, err);
|
|
@@ -13089,22 +13102,16 @@ var AvatarPlugin = async ({ client }) => {
|
|
|
13089
13102
|
isThinking = false;
|
|
13090
13103
|
isToolActive = false;
|
|
13091
13104
|
currentRequestId = null;
|
|
13105
|
+
const sessionId = event.sessionID || event.sessionId || currentAgentName || "unknown-session";
|
|
13106
|
+
const trackingName = currentAgentName || sessionId;
|
|
13107
|
+
updateToolUsage(client, trackingName, sessionId, "idle").catch((err) => {
|
|
13108
|
+
console.error(`[Avatar] Failed to update idle state:`, err);
|
|
13109
|
+
});
|
|
13092
13110
|
await setAvatarViaHttp(undefined, undefined, true);
|
|
13093
13111
|
}
|
|
13094
13112
|
},
|
|
13095
13113
|
"session.end": async (_input) => {}
|
|
13096
13114
|
};
|
|
13097
|
-
return {
|
|
13098
|
-
tool: {
|
|
13099
|
-
register_avatar_name: registerAvatarNameTool
|
|
13100
|
-
},
|
|
13101
|
-
config: async (input) => {
|
|
13102
|
-
input.experimental ??= {};
|
|
13103
|
-
input.experimental.primary_tools ??= [];
|
|
13104
|
-
input.experimental.primary_tools.push("register_avatar_name");
|
|
13105
|
-
},
|
|
13106
|
-
hooks
|
|
13107
|
-
};
|
|
13108
13115
|
};
|
|
13109
13116
|
export {
|
|
13110
13117
|
AvatarPlugin
|