@agentplat/rooms-api 0.2.0-beta.1

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
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.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
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 [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # `@agentplat/rooms-api`
2
+
3
+ Hono transport adapter for the public Agentplat Agent Room framework. The
4
+ package contains no database, runtime, or web-server choice: applications
5
+ inject a `RoomService` and mount the returned Hono app in their preferred
6
+ server.
7
+
8
+ ```ts
9
+ import { createRoomsApp } from '@agentplat/rooms-api';
10
+
11
+ const app = createRoomsApp({ service });
12
+ export default app;
13
+ ```
14
+
15
+ By default every route except `GET /health` requires an
16
+ `X-Agentplat-Tenant-Id` header. This is a trusted local-development boundary,
17
+ not an authentication protocol. A production application should inject an
18
+ authenticator that resolves its verified identity to an Agentplat
19
+ `TenantContext`:
20
+
21
+ ```ts
22
+ const app = createRoomsApp({
23
+ service,
24
+ auth: async (request) => {
25
+ const identity = await authenticateWithYourIdentityProvider(request);
26
+ return identity ? { tenantId: identity.tenantId } : null;
27
+ },
28
+ });
29
+ ```
30
+
31
+ Successful API responses use `{ "data": ... }`; errors use
32
+ `{ "error": { "code", "message", "details"? } }`. Tenant IDs supplied in
33
+ request bodies or query parameters are ignored—the authenticated tenant is
34
+ always authoritative.
35
+
36
+ Adapter error details are hidden by default. `exposeErrorDetails: true` is
37
+ available for local debugging and should not be enabled on an internet-facing
38
+ deployment.
39
+
40
+ ## Routes
41
+
42
+ - `GET /health`
43
+ - `POST /rooms`, `GET /rooms`
44
+ - `GET /rooms/:roomId`, `PATCH /rooms/:roomId`
45
+ - `POST /rooms/:roomId/pause|resume|complete|archive`
46
+ - `POST /rooms/:roomId/participants`
47
+ - `POST /rooms/:roomId/messages`
48
+ - `POST /rooms/:roomId/tasks`
49
+ - `POST /rooms/:roomId/tasks/:taskId/run`
50
+ - `POST /rooms/:roomId/artifacts`
51
+ - `POST /rooms/:roomId/artifacts/:artifactId/versions`
52
+ - `POST /rooms/:roomId/approvals`
53
+ - `POST /approvals/:approvalId/approve|reject|request-revision`
54
+ - `GET /rooms/:roomId/events`
55
+
56
+ `GET /rooms/:roomId` returns the complete aggregate projection produced by
57
+ the domain service, including participants, transcript, tasks, artifacts and
58
+ versions, approvals, policy and memory context, runs, tool calls, child rooms,
59
+ and ordered audit events.
@@ -0,0 +1,35 @@
1
+ import type { TenantContext } from '@agentplat/core';
2
+ import type { RoomService } from '@agentplat/rooms';
3
+ import { Hono } from 'hono';
4
+ export declare const DEFAULT_TENANT_HEADER = "X-Agentplat-Tenant-Id";
5
+ type MaybePromise<T> = T | Promise<T>;
6
+ /**
7
+ * The deliberately small application-service port consumed by the HTTP
8
+ * adapter. Implementations normally delegate these calls to RoomService.
9
+ */
10
+ export type RoomsApiService = Pick<RoomService, 'createRoom' | 'updateRoom' | 'transitionRoom' | 'listRooms' | 'getRoomState' | 'addParticipant' | 'sendMessage' | 'createTask' | 'runTask' | 'createArtifact' | 'createArtifactVersion' | 'requestApproval' | 'resolveApproval' | 'listEvents'>;
11
+ export type RoomsAuthenticator = (request: Request) => MaybePromise<TenantContext | null | undefined>;
12
+ export interface HeaderTenantAuthOptions {
13
+ headerName?: string;
14
+ }
15
+ export interface CreateRoomsAppOptions {
16
+ service: RoomsApiService;
17
+ /** Replaces the trusted development header with an application auth layer. */
18
+ auth?: RoomsAuthenticator;
19
+ /** Intended for local debugging only. Defaults to false to avoid leaking adapter details. */
20
+ exposeErrorDetails?: boolean;
21
+ }
22
+ interface RoomsApiEnv {
23
+ Variables: {
24
+ tenant: TenantContext;
25
+ };
26
+ }
27
+ /**
28
+ * Development authentication for self-hosted deployments. Production users
29
+ * should inject an authenticator backed by their identity provider.
30
+ */
31
+ export declare function headerTenantAuth(options?: HeaderTenantAuthOptions): RoomsAuthenticator;
32
+ /** Create a transport-only Hono application around an injected room service. */
33
+ export declare function createRoomsApp(options: CreateRoomsAppOptions): Hono<RoomsApiEnv>;
34
+ export {};
35
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAKV,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAGtC;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,WAAW,EACT,YAAY,GACZ,YAAY,GACZ,gBAAgB,GAChB,WAAW,GACX,cAAc,GACd,gBAAgB,GAChB,aAAa,GACb,YAAY,GACZ,SAAS,GACT,gBAAgB,GAChB,uBAAuB,GACvB,iBAAiB,GACjB,iBAAiB,GACjB,YAAY,CACf,CAAC;AAWF,MAAM,MAAM,kBAAkB,GAAG,CAC/B,OAAO,EAAE,OAAO,KACb,YAAY,CAAC,aAAa,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;AAEpD,MAAM,WAAW,uBAAuB;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,eAAe,CAAC;IACzB,8EAA8E;IAC9E,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,6FAA6F;IAC7F,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,UAAU,WAAW;IACnB,SAAS,EAAE;QACT,MAAM,EAAE,aAAa,CAAC;KACvB,CAAC;CACH;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,uBAA4B,GACpC,kBAAkB,CAapB;AAED,gFAAgF;AAChF,wBAAgB,cAAc,CAC5B,OAAO,EAAE,qBAAqB,GAC7B,IAAI,CAAC,WAAW,CAAC,CAgPnB"}
package/dist/index.js ADDED
@@ -0,0 +1,244 @@
1
+ import { AgentPlatError } from '@agentplat/core';
2
+ import { Hono } from 'hono';
3
+ export const DEFAULT_TENANT_HEADER = 'X-Agentplat-Tenant-Id';
4
+ /**
5
+ * Development authentication for self-hosted deployments. Production users
6
+ * should inject an authenticator backed by their identity provider.
7
+ */
8
+ export function headerTenantAuth(options = {}) {
9
+ const headerName = options.headerName ?? DEFAULT_TENANT_HEADER;
10
+ return (request) => {
11
+ const tenantId = request.headers.get(headerName)?.trim();
12
+ if (!tenantId) {
13
+ throw new AgentPlatError('BAD_REQUEST', `Missing required ${headerName} header`);
14
+ }
15
+ return { tenantId };
16
+ };
17
+ }
18
+ /** Create a transport-only Hono application around an injected room service. */
19
+ export function createRoomsApp(options) {
20
+ if (!options?.service) {
21
+ throw new AgentPlatError('VALIDATION_ERROR', 'A rooms application service is required');
22
+ }
23
+ const app = new Hono();
24
+ const authenticate = options.auth ?? headerTenantAuth();
25
+ app.onError((error, context) => errorResponse(context, error, options.exposeErrorDetails ?? false));
26
+ app.get('/health', (context) => context.json({ status: 'ok' }));
27
+ const requireTenant = async (context, next) => {
28
+ const tenant = await authenticate(context.req.raw);
29
+ if (!tenant?.tenantId?.trim()) {
30
+ throw new AgentPlatError('UNAUTHORIZED', 'Authentication is required');
31
+ }
32
+ context.set('tenant', { ...tenant, tenantId: tenant.tenantId.trim() });
33
+ await next();
34
+ };
35
+ app.use('/rooms', requireTenant);
36
+ app.use('/rooms/*', requireTenant);
37
+ app.use('/approvals/*', requireTenant);
38
+ app.post('/rooms', async (context) => {
39
+ const input = await readJsonObject(context);
40
+ const room = await options.service.createRoom(tenantId(context), omitReserved(input, 'tenantId'));
41
+ return context.json({ data: room }, 201);
42
+ });
43
+ app.get('/rooms', async (context) => {
44
+ const rooms = await options.service.listRooms(tenantId(context));
45
+ return context.json({ data: rooms });
46
+ });
47
+ app.get('/rooms/:roomId', async (context) => {
48
+ const state = await options.service.getRoomState(tenantId(context), context.req.param('roomId'));
49
+ return context.json({ data: state });
50
+ });
51
+ app.patch('/rooms/:roomId', async (context) => {
52
+ const input = await readJsonObject(context);
53
+ const room = await options.service.updateRoom(tenantId(context), context.req.param('roomId'), omitReserved(input, 'tenantId', 'id', 'roomId'));
54
+ return context.json({ data: room });
55
+ });
56
+ app.post('/rooms/:roomId/pause', async (context) => {
57
+ const input = await readOptionalJsonObject(context);
58
+ const room = await options.service.transitionRoom(tenantId(context), context.req.param('roomId'), 'pause', input.actorId);
59
+ return context.json({ data: room });
60
+ });
61
+ app.post('/rooms/:roomId/resume', async (context) => {
62
+ const input = await readOptionalJsonObject(context);
63
+ const room = await options.service.transitionRoom(tenantId(context), context.req.param('roomId'), 'resume', input.actorId);
64
+ return context.json({ data: room });
65
+ });
66
+ app.post('/rooms/:roomId/complete', async (context) => {
67
+ const input = await readOptionalJsonObject(context);
68
+ const room = await options.service.transitionRoom(tenantId(context), context.req.param('roomId'), 'complete', input.actorId);
69
+ return context.json({ data: room });
70
+ });
71
+ app.post('/rooms/:roomId/archive', async (context) => {
72
+ const input = await readOptionalJsonObject(context);
73
+ const room = await options.service.transitionRoom(tenantId(context), context.req.param('roomId'), 'archive', input.actorId);
74
+ return context.json({ data: room });
75
+ });
76
+ app.post('/rooms/:roomId/participants', async (context) => {
77
+ const input = await readJsonObject(context);
78
+ const { actorId, ...participantInput } = omitReserved(input, 'tenantId', 'roomId');
79
+ const participant = await options.service.addParticipant(tenantId(context), context.req.param('roomId'), participantInput, actorId);
80
+ return context.json({ data: participant }, 201);
81
+ });
82
+ app.post('/rooms/:roomId/messages', async (context) => {
83
+ const input = await readJsonObject(context);
84
+ const message = await options.service.sendMessage(tenantId(context), context.req.param('roomId'), omitReserved(input, 'tenantId', 'roomId'));
85
+ return context.json({ data: message }, 201);
86
+ });
87
+ app.post('/rooms/:roomId/tasks', async (context) => {
88
+ const input = await readJsonObject(context);
89
+ const { actorId, ...taskInput } = omitReserved(input, 'tenantId', 'roomId');
90
+ const task = await options.service.createTask(tenantId(context), context.req.param('roomId'), taskInput, actorId);
91
+ return context.json({ data: task }, 201);
92
+ });
93
+ app.post('/rooms/:roomId/tasks/:taskId/run', async (context) => {
94
+ const run = await options.service.runTask(tenantId(context), context.req.param('roomId'), context.req.param('taskId'));
95
+ return context.json({ data: run }, 201);
96
+ });
97
+ app.post('/rooms/:roomId/artifacts', async (context) => {
98
+ const input = await readJsonObject(context);
99
+ const artifact = await options.service.createArtifact(tenantId(context), context.req.param('roomId'), omitReserved(input, 'tenantId', 'roomId'));
100
+ return context.json({ data: artifact }, 201);
101
+ });
102
+ app.post('/rooms/:roomId/artifacts/:artifactId/versions', async (context) => {
103
+ const input = await readJsonObject(context);
104
+ const version = await options.service.createArtifactVersion(tenantId(context), context.req.param('roomId'), context.req.param('artifactId'), omitReserved(input, 'tenantId', 'roomId', 'artifactId'));
105
+ return context.json({ data: version }, 201);
106
+ });
107
+ app.post('/rooms/:roomId/approvals', async (context) => {
108
+ const input = await readJsonObject(context);
109
+ const approval = await options.service.requestApproval(tenantId(context), context.req.param('roomId'), omitReserved(input, 'tenantId', 'roomId'));
110
+ return context.json({ data: approval }, 201);
111
+ });
112
+ app.post('/approvals/:approvalId/approve', async (context) => {
113
+ const input = await readJsonObject(context);
114
+ const approval = await options.service.resolveApproval(tenantId(context), context.req.param('approvalId'), 'approved', trustedApprovalInput(context, input));
115
+ return context.json({ data: approval });
116
+ });
117
+ app.post('/approvals/:approvalId/reject', async (context) => {
118
+ const input = await readJsonObject(context);
119
+ const approval = await options.service.resolveApproval(tenantId(context), context.req.param('approvalId'), 'rejected', trustedApprovalInput(context, input));
120
+ return context.json({ data: approval });
121
+ });
122
+ app.post('/approvals/:approvalId/request-revision', async (context) => {
123
+ const input = await readJsonObject(context);
124
+ const approval = await options.service.resolveApproval(tenantId(context), context.req.param('approvalId'), 'needs_revision', trustedApprovalInput(context, input));
125
+ return context.json({ data: approval });
126
+ });
127
+ app.get('/rooms/:roomId/events', async (context) => {
128
+ const events = await options.service.listEvents(tenantId(context), context.req.param('roomId'));
129
+ return context.json({ data: events });
130
+ });
131
+ app.notFound((context) => context.json({ error: { code: 'NOT_FOUND', message: 'Route not found' } }, 404));
132
+ return app;
133
+ }
134
+ function tenantId(context) {
135
+ return context.get('tenant').tenantId;
136
+ }
137
+ function trustedApprovalInput(context, input) {
138
+ const sanitized = omitReserved(input, 'tenantId', 'id', 'approvalId', 'status');
139
+ const authenticatedActorId = context.get('tenant').actor?.actorId;
140
+ return authenticatedActorId
141
+ ? { ...sanitized, decidedBy: authenticatedActorId }
142
+ : sanitized;
143
+ }
144
+ async function readJsonObject(context) {
145
+ const body = await context.req.text();
146
+ if (!body.trim()) {
147
+ throw new AgentPlatError('BAD_REQUEST', 'A JSON request body is required');
148
+ }
149
+ return parseJsonObject(body);
150
+ }
151
+ async function readOptionalJsonObject(context) {
152
+ const body = await context.req.text();
153
+ return (body.trim() ? parseJsonObject(body) : {});
154
+ }
155
+ function parseJsonObject(body) {
156
+ let value;
157
+ try {
158
+ value = JSON.parse(body);
159
+ }
160
+ catch {
161
+ throw new AgentPlatError('BAD_REQUEST', 'Request body must be valid JSON');
162
+ }
163
+ if (!value || Array.isArray(value) || typeof value !== 'object') {
164
+ throw new AgentPlatError('VALIDATION_ERROR', 'Request body must be an object');
165
+ }
166
+ return value;
167
+ }
168
+ function omitReserved(input, ...keys) {
169
+ const output = { ...input };
170
+ for (const key of keys) {
171
+ delete output[key];
172
+ }
173
+ return output;
174
+ }
175
+ function errorResponse(context, error, exposeDetails) {
176
+ const normalized = normalizeError(error);
177
+ const payload = {
178
+ error: {
179
+ code: normalized.code,
180
+ message: normalized.message,
181
+ },
182
+ };
183
+ if (exposeDetails && normalized.details !== undefined) {
184
+ payload.error.details = normalized.details;
185
+ }
186
+ return context.json(payload, normalized.status);
187
+ }
188
+ function normalizeError(error) {
189
+ if (isAgentPlatError(error)) {
190
+ return {
191
+ code: error.code,
192
+ message: error.message,
193
+ details: error.details,
194
+ status: validStatus(error.statusCode) ?? statusForCode(error.code),
195
+ };
196
+ }
197
+ return {
198
+ code: 'INTERNAL_ERROR',
199
+ message: 'An unexpected error occurred',
200
+ status: 500,
201
+ };
202
+ }
203
+ function isAgentPlatError(error) {
204
+ const knownCodes = new Set([
205
+ 'BAD_REQUEST',
206
+ 'UNAUTHORIZED',
207
+ 'FORBIDDEN',
208
+ 'NOT_FOUND',
209
+ 'CONFLICT',
210
+ 'VALIDATION_ERROR',
211
+ 'INTERNAL_ERROR',
212
+ 'ADAPTER_ERROR',
213
+ ]);
214
+ return (error instanceof AgentPlatError ||
215
+ (!!error &&
216
+ typeof error === 'object' &&
217
+ typeof error.code === 'string' &&
218
+ knownCodes.has(error.code) &&
219
+ typeof error.message === 'string'));
220
+ }
221
+ function validStatus(status) {
222
+ const supported = [400, 401, 403, 404, 409, 422, 500, 502];
223
+ return supported.find((candidate) => candidate === status);
224
+ }
225
+ function statusForCode(code) {
226
+ switch (code) {
227
+ case 'BAD_REQUEST':
228
+ case 'VALIDATION_ERROR':
229
+ return 400;
230
+ case 'UNAUTHORIZED':
231
+ return 401;
232
+ case 'FORBIDDEN':
233
+ return 403;
234
+ case 'NOT_FOUND':
235
+ return 404;
236
+ case 'CONFLICT':
237
+ return 409;
238
+ case 'ADAPTER_ERROR':
239
+ return 502;
240
+ default:
241
+ return 500;
242
+ }
243
+ }
244
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AASjD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AA0D7D;;;GAGG;AACH,MAAM,UAAU,gBAAgB,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,EAAE,EAAE,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,aAAa,CACpB,IAAY;IAEZ,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,aAAa,CAAC;QACnB,KAAK,kBAAkB;YACrB,OAAO,GAAG,CAAC;QACb,KAAK,cAAc;YACjB,OAAO,GAAG,CAAC;QACb,KAAK,WAAW;YACd,OAAO,GAAG,CAAC;QACb,KAAK,WAAW;YACd,OAAO,GAAG,CAAC;QACb,KAAK,UAAU;YACb,OAAO,GAAG,CAAC;QACb,KAAK,eAAe;YAClB,OAAO,GAAG,CAAC;QACb;YACE,OAAO,GAAG,CAAC;IACf,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@agentplat/rooms-api",
3
+ "version": "0.2.0-beta.1",
4
+ "description": "Injectable Hono HTTP API for Agentplat Agent Rooms.",
5
+ "type": "module",
6
+ "license": "Apache-2.0",
7
+ "sideEffects": false,
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md"
19
+ ],
20
+ "dependencies": {
21
+ "hono": "^4.12.0",
22
+ "@agentplat/core": "^0.2.0-beta.1",
23
+ "@agentplat/rooms": "^0.2.0-beta.1"
24
+ },
25
+ "devDependencies": {
26
+ "typescript": "^5.3.0"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/Agentplat/agentplat.git",
34
+ "directory": "packages/rooms-api"
35
+ },
36
+ "scripts": {
37
+ "build": "tsc -p tsconfig.json",
38
+ "type-check": "tsc -p tsconfig.json --noEmit",
39
+ "test": "pnpm run build && node --test test/*.test.mjs",
40
+ "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\""
41
+ }
42
+ }