merry-runtime 0.1.3

Structured session, task ledger, context compaction, memory, permission, and tool runtime for Merry.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
//! Runtime-owned action policy taxonomy and default hard policy.
//!
//! These types describe runtime policy decisions for registered tool actions.
//! They are intentionally separate from provider-visible tool specs and provider
//! wire formats.

use crate::{
    AcceptedLocalWorkspaceProcessAdmission, ActionProposal, ActionProposalEvidence,
    ProcessPermissionProfileId, ToolActionKind,
    process::{
        ProcessIntentClass, classify_process_intent, required_process_permission_profile_id,
    },
};

/// Runtime-owned risk tier for a registered tool action.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum ActionRiskTier {
    /// Reads runtime or workspace state without changing it.
    ReadOnly,
    /// Mutates runtime-owned control state only.
    RuntimeControl,
    /// Performs bounded, low-risk edits.
    EditLow,
    /// Performs broader or higher-impact edits.
    EditElevated,
    /// Starts a bounded, low-risk local process.
    ProcessLow,
    /// Starts a local process with accepted workspace effects.
    ProcessLocalWorkspaceEffect,
    /// Starts a read-only shell wrapper under explicit shell-runner admission.
    ProcessShellReadOnly,
    /// Starts a process after explicit permission request admission.
    ProcessPermissioned,
    /// Starts a higher-risk local process.
    ProcessHigh,
    /// Uses network access.
    Network,
    /// Executes a user-configured external tool trusted by configuration.
    TrustedExternal,
    /// Is forbidden by runtime policy.
    Forbidden,
}

/// Runtime-owned disposition for an action policy decision.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum ActionPolicyDisposition {
    /// The action may execute without additional gates.
    Allow,
    /// The action is blocked by hard policy.
    Deny,
}

/// Runtime-owned decision for a registered tool action.
#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) struct ActionPolicyDecision {
    action_kind: ToolActionKind,
    risk_tier: ActionRiskTier,
    disposition: ActionPolicyDisposition,
    fully_trusted: bool,
}

impl ActionPolicyDecision {
    /// Creates a runtime-owned action policy decision.
    #[must_use]
    const fn new(
        action_kind: ToolActionKind,
        risk_tier: ActionRiskTier,
        disposition: ActionPolicyDisposition,
        fully_trusted: bool,
    ) -> Self {
        Self {
            action_kind,
            risk_tier,
            disposition,
            fully_trusted,
        }
    }

    /// Returns the action category considered by policy.
    #[must_use]
    pub(crate) const fn action_kind(&self) -> ToolActionKind {
        self.action_kind
    }

    /// Returns the risk tier assigned by policy.
    #[must_use]
    pub(crate) const fn risk_tier(&self) -> ActionRiskTier {
        self.risk_tier
    }

    /// Returns the policy disposition.
    #[cfg(test)]
    #[must_use]
    pub(crate) const fn disposition(&self) -> ActionPolicyDisposition {
        self.disposition
    }

    pub(crate) const fn is_allowed(&self) -> bool {
        matches!(self.disposition, ActionPolicyDisposition::Allow)
    }

    pub(crate) const fn is_fully_trusted(&self) -> bool {
        self.fully_trusted
    }

    /// Returns the same policy disposition with a proposal-aware risk tier.
    #[must_use]
    pub(crate) const fn with_risk_tier(&self, risk_tier: ActionRiskTier) -> Self {
        Self {
            action_kind: self.action_kind,
            risk_tier,
            disposition: self.disposition,
            fully_trusted: self.fully_trusted,
        }
    }

    /// Allows an otherwise denied action after a narrow proposal-aware opt-in.
    #[must_use]
    pub(crate) const fn allow_low_risk_apply_patch() -> Self {
        Self::new(
            ToolActionKind::WorkspaceWrite,
            ActionRiskTier::EditLow,
            ActionPolicyDisposition::Allow,
            false,
        )
    }

    /// Allows an otherwise denied command execution after a narrow process opt-in.
    #[must_use]
    pub(crate) const fn allow_low_risk_process_action() -> Self {
        Self::new(
            ToolActionKind::CommandExec,
            ActionRiskTier::ProcessLow,
            ActionPolicyDisposition::Allow,
            false,
        )
    }

    /// Allows an otherwise denied local workspace effect process after explicit risk acceptance.
    #[must_use]
    pub(crate) const fn allow_accepted_local_workspace_process_action() -> Self {
        Self::new(
            ToolActionKind::CommandExec,
            ActionRiskTier::ProcessLocalWorkspaceEffect,
            ActionPolicyDisposition::Allow,
            false,
        )
    }

