-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathsession-launch.js
More file actions
22 lines (19 loc) · 870 Bytes
/
Copy pathsession-launch.js
File metadata and controls
22 lines (19 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Pure launch-state helpers shared by main and unit tests.
/**
* Decide whether an open-terminal request should create a new CLI session.
*
* A caller may deliberately seed a transcript before the cache indexer has
* seen it (the schedule creator does this to provide its welcome message).
* Such a session must be resumed even when there is no cached row yet.
*/
function shouldStartFresh({ isNew, isPlainTerminal, hasCachedSession, resumeExisting }) {
if (isNew) return true;
if (isPlainTerminal) return false;
if (resumeExisting) return false;
return !hasCachedSession;
}
/** Archived transcript sessions must be restored before they can be resumed. */
function shouldBlockArchivedSession({ isNew, isPlainTerminal, archived }) {
return !isNew && !isPlainTerminal && !!archived;
}
module.exports = { shouldStartFresh, shouldBlockArchivedSession };