Expose loop transfers through versioned public observations

This commit is contained in:
Codex committed 2026-11-23 19:47:24 +08:00
1 parent 69c5dc8d20
commit 71d29261a8
21 files changed
+486 -35

No files matched your search

+13
View File
@@ -351,6 +351,19 @@ fn observation_payload(event: ObservationEvent<'_>) -> (&'static str, Json) {
"span": span.map(span_json),
}),
),
ObservationEvent::LoopTransfer {
frame_id,
transfer,
module_id,
span,
} => (
transfer.event_kind(),
json!({
"frame_id": frame_id.as_wire(),
"module_id": module_id,
"span": span_json(span),
}),
),
ObservationEvent::Effect {
operation,
result_code,
+1 -1
View File
@@ -314,7 +314,7 @@ struct CheckArgs {
/// Declare a plugin manifest for static export-signature checking.
#[arg(long = "plugin", value_name = "PATH")]
plugin: Vec<PathBuf>,
/// Write the public Analysis v2 projection (only on successful check).
/// Write public Analysis JSON, using v3 for projects with loop transfers.
#[arg(long, value_name = "PATH")]
emit: Option<PathBuf>,
/// Machine readable JSON output.
+21 -10
View File
@@ -31,7 +31,10 @@ struct SupportedProtocols {
const SUPPORTED: SupportedProtocols = SupportedProtocols {
tool: PROTOCOL_VERSION,
analysis: &[2],
analysis: &[
crate::analysis::BASE_VERSION,
crate::analysis::LOOP_CONTROL_VERSION,
],
trace: &[2],
};
@@ -297,7 +300,7 @@ fn negotiate_protocol(
let Some(requested) = requested else {
return Ok(());
};
if requested.is_empty() || !requested.iter().any(|version| supported.contains(version)) {
if shared_version(requested, supported).is_none() {
return Err(format!(
"tool.protocol_incompatible: tool requires {name} version(s) {requested:?}, this core supports {supported:?}"
));
@@ -305,6 +308,14 @@ fn negotiate_protocol(
Ok(())
}
fn shared_version(requested: &[u32], supported: &[u32]) -> Option<u32> {
requested
.iter()
.copied()
.filter(|version| supported.contains(version))
.max()
}
fn is_valid_command(command: &str) -> bool {
let mut bytes = command.bytes();
matches!(bytes.next(), Some(byte) if byte.is_ascii_lowercase())
@@ -623,21 +634,21 @@ pub fn dispatch(args: &[OsString]) -> i32 {
process.env("MARQDO_BIN", bin);
}
process.env("MARQDO_TOOL_PROTOCOL", "1");
if record
if let Some(version) = record
.compatibility
.analysis
.as_ref()
.is_some_and(|versions| versions.contains(&2))
.as_deref()
.and_then(|versions| shared_version(versions, SUPPORTED.analysis))
{
process.env("MARQDO_PROTOCOL_ANALYSIS", "2");
process.env("MARQDO_PROTOCOL_ANALYSIS", version.to_string());
}
if record
if let Some(version) = record
.compatibility
.trace
.as_ref()
.is_some_and(|versions| versions.contains(&2))
.as_deref()
.and_then(|versions| shared_version(versions, SUPPORTED.trace))
{
process.env("MARQDO_PROTOCOL_TRACE", "2");
process.env("MARQDO_PROTOCOL_TRACE", version.to_string());
}
match process.status() {
Ok(status) => status.code().unwrap_or(1),