devez-vibe 1.9.16 → 1.9.18
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/bin/dvz.exe +0 -0
- package/bridge/claude-agent-sdk-bridge.mjs +49 -8
- package/package.json +1 -1
package/bin/dvz.exe
CHANGED
|
Binary file
|
|
@@ -1384,6 +1384,7 @@ async function createSession(params, resumeId) {
|
|
|
1384
1384
|
subagentPulse: null,
|
|
1385
1385
|
lastContextUsage: null,
|
|
1386
1386
|
lastContextWindow: 0,
|
|
1387
|
+
contextWindowModel: "",
|
|
1387
1388
|
};
|
|
1388
1389
|
await ensureClaudeExecutableChoice(params);
|
|
1389
1390
|
const agentQuery = await startAgentQuery(queue, makeOptions(params, id, resumeId));
|
|
@@ -1649,11 +1650,19 @@ function processAssistant(session, message) {
|
|
|
1649
1650
|
session.models,
|
|
1650
1651
|
message.message?.model || session.model,
|
|
1651
1652
|
);
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1653
|
+
// The turn's result reports the window the run actually had, and it can differ
|
|
1654
|
+
// from the size guessed from the model name — a 1M tier reads as 200k here.
|
|
1655
|
+
// Keep the measured one while the model stays the same, so the status line
|
|
1656
|
+
// percentage stops swinging between a turn's messages and its result.
|
|
1657
|
+
const contextModel = message.message?.model || session.model;
|
|
1658
|
+
if (contextModel !== session.contextWindowModel || !session.lastContextWindow) {
|
|
1659
|
+
session.contextWindowModel = contextModel;
|
|
1660
|
+
session.lastContextWindow = capabilityContextWindow(
|
|
1661
|
+
capabilities,
|
|
1662
|
+
message.message?.model,
|
|
1663
|
+
session.model,
|
|
1664
|
+
);
|
|
1665
|
+
}
|
|
1657
1666
|
// Usage used to reach the host only with the turn's result, so a session's
|
|
1658
1667
|
// first turn read 0k on screen for its whole run. The assistant message
|
|
1659
1668
|
// already names the window it occupies, so publish it as it lands. No
|
|
@@ -2702,14 +2711,16 @@ async function processResult(session, message) {
|
|
|
2702
2711
|
totalTokens: sum.totalTokens + Number(usage.inputTokens || 0) + Number(usage.cacheReadInputTokens || 0) + Number(usage.cacheCreationInputTokens || 0) + Number(usage.outputTokens || 0),
|
|
2703
2712
|
contextWindow: Math.max(sum.contextWindow, Number(usage.contextWindow || 0)),
|
|
2704
2713
|
}), { inputTokens: 0, cachedInputTokens: 0, cacheWriteInputTokens: 0, outputTokens: 0, totalTokens: 0, contextWindow: 0 });
|
|
2714
|
+
// `modelUsage` reports the window the turn actually ran under, so it wins over
|
|
2715
|
+
// the size guessed from the model name — and it is remembered for the next
|
|
2716
|
+
// turn's messages too.
|
|
2717
|
+
if (totals.contextWindow > 0) session.lastContextWindow = totals.contextWindow;
|
|
2705
2718
|
notify("thread/tokenUsage/updated", {
|
|
2706
2719
|
threadId: session.id,
|
|
2707
2720
|
tokenUsage: {
|
|
2708
2721
|
total: totals,
|
|
2709
2722
|
...(session.lastContextUsage ? { last: session.lastContextUsage } : {}),
|
|
2710
|
-
|
|
2711
|
-
// over the size guessed from the model name.
|
|
2712
|
-
modelContextWindow: totals.contextWindow || session.lastContextWindow || undefined,
|
|
2723
|
+
modelContextWindow: session.lastContextWindow || undefined,
|
|
2713
2724
|
},
|
|
2714
2725
|
});
|
|
2715
2726
|
const detail = message.errors?.join("\n") || message.result || message.stop_reason || "Claude 실행 실패";
|
|
@@ -5283,6 +5294,36 @@ async function runSelfTest() {
|
|
|
5283
5294
|
|| contextEvent.params.tokenUsage.total !== undefined) {
|
|
5284
5295
|
throw new Error(`Claude mid-turn context self-test failed: ${JSON.stringify(contextEvent)}`);
|
|
5285
5296
|
}
|
|
5297
|
+
// The window measured at a turn's result must survive the next message of the
|
|
5298
|
+
// same model — the name alone reads a 1M tier as 200k.
|
|
5299
|
+
openingSession.contextWindowModel = "claude-sonnet-5";
|
|
5300
|
+
openingSession.lastContextWindow = 1_000_000;
|
|
5301
|
+
const measuredCaptured = [];
|
|
5302
|
+
process.stdout.write = (chunk) => {
|
|
5303
|
+
measuredCaptured.push(String(chunk));
|
|
5304
|
+
return true;
|
|
5305
|
+
};
|
|
5306
|
+
try {
|
|
5307
|
+
processAssistant(openingSession, {
|
|
5308
|
+
message: {
|
|
5309
|
+
model: "claude-sonnet-5",
|
|
5310
|
+
usage: { input_tokens: 1_000, output_tokens: 0 },
|
|
5311
|
+
content: [],
|
|
5312
|
+
},
|
|
5313
|
+
});
|
|
5314
|
+
} finally {
|
|
5315
|
+
process.stdout.write = stdoutWrite;
|
|
5316
|
+
}
|
|
5317
|
+
const measuredEvent = measuredCaptured
|
|
5318
|
+
.join("")
|
|
5319
|
+
.trim()
|
|
5320
|
+
.split("\n")
|
|
5321
|
+
.filter(Boolean)
|
|
5322
|
+
.map((line) => JSON.parse(line))
|
|
5323
|
+
.find((event) => event.method === "thread/tokenUsage/updated");
|
|
5324
|
+
if (measuredEvent?.params?.tokenUsage?.modelContextWindow !== 1_000_000) {
|
|
5325
|
+
throw new Error(`Claude measured context window self-test failed: ${JSON.stringify(measuredEvent)}`);
|
|
5326
|
+
}
|
|
5286
5327
|
const languageCaptured = [];
|
|
5287
5328
|
process.stdout.write = (chunk) => {
|
|
5288
5329
|
languageCaptured.push(String(chunk));
|