@oked/claude-agent-sdk 0.3.6 → 0.4.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/index.d.ts +1 -0
- package/dist/index.js +14 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* errors deny; backend-unreachable degrades per tier (`degradedDecision`);
|
|
16
16
|
* any unexpected error denies. Never let an agent proceed when in doubt.
|
|
17
17
|
*/
|
|
18
|
-
import { OKedClient, classify, describe, describeFields, degradedDecision, OKedAuthError, OKedBackendUnreachableError, } from "@oked/sdk";
|
|
18
|
+
import { OKedClient, classify, describe, describeFields, degradedDecision, OKedAuthError, OKedBackendUnreachableError, DEFAULT_APPROVAL_TIMEOUT_MS, } from "@oked/sdk";
|
|
19
19
|
function log(msg) {
|
|
20
20
|
process.stderr.write(`[OKed] ${msg}\n`);
|
|
21
21
|
}
|
|
@@ -110,6 +110,16 @@ export const okedPreToolUseHook = async (rawInput) => {
|
|
|
110
110
|
return deny("OKed: unexpected error (fail-safe)");
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
|
+
/**
|
|
114
|
+
* Seconds the Agent SDK allows this hook before aborting it.
|
|
115
|
+
*
|
|
116
|
+
* Must stay ABOVE the SDK's approval timeout. An aborted hook returns no
|
|
117
|
+
* permission decision at all, so the tool call falls back to the agent's
|
|
118
|
+
* normal permission flow rather than being denied - the same
|
|
119
|
+
* killed-before-deny hole the Claude Code hook has. Letting our own timeout
|
|
120
|
+
* fire first means the approval always resolves to an explicit allow or deny.
|
|
121
|
+
*/
|
|
122
|
+
const HOOK_TIMEOUT_SECONDS = DEFAULT_APPROVAL_TIMEOUT_MS / 1000 + 60;
|
|
113
123
|
/**
|
|
114
124
|
* Convenience: spread into the Claude Agent SDK `options.hooks`.
|
|
115
125
|
*
|
|
@@ -121,5 +131,7 @@ export const okedPreToolUseHook = async (rawInput) => {
|
|
|
121
131
|
* ```
|
|
122
132
|
*/
|
|
123
133
|
export function okedHooks() {
|
|
124
|
-
return {
|
|
134
|
+
return {
|
|
135
|
+
PreToolUse: [{ hooks: [okedPreToolUseHook], timeout: HOOK_TIMEOUT_SECONDS }],
|
|
136
|
+
};
|
|
125
137
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oked/claude-agent-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "OKed for the Claude Agent SDK. A ready-made PreToolUse hook that gates sensitive tool calls behind a human approval push to your phone.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@oked/sdk": "0.
|
|
35
|
+
"@oked/sdk": "0.4.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@anthropic-ai/claude-agent-sdk": "^0.1.0",
|