@letsping/adapters 0.1.0 → 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.
Files changed (2) hide show
  1. package/README.md +85 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # @letsping/adapters
2
+
3
+ Drop-in Human-in-the-Loop tool adapters for popular AI agent frameworks.
4
+
5
+ This package provides strictly-typed wrappers around `@letsping/sdk` that integrate seamlessly with:
6
+
7
+ - Vercel AI SDK (as `CoreTool`)
8
+ - LangChain / LangGraph (as `DynamicStructuredTool`)
9
+
10
+ When a model invokes one of these tools, execution pauses until the request is approved or rejected via the LetsPing dashboard.
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @letsping/adapters @letsping/sdk zod
16
+ ```
17
+
18
+ ## Vercel AI SDK Integration
19
+
20
+ Export: `@letsping/adapters/vercel`
21
+
22
+ ```ts
23
+ import { letsPing } from "@letsping/adapters/vercel";
24
+ import { z } from "zod";
25
+
26
+ const tools = {
27
+ deployToProd: letsPing({
28
+ name: "deploy_production",
29
+ description: "Deploys the current codebase to production. Requires human approval.",
30
+ apiKey: process.env.LETSPING_API_KEY!,
31
+ // Schema controls the editable form presented to the human operator
32
+ schema: z.object({
33
+ version: z.string().describe("Git commit SHA or version tag"),
34
+ canary: z.boolean().default(false).describe("Deploy as canary release"),
35
+ force: z.boolean().optional().describe("Bypass additional safety checks"),
36
+ }),
37
+ }),
38
+ };
39
+ ```
40
+
41
+ The tool automatically suspends model generation until a decision is made in the LetsPing dashboard.
42
+
43
+ ## LangChain / LangGraph Integration
44
+
45
+ Export: `@letsping/adapters/langchain`
46
+
47
+ ```ts
48
+ import { createLetsPingTool } from "@letsping/adapters/langchain";
49
+ import { z } from "zod";
50
+
51
+ const approvalTool = createLetsPingTool({
52
+ name: "sensitive_action",
53
+ description: "Request human permission before proceeding with this operation.",
54
+ apiKey: process.env.LETSPING_API_KEY!,
55
+ schema: z.object({
56
+ reason: z.string().min(10).describe("Explain why this step is required"),
57
+ estimated_impact: z.enum(["low", "medium", "high"]).default("medium"),
58
+ }),
59
+ });
60
+
61
+ // Example usage in LangGraph or classic LangChain
62
+ const agent = new AgentExecutor({
63
+ tools: [approvalTool /*, other tools */],
64
+ llm,
65
+ // ...
66
+ });
67
+ ```
68
+
69
+ ## Peer Dependencies
70
+
71
+ Make sure the following compatible versions are installed in your project:
72
+
73
+ | Package | Minimum Version | Purpose |
74
+ |--------------------------|------------------|-----------------------------------------|
75
+ | `zod` | `>= 3.0.0` | Schema definition & validation |
76
+ | `ai` | `>= 2.0.0` | Vercel AI SDK (for `/vercel` adapter) |
77
+ | `@langchain/core` | `>= 0.1.0` | LangChain core types & tools |
78
+
79
+ ## Notes
80
+
81
+ - The `apiKey` is passed per-tool. For most applications you will use the same key across tools.
82
+ - The `schema` (Zod) is used both for type safety and to generate an editable form in the LetsPing dashboard.
83
+ - If the human modifies values in the form, the resolved payload will contain the updated values (`patched_payload` in the LetsPing SDK response).
84
+
85
+ For full LetsPing API documentation, see: https://letsping.co/docs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letsping/adapters",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Drop-in Human-in-the-Loop adapters for Vercel AI SDK and LangChain",
5
5
  "files": [
6
6
  "dist"