strands-darwin 0.0.49 → 0.0.52
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 +6 -1
- package/README.zh-CN.md +6 -1
- package/dist/src/agent/instructions.d.ts +9 -4
- package/dist/src/agent/instructions.js +18 -8
- package/dist/src/agent/instructions.js.map +1 -1
- package/dist/src/agent/runtime.js +4 -2
- package/dist/src/agent/runtime.js.map +1 -1
- package/dist/src/cli-doctor.js +12 -8
- package/dist/src/cli-doctor.js.map +1 -1
- package/dist/src/collaboration/hub-wire.d.ts +6 -1
- package/dist/src/collaboration/hub-wire.js +6 -1
- package/dist/src/collaboration/hub-wire.js.map +1 -1
- package/dist/src/collaboration/local.d.ts +15 -1
- package/dist/src/collaboration/local.js +42 -6
- package/dist/src/collaboration/local.js.map +1 -1
- package/dist/src/collaboration/protocol.d.ts +9 -0
- package/dist/src/collaboration/protocol.js +9 -0
- package/dist/src/collaboration/protocol.js.map +1 -1
- package/dist/src/collaboration/tools.js +2 -2
- package/dist/src/collaboration/tools.js.map +1 -1
- package/dist/src/commands/custom-commands.d.ts +1 -1
- package/dist/src/commands/custom-commands.js +2 -1
- package/dist/src/commands/custom-commands.js.map +1 -1
- package/dist/src/commands/init-command.d.ts +3 -1
- package/dist/src/commands/init-command.js +6 -6
- package/dist/src/commands/init-command.js.map +1 -1
- package/dist/src/config.d.ts +3 -1
- package/dist/src/config.js +5 -0
- package/dist/src/config.js.map +1 -1
- package/dist/src/import-claude.js +18 -3
- package/dist/src/import-claude.js.map +1 -1
- package/dist/src/skills/builtin/developer/SKILL.md +1 -1
- package/dist/src/tui/App.js +111 -13
- package/dist/src/tui/App.js.map +1 -1
- package/dist/src/tui/InputBox.d.ts +1 -1
- package/dist/src/tui/InputBox.js +1 -1
- package/dist/src/tui/git-diff.d.ts +19 -0
- package/dist/src/tui/git-diff.js +147 -0
- package/dist/src/tui/git-diff.js.map +1 -0
- package/dist/src/tui/help-format.d.ts +1 -1
- package/dist/src/tui/help-format.js +2 -2
- package/dist/src/tui/help-format.js.map +1 -1
- package/dist/src/tui/instructions-format.js +2 -2
- package/dist/src/tui/instructions-format.js.map +1 -1
- package/package.json +1 -1
package/dist/src/tui/App.js
CHANGED
|
@@ -83,6 +83,7 @@ import { liveBackgroundDelegationRefusal } from '../agent/background-delegation.
|
|
|
83
83
|
import { createContextWarnLatch, formatContextReport, formatContextReportWithBreakdown } from './context-format.js';
|
|
84
84
|
import { COPY_COMMAND_USAGE, runCopyCommand } from './copy-command.js';
|
|
85
85
|
import { formatHelpReport } from './help-format.js';
|
|
86
|
+
import { DIFF_USAGE, parseDiffCommand, runGitDiff } from './git-diff.js';
|
|
86
87
|
import { readSessionsReport } from './sessions-format.js';
|
|
87
88
|
import { formatMcpReport } from './mcp-format.js';
|
|
88
89
|
import { describeMode, formatPromptCache, formatPromptCacheState, formatStatusReport, formatThinking, } from './status-format.js';
|
|
@@ -146,11 +147,19 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
146
147
|
// through this mirror rather than closing over `state`.
|
|
147
148
|
const historyRef = useRef(state.history);
|
|
148
149
|
historyRef.current = state.history;
|
|
149
|
-
|
|
150
|
+
// SER-124: one composer-owned Ctrl+X prefix, never draft/render/persisted state.
|
|
151
|
+
// Clear at ownership seams, not just on the next key or render: an async owner
|
|
152
|
+
// can arrive and leave without either, and must not hand an armed prefix back.
|
|
153
|
+
const editorPrefix = useRef(false);
|
|
154
|
+
const [status, setStatusState] = useState('idle');
|
|
150
155
|
// Mirror for subscription callbacks that must read the live status without being
|
|
151
156
|
// rebuilt per status change (the delegation-settlement listener, SER-070).
|
|
152
157
|
const statusRef = useRef(status);
|
|
153
|
-
|
|
158
|
+
const setStatus = useCallback((next) => {
|
|
159
|
+
editorPrefix.current = false;
|
|
160
|
+
statusRef.current = next;
|
|
161
|
+
setStatusState(next);
|
|
162
|
+
}, []);
|
|
154
163
|
const [workspacePaths, setWorkspacePaths] = useState(NO_WORKSPACE_PATHS);
|
|
155
164
|
const commandNames = useMemo(() => [...new Set([
|
|
156
165
|
...BUILTIN_COMMAND_NAMES,
|
|
@@ -211,7 +220,16 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
211
220
|
draftStashRef.current = next;
|
|
212
221
|
setDraftStashState(next);
|
|
213
222
|
}, []);
|
|
223
|
+
const diffRun = useRef(undefined);
|
|
224
|
+
const [diffActive, setDiffActive] = useState(false);
|
|
225
|
+
const discardDiff = useCallback(() => {
|
|
226
|
+
diffRun.current?.cancel();
|
|
227
|
+
diffRun.current = undefined;
|
|
228
|
+
}, []);
|
|
229
|
+
// A session replacement/unmount invalidates the result before killing its process.
|
|
230
|
+
useEffect(() => () => discardDiff(), [runtime, discardDiff]);
|
|
214
231
|
const exit = useCallback(() => {
|
|
232
|
+
discardDiff();
|
|
215
233
|
if (draftStashRef.current === undefined) {
|
|
216
234
|
inkExit();
|
|
217
235
|
return;
|
|
@@ -220,7 +238,7 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
220
238
|
dispatch({ type: 'notice', text: DRAFT_STASH_DROP_NOTICE });
|
|
221
239
|
// Let the bounded notice reach Static before Ink unmounts the composer.
|
|
222
240
|
void waitUntilRenderFlush().finally(() => inkExit());
|
|
223
|
-
}, [dispatch, inkExit, setDraftStash, waitUntilRenderFlush]);
|
|
241
|
+
}, [discardDiff, dispatch, inkExit, setDraftStash, waitUntilRenderFlush]);
|
|
224
242
|
const layout = layoutEditor(draft, columns, editor.cursor);
|
|
225
243
|
const preferredColumn = useRef(undefined);
|
|
226
244
|
// Composer undo (SER-044): the drafts destroyed by kill/word-delete chords,
|
|
@@ -309,6 +327,7 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
309
327
|
const [queued, setQueuedState] = useState([]);
|
|
310
328
|
const queuedRef = useRef(queued);
|
|
311
329
|
const setQueued = useCallback((next) => {
|
|
330
|
+
editorPrefix.current = false;
|
|
312
331
|
queuedRef.current = next;
|
|
313
332
|
setQueuedState(next);
|
|
314
333
|
}, []);
|
|
@@ -320,6 +339,7 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
320
339
|
const [goal, setGoalState] = useState(undefined);
|
|
321
340
|
const goalRef = useRef(undefined);
|
|
322
341
|
const setGoal = useCallback((next) => {
|
|
342
|
+
editorPrefix.current = false;
|
|
323
343
|
goalRef.current = next;
|
|
324
344
|
setGoalState(next);
|
|
325
345
|
}, []);
|
|
@@ -389,7 +409,10 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
389
409
|
dispatch({ type: 'prepareAnswerClose', id });
|
|
390
410
|
});
|
|
391
411
|
}, [dispatch]);
|
|
392
|
-
const pendingPermission = useSyncExternalStore((onChange) => permissions.subscribe(
|
|
412
|
+
const pendingPermission = useSyncExternalStore((onChange) => permissions.subscribe(() => {
|
|
413
|
+
editorPrefix.current = false;
|
|
414
|
+
onChange();
|
|
415
|
+
}), permissions.getSnapshot, permissions.getSnapshot);
|
|
393
416
|
const [ruleReview, setRuleReview] = useState();
|
|
394
417
|
const renderedRuleReview = useRef(undefined);
|
|
395
418
|
const reviewing = ruleReview?.request === pendingPermission && pendingPermission !== undefined
|
|
@@ -458,6 +481,7 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
458
481
|
const [historySearch, setHistorySearchState] = useState(undefined);
|
|
459
482
|
const historySearchRef = useRef(historySearch);
|
|
460
483
|
const setHistorySearch = useCallback((next) => {
|
|
484
|
+
editorPrefix.current = false;
|
|
461
485
|
historySearchRef.current = next;
|
|
462
486
|
setHistorySearchState(next);
|
|
463
487
|
}, []);
|
|
@@ -471,6 +495,7 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
471
495
|
const [rewindSearch, setRewindSearchState] = useState(undefined);
|
|
472
496
|
const rewindSearchRef = useRef(rewindSearch);
|
|
473
497
|
const setRewindSearch = useCallback((next) => {
|
|
498
|
+
editorPrefix.current = false;
|
|
474
499
|
rewindSearchRef.current = next;
|
|
475
500
|
setRewindSearchState(next);
|
|
476
501
|
}, []);
|
|
@@ -546,6 +571,7 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
546
571
|
const history = await loadRewindHistory(next.info.projectRoot, sourceSessionId, checkpoint);
|
|
547
572
|
writeToTerminal(CLEAR_TERMINAL);
|
|
548
573
|
recordAction({ type: 'clear', history });
|
|
574
|
+
editorPrefix.current = false;
|
|
549
575
|
setRuntime(next);
|
|
550
576
|
clipboardReadGeneration.current += 1;
|
|
551
577
|
if (draftStashRef.current !== undefined) {
|
|
@@ -863,6 +889,7 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
863
889
|
setQueued([...queuedRef.current, ...additions]);
|
|
864
890
|
}, [runtime, setQueued]);
|
|
865
891
|
useEffect(() => runtime.subscribeToBackgroundDelegations(() => {
|
|
892
|
+
editorPrefix.current = false;
|
|
866
893
|
if (statusRef.current === 'idle')
|
|
867
894
|
enqueueDelegationWakes();
|
|
868
895
|
}), [enqueueDelegationWakes, runtime]);
|
|
@@ -1130,9 +1157,14 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
1130
1157
|
return !failed;
|
|
1131
1158
|
}, [applyGoalTransition, prepareAnswerClose, returnQueuedToEditor, runtime, setGoal, setTangent, waitUntilRenderFlush]);
|
|
1132
1159
|
const submit = useCallback(async (raw, queuedEntry) => {
|
|
1160
|
+
editorPrefix.current = false;
|
|
1133
1161
|
const text = raw.trim();
|
|
1162
|
+
const diff = parseDiffCommand(text);
|
|
1134
1163
|
if (clearing.current) {
|
|
1135
|
-
|
|
1164
|
+
if (diff !== undefined)
|
|
1165
|
+
recordAction({ type: 'notice', text: diff === 'usage' ? DIFF_USAGE : '/diff does not queue — run it after current work finishes' });
|
|
1166
|
+
else
|
|
1167
|
+
dispatch({ type: 'notice', text: 'Session management in progress; submit again when it finishes' });
|
|
1136
1168
|
return;
|
|
1137
1169
|
}
|
|
1138
1170
|
// A drained entry owns its optional image, including explicit absence. It
|
|
@@ -1168,6 +1200,46 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
1168
1200
|
}
|
|
1169
1201
|
return;
|
|
1170
1202
|
}
|
|
1203
|
+
// Human-only Git inspection, before queueing or any model-bound expansion.
|
|
1204
|
+
if (diff !== undefined && queuedEntry === undefined) {
|
|
1205
|
+
setEditor({ text: '', cursor: { offset: 0, affinity: 'downstream' } });
|
|
1206
|
+
setSelectedCompletion(0);
|
|
1207
|
+
if (diff === 'usage') {
|
|
1208
|
+
recordAction({ type: 'notice', text: DIFF_USAGE });
|
|
1209
|
+
return;
|
|
1210
|
+
}
|
|
1211
|
+
if (statusRef.current !== 'idle' || diffRun.current !== undefined || draining.current ||
|
|
1212
|
+
permissions.current !== undefined || editorActive.current ||
|
|
1213
|
+
historySearchRef.current !== undefined || rewindSearchRef.current !== undefined) {
|
|
1214
|
+
recordAction({ type: 'notice', text: '/diff does not queue — run it after current work finishes' });
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
const run = runGitDiff({
|
|
1218
|
+
projectRoot: runtime.info.projectRoot, scope: diff,
|
|
1219
|
+
env: scrubShellEnv(process.env, runtime.info.shellEnv.passthrough).env,
|
|
1220
|
+
});
|
|
1221
|
+
diffRun.current = run; // Synchronous fence, before the first await/render.
|
|
1222
|
+
setDiffActive(true);
|
|
1223
|
+
try {
|
|
1224
|
+
const report = await run.result;
|
|
1225
|
+
if (diffRun.current === run)
|
|
1226
|
+
recordAction({ type: 'notice', text: report });
|
|
1227
|
+
}
|
|
1228
|
+
finally {
|
|
1229
|
+
if (diffRun.current === run)
|
|
1230
|
+
diffRun.current = undefined;
|
|
1231
|
+
setDiffActive(false);
|
|
1232
|
+
}
|
|
1233
|
+
return;
|
|
1234
|
+
}
|
|
1235
|
+
if (diffRun.current !== undefined) {
|
|
1236
|
+
if (text === '/exit' || text === '/quit') {
|
|
1237
|
+
exit();
|
|
1238
|
+
return;
|
|
1239
|
+
}
|
|
1240
|
+
recordAction({ type: 'notice', text: 'local diff in progress — cancel with Ctrl+C before submitting' });
|
|
1241
|
+
return;
|
|
1242
|
+
}
|
|
1171
1243
|
// A bounded pure projection of canonical commands and fixed input controls.
|
|
1172
1244
|
// It owns every whitespace-separated /help form before the busy guard, so an
|
|
1173
1245
|
// argument is rejected locally and a valid report remains available while a
|
|
@@ -1875,6 +1947,7 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
1875
1947
|
// whole-screen redraw.
|
|
1876
1948
|
writeToTerminal(CLEAR_TERMINAL);
|
|
1877
1949
|
dispatch({ type: 'clear' });
|
|
1950
|
+
editorPrefix.current = false;
|
|
1878
1951
|
setRuntime(next);
|
|
1879
1952
|
if (draftStashRef.current !== undefined) {
|
|
1880
1953
|
setDraftStash(undefined);
|
|
@@ -2084,7 +2157,7 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
2084
2157
|
// `wait`/`status`; such a wake is dropped silently — the conversation already
|
|
2085
2158
|
// holds the fact — and the next entry drains in its place.
|
|
2086
2159
|
useEffect(() => {
|
|
2087
|
-
if (draining.current || status !== 'idle' || pendingPermission !== undefined || clearing.current)
|
|
2160
|
+
if (diffRun.current !== undefined || draining.current || status !== 'idle' || pendingPermission !== undefined || clearing.current)
|
|
2088
2161
|
return;
|
|
2089
2162
|
// A delegation wake (SER-070) is dropped once the SDK no longer tracks its task:
|
|
2090
2163
|
// an intervening turn already carried the result pair, so the report is known.
|
|
@@ -2103,7 +2176,7 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
2103
2176
|
draining.current = false;
|
|
2104
2177
|
setDrainCycle((cycle) => cycle + 1);
|
|
2105
2178
|
});
|
|
2106
|
-
}, [drainCycle, pendingPermission, queued, runtime, setQueued, status, submit]);
|
|
2179
|
+
}, [diffActive, drainCycle, pendingPermission, queued, runtime, setQueued, status, submit]);
|
|
2107
2180
|
// Peer inbox borrows the existing Static notice surface and idle ownership latch,
|
|
2108
2181
|
// never a new live-frame row, editable user draft or background polling timer.
|
|
2109
2182
|
const [peerCycle, setPeerCycle] = useState(0);
|
|
@@ -2113,6 +2186,7 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
2113
2186
|
return;
|
|
2114
2187
|
let previous = 0;
|
|
2115
2188
|
const changed = () => {
|
|
2189
|
+
editorPrefix.current = false;
|
|
2116
2190
|
for (const text of local.takeNotices())
|
|
2117
2191
|
dispatch({ type: 'notice', text });
|
|
2118
2192
|
if (local.pending > previous)
|
|
@@ -2125,7 +2199,7 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
2125
2199
|
return unsubscribe;
|
|
2126
2200
|
}, [runtime, dispatch]);
|
|
2127
2201
|
useEffect(() => {
|
|
2128
|
-
if (draining.current || status !== 'idle' || pendingPermission !== undefined || clearing.current || queuedRef.current.length)
|
|
2202
|
+
if (diffRun.current !== undefined || draining.current || status !== 'idle' || pendingPermission !== undefined || clearing.current || queuedRef.current.length)
|
|
2129
2203
|
return;
|
|
2130
2204
|
const peer = runtime.collaboration?.take();
|
|
2131
2205
|
if (!peer)
|
|
@@ -2136,7 +2210,7 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
2136
2210
|
if (!completed)
|
|
2137
2211
|
dispatch({ type: 'notice', severity: 'warn', text: `peer message ${peer.envelope.id} failed/cancelled; not re-sent` });
|
|
2138
2212
|
}).finally(() => { draining.current = false; setDrainCycle(cycle => cycle + 1); });
|
|
2139
|
-
}, [peerCycle, drainCycle, pendingPermission, queued, runtime, runTurn, status, dispatch]);
|
|
2213
|
+
}, [diffActive, peerCycle, drainCycle, pendingPermission, queued, runtime, runTurn, status, dispatch]);
|
|
2140
2214
|
// The `/goal` loop (SER-108): the lowest-priority owner of an idle session. It is asked
|
|
2141
2215
|
// in the same commits as the two effects above and declared after them, so anything
|
|
2142
2216
|
// they take — a queued prompt, `!`, task/delegation wake, peer message — sets the
|
|
@@ -2152,7 +2226,7 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
2152
2226
|
useEffect(() => {
|
|
2153
2227
|
const current = goalRef.current;
|
|
2154
2228
|
const action = goalAction(current, {
|
|
2155
|
-
idle: status === 'idle',
|
|
2229
|
+
idle: status === 'idle' && diffRun.current === undefined,
|
|
2156
2230
|
permissionPending: pendingPermission !== undefined,
|
|
2157
2231
|
clearing: clearing.current,
|
|
2158
2232
|
draining: draining.current,
|
|
@@ -2207,7 +2281,7 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
2207
2281
|
draining.current = false;
|
|
2208
2282
|
setDrainCycle((cycle) => cycle + 1);
|
|
2209
2283
|
});
|
|
2210
|
-
}, [applyGoalTransition, drainCycle, goal, peerCycle, pendingPermission, queued, returnQueuedToEditor, runtime, setGoal, status, submit]);
|
|
2284
|
+
}, [diffActive, applyGoalTransition, drainCycle, goal, peerCycle, pendingPermission, queued, returnQueuedToEditor, runtime, setGoal, status, submit]);
|
|
2211
2285
|
/**
|
|
2212
2286
|
* Answers the pending confirmation and, when the user picked an "always allow"
|
|
2213
2287
|
* option, remembers the rule.
|
|
@@ -2525,6 +2599,7 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
2525
2599
|
* no change — leaves the draft, cursor and image exactly as they were.
|
|
2526
2600
|
*/
|
|
2527
2601
|
const openExternalEditor = useCallback(() => {
|
|
2602
|
+
editorPrefix.current = false;
|
|
2528
2603
|
if (historySearchRef.current !== undefined || rewindSearchRef.current !== undefined)
|
|
2529
2604
|
return;
|
|
2530
2605
|
const goalOwed = goalAction(goalRef.current, {
|
|
@@ -2532,7 +2607,7 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
2532
2607
|
}) !== 'none';
|
|
2533
2608
|
const refusal = externalEditorRefusal({
|
|
2534
2609
|
editorActive: editorActive.current,
|
|
2535
|
-
idle: status === 'idle' && pendingPermission === undefined,
|
|
2610
|
+
idle: status === 'idle' && pendingPermission === undefined && diffRun.current === undefined,
|
|
2536
2611
|
queued: queuedRef.current.length,
|
|
2537
2612
|
draining: draining.current,
|
|
2538
2613
|
clearing: clearing.current,
|
|
@@ -2653,6 +2728,10 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
2653
2728
|
return;
|
|
2654
2729
|
}
|
|
2655
2730
|
interruptedAt.current = now;
|
|
2731
|
+
if (diffRun.current !== undefined) {
|
|
2732
|
+
diffRun.current.cancel();
|
|
2733
|
+
return;
|
|
2734
|
+
}
|
|
2656
2735
|
if (status === 'idle' && pendingPermission === undefined) {
|
|
2657
2736
|
// One stray press never ends the session: it only arms the second one.
|
|
2658
2737
|
dispatch({ type: 'notice', text: 'press ctrl+c again to exit' });
|
|
@@ -2690,6 +2769,8 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
2690
2769
|
dispatch({ type: 'notice', text: 'interrupted — press ctrl+c again to exit' });
|
|
2691
2770
|
}, [exit, pendingPermission, permissions, runtime, status]);
|
|
2692
2771
|
useInput((typed, key) => {
|
|
2772
|
+
const armedEditorPrefix = editorPrefix.current;
|
|
2773
|
+
editorPrefix.current = false;
|
|
2693
2774
|
// Esc Esc chord (SER-059) bookkeeping: every key disarms it, and only the
|
|
2694
2775
|
// composer's own Escape branch below re-arms — so an Escape consumed by an
|
|
2695
2776
|
// earlier owner (permission, a search mode, a menu) never counts as a first press.
|
|
@@ -2822,6 +2903,22 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
2822
2903
|
}
|
|
2823
2904
|
return;
|
|
2824
2905
|
}
|
|
2906
|
+
// SER-124: Ink leaves adjacent legacy control bytes in one input event.
|
|
2907
|
+
// Recognize only this chord (including repeated prefixes), never split paste
|
|
2908
|
+
// or general input. Earlier owners cannot arm it; live mirrors also fence an
|
|
2909
|
+
// ownership change whose React commit has not reached this handler yet.
|
|
2910
|
+
const prefixKey = !key.meta && ((key.ctrl && typed === 'x') || /^\u0018+$/.test(typed));
|
|
2911
|
+
const editorChord = !key.meta && ((armedEditorPrefix && key.ctrl && typed === 'e') || /^\u0018+\u0005$/.test(typed));
|
|
2912
|
+
if (prefixKey || editorChord) {
|
|
2913
|
+
if (permissions.current !== undefined || statusRef.current === 'compacting' ||
|
|
2914
|
+
clearing.current || editorActive.current)
|
|
2915
|
+
return;
|
|
2916
|
+
if (prefixKey)
|
|
2917
|
+
editorPrefix.current = true;
|
|
2918
|
+
else
|
|
2919
|
+
openExternalEditor();
|
|
2920
|
+
return;
|
|
2921
|
+
}
|
|
2825
2922
|
// External editor (SER-113): composer ownership like Ctrl+S/Ctrl+O, below the
|
|
2826
2923
|
// permission, compaction and search owners. Eligibility and the repeated-chord
|
|
2827
2924
|
// fence live in `openExternalEditor`.
|
|
@@ -2842,7 +2939,7 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
2842
2939
|
else if (recallRef.current !== undefined) {
|
|
2843
2940
|
endRecall();
|
|
2844
2941
|
}
|
|
2845
|
-
else if (status === 'idle' && queuedRef.current.length === 0 && editorRef.current.text === '') {
|
|
2942
|
+
else if (status === 'idle' && diffRun.current === undefined && queuedRef.current.length === 0 && editorRef.current.text === '') {
|
|
2846
2943
|
// Esc Esc (SER-059): no owner took this Escape and there is nothing to
|
|
2847
2944
|
// lose — empty draft, no turn or `!` command, no queue (a pending
|
|
2848
2945
|
// permission returned above). The first press arms a timestamp; a second
|
|
@@ -3095,6 +3192,7 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
|
|
|
3095
3192
|
endRecall();
|
|
3096
3193
|
});
|
|
3097
3194
|
usePaste((pasted) => {
|
|
3195
|
+
editorPrefix.current = false;
|
|
3098
3196
|
// Permission and compaction own all input while visible/busy, including paste.
|
|
3099
3197
|
if (pendingPermission !== undefined || status === 'compacting')
|
|
3100
3198
|
return;
|