@ory/opencode 0.9.0 → 0.10.0

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.
Files changed (2) hide show
  1. package/README.md +31 -12
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -4,6 +4,20 @@
4
4
 
5
5
  You don't need an Ory account or any prior Ory experience to start.
6
6
 
7
+ ## New to Ory?
8
+
9
+ [Ory](https://www.ory.com/docs/) is an open-source identity and access platform — it provides login, registration, sessions, social sign-in, multi-factor auth, and fine-grained permissions, so you don't have to build any of that yourself. Two things make it easy to try with no prior experience:
10
+
11
+ - **Ory Elements** are prebuilt, themeable UI components for the auth pages (login, registration, recovery, settings). The scaffolding skills wire them into your app for you.
12
+ - **The local Ory stack** is a complete Ory running on your laptop in Docker — no account, no signup, no API key. Everything in the Quickstart below works against it, fully offline.
13
+
14
+ This plugin does two independent things, and you can use either on its own:
15
+
16
+ 1. **Build auth into your app.** Have OpenCode scaffold Ory login, registration, social sign-in, and permissions into the project you're working on, backed by the local stack. This is the Quickstart below — it needs nothing but Docker.
17
+ 2. **Govern the agent itself.** Authenticate OpenCode's own session and authorize every tool it runs against Ory Permissions, with a full audit trail. See [Agent security](#agent-security).
18
+
19
+ If you're just exploring, do the Quickstart first.
20
+
7
21
  ## Prerequisites
8
22
 
9
23
  - [OpenCode](https://opencode.ai) installed
@@ -80,11 +94,16 @@ That's the full Ory DX path. Stop here if you're just evaluating the plugin. Con
80
94
 
81
95
  Each skill is a vetted, end-to-end playbook. Ask OpenCode in natural language or invoke a skill directly:
82
96
 
97
+ **Start here — add Ory auth to your app:**
98
+
83
99
  - **`ory-auth-setup`** — full project setup. Install the Ory CLI, create an Ory Network project (or use the local one), add Ory Elements, configure the SDK, build the auth pages, wire session middleware.
84
100
  - **`ory-login-flow`** — login, registration, recovery, verification, and settings pages with Ory Elements. Next.js App Router and React SPA variants.
85
101
  - **`ory-social-login`** — Google, GitHub, Apple, Microsoft, Discord, and other OIDC providers with Jsonnet data mappers.
86
102
  - **`ory-local-dev`** — drive the local Ory stack from within OpenCode to prototype and test without a remote project.
87
- - **`ory-permissions-onboarding`** — bootstrap permission tuples for built-in tools, switch between observe and enforce mode, troubleshoot denials.
103
+
104
+ **Going further:**
105
+
106
+ - **`ory-permissions-onboarding`** — bootstrap permissions for built-in tools, switch between observe and enforce mode, troubleshoot denials.
88
107
  - **`ory-build-integration`** — pull the runnable subset of an `ory/integrates` template (webhook / config / http-event) into your own app and wire it to your Ory project — no contribution/registry concerns.
89
108
  - **`ory-contribute-integration`** — author a brand-new integration as a contribution to `ory/integrates`, including `registry.entry.yaml`, the `Maintained by:` footer, DCO sign-off, and registry regeneration.
90
109
  - **`ory-e2b-sandbox`** — scaffold an [E2B](https://e2b.dev) sandbox template that boots with this plugin preinstalled and registered, so every sandbox session is gated by Ory auth, permissions, and tracing without any per-sandbox setup.
@@ -93,7 +112,7 @@ Each skill is a vetted, end-to-end playbook. Ask OpenCode in natural language or
93
112
 
94
113
  ### Ory MCP server
95
114
 
96
- Bundled and registered by the Ory installer. Exposes the Ory CLI and the Ory Network REST API as MCP tools so OpenCode can manage identities, OAuth2 clients, projects, permission tuples, and configuration without ever leaving the chat. Useful for seeding test data, verifying a scaffolded integration, or running one-off admin tasks.
115
+ Bundled and registered by the Ory installer. Exposes the Ory CLI and the Ory Network REST API as MCP tools so OpenCode can manage identities, OAuth2 clients, projects, permissions, and configuration without ever leaving the chat. Useful for seeding test data, verifying a scaffolded integration, or running one-off admin tasks.
97
116
 
98
117
  ### Local Ory stack
99
118
 
@@ -103,16 +122,16 @@ Bundled and registered by the Ory installer. Exposes the Ory CLI and the Ory Net
103
122
  /ory:temporal-up # start a local Temporal dev server (for ory-temporal-worker)
104
123
  ```
105
124
 
106
- `local-up` brings up Ory Identities, OAuth2, and Permissions, plus a login UI on `:3000` and Jaeger on `:16686`, all reachable through `http://localhost:4000`. A test user identity is seeded and the credentials are printed for you. Use it to:
125
+ `local-up` runs a complete Ory on your laptop: the Ory APIs (Identities, OAuth2, Permissions) at `http://localhost:4000`, a login UI on `:4455` (not :3000, to avoid Next.js port conflicts), and Jaeger (the trace viewer) on `:16686`. A test user identity is seeded and its credentials are printed for you. Use it to:
107
126
 
108
127
  - **Learn Ory hands-on** without signing up for a hosted project.
109
- - **Prototype** flows (login, social, MFA, recovery, permission tuples) against a real Ory backend.
128
+ - **Prototype** flows (login, social, MFA, recovery, permissions) against a real Ory backend.
110
129
  - **Test** an auth integration end-to-end before pushing anything to a real environment.
111
130
  - **Develop** your application against the same identity, OAuth2, and permission surfaces you'll ship with.
112
131
 
113
132
  ## Pointing at a real Ory project
114
133
 
115
- The Quickstart uses the local stack. If you have a hosted [Ory Network](https://console.ory.sh) project, point the plugin at it with a single configure command. **The plugin requires `--oauth2-client-id` whenever `--project-url` is provided** — register the client first (see [Register the user OAuth2 client](#register-the-user-oauth2-client) below), then run:
134
+ The Quickstart uses the local stack. If you have a hosted [Ory Network](https://console.ory.sh) project (Ory's managed cloud), point the plugin at it with a single configure command. **The plugin requires `--oauth2-client-id` whenever `--project-url` is provided** — register the client first (see [Register the user OAuth2 client](#register-the-user-oauth2-client) below), then run:
116
135
 
117
136
  ```bash
118
137
  npx -y -p @ory/opencode ory-opencode configure \
@@ -186,10 +205,10 @@ Headless / CI runs that already hold a session token can skip this entirely by s
186
205
  Once the plugin is pointed at an Ory project (local or hosted), OpenCode's session and every tool call can be governed by Ory.
187
206
 
188
207
  - **Authentication.** Two identities. The human at the keyboard (the **user**) authenticates interactively via Ory Identities when user login is enabled (`ORY_USER_LOGIN=true`, off by default — browser PKCE flow on first session, persisted token thereafter). The OpenCode process (the **agent**) gets its own OAuth2 identity, self-registered via [Dynamic Client Registration (RFC 7591)](https://datatracker.ietf.org/doc/html/rfc7591) on first run.
189
- - **Authorization.** When OpenCode prompts for permission to use a tool, the plugin checks [Ory Permissions](https://www.ory.com/docs/keto) (Zanzibar-style relation tuples) against the user's subject and returns `allow` / `deny`. A parallel pre-tool check is recorded as part of the audit trail. MCP tool calls additionally get a server-level check.
190
- - **Audit.** Every decision (allow, deny, fallback) is recorded as a structured trace span: NDJSON file output and/or OTLP/HTTP export to Jaeger, Honeycomb, Grafana, and similar collectors. The user → agent delegation is written to Ory as a relation tuple so *"agent X acting on behalf of user Y"* stays queryable after tokens expire.
208
+ - **Authorization.** When OpenCode prompts for permission to use a tool, the plugin checks [Ory Permissions](https://www.ory.com/docs/keto) (Zanzibar-style relations) against the user's subject. In **enforce** mode a deny blocks the tool by throwing an `OryDenialError` (OpenCode surfaces the denial reason); in **observe** mode (default) the deny is recorded as a `permission.observe_deny` span and the tool runs. A parallel pre-tool check is recorded as part of the audit trail. MCP tool calls additionally get a server-level check.
209
+ - **Audit.** Every decision (allow, deny, fallback) is recorded as a structured trace span: NDJSON file output and/or OTLP/HTTP export to Jaeger, Honeycomb, Grafana, and similar collectors. The user → agent delegation is written to Ory as a relation so *"agent X acting on behalf of user Y"* stays queryable after tokens expire.
191
210
 
192
- The plugin is **fail-open** on its own infrastructure failures (network errors, rate limits, missing config), so enforcement is only as strong as your tuples — grant explicit `invoke` relations for the tools each user should be able to run.
211
+ The plugin is **fail-open** on its own infrastructure failures (network errors, rate limits, missing config), so enforcement is only as strong as your permission grants — grant explicit `use` on the tools each user should be able to run.
193
212
 
194
213
  ### Enable enforcement
195
214
 
@@ -206,7 +225,7 @@ After install the plugin runs in **observe mode**: every tool call is checked ag
206
225
 
207
226
  `ORY_OAUTH2_CLIENT_ID` is required when `ORY_USER_LOGIN` is on: PKCE needs a public OAuth2 client registered with the four loopback redirect URIs (`http://127.0.0.1:47823..47826/callback`) to exchange the authorization code for a token. The local stack provisions one and prints the export in its `local up` banner; for a hosted Ory project see [Register the user OAuth2 client](#register-the-user-oauth2-client) for the exact CLI / Console steps. Headless / CI runs can skip the browser flow entirely by pre-supplying `ORY_USER_SESSION_TOKEN` instead.
208
227
 
209
- 2. **Bootstrap tuples for the built-in tools.** One idempotent command grants the current user `use` on every tool OpenCode ships with (read, write, edit, bash, …):
228
+ 2. **Bootstrap permissions for the built-in tools.** One idempotent command grants the current user `use` on every tool OpenCode ships with (read, write, edit, bash, …):
210
229
 
211
230
  ```bash
212
231
  npx -y -p @ory/opencode ory-opencode permissions bootstrap
@@ -220,7 +239,7 @@ After install the plugin runs in **observe mode**: every tool call is checked ag
220
239
  npx -y -p @ory/opencode ory-opencode permissions status
221
240
  ```
222
241
 
223
- Add tuples for any MCP server tools or custom commands by hand, or via the Ory MCP server from inside OpenCode (*"grant me use on the bash tool"*).
242
+ Add permissions for any MCP server tools or custom commands by hand, or via the Ory MCP server from inside OpenCode (*"grant me use on the bash tool"*).
224
243
 
225
244
  4. **Promote to enforce.** Once the observe-mode logs look right, switch over:
226
245
 
@@ -244,13 +263,13 @@ npx -y -p @ory/opencode ory-opencode status [--projec
244
263
  Highlights:
245
264
 
246
265
  - `agent status` — show the current persisted DCR identity for the agent.
247
- - `permissions observe` / `permissions enforce` — switch between "log denies, allow through" (the install default) and "block denies." `permissions bootstrap` writes `use` tuples for the harness's built-in tools so the promotion path doesn't require hand-writing relationships.
266
+ - `permissions observe` / `permissions enforce` — switch between "log denies, allow through" (the install default) and "block denies." `permissions bootstrap` writes `use` permissions for the harness's built-in tools so the promotion path doesn't require hand-writing relations.
248
267
  - `configure --audit-only` — kill switch that disables Ory entirely (no auth, no permission checks; only audit logging of tool invocations). For phased rollouts, prefer `permissions observe` over `--audit-only`.
249
268
  - `local seed` / `local env` — reseed the test user, or print env vars for pointing other tools at the local stack.
250
269
 
251
270
  ## Troubleshooting
252
271
 
253
- - **`/ory:local-up` fails.** Make sure Docker is running and ports `3000`, `4000`, `4100`, and `16686` are free.
272
+ - **`/ory:local-up` fails.** Make sure Docker is running and ports `4455` (login UI), `4000`, `4100`, and `16686` are free.
254
273
  - **PKCE login loops.** Clear persisted state with `npx -y -p @ory/opencode ory-opencode agent unregister` and retry.
255
274
  - **`npx` fetches an old version.** Force a fresh fetch: `npx -y -p @ory/opencode@latest ory-opencode …`.
256
275
  - **`npm error code ENOVERSIONS` on install.** Your npm has a supply-chain freshness filter (`min-release-age`) that's hiding all `@ory/opencode` versions newer than its threshold. Either wait it out, or run the installer with `--min-release-age=0`: `npx -y --min-release-age=0 -p @ory/opencode ory-opencode install`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ory/opencode",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Ory plugin for OpenCode: scaffolding skills, a local Ory instance, and authentication, authorization, and audit for every tool call",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://ory.com",
@@ -63,7 +63,7 @@
63
63
  "!dist/**/*.tsbuildinfo"
64
64
  ],
65
65
  "dependencies": {
66
- "@ory/argus": "0.9.0"
66
+ "@ory/argus": "0.10.0"
67
67
  },
68
68
  "engines": {
69
69
  "node": ">=22"