proto becomes bxcore, the one shared crate (M5b task 00)
Done the way the owner asked and the spike mapped: the crate and the manifests renamed, then what the build reported fixed. Layers: 138 "proto unresolved" errors across 169 files; cargo fmt reordering imports; six fixture paths built as strings in brokerd's and bxctl's tests, which the compiler cannot see, and comments naming crates/proto/; the crate-dependency check and its self-test. One more the spike did not reach: a `\nproto =` key inside a printf format in the self-test, which a word-boundary replacement skips because `n` and `p` are both word characters. make gate: gate: ok, 944 tests; no new entry in /tmp. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@ use std::collections::{HashMap, HashSet};
|
||||
use std::sync::mpsc::Sender;
|
||||
use std::sync::{Mutex, MutexGuard};
|
||||
|
||||
use proto::ApprovalReply;
|
||||
use bxcore::ApprovalReply;
|
||||
|
||||
use crate::sessions::ApprovalCommand::{self, Approve, Deny, Malformed};
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
//! The text of an approval's posts, and of the line added when it ends (M4b spec, section 6).
|
||||
//! Nothing here is shortened: arguments too long to show whole are not shown at all.
|
||||
|
||||
use proto::escape::escape_json_text;
|
||||
use proto::{DenyReason, PendingApproval, Timestamp, sha256};
|
||||
use bxcore::escape::escape_json_text;
|
||||
use bxcore::{DenyReason, PendingApproval, Timestamp, sha256};
|
||||
|
||||
/// Arguments are split into parts of at most this many characters.
|
||||
pub const PART_CHARS: usize = 15_000;
|
||||
@@ -196,7 +196,7 @@ pub fn asked_post(id: u64, asked: &Asked) -> String {
|
||||
} else {
|
||||
"a direct message"
|
||||
};
|
||||
let escaped = proto::escape::escape_model_text(&asked.prompt);
|
||||
let escaped = bxcore::escape::escape_model_text(&asked.prompt);
|
||||
let total = escaped.chars().count();
|
||||
let shown: String = escaped.chars().take(PROMPT_SHOWN).collect();
|
||||
let mut post = format!(
|
||||
|
||||
@@ -5,7 +5,7 @@ use std::os::unix::net::UnixStream;
|
||||
use std::path::Path;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use proto::{
|
||||
use bxcore::{
|
||||
Envelope, ErrorCode, Message, PROTOCOL_VERSION, Turn, TurnEvent, WireError, read_frame,
|
||||
write_frame,
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@ use std::sync::Arc;
|
||||
use std::sync::mpsc::{self, Receiver, RecvTimeoutError, Sender, TryRecvError};
|
||||
use std::time::Duration;
|
||||
|
||||
use proto::{
|
||||
use bxcore::{
|
||||
ApprovalPosted, ApprovalReply, Envelope, ErrorCode, FrameError, GatewayOutcome, Message,
|
||||
PROTOCOL_VERSION, PendingApproval, WireError, read_frame, write_frame,
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
use std::sync::mpsc::Sender;
|
||||
|
||||
use proto::{ApprovalReply, GatewayOutcome, PendingApproval};
|
||||
use bxcore::{ApprovalReply, GatewayOutcome, PendingApproval};
|
||||
|
||||
use crate::approvals::Posted;
|
||||
use crate::approvals::text::{self, Asked, Ended};
|
||||
|
||||
@@ -12,7 +12,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::mpsc::{self, Receiver, Sender};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use proto::SessionId;
|
||||
use bxcore::SessionId;
|
||||
|
||||
use crate::approvals::Registry;
|
||||
use crate::config::Config;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
use std::collections::{BTreeSet, HashMap};
|
||||
|
||||
use proto::SessionId;
|
||||
use bxcore::SessionId;
|
||||
|
||||
use crate::mm::Post;
|
||||
|
||||
@@ -71,7 +71,7 @@ pub enum ApprovalCommand {
|
||||
}
|
||||
|
||||
/// The longest reason a `!deny` may give, in characters.
|
||||
pub const MAX_REASON: usize = proto::MAX_REASON;
|
||||
pub const MAX_REASON: usize = bxcore::MAX_REASON;
|
||||
|
||||
/// `!approve …` or `!deny …` as an approval command; `None` for any other text.
|
||||
pub fn approval_command(text: &str) -> Option<ApprovalCommand> {
|
||||
|
||||
@@ -34,11 +34,11 @@ pub fn base64(bytes: &[u8]) -> String {
|
||||
|
||||
/// The `Sec-WebSocket-Accept` a server must send for `key`.
|
||||
pub fn accept_for(key: &str) -> String {
|
||||
// base64(sha1(key + GUID)), with `proto::sha1::sha1`.
|
||||
// base64(sha1(key + GUID)), with `bxcore::sha1::sha1`.
|
||||
let mut data = Vec::with_capacity(key.len() + GUID.len());
|
||||
data.extend_from_slice(key.as_bytes());
|
||||
data.extend_from_slice(GUID.as_bytes());
|
||||
base64(&proto::sha1::sha1(&data))
|
||||
base64(&bxcore::sha1::sha1(&data))
|
||||
}
|
||||
|
||||
/// A fresh key: 16 bytes from `random` (in `gatewayd`, `/dev/urandom`), in base64.
|
||||
|
||||
Reference in New Issue
Block a user