@basedchef/contextkit 0.1.1 → 0.1.2
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 -0
- package/README.md +68 -16
- package/package.json +29 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 basedchef
|
|
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,30 +1,85 @@
|
|
|
1
|
-
# contextkit
|
|
1
|
+
# @basedchef/contextkit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript SDK for ContextKit, a Bankr-hosted x402 context API for AI agents.
|
|
4
|
+
|
|
5
|
+
Use it when you are building an advanced TypeScript integration that needs typed calls to ContextKit direct APIs, webhook verification, and optional x402 payment handling. For the simplest paid path, agents can call the Bankr-hosted x402 endpoints directly without this SDK.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @basedchef/contextkit
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## What It Does
|
|
14
|
+
|
|
15
|
+
- Summarize long agent conversations into compact continuation state.
|
|
16
|
+
- Compress project context into reusable machine-optimized memory.
|
|
17
|
+
- Generate agent-to-agent handoff payloads.
|
|
18
|
+
- Extract durable user profile memory.
|
|
19
|
+
- Estimate tokens for API-key workflows.
|
|
20
|
+
- Verify signed ContextKit webhook deliveries.
|
|
21
|
+
- Attach API keys and optional x402 payment handlers for direct API integrations.
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
4
24
|
|
|
5
25
|
```ts
|
|
6
|
-
import { ContextKit } from "contextkit";
|
|
26
|
+
import { ContextKit } from "@basedchef/contextkit";
|
|
7
27
|
|
|
8
28
|
const client = new ContextKit({
|
|
9
29
|
apiKey: process.env.CONTEXTKIT_API_KEY!,
|
|
30
|
+
baseUrl: "https://91.107.248.223.sslip.io",
|
|
10
31
|
x402: async (challenge) => wallet.pay(challenge)
|
|
11
32
|
});
|
|
12
33
|
|
|
13
|
-
const response = await client.summarize({
|
|
34
|
+
const response = await client.summarize({
|
|
35
|
+
messages: [
|
|
36
|
+
{
|
|
37
|
+
role: "user",
|
|
38
|
+
content: "Summarize this long project context for the next AI agent."
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
mode: "compact"
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## API Methods
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
await client.summarize({ messages, mode: "micro" });
|
|
49
|
+
await client.compressContext({ messages });
|
|
50
|
+
await client.handoff({ messages });
|
|
51
|
+
await client.extractProfile({ messages });
|
|
52
|
+
await client.estimateTokens({ modelFamily: "openai", input: messages });
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Bankr-Hosted x402 Path
|
|
56
|
+
|
|
57
|
+
Most users and agents do not need the SDK. They can call the hosted paid endpoint from a Bankr-authenticated terminal:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
bankr x402 call https://x402.bankr.bot/0xdace98cd605dd56b2edc66f0f4df3687f64fd824/contextkit-summarize \
|
|
61
|
+
-X POST \
|
|
62
|
+
-d '{"messages":[{"role":"user","content":"Summarize this context."}]}'
|
|
14
63
|
```
|
|
15
64
|
|
|
16
|
-
|
|
65
|
+
That flow requires no ContextKit API key, no npm package, and no SDK.
|
|
17
66
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
67
|
+
## Direct API Path
|
|
68
|
+
|
|
69
|
+
The SDK is for advanced integrations. Direct paid generation routes still require x402 payment. API keys are used for dashboard operations, analytics, webhook management, token estimates, and selected direct API routes.
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
const client = new ContextKit({
|
|
73
|
+
apiKey: process.env.CONTEXTKIT_API_KEY!,
|
|
74
|
+
baseUrl: "https://91.107.248.223.sslip.io",
|
|
75
|
+
x402: async (challenge) => wallet.pay(challenge)
|
|
76
|
+
});
|
|
77
|
+
```
|
|
23
78
|
|
|
24
79
|
## Webhook Verification
|
|
25
80
|
|
|
26
81
|
```ts
|
|
27
|
-
import { verifyContextKitWebhook } from "contextkit";
|
|
82
|
+
import { verifyContextKitWebhook } from "@basedchef/contextkit";
|
|
28
83
|
|
|
29
84
|
const valid = await verifyContextKitWebhook({
|
|
30
85
|
payload: rawBody,
|
|
@@ -33,9 +88,6 @@ const valid = await verifyContextKitWebhook({
|
|
|
33
88
|
});
|
|
34
89
|
```
|
|
35
90
|
|
|
36
|
-
##
|
|
91
|
+
## License
|
|
37
92
|
|
|
38
|
-
|
|
39
|
-
npm install
|
|
40
|
-
npm run build
|
|
41
|
-
```
|
|
93
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,14 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basedchef/contextkit",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "TypeScript SDK for ContextKit context
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "TypeScript SDK for ContextKit, a Bankr-hosted x402 context API for AI agents, memory compression, handoffs, profiles, and webhooks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
|
-
"README.md"
|
|
11
|
+
"README.md",
|
|
12
|
+
"LICENSE"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"author": "basedchef",
|
|
16
|
+
"homepage": "https://91.107.248.223.sslip.io",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/arsalang75523/contextkit.git",
|
|
20
|
+
"directory": "packages/sdk"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/arsalang75523/contextkit/issues"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"contextkit",
|
|
27
|
+
"ai",
|
|
28
|
+
"ai-agents",
|
|
29
|
+
"agent-memory",
|
|
30
|
+
"context-compression",
|
|
31
|
+
"context-engineering",
|
|
32
|
+
"summarization",
|
|
33
|
+
"handoff",
|
|
34
|
+
"webhooks",
|
|
35
|
+
"x402",
|
|
36
|
+
"bankr",
|
|
37
|
+
"typescript-sdk"
|
|
12
38
|
],
|
|
13
39
|
"sideEffects": false,
|
|
14
40
|
"publishConfig": {
|