Skip to content

Commit 9667c74

Browse files
committed
feat: add @thirdweb-dev/nebula package. (#7389)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> This PR adds the new `@thirdweb-dev/nebula` package. It's an OpenAPI Typescript Wrapper for the new Nebula APIs. <!-- start pr-codex --> --- ## PR-Codex overview This PR introduces the initial release of the `@thirdweb-dev/nebula` TypeScript SDK, providing a wrapper for the Nebula API with configuration options and client functionalities. ### Detailed summary - Added `@thirdweb-dev/nebula` package with initial release. - Created configuration functions: `configure`, `configureWithClient`, and `getNebulaClient`. - Generated client and types using `@hey-api/openapi-ts`. - Included comprehensive README with usage examples. - Established TypeScript configuration files. > The following files were skipped due to too many changes: `packages/nebula/src/client/types.gen.ts` > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced the Nebula TypeScript SDK as a new package, providing a client for interacting with the Nebula OpenAPI AI agent service. - Added configuration utilities for flexible authentication and integration with existing clients. - Exposed a comprehensive set of API methods for managing agents, conversations, models, and user data. - Extended build scripts to include the Nebula package in relevant workspace commands. - **Documentation** - Added detailed README with setup instructions and usage examples for the Nebula SDK. - **Chores** - Added configuration and build files to support development and compilation of the new package. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 997beea commit 9667c74

16 files changed

+5862
-36
lines changed

.changeset/vast-tires-tickle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@thirdweb-dev/nebula": minor
3+
---
4+
5+
Initial release of the Nebula TS sdk

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@
5555
"build": "turbo run build --filter=./packages/*",
5656
"build:release": "turbo run build --filter=./packages/* --force",
5757
"changeset": "changeset",
58-
"dashboard": "turbo run dev --filter=./apps/dashboard --filter=./packages/thirdweb --filter=./packages/insight --filter=./packages/vault-sdk --filter=./packages/engine",
58+
"dashboard": "turbo run dev --filter=./apps/dashboard --filter=./packages/thirdweb --filter=./packages/insight --filter=./packages/vault-sdk --filter=./packages/engine --filter=./packages/nebula",
5959
"dashboard:build": "turbo run build --filter=./apps/dashboard",
6060
"e2e": "turbo run e2e --filter=./packages/*",
6161
"fix": "turbo run fix",
6262
"hotlink-init": "node ./scripts/hotlink/hotlink-init.mjs",
6363
"hotlink-revert": "node ./scripts/hotlink/hotlink-revert.mjs",
6464
"lint": "pnpm dlx sherif@latest -i remark-gfm -i eslint && turbo run lint",
65-
"playground": "turbo run dev --filter=./apps/playground-web --filter=./packages/thirdweb --filter=./packages/insight --filter=./packages/engine",
65+
"playground": "turbo run dev --filter=./apps/playground-web --filter=./packages/thirdweb --filter=./packages/insight --filter=./packages/engine --filter=./packages/nebula",
6666
"playground:build": "turbo run build --filter=./apps/playground-web",
67-
"portal": "turbo run dev --filter=./apps/portal --filter=./packages/thirdweb --filter=./packages/insight --filter=./packages/engine",
67+
"portal": "turbo run dev --filter=./apps/portal --filter=./packages/thirdweb --filter=./packages/insight --filter=./packages/engine --filter=./packages/nebula",
6868
"portal:build": "turbo run build --filter=./apps/portal",
6969
"prefix": "pnpm dlx sherif@latest -i remark-gfm -i eslint --fix",
7070
"preinstall": "npx only-allow pnpm",
@@ -75,8 +75,9 @@
7575
"typedoc": "turbo run typedoc",
7676
"version-packages": "changeset version",
7777
"version-packages:nightly": "node scripts/pre-nightly.mjs && changeset version --snapshot nightly",
78-
"wallet-ui": "turbo run dev --filter=./apps/wallet-ui --filter=./packages/thirdweb --filter=./packages/insight --filter=./packages/engine",
79-
"wallet-ui:build": "turbo run build --filter=./apps/wallet-ui --filter=./packages/thirdweb --filter=./packages/insight --filter=./packages/engine"
78+
"wallet-ui": "turbo run dev --filter=./apps/wallet-ui --filter=./packages/thirdweb --filter=./packages/insight --filter=./packages/engine --filter=./packages/nebula",
79+
"wallet-ui:build": "turbo run build --filter=./apps/wallet-ui --filter=./packages/thirdweb --filter=./packages/insight --filter=./packages/engine --filter=./packages/nebula"
8080
},
81+
8182
"version": "1.0.0"
8283
}

