@japro/luma-sdk 0.1.0 → 0.1.1
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/README.md +116 -0
- package/package.json +12 -13
package/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Luma SDK
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for the Luma agentic platform used by Mentingo.
|
|
4
|
+
This SDK wraps Luma's public API for multi-agent draft creation, ingestion, chat, and generated course retrieval.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pnpm add @japro/luma-sdk
|
|
10
|
+
# or
|
|
11
|
+
npm install @japro/luma-sdk
|
|
12
|
+
# or
|
|
13
|
+
yarn add @japro/luma-sdk
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { createLumaClient } from "@japro/luma-sdk";
|
|
20
|
+
|
|
21
|
+
const client = createLumaClient({
|
|
22
|
+
baseURL: "https://your-luma-api.example.com",
|
|
23
|
+
apiKey: process.env.LUMA_API_KEY,
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Client Options
|
|
28
|
+
|
|
29
|
+
- `baseURL?: string` - Luma API base URL.
|
|
30
|
+
- `apiKey?: string` - API key sent as `X-API-Key`.
|
|
31
|
+
- `httpsAgent?: Agent` - custom Node.js HTTPS agent.
|
|
32
|
+
- `allowInsecureTls?: boolean` - if `true`, creates an HTTPS agent with `rejectUnauthorized: false` (use only in local/dev environments).
|
|
33
|
+
|
|
34
|
+
## Core API
|
|
35
|
+
|
|
36
|
+
### 1) Create a draft
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
const draft = await client.createDraft({
|
|
40
|
+
integrationId: "course-123",
|
|
41
|
+
draftName: "Cybersecurity Fundamentals",
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
console.log(draft.draftId);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2) Ingest a file into a draft
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
const file = new File(["file-content"], "source.txt", { type: "text/plain" });
|
|
51
|
+
|
|
52
|
+
const ingestResult = await client.ingestDraftFile({
|
|
53
|
+
integrationId: "course-123",
|
|
54
|
+
file,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
console.log(ingestResult.success, ingestResult.jobId);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 3) Chat with the draft context
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
const response = await client.chat({
|
|
64
|
+
integrationId: "course-123",
|
|
65
|
+
message: "Build a 5-module beginner learning path",
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
console.log(response.data);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 4) Read draft artifacts
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
const status = await client.getDraft({ integrationId: "course-123" });
|
|
75
|
+
const files = await client.getDraftFiles({ integrationId: "course-123" });
|
|
76
|
+
const messages = await client.getDraftMessages({ integrationId: "course-123" });
|
|
77
|
+
const course = await client.getGeneratedCourse({ integrationId: "course-123" });
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 5) Delete ingested documents
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
await client.deleteIngestedDocument({
|
|
84
|
+
integrationId: "course-123",
|
|
85
|
+
documentId: "doc-uuid",
|
|
86
|
+
});
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Exports
|
|
90
|
+
|
|
91
|
+
- `createLumaClient(opts)`
|
|
92
|
+
- `LumaClient`
|
|
93
|
+
- All SDK types from `src/types.ts`
|
|
94
|
+
|
|
95
|
+
## Development
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
pnpm install
|
|
99
|
+
pnpm build
|
|
100
|
+
pnpm lint
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Regenerate API client from OpenAPI schema
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pnpm generate:client
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
This uses `src/api/api-schema-public.json` to regenerate `src/api/generated-api.ts`.
|
|
110
|
+
|
|
111
|
+
## Notes
|
|
112
|
+
|
|
113
|
+
- The SDK is built with `tsup` and ships both ESM and CJS outputs.
|
|
114
|
+
- API calls are authenticated with the `X-API-Key` header.
|
|
115
|
+
- `chat(...)` returns the underlying HTTP response from the generated API client.
|
|
116
|
+
- Keep API keys out of source control and prefer environment variables.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@japro/luma-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Luma API SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -17,17 +17,6 @@
|
|
|
17
17
|
"files": [
|
|
18
18
|
"dist"
|
|
19
19
|
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
22
|
-
"dev": "tsup src/index.ts --watch --format esm,cjs --dts",
|
|
23
|
-
"lint": "eslint .",
|
|
24
|
-
"lint:fix": "eslint . --fix",
|
|
25
|
-
"format": "prettier . --write",
|
|
26
|
-
"format:check": "prettier . --check",
|
|
27
|
-
"clean": "rm -rf dist",
|
|
28
|
-
"prepublishOnly": "pnpm clean && pnpm build",
|
|
29
|
-
"generate:client": "swagger-typescript-api generate -p ./src/api/api-schema-public.json -o ./src/api --axios --name generated-api.ts --api-class-name API"
|
|
30
|
-
},
|
|
31
20
|
"devDependencies": {
|
|
32
21
|
"@eslint/js": "^9.35.0",
|
|
33
22
|
"@types/node": "^25.3.0",
|
|
@@ -42,5 +31,15 @@
|
|
|
42
31
|
},
|
|
43
32
|
"dependencies": {
|
|
44
33
|
"axios": "^1.13.5"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
37
|
+
"dev": "tsup src/index.ts --watch --format esm,cjs --dts",
|
|
38
|
+
"lint": "eslint .",
|
|
39
|
+
"lint:fix": "eslint . --fix",
|
|
40
|
+
"format": "prettier . --write",
|
|
41
|
+
"format:check": "prettier . --check",
|
|
42
|
+
"clean": "rm -rf dist",
|
|
43
|
+
"generate:client": "swagger-typescript-api generate -p ./src/api/api-schema-public.json -o ./src/api --axios --name generated-api.ts --api-class-name API"
|
|
45
44
|
}
|
|
46
|
-
}
|
|
45
|
+
}
|