@robota-sdk/agent-transport-http 3.0.0-beta.44 → 3.0.0-beta.45

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
@@ -12,14 +12,13 @@ pnpm add @robota-sdk/agent-transport-http
12
12
 
13
13
  ```typescript
14
14
  import { createAgentRoutes } from '@robota-sdk/agent-transport-http';
15
- import { InteractiveSession, SystemCommandExecutor } from '@robota-sdk/agent-sdk';
15
+ import type { InteractiveSession } from '@robota-sdk/agent-sdk';
16
16
  import { Hono } from 'hono';
17
17
 
18
18
  const app = new Hono();
19
19
 
20
20
  const routes = createAgentRoutes({
21
21
  sessionFactory: (_req) => interactiveSession, // resolve per-request
22
- commandExecutor,
23
22
  });
24
23
 
25
24
  // Mount under a prefix
@@ -58,5 +57,5 @@ The `sessionFactory` callback receives the Hono request context and returns an `
58
57
 
59
58
  ## Dependencies
60
59
 
61
- - `@robota-sdk/agent-sdk` — `InteractiveSession`, `SystemCommandExecutor`
60
+ - `@robota-sdk/agent-sdk` — `InteractiveSession`
62
61
  - `hono` — HTTP framework
@@ -28,7 +28,7 @@ module.exports = __toCommonJS(index_exports);
28
28
  var import_hono = require("hono");
29
29
  var import_streaming = require("hono/streaming");
30
30
  function createAgentRoutes(options) {
31
- const { sessionFactory, commandExecutor } = options;
31
+ const { sessionFactory } = options;
32
32
  const app = new import_hono.Hono();
33
33
  app.post("/submit", async (c) => {
34
34
  const session = await sessionFactory(c);
@@ -83,7 +83,7 @@ function createAgentRoutes(options) {
83
83
  if (!body.name || typeof body.name !== "string") {
84
84
  return c.json({ error: "name is required" }, 400);
85
85
  }
86
- const result = await commandExecutor.execute(body.name, session, body.args ?? "");
86
+ const result = await session.executeCommand(body.name, body.args ?? "");
87
87
  if (!result) {
88
88
  return c.json({ error: `Unknown command: ${body.name}` }, 404);
89
89
  }
@@ -0,0 +1,29 @@
1
+ import { Context, Hono } from 'hono';
2
+ import { InteractiveSession } from '@robota-sdk/agent-sdk';
3
+
4
+ /**
5
+ * HTTP transport adapter — exposes InteractiveSession over REST API.
6
+ *
7
+ * Built on Hono for Cloudflare Workers + Node.js + AWS Lambda compatibility.
8
+ * Each endpoint maps 1:1 to an InteractiveSession API method.
9
+ */
10
+
11
+ /** Callback that resolves an InteractiveSession from the request context. */
12
+ type ISessionFactory = (c: Context) => InteractiveSession | Promise<InteractiveSession>;
13
+ interface IAgentRoutesOptions {
14
+ /** Resolve an InteractiveSession per request (e.g., by auth token, session ID). */
15
+ sessionFactory: ISessionFactory;
16
+ }
17
+ /**
18
+ * Create a Hono router with all agent HTTP endpoints.
19
+ *
20
+ * Usage:
21
+ * ```typescript
22
+ * const routes = createAgentRoutes({ sessionFactory });
23
+ * app.route('/agent', routes); // mount on existing app
24
+ * export default routes; // or use standalone (CF Workers)
25
+ * ```
26
+ */
27
+ declare function createAgentRoutes(options: IAgentRoutesOptions): Hono;
28
+
29
+ export { type IAgentRoutesOptions, type ISessionFactory, createAgentRoutes };
@@ -0,0 +1,29 @@
1
+ import { Context, Hono } from 'hono';
2
+ import { InteractiveSession } from '@robota-sdk/agent-sdk';
3
+
4
+ /**
5
+ * HTTP transport adapter — exposes InteractiveSession over REST API.
6
+ *
7
+ * Built on Hono for Cloudflare Workers + Node.js + AWS Lambda compatibility.
8
+ * Each endpoint maps 1:1 to an InteractiveSession API method.
9
+ */
10
+
11
+ /** Callback that resolves an InteractiveSession from the request context. */
12
+ type ISessionFactory = (c: Context) => InteractiveSession | Promise<InteractiveSession>;
13
+ interface IAgentRoutesOptions {
14
+ /** Resolve an InteractiveSession per request (e.g., by auth token, session ID). */
15
+ sessionFactory: ISessionFactory;
16
+ }
17
+ /**
18
+ * Create a Hono router with all agent HTTP endpoints.
19
+ *
20
+ * Usage:
21
+ * ```typescript
22
+ * const routes = createAgentRoutes({ sessionFactory });
23
+ * app.route('/agent', routes); // mount on existing app
24
+ * export default routes; // or use standalone (CF Workers)
25
+ * ```
26
+ */
27
+ declare function createAgentRoutes(options: IAgentRoutesOptions): Hono;
28
+
29
+ export { type IAgentRoutesOptions, type ISessionFactory, createAgentRoutes };
@@ -2,7 +2,7 @@
2
2
  import { Hono } from "hono";
3
3
  import { streamSSE } from "hono/streaming";
4
4
  function createAgentRoutes(options) {
5
- const { sessionFactory, commandExecutor } = options;
5
+ const { sessionFactory } = options;
6
6
  const app = new Hono();
7
7
  app.post("/submit", async (c) => {
8
8
  const session = await sessionFactory(c);
@@ -57,7 +57,7 @@ function createAgentRoutes(options) {
57
57
  if (!body.name || typeof body.name !== "string") {
58
58
  return c.json({ error: "name is required" }, 400);
59
59
  }
60
- const result = await commandExecutor.execute(body.name, session, body.args ?? "");
60
+ const result = await session.executeCommand(body.name, body.args ?? "");
61
61
  if (!result) {
62
62
  return c.json({ error: `Unknown command: ${body.name}` }, 404);
63
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robota-sdk/agent-transport-http",
3
- "version": "3.0.0-beta.44",
3
+ "version": "3.0.0-beta.45",
4
4
  "description": "HTTP transport adapter for exposing InteractiveSession over REST API",
5
5
  "type": "module",
6
6
  "main": "dist/node/index.js",
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "hono": "^4.7.0",
26
- "@robota-sdk/agent-sdk": "3.0.0-beta.44"
26
+ "@robota-sdk/agent-sdk": "3.0.0-beta.45"
27
27
  },
28
28
  "devDependencies": {
29
29
  "rimraf": "^5.0.5",