@looopy-ai/aws 1.0.7 → 2.0.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.
@@ -4,6 +4,7 @@ import type pino from 'pino';
4
4
  export type ServeConfig = {
5
5
  agent: (contextId: string) => Promise<Agent>;
6
6
  decodeAuthorization?: (authorization: string) => Promise<AuthContext | null>;
7
+ logger: pino.Logger;
7
8
  port?: number;
8
9
  };
9
10
  export type HonoVariables = {
@@ -10,7 +10,7 @@ export const hono = (config) => {
10
10
  app.use(requestId());
11
11
  app.use('*', async (c, next) => {
12
12
  const requestId = c.var.requestId;
13
- const child = getLogger({
13
+ const child = (config.logger.child ?? getLogger)({
14
14
  requestId,
15
15
  method: c.req.method,
16
16
  path: c.req.path,
@@ -21,8 +21,10 @@ export const hono = (config) => {
21
21
  await next();
22
22
  }
23
23
  finally {
24
- const ms = performance.now() - start;
25
- child.info({ status: c.res.status, ms }, 'request completed');
24
+ if (c.req.path !== '/ping') {
25
+ const ms = performance.now() - start;
26
+ child.info({ status: c.res.status, ms }, 'request completed');
27
+ }
26
28
  }
27
29
  });
28
30
  const state = { busy: false, agent: undefined };
@@ -32,7 +34,7 @@ export const hono = (config) => {
32
34
  time_of_last_update: Date.now(),
33
35
  }));
34
36
  });
35
- app.post('/invocation', async (c) => {
37
+ app.post('/invocations', async (c) => {
36
38
  const logger = c.var.logger;
37
39
  if (state.busy) {
38
40
  return c.json({ error: 'Agent is currently busy' }, 503);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@looopy-ai/aws",
3
- "version": "1.0.7",
3
+ "version": "2.0.0",
4
4
  "description": "AWS storage and providers for Looopy AI",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",