langtrain 0.1.19 → 0.1.21
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/.agent/workflows/gsd.md +27 -0
- package/.agent/workflows/ralph.md +28 -0
- package/README.md +73 -68
- package/assets/cli-demo.png +0 -0
- package/dist/chunk-QZ6U7AJN.js +30 -0
- package/dist/chunk-QZ6U7AJN.js.map +1 -0
- package/dist/chunk-TDQXC2RA.mjs +30 -0
- package/dist/chunk-TDQXC2RA.mjs.map +1 -0
- package/dist/cli.js +8 -6
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +8 -6
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +67 -1
- package/dist/index.d.ts +67 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -1
- package/src/cli/auth.ts +2 -2
- package/src/cli/components/Table.ts +20 -0
- package/src/cli/handlers/agent.ts +35 -3
- package/src/cli/handlers/data.ts +128 -5
- package/src/cli/handlers/env.ts +89 -0
- package/src/cli/handlers/guardrails.ts +100 -0
- package/src/cli/handlers/logs.ts +68 -0
- package/src/cli/handlers/subscription.ts +2 -2
- package/src/cli/handlers/tune.ts +18 -8
- package/src/cli/handlers/vision.ts +2 -2
- package/src/cli/index.ts +100 -15
- package/src/cli/menu.ts +12 -1
- package/src/cli/ui.ts +13 -8
- package/src/index.ts +4 -1
- package/src/lib/agent.ts +7 -0
- package/src/lib/guardrails.ts +72 -0
- package/src/lib/secrets.ts +39 -0
- package/dist/chunk-PAHGEWDE.js +0 -30
- package/dist/chunk-PAHGEWDE.js.map +0 -1
- package/dist/chunk-Q46V6ODQ.mjs +0 -30
- package/dist/chunk-Q46V6ODQ.mjs.map +0 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run GSD, the high-velocity "Get Shit Done" implementation agent
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# GSD - Get Shit Done
|
|
6
|
+
|
|
7
|
+
GSD mode is for rapid, iterative implementation of a specific feature or fix.
|
|
8
|
+
|
|
9
|
+
1. **Understand the Goal**
|
|
10
|
+
- Read the user request and any linked files.
|
|
11
|
+
- If ambiguous, make a reasonable assumption and proceed (bias for action).
|
|
12
|
+
|
|
13
|
+
2. **Plan (Quickly)**
|
|
14
|
+
- Create a mini-plan in your scratchpad.
|
|
15
|
+
- Break down into: Backend, Frontend, Integration.
|
|
16
|
+
|
|
17
|
+
3. **Execute (Iterative)**
|
|
18
|
+
- **// turbo-all**
|
|
19
|
+
- Write code.
|
|
20
|
+
- Run tests/builds immediately after writing.
|
|
21
|
+
- Fix errors immediately. Do not ask for help unless blocked by missing credentials/info.
|
|
22
|
+
|
|
23
|
+
4. **Verify**
|
|
24
|
+
- Run the relevant verification script.
|
|
25
|
+
- If it passes, you are done.
|
|
26
|
+
|
|
27
|
+
**Motto**: "Perfect is the enemy of done. Ship it."
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run Ralph, the strict code quality and cleanup agent
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Ralph - The Code Janitor
|
|
6
|
+
|
|
7
|
+
Ralph's job is to ensure code quality, consistency, and cleanliness.
|
|
8
|
+
|
|
9
|
+
1. **Analyze Project Structure**
|
|
10
|
+
- Run `find . -maxdepth 2 -not -path '*/.*'` to see the lay of the land.
|
|
11
|
+
|
|
12
|
+
2. **Lint & Format**
|
|
13
|
+
- IF `package.json` exists:
|
|
14
|
+
- Run `npm run lint` or `pnpm lint`.
|
|
15
|
+
- If it fails, fix the errors automatically.
|
|
16
|
+
- IF `pyproject.toml` or `requirements.txt` exists:
|
|
17
|
+
- Run `ruff check . --fix` (if available) or `flake8 .`.
|
|
18
|
+
|
|
19
|
+
3. **Dead Code Detection**
|
|
20
|
+
- Search for TODOs and FIXMEs: `grep -r "TODO" .`, `grep -r "FIXME" .`
|
|
21
|
+
- Report them to the user but do NOT delete unless instructed.
|
|
22
|
+
|
|
23
|
+
4. **Security Scan**
|
|
24
|
+
- Check for hardcoded secrets (basic regex check).
|
|
25
|
+
- `grep -r "API_KEY" .` (exclude env files).
|
|
26
|
+
|
|
27
|
+
5. **Report**
|
|
28
|
+
- Generate a summary of what was cleaned and what needs attention.
|
package/README.md
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
+
<br />
|
|
2
3
|
<picture>
|
|
3
4
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/langtrain-ai/langtrain-sdk/main/public/langtrain-white.svg">
|
|
4
5
|
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/langtrain-ai/langtrain-sdk/main/public/langtrain-black.svg">
|
|
5
|
-
<img alt="Langtrain Logo" src="https://raw.githubusercontent.com/langtrain-ai/langtrain-sdk/main/public/langtrain-black.svg" width="
|
|
6
|
+
<img alt="Langtrain Logo" src="https://raw.githubusercontent.com/langtrain-ai/langtrain-sdk/main/public/langtrain-black.svg" width="280">
|
|
6
7
|
</picture>
|
|
7
|
-
<h3>Langtrain SDK</h3>
|
|
8
|
-
<p>The unified intelligence layer for JavaScript applications.</p>
|
|
9
8
|
|
|
9
|
+
<br />
|
|
10
|
+
<br />
|
|
11
|
+
|
|
12
|
+
<h1>The Unified AI Engineering Platform</h1>
|
|
13
|
+
|
|
14
|
+
<p style="font-size: 1.2rem; max-width: 600px; margin: 0 auto; color: #666;">
|
|
15
|
+
Build, fine-tune, and deploy autonomous agents with a single workflow.
|
|
16
|
+
<br />
|
|
17
|
+
Langtrain bridges the gap between local development and enterprise-grade cloud infrastructure.
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
<br />
|
|
21
|
+
|
|
10
22
|
<p>
|
|
11
23
|
<a href="https://www.npmjs.com/package/langtrain"><img src="https://img.shields.io/npm/v/langtrain?style=flat-square&labelColor=18181b&color=22c55e" alt="npm version" /></a>
|
|
12
24
|
<a href="https://www.npmjs.com/package/langtrain"><img src="https://img.shields.io/npm/dm/langtrain?style=flat-square&labelColor=18181b&color=3b82f6" alt="npm downloads" /></a>
|
|
@@ -15,119 +27,112 @@
|
|
|
15
27
|
<a href="https://github.com/langtrain-ai/langtrain-sdk/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/langtrain?style=flat-square&labelColor=18181b&color=3b82f6" alt="license" /></a>
|
|
16
28
|
</p>
|
|
17
29
|
|
|
18
|
-
<br/>
|
|
30
|
+
<br />
|
|
19
31
|
|
|
20
|
-
<
|
|
21
|
-
|
|
32
|
+
<a href="https://langtrain.xyz">
|
|
33
|
+
<img src="./assets/cli-demo.png" alt="Langtrain CLI Interface" width="100%" style="border-radius: 12px; border: 1px solid #333; box-shadow: 0 20px 40px -10px rgba(0,0,0,0.5);" />
|
|
34
|
+
</a>
|
|
22
35
|
|
|
23
|
-
<p>
|
|
24
|
-
If you are looking for the <em>web-based platform</em>, <strong>Langtrain Web</strong>, go to <a href="https://langtrain.xyz">langtrain.xyz</a>.
|
|
25
|
-
</p>
|
|
26
36
|
</div>
|
|
27
37
|
|
|
28
|
-
|
|
38
|
+
<br />
|
|
39
|
+
<br />
|
|
29
40
|
|
|
30
|
-
##
|
|
41
|
+
## Quick Start
|
|
31
42
|
|
|
32
|
-
|
|
43
|
+
Get up and running in seconds. Langtrain CLI is your gateway to the entire ecosystem.
|
|
33
44
|
|
|
34
|
-
```
|
|
45
|
+
```bash
|
|
46
|
+
# Install globally
|
|
35
47
|
npm install -g langtrain
|
|
36
|
-
```
|
|
37
48
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
```shell
|
|
49
|
+
# Start the interactive studio
|
|
41
50
|
lt
|
|
42
51
|
```
|
|
43
52
|
|
|
44
53
|
<details>
|
|
45
54
|
<summary><strong>Troubleshooting Installation</strong></summary>
|
|
46
55
|
|
|
47
|
-
If you encounter permission errors, try running with sudo or
|
|
56
|
+
If you encounter permission errors, try running with sudo or check your npm permissions:
|
|
48
57
|
```bash
|
|
49
58
|
sudo npm install -g langtrain
|
|
50
59
|
```
|
|
51
60
|
</details>
|
|
52
61
|
|
|
53
|
-
|
|
62
|
+
<br />
|
|
54
63
|
|
|
55
|
-
|
|
64
|
+
## Features
|
|
56
65
|
|
|
57
|
-
|
|
58
|
-
```shell
|
|
59
|
-
lt status
|
|
60
|
-
```
|
|
61
|
-
*Free plans allow local fine-tuning. Upgrade to Pro for cloud-based GPU training.*
|
|
66
|
+
Langtrain provides a complete toolkit for the modern AI engineer.
|
|
62
67
|
|
|
63
|
-
|
|
68
|
+
| Feature | Description |
|
|
69
|
+
| :--- | :--- |
|
|
70
|
+
| **Autonomous Agents** | Create, manage, and chat with custom agents. Routable via `lt agent`. |
|
|
71
|
+
| **Langtune** | Fine-tune LLMs (Llama 3, Mistral) locally using QLoRA or dispatch to H100s. |
|
|
72
|
+
| **Langvision** | Optimize multimodal datasets and vision models for edge deployment. |
|
|
73
|
+
| **Enterprise Security** | Local-first architecture. Your data leaves your machine only when you say so. |
|
|
74
|
+
| **Instant Deploy** | Push your verified agents to production endpoints with `lt deploy`. |
|
|
64
75
|
|
|
65
|
-
|
|
76
|
+
<br />
|
|
66
77
|
|
|
67
|
-
|
|
78
|
+
## SDK Integration
|
|
79
|
+
|
|
80
|
+
Use the power of Langtrain directly in your Node.js or TypeScript applications.
|
|
68
81
|
|
|
69
82
|
```typescript
|
|
70
|
-
import { Langvision, Langtune
|
|
83
|
+
import { Langvision, Langtune } from 'langtrain';
|
|
71
84
|
|
|
72
|
-
//
|
|
85
|
+
// Initialize with your project context
|
|
73
86
|
const vision = new Langvision({ apiKey: process.env.LANGTRAIN_API_KEY });
|
|
74
87
|
const tune = new Langtune({ apiKey: process.env.LANGTRAIN_API_KEY });
|
|
75
88
|
|
|
76
|
-
async function
|
|
77
|
-
// Analyze
|
|
78
|
-
const
|
|
79
|
-
image: './dashboard.
|
|
80
|
-
|
|
89
|
+
async function main() {
|
|
90
|
+
// 1. Analyze Visual Context
|
|
91
|
+
const analysis = await vision.analyze({
|
|
92
|
+
image: './dashboard.png',
|
|
93
|
+
prompt: 'Extract UI component hierarchy'
|
|
81
94
|
});
|
|
82
95
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
model: 'gpt-4-vision-optimized',
|
|
88
|
-
prompt: `Explain this dashboard layout: ${context.description}`
|
|
96
|
+
// 2. Generate Optimized Code
|
|
97
|
+
const code = await tune.generate({
|
|
98
|
+
model: 'gpt-4-turbo',
|
|
99
|
+
prompt: `Create a React component based on: ${analysis.description}`
|
|
89
100
|
});
|
|
90
101
|
|
|
91
|
-
console.log(
|
|
102
|
+
console.log(code);
|
|
92
103
|
}
|
|
93
104
|
```
|
|
94
105
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
- **AI Agents**: Create, manage, and chat with custom AI agents hosted on Langtrain Server.
|
|
98
|
-
- **Langtune**: Fine-tune LLMs (Llama 3, Mistral) locally or on the cloud.
|
|
99
|
-
- **Langvision**: Optimize and fine-tune multimodal vision models.
|
|
100
|
-
- **Data Persistence**: Automatically sync datasets and training jobs with your workspace.
|
|
101
|
-
- **Subscription Management**: Verify plan limits and feature access programmatically.
|
|
106
|
+
<br />
|
|
102
107
|
|
|
103
108
|
## Configuration
|
|
104
109
|
|
|
105
|
-
|
|
110
|
+
Configure your environment seamlessly via CLI or environment variables.
|
|
106
111
|
|
|
107
112
|
| Variable | Description |
|
|
108
113
|
| :--- | :--- |
|
|
109
|
-
| `LANGTRAIN_API_KEY` | Your project
|
|
110
|
-
| `LANGTRAIN_WORKSPACE_ID` | (Optional)
|
|
114
|
+
| `LANGTRAIN_API_KEY` | Your project Secret Key (find it in Settings). |
|
|
115
|
+
| `LANGTRAIN_WORKSPACE_ID` | (Optional) Target specific workspace environments. |
|
|
111
116
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
apiKey: "lt_sk_...",
|
|
116
|
-
workspaceId: "ws_..."
|
|
117
|
-
});
|
|
118
|
-
```
|
|
117
|
+
> **Pro Tip:** Run `lt login` to authenticate continuously without managing `.env` files manually.
|
|
118
|
+
|
|
119
|
+
<br />
|
|
119
120
|
|
|
120
|
-
##
|
|
121
|
+
## Community & Support
|
|
121
122
|
|
|
122
|
-
|
|
123
|
+
Join the thousands of engineers building with Langtrain.
|
|
123
124
|
|
|
124
|
-
|
|
125
|
+
- **[Documentation](https://docs.langtrain.xyz)** - Guides, API Reference, and Tutorials.
|
|
126
|
+
- **[GitHub Discussions](https://github.com/langtrain-ai/langtrain-sdk/discussions)** - Ask questions, request features.
|
|
127
|
+
- **[Enterprise Support](mailto:support@langtrain.xyz)** - Dedicated support for teams.
|
|
125
128
|
|
|
126
|
-
|
|
127
|
-
- [**SDK Reference**](https://docs.langtrain.xyz/sdk)
|
|
128
|
-
- [**Contributing**](./CONTRIBUTING.md)
|
|
129
|
+
<br />
|
|
129
130
|
|
|
130
|
-
|
|
131
|
+
---
|
|
131
132
|
|
|
132
|
-
|
|
133
|
-
|
|
133
|
+
<div align="center">
|
|
134
|
+
<p style="color: #666; font-size: 0.9rem;">
|
|
135
|
+
© 2024 Langtrain AI Inc. All rights reserved. <br />
|
|
136
|
+
<a href="https://langtrain.xyz/privacy">Privacy Policy</a> • <a href="https://langtrain.xyz/terms">Terms of Service</a>
|
|
137
|
+
</p>
|
|
138
|
+
</div>
|
|
Binary file
|