    /// Allows a validated process intent through the configured sandbox or
    /// explicit unrestricted host runner.
    #[must_use]
    pub(crate) const fn allow_configured_process_action() -> Self {
        Self::new(
            ToolActionKind::CommandExec,
            ActionRiskTier::ProcessHigh,
            ActionPolicyDisposition::Allow,
            false,
        )
    }

    /// Allows an otherwise denied read-only shell wrapper after explicit shell opt-in.
    #[must_use]
    pub(crate) const fn allow_read_only_shell_process_action() -> Self {
        Self::new(
            ToolActionKind::CommandExec,
            ActionRiskTier::ProcessShellReadOnly,
            ActionPolicyDisposition::Allow,
            false,
        )
    }

    /// Allows a process after explicit permission request admission.
    #[must_use]
    pub(crate) const fn allow_permissioned_process_action() -> Self {
        Self::new(
            ToolActionKind::CommandExec,
            ActionRiskTier::ProcessPermissioned,
            ActionPolicyDisposition::Allow,
            false,
        )
    }

    /// Allows a permissioned network tool (`web_fetch`, `browser_tab`,
    /// `browser_network`) whose executor enforces SSRF + [`crate::LivePolicyHandle`]
    /// and escalates unapproved external domains through runtime review.
    #[must_use]
    pub(crate) const fn allow_permissioned_network_action() -> Self {
        Self::new(
            ToolActionKind::Network,
            ActionRiskTier::Network,
            ActionPolicyDisposition::Allow,
            false,
        )
    }

    /// Allows a registered tool in explicit fully trusted mode.
    pub(crate) fn allow_fully_trusted_action(action_kind: ToolActionKind) -> Self {
        let risk_tier = if action_kind == ToolActionKind::Network {
            ActionRiskTier::Network
        } else {
            classify_tool_action_risk(action_kind, None)
        };
        Self::new(action_kind, risk_tier, ActionPolicyDisposition::Allow, true)
    }
}

/// Classifies the runtime-owned risk tier for a tool action.
#[must_use]
pub(crate) fn classify_tool_action_risk(
    action_kind: ToolActionKind,
    proposal: Option<&ActionProposal>,
) -> ActionRiskTier {
    match action_kind {
        ToolActionKind::ReadOnly => ActionRiskTier::ReadOnly,
        ToolActionKind::RuntimeControl => ActionRiskTier::RuntimeControl,
        ToolActionKind::WorkspaceWrite => {
            if matches!(
                proposal.map(ActionProposal::evidence),
                Some(ActionProposalEvidence::WorkspacePatch(_))
            ) {
                ActionRiskTier::EditLow
            } else {
                ActionRiskTier::EditElevated
            }
        }
        ToolActionKind::CommandExec => match proposal.map(ActionProposal::evidence) {
            Some(ActionProposalEvidence::ProcessAction(intent)) => {
                if crate::is_read_only_shell_process_action_intent(intent) {
                    return ActionRiskTier::ProcessShellReadOnly;
                }
                match classify_process_intent(intent) {
                    ProcessIntentClass::Informational => ActionRiskTier::ProcessLow,
                    ProcessIntentClass::LocalWorkspaceEffect => {
                        ActionRiskTier::ProcessLocalWorkspaceEffect
                    }
                    ProcessIntentClass::Unknown => ActionRiskTier::ProcessLocalWorkspaceEffect,
                    ProcessIntentClass::Forbidden => ActionRiskTier::ProcessHigh,
                }
            }
            _ => ActionRiskTier::ProcessHigh,
        },
        ToolActionKind::Network => ActionRiskTier::Forbidden,
        ToolActionKind::TrustedExternal => ActionRiskTier::TrustedExternal,
    }
}

/// Returns whether proposal evidence is compatible with the low-risk workspace patch lane.
#[must_use]
pub(crate) fn is_low_risk_apply_patch_proposal(
    action_kind: ToolActionKind,
    proposal: &ActionProposal,
) -> bool {
    action_kind == ToolActionKind::WorkspaceWrite
        && proposal.action_kind() == ToolActionKind::WorkspaceWrite
        && matches!(
            proposal.evidence(),
            ActionProposalEvidence::WorkspacePatch(_)
        )
}

