@cydm/pie 1.0.33 → 1.0.34
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/cli.js +88 -9
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -54844,7 +54844,8 @@ var DEFAULT_APP_KEYBINDINGS = {
|
|
|
54844
54844
|
toggleThinking: "ctrl+t",
|
|
54845
54845
|
toggleSessionNamedFilter: "ctrl+n",
|
|
54846
54846
|
externalEditor: "ctrl+g",
|
|
54847
|
-
|
|
54847
|
+
steer: "alt+enter",
|
|
54848
|
+
followUp: [],
|
|
54848
54849
|
dequeue: ["alt+up", "ctrl+shift+up"],
|
|
54849
54850
|
pasteImage: "ctrl+v",
|
|
54850
54851
|
newSession: [],
|
|
@@ -54869,6 +54870,7 @@ var APP_ACTIONS = [
|
|
|
54869
54870
|
"toggleThinking",
|
|
54870
54871
|
"toggleSessionNamedFilter",
|
|
54871
54872
|
"externalEditor",
|
|
54873
|
+
"steer",
|
|
54872
54874
|
"followUp",
|
|
54873
54875
|
"dequeue",
|
|
54874
54876
|
"pasteImage",
|
|
@@ -63849,7 +63851,7 @@ function handleHotkeysCommand(host) {
|
|
|
63849
63851
|
theme.fg("muted", "Editor shortcuts:"),
|
|
63850
63852
|
" Enter Submit message",
|
|
63851
63853
|
" Shift+Enter New line",
|
|
63852
|
-
` ${theme.fg("dim", kb.getKeys("
|
|
63854
|
+
` ${theme.fg("dim", kb.getKeys("steer").join(" / "))} ${theme.fg("muted", "Queue steering message for the active turn")}`,
|
|
63853
63855
|
` ${theme.fg("dim", kb.getKeys("dequeue").join(" / "))} ${theme.fg("muted", "Restore queued messages")}`,
|
|
63854
63856
|
" / Show slash commands",
|
|
63855
63857
|
" Esc Cancel autocomplete",
|
|
@@ -66772,6 +66774,10 @@ function setupInteractiveKeybindings(host) {
|
|
|
66772
66774
|
host.dequeueMessages();
|
|
66773
66775
|
return { consume: true };
|
|
66774
66776
|
}
|
|
66777
|
+
if (host.keybindings.matches(data, "steer")) {
|
|
66778
|
+
host.handleSteer();
|
|
66779
|
+
return { consume: true };
|
|
66780
|
+
}
|
|
66775
66781
|
if (host.keybindings.matches(data, "followUp")) {
|
|
66776
66782
|
host.handleFollowUp();
|
|
66777
66783
|
return { consume: true };
|
|
@@ -66872,6 +66878,19 @@ function handleFollowUp(host) {
|
|
|
66872
66878
|
void host.editor.onSubmit(text);
|
|
66873
66879
|
}
|
|
66874
66880
|
}
|
|
66881
|
+
function handleSteer(host) {
|
|
66882
|
+
const text = host.editor.getText().trim();
|
|
66883
|
+
if (!text) return;
|
|
66884
|
+
if (isCommandLikeInput(text)) {
|
|
66885
|
+
host.editor.onSubmit?.(text);
|
|
66886
|
+
return;
|
|
66887
|
+
}
|
|
66888
|
+
if (host.submitLock || (host.agentSessionController?.hasQueuedMessages ?? false)) {
|
|
66889
|
+
queueMessage(host, text, "steer");
|
|
66890
|
+
} else if (host.editor.onSubmit) {
|
|
66891
|
+
void host.editor.onSubmit(text);
|
|
66892
|
+
}
|
|
66893
|
+
}
|
|
66875
66894
|
function truncate(text, maxLength) {
|
|
66876
66895
|
if (text.length <= maxLength) return text;
|
|
66877
66896
|
return text.slice(0, maxLength) + "...";
|
|
@@ -69558,6 +69577,9 @@ var InteractiveMode = class {
|
|
|
69558
69577
|
handleFollowUp() {
|
|
69559
69578
|
handleFollowUp(this);
|
|
69560
69579
|
}
|
|
69580
|
+
handleSteer() {
|
|
69581
|
+
handleSteer(this);
|
|
69582
|
+
}
|
|
69561
69583
|
restoreEditor() {
|
|
69562
69584
|
return restoreEditor(this.uiHelperHost);
|
|
69563
69585
|
}
|
|
@@ -70174,12 +70196,17 @@ function parseInput(line) {
|
|
|
70174
70196
|
reason: typeof parsed.reason === "string" ? parsed.reason : void 0
|
|
70175
70197
|
};
|
|
70176
70198
|
}
|
|
70177
|
-
if (parsed.type === "turn.request" && typeof parsed.turnId === "string" && typeof parsed.prompt === "string") {
|
|
70199
|
+
if ((parsed.type === "turn.request" || parsed.type === "turn.input") && typeof parsed.turnId === "string" && typeof parsed.prompt === "string") {
|
|
70200
|
+
const streamingBehavior = parsed.streamingBehavior;
|
|
70201
|
+
if (streamingBehavior !== void 0 && streamingBehavior !== "steer" && streamingBehavior !== "followUp") {
|
|
70202
|
+
return null;
|
|
70203
|
+
}
|
|
70178
70204
|
return {
|
|
70179
70205
|
type: "turn.request",
|
|
70180
70206
|
sessionId: typeof parsed.sessionId === "string" ? parsed.sessionId : void 0,
|
|
70181
70207
|
turnId: parsed.turnId,
|
|
70182
70208
|
prompt: parsed.prompt,
|
|
70209
|
+
streamingBehavior,
|
|
70183
70210
|
cwd: typeof parsed.cwd === "string" ? parsed.cwd : void 0,
|
|
70184
70211
|
metadata: isRecord4(parsed.metadata) ? parsed.metadata : void 0
|
|
70185
70212
|
};
|
|
@@ -70343,6 +70370,13 @@ async function runJsonEventsMode(params) {
|
|
|
70343
70370
|
function delay(ms) {
|
|
70344
70371
|
return new Promise((resolve5) => setTimeout(resolve5, Math.max(0, ms)));
|
|
70345
70372
|
}
|
|
70373
|
+
async function waitForActiveController(timeoutMs = 1e3) {
|
|
70374
|
+
const deadline = Date.now() + timeoutMs;
|
|
70375
|
+
while (!controller && activeTurn && !activeTurn.finalized && Date.now() < deadline) {
|
|
70376
|
+
await delay(5);
|
|
70377
|
+
}
|
|
70378
|
+
return controller;
|
|
70379
|
+
}
|
|
70346
70380
|
function touch() {
|
|
70347
70381
|
if (activeTurn) {
|
|
70348
70382
|
activeTurn.lastActivityAt = Date.now();
|
|
@@ -70844,12 +70878,7 @@ async function runJsonEventsMode(params) {
|
|
|
70844
70878
|
return;
|
|
70845
70879
|
}
|
|
70846
70880
|
if (activeTurn && !activeTurn.finalized) {
|
|
70847
|
-
|
|
70848
|
-
type: "turn.failed",
|
|
70849
|
-
sessionId,
|
|
70850
|
-
turnId: message.turnId,
|
|
70851
|
-
error: "another turn is already running"
|
|
70852
|
-
});
|
|
70881
|
+
await queueActiveTurnInput(message);
|
|
70853
70882
|
return;
|
|
70854
70883
|
}
|
|
70855
70884
|
activeTurn = {
|
|
@@ -70974,6 +71003,55 @@ async function runJsonEventsMode(params) {
|
|
|
70974
71003
|
if (activeTurn === turn) activeTurn = null;
|
|
70975
71004
|
}
|
|
70976
71005
|
}
|
|
71006
|
+
async function queueActiveTurnInput(message) {
|
|
71007
|
+
if (!message.streamingBehavior) {
|
|
71008
|
+
writeEvent({
|
|
71009
|
+
type: "turn.failed",
|
|
71010
|
+
sessionId,
|
|
71011
|
+
turnId: message.turnId,
|
|
71012
|
+
error: "another turn is already running; specify streamingBehavior ('steer' or 'followUp') to queue the message"
|
|
71013
|
+
});
|
|
71014
|
+
return;
|
|
71015
|
+
}
|
|
71016
|
+
const activeController = await waitForActiveController();
|
|
71017
|
+
if (!activeController) {
|
|
71018
|
+
writeEvent({
|
|
71019
|
+
type: "turn.failed",
|
|
71020
|
+
sessionId,
|
|
71021
|
+
turnId: message.turnId,
|
|
71022
|
+
error: "JSON events runtime is not ready to queue a streaming turn"
|
|
71023
|
+
});
|
|
71024
|
+
return;
|
|
71025
|
+
}
|
|
71026
|
+
try {
|
|
71027
|
+
applyRuntimeSelection(message);
|
|
71028
|
+
trace?.notePendingUserText(message.prompt);
|
|
71029
|
+
trace?.noteRuntimeEvent("json_events_turn_queued", {
|
|
71030
|
+
mode: message.streamingBehavior,
|
|
71031
|
+
turnId: message.turnId
|
|
71032
|
+
});
|
|
71033
|
+
await activeController.prompt(message.prompt, {
|
|
71034
|
+
source: "json-events",
|
|
71035
|
+
streamingBehavior: message.streamingBehavior,
|
|
71036
|
+
displayText: message.prompt,
|
|
71037
|
+
deliverWhileStreaming: message.streamingBehavior === "steer"
|
|
71038
|
+
});
|
|
71039
|
+
writeEvent({
|
|
71040
|
+
type: "turn.queued",
|
|
71041
|
+
sessionId,
|
|
71042
|
+
turnId: message.turnId,
|
|
71043
|
+
mode: message.streamingBehavior,
|
|
71044
|
+
activeTurnId: activeTurn?.turnId
|
|
71045
|
+
});
|
|
71046
|
+
} catch (error) {
|
|
71047
|
+
writeEvent({
|
|
71048
|
+
type: "turn.failed",
|
|
71049
|
+
sessionId,
|
|
71050
|
+
turnId: message.turnId,
|
|
71051
|
+
error: error instanceof Error ? error.message : String(error)
|
|
71052
|
+
});
|
|
71053
|
+
}
|
|
71054
|
+
}
|
|
70977
71055
|
async function interrupt(message) {
|
|
70978
71056
|
if (isSessionMismatch(message)) {
|
|
70979
71057
|
writeEvent({
|
|
@@ -71098,6 +71176,7 @@ Commands:
|
|
|
71098
71176
|
Interactive Mode Key Bindings:
|
|
71099
71177
|
Enter Submit message
|
|
71100
71178
|
\\ + Enter New line (fallback)
|
|
71179
|
+
Alt+Enter Queue steering message for the active turn
|
|
71101
71180
|
Ctrl+C Exit
|
|
71102
71181
|
Ctrl+D Exit
|
|
71103
71182
|
Ctrl+O Expand/collapse tool output
|