@ory/openclaw 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/plugin.js +6 -63
  2. package/package.json +2 -2
package/dist/plugin.js CHANGED
@@ -68,11 +68,11 @@ function createSessionStartHandler(client, deps) {
68
68
  const agentGate = deps.agentGate ?? argus_1.ensureAgentIdentity;
69
69
  await agentGate(client, { projectUrl: (0, argus_1.resolveConfig)().projectUrl, harness: "openclaw" });
70
70
  // Record the user→agent delegation so the audit trail captures that
71
- // this user authorized this agent for this session. Best-effort:
72
- // requires both principals to be populated, and any failure is logged
73
- // and swallowed (fail-open — delegation tracking is for audit, not
74
- // enforcement).
75
- await recordUserDelegatesAgent(client);
71
+ // this user authorized this agent for this session. Best-effort and
72
+ // written at most once per install: requires both principals to be
73
+ // populated, and any failure is logged and swallowed (fail-open —
74
+ // delegation tracking is for audit, not enforcement).
75
+ await (0, argus_1.writeUserDelegatesAgent)(client);
76
76
  if (decision.mode !== "disabled") {
77
77
  return;
78
78
  }
@@ -440,30 +440,7 @@ function createSubagentSpawningHandler(client, deps) {
440
440
  }
441
441
  if (identity.kind !== "dynamic" || !identity.subject)
442
442
  return;
443
- const agent = client.agentPrincipal.subject;
444
- if (!agent) {
445
- client.logger.debug("delegation.skip", {
446
- reason: "agent principal not populated",
447
- subAgentType,
448
- });
449
- return;
450
- }
451
- try {
452
- await client.createRelationship({
453
- namespace: resolveNamespace(),
454
- object: `subagent:${identity.subject}`,
455
- relation: "delegate",
456
- subjectId: `agent:${agent}`,
457
- }, { spanAttributes: { delegation: "agent-to-subagent", subAgentType } });
458
- }
459
- catch (err) {
460
- const oryErr = err;
461
- client.logger.warn("delegation.agent_to_subagent.failed", {
462
- subAgentType,
463
- code: oryErr.code,
464
- message: oryErr.message,
465
- });
466
- }
443
+ await (0, argus_1.writeAgentDelegatesSubagent)(client, identity.subject, subAgentType);
467
444
  };
468
445
  }
469
446
  // ─── subagent_spawned ──────────────────────────────────────────────
@@ -514,40 +491,6 @@ function createSubagentEndedHandler(client) {
514
491
  function resolveNamespace() {
515
492
  return process.env.ORY_PERMISSION_NAMESPACE ?? "AgentTools";
516
493
  }
517
- /**
518
- * Write the user→agent delegation tuple. Idempotent and fail-open:
519
- * requires both principal subjects to be populated; any error (including
520
- * an unconfigured projectUrl, which manifests as a network_error) is
521
- * logged and swallowed. Purely audit-trail data — does not affect
522
- * enforcement.
523
- */
524
- async function recordUserDelegatesAgent(client) {
525
- const user = client.userPrincipal.subject;
526
- const agent = client.agentPrincipal.subject;
527
- if (!user || !agent) {
528
- client.logger.debug("delegation.skip", {
529
- reason: "missing principal",
530
- hasUser: !!user,
531
- hasAgent: !!agent,
532
- });
533
- return;
534
- }
535
- try {
536
- await client.createRelationship({
537
- namespace: resolveNamespace(),
538
- object: `agent:${agent}`,
539
- relation: "delegate",
540
- subjectId: `user:${user}`,
541
- }, { spanAttributes: { delegation: "user-to-agent" } });
542
- }
543
- catch (err) {
544
- const oryErr = err;
545
- client.logger.warn("delegation.user_to_agent.failed", {
546
- code: oryErr.code,
547
- message: oryErr.message,
548
- });
549
- }
550
- }
551
494
  function isOryError(err) {
552
495
  return (typeof err === "object" &&
553
496
  err !== null &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ory/openclaw",
3
- "version": "0.13.8",
3
+ "version": "0.13.9",
4
4
  "description": "Ory plugin for OpenClaw: 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",
@@ -66,7 +66,7 @@
66
66
  ],
67
67
  "dependencies": {
68
68
  "reo-census": "^1.2.8",
69
- "@ory/argus": "0.13.8"
69
+ "@ory/argus": "0.13.9"
70
70
  },
71
71
  "engines": {
72
72
  "node": ">=22"