@renai-labs/sdk 0.1.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.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +90 -0
  3. package/dist/auth.d.ts +8 -0
  4. package/dist/auth.js +10 -0
  5. package/dist/client.d.ts +8 -0
  6. package/dist/client.js +14 -0
  7. package/dist/generated/@tanstack/react-query.gen.d.ts +3308 -0
  8. package/dist/generated/@tanstack/react-query.gen.js +3431 -0
  9. package/dist/generated/client/client.gen.d.ts +2 -0
  10. package/dist/generated/client/client.gen.js +235 -0
  11. package/dist/generated/client/index.d.ts +8 -0
  12. package/dist/generated/client/index.js +6 -0
  13. package/dist/generated/client/types.gen.d.ts +117 -0
  14. package/dist/generated/client/types.gen.js +2 -0
  15. package/dist/generated/client/utils.gen.d.ts +33 -0
  16. package/dist/generated/client/utils.gen.js +228 -0
  17. package/dist/generated/client.gen.d.ts +12 -0
  18. package/dist/generated/client.gen.js +3 -0
  19. package/dist/generated/core/auth.gen.d.ts +18 -0
  20. package/dist/generated/core/auth.gen.js +14 -0
  21. package/dist/generated/core/bodySerializer.gen.d.ts +25 -0
  22. package/dist/generated/core/bodySerializer.gen.js +57 -0
  23. package/dist/generated/core/params.gen.d.ts +43 -0
  24. package/dist/generated/core/params.gen.js +100 -0
  25. package/dist/generated/core/pathSerializer.gen.d.ts +33 -0
  26. package/dist/generated/core/pathSerializer.gen.js +106 -0
  27. package/dist/generated/core/queryKeySerializer.gen.d.ts +18 -0
  28. package/dist/generated/core/queryKeySerializer.gen.js +92 -0
  29. package/dist/generated/core/serverSentEvents.gen.d.ts +71 -0
  30. package/dist/generated/core/serverSentEvents.gen.js +132 -0
  31. package/dist/generated/core/types.gen.d.ts +78 -0
  32. package/dist/generated/core/types.gen.js +2 -0
  33. package/dist/generated/core/utils.gen.d.ts +19 -0
  34. package/dist/generated/core/utils.gen.js +87 -0
  35. package/dist/generated/sdk.gen.d.ts +885 -0
  36. package/dist/generated/sdk.gen.js +1614 -0
  37. package/dist/generated/types.gen.d.ts +6898 -0
  38. package/dist/generated/types.gen.js +2 -0
  39. package/dist/generated/zod.gen.d.ts +4873 -0
  40. package/dist/generated/zod.gen.js +2212 -0
  41. package/dist/index.d.ts +3 -0
  42. package/dist/index.js +3 -0
  43. package/dist/session.d.ts +92 -0
  44. package/dist/session.js +1 -0
  45. package/package.json +86 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ren Labs, Inc.
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 ADDED
@@ -0,0 +1,90 @@
1
+ # @renai-labs/sdk
2
+
3
+ TypeScript SDK for the Ren API.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @renai-labs/sdk
9
+ ```
10
+
11
+ ## Quick start
12
+
13
+ ```ts
14
+ import { createRenClient, pat } from "@renai-labs/sdk"
15
+
16
+ const client = createRenClient({
17
+ baseUrl: "https://api.ren.example",
18
+ auth: pat(process.env.REN_PAT_TOKEN!),
19
+ })
20
+
21
+ const { data: skills } = await client.skill.list()
22
+ ```
23
+
24
+ Calls are grouped by resource — `client.skill`, `client.agent`, `client.pod`, `client.routines`, `client.session`, `client.mcp`, `client.vault`, `client.credential`, `client.fileStore`, `client.memoryStore`, `client.environment`, `client.replay`, `client.registry`, `client.pat`. Each exposes the operations available on that resource.
25
+
26
+ Every method returns `{ data, error, request, response }`. `data` is typed to the success payload; `error` is the typed error body for non-2xx responses.
27
+
28
+ ## Authentication
29
+
30
+ Pass an auth strategy to `createRenClient`:
31
+
32
+ ```ts
33
+ import { createRenClient, pat } from "@renai-labs/sdk"
34
+
35
+ // Personal Access Token (server-side, CLIs, CI)
36
+ createRenClient({ baseUrl, auth: pat(token) })
37
+ ```
38
+
39
+ Custom strategies implement `AuthStrategy`:
40
+
41
+ ```ts
42
+ import type { AuthStrategy } from "@renai-labs/sdk"
43
+
44
+ const apiKey: AuthStrategy = {
45
+ apply: ({ headers }) => headers.set("X-Api-Key", process.env.MY_KEY!),
46
+ }
47
+
48
+ createRenClient({ baseUrl, auth: apiKey })
49
+ ```
50
+
51
+ ## Types
52
+
53
+ For apps that only need the shapes (form validators, type exports), use the `/types` subpath to avoid pulling in the client runtime:
54
+
55
+ ```ts
56
+ import type { Skill, SkillCreateData } from "@renai-labs/sdk/types"
57
+ ```
58
+
59
+ ## Errors
60
+
61
+ Non-2xx responses don't throw by default — check `error` or opt into throwing:
62
+
63
+ ```ts
64
+ const { data, error } = await client.skill.get({ path: { id } })
65
+ if (error) {
66
+ // error is typed to the operation's error schema
67
+ }
68
+
69
+ const { data } = await client.skill.get({
70
+ path: { id },
71
+ throwOnError: true,
72
+ })
73
+ ```
74
+
75
+ ## Configuration
76
+
77
+ `createRenClient` accepts any `@hey-api/client-fetch` `Config` option — `baseUrl`, `headers`, `fetch`, `credentials`, interceptors, etc.
78
+
79
+ ```ts
80
+ createRenClient({
81
+ baseUrl: "https://api.ren.example",
82
+ auth: pat(token),
83
+ headers: { "X-Request-Id": crypto.randomUUID() },
84
+ fetch: customFetch,
85
+ })
86
+ ```
87
+
88
+ ## License
89
+
90
+ MIT
package/dist/auth.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ export interface AuthStrategy {
2
+ apply(req: {
3
+ headers: Headers;
4
+ url: URL;
5
+ }): void | Promise<void>;
6
+ }
7
+ export declare const pat: (token: string) => AuthStrategy;
8
+ export declare const session: (cookie: string) => AuthStrategy;
package/dist/auth.js ADDED
@@ -0,0 +1,10 @@
1
+ export const pat = (token) => ({
2
+ apply: ({ headers }) => {
3
+ headers.set("Authorization", `Bearer ${token}`);
4
+ },
5
+ });
6
+ export const session = (cookie) => ({
7
+ apply: ({ headers }) => {
8
+ headers.set("Cookie", cookie);
9
+ },
10
+ });
@@ -0,0 +1,8 @@
1
+ import type { Config } from "./generated/client";
2
+ import { RenClient } from "./generated/sdk.gen";
3
+ import type { AuthStrategy } from "./auth";
4
+ export type RenClientConfig = Omit<Config, "auth"> & {
5
+ auth?: AuthStrategy;
6
+ };
7
+ export declare function createRenClient(config?: RenClientConfig): RenClient;
8
+ export { RenClient };
package/dist/client.js ADDED
@@ -0,0 +1,14 @@
1
+ import { createClient } from "./generated/client";
2
+ import { RenClient } from "./generated/sdk.gen";
3
+ export function createRenClient(config = {}) {
4
+ const { auth, ...rest } = config;
5
+ const client = createClient(rest);
6
+ if (auth) {
7
+ client.interceptors.request.use(async (req) => {
8
+ await auth.apply({ headers: req.headers, url: new URL(req.url) });
9
+ return req;
10
+ });
11
+ }
12
+ return new RenClient({ client });
13
+ }
14
+ export { RenClient };