devez-vibe 1.3.34 → 1.3.35
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 +43 -1
- package/package.json +1 -1
package/bin/dvz.exe
CHANGED
|
Binary file
|
|
@@ -892,6 +892,8 @@ async function createSession(params, resumeId) {
|
|
|
892
892
|
turn: null,
|
|
893
893
|
// Prompts that arrived while a turn was running, run in order afterwards.
|
|
894
894
|
pendingPrompts: [],
|
|
895
|
+
// Steered prompts whose answer may still need a turn of its own.
|
|
896
|
+
steerPending: 0,
|
|
895
897
|
turnSequence: 1,
|
|
896
898
|
itemSequence: 1,
|
|
897
899
|
streamBlocks: new Map(),
|
|
@@ -1836,6 +1838,15 @@ function finishTurn(session, error, durationMs) {
|
|
|
1836
1838
|
async function consume(session) {
|
|
1837
1839
|
for await (const message of session.query) {
|
|
1838
1840
|
adoptSessionId(session, message.session_id);
|
|
1841
|
+
// A steered prompt answered after its turn already ended still deserves a
|
|
1842
|
+
// turn of its own, or the host would drop every event that follows.
|
|
1843
|
+
if (!session.turn
|
|
1844
|
+
&& session.steerPending > 0
|
|
1845
|
+
&& !message.parent_tool_use_id
|
|
1846
|
+
&& (message.type === "stream_event" || message.type === "assistant")) {
|
|
1847
|
+
session.steerPending -= 1;
|
|
1848
|
+
beginTurn(session);
|
|
1849
|
+
}
|
|
1839
1850
|
if (message.type === "stream_event") {
|
|
1840
1851
|
if (message.event?.type === "content_block_delta" && (message.event?.delta?.text || message.event?.delta?.thinking)) {
|
|
1841
1852
|
if (session.turn) session.turn.sawStreamText = true;
|
|
@@ -1917,6 +1928,32 @@ async function startPrompt(params) {
|
|
|
1917
1928
|
return runPrompt(session, params);
|
|
1918
1929
|
}
|
|
1919
1930
|
|
|
1931
|
+
// Steering pushes the prompt straight into the SDK input stream, so the running
|
|
1932
|
+
// turn picks it up at its next model request instead of waiting for the turn to
|
|
1933
|
+
// end. Model, effort and permission mode stay untouched: the turn is mid-flight.
|
|
1934
|
+
async function steerPrompt(params) {
|
|
1935
|
+
const id = liveSessionId(params.sessionId);
|
|
1936
|
+
const session = sessions.get(id);
|
|
1937
|
+
if (!session) throw new Error(`Claude 세션을 찾을 수 없습니다: ${id}`);
|
|
1938
|
+
if (!session.turn) return runPrompt(session, params);
|
|
1939
|
+
if (params.expectedTurnId && params.expectedTurnId !== session.turn.id) {
|
|
1940
|
+
throw new Error(`turn ID가 일치하지 않습니다: ${params.expectedTurnId}`);
|
|
1941
|
+
}
|
|
1942
|
+
// The CLI may answer the steered message in a cycle of its own, ending the
|
|
1943
|
+
// running turn first. Remember the debt so that answer opens a fresh turn
|
|
1944
|
+
// instead of arriving with no turn to attach to.
|
|
1945
|
+
session.steerPending = (session.steerPending || 0) + 1;
|
|
1946
|
+
const content = await inputContent(params.input, params.handoffContext);
|
|
1947
|
+
session.queue.push({
|
|
1948
|
+
type: "user",
|
|
1949
|
+
message: { role: "user", content },
|
|
1950
|
+
parent_tool_use_id: null,
|
|
1951
|
+
session_id: id,
|
|
1952
|
+
origin: { kind: "human" },
|
|
1953
|
+
});
|
|
1954
|
+
return { turn: { id: session.turn.id }, steered: true };
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1920
1957
|
async function runPrompt(session, params) {
|
|
1921
1958
|
const id = session.id;
|
|
1922
1959
|
if (params.model) {
|
|
@@ -1924,6 +1961,7 @@ async function runPrompt(session, params) {
|
|
|
1924
1961
|
await session.query.setModel(model);
|
|
1925
1962
|
session.model = visibleModel(params.model);
|
|
1926
1963
|
}
|
|
1964
|
+
session.steerPending = 0;
|
|
1927
1965
|
const effort = supportedEffort(modelCapabilities(session.models, params.model || session.model), params.effort);
|
|
1928
1966
|
if (effort) {
|
|
1929
1967
|
await session.query.applyFlagSettings({ effortLevel: effort });
|
|
@@ -2380,11 +2418,15 @@ async function dispatch(method, params = {}) {
|
|
|
2380
2418
|
return { data: historyTurns(messages), nextCursor: null };
|
|
2381
2419
|
}
|
|
2382
2420
|
if (method === "session/prompt") return startPrompt(params);
|
|
2421
|
+
if (method === "session/steer") return steerPrompt(params);
|
|
2383
2422
|
if (method === "session/interrupt") {
|
|
2384
2423
|
const session = lookupSession(params.sessionId);
|
|
2385
2424
|
// Stopping the run drops what was waiting behind it too, so nothing the user
|
|
2386
2425
|
// just cancelled starts on its own afterwards.
|
|
2387
|
-
if (session)
|
|
2426
|
+
if (session) {
|
|
2427
|
+
session.pendingPrompts.length = 0;
|
|
2428
|
+
session.steerPending = 0;
|
|
2429
|
+
}
|
|
2388
2430
|
if (session?.turn) {
|
|
2389
2431
|
const turn = session.turn;
|
|
2390
2432
|
turn.interruptRequested = true;
|