Skip to content

Commit 3abdc0e

Browse files
committed
chore(ory-codex): release v1.10.0
1 parent d7c6e19 commit 3abdc0e

3 files changed

Lines changed: 44 additions & 18 deletions

File tree

‎plugins/ory-codex/.codex-plugin/plugin.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ory-codex",
3-
"version": "1.9.2",
3+
"version": "1.10.0",
44
"description": "Ory authentication, authorization, and audit for every Codex tool call.",
55
"author": {
66
"name": "Ory",

‎plugins/ory-codex/README.md‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ One command installs two independent halves:
1212
## What you'll need
1313

1414
- [Codex](https://github.com/openai/codex), installed and signed in
15+
<!-- BEGIN GENERATED requirements -->
1516
- Node.js **22 or newer**
1617
- [Docker](https://docs.docker.com/get-docker/) — only if you want to run Ory locally
1718
- macOS or Linux (Windows works via WSL2)
19+
<!-- END GENERATED requirements -->
1820

1921
## Get started
2022

@@ -72,7 +74,7 @@ Out of the box, every tool Codex runs produces a privacy-safe structured activit
7274
Once you connect to Ory Agent Security, two more things happen automatically:
7375

7476
- **Who's driving.** You sign in once in your browser; Codex (and any sub-agents it spawns) each get their own identity. No tokens to copy around, and the "who acted on whose behalf" trail stays queryable later.
75-
- **What it's allowed to do.** Before a tool runs, Ory checks whether it's permitted. It starts in **observe mode** — nothing is blocked, you just *see* what would be — so it never gets in your way on day one.
77+
- **What it's allowed to do.** Before a tool runs, Ory checks whether it's permitted. It starts in **observe mode** — nothing is blocked, you just *see* what would be — so it never gets in your way on day one. In observe mode, Codex still shows its own approval prompt for a tool Ory would deny.
7678

7779
If Ory is ever unreachable, the plugin gets out of the way and lets Codex keep working — so it can't lock you out.
7880

@@ -101,6 +103,7 @@ Then a denied tool is actually blocked and Codex shows why.
101103

102104
## Connect to Ory Agent Security
103105

106+
<!-- BEGIN GENERATED connect -->
104107
Copy the connection details from the [Ory Console](https://console.ory.sh) under **Agent Security**:
105108

106109
| Value | Flag | Environment variable |
@@ -123,7 +126,10 @@ npx -y -p @ory/codex ory-codex configure \
123126

124127
Sign-in runs at the start of every session and never blocks — a declined, skipped, or timed-out login simply leaves that session without a user identity.
125128

129+
When a login is declined, times out, or fails, Codex shows a warning that sign-in did not complete (and tells the model, so it can explain a later denial).
130+
126131
Settings are saved to `~/.config/ory-agent-plugins/config.json` and shared across all your Ory agent plugins; environment variables win when both are set. Running headless with an OAuth2 access token already? Set `ORY_USER_OAUTH2_TOKEN` and the browser step is skipped entirely.
132+
<!-- END GENERATED connect -->
127133

128134
## Commands
129135

@@ -143,15 +149,17 @@ The local stack runs a complete Ory on your laptop: the Ory APIs at `http://loca
143149

144150
## Troubleshooting
145151

146-
- **`local up` fails** — make sure Docker is running and ports `4000`, `4100`, `4455`, and `16686` are free.
152+
- **`local up` fails** — <!-- BEGIN GENERATED local-stack-ports -->make sure Docker is running and ports `4000`, `4100`, and `4455` are free.<!-- END GENERATED local-stack-ports -->
147153
- **Browser sign-in loops** (after connecting) — confirm the reserved login client has all four documented loopback redirect URIs; `agent unregister` only clears legacy agent OAuth state.
148154
- **Running an older CLI than expected** — `npx -p @ory/codex` (no version pin) reuses a previously-downloaded copy instead of re-resolving to the latest. The install banner prints the running version; confirm it with `npx -y -p @ory/codex ory-codex version`. To force the current release, clear the cache and reinstall: `rm -rf ~/.npm/_npx` then `npx -y -p @ory/codex ory-codex install`. Pinning an exact version (`@ory/codex@<version>`) also bypasses the cached copy.
149155
- **`npm install … ENOVERSIONS`** — if your `~/.npmrc` sets `min-release-age`, npm hides versions newer than that. Override per-call: `npm_config_min_release_age=0 npx -y -p @ory/codex ory-codex install`.
150156
- **`codex doctor` says `ory-mcp-server is not resolvable`** — the bundled tool server is fetched on demand via `npx`, so make sure `npm`/`npx` is on your PATH. The first session downloads it; later ones reuse the cache.
151157

152158
## Learn more
153159

160+
<!-- BEGIN GENERATED ory-links -->
154161
- [Ory documentation](https://www.ory.com/docs/) · [Ory Console](https://console.ory.sh) · [Ory Elements](https://github.com/ory/elements)
162+
<!-- END GENERATED ory-links -->
155163
- [Codex documentation](https://github.com/openai/codex)
156164

157165
## License

‎plugins/ory-codex/skills/ory-build-agent/SKILL.md‎

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ wrap each tool dispatch with the gate from Step 4.
3636

3737
| SDK | Language | Where Ory hooks in |
3838
|---|---|---|
39-
| Claude Agent SDK (`@anthropic-ai/claude-agent-sdk`) | TypeScript / Python | `canUseTool` callback on `query({...})` |
39+
| Claude Agent SDK (`@anthropic-ai/claude-agent-sdk`) | TypeScript / Python | `PreToolUse` hook on `query({ options: { hooks } })` (or `@ory/claude-agent-sdk`) |
4040
| OpenAI Agents SDK (`@openai/agents`) | TypeScript | Per-tool `execute` wrapper or `RunHooks.onToolStart` |
4141
| Salesforce Agentforce (Agent Builder) | declarative + Apex | External Service / side-car — see "Salesforce" below |
4242
| Mastra (`@mastra/core`) | TypeScript | Higher-order wrapper around each tool's `execute` |
@@ -119,33 +119,51 @@ complete(client, { toolName, output });
119119

120120
### Claude Agent SDK
121121

122-
The Claude Agent SDK exposes a `canUseTool` callback that fires before every
123-
tool invocation. Drop the gate there:
122+
Prefer `@ory/claude-agent-sdk`: `createOryHooks()` wires every hook below. To wire
123+
it by hand, gate in a `PreToolUse` hook. It runs for every tool call, including
124+
tools the SDK auto-approves. Do not rely on `canUseTool` for enforcement: the SDK
125+
never calls it for auto-approved tools (`allowedTools`, `bypassPermissions`,
126+
`acceptEdits`, read-only Bash, reads inside the working directory).
124127

125128
```ts
126-
import { query } from "@anthropic-ai/claude-agent-sdk";
129+
import { query, type HookCallback, type PreToolUseHookInput } from "@anthropic-ai/claude-agent-sdk";
130+
import { parseClaudeCodeMcpTool } from "@ory/argus";
131+
132+
const oryPreToolUse: HookCallback = async (input) => {
133+
const { tool_name, tool_input } = input as PreToolUseHookInput;
134+
const result = await gate(client, {
135+
harness: "my-agent",
136+
toolName: tool_name,
137+
toolArgs: tool_input,
138+
mcpTool: parseClaudeCodeMcpTool(tool_name) ?? undefined,
139+
});
140+
if (!result.blocked) return {};
141+
return {
142+
hookSpecificOutput: {
143+
hookEventName: "PreToolUse",
144+
permissionDecision: "deny",
145+
permissionDecisionReason: result.denialMessage,
146+
},
147+
};
148+
};
127149

128150
const stream = query({
129151
prompt,
130152
options: {
131-
canUseTool: async (toolName, input, { signal }) => {
132-
const sessionId = currentSessionId(); // your own correlation id
133-
const gate = await gateTool(toolName, sessionId);
134-
if (!gate.allow) {
135-
return { behavior: "deny", message: gate.message };
136-
}
137-
return { behavior: "allow", updatedInput: input };
153+
hooks: {
154+
// Optional: add onFailure: "block" (Agent SDK v0.3.317+) to block the tool if the
155+
// hook throws instead of failing open.
156+
PreToolUse: [{ hooks: [oryPreToolUse] }],
138157
},
139158
},
140159
});
141160

142161
for await (const msg of stream) { /* standard handling */ }
143162
```
144163

145-
`canUseTool` only fires for tools the SDK controls. If the agent also
146-
registers MCP servers, gate each MCP tool handler the same way and pass
147-
`mcpTool` (from the `@ory/argus` `parseClaudeCodeMcpTool` or `parseMcpToolName`
148-
helpers) so the call is checked against the project's MCP server access.
164+
MCP tools arrive as `mcp__<server>__<tool>`; `parseClaudeCodeMcpTool` turns that
165+
into the `mcpTool` identity so the call is checked against the project's MCP
166+
server access.
149167

150168
### OpenAI Agents SDK
151169

0 commit comments

Comments
 (0)