@ory/goose 0.13.8 → 0.13.9

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.
Files changed (2) hide show
  1. package/dist/handlers.js +3 -36
  2. package/package.json +2 -2
package/dist/handlers.js CHANGED
@@ -69,8 +69,9 @@ async function handleSessionStart(input, client, deps) {
69
69
  // attaches the agent's bearer token to outgoing Ory API calls.
70
70
  const agentGate = deps.agentGate ?? argus_1.ensureAgentIdentity;
71
71
  await agentGate(client, { projectUrl: (0, argus_1.resolveConfig)().projectUrl, harness: "goose" });
72
- // User → agent delegation tuple (best-effort, audit-trail only).
73
- await recordUserDelegatesAgent(client);
72
+ // User → agent delegation tuple (best-effort, audit-trail only). Written
73
+ // at most once per install.
74
+ await (0, argus_1.writeUserDelegatesAgent)(client);
74
75
  if (!decision.proceed) {
75
76
  return { action: "block", message: decision.reason };
76
77
  }
@@ -279,40 +280,6 @@ async function handleTraceOnly(input, client) {
279
280
  function resolveNamespace() {
280
281
  return process.env.ORY_PERMISSION_NAMESPACE ?? "AgentTools";
281
282
  }
282
- /**
283
- * Write the user→agent delegation tuple. Idempotent and fail-open:
284
- * requires both principal subjects to be populated; any error (including
285
- * unconfigured projectUrl, which manifests as a network_error) is logged
286
- * and swallowed. The actual permission enforcement is unchanged — this
287
- * tuple is purely audit-trail data.
288
- */
289
- async function recordUserDelegatesAgent(client) {
290
- const user = client.userPrincipal.subject;
291
- const agent = client.agentPrincipal.subject;
292
- if (!user || !agent) {
293
- client.logger.debug("delegation.skip", {
294
- reason: "missing principal",
295
- hasUser: !!user,
296
- hasAgent: !!agent,
297
- });
298
- return;
299
- }
300
- try {
301
- await client.createRelationship({
302
- namespace: resolveNamespace(),
303
- object: `agent:${agent}`,
304
- relation: "delegate",
305
- subjectId: `user:${user}`,
306
- }, { spanAttributes: { delegation: "user-to-agent" } });
307
- }
308
- catch (err) {
309
- const oryErr = err;
310
- client.logger.warn("delegation.user_to_agent.failed", {
311
- code: oryErr.code,
312
- message: oryErr.message,
313
- });
314
- }
315
- }
316
283
  function handlePermissionError(oryErr, toolName, client) {
317
284
  if (oryErr.code === "network_error") {
318
285
  client.logger.warn("permission.network_error", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ory/goose",
3
- "version": "0.13.8",
3
+ "version": "0.13.9",
4
4
  "description": "Ory plugin for Goose (Block's open-source agent 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",
@@ -67,7 +67,7 @@
67
67
  ],
68
68
  "dependencies": {
69
69
  "reo-census": "^1.2.8",
70
- "@ory/argus": "0.13.8"
70
+ "@ory/argus": "0.13.9"
71
71
  },
72
72
  "devDependencies": {
73
73
  "typescript": "^6.0.2",