/// Returns whether proposal evidence is compatible with the low-risk process lane.
#[must_use]
pub(crate) fn is_low_risk_process_action_proposal(
    action_kind: ToolActionKind,
    proposal: &ActionProposal,
) -> bool {
    action_kind == ToolActionKind::CommandExec
        && proposal.action_kind() == ToolActionKind::CommandExec
        && matches!(
            proposal.evidence(),
            ActionProposalEvidence::ProcessAction(intent)
                if crate::is_low_risk_process_action_intent(intent)
        )
}

/// Returns whether proposal evidence is compatible with the read-only shell process lane.
#[must_use]
pub(crate) fn is_read_only_shell_process_action_proposal(
    action_kind: ToolActionKind,
    proposal: &ActionProposal,
) -> bool {
    action_kind == ToolActionKind::CommandExec
        && proposal.action_kind() == ToolActionKind::CommandExec
        && matches!(
            proposal.evidence(),
            ActionProposalEvidence::ProcessAction(intent)
                if crate::is_read_only_shell_process_action_intent(intent)
        )
}

/// Returns whether proposal evidence is compatible with the accepted local workspace process lane.
#[must_use]
pub(crate) fn is_local_workspace_effect_process_action_proposal(
    action_kind: ToolActionKind,
    proposal: &ActionProposal,
    admission: AcceptedLocalWorkspaceProcessAdmission,
) -> bool {
    action_kind == ToolActionKind::CommandExec
        && proposal.action_kind() == ToolActionKind::CommandExec
        && matches!(
            proposal.evidence(),
            ActionProposalEvidence::ProcessAction(intent)
                if intent.env_policy() == crate::ProcessEnvPolicy::Empty
                    && intent.stdin_text().is_none()
                    && classify_process_intent(intent)
                        == ProcessIntentClass::LocalWorkspaceEffect
                    && required_process_permission_profile_id(intent)
                        == Some(ProcessPermissionProfileId::LOCAL_WORKSPACE)
                    && admission.matches_intent(intent)
        )
}

/// Default runtime hard policy for registered tool actions.
///
/// The MVP policy is intentionally conservative and equivalent to the original
/// hard-coded behavior: read-only actions are allowed and all mutating,
/// process, or network actions are denied.
#[derive(Debug, Clone, Copy, Default)]
pub(crate) struct DefaultActionPolicy;

impl DefaultActionPolicy {
    /// Decides whether a registered tool action may execute.
    #[must_use]
    pub(crate) fn decide(&self, action_kind: ToolActionKind) -> ActionPolicyDecision {
        match action_kind {
            ToolActionKind::ReadOnly => ActionPolicyDecision::new(
                ToolActionKind::ReadOnly,
                classify_tool_action_risk(ToolActionKind::ReadOnly, None),
                ActionPolicyDisposition::Allow,
                false,
            ),
            ToolActionKind::RuntimeControl => ActionPolicyDecision::new(
                ToolActionKind::RuntimeControl,
                classify_tool_action_risk(ToolActionKind::RuntimeControl, None),
                ActionPolicyDisposition::Allow,
                false,
            ),
            ToolActionKind::WorkspaceWrite => ActionPolicyDecision::new(
                ToolActionKind::WorkspaceWrite,
                classify_tool_action_risk(ToolActionKind::WorkspaceWrite, None),
                ActionPolicyDisposition::Deny,
                false,
            ),
            ToolActionKind::CommandExec => ActionPolicyDecision::new(
                ToolActionKind::CommandExec,
                classify_tool_action_risk(ToolActionKind::CommandExec, None),
                ActionPolicyDisposition::Deny,
                false,
            ),
            ToolActionKind::Network => ActionPolicyDecision::new(
                ToolActionKind::Network,
                classify_tool_action_risk(ToolActionKind::Network, None),
                ActionPolicyDisposition::Deny,
                false,
            ),
            ToolActionKind::TrustedExternal => ActionPolicyDecision::new(
                ToolActionKind::TrustedExternal,
                classify_tool_action_risk(ToolActionKind::TrustedExternal, None),
                ActionPolicyDisposition::Allow,
                false,
            ),
        }
    }
}

#[cfg(test)]
mod tests {
    use super::{
        ActionPolicyDisposition, ActionRiskTier, DefaultActionPolicy, classify_tool_action_risk,
        is_local_workspace_effect_process_action_proposal, is_low_risk_process_action_proposal,
        is_read_only_shell_process_action_proposal,
    };
    use crate::{
        AcceptedLocalWorkspaceProcessAdmission, ActionProposal, ActionProposalEvidence,
        ProcessActionIntent, ProcessEnvPolicy, ProcessPermissionProfileId, ToolActionKind,
        WorkspacePatchProposal,
    };
    use merry_core::{PendingToolCall, ToolCallArguments, ToolCallId, ToolName};
    use serde_json::json;

