@giovannijecha/jecode 0.1.6-rc.1 → 0.1.7
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/README.md +2 -1
- package/dist/batch.js +2 -9
- package/dist/tui/app-workflows.js +5 -2
- package/dist/tui/turn.js +9 -1
- package/dist/ui/render.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -202,7 +202,8 @@ printf "explain this project\n" | jecode --root .
|
|
|
202
202
|
~~~
|
|
203
203
|
|
|
204
204
|
Dangerous tools stay denied in batch mode unless **--auto-approve** is supplied
|
|
205
|
-
explicitly.
|
|
205
|
+
explicitly. A terminal batch failure is written to stderr and exits non-zero,
|
|
206
|
+
so shell pipelines can stop reliably.
|
|
206
207
|
|
|
207
208
|
## Safety model
|
|
208
209
|
|
package/dist/batch.js
CHANGED
|
@@ -32,15 +32,8 @@ export async function runBatch(session, environment = {}) {
|
|
|
32
32
|
write(`> ${terminalText(line)}\n`);
|
|
33
33
|
session.history.push({ role: "user", content: [{ kind: "text", text: line }] });
|
|
34
34
|
const turn = events(emit, session);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
emit({ kind: "notice", text: error.message, tone: "error" });
|
|
40
|
-
}
|
|
41
|
-
finally {
|
|
42
|
-
turn.flush();
|
|
43
|
-
}
|
|
35
|
+
await runTurn(session.history, options(session), turn);
|
|
36
|
+
turn.flush();
|
|
44
37
|
}
|
|
45
38
|
}
|
|
46
39
|
finally {
|
|
@@ -90,14 +90,17 @@ export function appWorkflows(options) {
|
|
|
90
90
|
},
|
|
91
91
|
usage: (usage) => recordUsage(session.usage, usage),
|
|
92
92
|
});
|
|
93
|
+
let finishReason;
|
|
93
94
|
try {
|
|
94
95
|
await runTurn(session.history, controllerOptions(session), events, activity.control.signal);
|
|
95
96
|
}
|
|
96
97
|
catch (error) {
|
|
97
|
-
|
|
98
|
+
const interrupted = activity.control.signal.aborted;
|
|
99
|
+
finishReason = interrupted ? "interrupted" : "failed";
|
|
100
|
+
options.emit(turnFailure(session, error, interrupted));
|
|
98
101
|
}
|
|
99
102
|
finally {
|
|
100
|
-
events.finish();
|
|
103
|
+
events.finish(finishReason);
|
|
101
104
|
options.finishActivity(activity);
|
|
102
105
|
}
|
|
103
106
|
}
|
package/dist/tui/turn.js
CHANGED
|
@@ -32,10 +32,18 @@ export function transcribe(stage) {
|
|
|
32
32
|
return changed ? block : undefined;
|
|
33
33
|
};
|
|
34
34
|
return {
|
|
35
|
-
finish() {
|
|
35
|
+
finish(reason) {
|
|
36
36
|
const changed = close();
|
|
37
37
|
if (changed !== undefined)
|
|
38
38
|
stage.render(changed);
|
|
39
|
+
for (const block of tools.values()) {
|
|
40
|
+
if (block.kind !== "tool" || block.tone !== "pending")
|
|
41
|
+
continue;
|
|
42
|
+
block.tone = "fail";
|
|
43
|
+
block.right = reason ?? "failed";
|
|
44
|
+
block.startedAt = undefined;
|
|
45
|
+
stage.render(block);
|
|
46
|
+
}
|
|
39
47
|
},
|
|
40
48
|
onStep(current, total) {
|
|
41
49
|
step = current;
|
package/dist/ui/render.js
CHANGED
|
@@ -94,7 +94,7 @@ export function row(width, left, right = [], ground, padX = PAD) {
|
|
|
94
94
|
// reach approval titles on narrow terminals).
|
|
95
95
|
const fittedRight = fitSegs(right, inner);
|
|
96
96
|
const rightW = plainLen(fittedRight);
|
|
97
|
-
const gutter = fittedRight.length > 0 ? 1 : 0;
|
|
97
|
+
const gutter = fittedRight.length > 0 && rightW < inner ? 1 : 0;
|
|
98
98
|
const fitted = fitSegs(left, Math.max(0, inner - rightW - gutter));
|
|
99
99
|
// An empty pad is no pad at all: a zero-width segment still costs a pair of
|
|
100
100
|
// escape sequences on every row of every frame.
|