@ory/gemini-cli 0.9.1 → 0.11.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 CHANGED
@@ -45,8 +45,8 @@ npx -y -p @ory/gemini-cli ory-gemini status
45
45
  <summary>Alternative install paths</summary>
46
46
 
47
47
  ```bash
48
- npx -y @ory/gemini-cli install
49
- npx -y @ory/gemini-cli uninstall
48
+ npx -y -p @ory/gemini-cli ory-gemini install
49
+ npx -y -p @ory/gemini-cli ory-gemini uninstall
50
50
  ```
51
51
 
52
52
  If the `gemini` binary isn't on your `PATH`, `npx -y -p @ory/gemini-cli ory-gemini-setup` writes the extension config directly into your project's `.gemini/settings.json`.
@@ -116,7 +116,7 @@ Bundled and registered automatically. Exposes the Ory CLI and the Ory Network RE
116
116
  /ory:temporal-up # start a local Temporal dev server (for ory-temporal-worker)
117
117
  ```
118
118
 
119
- `local-up` runs a complete Ory on your laptop: the Ory APIs (Identities, OAuth2, Permissions) at `http://localhost:4000`, a login UI on `:3000`, and Jaeger (the trace viewer) on `:16686`. A test user identity is seeded and its credentials are printed for you. Use it to:
119
+ `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:
120
120
 
121
121
  - **Learn Ory hands-on** without signing up for a hosted project.
122
122
  - **Prototype** flows (login, social, MFA, recovery, permissions) against a real Ory backend.
@@ -264,7 +264,7 @@ Highlights:
264
264
 
265
265
  ## Troubleshooting
266
266
 
267
- - **`/ory:local-up` fails.** Make sure Docker is running and ports `3000`, `4000`, `4100`, and `16686` are free.
267
+ - **`/ory:local-up` fails.** Make sure Docker is running and ports `4455` (login UI), `4000`, `4100`, and `16686` are free.
268
268
  - **PKCE login loops.** Clear persisted state with `npx -y -p @ory/gemini-cli ory-gemini agent unregister` and retry.
269
269
  - **`npx` fetches an old version.** Force a fresh fetch: `npx -y -p @ory/gemini-cli@latest ory-gemini …`.
270
270
  - **Need more signal.** Set `ORY_AGENT_DEBUG=true` and `ORY_AGENT_LOG_FILE=/tmp/ory.log` to capture structured logs.
package/dist/handlers.js CHANGED
@@ -65,6 +65,12 @@ async function handleSessionStart(input, client, deps) {
65
65
  // attaches the agent's bearer token to outgoing Ory API calls.
66
66
  const agentGate = deps.agentGate ?? argus_1.ensureAgentIdentity;
67
67
  await agentGate(client, { projectUrl: (0, argus_1.resolveConfig)().projectUrl, harness: "gemini-cli" });
68
+ // Record the user→agent delegation so the audit trail captures that
69
+ // this user authorized this agent for this session. Best-effort:
70
+ // requires both principals to be populated, and any failure is logged
71
+ // and swallowed (fail-open — delegation tracking is for audit, not
72
+ // enforcement).
73
+ await recordUserDelegatesAgent(client);
68
74
  if (!decision.proceed) {
69
75
  return { decision: "deny", reason: decision.reason };
70
76
  }
@@ -330,6 +336,40 @@ async function handlePreCompress(input, client) {
330
336
  function resolveNamespace() {
331
337
  return process.env.ORY_PERMISSION_NAMESPACE ?? "AgentTools";
332
338
  }
339
+ /**
340
+ * Write the user→agent delegation tuple. Idempotent and fail-open:
341
+ * requires both principal subjects to be populated; any error (including
342
+ * an unconfigured projectUrl, which manifests as a network_error) is
343
+ * logged and swallowed. Purely audit-trail data — does not affect
344
+ * enforcement.
345
+ */
346
+ async function recordUserDelegatesAgent(client) {
347
+ const user = client.userPrincipal.subject;
348
+ const agent = client.agentPrincipal.subject;
349
+ if (!user || !agent) {
350
+ client.logger.debug("delegation.skip", {
351
+ reason: "missing principal",
352
+ hasUser: !!user,
353
+ hasAgent: !!agent,
354
+ });
355
+ return;
356
+ }
357
+ try {
358
+ await client.createRelationship({
359
+ namespace: resolveNamespace(),
360
+ object: `agent:${agent}`,
361
+ relation: "delegate",
362
+ subjectId: `user:${user}`,
363
+ }, { spanAttributes: { delegation: "user-to-agent" } });
364
+ }
365
+ catch (err) {
366
+ const oryErr = err;
367
+ client.logger.warn("delegation.user_to_agent.failed", {
368
+ code: oryErr.code,
369
+ message: oryErr.message,
370
+ });
371
+ }
372
+ }
333
373
  function handlePermissionError(oryErr, toolName, client) {
334
374
  if (oryErr.code === "network_error") {
335
375
  client.logger.warn("permission.network_error", {
@@ -24,7 +24,7 @@ tool call.
24
24
  ## Slash commands
25
25
 
26
26
  - `/ory:local-up` — start a local Ory instance in Docker (Identities, OAuth2,
27
- Permissions, plus a login UI on `:3000` and Jaeger on `:16686`, reachable
27
+ Permissions, plus a login UI on `:4455` (not :3000, to avoid Next.js port conflicts) and Jaeger on `:16686`, reachable
28
28
  through `http://localhost:4000`). Prints seeded test-user credentials.
29
29
  - `/ory:local-down` — tear it all down.
30
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ory/gemini-cli",
3
- "version": "0.9.1",
3
+ "version": "0.11.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",
@@ -68,7 +68,7 @@
68
68
  "gemini-extension"
69
69
  ],
70
70
  "dependencies": {
71
- "@ory/argus": "0.9.1"
71
+ "@ory/argus": "0.11.0"
72
72
  },
73
73
  "engines": {
74
74
  "node": ">=22"