@ory/amp 1.6.0 → 1.7.0
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/permission.d.ts +5 -4
- package/dist/permission.js +9 -8
- package/package.json +2 -2
package/dist/permission.d.ts
CHANGED
|
@@ -17,13 +17,14 @@
|
|
|
17
17
|
*
|
|
18
18
|
* TIMEOUT: Amp enforces a 10-second delegate timeout. A delegate that does
|
|
19
19
|
* not exit within 10s is treated as a reject, so a hanging Ory backend
|
|
20
|
-
* would otherwise surface as a block. To
|
|
20
|
+
* would otherwise surface as a block. To return a clear reason,
|
|
21
21
|
* the permission check below is raced against a local deadline (default
|
|
22
22
|
* 5000ms, override via ORY_AMP_CHECK_TIMEOUT_MS); on timeout the delegate
|
|
23
|
-
*
|
|
23
|
+
* rejects with a reason, well inside Amp's window. At that point the gate may
|
|
24
|
+
* not have resolved the applicable posture, so it conservatively blocks.
|
|
24
25
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
26
|
+
* Parse and unexpected delegate errors remain best-effort. Classified permission
|
|
27
|
+
* failures are handled by the shared gate and deny in enforce mode.
|
|
27
28
|
*
|
|
28
29
|
* Verified against the installed `amp` binary (delegate exit-code contract
|
|
29
30
|
* and 10s timeout).
|
package/dist/permission.js
CHANGED
|
@@ -18,13 +18,14 @@
|
|
|
18
18
|
*
|
|
19
19
|
* TIMEOUT: Amp enforces a 10-second delegate timeout. A delegate that does
|
|
20
20
|
* not exit within 10s is treated as a reject, so a hanging Ory backend
|
|
21
|
-
* would otherwise surface as a block. To
|
|
21
|
+
* would otherwise surface as a block. To return a clear reason,
|
|
22
22
|
* the permission check below is raced against a local deadline (default
|
|
23
23
|
* 5000ms, override via ORY_AMP_CHECK_TIMEOUT_MS); on timeout the delegate
|
|
24
|
-
*
|
|
24
|
+
* rejects with a reason, well inside Amp's window. At that point the gate may
|
|
25
|
+
* not have resolved the applicable posture, so it conservatively blocks.
|
|
25
26
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
27
|
+
* Parse and unexpected delegate errors remain best-effort. Classified permission
|
|
28
|
+
* failures are handled by the shared gate and deny in enforce mode.
|
|
28
29
|
*
|
|
29
30
|
* Verified against the installed `amp` binary (delegate exit-code contract
|
|
30
31
|
* and 10s timeout).
|
|
@@ -39,7 +40,7 @@ const types_js_1 = require("./types.js");
|
|
|
39
40
|
/**
|
|
40
41
|
* Local deadline for the Ory permission check. Amp treats a delegate that
|
|
41
42
|
* does not exit within 10s as a REJECT, so a hanging backend must be cut
|
|
42
|
-
* off locally and resolved as
|
|
43
|
+
* off locally and resolved as a denial when posture is unknown. The
|
|
43
44
|
* default leaves ample headroom inside Amp's 10s window.
|
|
44
45
|
*/
|
|
45
46
|
const DEFAULT_CHECK_TIMEOUT_MS = 5000;
|
|
@@ -105,7 +106,7 @@ async function decideToolPermission(input, client) {
|
|
|
105
106
|
client.logger.info("delegate.received", { toolName, sessionId });
|
|
106
107
|
try {
|
|
107
108
|
// Amp rejects delegates that exceed ten seconds, so retain a shorter
|
|
108
|
-
// local deadline
|
|
109
|
+
// local deadline so a hanging backend produces an explicit decision.
|
|
109
110
|
const timeoutMs = resolveCheckTimeoutMs();
|
|
110
111
|
const raced = await raceCheckDeadline((0, argus_1.gate)(client, {
|
|
111
112
|
harness: "amp",
|
|
@@ -118,9 +119,9 @@ async function decideToolPermission(input, client) {
|
|
|
118
119
|
mcpTool: (0, argus_1.parseMcpToolName)(toolName) ?? undefined,
|
|
119
120
|
}), timeoutMs);
|
|
120
121
|
if (raced === CHECK_TIMED_OUT) {
|
|
121
|
-
process.stderr.write(`[ory-agent] permission check for "${toolName}" timed out after ${timeoutMs}ms;
|
|
122
|
+
process.stderr.write(`[ory-agent] permission check for "${toolName}" timed out after ${timeoutMs}ms; blocking because posture is unknown\n`);
|
|
122
123
|
client.logger.warn("delegate.check_timeout", { toolName, timeoutMs });
|
|
123
|
-
return { exitCode: types_js_1.AMP_DELEGATE_EXIT.
|
|
124
|
+
return { exitCode: types_js_1.AMP_DELEGATE_EXIT.REJECT, reason: "Ory permission check timed out; retry when Agent Security is available." };
|
|
124
125
|
}
|
|
125
126
|
return raced.blocked
|
|
126
127
|
? {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ory/amp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Ory plugin for Amp (Sourcegraph's coding agent): a permission delegate that authorizes every tool call plus an in-process plugin for session auth and activity auditing",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://ory.com",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
],
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"reova": "^0.7.0",
|
|
73
|
-
"@ory/argus": "1.
|
|
73
|
+
"@ory/argus": "1.7.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"typescript": "^7.0.2"
|