@antst/dashi 0.1.0-alpha.16 → 0.1.0-alpha.17

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.
Files changed (2) hide show
  1. package/lib/state.js +9 -6
  2. package/package.json +1 -1
package/lib/state.js CHANGED
@@ -104,6 +104,13 @@ function codeBlockOptions(text) {
104
104
  };
105
105
  });
106
106
  }
107
+ function exitChord(state) {
108
+ if (state.exitArmed)
109
+ return reduce(state, { type: 'exit' });
110
+ return [{ ...state, exitArmed: true, rewindArmed: false }, [
111
+ { type: 'exit-timer', armed: true }, ...redraw(),
112
+ ]];
113
+ }
107
114
  export function reduce(state, action) {
108
115
  const head = state.decisions[0];
109
116
  switch (action.type) {
@@ -168,16 +175,12 @@ export function reduce(state, action) {
168
175
  ...state, attachments: [], composer: '', exitArmed: false, recall: undefined, rewindArmed: false,
169
176
  }, [{ type: 'set-composer', text: '' }, ...redraw()]];
170
177
  }
171
- if (state.exitArmed)
172
- return reduce(state, { type: 'exit' });
173
- return [{ ...state, exitArmed: true, rewindArmed: false }, [{ type: 'exit-timer', armed: true }, ...redraw()]];
178
+ return exitChord(state);
174
179
  }
175
180
  case 'ctrl-d':
176
181
  if (state.composer !== '')
177
182
  return [state, []];
178
- if (state.root?.status !== 'idle' || state.attachments.length > 0)
179
- return reduce(state, { type: 'exit' });
180
- return reduce(state, { type: 'ctrl-c' });
183
+ return exitChord(state);
181
184
  case 'decision-cancel': {
182
185
  if (head === undefined)
183
186
  return [state, []];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antst/dashi",
3
- "version": "0.1.0-alpha.16",
3
+ "version": "0.1.0-alpha.17",
4
4
  "description": "A terminal UI for DeepSeek Harness",
5
5
  "publishConfig": {
6
6
  "access": "public"