[skip ci] wip: preserve Hermes crank development checkpoint
Owner-authorized recovery of accumulated source changes.
Includes accepted work and in-progress changes; NOT a release or acceptance.
Parent baseline 1b6db09bd1. Runtime data, build caches and local credentials excluded.
This commit is contained in:
1 parent
1b6db09bd1
commit
75fe5a123c
357 files changed
+118831
-5113
No files matched your search
@@ -85,11 +85,11 @@ impl io::Write for SharedLogGuard {
|
||||
}
|
||||
}
|
||||
|
||||
fn test_workspace_slug() -> &'static str {
|
||||
pub(super) fn test_workspace_slug() -> &'static str {
|
||||
"default"
|
||||
}
|
||||
|
||||
fn test_agent_id(agent_slug: &str) -> AgentId {
|
||||
pub(super) fn test_agent_id(agent_slug: &str) -> AgentId {
|
||||
AgentId::new(format!("agent_{agent_slug}"))
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ pub(super) fn build_test_app(
|
||||
)
|
||||
}
|
||||
|
||||
fn build_test_app_with_rate_limit(
|
||||
pub(super) fn build_test_app_with_rate_limit(
|
||||
registry: PostgresRegistry,
|
||||
refresh_interval: Duration,
|
||||
public_base_url: Option<String>,
|
||||
@@ -122,7 +122,7 @@ fn build_test_app_with_rate_limit(
|
||||
)
|
||||
}
|
||||
|
||||
fn build_test_app_with_store(
|
||||
pub(super) fn build_test_app_with_store(
|
||||
registry: PostgresRegistry,
|
||||
refresh_interval: Duration,
|
||||
public_base_url: Option<String>,
|
||||
@@ -146,6 +146,55 @@ fn build_test_app_with_store(
|
||||
)
|
||||
}
|
||||
|
||||
/// Story 3.8 support: build the real app with the process artifact store, so `resources/read` serves
|
||||
/// published bytes from a real immutable root (the same seam the production launcher uses).
|
||||
pub(super) fn build_test_app_with_artifacts(
|
||||
registry: PostgresRegistry,
|
||||
refresh_interval: Duration,
|
||||
public_base_url: Option<String>,
|
||||
artifact_store: crank_artifacts::ArtifactStore,
|
||||
) -> axum::Router {
|
||||
crank_community_mcp::build_app_with_artifacts(
|
||||
registry,
|
||||
refresh_interval,
|
||||
public_base_url,
|
||||
SecretCrypto::new("test-master-key-00000000000000000000000000000000").unwrap(),
|
||||
crank_runtime::community_with_outbound_policy(
|
||||
crank_runtime::OutboundHttpPolicy::allowing_hosts(["127.0.0.1"]),
|
||||
)
|
||||
.build(),
|
||||
RequestRateLimiter::new(RequestRateLimitConfig::new(10_000, 10_000).unwrap()),
|
||||
std::sync::Arc::new(InMemoryCoordinationStateStore::default()),
|
||||
std::sync::Arc::new(InMemorySessionStore::default()),
|
||||
std::sync::Arc::new(CommunityMachineCredentialVerifier),
|
||||
// The same default concurrency the existing `build_app` helper uses.
|
||||
16,
|
||||
artifact_store,
|
||||
)
|
||||
}
|
||||
|
||||
/// Story 3.1 ATDD support: build the real app with an injected session store.
|
||||
///
|
||||
/// The store seam (`TransportSessionStore` / `SharedSessionStore`) is already public; this helper
|
||||
/// only exposes the existing instrumented-app path to the new subject modules, so a test can count
|
||||
/// or gate session-store *operations* (`get`/`create`/`mark_initialized`) without touching
|
||||
/// production code. It is deliberately the only addition to this file.
|
||||
pub(super) fn build_test_app_with_sessions(
|
||||
registry: PostgresRegistry,
|
||||
refresh_interval: Duration,
|
||||
public_base_url: Option<String>,
|
||||
sessions: SharedSessionStore,
|
||||
) -> axum::Router {
|
||||
build_test_app_with_store(
|
||||
registry,
|
||||
refresh_interval,
|
||||
public_base_url,
|
||||
RequestRateLimitConfig::new(10_000, 10_000).unwrap(),
|
||||
sessions,
|
||||
std::sync::Arc::new(CommunityMachineCredentialVerifier),
|
||||
)
|
||||
}
|
||||
|
||||
pub(super) async fn initialize_session(
|
||||
client: &reqwest::Client,
|
||||
mcp_url: &str,
|
||||
@@ -219,6 +268,29 @@ pub(super) async fn post_jsonrpc(
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
/// Story 3.1 ATDD support: POST a JSON-RPC payload with explicitly chosen identity headers.
|
||||
///
|
||||
/// The helper only adds the headers the caller passes, so a test can express "no version header",
|
||||
/// "modern header without body identity" or an unknown revision without touching existing helpers.
|
||||
pub(super) async fn post_jsonrpc_with_headers(
|
||||
client: &reqwest::Client,
|
||||
mcp_url: &str,
|
||||
api_key: &str,
|
||||
headers: &[(&str, &str)],
|
||||
payload: Value,
|
||||
) -> reqwest::Response {
|
||||
let mut request = client
|
||||
.post(mcp_url)
|
||||
.header(header::ACCEPT, "application/json, text/event-stream")
|
||||
.header(header::AUTHORIZATION, format!("Bearer {api_key}"));
|
||||
|
||||
for (name, value) in headers {
|
||||
request = request.header(*name, *value);
|
||||
}
|
||||
|
||||
request.json(&payload).send().await.unwrap()
|
||||
}
|
||||
|
||||
pub(super) async fn post_jsonrpc_response(
|
||||
client: &reqwest::Client,
|
||||
mcp_url: &str,
|
||||
|
||||
Reference in new issue
Block a user