ppio-sandbox-cli-global 0.0.0-stage → 0.0.1-a2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 FOUNDRYLABS, INC.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,172 @@
1
- # Temporary Holding Version
1
+ # PPIO Sandbox Global CLI
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ This CLI tool allows you to build manager your running PPIO sandbox and sandbox templates. Learn more in [our documentation](https://ppio.ai/docs/sandbox/overview).
4
+
5
+ ### 1. Install the CLI
6
+
7
+ **Using NPM**
8
+
9
+ ```bash
10
+ npm install -g ppio-sandbox-cli-global@0.0.1-a2
11
+ ```
12
+
13
+ The commands are `ppio-sandbox-cli-global` and `ppio-global`. The default API is
14
+ `https://api.ap-southeast-1.sandbox.ppio.ai`. Saved login credentials are stored
15
+ in `~/.ppio-global/config.json`. `PPIO_API_KEY`, `PPIO_ACCESS_TOKEN`,
16
+ `PPIO_DOMAIN`, and `PPIO_API_URL` continue to work as environment overrides.
17
+ Browser login opens `https://sandbox.ppio.ai/docs/api/cli`; API keys are managed
18
+ at `https://ppio.ai/settings/key-management`. `PPIO_DOCS_BASE` and
19
+ `PPIO_DASHBOARD_BASE` override the browser login and dashboard bases separately.
20
+
21
+ ### 2. Authenticate
22
+
23
+ ```bash
24
+ ppio-sandbox-cli-global auth login
25
+ ```
26
+
27
+ > [!NOTE]
28
+ > To authenticate without the ability to open the browser, provide
29
+ > `PPIO_ACCESS_TOKEN` as an environment variable. You can find your token
30
+ > in Account Settings under the Team selector at [ppio.ai/console](https://ppio.ai/console). Then use the CLI like this:
31
+ > `PPIO_ACCESS_TOKEN=sk_... ppio-sandbox-cli-global template build`.
32
+
33
+ > [!IMPORTANT]
34
+ > Note the distinction between `PPIO_ACCESS_TOKEN` and `PPIO_API_KEY`.
35
+
36
+ ### 3. Agent Runtime Commands
37
+
38
+ The CLI provides commands for managing PPIO Agent Runtime projects, with a command structure similar to AWS Bedrock Agentcore for easier migration.
39
+
40
+ #### Configure Agent
41
+
42
+ ```bash
43
+ # Interactive configuration
44
+ ppio-sandbox-cli-global agent configure
45
+
46
+ # Non-interactive with options
47
+ ppio-sandbox-cli-global agent configure --name my-agent --entrypoint agent.py --no-interactive
48
+ ```
49
+
50
+ #### Deploy Agent
51
+
52
+ ```bash
53
+ # Deploy to PPIO Sandbox
54
+ ppio-sandbox-cli-global agent deploy
55
+
56
+ # Or use 'launch' command (alias for deploy)
57
+ ppio-sandbox-cli-global agent launch
58
+ ```
59
+
60
+ #### Invoke Agent
61
+
62
+ ```bash
63
+ # Simple text invocation
64
+ ppio-sandbox-cli-global agent invoke "Hello, how are you?"
65
+
66
+ # JSON payload invocation
67
+ ppio-sandbox-cli-global agent invoke '{"prompt": "What is the weather?", "location": "Beijing"}'
68
+
69
+ # With streaming response
70
+ ppio-sandbox-cli-global agent invoke "Write a long story" --stream
71
+
72
+ # With custom timeout
73
+ ppio-sandbox-cli-global agent invoke "Complex task" --timeout 120
74
+ ```
75
+
76
+ #### Comparison with AWS Agentcore CLI
77
+
78
+ PPIO CLI commands are similar to AWS Bedrock Agentcore CLI for easier migration:
79
+
80
+ | AWS Agentcore | PPIO CLI | Notes |
81
+ |---------------|----------|-------|
82
+ | `agentcore configure` | `ppio-sandbox-cli-global agent configure` | Similar options |
83
+ | `agentcore launch` | `ppio-sandbox-cli-global agent launch` | Same as `agent deploy` |
84
+ | `agentcore invoke "text"` | `ppio-sandbox-cli-global agent invoke "text"` | Positional argument |
85
+
86
+ **Key Differences:**
87
+ - PPIO uses `agent` subcommand group for better organization alongside `sandbox` and `template` commands
88
+ - PPIO supports `--stream` option for streaming responses
89
+ - PPIO includes additional command groups: `auth`, `sandbox`, `template`
90
+
91
+ ### 4. Check out docs
92
+
93
+ Visit our [CLI documentation](https://ppio.ai/docs/sandbox/overview) to learn more.
94
+
95
+ ### Private service access
96
+
97
+ Upgrade with `npm install -g ppio-sandbox-cli-global@0.0.1-a2`.
98
+
99
+ `create`, `connect`, `resume`, and `reset` accept `--public-traffic` /
100
+ `--no-public-traffic`. Contradictory flags fail before any request is sent.
101
+
102
+ Every sandbox secures controller (envd) traffic; the former `--secure` /
103
+ `--no-secure` flags have been removed. Omitted public traffic flags preserve the
104
+ backend default (public traffic allowed). Connect, resume and reset leave an
105
+ omitted setting unchanged. To require a token for sandbox service URLs,
106
+ explicitly pass `--no-public-traffic`.
107
+
108
+ Security upgrades are irreversible: `allowPublicTraffic=false` cannot be
109
+ converted back to `true`. Pausing and resuming does not bypass this rule.
110
+
111
+ ```bash
112
+ # Create a private sandbox; JSON/YAML return without opening a terminal.
113
+ ppio-global sandbox create base --no-public-traffic --output json
114
+
115
+ # Reconnect to an existing sandbox and obtain its traffic token.
116
+ ppio-global sandbox connect <sandbox-id> --no-public-traffic --output json
117
+
118
+ ppio-global sandbox pause <sandbox-id>
119
+ ppio-global sandbox resume <sandbox-id> --no-public-traffic --output json
120
+
121
+ # Reset resumes by default. Restart your application inside the sandbox after reset.
122
+ ppio-global sandbox reset <sandbox-id> --no-public-traffic --output json
123
+
124
+ # Reset and keep the sandbox paused.
125
+ ppio-global sandbox reset <sandbox-id> --no-resume --no-public-traffic --output json
126
+ ```
127
+
128
+ A successful private operation includes `trafficAccessToken` and
129
+ `trafficTokenStatus: "available"`. Send the returned token in the
130
+ `E2B-Traffic-Access-Token` HTTP header when accessing your application's sandbox
131
+ URL. This is separate from your platform API key. For example, with an HTTP
132
+ service already running on port 3000:
133
+
134
+ ```bash
135
+ curl -H "E2B-Traffic-Access-Token: $TRAFFIC_TOKEN" \
136
+ "https://3000-$SANDBOX_ID.$SANDBOX_DOMAIN/"
137
+ ```
138
+
139
+ Pretty output prints the token before opening a terminal. `connect --detach`
140
+ returns details without opening one. `--output json` / `--output yaml` can be
141
+ used by scripts; the old `--format` and `--json` aliases also work.
142
+
143
+ If private creation or a resumed reset succeeds but returns no token, the CLI
144
+ connects once to that same sandbox to obtain it. If the token is still missing,
145
+ the output preserves `sandboxId`, reports `trafficAccessToken: null` and
146
+ `trafficTokenStatus: "unavailable"`, provides a `resumeCommand`, and exits
147
+ nonzero. It does not report private URL access as ready.
148
+
149
+ `reset --no-resume` never reconnects. It returns the reset response token if
150
+ available; otherwise, an explicitly private reset reports
151
+ `trafficTokenStatus: "requires_resume"` and a recovery command to run when you
152
+ are ready to resume. HTTP 409 returns `reset: false` and exits nonzero.
153
+
154
+ The security regression tests exercise the built CLI and pinned global SDK 0.0.1-a2
155
+ against a local HTTP fixture for legacy and modern domains, including request
156
+ fields, private tokens, aliases, reset errors and paused reset behavior. They
157
+ do not establish live cloud policy enforcement or deployment support.
158
+
159
+ ### Development
160
+
161
+ Build from the repository checkout with Node.js 20 or later and pnpm 10:
162
+
163
+ ```bash
164
+ pnpm --dir cli install --frozen-lockfile
165
+ pnpm --dir cli test:global
166
+ pnpm --dir cli test:registry
167
+ pnpm --dir cli test:security
168
+ ```
169
+
170
+ The registry tests run the compiled CLI and its bundled SDK against HTTP fixtures
171
+ and check the template build request, including image ENV inheritance and private
172
+ registry credentials. No API key or live registry is needed.