    fn pending_tool_call() -> PendingToolCall {
        PendingToolCall::new(
            ToolCallId::new("call-risk-classifier").expect("valid call id"),
            ToolName::new("apply_patch").expect("valid tool name"),
            ToolCallArguments::try_from(json!({ "patch": "*** Begin Workspace Patch\n*** Update File: notes/proposed.txt\n-old\n+new\n*** End Workspace Patch" }))
                .expect("object arguments are valid"),
        )
    }

    fn apply_patch_proposal(call: &PendingToolCall) -> ActionProposal {
        let patch = WorkspacePatchProposal::new(
            "notes/proposed.txt",
            3,
            7,
            20,
            24,
            "fnv1a64:0000000000000001",
            "fnv1a64:0000000000000002",
        )
        .expect("test patch proposal is valid");
        ActionProposal::new(
            call,
            ToolActionKind::WorkspaceWrite,
            "workspace patch",
            "notes/proposed.txt",
            "Replace one matched preimage in notes/proposed.txt",
            ActionProposalEvidence::WorkspacePatch(patch),
        )
        .expect("test action proposal is valid")
    }

    fn process_proposal(call: &PendingToolCall, argv: &[&str]) -> ActionProposal {
        process_proposal_with_policy(call, argv, ProcessEnvPolicy::empty(), None)
    }

    fn process_proposal_with_policy(
        call: &PendingToolCall,
        argv: &[&str],
        env_policy: ProcessEnvPolicy,
        stdin_text: Option<&str>,
    ) -> ActionProposal {
        let intent = ProcessActionIntent::new(
            argv.iter().map(|argument| (*argument).to_owned()).collect(),
            Some(".".to_owned()),
            env_policy,
            stdin_text.map(str::to_owned),
            1024,
            1024,
        )
        .expect("test process intent is valid");
        ActionProposal::new(
            call,
            ToolActionKind::CommandExec,
            "process",
            argv.join(" "),
            "Classify process proposal.",
            ActionProposalEvidence::ProcessAction(intent),
        )
        .expect("test process proposal is valid")
    }

    #[test]
    fn classifier_assigns_read_only_risk() {
        assert_eq!(
            classify_tool_action_risk(ToolActionKind::ReadOnly, None),
            ActionRiskTier::ReadOnly
        );
    }

    #[test]
    fn classifier_assigns_low_edit_risk_for_apply_patch_proposal() {
        let call = pending_tool_call();
        let proposal = apply_patch_proposal(&call);

        assert_eq!(
            classify_tool_action_risk(ToolActionKind::WorkspaceWrite, Some(&proposal)),
            ActionRiskTier::EditLow
        );
    }

    #[test]
    fn classifier_assigns_elevated_edit_risk_without_compatible_proposal() {
        assert_eq!(
            classify_tool_action_risk(ToolActionKind::WorkspaceWrite, None),
            ActionRiskTier::EditElevated
        );
    }

    #[test]
    fn classifier_assigns_process_risk_from_process_proposal() {
        assert_eq!(
            classify_tool_action_risk(ToolActionKind::CommandExec, None),
            ActionRiskTier::ProcessHigh
        );

        let call = pending_tool_call();
        for argv in [["rustc", "--version"], ["rg", "--version"]] {
            let informational = process_proposal(&call, &argv);
            assert_eq!(
                classify_tool_action_risk(ToolActionKind::CommandExec, Some(&informational)),
                ActionRiskTier::ProcessLow
            );
        }

        let local_effect = process_proposal(&call, &["cargo", "test", "-p", "merry-runtime"]);
        assert_eq!(
            classify_tool_action_risk(ToolActionKind::CommandExec, Some(&local_effect)),
            ActionRiskTier::ProcessLocalWorkspaceEffect
        );

        let forbidden = process_proposal(&call, &["sh", "-c", "rm -rf target"]);
        assert_eq!(
            classify_tool_action_risk(ToolActionKind::CommandExec, Some(&forbidden)),
            ActionRiskTier::ProcessHigh
        );

        let unknown = process_proposal(&call, &["unknown-readonly-ish", "--version"]);
        assert_eq!(
            classify_tool_action_risk(ToolActionKind::CommandExec, Some(&unknown)),
            ActionRiskTier::ProcessLocalWorkspaceEffect
        );
    }

