@ory/gemini-cli 0.13.9 → 0.14.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 +11 -8
- package/dist/cli/main.js +8 -1
- package/dist/handlers.js +5 -77
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -21,12 +21,14 @@ Run one command. It installs the extension and walks you through connecting:
|
|
|
21
21
|
npx -y -p @ory/gemini-cli ory-gemini install
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
This registers the extension — its hooks, skills, `/ory:` slash commands, and the bundled Ory MCP server — then
|
|
24
|
+
This registers the extension — its hooks, skills, `/ory:` slash commands, and the bundled Ory MCP server — then opens a guided setup **in your browser** where you pick how to connect — the default takes just a click:
|
|
25
25
|
|
|
26
26
|
- **Ory Network** *(default)* — sign in, or create a free account, in your browser. The project, keys, permissions, and login are all set up for you. Nothing to configure by hand.
|
|
27
27
|
- **Local** — run a complete Ory on your laptop with Docker. No account, no signup, no keys. Great for trying it out.
|
|
28
28
|
- **Audit-only** — skip Ory entirely and just log what Gemini does.
|
|
29
29
|
|
|
30
|
+
> No browser available (CI, SSH, headless)? The same walkthrough runs right in your terminal instead — or force it with `--no-web`.
|
|
31
|
+
|
|
30
32
|
That's it. Confirm everything landed with:
|
|
31
33
|
|
|
32
34
|
```bash
|
|
@@ -52,6 +54,7 @@ If Ory is ever unreachable, the extension gets out of the way and lets Gemini ke
|
|
|
52
54
|
Everything the plugin does is observable out of the box — no configuration required:
|
|
53
55
|
|
|
54
56
|
- **Status at a glance.** `npx -y -p @ory/gemini-cli ory-gemini status` shows what's configured, who's signed in, how many built-in tools your permissions cover, and the most recent tool-call activity.
|
|
57
|
+
- **Live dashboard.** `npx -y -p @ory/gemini-cli ory-gemini dashboard` opens the same picture in your browser — configuration, identities, permission coverage, Ory service health, and the latest tool-call activity, all refreshing live. From there you can flip **enforcement** on or off, toggle **user login**, and use **Change stack** to reconnect to a different Ory — no CLI required.
|
|
55
58
|
- **Live traces.** Every tool call is recorded as an OpenTelemetry-style span. Watch them stream as the agent works:
|
|
56
59
|
|
|
57
60
|
```bash
|
|
@@ -69,7 +72,7 @@ When the watch-mode logs look right, turn on blocking with one command (setup al
|
|
|
69
72
|
npx -y -p @ory/gemini-cli ory-gemini permissions enforce
|
|
70
73
|
```
|
|
71
74
|
|
|
72
|
-
Now a denied tool is actually blocked and Gemini shows why. Go back to watch mode anytime with `permissions observe`. Use `permissions status` to see what's covered and `permissions bootstrap` to (re-)grant the built-in tools — or just ask Gemini in chat, e.g. *"grant me use of the shell tool."*
|
|
75
|
+
Now a denied tool is actually blocked and Gemini shows why. Go back to watch mode anytime with `permissions observe`. Prefer clicking? The dashboard has the same **Enforce** switch — flip it on, or back to watch mode, without touching the CLI. Use `permissions status` to see what's covered and `permissions bootstrap` to (re-)grant the built-in tools — or just ask Gemini in chat, e.g. *"grant me use of the shell tool."*
|
|
73
76
|
|
|
74
77
|
## Also: add login to your own app
|
|
75
78
|
|
|
@@ -86,11 +89,10 @@ The guided setup covers most people. For scripted or CI setups, or to point at a
|
|
|
86
89
|
```bash
|
|
87
90
|
npx -y -p @ory/gemini-cli ory-gemini configure \
|
|
88
91
|
--project-url https://<slug>.projects.oryapis.com \
|
|
89
|
-
--oauth2-client-id <login client id>
|
|
90
|
-
--user-login
|
|
92
|
+
--oauth2-client-id <login client id>
|
|
91
93
|
```
|
|
92
94
|
|
|
93
|
-
Gemini's own identity registers itself automatically on first run — nothing to create. The `--oauth2-client-id` is the one piece browser sign-in needs, so `configure` won't save a project URL without it; the guided setup makes it for you, or see below to do it by hand. For logging-only with no checks, use `--audit-only`. The matching env vars are `ORY_PROJECT_URL`, `ORY_OAUTH2_CLIENT_ID`,
|
|
95
|
+
Gemini's own identity registers itself automatically on first run — nothing to create. The `--oauth2-client-id` is the one piece browser sign-in needs, so `configure` won't save a project URL without it; the guided setup makes it for you, or see below to do it by hand. For logging-only with no checks, use `--audit-only`. The interactive user login runs every session (always on, non-blocking) and only needs `ORY_OAUTH2_CLIENT_ID` to complete the browser flow. The matching env vars are `ORY_PROJECT_URL`, `ORY_OAUTH2_CLIENT_ID`, and `ORY_AGENT_API_KEY`.
|
|
94
96
|
|
|
95
97
|
<details>
|
|
96
98
|
<summary>Create the sign-in client by hand</summary>
|
|
@@ -106,7 +108,7 @@ Create it with the [Ory CLI](https://www.ory.com/docs/guides/cli/installation):
|
|
|
106
108
|
|
|
107
109
|
```bash
|
|
108
110
|
ory create oauth2-client --project <project-id> \
|
|
109
|
-
--name "
|
|
111
|
+
--name "Ory Agent Security · user login (PKCE)" \
|
|
110
112
|
--grant-type authorization_code,refresh_token \
|
|
111
113
|
--response-type code \
|
|
112
114
|
--scope openid,offline_access \
|
|
@@ -126,11 +128,12 @@ With nothing configured, the extension still loads and runs in **pass-through mo
|
|
|
126
128
|
## Commands
|
|
127
129
|
|
|
128
130
|
```
|
|
129
|
-
ory-gemini install | uninstall Install/remove; --reconfigure re-runs setup, --no-configure skips it
|
|
131
|
+
ory-gemini install | uninstall Install/remove; --reconfigure re-runs setup, --no-web forces the terminal wizard, --no-configure skips it
|
|
130
132
|
ory-gemini status Show configuration, identities, permission coverage, recent activity
|
|
133
|
+
ory-gemini dashboard Open the live browser dashboard (status + service health + Change stack)
|
|
131
134
|
ory-gemini watch Tail the live trace stream (OTel spans)
|
|
132
135
|
ory-gemini permissions <cmd> status | bootstrap | observe (watch) | enforce (block)
|
|
133
|
-
ory-gemini configure <flags> Point at a project by hand (--project-url, --oauth2-client-id, --
|
|
136
|
+
ory-gemini configure <flags> Point at a project by hand (--project-url, --oauth2-client-id, --audit-only)
|
|
134
137
|
ory-gemini agent <status|unregister> Manage Gemini's own auto-created identity
|
|
135
138
|
ory-gemini local <up|down|status|…> Run / manage a local Ory in Docker
|
|
136
139
|
```
|
package/dist/cli/main.js
CHANGED
|
@@ -108,6 +108,12 @@ function main() {
|
|
|
108
108
|
case "watch":
|
|
109
109
|
(0, argus_1.runWatchCommand)("gemini-cli", args);
|
|
110
110
|
break;
|
|
111
|
+
case "dashboard":
|
|
112
|
+
(0, argus_1.runDashboardCommand)("ory-gemini", "gemini-cli", args).then((code) => process.exit(code), (err) => {
|
|
113
|
+
console.error(err.message ?? err);
|
|
114
|
+
process.exit(1);
|
|
115
|
+
});
|
|
116
|
+
break;
|
|
111
117
|
case "version":
|
|
112
118
|
case "--version":
|
|
113
119
|
case "-v":
|
|
@@ -204,7 +210,7 @@ function printQuickstart() {
|
|
|
204
210
|
console.log("Quickstart:");
|
|
205
211
|
console.log(" 1. Inside Gemini, run /ory:local-up to start a local Ory stack.");
|
|
206
212
|
console.log(" 2. Ask Gemini \"add Ory auth to this app\" to scaffold login/signup.");
|
|
207
|
-
console.log(" 3. Set
|
|
213
|
+
console.log(" 3. Set ORY_OAUTH2_CLIENT_ID so the per-session PKCE browser login can complete.");
|
|
208
214
|
}
|
|
209
215
|
async function status() {
|
|
210
216
|
await (0, argus_1.runStatusCommand)("ory-gemini", "gemini-cli", {
|
|
@@ -234,6 +240,7 @@ Commands:
|
|
|
234
240
|
permissions <cmd> Manage permission mode and tool permissions (status, bootstrap, observe, enforce)
|
|
235
241
|
setup [--project-dir] Write hooks directly to settings.json (fallback)
|
|
236
242
|
status Show plugin status and configuration
|
|
243
|
+
dashboard Open the Ory Agent dashboard (system health + configuration)
|
|
237
244
|
watch [trace-file] Tail the trace stream (OTel spans) live
|
|
238
245
|
version Show version and the ory-agent-plugins build commit
|
|
239
246
|
local <cmd> Manage local Ory dev environment (up, down, status, seed, ...)
|
package/dist/handlers.js
CHANGED
|
@@ -55,11 +55,14 @@ async function handleSessionStart(input, client, deps) {
|
|
|
55
55
|
client.tracer.record("session.start", "ok", {
|
|
56
56
|
attributes: { source: input.source },
|
|
57
57
|
});
|
|
58
|
+
// The user login runs every session and never blocks — it refreshes
|
|
59
|
+
// persisted tokens, prompts on a TTY when needed, and emits the user.auth
|
|
60
|
+
// audit span. Enforcement is governed solely by permissionMode at
|
|
61
|
+
// tool-call time.
|
|
58
62
|
const userGate = deps.userLogin ?? argus_1.ensureUserAuthenticated;
|
|
59
|
-
|
|
63
|
+
await userGate(client, {
|
|
60
64
|
binName: "ory-gemini",
|
|
61
65
|
harness: "gemini-cli",
|
|
62
|
-
allowBlock: true,
|
|
63
66
|
});
|
|
64
67
|
// Resolve the agent identity (machine credentials). Never blocks;
|
|
65
68
|
// attaches the agent's bearer token to outgoing Ory API calls.
|
|
@@ -71,83 +74,8 @@ async function handleSessionStart(input, client, deps) {
|
|
|
71
74
|
// any failure is logged and swallowed (fail-open — delegation tracking is
|
|
72
75
|
// for audit, not enforcement).
|
|
73
76
|
await (0, argus_1.writeUserDelegatesAgent)(client);
|
|
74
|
-
if (!decision.proceed) {
|
|
75
|
-
return { decision: "deny", reason: decision.reason };
|
|
76
|
-
}
|
|
77
|
-
if (decision.mode !== "disabled") {
|
|
78
|
-
return {};
|
|
79
|
-
}
|
|
80
|
-
const resolved = (0, argus_1.resolveConfig)();
|
|
81
|
-
if (resolved.auditOnly) {
|
|
82
|
-
client.logger.info("config.audit_only", {
|
|
83
|
-
message: "Audit-only mode enabled. Auth and permission checks are disabled.",
|
|
84
|
-
});
|
|
85
|
-
return {};
|
|
86
|
-
}
|
|
87
|
-
if (!resolved.projectUrl) {
|
|
88
|
-
client.logger.warn("config.not_configured", {
|
|
89
|
-
message: "Ory plugin is not configured. Auth and permission checks are disabled. " +
|
|
90
|
-
"Run 'npx ory-gemini configure' to connect to an Ory project.",
|
|
91
|
-
});
|
|
92
|
-
return {};
|
|
93
|
-
}
|
|
94
|
-
// Try session token first, then OAuth2 token
|
|
95
|
-
const sessionToken = process.env.ORY_SESSION_TOKEN;
|
|
96
|
-
const oauth2Token = process.env.ORY_OAUTH2_TOKEN;
|
|
97
|
-
if (sessionToken) {
|
|
98
|
-
await verifySessionToken(sessionToken, client);
|
|
99
|
-
return {};
|
|
100
|
-
}
|
|
101
|
-
if (oauth2Token) {
|
|
102
|
-
await verifyOAuth2Token(oauth2Token, client);
|
|
103
|
-
return {};
|
|
104
|
-
}
|
|
105
|
-
client.logger.warn("session.no_credentials", {
|
|
106
|
-
message: "Neither ORY_SESSION_TOKEN nor ORY_OAUTH2_TOKEN is set. " +
|
|
107
|
-
"Skipping authentication.",
|
|
108
|
-
});
|
|
109
77
|
return {};
|
|
110
78
|
}
|
|
111
|
-
async function verifySessionToken(token, client) {
|
|
112
|
-
try {
|
|
113
|
-
const session = await client.verifySession(token);
|
|
114
|
-
if (!session.active) {
|
|
115
|
-
client.logger.warn("session.inactive", {
|
|
116
|
-
message: "Ory session is not active. Re-authenticate to enable auth checks.",
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
catch (err) {
|
|
121
|
-
const oryErr = err;
|
|
122
|
-
client.logger.warn("session.verify_failed", {
|
|
123
|
-
code: oryErr.code,
|
|
124
|
-
message: oryErr.message,
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
async function verifyOAuth2Token(token, client) {
|
|
129
|
-
try {
|
|
130
|
-
const tokenInfo = await client.introspectToken(token);
|
|
131
|
-
if (!tokenInfo.active) {
|
|
132
|
-
client.logger.warn("oauth2.token_inactive", {
|
|
133
|
-
message: "Ory OAuth2 token is not active. Obtain a new token to enable auth checks.",
|
|
134
|
-
});
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
client.logger.info("oauth2.session_authenticated", {
|
|
138
|
-
clientId: tokenInfo.clientId,
|
|
139
|
-
subject: tokenInfo.subject,
|
|
140
|
-
scope: tokenInfo.scope,
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
catch (err) {
|
|
144
|
-
const oryErr = err;
|
|
145
|
-
client.logger.warn("oauth2.introspect_failed", {
|
|
146
|
-
code: oryErr.code,
|
|
147
|
-
message: oryErr.message,
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
79
|
// ─── BeforeTool ────────────────────────────────────────────────────
|
|
152
80
|
async function handleBeforeTool(input, client) {
|
|
153
81
|
const toolName = input.tool_name ?? "unknown";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ory/gemini-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Ory extension for Gemini CLI: 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",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
],
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"reo-census": "^1.2.8",
|
|
72
|
-
"@ory/argus": "0.
|
|
72
|
+
"@ory/argus": "0.14.0"
|
|
73
73
|
},
|
|
74
74
|
"engines": {
|
|
75
75
|
"node": ">=22"
|