ExpandShellOutputContext.tsx
components/shell/ExpandShellOutputContext.tsx
36
Lines
3504
Bytes
2
Exports
3
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file is one piece of the larger system. Its name, directory, imports, and exports show where it fits. Start by reading the exports and related files first.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with shell-safety, repo-context, ui-flow. It contains 36 lines, 3 detected imports, and 2 detected exports.
Important relationships
Detected exports
ExpandShellOutputProvideruseExpandShellOutput
Keywords
reactexpandshelloutputcontextchildrenoutputusecontextcontextshellshouldshownfull
Detected imports
react/compiler-runtimereactreact
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
import { c as _c } from "react/compiler-runtime";
import * as React from 'react';
import { useContext } from 'react';
/**
* Context to indicate that shell output should be shown in full (not truncated).
* Used to auto-expand the most recent user `!` command output.
*
* This follows the same pattern as MessageResponseContext and SubAgentContext -
* a boolean context that child components can check to modify their behavior.
*/
const ExpandShellOutputContext = React.createContext(false);
export function ExpandShellOutputProvider(t0) {
const $ = _c(2);
const {
children
} = t0;
let t1;
if ($[0] !== children) {
t1 = <ExpandShellOutputContext.Provider value={true}>{children}</ExpandShellOutputContext.Provider>;
$[0] = children;
$[1] = t1;
} else {
t1 = $[1];
}
return t1;
}
/**
* Returns true if this component is rendered inside an ExpandShellOutputProvider,
* indicating the shell output should be shown in full rather than truncated.
*/
export function useExpandShellOutput() {
return useContext(ExpandShellOutputContext);
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJSZWFjdCIsInVzZUNvbnRleHQiLCJFeHBhbmRTaGVsbE91dHB1dENvbnRleHQiLCJjcmVhdGVDb250ZXh0IiwiRXhwYW5kU2hlbGxPdXRwdXRQcm92aWRlciIsInQwIiwiJCIsIl9jIiwiY2hpbGRyZW4iLCJ0MSIsInVzZUV4cGFuZ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