Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ process-wrap = { version = "10.0.0", default-features = false, features = ["std"
proptest = { version = "1.11.0", default-features = false, features = ["std"] }
rpassword = "7.5.4"
rusqlite = { version = "0.40.2", features = ["bundled"] }
rustyline = { version = "18.0.1", default-features = false, features = ["with-file-history"] }
serde = { version = "1.0.229", features = ["derive"] }
serde_jcs = "0.2.0"
serde_json = "1.0.151"
Expand Down
78 changes: 78 additions & 0 deletions THIRD_PARTY_LICENSES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4613,6 +4613,8 @@ Used by:
- smallvec 1.15.2 (https://github.com/servo/rust-smallvec)
- stable_deref_trait 1.2.1 (https://github.com/storyyeller/stable_deref_trait)
- tempfile 3.27.0 (https://github.com/Stebalien/tempfile)
- unicode-segmentation 1.13.3 (https://github.com/unicode-rs/unicode-segmentation)
- unicode-width 0.2.2 (https://github.com/unicode-rs/unicode-width)
- url 2.5.8 (https://github.com/servo/rust-url)
- uuid 1.26.0 (https://github.com/uuid-rs/uuid)
- version_check 0.9.5 (https://github.com/SergioBenitez/version_check)
Expand Down Expand Up @@ -7350,6 +7352,52 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


================================================================================
License: Boost Software License 1.0

Used by:
- error-code 3.4.0 (https://github.com/DoumanAsh/error-code)

Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:

The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.


================================================================================
License: Boost Software License 1.0

Used by:
- clipboard-win 5.4.3 (https://github.com/DoumanAsh/clipboard-win)

Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following:

The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


================================================================================
License: Community Data License Agreement Permissive 2.0

Expand Down Expand Up @@ -8780,6 +8828,36 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================================================
License: MIT License

Used by:
- rustyline 18.0.1 (https://github.com/kkawakam/rustyline)

The MIT License (MIT)

Copyright (c) 2015 Katsu Kawakami & Rustyline authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.



================================================================================
License: MIT License

Expand Down
1 change: 1 addition & 0 deletions about.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ accepted = [
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause",
"BSL-1.0",
"CDLA-Permissive-2.0",
"ISC",
"MIT",
Expand Down
1 change: 1 addition & 0 deletions crates/xgen-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ureq.workspace = true
keyring.workspace = true
rpassword.workspace = true
rusqlite.workspace = true
rustyline.workspace = true
serde.workspace = true
serde_jcs.workspace = true
serde_json.workspace = true
Expand Down
9 changes: 9 additions & 0 deletions crates/xgen-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ pub use usage::{CostEstimate, TokenPrices, UsageReport, UsdPerMillion, inspect_l
#[doc(hidden)]
pub use environment::compatible_environment;

/// Where the interactive REPL keeps its input history, beside the Runs (ADR-0071).
#[doc(hidden)]
#[must_use]
pub fn repl_history_path() -> Option<std::path::PathBuf> {
run_layout::discover_state_root()
.ok()
.map(|root| root.join("repl-history.txt"))
}

/// Resolve the catalog directory using the same platform and legacy state roots as Runs.
#[doc(hidden)]
pub fn tool_catalog_directory() -> Result<std::path::PathBuf, &'static str> {
Expand Down
40 changes: 30 additions & 10 deletions crates/xgen-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -816,16 +816,36 @@ fn interactive_command(debug: bool, max_model_turns: u32, trust: bool) -> ExitCo
eprintln!("XGEN_ERROR code={}", PublicRunError::Configuration.code());
return ExitCode::from(PublicRunError::Configuration.exit_code());
};
let mut input = repl::InterruptibleInput::stdin(cancellation.clone());
let mut output = std::io::stdout();
match repl::run_with_display(
&mut input,
&mut output,
&mut host,
&cancellation,
terminal && !debug,
trust,
) {
let result = if terminal {
// ADR-0071: arrow-key editing and history while the REPL waits for a line.
let prompt = repl::PendingPrompt::default();
let mut input = repl::InterruptibleInput::terminal(
cancellation.clone(),
prompt.clone(),
xgen_cli::repl_history_path(),
);
let mut output = repl::PromptTrackingOutput::new(std::io::stdout(), prompt);
repl::run_with_display(
&mut input,
&mut output,
&mut host,
&cancellation,
!debug,
trust,
)
} else {
let mut input = repl::InterruptibleInput::stdin(cancellation.clone());
let mut output = std::io::stdout();
repl::run_with_display(
&mut input,
&mut output,
&mut host,
&cancellation,
false,
trust,
)
};
match result {
Ok(()) => ExitCode::SUCCESS,
Err(error) if error.kind() == ErrorKind::BrokenPipe => ExitCode::SUCCESS,
Err(_) => {
Expand Down
Loading
Loading