@ory/openclaw 0.6.2 → 0.7.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.
- package/README.md +6 -6
- package/dist/plugin.d.ts +4 -4
- package/dist/plugin.js +10 -10
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -43,13 +43,13 @@ From any project where you'd like Ory authentication, inside OpenClaw:
|
|
|
43
43
|
|
|
44
44
|
3. **Sign in.** Start your app, visit the login page OpenClaw added, and sign in with the seeded credentials. You now have a real Ory session backed by a real Ory stack — locally, offline, with zero configuration.
|
|
45
45
|
|
|
46
|
-
4. **Turn on Ory login for the OpenClaw session itself.** *(Optional but recommended.)* Out of the box the plugin only governs your *app*. To also attach an Ory identity to *OpenClaw's* session — so every tool call is attributed to you, not a fallback `session:<id>` subject —
|
|
46
|
+
4. **Turn on Ory login for the OpenClaw session itself.** *(Optional but recommended.)* Out of the box the plugin only governs your *app*. To also attach an Ory identity to *OpenClaw's* session — so every tool call is attributed to you, not a fallback `session:<id>` subject — opt in to the user-login flow:
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
|
-
export
|
|
49
|
+
export ORY_USER_LOGIN=1
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
User login is off by default. With it on, the next OpenClaw session opens an Ory login in your browser; sign in with the same seeded credentials from step 1, and the token is reused on subsequent sessions until it expires. This is what makes `permissions enforce` (see [Agent security](#agent-security)) deny on the right identity later. (Note: OpenClaw's session-start primitive can't hard-block, so the flow runs in advisory mode at session start — auth still happens and the audit trail is correct, but the session always proceeds. Tool-call enforcement is unaffected.)
|
|
53
53
|
|
|
54
54
|
That's the full Ory DX path. Stop here if you're just evaluating the plugin. Continue to [Agent security](#agent-security) when you're ready to enforce.
|
|
55
55
|
|
|
@@ -108,7 +108,7 @@ Without configuration the plugin still loads cleanly and runs in **pass-through
|
|
|
108
108
|
|
|
109
109
|
Once the plugin is pointed at an Ory project (local or hosted), OpenClaw's session and every tool call can be governed by Ory.
|
|
110
110
|
|
|
111
|
-
- **Authentication.** Two identities. The human at the keyboard (the **user**) authenticates interactively via Ory Identities when `
|
|
111
|
+
- **Authentication.** Two identities. The human at the keyboard (the **user**) authenticates interactively via Ory Identities when user login is enabled (`ORY_USER_LOGIN=1`, off by default — browser PKCE flow on first session, persisted token thereafter). The OpenClaw 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.
|
|
112
112
|
- **Authorization.** Before any tool runs, the plugin checks [Ory Permissions](https://www.ory.com/docs/keto) (Zanzibar-style relation tuples) against the user's subject and blocks the call on `deny`. MCP tool calls additionally get a server-level check.
|
|
113
113
|
- **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.
|
|
114
114
|
|
|
@@ -118,10 +118,10 @@ The plugin is **fail-open** on its own infrastructure failures (network errors,
|
|
|
118
118
|
|
|
119
119
|
After install the plugin runs in **observe mode**: every tool call is checked against Ory Permissions, but a deny is recorded as a `permission.observe_deny` audit span and the tool runs anyway. This lets you see what *would* be blocked before turning on hard blocking.
|
|
120
120
|
|
|
121
|
-
1. **Turn on
|
|
121
|
+
1. **Turn on user login.** It's off by default. In your shell:
|
|
122
122
|
|
|
123
123
|
```bash
|
|
124
|
-
export
|
|
124
|
+
export ORY_USER_LOGIN=1
|
|
125
125
|
```
|
|
126
126
|
|
|
127
127
|
The next OpenClaw session refreshes or prompts for PKCE login. Subsequent sessions reuse the persisted token until it expires.
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { OryAgentClient, ensureUserAuthenticated, ensureAgentIdentity, ensureSubAgentIdentity } from "@ory/argus";
|
|
2
2
|
import type { OpenClawPluginEntry } from "./types.js";
|
|
3
3
|
export interface CreateOryPluginDeps {
|
|
4
|
-
/** Test injection point for the user
|
|
5
|
-
|
|
4
|
+
/** Test injection point for the user login flow. */
|
|
5
|
+
userLogin?: typeof ensureUserAuthenticated;
|
|
6
6
|
/** Test injection point for the agent identity gate. */
|
|
7
7
|
agentGate?: typeof ensureAgentIdentity;
|
|
8
8
|
/** Test injection point for the sub-agent identity resolver. */
|
|
@@ -17,8 +17,8 @@ export interface CreateOryPluginDeps {
|
|
|
17
17
|
* makes permission checks enforceable, unlike harnesses that can only
|
|
18
18
|
* log denials.
|
|
19
19
|
*
|
|
20
|
-
* The `session_start` hook returns `Promise<void>` so
|
|
21
|
-
* advisory at session start: the
|
|
20
|
+
* The `session_start` hook returns `Promise<void>` so user login is
|
|
21
|
+
* advisory at session start: the flow still runs to emit the audit span,
|
|
22
22
|
* refresh tokens, and prompt for the project URL when interactive, but
|
|
23
23
|
* cannot hard-block the session.
|
|
24
24
|
*/
|
package/dist/plugin.js
CHANGED
|
@@ -11,8 +11,8 @@ const argus_1 = require("@ory/argus");
|
|
|
11
11
|
* makes permission checks enforceable, unlike harnesses that can only
|
|
12
12
|
* log denials.
|
|
13
13
|
*
|
|
14
|
-
* The `session_start` hook returns `Promise<void>` so
|
|
15
|
-
* advisory at session start: the
|
|
14
|
+
* The `session_start` hook returns `Promise<void>` so user login is
|
|
15
|
+
* advisory at session start: the flow still runs to emit the audit span,
|
|
16
16
|
* refresh tokens, and prompt for the project URL when interactive, but
|
|
17
17
|
* cannot hard-block the session.
|
|
18
18
|
*/
|
|
@@ -30,7 +30,7 @@ function createOryPlugin(clientOrConfig, deps = {}) {
|
|
|
30
30
|
})
|
|
31
31
|
: argus_1.OryAgentClient.fromEnv("openclaw");
|
|
32
32
|
api.registerHook("session_start", createSessionStartHandler(client, deps), { name: "ory.session-verify", description: "Verify session via Ory Identities" });
|
|
33
|
-
api.registerHook("before_agent_run", createBeforeAgentRunHandler(client, deps), { name: "ory.user-
|
|
33
|
+
api.registerHook("before_agent_run", createBeforeAgentRunHandler(client, deps), { name: "ory.user-login", description: "Block runs when the user login denies" });
|
|
34
34
|
api.registerHook("before_tool_call", createBeforeToolCallHandler(client), { name: "ory.permission-check", description: "Check tool permissions via Ory Permissions" });
|
|
35
35
|
api.registerHook("after_tool_call", createAfterToolCallHandler(client), { name: "ory.trace-complete", description: "Record tool completion trace" });
|
|
36
36
|
api.registerHook("subagent_spawning", createSubagentSpawningHandler(client, deps), { name: "ory.subagent-register", description: "Register Ory identity and write delegation tuple for spawned sub-agent" });
|
|
@@ -51,13 +51,13 @@ function createSessionStartHandler(client, deps) {
|
|
|
51
51
|
traceId: (0, argus_1.deriveTraceId)(ctx.sessionId),
|
|
52
52
|
sessionId: ctx.sessionId,
|
|
53
53
|
});
|
|
54
|
-
// Run the user
|
|
55
|
-
// (handler returns void), so allowBlock is false —
|
|
54
|
+
// Run the user login. session_start cannot hard-block in OpenClaw
|
|
55
|
+
// (handler returns void), so allowBlock is false — it still emits
|
|
56
56
|
// the user.auth audit span, refreshes tokens, and prompts for the
|
|
57
|
-
// project URL when interactive. When
|
|
57
|
+
// project URL when interactive. When ORY_USER_LOGIN is unset this is
|
|
58
58
|
// a no-op (mode === "disabled") and we fall through to the legacy
|
|
59
59
|
// verification path.
|
|
60
|
-
const userGate = deps.
|
|
60
|
+
const userGate = deps.userLogin ?? argus_1.ensureUserAuthenticated;
|
|
61
61
|
const decision = await userGate(client, {
|
|
62
62
|
binName: "ory-openclaw",
|
|
63
63
|
harness: "openclaw",
|
|
@@ -338,10 +338,10 @@ function createAfterToolCallHandler(client) {
|
|
|
338
338
|
// ─── before_agent_run ──────────────────────────────────────────────
|
|
339
339
|
//
|
|
340
340
|
// Real per-turn enforcement gate. `session_start` cannot hard-block in
|
|
341
|
-
// OpenClaw (handler returns void), so the user
|
|
341
|
+
// OpenClaw (handler returns void), so the user login runs there in
|
|
342
342
|
// advisory mode. `before_agent_run` is the first hook OpenClaw exposes
|
|
343
343
|
// that can return a block decision on the user prompt — we re-run the
|
|
344
|
-
//
|
|
344
|
+
// login here so denied users can't drive the agent. `ensureUserAuthenticated`
|
|
345
345
|
// reuses persisted tokens, so per-turn calls are non-interactive after
|
|
346
346
|
// the first session.
|
|
347
347
|
function createBeforeAgentRunHandler(client, deps) {
|
|
@@ -350,7 +350,7 @@ function createBeforeAgentRunHandler(client, deps) {
|
|
|
350
350
|
traceId: (0, argus_1.deriveTraceId)(ctx.sessionKey ?? ctx.sessionId ?? "openclaw"),
|
|
351
351
|
sessionId: ctx.sessionKey ?? ctx.sessionId,
|
|
352
352
|
});
|
|
353
|
-
const userGate = deps.
|
|
353
|
+
const userGate = deps.userLogin ?? argus_1.ensureUserAuthenticated;
|
|
354
354
|
const decision = await userGate(client, {
|
|
355
355
|
binName: "ory-openclaw",
|
|
356
356
|
harness: "openclaw",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ory/openclaw",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Ory plugin for OpenClaw: 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",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"!dist/**/*.tsbuildinfo"
|
|
66
66
|
],
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@ory/argus": "0.
|
|
68
|
+
"@ory/argus": "0.7.0"
|
|
69
69
|
},
|
|
70
70
|
"engines": {
|
|
71
71
|
"node": ">=22"
|