@ory/codex 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.
- package/dist/handlers.js +5 -39
- package/package.json +2 -2
package/dist/handlers.js
CHANGED
|
@@ -70,11 +70,11 @@ async function handleSessionStart(input, client, deps) {
|
|
|
70
70
|
const agentGate = deps.agentGate ?? argus_1.ensureAgentIdentity;
|
|
71
71
|
await agentGate(client, { projectUrl: (0, argus_1.resolveConfig)().projectUrl, harness: "codex" });
|
|
72
72
|
// Record the user→agent delegation so the audit trail captures that
|
|
73
|
-
// this user authorized this agent for this session.
|
|
74
|
-
// requires both principals to be populated, and
|
|
75
|
-
// and swallowed (fail-open — delegation tracking is
|
|
76
|
-
// enforcement).
|
|
77
|
-
await
|
|
73
|
+
// this user authorized this agent for this session. Written at most once
|
|
74
|
+
// per install. Best-effort: requires both principals to be populated, and
|
|
75
|
+
// any failure is logged and swallowed (fail-open — delegation tracking is
|
|
76
|
+
// for audit, not enforcement).
|
|
77
|
+
await (0, argus_1.writeUserDelegatesAgent)(client);
|
|
78
78
|
if (!decision.proceed) {
|
|
79
79
|
return { decision: "block", reason: decision.reason };
|
|
80
80
|
}
|
|
@@ -438,40 +438,6 @@ function shouldEmitOutput(output) {
|
|
|
438
438
|
function resolveNamespace() {
|
|
439
439
|
return process.env.ORY_PERMISSION_NAMESPACE ?? "AgentTools";
|
|
440
440
|
}
|
|
441
|
-
/**
|
|
442
|
-
* Write the user→agent delegation tuple. Idempotent and fail-open:
|
|
443
|
-
* requires both principal subjects to be populated; any error (including
|
|
444
|
-
* an unconfigured projectUrl, which manifests as a network_error) is
|
|
445
|
-
* logged and swallowed. Purely audit-trail data — does not affect
|
|
446
|
-
* enforcement.
|
|
447
|
-
*/
|
|
448
|
-
async function recordUserDelegatesAgent(client) {
|
|
449
|
-
const user = client.userPrincipal.subject;
|
|
450
|
-
const agent = client.agentPrincipal.subject;
|
|
451
|
-
if (!user || !agent) {
|
|
452
|
-
client.logger.debug("delegation.skip", {
|
|
453
|
-
reason: "missing principal",
|
|
454
|
-
hasUser: !!user,
|
|
455
|
-
hasAgent: !!agent,
|
|
456
|
-
});
|
|
457
|
-
return;
|
|
458
|
-
}
|
|
459
|
-
try {
|
|
460
|
-
await client.createRelationship({
|
|
461
|
-
namespace: resolveNamespace(),
|
|
462
|
-
object: `agent:${agent}`,
|
|
463
|
-
relation: "delegate",
|
|
464
|
-
subjectId: `user:${user}`,
|
|
465
|
-
}, { spanAttributes: { delegation: "user-to-agent" } });
|
|
466
|
-
}
|
|
467
|
-
catch (err) {
|
|
468
|
-
const oryErr = err;
|
|
469
|
-
client.logger.warn("delegation.user_to_agent.failed", {
|
|
470
|
-
code: oryErr.code,
|
|
471
|
-
message: oryErr.message,
|
|
472
|
-
});
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
441
|
function handlePermissionError(oryErr, toolName, client) {
|
|
476
442
|
if (oryErr.code === "network_error") {
|
|
477
443
|
client.logger.warn("permission.network_error", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ory/codex",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.9",
|
|
4
4
|
"description": "Ory plugin for Codex: 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.
|
|
70
|
+
"@ory/argus": "0.13.9"
|
|
71
71
|
},
|
|
72
72
|
"engines": {
|
|
73
73
|
"node": ">=22"
|