    #[test]
    fn process_admission_predicates_keep_low_and_local_workspace_lanes_distinct() {
        let call = pending_tool_call();
        let admission = AcceptedLocalWorkspaceProcessAdmission::accept_local_workspace();
        let informational = process_proposal(&call, &["rustc", "--version"]);
        assert!(is_low_risk_process_action_proposal(
            ToolActionKind::CommandExec,
            &informational
        ));
        assert!(!is_local_workspace_effect_process_action_proposal(
            ToolActionKind::CommandExec,
            &informational,
            admission
        ));
        assert!(!is_read_only_shell_process_action_proposal(
            ToolActionKind::CommandExec,
            &informational
        ));

        let local_effect = process_proposal(&call, &["cargo", "test", "-p", "merry-runtime"]);
        assert!(!is_low_risk_process_action_proposal(
            ToolActionKind::CommandExec,
            &local_effect
        ));
        assert!(!is_read_only_shell_process_action_proposal(
            ToolActionKind::CommandExec,
            &local_effect
        ));
        assert!(is_local_workspace_effect_process_action_proposal(
            ToolActionKind::CommandExec,
            &local_effect,
            admission
        ));
        assert!(!is_local_workspace_effect_process_action_proposal(
            ToolActionKind::WorkspaceWrite,
            &local_effect,
            admission
        ));

        let local_effect_with_stdin = process_proposal_with_policy(
            &call,
            &["cargo", "test", "-p", "merry-runtime"],
            ProcessEnvPolicy::empty(),
            Some("stdin is not admitted"),
        );
        assert!(!is_local_workspace_effect_process_action_proposal(
            ToolActionKind::CommandExec,
            &local_effect_with_stdin,
            admission
        ));

        let local_effect_with_env = process_proposal_with_policy(
            &call,
            &["cargo", "test", "-p", "merry-runtime"],
            ProcessEnvPolicy::NonEmptyForTest,
            None,
        );
        assert!(!is_local_workspace_effect_process_action_proposal(
            ToolActionKind::CommandExec,
            &local_effect_with_env,
            admission
        ));

        let mismatched_admission =
            AcceptedLocalWorkspaceProcessAdmission::for_test_permission_profile_id(
                ProcessPermissionProfileId::READ_ONLY,
            );
        assert!(!is_local_workspace_effect_process_action_proposal(
            ToolActionKind::CommandExec,
            &local_effect,
            mismatched_admission
        ));

        let unknown_workspace_effect =
            process_proposal(&call, &["unknown-readonly-ish", "--version"]);
        assert!(!is_low_risk_process_action_proposal(
            ToolActionKind::CommandExec,
            &unknown_workspace_effect
        ));
        assert!(!is_local_workspace_effect_process_action_proposal(
            ToolActionKind::CommandExec,
            &unknown_workspace_effect,
            admission
        ));

        let shell_workspace_effect = process_proposal(
            &call,
            &[
                "bash",
                "-lc",
                "HOME=.merry/local/home cargo check --all-targets -p merry-runtime",
            ],
        );
        assert!(!is_read_only_shell_process_action_proposal(
            ToolActionKind::CommandExec,
            &shell_workspace_effect
        ));
        assert!(!is_local_workspace_effect_process_action_proposal(
            ToolActionKind::CommandExec,
            &shell_workspace_effect,
            admission
        ));

        let shell_read_only = process_proposal(&call, &["bash", "-lc", "rg ProcessRunner | wc -l"]);
        assert!(!is_low_risk_process_action_proposal(
            ToolActionKind::CommandExec,
            &shell_read_only
        ));
        assert!(!is_local_workspace_effect_process_action_proposal(
            ToolActionKind::CommandExec,
            &shell_read_only,
            admission
        ));
        assert_eq!(
            is_read_only_shell_process_action_proposal(
                ToolActionKind::CommandExec,
                &shell_read_only
            ),
            cfg!(feature = "bash-ast")
        );
    }

    #[test]
    fn network_actions_are_forbidden_and_denied_by_default_policy() {
        assert_eq!(
            classify_tool_action_risk(ToolActionKind::Network, None),
            ActionRiskTier::Forbidden
        );

        let decision = DefaultActionPolicy.decide(ToolActionKind::Network);
        assert_eq!(decision.action_kind(), ToolActionKind::Network);
        assert_eq!(decision.risk_tier(), ActionRiskTier::Forbidden);
        assert_eq!(decision.disposition(), ActionPolicyDisposition::Deny);
        assert!(!decision.is_allowed());
    }
}