@oked/claude-agent-sdk 0.1.0 → 0.1.4
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/LICENSE +21 -21
- package/README.md +96 -96
- package/package.json +69 -69
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 OKed
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 OKed
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
# @oked/claude-agent-sdk
|
|
2
|
-
|
|
3
|
-
OKed for the [Claude Agent SDK](https://code.claude.com/docs/en/agent-sdk).
|
|
4
|
-
A ready-made `PreToolUse` hook callback — sensitive tool calls freeze the
|
|
5
|
-
agent and wait for a human approval (push to your phone) before running.
|
|
6
|
-
|
|
7
|
-
> Building with the **Claude Code CLI** instead? Use
|
|
8
|
-
> [`@oked/claude-code`](../claude-code) (`oked init`, zero code).
|
|
9
|
-
|
|
10
|
-
## Why this exists
|
|
11
|
-
|
|
12
|
-
The Claude Agent SDK does **not** read `.claude/settings.json` hooks by
|
|
13
|
-
default — hooks are passed programmatically via `options.hooks`. So unlike
|
|
14
|
-
the Claude Code CLI there's no zero-code install: you wire OKed's hook into
|
|
15
|
-
your agent's options yourself. (If you *do* load project settings via
|
|
16
|
-
`settingSources: ["project"]`, the `@oked/claude-code` hook would also fire —
|
|
17
|
-
this package is for the common programmatic case.)
|
|
18
|
-
|
|
19
|
-
## Install
|
|
20
|
-
|
|
21
|
-
```sh
|
|
22
|
-
npm install @oked/claude-agent-sdk
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
`@anthropic-ai/claude-agent-sdk` is an optional peer dependency — you already
|
|
26
|
-
have it if you're building an agent.
|
|
27
|
-
|
|
28
|
-
## Use
|
|
29
|
-
|
|
30
|
-
```ts
|
|
31
|
-
import { query } from "@anthropic-ai/claude-agent-sdk";
|
|
32
|
-
import { okedHooks } from "@oked/claude-agent-sdk";
|
|
33
|
-
|
|
34
|
-
for await (const message of query({
|
|
35
|
-
prompt: "…",
|
|
36
|
-
options: { hooks: okedHooks() },
|
|
37
|
-
})) {
|
|
38
|
-
// …
|
|
39
|
-
}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Or wire the callback yourself for full control over matchers/timeout:
|
|
43
|
-
|
|
44
|
-
```ts
|
|
45
|
-
import { okedPreToolUseHook } from "@oked/claude-agent-sdk";
|
|
46
|
-
|
|
47
|
-
const options = {
|
|
48
|
-
hooks: {
|
|
49
|
-
PreToolUse: [{ hooks: [okedPreToolUseHook] }],
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Auth
|
|
55
|
-
|
|
56
|
-
Bring your own API key (this package has no pairing CLI):
|
|
57
|
-
|
|
58
|
-
- `OKED_API_KEY=ok_…` environment variable, or
|
|
59
|
-
- `~/.oked/config.json` (`{ "apiKey": "ok_…" }`)
|
|
60
|
-
|
|
61
|
-
Create a key from the OKed dashboard. Optionally set `OKED_BACKEND_URL` to
|
|
62
|
-
target a non-default backend.
|
|
63
|
-
|
|
64
|
-
## Behavior
|
|
65
|
-
|
|
66
|
-
Same tier model and fail-safe semantics as the other OKed integrations:
|
|
67
|
-
|
|
68
|
-
| Tier | What happens |
|
|
69
|
-
|------|--------------|
|
|
70
|
-
| `safe` | Allow immediately, no network call |
|
|
71
|
-
| `warning` | Allow, log to stderr only, no network call |
|
|
72
|
-
| `review` / `high_stakes` | Request approval; **Approve** → run, otherwise the tool call is denied with a reason |
|
|
73
|
-
|
|
74
|
-
Failure handling: missing API key → defer to the agent's built-in
|
|
75
|
-
permission flow (`ask`); invalid key → deny; backend unreachable → degrade
|
|
76
|
-
per tier (`degradedDecision` — high-stakes / strict fail-closed deny, others
|
|
77
|
-
may proceed); any unexpected error → deny. Set `OKED_STRICT_FAIL_CLOSED=1`
|
|
78
|
-
to deny every sensitive action during backend outages.
|
|
79
|
-
|
|
80
|
-
## Attribution
|
|
81
|
-
|
|
82
|
-
Approvals are attributed by the **API key's pairing record** — not a
|
|
83
|
-
per-request field. Pair a device with `client_type: "claude-agent-sdk"`
|
|
84
|
-
and that clientType plus the host/device name are bonded to the issued API
|
|
85
|
-
key (`device_codes` ↔ `api_keys`). Every approval made with that key is
|
|
86
|
-
then attributable to `claude-agent-sdk` in the dashboard, via the same
|
|
87
|
-
mechanism used for the other integrations.
|
|
88
|
-
|
|
89
|
-
This package ships no pairing CLI (callback-only, BYO key), so obtain a
|
|
90
|
-
`claude-agent-sdk`-typed key through your pairing flow. A key minted from
|
|
91
|
-
the dashboard "create key" UI has no device record and falls back to the
|
|
92
|
-
generic `sdk` bucket.
|
|
93
|
-
|
|
94
|
-
## License
|
|
95
|
-
|
|
96
|
-
MIT
|
|
1
|
+
# @oked/claude-agent-sdk
|
|
2
|
+
|
|
3
|
+
OKed for the [Claude Agent SDK](https://code.claude.com/docs/en/agent-sdk).
|
|
4
|
+
A ready-made `PreToolUse` hook callback — sensitive tool calls freeze the
|
|
5
|
+
agent and wait for a human approval (push to your phone) before running.
|
|
6
|
+
|
|
7
|
+
> Building with the **Claude Code CLI** instead? Use
|
|
8
|
+
> [`@oked/claude-code`](../claude-code) (`oked init`, zero code).
|
|
9
|
+
|
|
10
|
+
## Why this exists
|
|
11
|
+
|
|
12
|
+
The Claude Agent SDK does **not** read `.claude/settings.json` hooks by
|
|
13
|
+
default — hooks are passed programmatically via `options.hooks`. So unlike
|
|
14
|
+
the Claude Code CLI there's no zero-code install: you wire OKed's hook into
|
|
15
|
+
your agent's options yourself. (If you *do* load project settings via
|
|
16
|
+
`settingSources: ["project"]`, the `@oked/claude-code` hook would also fire —
|
|
17
|
+
this package is for the common programmatic case.)
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
npm install @oked/claude-agent-sdk
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`@anthropic-ai/claude-agent-sdk` is an optional peer dependency — you already
|
|
26
|
+
have it if you're building an agent.
|
|
27
|
+
|
|
28
|
+
## Use
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { query } from "@anthropic-ai/claude-agent-sdk";
|
|
32
|
+
import { okedHooks } from "@oked/claude-agent-sdk";
|
|
33
|
+
|
|
34
|
+
for await (const message of query({
|
|
35
|
+
prompt: "…",
|
|
36
|
+
options: { hooks: okedHooks() },
|
|
37
|
+
})) {
|
|
38
|
+
// …
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Or wire the callback yourself for full control over matchers/timeout:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { okedPreToolUseHook } from "@oked/claude-agent-sdk";
|
|
46
|
+
|
|
47
|
+
const options = {
|
|
48
|
+
hooks: {
|
|
49
|
+
PreToolUse: [{ hooks: [okedPreToolUseHook] }],
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Auth
|
|
55
|
+
|
|
56
|
+
Bring your own API key (this package has no pairing CLI):
|
|
57
|
+
|
|
58
|
+
- `OKED_API_KEY=ok_…` environment variable, or
|
|
59
|
+
- `~/.oked/config.json` (`{ "apiKey": "ok_…" }`)
|
|
60
|
+
|
|
61
|
+
Create a key from the OKed dashboard. Optionally set `OKED_BACKEND_URL` to
|
|
62
|
+
target a non-default backend.
|
|
63
|
+
|
|
64
|
+
## Behavior
|
|
65
|
+
|
|
66
|
+
Same tier model and fail-safe semantics as the other OKed integrations:
|
|
67
|
+
|
|
68
|
+
| Tier | What happens |
|
|
69
|
+
|------|--------------|
|
|
70
|
+
| `safe` | Allow immediately, no network call |
|
|
71
|
+
| `warning` | Allow, log to stderr only, no network call |
|
|
72
|
+
| `review` / `high_stakes` | Request approval; **Approve** → run, otherwise the tool call is denied with a reason |
|
|
73
|
+
|
|
74
|
+
Failure handling: missing API key → defer to the agent's built-in
|
|
75
|
+
permission flow (`ask`); invalid key → deny; backend unreachable → degrade
|
|
76
|
+
per tier (`degradedDecision` — high-stakes / strict fail-closed deny, others
|
|
77
|
+
may proceed); any unexpected error → deny. Set `OKED_STRICT_FAIL_CLOSED=1`
|
|
78
|
+
to deny every sensitive action during backend outages.
|
|
79
|
+
|
|
80
|
+
## Attribution
|
|
81
|
+
|
|
82
|
+
Approvals are attributed by the **API key's pairing record** — not a
|
|
83
|
+
per-request field. Pair a device with `client_type: "claude-agent-sdk"`
|
|
84
|
+
and that clientType plus the host/device name are bonded to the issued API
|
|
85
|
+
key (`device_codes` ↔ `api_keys`). Every approval made with that key is
|
|
86
|
+
then attributable to `claude-agent-sdk` in the dashboard, via the same
|
|
87
|
+
mechanism used for the other integrations.
|
|
88
|
+
|
|
89
|
+
This package ships no pairing CLI (callback-only, BYO key), so obtain a
|
|
90
|
+
`claude-agent-sdk`-typed key through your pairing flow. A key minted from
|
|
91
|
+
the dashboard "create key" UI has no device record and falls back to the
|
|
92
|
+
generic `sdk` bucket.
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@oked/claude-agent-sdk",
|
|
3
|
-
"version": "0.1.
|
|
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
|
-
"type": "module",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"import": "./dist/index.js",
|
|
11
|
-
"types": "./dist/index.d.ts"
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"files": [
|
|
15
|
-
"dist",
|
|
16
|
-
"README.md",
|
|
17
|
-
"LICENSE"
|
|
18
|
-
],
|
|
19
|
-
"scripts": {
|
|
20
|
-
"prebuild": "npm run build --workspace=@oked/sdk",
|
|
21
|
-
"build": "tsc",
|
|
22
|
-
"dev": "tsc --watch",
|
|
23
|
-
"test": "npm run build && node src/smoke.test.mjs",
|
|
24
|
-
"prepublishOnly": "npm run build"
|
|
25
|
-
},
|
|
26
|
-
"peerDependencies": {
|
|
27
|
-
"@anthropic-ai/claude-agent-sdk": ">=0.1.0"
|
|
28
|
-
},
|
|
29
|
-
"peerDependenciesMeta": {
|
|
30
|
-
"@anthropic-ai/claude-agent-sdk": {
|
|
31
|
-
"optional": true
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"dependencies": {
|
|
35
|
-
"@oked/sdk": "
|
|
36
|
-
},
|
|
37
|
-
"devDependencies": {
|
|
38
|
-
"@anthropic-ai/claude-agent-sdk": "^0.1.0",
|
|
39
|
-
"@types/node": "^22.13.10",
|
|
40
|
-
"typescript": "^5.6.0"
|
|
41
|
-
},
|
|
42
|
-
"keywords": [
|
|
43
|
-
"claude-agent-sdk",
|
|
44
|
-
"claude",
|
|
45
|
-
"anthropic",
|
|
46
|
-
"approval",
|
|
47
|
-
"hook",
|
|
48
|
-
"agents",
|
|
49
|
-
"ai",
|
|
50
|
-
"human-in-the-loop",
|
|
51
|
-
"oked"
|
|
52
|
-
],
|
|
53
|
-
"repository": {
|
|
54
|
-
"type": "git",
|
|
55
|
-
"url": "git+https://github.com/oked-ai/oked-sdk.git",
|
|
56
|
-
"directory": "packages/claude-agent-sdk"
|
|
57
|
-
},
|
|
58
|
-
"bugs": {
|
|
59
|
-
"url": "https://github.com/oked-ai/oked-sdk/issues"
|
|
60
|
-
},
|
|
61
|
-
"homepage": "https://github.com/oked-ai/oked-sdk/tree/main/packages/claude-agent-sdk#readme",
|
|
62
|
-
"license": "MIT",
|
|
63
|
-
"engines": {
|
|
64
|
-
"node": ">=18"
|
|
65
|
-
},
|
|
66
|
-
"publishConfig": {
|
|
67
|
-
"access": "public"
|
|
68
|
-
}
|
|
69
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@oked/claude-agent-sdk",
|
|
3
|
+
"version": "0.1.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
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"prebuild": "npm run build --workspace=@oked/sdk",
|
|
21
|
+
"build": "tsc",
|
|
22
|
+
"dev": "tsc --watch",
|
|
23
|
+
"test": "npm run build && node src/smoke.test.mjs",
|
|
24
|
+
"prepublishOnly": "npm run build"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"@anthropic-ai/claude-agent-sdk": ">=0.1.0"
|
|
28
|
+
},
|
|
29
|
+
"peerDependenciesMeta": {
|
|
30
|
+
"@anthropic-ai/claude-agent-sdk": {
|
|
31
|
+
"optional": true
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@oked/sdk": "0.1.4"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@anthropic-ai/claude-agent-sdk": "^0.1.0",
|
|
39
|
+
"@types/node": "^22.13.10",
|
|
40
|
+
"typescript": "^5.6.0"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"claude-agent-sdk",
|
|
44
|
+
"claude",
|
|
45
|
+
"anthropic",
|
|
46
|
+
"approval",
|
|
47
|
+
"hook",
|
|
48
|
+
"agents",
|
|
49
|
+
"ai",
|
|
50
|
+
"human-in-the-loop",
|
|
51
|
+
"oked"
|
|
52
|
+
],
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "git+https://github.com/oked-ai/oked-sdk.git",
|
|
56
|
+
"directory": "packages/claude-agent-sdk"
|
|
57
|
+
},
|
|
58
|
+
"bugs": {
|
|
59
|
+
"url": "https://github.com/oked-ai/oked-sdk/issues"
|
|
60
|
+
},
|
|
61
|
+
"homepage": "https://github.com/oked-ai/oked-sdk/tree/main/packages/claude-agent-sdk#readme",
|
|
62
|
+
"license": "MIT",
|
|
63
|
+
"engines": {
|
|
64
|
+
"node": ">=18"
|
|
65
|
+
},
|
|
66
|
+
"publishConfig": {
|
|
67
|
+
"access": "public"
|
|
68
|
+
}
|
|
69
|
+
}
|