feat(grid-agent): add chat and IM interactions (#123)
Some checks failed
CI / rust-skia (Rust only) (push) Successful in 2m44s
CI / required (push) Failing after 2m41s

This commit is contained in:
2026-08-17 23:11:04 +00:00
parent e3ed39471b
commit 26fd2bf714
12 changed files with 3280 additions and 19 deletions

View File

@@ -46,7 +46,7 @@ fn runtime_source_has_no_subprocess_or_native_abi_escape_hatch() {
let mut files = Vec::with_capacity(16);
collect_rust_files(&source, &mut files);
assert!(
files.len() <= 14,
files.len() <= 16,
"source-file count needs a reviewed bound update"
);
for path in files {
@@ -87,7 +87,7 @@ fn world_backend_requires_the_opaque_policy_authorization() {
}
#[test]
fn live_session_adapter_reuses_only_the_native_network_manager_lifecycle() {
fn live_session_adapter_reuses_native_lifecycle_and_messaging_managers() {
let root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let backend = fs::read_to_string(root.join("src/backend.rs")).expect("backend source");
for required in [
@@ -96,6 +96,10 @@ fn live_session_adapter_reuses_only_the_native_network_manager_lifecycle() {
".native_subscribe_disconnected(",
".native_subscribe_event_queue_running(",
".native_logout_async(",
".subscribe_chat_from_simulator(",
".subscribe_im(",
".chat(",
".instant_message_with_uuid_string(",
] {
assert!(
backend.contains(required),

View File

@@ -225,3 +225,34 @@ fn authenticated_uuid_not_message_text_controls_im_authority() {
.expect("decision");
assert_eq!(result.disposition, PolicyDisposition::Denied);
}
#[test]
fn interaction_intent_capability_filter_can_only_narrow_origin_allowed_tools() {
let authorized = id("11111111-1111-4111-8111-111111111111");
let audit = Arc::new(MemoryPolicyAudit::new(16).expect("audit"));
let gateway = PolicyGateway::new(
BTreeSet::from([authorized]),
vec![tool("inspect", true), tool("move", false)],
PolicyLimits::default(),
audit,
)
.expect("gateway");
let context = PolicyRequestContext::new(
ActionOrigin::instant_message(authorized),
"intent-session",
"intent-correlation",
)
.expect("context");
let informational = gateway.tools_for_capability_set(
&context,
100,
&BTreeSet::from([Capability::Informational]),
);
assert_eq!(informational.len(), 1);
assert_eq!(informational[0].name.as_str(), "inspect");
assert!(
gateway
.tools_for_capability_set(&context, 100, &BTreeSet::new())
.is_empty()
);
}