opencode-avatar 0.3.16 → 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 +12 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13042,14 +13042,22 @@ 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;
|
|
13052
|
-
const sessionId = output.sessionID || currentAgentName || "unknown";
|
|
13060
|
+
const sessionId = input.sessionID || output.sessionID || currentAgentName || "unknown-session";
|
|
13053
13061
|
const trackingName = currentAgentName || sessionId;
|
|
13054
13062
|
updateToolUsage(client, trackingName, sessionId, "thinking").catch((err) => {
|
|
13055
13063
|
console.error(`[Avatar] Failed to update thinking state:`, err);
|
|
@@ -13061,7 +13069,7 @@ var AvatarPlugin = async ({ client }) => {
|
|
|
13061
13069
|
},
|
|
13062
13070
|
"tool.execute.before": async (input) => {
|
|
13063
13071
|
const toolName = input.tool;
|
|
13064
|
-
const sessionId = input.sessionID || currentAgentName || "unknown";
|
|
13072
|
+
const sessionId = input.sessionID || input.sessionId || currentAgentName || "unknown-session";
|
|
13065
13073
|
const trackingName = currentAgentName || sessionId;
|
|
13066
13074
|
updateToolUsage(client, trackingName, sessionId, toolName).catch((err) => {
|
|
13067
13075
|
console.error(`[Avatar] Failed to update tool usage:`, err);
|
|
@@ -13094,7 +13102,7 @@ var AvatarPlugin = async ({ client }) => {
|
|
|
13094
13102
|
isThinking = false;
|
|
13095
13103
|
isToolActive = false;
|
|
13096
13104
|
currentRequestId = null;
|
|
13097
|
-
const sessionId = event.sessionID || currentAgentName || "unknown";
|
|
13105
|
+
const sessionId = event.sessionID || event.sessionId || currentAgentName || "unknown-session";
|
|
13098
13106
|
const trackingName = currentAgentName || sessionId;
|
|
13099
13107
|
updateToolUsage(client, trackingName, sessionId, "idle").catch((err) => {
|
|
13100
13108
|
console.error(`[Avatar] Failed to update idle state:`, err);
|
|
@@ -13104,17 +13112,6 @@ var AvatarPlugin = async ({ client }) => {
|
|
|
13104
13112
|
},
|
|
13105
13113
|
"session.end": async (_input) => {}
|
|
13106
13114
|
};
|
|
13107
|
-
return {
|
|
13108
|
-
tool: {
|
|
13109
|
-
register_avatar_name: registerAvatarNameTool
|
|
13110
|
-
},
|
|
13111
|
-
config: async (input) => {
|
|
13112
|
-
input.experimental ??= {};
|
|
13113
|
-
input.experimental.primary_tools ??= [];
|
|
13114
|
-
input.experimental.primary_tools.push("register_avatar_name");
|
|
13115
|
-
},
|
|
13116
|
-
hooks
|
|
13117
|
-
};
|
|
13118
13115
|
};
|
|
13119
13116
|
export {
|
|
13120
13117
|
AvatarPlugin
|