ohbaby-cli 0.1.1 → 0.1.2
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/bin.js +22 -2
- package/dist/bin.js.map +1 -1
- package/dist/cli/commands/terminal.d.ts.map +1 -1
- package/dist/cli/commands/types.d.ts +1 -0
- package/dist/cli/commands/types.d.ts.map +1 -1
- package/dist/index.js +21 -2
- package/dist/index.js.map +1 -1
- package/dist/tui/app.d.ts +2 -1
- package/dist/tui/app.d.ts.map +1 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/store/events.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/bin.js
CHANGED
|
@@ -217,6 +217,7 @@ function createTerminalCommand(runtime) {
|
|
|
217
217
|
await host.core.getSnapshot();
|
|
218
218
|
}
|
|
219
219
|
const instance = runtime.renderTerminalUi({
|
|
220
|
+
clearOnStart: resume === void 0 && args.continue !== true,
|
|
220
221
|
client: host.core,
|
|
221
222
|
subscribeEvents: (handler) => host.callbacks.subscribeEvents(handler)
|
|
222
223
|
});
|
|
@@ -3915,7 +3916,6 @@ function applyTuiEvent(state, event) {
|
|
|
3915
3916
|
);
|
|
3916
3917
|
case "session.updated":
|
|
3917
3918
|
return rebuildFromCollections(state, {
|
|
3918
|
-
activeSessionId: state.activeSessionId ?? event.session.id,
|
|
3919
3919
|
sessions: upsertById(state.sessions, event.session)
|
|
3920
3920
|
});
|
|
3921
3921
|
case "message.appended": {
|
|
@@ -4045,7 +4045,13 @@ function applyTuiEvent(state, event) {
|
|
|
4045
4045
|
);
|
|
4046
4046
|
}
|
|
4047
4047
|
case "command.result.delivered": {
|
|
4048
|
-
const
|
|
4048
|
+
const selectedSessionId = selectedSessionIdFromCommandAction(event.action);
|
|
4049
|
+
const next = selectedSessionId === void 0 ? clearCommandRuntime(state, event.commandRunId) : clearCommandRuntime(
|
|
4050
|
+
rebuildFromCollections(state, {
|
|
4051
|
+
activeSessionId: selectedSessionId
|
|
4052
|
+
}),
|
|
4053
|
+
event.commandRunId
|
|
4054
|
+
);
|
|
4049
4055
|
if (!event.output || !shouldDisplayCommandOutput(event.output)) {
|
|
4050
4056
|
return next;
|
|
4051
4057
|
}
|
|
@@ -4099,6 +4105,13 @@ function applyTuiEvent(state, event) {
|
|
|
4099
4105
|
}
|
|
4100
4106
|
return state;
|
|
4101
4107
|
}
|
|
4108
|
+
function selectedSessionIdFromCommandAction(action) {
|
|
4109
|
+
if (action?.kind !== "session.selected" || !isRecord3(action.data)) {
|
|
4110
|
+
return void 0;
|
|
4111
|
+
}
|
|
4112
|
+
const choiceId = action.data.choiceId;
|
|
4113
|
+
return typeof choiceId === "string" && choiceId.length > 0 ? choiceId : void 0;
|
|
4114
|
+
}
|
|
4102
4115
|
function setCommandCatalog(state, catalog) {
|
|
4103
4116
|
return {
|
|
4104
4117
|
...state,
|
|
@@ -4878,6 +4891,7 @@ var NEW_SESSION_CLEAR_SEQUENCE = "\x1B[2J\x1B[3J\x1B[H";
|
|
|
4878
4891
|
var ESC_INTERRUPT_WINDOW_MS = 1500;
|
|
4879
4892
|
var ESC_INTERRUPT_HINT = "Press Esc again to interrupt";
|
|
4880
4893
|
function OhbabyTerminalApp({
|
|
4894
|
+
clearOnStart = false,
|
|
4881
4895
|
client,
|
|
4882
4896
|
subscribeEvents
|
|
4883
4897
|
}) {
|
|
@@ -4886,6 +4900,7 @@ function OhbabyTerminalApp({
|
|
|
4886
4900
|
const catalogRequestSequenceRef = useRef(0);
|
|
4887
4901
|
const contextRefreshSequenceRef = useRef(0);
|
|
4888
4902
|
const contextNoticeSequenceRef = useRef(0);
|
|
4903
|
+
const didClearOnStartRef = useRef(false);
|
|
4889
4904
|
const disposedRef = useRef(false);
|
|
4890
4905
|
const [screenGeneration, setScreenGeneration] = useState(0);
|
|
4891
4906
|
const [commandPanel, setCommandPanel] = useState(
|
|
@@ -4897,6 +4912,10 @@ function OhbabyTerminalApp({
|
|
|
4897
4912
|
const store = storeRef.current;
|
|
4898
4913
|
const { exit } = useApp();
|
|
4899
4914
|
const { write: writeStdout } = useStdout();
|
|
4915
|
+
if (clearOnStart && !didClearOnStartRef.current) {
|
|
4916
|
+
writeStdout(NEW_SESSION_CLEAR_SEQUENCE);
|
|
4917
|
+
didClearOnStartRef.current = true;
|
|
4918
|
+
}
|
|
4900
4919
|
const activeSessionId = useTuiStoreSelector(
|
|
4901
4920
|
store,
|
|
4902
4921
|
(state) => state.activeSessionId
|
|
@@ -5535,6 +5554,7 @@ function renderTerminalUi(options) {
|
|
|
5535
5554
|
/* @__PURE__ */ jsx(
|
|
5536
5555
|
OhbabyTerminalApp,
|
|
5537
5556
|
{
|
|
5557
|
+
clearOnStart: options.clearOnStart,
|
|
5538
5558
|
client: options.client,
|
|
5539
5559
|
subscribeEvents: options.subscribeEvents
|
|
5540
5560
|
}
|