Skip to content

Commit 1813003

Browse files
committed
docs: refresh README for current runtime
1 parent f430139 commit 1813003

1 file changed

Lines changed: 79 additions & 4 deletions

File tree

README.md

Lines changed: 79 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
# AgentPowerShell
22

3-
AgentPowerShell is a .NET 9 PowerShell execution gateway for policy-enforced agent workflows. The solution combines a CLI, daemon, shim, event pipeline, approval system, LLM proxy, MCP inspection, and cross-platform enforcement abstractions.
3+
AgentPowerShell is a .NET 9 PowerShell execution gateway for policy-enforced agent workflows. The solution combines a CLI, daemon, shim, event pipeline, approval system, LLM proxy, MCP inspection, and platform-specific enforcement slices.
44

55
## Features
66

77
- YAML policy loading with first-match-wins evaluation
88
- Session creation, listing, expiry, and status reporting
9+
- Explicit command execution with JSON/text output and real exit-code propagation
10+
- Hosted PowerShell execution for inline `powershell` and `pwsh` `-Command` invocations
911
- Event capture, append-only storage, JSON serialization, and report generation
1012
- Approval flows for tty, API, TOTP, and WebAuthn-oriented configurations
1113
- Authentication modes for none, API key, OIDC, and hybrid operation
1214
- LLM proxy routing with redaction and usage tracking
1315
- MCP registry, pinning, and cross-server flow inspection
1416
- Workspace checkpoints with create, list, restore, and dry-run restore preview
17+
- Windows Job Object containment for native child processes
18+
- Windows AppContainer isolation for direct native network-client commands under deny-all network policy
1519

1620
## Quick Start
1721

@@ -20,7 +24,8 @@ AgentPowerShell is a .NET 9 PowerShell execution gateway for policy-enforced age
2024
3. Build the solution:
2125

2226
```powershell
23-
dotnet build agentpowershell.sln
27+
dotnet build agentpowershell.sln --verbosity minimal
28+
dotnet test agentpowershell.sln --verbosity minimal --no-build
2429
```
2530

2631
4. Run the CLI:
@@ -35,6 +40,75 @@ dotnet run --project src/AgentPowerShell.Cli -- version
3540
dotnet run --project src/AgentPowerShell.Cli -- policy validate default-policy.yml --output json
3641
```
3742

43+
6. Or install the self-contained binaries:
44+
45+
```powershell
46+
./install.ps1
47+
```
48+
49+
## Practical Usage
50+
51+
List sessions:
52+
53+
```powershell
54+
dotnet run --project src/AgentPowerShell.Cli -- session list
55+
```
56+
57+
Run inline PowerShell through the hosted path:
58+
59+
```powershell
60+
dotnet run --project src/AgentPowerShell.Cli -- exec session-a powershell -Command "$ExecutionContext.SessionState.LanguageMode" --output json
61+
```
62+
63+
Run a native command:
64+
65+
```powershell
66+
dotnet run --project src/AgentPowerShell.Cli -- exec session-a dotnet --version --output json
67+
```
68+
69+
Use the built binary directly:
70+
71+
```powershell
72+
.\src\AgentPowerShell.Cli\bin\Debug\net9.0\AgentPowerShell.Cli.exe exec session-a dotnet --version --output json
73+
```
74+
75+
## Blocked Network Example
76+
77+
On Windows, a direct native network client such as `curl.exe` can now be run inside an AppContainer sandbox when the effective policy denies all network access.
78+
79+
Example policy:
80+
81+
```yaml
82+
command_rules:
83+
- name: allow-all
84+
pattern: "*"
85+
decision: allow
86+
87+
network_rules:
88+
- name: deny-all
89+
domain: "*"
90+
ports: ["1-65535"]
91+
decision: deny
92+
```
93+
94+
Example binary invocation:
95+
96+
```powershell
97+
.\src\AgentPowerShell.Cli\bin\Debug\net9.0\AgentPowerShell.Cli.exe `
98+
exec blocked-demo `
99+
"C:\Program Files\Git\mingw64\bin\curl.exe" `
100+
"https://example.com" `
101+
--output json
102+
```
103+
104+
Current observed Windows behavior for that case is:
105+
106+
- `policyDecision` remains `allow` because command policy allowed the launch.
107+
- The native command actually starts.
108+
- The process then fails inside the sandbox, for example with `curl: (6) Could not resolve host: example.com`.
109+
110+
This is intentionally narrower than a full host-wide firewall model. Mixed allowlists still rely on explicit-target policy checks rather than claiming complete OS-level outbound allow/deny parity.
111+
38112
## Repository Layout
39113

40114
- `src/AgentPowerShell.Core`: policy, config, and shared models
@@ -72,14 +146,15 @@ The repository currently delivers a usable, tested baseline for:
72146
- CLI-driven session management, checkpointing, config updates, reporting, and policy inspection
73147
- `exec` for explicit commands through the shim/daemon processor path
74148
- hosted PowerShell execution for inline `powershell` and `pwsh` `-Command` invocations
75-
- command policy checks, explicit-network prechecks, and first-pass Windows Job Object process control
149+
- command policy checks, explicit-network prechecks, and Windows Job Object process control
150+
- a narrow Windows host-level network isolation path for native clients under deny-all policy
76151
- env-rule enforcement for explicit environment overrides passed into command execution
77152

78153
The repository does not yet fulfill the full `agentsh`-style specification described in `request.task.md` and `docs/architecture.md`. In particular:
79154

80155
- interactive shell sessions through `exec` are still intentionally unsupported
81156
- Linux and macOS platform enforcers remain mostly structural scaffolding
82-
- network blocking is policy-aware pre-execution filtering, not full OS-level egress interception
157+
- broader network enforcement is still mostly policy-aware pre-execution filtering
83158
- the documented long-term architecture is broader than the currently verified runtime behavior
84159

85160
Treat the project as an actively converging implementation rather than a finished parity clone.

0 commit comments

Comments
 (0)