@oagi/oagi 0.1.3
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 +154 -0
- package/dist/chunk-SDBYP57G.js +1536 -0
- package/dist/chunk-SDBYP57G.js.map +1 -0
- package/dist/cli.cjs +1927 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +2 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +414 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +1173 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +567 -0
- package/dist/index.d.ts +567 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 OpenAGI Foundation
|
|
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,154 @@
|
|
|
1
|
+
# OAGI TypeScript SDK
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for the OAGI API - vision-based task automation.
|
|
4
|
+
|
|
5
|
+
## What is OAGI?
|
|
6
|
+
|
|
7
|
+
OAGI is the TypeScript SDK for **Lux**, the world's most advanced computer-use model from the OpenAGI Foundation.
|
|
8
|
+
|
|
9
|
+
**Computer Use** is AI's ability to operate human-facing software — not just through APIs, but by operating computers natively, just as human users do. It's a paradigm shift in what AI can do: not just generating, reasoning, or researching, but actually operating on your computer.
|
|
10
|
+
|
|
11
|
+
Lux comes in three modes, giving you control over depth, speed, and style of execution:
|
|
12
|
+
|
|
13
|
+
- **Tasker** — Strictly follows step-by-step instructions with ultra-stable, controllable execution
|
|
14
|
+
- **Actor** — Ideal for immediate tasks, completing actions at near-instant speed
|
|
15
|
+
- **Thinker** — Understands vague, complex goals, performing hour-long executions
|
|
16
|
+
|
|
17
|
+
### Use Cases
|
|
18
|
+
|
|
19
|
+
With Lux, possibilities are endless. Here are a few examples:
|
|
20
|
+
|
|
21
|
+
- **Web Scraping & Data Crawl** — Navigate websites, sort results, and collect product information autonomously
|
|
22
|
+
- **Software QA** — Automate repetitive testing tasks, navigate applications, perform test actions, and validate expected behaviors
|
|
23
|
+
- **Financial Data Extraction** — Navigate to sites like NASDAQ and extract insider activity data
|
|
24
|
+
- **Data Entry** — Enter accurate data across dashboards and forms
|
|
25
|
+
- **Workflow Automation** — Chain together multi-step tasks across different applications
|
|
26
|
+
|
|
27
|
+
## Table of Contents
|
|
28
|
+
|
|
29
|
+
- [OAGI TypeScript SDK](#oagi-typescript-sdk)
|
|
30
|
+
- [What is OAGI?](#what-is-oagi)
|
|
31
|
+
- [Use Cases](#use-cases)
|
|
32
|
+
- [Table of Contents](#table-of-contents)
|
|
33
|
+
- [Installation](#installation)
|
|
34
|
+
- [Quick Start](#quick-start)
|
|
35
|
+
- [Automated Task Execution](#automated-task-execution)
|
|
36
|
+
- [Command Line Interface](#command-line-interface)
|
|
37
|
+
- [Image Processing](#image-processing)
|
|
38
|
+
- [Manual Control with Actor](#manual-control-with-actor)
|
|
39
|
+
- [Documentation](#documentation)
|
|
40
|
+
- [License](#license)
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# If you are using Node.js
|
|
46
|
+
npm install oagi
|
|
47
|
+
yarn add oagi
|
|
48
|
+
pnpm add oagi
|
|
49
|
+
|
|
50
|
+
# If you are using Deno
|
|
51
|
+
deno add npm:oagi
|
|
52
|
+
|
|
53
|
+
# If you are using Bun
|
|
54
|
+
bun install oagi
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Quick Start
|
|
58
|
+
|
|
59
|
+
Set your API credentials:
|
|
60
|
+
```bash
|
|
61
|
+
export OAGI_API_KEY="your-api-key" # get your API key from https://developer.agiopen.org/
|
|
62
|
+
# export OAGI_BASE_URL="https://api.agiopen.org/", # optional, defaults to production endpoint
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Automated Task Execution
|
|
66
|
+
|
|
67
|
+
Run tasks automatically with screenshot capture and action execution:
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { DefaultActionHandler, DefaultAgent, ScreenshotMaker } from 'oagi';
|
|
71
|
+
|
|
72
|
+
const agent = new DefaultAgent();
|
|
73
|
+
await agent.execute(
|
|
74
|
+
'Search weather on Google',
|
|
75
|
+
new DefaultActionHandler(),
|
|
76
|
+
new ScreenshotMaker(),
|
|
77
|
+
);
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Command Line Interface
|
|
81
|
+
|
|
82
|
+
Run agents directly from the terminal:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Run with actor model
|
|
86
|
+
oagi agent run "Go to nasdaq.com, search for AAPL. Under More, go to Insider Activity" --model lux-actor-1
|
|
87
|
+
|
|
88
|
+
# Run with thinker mode (uses lux-thinker-1 model with more steps)
|
|
89
|
+
oagi agent run "Look up the store hours for the nearest Apple Store to zip code 23456 using the Apple Store Locator" --model lux-thinker-1
|
|
90
|
+
|
|
91
|
+
# Run pre-configured tasker workflows (no instruction needed)
|
|
92
|
+
oagi agent run --mode tasker:software_qa
|
|
93
|
+
|
|
94
|
+
# List all available modes
|
|
95
|
+
oagi agent modes
|
|
96
|
+
|
|
97
|
+
# Check macOS permissions (screen recording & accessibility)
|
|
98
|
+
oagi agent permission
|
|
99
|
+
|
|
100
|
+
# Export execution history
|
|
101
|
+
oagi agent run "Complete the form" --export html --export-file report.html
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
CLI options:
|
|
105
|
+
- `--mode`: Agent mode (default: actor). Use `oagi agent modes` to list available modes
|
|
106
|
+
- `--model`: Override the model (default: determined by mode)
|
|
107
|
+
- `--max-steps`: Maximum steps (default: determined by mode)
|
|
108
|
+
- `--temperature`: Sampling temperature (default: determined by mode)
|
|
109
|
+
- `--step-delay`: Delay after each action before next screenshot (default: 0.3s)
|
|
110
|
+
- `--export`: Export format (markdown, html, json)
|
|
111
|
+
- `--export-file`: Output file path for export
|
|
112
|
+
|
|
113
|
+
### Image Processing
|
|
114
|
+
|
|
115
|
+
Process and optimize images before sending to API:
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
import sharp from 'sharp';
|
|
119
|
+
|
|
120
|
+
const compressed = await sharp('large_screenshot.png')
|
|
121
|
+
.resize(1260, 700, { fit: 'fill' })
|
|
122
|
+
.jpeg({ quality: 85 })
|
|
123
|
+
.toBuffer();
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Manual Control with Actor
|
|
127
|
+
|
|
128
|
+
For step-by-step control over task execution:
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
import { Actor, DefaultActionHandler, ScreenshotMaker } from 'oagi';
|
|
132
|
+
|
|
133
|
+
const actor = new Actor();
|
|
134
|
+
actor.initTask('Complete the form');
|
|
135
|
+
const image_provider = new ScreenshotMaker();
|
|
136
|
+
const action_handler = new DefaultActionHandler();
|
|
137
|
+
|
|
138
|
+
for (let i = 0; i < 10; ++i) {
|
|
139
|
+
const image = await image_provider.provide();
|
|
140
|
+
const step = await actor.step(image);
|
|
141
|
+
|
|
142
|
+
if (step.stop) break;
|
|
143
|
+
|
|
144
|
+
await action_handler.handle(step.actions);
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Documentation
|
|
149
|
+
|
|
150
|
+
For full Lux documentation and guides, visit the [OAGI Developer Documentation](https://developer.agiopen.org/docs/index).
|
|
151
|
+
|
|
152
|
+
## License
|
|
153
|
+
|
|
154
|
+
MIT
|