@ory/argus 0.5.0 → 0.6.1
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/assets/skills/ory-e2b-sandbox/SKILL.md +224 -0
- package/dist/skills.d.ts +3 -3
- package/dist/skills.js +15 -6
- package/package.json +1 -1
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ory-e2b-sandbox
|
|
3
|
+
description: Scaffold an E2B (e2b.dev) sandbox template that boots with {{PKG}} preinstalled, so every Claude/Codex/Gemini/OpenClaw/OpenCode session running inside the sandbox is gated by Ory auth, permissions, and tracing without any per-sandbox setup. Use when the user asks to "create an E2B sandbox with Ory agent security", "build an E2B template with the Ory plugin", "make an E2B image that includes Ory auth", or any close variant. The skill generates the template files in the user's project — it does not deploy them.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# E2B sandbox with Ory agent security
|
|
7
|
+
|
|
8
|
+
You are helping the user scaffold an [E2B](https://e2b.dev) sandbox template
|
|
9
|
+
that preinstalls and registers the {{PKG}} plugin. The resulting template
|
|
10
|
+
publishes a named image; every `Sandbox.create("<tag>")` call from their SDK
|
|
11
|
+
gets a runtime where the agent's tool calls are already authenticated against
|
|
12
|
+
Ory Identities, authorized against Ory Permissions, and emitted as trace
|
|
13
|
+
spans — with **no** install step at sandbox boot.
|
|
14
|
+
|
|
15
|
+
This skill carries the full workflow and the file contents. You generate the
|
|
16
|
+
files in the user's repo; the user runs the build.
|
|
17
|
+
|
|
18
|
+
> **Precondition:** the user has (or will obtain) an `E2B_API_KEY` and has
|
|
19
|
+
> installed the E2B CLI / SDK (`npm install e2b dotenv`). If they haven't, point
|
|
20
|
+
> them at <https://e2b.dev/docs> and stop — do not fabricate credentials.
|
|
21
|
+
|
|
22
|
+
## Step 1 — Confirm the target
|
|
23
|
+
|
|
24
|
+
Before writing files, confirm with the user:
|
|
25
|
+
|
|
26
|
+
1. **Where in their repo should the integration live?** A common choice is
|
|
27
|
+
`integrations/e2b/` at the repo root. Use that unless they say otherwise.
|
|
28
|
+
2. **Template tag.** Default to `agent-ory` (e.g. `claude-code-ory`,
|
|
29
|
+
`codex-ory`). Operators will reference this string in `Sandbox.create()`.
|
|
30
|
+
3. **Will the sandbox have network access to Ory?** It must — the plugin makes
|
|
31
|
+
live API calls to `ORY_PROJECT_URL` from inside the sandbox.
|
|
32
|
+
|
|
33
|
+
If the user is targeting an in-process harness (OpenClaw, OpenCode), the host
|
|
34
|
+
binary that loads the plugin must also be available inside the sandbox. Flag
|
|
35
|
+
this and ask how they ship that binary today — usually `npm install` of a
|
|
36
|
+
project that already depends on the harness runtime.
|
|
37
|
+
|
|
38
|
+
## Step 2 — Generate the files
|
|
39
|
+
|
|
40
|
+
Create these four files at the chosen location (the example uses
|
|
41
|
+
`integrations/e2b/`).
|
|
42
|
+
|
|
43
|
+
### `integrations/e2b/template.ts`
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import { Template } from "e2b";
|
|
47
|
+
|
|
48
|
+
export const template = Template()
|
|
49
|
+
.fromUbuntuImage("22.04")
|
|
50
|
+
.aptInstall(["curl", "ca-certificates", "git", "python3"])
|
|
51
|
+
|
|
52
|
+
// Node.js 20 (NodeSource)
|
|
53
|
+
.runCmd("curl -fsSL https://deb.nodesource.com/setup_20.x | bash -")
|
|
54
|
+
.aptInstall(["nodejs"])
|
|
55
|
+
|
|
56
|
+
// Install the harness CLI globally. Replace `@anthropic-ai/claude-code` with
|
|
57
|
+
// the binary that hosts the Ory plugin in this sandbox (e.g. the Codex or
|
|
58
|
+
// Gemini CLI). For in-process harnesses (openclaw, opencode), `npm install`
|
|
59
|
+
// the harness runtime here instead and ensure its entrypoint is on PATH.
|
|
60
|
+
.npmInstall(["@anthropic-ai/claude-code"], { g: true })
|
|
61
|
+
|
|
62
|
+
// Install the Ory plugin into the harness's discovery location.
|
|
63
|
+
.setWorkdir("/root")
|
|
64
|
+
.runCmd("{{NPX}} install")
|
|
65
|
+
|
|
66
|
+
// Sandbox runtime defaults. Per-tenant secrets (project URL, tokens, client
|
|
67
|
+
// IDs) MUST be passed at Sandbox.create() time, never baked into the image.
|
|
68
|
+
.setEnvs({
|
|
69
|
+
ORY_AUTH_GATE: "1",
|
|
70
|
+
ORY_PERMISSION_MODE: "observe",
|
|
71
|
+
ORY_PERMISSION_NAMESPACE: "AgentTools",
|
|
72
|
+
ORY_AGENT_DEBUG: "true",
|
|
73
|
+
ORY_AGENT_LOG_FILE: "/root/ory-agent-debug.log",
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
.setWorkdir("/workspace");
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### `integrations/e2b/build.prod.ts`
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
import "dotenv/config";
|
|
83
|
+
import { Template, defaultBuildLogger } from "e2b";
|
|
84
|
+
import { template } from "./template";
|
|
85
|
+
|
|
86
|
+
await Template.build(template, "agent-ory", {
|
|
87
|
+
cpuCount: 2,
|
|
88
|
+
memoryMB: 4096,
|
|
89
|
+
onBuildLogs: defaultBuildLogger(),
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### `integrations/e2b/build.dev.ts`
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
import "dotenv/config";
|
|
97
|
+
import { Template, defaultBuildLogger } from "e2b";
|
|
98
|
+
import { template } from "./template";
|
|
99
|
+
|
|
100
|
+
await Template.build(template, "agent-ory-dev", {
|
|
101
|
+
cpuCount: 2,
|
|
102
|
+
memoryMB: 4096,
|
|
103
|
+
skipCache: true,
|
|
104
|
+
onBuildLogs: defaultBuildLogger(),
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### `integrations/e2b/.env.example`
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
# E2B credentials — required to build and run templates.
|
|
112
|
+
E2B_API_KEY=e2b_***
|
|
113
|
+
|
|
114
|
+
# Per-tenant Ory wiring — passed to Sandbox.create() at runtime, NOT baked into
|
|
115
|
+
# the template. Listed here so operators know what to plumb through.
|
|
116
|
+
ORY_PROJECT_URL=https://<slug>.projects.oryapis.com
|
|
117
|
+
ORY_OAUTH2_CLIENT_ID=
|
|
118
|
+
ORY_USER_SESSION_TOKEN=
|
|
119
|
+
# Optional: pin a static agent identity instead of DCR.
|
|
120
|
+
# ORY_AGENT_API_KEY=
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### `integrations/e2b/package.json`
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"name": "ory-e2b-integration",
|
|
128
|
+
"version": "0.0.0",
|
|
129
|
+
"private": true,
|
|
130
|
+
"type": "module",
|
|
131
|
+
"scripts": {
|
|
132
|
+
"build:dev": "tsx build.dev.ts",
|
|
133
|
+
"build:prod": "tsx build.prod.ts"
|
|
134
|
+
},
|
|
135
|
+
"dependencies": {
|
|
136
|
+
"dotenv": "^16.4.5",
|
|
137
|
+
"e2b": "^2.3.0"
|
|
138
|
+
},
|
|
139
|
+
"devDependencies": {
|
|
140
|
+
"tsx": "^4.19.0",
|
|
141
|
+
"typescript": "^6.0.2"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### `integrations/e2b/README.md`
|
|
147
|
+
|
|
148
|
+
Generate a README that captures:
|
|
149
|
+
|
|
150
|
+
- What the template provides (harness CLI + {{PKG}} preinstalled, runtime
|
|
151
|
+
defaults baked in, secrets supplied at sandbox creation).
|
|
152
|
+
- The build flow: `npm install`, `npx e2b auth login` once, then
|
|
153
|
+
`npm run build:prod`.
|
|
154
|
+
- A `Sandbox.create("agent-ory", { envs: { ... } })` example showing which env
|
|
155
|
+
vars to inject at runtime (`ORY_PROJECT_URL`, `ORY_OAUTH2_CLIENT_ID`,
|
|
156
|
+
`ORY_USER_SESSION_TOKEN` or `ORY_USER_OAUTH2_TOKEN`, optional
|
|
157
|
+
`ORY_AGENT_API_KEY`).
|
|
158
|
+
- A pointer to {{REF_AUTH_SETUP}} for full env-var coverage and to
|
|
159
|
+
{{REF_LOCAL_DEV}} for testing the same plugin locally before publishing the
|
|
160
|
+
template.
|
|
161
|
+
|
|
162
|
+
## Step 3 — Build and publish
|
|
163
|
+
|
|
164
|
+
Walk the user through:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
cd integrations/e2b
|
|
168
|
+
cp .env.example .env # then fill in E2B_API_KEY
|
|
169
|
+
npm install
|
|
170
|
+
npx e2b auth login # one-time
|
|
171
|
+
npm run build:prod # publishes the tag chosen in Step 1
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Manage the published template via the E2B CLI:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
npx e2b template list
|
|
178
|
+
npx e2b template delete <tag>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Step 4 — Use the sandbox
|
|
182
|
+
|
|
183
|
+
Show the user the minimal SDK call once their template is live:
|
|
184
|
+
|
|
185
|
+
```ts
|
|
186
|
+
import { Sandbox } from "e2b";
|
|
187
|
+
|
|
188
|
+
const sbx = await Sandbox.create("agent-ory", {
|
|
189
|
+
envs: {
|
|
190
|
+
ORY_PROJECT_URL: process.env.ORY_PROJECT_URL!,
|
|
191
|
+
ORY_OAUTH2_CLIENT_ID: process.env.ORY_OAUTH2_CLIENT_ID!,
|
|
192
|
+
// Pre-supply a user token so the headless sandbox skips PKCE.
|
|
193
|
+
ORY_USER_SESSION_TOKEN: process.env.ORY_USER_SESSION_TOKEN!,
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
await sbx.commands.run("{{BIN}} --version"); // sanity check
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Sandboxes are headless, so the user **must** pre-supply
|
|
201
|
+
`ORY_USER_SESSION_TOKEN` or `ORY_USER_OAUTH2_TOKEN` — otherwise the auth gate's
|
|
202
|
+
PKCE browser flow has no target and hangs. See {{REF_AUTH_SETUP}} for the full
|
|
203
|
+
env-var matrix.
|
|
204
|
+
|
|
205
|
+
## Step 5 — Promotion path
|
|
206
|
+
|
|
207
|
+
The template ships with `ORY_PERMISSION_MODE=observe` baked in so first-run
|
|
208
|
+
sandboxes never block. To promote a sandbox to hard enforcement without
|
|
209
|
+
rebuilding the template, either pass `ORY_PERMISSION_MODE=enforce` at
|
|
210
|
+
`Sandbox.create()` time, or run `{{NPX}} permissions enforce` inside a running
|
|
211
|
+
sandbox. Run `{{NPX}} permissions bootstrap` first on a fresh Ory project so
|
|
212
|
+
the `use` tuples exist before enforcement turns on.
|
|
213
|
+
|
|
214
|
+
## What this skill does NOT do
|
|
215
|
+
|
|
216
|
+
- It does not build or publish the template — the user runs the build, so
|
|
217
|
+
they can see logs and own the resulting tag.
|
|
218
|
+
- It does not bake secrets into the image. `ORY_PROJECT_URL`, OAuth client IDs,
|
|
219
|
+
and any tokens are always passed at `Sandbox.create()` time.
|
|
220
|
+
- It does not pin the harness CLI version inside the template. If the user
|
|
221
|
+
wants reproducibility, swap the unpinned `npmInstall([...])` for a tagged
|
|
222
|
+
version (e.g. `["@anthropic-ai/claude-code@1.2.3"]`) before building.
|
|
223
|
+
- It does not modify the user's Ory project. Use {{REF_AUTH_SETUP}} to
|
|
224
|
+
provision the OAuth2 client and namespaces the sandbox will need.
|
package/dist/skills.d.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Canonical Ory agent skills and commands.
|
|
3
3
|
*
|
|
4
4
|
* The skill playbooks (auth-setup, login-flow, social-login, local-dev,
|
|
5
|
-
* permissions-onboarding, contribute-integration, build-integration
|
|
6
|
-
* local-stack commands (local-up, local-down) live once,
|
|
7
|
-
* templates under `packages/core/assets/`. Every harness plugin renders them
|
|
5
|
+
* permissions-onboarding, contribute-integration, build-integration,
|
|
6
|
+
* e2b-sandbox) and the local-stack commands (local-up, local-down) live once,
|
|
7
|
+
* as token-bearing templates under `packages/core/assets/`. Every harness plugin renders them
|
|
8
8
|
* through {@link renderOrySkills} / {@link renderOryCommands}, substituting the
|
|
9
9
|
* harness's CLI binary, package name, and the way it references sibling skills
|
|
10
10
|
* and commands. Plugins then write the rendered docs into whatever location
|
package/dist/skills.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Canonical Ory agent skills and commands.
|
|
4
4
|
*
|
|
5
5
|
* The skill playbooks (auth-setup, login-flow, social-login, local-dev,
|
|
6
|
-
* permissions-onboarding, contribute-integration, build-integration
|
|
7
|
-
* local-stack commands (local-up, local-down) live once,
|
|
8
|
-
* templates under `packages/core/assets/`. Every harness plugin renders them
|
|
6
|
+
* permissions-onboarding, contribute-integration, build-integration,
|
|
7
|
+
* e2b-sandbox) and the local-stack commands (local-up, local-down) live once,
|
|
8
|
+
* as token-bearing templates under `packages/core/assets/`. Every harness plugin renders them
|
|
9
9
|
* through {@link renderOrySkills} / {@link renderOryCommands}, substituting the
|
|
10
10
|
* harness's CLI binary, package name, and the way it references sibling skills
|
|
11
11
|
* and commands. Plugins then write the rendered docs into whatever location
|
|
@@ -81,6 +81,11 @@ const SKILL_SOURCES = [
|
|
|
81
81
|
name: "ory-build-integration",
|
|
82
82
|
file: "skills/ory-build-integration/SKILL.md",
|
|
83
83
|
},
|
|
84
|
+
{
|
|
85
|
+
id: "e2b-sandbox",
|
|
86
|
+
name: "ory-e2b-sandbox",
|
|
87
|
+
file: "skills/ory-e2b-sandbox/SKILL.md",
|
|
88
|
+
},
|
|
84
89
|
];
|
|
85
90
|
const COMMAND_SOURCES = [
|
|
86
91
|
{
|
|
@@ -112,9 +117,10 @@ function code(value) {
|
|
|
112
117
|
* Build the token substitution map for a harness. The reference style differs:
|
|
113
118
|
*
|
|
114
119
|
* - Claude Code addresses sibling skills as `/project:<name>` and the commands
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
120
|
+
* under the plugin's own namespace (`/ory-agent-plugin:local-up`), because
|
|
121
|
+
* Claude Code namespaces plugin commands by the plugin's `plugin.json` name.
|
|
122
|
+
* - Gemini CLI and OpenCode expose the commands as real slash commands under
|
|
123
|
+
* the `ory` namespace (`/ory:local-up`) but model-invoke skills by name.
|
|
118
124
|
* - Codex and OpenClaw render the commands as user-invocable skills, so both
|
|
119
125
|
* skills and commands are referenced by their bare skill name.
|
|
120
126
|
*/
|
|
@@ -124,6 +130,9 @@ function buildProfile(harness, opts) {
|
|
|
124
130
|
let localDown;
|
|
125
131
|
switch (harness) {
|
|
126
132
|
case "claude-code":
|
|
133
|
+
localUp = code("/ory-agent-plugin:local-up");
|
|
134
|
+
localDown = code("/ory-agent-plugin:local-down");
|
|
135
|
+
break;
|
|
127
136
|
case "gemini-cli":
|
|
128
137
|
case "opencode":
|
|
129
138
|
localUp = code("/ory:local-up");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ory/argus",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Ory Argus: the core API for building authentication, authorization, and audit into AI agent harness plugins, extensions, and custom integrations",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://ory.com",
|