@blade-hq/agent-kit 1.0.20 → 1.0.22
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/{SkillStatusBar-DskumalP.d.ts → SkillStatusBar-DluiBsVj.d.ts} +1 -1
- package/dist/{blade-client-KZiBuBHI.d.ts → blade-client-CseN7OW9.d.ts} +69 -1
- package/dist/{chunk-MKZ4VTJ2.js → chunk-2QYV43YP.js} +2 -2
- package/dist/{chunk-V74REX3Q.js → chunk-7F6UP5LP.js} +250 -2
- package/dist/chunk-7F6UP5LP.js.map +1 -0
- package/dist/{chunk-ZKOSOL3V.js → chunk-BQKF6HJH.js} +10 -6
- package/dist/chunk-BQKF6HJH.js.map +1 -0
- package/dist/{chunk-JWWU2GWP.js → chunk-ICV7OTGX.js} +127 -26
- package/dist/{chunk-JWWU2GWP.js.map → chunk-ICV7OTGX.js.map} +1 -1
- package/dist/{chunk-TLB4ORQT.js → chunk-IMMRWXI7.js} +67 -3
- package/dist/chunk-IMMRWXI7.js.map +1 -0
- package/dist/{chunk-ADVQBVGQ.js → chunk-TYM7KL2L.js} +2 -2
- package/dist/client/index.d.ts +172 -1
- package/dist/client/index.js +3 -1
- package/dist/react/api/vibe-coding.d.ts +2 -2
- package/dist/react/api/vibe-coding.js +2 -2
- package/dist/react/components/chat/index.d.ts +3 -3
- package/dist/react/components/chat/index.js +5 -5
- package/dist/react/components/plan/index.js +4 -4
- package/dist/react/components/session/index.js +3 -3
- package/dist/react/components/workspace/index.d.ts +2 -2
- package/dist/react/components/workspace/index.js +31 -3
- package/dist/react/components/workspace/index.js.map +1 -1
- package/dist/react/index.d.ts +14 -6
- package/dist/react/index.js +6 -6
- package/dist/{sessions-BX8qHBN3.d.ts → sessions-DI9DVun7.d.ts} +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/chunk-TLB4ORQT.js.map +0 -1
- package/dist/chunk-V74REX3Q.js.map +0 -1
- package/dist/chunk-ZKOSOL3V.js.map +0 -1
- /package/dist/{chunk-MKZ4VTJ2.js.map → chunk-2QYV43YP.js.map} +0 -0
- /package/dist/{chunk-ADVQBVGQ.js.map → chunk-TYM7KL2L.js.map} +0 -0
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-J3XVFPOV.js";
|
|
4
4
|
import {
|
|
5
5
|
BladeClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7F6UP5LP.js";
|
|
7
7
|
import {
|
|
8
8
|
createClientActions,
|
|
9
9
|
useCardStateStore
|
|
@@ -636,9 +636,44 @@ function applyToolResult(state, toolCallId, result, status, durationMs, sourceLo
|
|
|
636
636
|
displayName = tc.display_name;
|
|
637
637
|
break;
|
|
638
638
|
}
|
|
639
|
+
upsertToolResultBlock(state, toolCallId, finalResult, toolName, displayName);
|
|
640
|
+
}
|
|
641
|
+
function appendToolResultDelta(state, toolCallId, delta) {
|
|
642
|
+
if (!toolCallId || !delta) return;
|
|
643
|
+
let toolName = "";
|
|
644
|
+
let displayName = "";
|
|
645
|
+
let currentResult = "";
|
|
646
|
+
for (let i = 0; i < state.toolCalls.length; i++) {
|
|
647
|
+
const tc = state.toolCalls[i];
|
|
648
|
+
if (tc.id !== toolCallId) continue;
|
|
649
|
+
toolName = tc.tool_name;
|
|
650
|
+
displayName = tc.display_name;
|
|
651
|
+
if (typeof tc.result === "string") currentResult = tc.result;
|
|
652
|
+
state.toolCalls[i] = { ...tc, result: currentResult + delta };
|
|
653
|
+
break;
|
|
654
|
+
}
|
|
655
|
+
for (const block of state.blocks) {
|
|
656
|
+
if (block.type !== "tool_result" || block.tool_call_id !== toolCallId) continue;
|
|
657
|
+
if (typeof block.content === "string") currentResult = block.content;
|
|
658
|
+
break;
|
|
659
|
+
}
|
|
660
|
+
upsertToolResultBlock(state, toolCallId, currentResult + delta, toolName, displayName);
|
|
661
|
+
}
|
|
662
|
+
function upsertToolResultBlock(state, toolCallId, content, toolName, displayName) {
|
|
663
|
+
for (let i = 0; i < state.blocks.length; i++) {
|
|
664
|
+
const block = state.blocks[i];
|
|
665
|
+
if (block.type !== "tool_result" || block.tool_call_id !== toolCallId) continue;
|
|
666
|
+
state.blocks[i] = {
|
|
667
|
+
...block,
|
|
668
|
+
content,
|
|
669
|
+
tool_name: toolName || block.tool_name,
|
|
670
|
+
display_name: displayName || block.display_name
|
|
671
|
+
};
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
639
674
|
state.blocks.push({
|
|
640
675
|
type: "tool_result",
|
|
641
|
-
content
|
|
676
|
+
content,
|
|
642
677
|
tool_call_id: toolCallId,
|
|
643
678
|
tool_name: toolName || null,
|
|
644
679
|
display_name: displayName || null
|
|
@@ -1099,6 +1134,8 @@ var ClientProjectionBuilder = class {
|
|
|
1099
1134
|
return this.onToolCallCreated(state, payload);
|
|
1100
1135
|
case "llm:response:done":
|
|
1101
1136
|
return this.onResponseDone(state, loopId, payload);
|
|
1137
|
+
case "tool:result:delta":
|
|
1138
|
+
return this.onToolResultDelta(state, payload);
|
|
1102
1139
|
case "tool:result:done":
|
|
1103
1140
|
return this.onToolResultDone(state, loopId, payload);
|
|
1104
1141
|
case "loop:tool_ui":
|
|
@@ -1365,6 +1402,14 @@ var ClientProjectionBuilder = class {
|
|
|
1365
1402
|
}
|
|
1366
1403
|
return this.syncPatch(state);
|
|
1367
1404
|
}
|
|
1405
|
+
onToolResultDelta(state, payload) {
|
|
1406
|
+
appendToolResultDelta(
|
|
1407
|
+
state,
|
|
1408
|
+
String(payload.tool_call_id ?? ""),
|
|
1409
|
+
String(payload.content ?? "")
|
|
1410
|
+
);
|
|
1411
|
+
return this.syncPatch(state);
|
|
1412
|
+
}
|
|
1368
1413
|
onToolUi(state, payload) {
|
|
1369
1414
|
const toolCallId = String(payload.tool_call_id ?? "");
|
|
1370
1415
|
const ui = payload.ui;
|
|
@@ -1878,6 +1923,10 @@ function getToolDisplayLabel(toolCall) {
|
|
|
1878
1923
|
if (normalized === "BgBash") {
|
|
1879
1924
|
return description ? `\u540E\u53F0\u6267\u884C\uFF1A${description}` : "\u540E\u53F0\u6267\u884C\u547D\u4EE4";
|
|
1880
1925
|
}
|
|
1926
|
+
if (normalized === "ReadSkill") {
|
|
1927
|
+
const skillName = getStringArgValue(args, "skill") || getStringArgValue(args, "skill_name");
|
|
1928
|
+
return skillName ? `${baseLabel}\u300C${skillName}\u300D` : baseLabel;
|
|
1929
|
+
}
|
|
1881
1930
|
if (normalized === "FinishTask") {
|
|
1882
1931
|
const title = args && typeof args.title === "string" ? args.title : "";
|
|
1883
1932
|
return title ? `${baseLabel}\uFF1A${title}` : baseLabel;
|
|
@@ -3456,6 +3505,7 @@ var AgentSocket = class {
|
|
|
3456
3505
|
pendingJoins = /* @__PURE__ */ new Map();
|
|
3457
3506
|
recentChatEndAt = /* @__PURE__ */ new Map();
|
|
3458
3507
|
boardProjectRefCounts = /* @__PURE__ */ new Map();
|
|
3508
|
+
frontendTelemetryCounter = 0;
|
|
3459
3509
|
patchFlushHandle = null;
|
|
3460
3510
|
patchFlushCancel = null;
|
|
3461
3511
|
projectionBuilder = new ClientProjectionBuilder();
|
|
@@ -3472,6 +3522,16 @@ var AgentSocket = class {
|
|
|
3472
3522
|
_resolveSessionId(data) {
|
|
3473
3523
|
return data?.session_id ?? this.subscribedSession;
|
|
3474
3524
|
}
|
|
3525
|
+
_reportFrontendTelemetry(event, latencyMs) {
|
|
3526
|
+
this.frontendTelemetryCounter += 1;
|
|
3527
|
+
if (latencyMs < 16 && this.frontendTelemetryCounter % 20 !== 0) {
|
|
3528
|
+
return;
|
|
3529
|
+
}
|
|
3530
|
+
void this.client.json("POST", "/api/observability/frontend", {
|
|
3531
|
+
event,
|
|
3532
|
+
latency_ms: latencyMs
|
|
3533
|
+
}).catch(() => void 0);
|
|
3534
|
+
}
|
|
3475
3535
|
_queueTurnPatch(sessionId, patch) {
|
|
3476
3536
|
let sessionPatches = this.pendingTurnPatches.get(sessionId);
|
|
3477
3537
|
if (!sessionPatches) {
|
|
@@ -3510,6 +3570,7 @@ var AgentSocket = class {
|
|
|
3510
3570
|
}
|
|
3511
3571
|
for (const [targetSessionId, patchesByTurn] of sessions) {
|
|
3512
3572
|
const patches = [...patchesByTurn.values()].sort((left, right) => left.sequence - right.sequence);
|
|
3573
|
+
const startedAt = performance.now();
|
|
3513
3574
|
for (const patch of patches) {
|
|
3514
3575
|
useChatStore.getState().applyTurnPatch(targetSessionId, patch);
|
|
3515
3576
|
const turn = patch.data.turn;
|
|
@@ -3520,6 +3581,7 @@ var AgentSocket = class {
|
|
|
3520
3581
|
}
|
|
3521
3582
|
this._applyProjectionSideEffects(targetSessionId, turn);
|
|
3522
3583
|
}
|
|
3584
|
+
this._reportFrontendTelemetry("turn_patch_apply", performance.now() - startedAt);
|
|
3523
3585
|
}
|
|
3524
3586
|
if (this.pendingTurnPatches.size === 0 && this.patchFlushCancel) {
|
|
3525
3587
|
this.patchFlushCancel();
|
|
@@ -3579,6 +3641,7 @@ var AgentSocket = class {
|
|
|
3579
3641
|
Math.max(...existingTurns.map((t) => t.sequence))
|
|
3580
3642
|
);
|
|
3581
3643
|
}
|
|
3644
|
+
const applyStartedAt = performance.now();
|
|
3582
3645
|
const updates = this.projectionBuilder.processBatch(data.events);
|
|
3583
3646
|
for (const update of updates) {
|
|
3584
3647
|
if (update.kind === "upsert") {
|
|
@@ -3592,6 +3655,7 @@ var AgentSocket = class {
|
|
|
3592
3655
|
notifyWorkspaceFilesChanged(sessionId);
|
|
3593
3656
|
}
|
|
3594
3657
|
}
|
|
3658
|
+
this._reportFrontendTelemetry("turn_events_apply", performance.now() - applyStartedAt);
|
|
3595
3659
|
if (terminalChatEndStatus) {
|
|
3596
3660
|
useSessionStore.getState().updateSessionStatus(sessionId, sessionStatusFromChatEnd(terminalChatEndStatus));
|
|
3597
3661
|
if (terminalChatEndStatus === "interrupted") {
|
|
@@ -4535,4 +4599,4 @@ export {
|
|
|
4535
4599
|
bootstrapBladeClient,
|
|
4536
4600
|
getBootstrappedClient
|
|
4537
4601
|
};
|
|
4538
|
-
//# sourceMappingURL=chunk-
|
|
4602
|
+
//# sourceMappingURL=chunk-IMMRWXI7.js.map
|