Skip to content
Open
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
17 changes: 13 additions & 4 deletions crates/persisting-gateway/src/echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,15 @@ mod tests {
use super::*;
use std::sync::{Arc, Mutex};

fn test_client() -> reqwest::Client {
// Local echo binds 127.0.0.1; ignore ambient HTTP(S)_PROXY / ALL_PROXY
// (e.g. socks5h) which reqwest may not support without extra features.
reqwest::Client::builder()
.no_proxy()
.build()
.expect("reqwest client")
}

async fn spawn_echo() -> (String, tokio::sync::oneshot::Sender<()>) {
let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();
let address = listener.local_addr().unwrap();
Expand All @@ -622,7 +631,7 @@ mod tests {
#[tokio::test]
async fn raw_echo_supports_plain_and_base64() {
let (base, stop) = spawn_echo().await;
let client = reqwest::Client::new();
let client = test_client();
let plain = client
.post(format!("{base}/echo"))
.body("hello")
Expand All @@ -645,7 +654,7 @@ mod tests {
#[tokio::test]
async fn chat_echo_uses_last_user_message_and_streams() {
let (base, stop) = spawn_echo().await;
let client = reqwest::Client::new();
let client = test_client();
let response: Value = client
.post(format!("{base}/v1/chat/completions"))
.header(ECHO_ENCODING_HEADER, "base64")
Expand Down Expand Up @@ -687,7 +696,7 @@ mod tests {
#[tokio::test]
async fn native_protocol_endpoints_return_their_wire_shapes() {
let (base, stop) = spawn_echo().await;
let client = reqwest::Client::new();
let client = test_client();

let messages: Value = client
.post(format!("{base}/v1/messages"))
Expand Down Expand Up @@ -774,7 +783,7 @@ forward = "echo-upstream"
},
));

let response = reqwest::Client::new()
let response = test_client()
.post(format!("http://{gateway_address}/v1/messages"))
.header(ECHO_ENCODING_HEADER, "base64")
.json(&json!({
Expand Down
17 changes: 8 additions & 9 deletions crates/persisting-pchronicle-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**Standalone `pchronicle` CLI for onboarding, browsing, querying, importing,
exporting, and serving trajectory Datasets.**

Owns the `pchronicle` binary, loopback-only Warehouse HTTP, the write-capable
Owns the `pchronicle` binary, Warehouse HTTP, the write-capable
`--control` plane used by pPilot and pVisor, optional Gateway ingest/forwarding
flags, and the embed of staged `pchronicle-web` assets at build time.

Expand All @@ -17,14 +17,13 @@ Current commands include `onboard`, `dataset` (pin/unpin/list/show/set/rename),
`list`/`ls`, `stats`, bounded read-only `query`, built-in `stats` reports, assisted
`agent` sessions, Source-local `find`, create/append/replace `import`,
destructive `drop`, complete-trajectory `export`, directory `sync`, `echo`, and
loopback-only `serve`. Import and export support ATIF, OpenAI Messages, ACTF,
Storyline JSON, and record-level Compact JSONL. `sync --from SOURCE --to
WAREHOUSE --convert OUTPUT` polls a local source directory, atomically mirrors
supported JSON files into a local Warehouse Dataset byte-for-byte, and rebuilds
a Storyline Lance Dataset at the conversion output on each coalesced batch.
With `--input-format compact-jsonl`, each batch instead replaces a compact Lance
snapshot at `OUTPUT`; `--to` remains required but is not written. Use `--once`
for a finite run.
`serve`. Import and export support ATIF, OpenAI Messages, ACTF,
Storyline JSON, and record-level Compact JSONL. `sync --from SOURCE [--mirror
MIRROR] [--to OUTPUT]` polls a source directory and, on each coalesced batch,
optionally rebuilds a Compact JSONL Lance Dataset at `--mirror` and/or a
Storyline Lance Dataset at `--to`. Provide at least one destination. With
`--input-format compact-jsonl`, only `--mirror` is valid. Use `--once` for a
finite run.

`pchronicle serve --control 127.0.0.1:0 URI` is normally launched by pPilot or
pVisor. `serve --listen` is the read-only Warehouse. Public bind addresses are
Expand Down
4 changes: 0 additions & 4 deletions crates/persisting-pchronicle-cli/src/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ pub(super) struct PreparedControl {

impl PreparedControl {
pub(super) async fn bind(storage: &str, listen: SocketAddr) -> Result<Self> {
anyhow::ensure!(
listen.ip().is_loopback(),
"pChronicle control may only bind to a loopback address"
);
let control = Arc::new(
RunControlStore::open(storage)
.await
Expand Down
Loading
Loading