devez-vibe 1.9.17 → 1.9.19
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 +67 -13
- package/package.json +1 -1
package/bin/dvz.exe
CHANGED
|
Binary file
|
|
@@ -428,6 +428,13 @@ function stripClaudeModel(model) {
|
|
|
428
428
|
return model.startsWith("claude:") ? model.slice("claude:".length) : model;
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
+
function forkSessionSelection(params, parent) {
|
|
432
|
+
return {
|
|
433
|
+
model: parent?.model || (stripClaudeModel(params.model) ? params.model : (params.fallbackModel || params.model)),
|
|
434
|
+
effort: parent?.effort || params.effort || params.fallbackEffort,
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
|
|
431
438
|
function visibleModel(model) {
|
|
432
439
|
if (!model) return "claude:default";
|
|
433
440
|
return model.startsWith("claude:") ? model : `claude:${model}`;
|
|
@@ -1384,6 +1391,7 @@ async function createSession(params, resumeId) {
|
|
|
1384
1391
|
subagentPulse: null,
|
|
1385
1392
|
lastContextUsage: null,
|
|
1386
1393
|
lastContextWindow: 0,
|
|
1394
|
+
contextWindowModel: "",
|
|
1387
1395
|
};
|
|
1388
1396
|
await ensureClaudeExecutableChoice(params);
|
|
1389
1397
|
const agentQuery = await startAgentQuery(queue, makeOptions(params, id, resumeId));
|
|
@@ -1649,11 +1657,19 @@ function processAssistant(session, message) {
|
|
|
1649
1657
|
session.models,
|
|
1650
1658
|
message.message?.model || session.model,
|
|
1651
1659
|
);
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1660
|
+
// The turn's result reports the window the run actually had, and it can differ
|
|
1661
|
+
// from the size guessed from the model name — a 1M tier reads as 200k here.
|
|
1662
|
+
// Keep the measured one while the model stays the same, so the status line
|
|
1663
|
+
// percentage stops swinging between a turn's messages and its result.
|
|
1664
|
+
const contextModel = message.message?.model || session.model;
|
|
1665
|
+
if (contextModel !== session.contextWindowModel || !session.lastContextWindow) {
|
|
1666
|
+
session.contextWindowModel = contextModel;
|
|
1667
|
+
session.lastContextWindow = capabilityContextWindow(
|
|
1668
|
+
capabilities,
|
|
1669
|
+
message.message?.model,
|
|
1670
|
+
session.model,
|
|
1671
|
+
);
|
|
1672
|
+
}
|
|
1657
1673
|
// Usage used to reach the host only with the turn's result, so a session's
|
|
1658
1674
|
// first turn read 0k on screen for its whole run. The assistant message
|
|
1659
1675
|
// already names the window it occupies, so publish it as it lands. No
|
|
@@ -2702,14 +2718,16 @@ async function processResult(session, message) {
|
|
|
2702
2718
|
totalTokens: sum.totalTokens + Number(usage.inputTokens || 0) + Number(usage.cacheReadInputTokens || 0) + Number(usage.cacheCreationInputTokens || 0) + Number(usage.outputTokens || 0),
|
|
2703
2719
|
contextWindow: Math.max(sum.contextWindow, Number(usage.contextWindow || 0)),
|
|
2704
2720
|
}), { inputTokens: 0, cachedInputTokens: 0, cacheWriteInputTokens: 0, outputTokens: 0, totalTokens: 0, contextWindow: 0 });
|
|
2721
|
+
// `modelUsage` reports the window the turn actually ran under, so it wins over
|
|
2722
|
+
// the size guessed from the model name — and it is remembered for the next
|
|
2723
|
+
// turn's messages too.
|
|
2724
|
+
if (totals.contextWindow > 0) session.lastContextWindow = totals.contextWindow;
|
|
2705
2725
|
notify("thread/tokenUsage/updated", {
|
|
2706
2726
|
threadId: session.id,
|
|
2707
2727
|
tokenUsage: {
|
|
2708
2728
|
total: totals,
|
|
2709
2729
|
...(session.lastContextUsage ? { last: session.lastContextUsage } : {}),
|
|
2710
|
-
|
|
2711
|
-
// over the size guessed from the model name.
|
|
2712
|
-
modelContextWindow: totals.contextWindow || session.lastContextWindow || undefined,
|
|
2730
|
+
modelContextWindow: session.lastContextWindow || undefined,
|
|
2713
2731
|
},
|
|
2714
2732
|
});
|
|
2715
2733
|
const detail = message.errors?.join("\n") || message.result || message.stop_reason || "Claude 실행 실패";
|
|
@@ -3711,14 +3729,13 @@ async function dispatch(method, params = {}) {
|
|
|
3711
3729
|
const source = liveSessionId(params.sessionId);
|
|
3712
3730
|
const forked = await forkSession(source, { dir: await readableCwd(source, params.cwd) });
|
|
3713
3731
|
const id = forked.sessionId || forked;
|
|
3714
|
-
//
|
|
3715
|
-
//
|
|
3716
|
-
// the model default instead of what the parent was running.
|
|
3732
|
+
// The live source is authoritative. A host can carry startup defaults while
|
|
3733
|
+
// the source has since changed model or effort.
|
|
3717
3734
|
const parent = sessions.get(source);
|
|
3735
|
+
const selection = forkSessionSelection(params, parent);
|
|
3718
3736
|
const { session, account, usage } = await createSession({
|
|
3719
3737
|
...params,
|
|
3720
|
-
|
|
3721
|
-
effort: params.effort || parent?.effort || params.fallbackEffort,
|
|
3738
|
+
...selection,
|
|
3722
3739
|
}, id);
|
|
3723
3740
|
return {
|
|
3724
3741
|
id,
|
|
@@ -4373,6 +4390,13 @@ async function runSelfTest() {
|
|
|
4373
4390
|
) !== "max") {
|
|
4374
4391
|
throw new Error(`Claude pinned model self-test failed: ${JSON.stringify(catalog)}`);
|
|
4375
4392
|
}
|
|
4393
|
+
const inheritedFork = forkSessionSelection(
|
|
4394
|
+
{ model: "claude:sonnet", effort: "high" },
|
|
4395
|
+
{ model: "claude:opus", effort: "max" },
|
|
4396
|
+
);
|
|
4397
|
+
if (inheritedFork.model !== "claude:opus" || inheritedFork.effort !== "max") {
|
|
4398
|
+
throw new Error(`Claude fork selection self-test failed: ${JSON.stringify(inheritedFork)}`);
|
|
4399
|
+
}
|
|
4376
4400
|
const notification = taskNotifications({
|
|
4377
4401
|
origin: { kind: "task-notification" },
|
|
4378
4402
|
message: {
|
|
@@ -5283,6 +5307,36 @@ async function runSelfTest() {
|
|
|
5283
5307
|
|| contextEvent.params.tokenUsage.total !== undefined) {
|
|
5284
5308
|
throw new Error(`Claude mid-turn context self-test failed: ${JSON.stringify(contextEvent)}`);
|
|
5285
5309
|
}
|
|
5310
|
+
// The window measured at a turn's result must survive the next message of the
|
|
5311
|
+
// same model — the name alone reads a 1M tier as 200k.
|
|
5312
|
+
openingSession.contextWindowModel = "claude-sonnet-5";
|
|
5313
|
+
openingSession.lastContextWindow = 1_000_000;
|
|
5314
|
+
const measuredCaptured = [];
|
|
5315
|
+
process.stdout.write = (chunk) => {
|
|
5316
|
+
measuredCaptured.push(String(chunk));
|
|
5317
|
+
return true;
|
|
5318
|
+
};
|
|
5319
|
+
try {
|
|
5320
|
+
processAssistant(openingSession, {
|
|
5321
|
+
message: {
|
|
5322
|
+
model: "claude-sonnet-5",
|
|
5323
|
+
usage: { input_tokens: 1_000, output_tokens: 0 },
|
|
5324
|
+
content: [],
|
|
5325
|
+
},
|
|
5326
|
+
});
|
|
5327
|
+
} finally {
|
|
5328
|
+
process.stdout.write = stdoutWrite;
|
|
5329
|
+
}
|
|
5330
|
+
const measuredEvent = measuredCaptured
|
|
5331
|
+
.join("")
|
|
5332
|
+
.trim()
|
|
5333
|
+
.split("\n")
|
|
5334
|
+
.filter(Boolean)
|
|
5335
|
+
.map((line) => JSON.parse(line))
|
|
5336
|
+
.find((event) => event.method === "thread/tokenUsage/updated");
|
|
5337
|
+
if (measuredEvent?.params?.tokenUsage?.modelContextWindow !== 1_000_000) {
|
|
5338
|
+
throw new Error(`Claude measured context window self-test failed: ${JSON.stringify(measuredEvent)}`);
|
|
5339
|
+
}
|
|
5286
5340
|
const languageCaptured = [];
|
|
5287
5341
|
process.stdout.write = (chunk) => {
|
|
5288
5342
|
languageCaptured.push(String(chunk));
|