@robota-sdk/agent-transport-http 3.0.0-beta.46 → 3.0.0-beta.48
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 +17 -0
- package/dist/node/index.cjs +27 -2
- package/dist/node/index.d.cts +17 -2
- package/dist/node/index.d.ts +17 -2
- package/dist/node/index.js +25 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -55,6 +55,23 @@ The `sessionFactory` callback receives the Hono request context and returns an `
|
|
|
55
55
|
| `interrupted` | `IExecutionResult` | Execution was aborted |
|
|
56
56
|
| `error` | `{ message: string }` | Execution error |
|
|
57
57
|
|
|
58
|
+
## ITransportAdapter
|
|
59
|
+
|
|
60
|
+
The HTTP transport implements the `ITransportAdapter` interface from `@robota-sdk/agent-sdk`:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
import { createHttpTransport } from '@robota-sdk/agent-transport-http';
|
|
64
|
+
import type { ITransportAdapter } from '@robota-sdk/agent-sdk';
|
|
65
|
+
|
|
66
|
+
const transport: ITransportAdapter = createHttpTransport();
|
|
67
|
+
|
|
68
|
+
transport.attach(interactiveSession);
|
|
69
|
+
await transport.start();
|
|
70
|
+
|
|
71
|
+
// Access the Hono app for serving
|
|
72
|
+
const app = transport.getApp();
|
|
73
|
+
```
|
|
74
|
+
|
|
58
75
|
## Dependencies
|
|
59
76
|
|
|
60
77
|
- `@robota-sdk/agent-sdk` — `InteractiveSession`
|
package/dist/node/index.cjs
CHANGED
|
@@ -20,7 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
-
createAgentRoutes: () => createAgentRoutes
|
|
23
|
+
createAgentRoutes: () => createAgentRoutes,
|
|
24
|
+
createHttpTransport: () => createHttpTransport
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(index_exports);
|
|
26
27
|
|
|
@@ -117,7 +118,31 @@ function createAgentRoutes(options) {
|
|
|
117
118
|
});
|
|
118
119
|
return app;
|
|
119
120
|
}
|
|
121
|
+
|
|
122
|
+
// src/http-transport.ts
|
|
123
|
+
function createHttpTransport(options) {
|
|
124
|
+
let session = null;
|
|
125
|
+
let app = null;
|
|
126
|
+
return {
|
|
127
|
+
name: "http",
|
|
128
|
+
attach(s) {
|
|
129
|
+
session = s;
|
|
130
|
+
},
|
|
131
|
+
async start() {
|
|
132
|
+
if (!session) throw new Error("No session attached. Call attach() first.");
|
|
133
|
+
app = createAgentRoutes({ sessionFactory: () => session });
|
|
134
|
+
},
|
|
135
|
+
async stop() {
|
|
136
|
+
app = null;
|
|
137
|
+
},
|
|
138
|
+
getApp() {
|
|
139
|
+
if (!app) throw new Error("Transport not started. Call start() first.");
|
|
140
|
+
return app;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
120
144
|
// Annotate the CommonJS export names for ESM import in node:
|
|
121
145
|
0 && (module.exports = {
|
|
122
|
-
createAgentRoutes
|
|
146
|
+
createAgentRoutes,
|
|
147
|
+
createHttpTransport
|
|
123
148
|
});
|
package/dist/node/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context, Hono } from 'hono';
|
|
2
|
-
import { InteractiveSession } from '@robota-sdk/agent-sdk';
|
|
2
|
+
import { InteractiveSession, ITransportAdapter } from '@robota-sdk/agent-sdk';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* HTTP transport adapter — exposes InteractiveSession over REST API.
|
|
@@ -26,4 +26,19 @@ interface IAgentRoutesOptions {
|
|
|
26
26
|
*/
|
|
27
27
|
declare function createAgentRoutes(options: IAgentRoutesOptions): Hono;
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
/**
|
|
30
|
+
* ITransportAdapter implementation for HTTP transport.
|
|
31
|
+
*
|
|
32
|
+
* Wraps createAgentRoutes into the unified ITransportAdapter interface
|
|
33
|
+
* while exposing the underlying Hono app via getApp().
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
interface IHttpTransportOptions {
|
|
37
|
+
/** Optional: base path prefix for routes. */
|
|
38
|
+
basePath?: string;
|
|
39
|
+
}
|
|
40
|
+
declare function createHttpTransport(options?: IHttpTransportOptions): ITransportAdapter & {
|
|
41
|
+
getApp(): Hono;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { type IAgentRoutesOptions, type IHttpTransportOptions, type ISessionFactory, createAgentRoutes, createHttpTransport };
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context, Hono } from 'hono';
|
|
2
|
-
import { InteractiveSession } from '@robota-sdk/agent-sdk';
|
|
2
|
+
import { InteractiveSession, ITransportAdapter } from '@robota-sdk/agent-sdk';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* HTTP transport adapter — exposes InteractiveSession over REST API.
|
|
@@ -26,4 +26,19 @@ interface IAgentRoutesOptions {
|
|
|
26
26
|
*/
|
|
27
27
|
declare function createAgentRoutes(options: IAgentRoutesOptions): Hono;
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
/**
|
|
30
|
+
* ITransportAdapter implementation for HTTP transport.
|
|
31
|
+
*
|
|
32
|
+
* Wraps createAgentRoutes into the unified ITransportAdapter interface
|
|
33
|
+
* while exposing the underlying Hono app via getApp().
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
interface IHttpTransportOptions {
|
|
37
|
+
/** Optional: base path prefix for routes. */
|
|
38
|
+
basePath?: string;
|
|
39
|
+
}
|
|
40
|
+
declare function createHttpTransport(options?: IHttpTransportOptions): ITransportAdapter & {
|
|
41
|
+
getApp(): Hono;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { type IAgentRoutesOptions, type IHttpTransportOptions, type ISessionFactory, createAgentRoutes, createHttpTransport };
|
package/dist/node/index.js
CHANGED
|
@@ -91,6 +91,30 @@ function createAgentRoutes(options) {
|
|
|
91
91
|
});
|
|
92
92
|
return app;
|
|
93
93
|
}
|
|
94
|
+
|
|
95
|
+
// src/http-transport.ts
|
|
96
|
+
function createHttpTransport(options) {
|
|
97
|
+
let session = null;
|
|
98
|
+
let app = null;
|
|
99
|
+
return {
|
|
100
|
+
name: "http",
|
|
101
|
+
attach(s) {
|
|
102
|
+
session = s;
|
|
103
|
+
},
|
|
104
|
+
async start() {
|
|
105
|
+
if (!session) throw new Error("No session attached. Call attach() first.");
|
|
106
|
+
app = createAgentRoutes({ sessionFactory: () => session });
|
|
107
|
+
},
|
|
108
|
+
async stop() {
|
|
109
|
+
app = null;
|
|
110
|
+
},
|
|
111
|
+
getApp() {
|
|
112
|
+
if (!app) throw new Error("Transport not started. Call start() first.");
|
|
113
|
+
return app;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
94
117
|
export {
|
|
95
|
-
createAgentRoutes
|
|
118
|
+
createAgentRoutes,
|
|
119
|
+
createHttpTransport
|
|
96
120
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robota-sdk/agent-transport-http",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.48",
|
|
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.
|
|
26
|
+
"@robota-sdk/agent-sdk": "3.0.0-beta.48"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"rimraf": "^5.0.5",
|