@ian2018cs/agenthub 0.2.2 → 0.2.4
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.html
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
<!-- Prevent zoom on iOS -->
|
|
27
27
|
<meta name="format-detection" content="telephone=no" />
|
|
28
|
-
<script type="module" crossorigin src="/assets/index-
|
|
28
|
+
<script type="module" crossorigin src="/assets/index-CqQO7fqd.js"></script>
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-C_uEg43g.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/assets/vendor-codemirror-B2saKA4-.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/assets/vendor-utils-00TdZexr.js">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ian2018cs/agenthub",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "A web-based UI for AI Agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "server/index.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@anthropic-ai/claude-agent-sdk": "^0.2.
|
|
54
|
+
"@anthropic-ai/claude-agent-sdk": "^0.2.86",
|
|
55
55
|
"@codemirror/lang-css": "^6.3.1",
|
|
56
56
|
"@codemirror/lang-html": "^6.4.9",
|
|
57
57
|
"@codemirror/lang-javascript": "^6.2.4",
|
package/server/claude-sdk.js
CHANGED
|
@@ -800,13 +800,29 @@ async function queryClaudeSDK(command, options = {}, ws) {
|
|
|
800
800
|
|
|
801
801
|
// Extract and send token budget updates from result messages
|
|
802
802
|
if (message.type === 'result') {
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
803
|
+
// Use getContextUsage() for accurate SDK-reported context window data
|
|
804
|
+
try {
|
|
805
|
+
const contextUsage = await queryInstance.getContextUsage();
|
|
806
|
+
if (contextUsage && contextUsage.maxTokens > 0) {
|
|
807
|
+
mutableWriter.send({
|
|
808
|
+
type: 'token-budget',
|
|
809
|
+
data: {
|
|
810
|
+
used: contextUsage.totalTokens,
|
|
811
|
+
total: contextUsage.maxTokens,
|
|
812
|
+
percentage: contextUsage.percentage,
|
|
813
|
+
categories: contextUsage.categories
|
|
814
|
+
}
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
} catch (contextErr) {
|
|
818
|
+
// Fallback to modelUsage if getContextUsage() fails
|
|
819
|
+
const tokenBudget = extractTokenBudget(message);
|
|
820
|
+
if (tokenBudget) {
|
|
821
|
+
mutableWriter.send({
|
|
822
|
+
type: 'token-budget',
|
|
823
|
+
data: tokenBudget
|
|
824
|
+
});
|
|
825
|
+
}
|
|
810
826
|
}
|
|
811
827
|
|
|
812
828
|
// Record usage to database for admin statistics
|
|
@@ -46,9 +46,11 @@ export class LarkClient {
|
|
|
46
46
|
async start() {
|
|
47
47
|
// 获取机器人自身 open_id,用于群聊 @ 检测
|
|
48
48
|
try {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
const resp = await this.client.request({
|
|
50
|
+
method: 'GET',
|
|
51
|
+
url: '/open-apis/bot/v3/info',
|
|
52
|
+
});
|
|
53
|
+
this.botOpenId = resp.bot?.open_id || null;
|
|
52
54
|
} catch (err) {
|
|
53
55
|
console.error('[Feishu] Failed to get bot info:', err.message);
|
|
54
56
|
}
|