MCPcopy Create free account
hub / github.com/Noumena-Network/code / determineSessionLifecycle

Function determineSessionLifecycle

src/utils/sessionLifecycle.ts:36–71  ·  view source on GitHub ↗
(
  params: SessionLifecycleInput,
)

Source from the content-addressed store, hash-verified

34}
35
36export function determineSessionLifecycle(
37 params: SessionLifecycleInput,
38): SessionLifecycle {
39 // SDK / headless / print modes are non-interactive inference.
40 // They run locally but without a TUI and should skip TUI-specific
41 // prefetches (bootstrap model options, fast mode, example commands).
42 if (
43 params.sdkUrl ||
44 params.print ||
45 (params.inputFormat === 'stream-json' && params.outputFormat === 'stream-json')
46 ) {
47 return 'noninteractive'
48 }
49
50 // Feature-gated connection modes take precedence over local REPL.
51 if (params.hasPendingSSH) {
52 return 'ssh_remote'
53 }
54 if (params.hasPendingConnect) {
55 return 'direct_connect'
56 }
57 if (params.hasPendingAssistant) {
58 return 'assistant'
59 }
60
61 // Explicit remote-session verbs.
62 if (params.remote !== null) {
63 return 'remote'
64 }
65 if (params.teleport !== null) {
66 return 'teleport'
67 }
68
69 // Everything else is a local interactive session (continue, resume, etc).
70 return 'local_interactive'
71}

Callers 2

runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected