Skip to content

Commit 7a4e155

Browse files
authored
Refactor API: Move automate to agent client and remove extract.schema (#5)
## Summary - Moves automate functionality behind a new `agent` client (`tabs.agent.automate()`) - Removes `extract.schema()` method entirely - Updates all documentation, examples, and tests to reflect the new API ## Changes - **New Agent Client**: Created `Agent` class to handle automation - **API Simplification**: Removed `extract.schema()` method and `ExtractSchemaOptions` type - **Updated Documentation**: README and examples now reflect the new API - **Test Coverage**: All 233 tests pass ## Migration Guide ### Before ```typescript for await (const event of tabs.automate.execute(task, options)) { ... } const schema = await tabs.extract.schema(url, { instructions: "..." }); ``` ### After ```typescript for await (const event of tabs.agent.automate(task, options)) { ... } // extract.schema() removed - use predefined schemas instead ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent a466e4e commit 7a4e155

23 files changed

+268
-506
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contributing to TABStack TypeScript SDK
1+
# Contributing to Tabstack TypeScript SDK
22

33
Thank you for your interest in contributing! This document provides guidelines for contributing to the project.
44

LICENSE

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -162,20 +162,31 @@
162162
other commercial damages or losses), even if such Contributor
163163
has been advised of the possibility of such damages.
164164

165-
9. Accepting Warranty or Support. While redistributing the Work or
166-
Derivative Works thereof, You may choose to offer, and charge a fee
167-
for, acceptance of support, warranty, indemnity, or other liability
168-
obligations and/or rights consistent with this License. However, in
169-
accepting such obligations, You may act only on Your own behalf and
170-
on Your sole responsibility, not on behalf of any other Contributor,
171-
and only if You agree to indemnify, defend, and hold each Contributor
172-
harmless for any liability incurred by, or claims asserted against,
173-
such Contributor by reason of your accepting any such warranty or
174-
additional liability.
165+
9. Accepting Warranty or Additional Liability. While redistributing
166+
the Work or Derivative Works thereof, You may choose to offer,
167+
and charge a fee for, acceptance of support, warranty, indemnity,
168+
or other liability obligations and/or rights consistent with this
169+
License. However, in accepting such obligations, You may act only
170+
on Your own behalf and on Your sole responsibility, not on behalf
171+
of any other Contributor, and only if You agree to indemnify,
172+
defend, and hold each Contributor harmless for any liability
173+
incurred by, or claims asserted against, such Contributor by reason
174+
of your accepting any such warranty or additional liability.
175175

176176
END OF TERMS AND CONDITIONS
177177

178-
Copyright 2025 TABStack
178+
APPENDIX: How to apply the Apache License to your work.
179+
180+
To apply the Apache License to your work, attach the following
181+
boilerplate notice, with the fields enclosed by brackets "[]"
182+
replaced with your own identifying information. (Don't include
183+
the brackets!) The text should be enclosed in the appropriate
184+
comment syntax for the file format. We also recommend that a
185+
file or class name and description of purpose be included on the
186+
same "printed page" as the copyright notice for easier
187+
identification within third-party archives.
188+
189+
Copyright 2025 Mozilla
179190

180191
Licensed under the Apache License, Version 2.0 (the "License");
181192
you may not use this file except in compliance with the License.

README.md

Lines changed: 17 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
# TABStack AI TypeScript SDK
1+
# Tabstack TypeScript SDK
22

3-
TypeScript/JavaScript SDK for [TABStack AI](https://tabstack.ai) - Extract, Generate, and Automate web content with AI.
3+
> [!WARNING]
4+
> **Early Release**: This SDK is in early development. The API may change in future releases as we refine and improve the library based on user feedback.
5+
6+
TypeScript/JavaScript SDK for [Tabstack](https://tabstack.ai) - Extract, Generate, and Automate web content with AI.
47

58
## Features
69

7-
- **Extract**: Convert web pages to Markdown, generate schemas, and extract structured JSON data
10+
- **Extract**: Convert web pages to Markdown and extract structured JSON data
811
- **Generate**: Transform web content using AI with custom instructions
9-
- **Automate**: Execute complex browser automation tasks with natural language
12+
- **Agent**: Execute complex browser automation tasks with natural language
1013
- **Type-Safe**: Full TypeScript support with comprehensive type definitions
1114
- **Zero Dependencies**: Uses only Node.js standard library
1215
- **Universal Module Support**: Works with CommonJS, ESM, and all TypeScript configurations
@@ -72,9 +75,9 @@ Sign up at [tabstack.ai](https://tabstack.ai) to get your API key.
7275

7376
#### ES Modules (ESM)
7477
```typescript
75-
import { TABStack } from '@tabstack/sdk';
78+
import { Tabstack } from '@tabstack/sdk';
7679

77-
const tabs = new TABStack({
80+
const tabs = new Tabstack({
7881
apiKey: process.env.TABSTACK_API_KEY!
7982
});
8083

@@ -108,9 +111,9 @@ console.log(data.data);
108111

109112
#### CommonJS
110113
```javascript
111-
const { TABStack } = require('@tabstack/sdk');
114+
const { Tabstack } = require('@tabstack/sdk');
112115

113-
const tabs = new TABStack({
116+
const tabs = new Tabstack({
114117
apiKey: process.env.TABSTACK_API_KEY
115118
});
116119

@@ -168,20 +171,6 @@ const result = await tabs.extract.json('https://example.com/products', schema);
168171
console.log(result.data);
169172
```
170173

171-
### Generate Schema
172-
173-
Generate a JSON schema from web content:
174-
175-
```typescript
176-
const schema = await tabs.extract.schema('https://news.ycombinator.com', {
177-
instructions: 'extract top stories with title, points, and author'
178-
});
179-
180-
// Use the generated schema for extraction
181-
const result = await tabs.extract.json('https://news.ycombinator.com', schema);
182-
console.log(result.data);
183-
```
184-
185174
### Generate Content
186175

187176
Transform web content using AI:
@@ -220,7 +209,7 @@ console.log(result.data);
220209
Execute browser automation tasks with streaming updates:
221210

222211
```typescript
223-
for await (const event of tabs.automate.execute(
212+
for await (const event of tabs.agent.automate(
224213
'Find the top 3 trending repositories and extract their details',
225214
{
226215
url: 'https://github.com/trending',
@@ -240,9 +229,7 @@ for await (const event of tabs.automate.execute(
240229

241230
## Working with JSON Schemas
242231

243-
The SDK uses standard [JSON Schema](https://json-schema.org/) format for defining data structures. You can define schemas manually or generate them automatically:
244-
245-
### Manual Schema Definition
232+
The SDK uses standard [JSON Schema](https://json-schema.org/) format for defining data structures:
246233

247234
```typescript
248235
const schema = {
@@ -280,27 +267,13 @@ const schema = {
280267
};
281268
```
282269

283-
### Automatic Schema Generation
284-
285-
Let the AI generate a schema from any webpage:
286-
287-
```typescript
288-
// Generate schema from content
289-
const schema = await tabs.extract.schema('https://news.ycombinator.com', {
290-
instructions: 'extract stories with title, points, and author'
291-
});
292-
293-
// Use it immediately
294-
const data = await tabs.extract.json('https://news.ycombinator.com', schema);
295-
```
296-
297270
## Error Handling
298271

299272
Handle errors with specific error classes:
300273

301274
```typescript
302275
import {
303-
TABStackError,
276+
TabstackError,
304277
UnauthorizedError,
305278
InvalidURLError,
306279
BadRequestError,
@@ -314,15 +287,15 @@ try {
314287
console.error('Invalid API key');
315288
} else if (error instanceof InvalidURLError) {
316289
console.error('Invalid or inaccessible URL');
317-
} else if (error instanceof TABStackError) {
290+
} else if (error instanceof TabstackError) {
318291
console.error(`API error: ${error.message}`);
319292
}
320293
}
321294
```
322295

323296
### Error Classes
324297

325-
- `TABStackError` - Base error class
298+
- `TabstackError` - Base error class
326299
- `BadRequestError` - 400: Malformed request
327300
- `UnauthorizedError` - 401: Invalid API key
328301
- `InvalidURLError` - 422: Invalid or inaccessible URL
@@ -333,7 +306,7 @@ try {
333306
## Requirements
334307

335308
- Node.js >= 20.0.0
336-
- TABStack API key ([get one here](https://tabstack.ai))
309+
- Tabstack API key ([get one here](https://tabstack.ai))
337310

338311
## Development & Testing
339312

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@tabstack/sdk",
33
"version": "0.0.0",
4-
"description": "TypeScript/JavaScript SDK for TABStack AI - Extract, Generate, and Automate web content",
4+
"description": "TypeScript/JavaScript SDK for Tabstack - Extract, Generate, and Automate web content",
55
"main": "./dist/cjs/index.js",
66
"module": "./dist/esm/index.js",
77
"types": "./dist/types/index.d.ts",
@@ -55,7 +55,7 @@
5555
"typescript",
5656
"javascript"
5757
],
58-
"author": "TABStack",
58+
"author": "Tabstack",
5959
"license": "Apache-2.0",
6060
"repository": {
6161
"type": "git",

0 commit comments

Comments
 (0)