packages/nebula/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Nebula OpenAPI TypeScript wrapper
2+
3+
This package is a thin OpenAPI wrapper for Nebula, our AI agent service.
4+
5+
## Configuration
6+
7+
```ts
8+
import { configure } from "@thirdweb-dev/nebula";
9+
10+
// call this once at the startup of your application
11+
configure({
12+
secretKey: "<PROJECT_SECRET_KEY>",
13+
});
14+
```
15+
16+
You can also configure the client with a Thirdweb client instance:
17+
18+
```ts
19+
import { configureWithClient } from "@thirdweb-dev/nebula";
20+
import { twClient } from "./thirdwebClient";
21+
22+
// call this once at the startup of your application
23+
configureWithClient(twClient);
24+
```
25+
26+
## Example Usage
27+
28+
```ts
29+
import { getModels } from "@thirdweb-dev/nebula";
30+
31+
const models = await getModels();
32+
```
33+
34+
You can also use this package on a client application (eg. NextJS) by retrieving the Nebula API client first.
35+
36+
```ts
37+
import { getNebulaClient, getAgents } from "@thirdweb-dev/nebula";
38+
39+
// retrieve the Nebula auth token
40+
const nebulaClient = getNebulaClient(authToken);
41+
42+
// pass the client inside the methods
43+
const agentsResult = await getAgents({ client: nebulaClient });
44+
```
45+
46+
This package was autogenerated from the [Nebula openAPI spec](https://nebula-api.thirdweb.com/docs) using [@hey-api/openapi-ts](https://github.com/hey-api/openapi-ts)

packages/nebula/biome.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
3+
"extends": "//"
4+
}

packages/nebula/openapi-ts.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { defineConfig } from "@hey-api/openapi-ts";
2+
3+
export default defineConfig({
4+
input: "https://nebula-api.thirdweb-dev.com/openapi.json",
5+
output: { format: "biome", lint: "biome", path: "src/client" },
6+
plugins: ["@hey-api/client-fetch"],
7+
});

packages/nebula/package.json

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"name": "@thirdweb-dev/nebula",
3+
"version": "0.0.0",
4+
"repository": {
5+
"type": "git",
6+
"url": "git+https://github.com/thirdweb-dev/js.git#main"
7+
},
8+
"license": "Apache-2.0",
9+
"bugs": {
10+
"url": "https://github.com/thirdweb-dev/js/issues"
11+
},
12+
"author": "thirdweb eng <[email protected]>",
13+
"type": "module",
14+
"main": "./dist/cjs/exports/thirdweb.js",
15+
"module": "./dist/esm/exports/thirdweb.js",
16+
"types": "./dist/types/exports/thirdweb.d.ts",
17+
"typings": "./dist/types/exports/thirdweb.d.ts",
18+
"exports": {
19+
".": {
20+
"types": "./dist/types/exports/thirdweb.d.ts",
21+
"import": "./dist/esm/exports/thirdweb.js",
22+
"default": "./dist/cjs/exports/thirdweb.js"
23+
},
24+
"./package.json": "./package.json"
25+
},
26+
"files": [
27+
"dist/*",
28+
"src/*"
29+
],
30+
"dependencies": {
31+
"@hey-api/client-fetch": "0.10.0",
32+
"thirdweb": "workspace:*"
33+
},
34+
"devDependencies": {
35+
"@biomejs/biome": "2.0.0",
36+
"@hey-api/openapi-ts": "0.72.1",
37+
"rimraf": "6.0.1",
38+
"tslib": "^2.8.1"
39+
},
40+
"peerDependencies": {
41+
"typescript": ">=5.0.4"
42+
},
43+
"peerDependenciesMeta": {
44+
"typescript": {
45+
"optional": true
46+
}
47+
},
48+
"scripts": {
49+
"format": "biome format ./src --write",
50+
"lint": "biome check ./src",
51+
"fix": "biome check ./src --fix",
52+
"build": "pnpm clean && pnpm build:cjs && pnpm build:esm && pnpm build:types",
53+
"build:cjs": "tsc --project ./tsconfig.build.json --module commonjs --outDir ./dist/cjs --verbatimModuleSyntax false && printf '{\"type\":\"commonjs\"}' > ./dist/cjs/package.json",
54+
"build:esm": "tsc --project ./tsconfig.build.json --module es2020 --outDir ./dist/esm && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./dist/esm/package.json",
55+
"build:types": "tsc --project ./tsconfig.build.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
56+
"clean": "rimraf dist",
57+
"build:generate": "openapi-ts && pnpm format"
58+
},
59+
"engines": {
60+
"node": ">=18"
61+
}
62+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// This file is auto-generated by @hey-api/openapi-ts
2+
3+
import {
4+
type Config,
5+
createClient,
6+
createConfig,
7+
type ClientOptions as DefaultClientOptions,
8+
} from "@hey-api/client-fetch";
9+
import type { ClientOptions } from "./types.gen.js";
10+
11+
/**
12+
* The `createClientConfig()` function will be called on client initialization
13+
* and the returned object will become the client's initial configuration.
14+
*
15+
* You may want to initialize your client this way instead of calling
16+
* `setConfig()`. This is useful for example if you're using Next.js
17+
* to ensure your client always has the correct values.
18+
*/
19+
export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> =
20+
(
21+
override?: Config<DefaultClientOptions & T>,
22+
) => Config<Required<DefaultClientOptions> & T>;
23+
24+
export const client = createClient(
25+
createConfig<ClientOptions>({
26+
baseUrl: "https://nebula-api.thirdweb-dev.com",
27+
}),
28+
);

packages/nebula/src/client/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This file is auto-generated by @hey-api/openapi-ts
2+
3+
export * from "./sdk.gen.js";
4+
export * from "./types.gen.js";

0 commit comments

Comments
 (0)