@ory/gemini-cli 0.10.0 → 0.11.1

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`.
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", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ory/gemini-cli",
3
- "version": "0.10.0",
3
+ "version": "0.11.1",
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.10.0"
71
+ "@ory/argus": "0.11.1"
72
72
  },
73
73
  "engines": {
74
74
  "node": ">=22"