@rebyteai/agent-server 0.2.4 → 0.6.0

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 CHANGED
@@ -3,11 +3,11 @@
3
3
  Install the versioned package (no repository clone required):
4
4
 
5
5
  ```sh
6
- pnpm add @rebyteai/agent-server@0.2.0
6
+ pnpm add @rebyteai/agent-server
7
7
  ```
8
8
 
9
9
 
10
- A shared Hono application proxy for the Node and Cloudflare App Kit examples.
10
+ A shared Hono application proxy for the Node and Cloudflare React example examples.
11
11
 
12
12
  ```ts
13
13
  import { createAgentApp } from '@rebyteai/agent-server'
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  // src/index.ts
2
2
  import { Hono } from "hono";
3
3
  import { HTTPException } from "hono/http-exception";
4
- import Rebyte, { rebyteSandbox } from "@rebyteai/agent-sdk";
4
+ import OpenAI from "openai";
5
5
  var maxFileSize = 5 * 1024 * 1024;
6
6
  var invalid = (message) => new HTTPException(400, { message });
7
7
  function createAgentApp(options) {
8
8
  if (!options.apiKey || !options.agentId) throw new Error("API key and Agent ID are required");
9
- const client = new Rebyte({ apiKey: options.apiKey, baseURL: options.baseURL, maxRetries: 0 });
9
+ const client = new OpenAI({ apiKey: options.apiKey, baseURL: options.baseURL ?? "https://api.rebyte.ai/v1", maxRetries: 0 });
10
10
  const sessions = client.beta.agents.sessions;
11
11
  const app = new Hono();
12
12
  async function owned(id) {
@@ -16,7 +16,7 @@ function createAgentApp(options) {
16
16
  }
17
17
  app.get("/api/health", (c) => c.json({ ok: true, api: "agents", agentId: options.agentId }));
18
18
  app.post("/api/sessions", async (c) => {
19
- const session = await sessions.create({ agent_id: options.agentId, environment: rebyteSandbox() });
19
+ const session = await sessions.create({ agent_id: options.agentId, environment: { type: "openai_hosted" } });
20
20
  return c.json(session, 201);
21
21
  });
22
22
  app.get("/api/sessions/:id", async (c) => c.json(await owned(c.req.param("id"))));
@@ -111,7 +111,7 @@ function createAgentApp(options) {
111
111
  app.onError((error, c) => {
112
112
  if (error instanceof HTTPException) return c.json({ error: { message: error.message } }, error.status);
113
113
  if (error instanceof SyntaxError) return c.json({ error: { message: "Invalid JSON" } }, 400);
114
- if (error instanceof Rebyte.APIError) return c.json({ error: { message: error.message, code: error.code } }, error.status >= 400 && error.status < 600 ? error.status : 502);
114
+ if (error instanceof OpenAI.APIError) return c.json({ error: { message: error.message, code: error.code } }, error.status >= 400 && error.status < 600 ? error.status : 502);
115
115
  console.error("Agents app request failed", error);
116
116
  return c.json({ error: { message: "The example server failed" } }, 500);
117
117
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebyteai/agent-server",
3
- "version": "0.2.4",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "hono": "^4.9.9",
20
- "@rebyteai/agent-sdk": "0.2.4"
20
+ "openai": "7.15.0"
21
21
  },
22
22
  "devDependencies": {
23
23
  "tsup": "^8.5.0",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "repository": {
31
31
  "type": "git",
32
- "url": "git+https://github.com/ReByteAI/rebyte-agent-toolkit.git",
32
+ "url": "git+https://github.com/ReByteAI/rebyte-agent-sdk.git",
33
33
  "directory": "packages/server"
34
34
  },
35
35
  "scripts": {