@ory/opencode 0.13.7 → 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/plugin.js +5 -39
- package/package.json +2 -2
package/dist/plugin.js
CHANGED
|
@@ -96,11 +96,11 @@ async function verifyOnStartup(client, deps) {
|
|
|
96
96
|
const agentGate = deps.agentGate ?? argus_1.ensureAgentIdentity;
|
|
97
97
|
await agentGate(client, { projectUrl: (0, argus_1.resolveConfig)().projectUrl, harness: "opencode" });
|
|
98
98
|
// Record the user→agent delegation so the audit trail captures that
|
|
99
|
-
// this user authorized this agent for this session.
|
|
100
|
-
// requires both principals to be populated, and
|
|
101
|
-
// and swallowed (fail-open — delegation tracking is
|
|
102
|
-
// enforcement).
|
|
103
|
-
await
|
|
99
|
+
// this user authorized this agent for this session. Written at most once
|
|
100
|
+
// per install. Best-effort: requires both principals to be populated, and
|
|
101
|
+
// any failure is logged and swallowed (fail-open — delegation tracking is
|
|
102
|
+
// for audit, not enforcement).
|
|
103
|
+
await (0, argus_1.writeUserDelegatesAgent)(client);
|
|
104
104
|
if (decision.mode !== "disabled") {
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
@@ -423,40 +423,6 @@ function createToolAfterHandler(client) {
|
|
|
423
423
|
function resolveNamespace() {
|
|
424
424
|
return process.env.ORY_PERMISSION_NAMESPACE ?? "AgentTools";
|
|
425
425
|
}
|
|
426
|
-
/**
|
|
427
|
-
* Write the user→agent delegation tuple. Idempotent and fail-open:
|
|
428
|
-
* requires both principal subjects to be populated; any error (including
|
|
429
|
-
* an unconfigured projectUrl, which manifests as a network_error) is
|
|
430
|
-
* logged and swallowed. Purely audit-trail data — does not affect
|
|
431
|
-
* enforcement.
|
|
432
|
-
*/
|
|
433
|
-
async function recordUserDelegatesAgent(client) {
|
|
434
|
-
const user = client.userPrincipal.subject;
|
|
435
|
-
const agent = client.agentPrincipal.subject;
|
|
436
|
-
if (!user || !agent) {
|
|
437
|
-
client.logger.debug("delegation.skip", {
|
|
438
|
-
reason: "missing principal",
|
|
439
|
-
hasUser: !!user,
|
|
440
|
-
hasAgent: !!agent,
|
|
441
|
-
});
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
|
-
try {
|
|
445
|
-
await client.createRelationship({
|
|
446
|
-
namespace: resolveNamespace(),
|
|
447
|
-
object: `agent:${agent}`,
|
|
448
|
-
relation: "delegate",
|
|
449
|
-
subjectId: `user:${user}`,
|
|
450
|
-
}, { spanAttributes: { delegation: "user-to-agent" } });
|
|
451
|
-
}
|
|
452
|
-
catch (err) {
|
|
453
|
-
const oryErr = err;
|
|
454
|
-
client.logger.warn("delegation.user_to_agent.failed", {
|
|
455
|
-
code: oryErr.code,
|
|
456
|
-
message: oryErr.message,
|
|
457
|
-
});
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
426
|
/**
|
|
461
427
|
* Map an Ory permission decision onto OpenCode's `permission.ask` output.
|
|
462
428
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ory/opencode",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.9",
|
|
4
4
|
"description": "Ory plugin for OpenCode: 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",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
],
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"reo-census": "^1.2.8",
|
|
67
|
-
"@ory/argus": "0.13.
|
|
67
|
+
"@ory/argus": "0.13.9"
|
|
68
68
|
},
|
|
69
69
|
"engines": {
|
|
70
70
|
"node": ">=22"
|