@inkeep/agents-manage-api 0.31.7 → 0.32.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/README.md CHANGED
@@ -41,7 +41,7 @@ pnpm db:migrate
41
41
  ```env
42
42
  ENVIRONMENT=development|production|test
43
43
  PORT=3002
44
- DB_FILE_NAME=path/to/sqlite.db
44
+ DATABASE_URL=pg_db_url
45
45
  LOG_LEVEL=debug|info|warn|error
46
46
  ```
47
47
 
package/dist/index.cjs CHANGED
@@ -23,9 +23,7 @@ var envSchema = zod.z.object({
23
23
  ENVIRONMENT: zod.z.enum(["development", "production", "pentest", "test"]).optional(),
24
24
  AGENTS_MANAGE_API_URL: zod.z.string().optional().default("http://localhost:3002"),
25
25
  AGENTS_RUN_API_URL: zod.z.string().optional().default("http://localhost:3003"),
26
- DB_FILE_NAME: zod.z.string().optional(),
27
- TURSO_DATABASE_URL: zod.z.string().optional(),
28
- TURSO_AUTH_TOKEN: zod.z.string().optional(),
26
+ DATABASE_URL: zod.z.string().optional(),
29
27
  LOG_LEVEL: zod.z.enum(["trace", "debug", "info", "warn", "error"]).optional().default("debug"),
30
28
  NANGO_SERVER_URL: zod.z.string().optional().default("https://api.nango.dev"),
31
29
  NANGO_SECRET_KEY: zod.z.string().optional(),
@@ -106,22 +104,9 @@ function setupOpenAPIRoutes(app25) {
106
104
  }
107
105
  var getDbConfig = () => {
108
106
  if (env.ENVIRONMENT === "test") {
109
- return { url: ":memory:" };
107
+ return {};
110
108
  }
111
- if (env.TURSO_DATABASE_URL && env.TURSO_AUTH_TOKEN) {
112
- return {
113
- url: env.TURSO_DATABASE_URL,
114
- authToken: env.TURSO_AUTH_TOKEN
115
- };
116
- }
117
- if (!env.DB_FILE_NAME) {
118
- throw new Error(
119
- "Database configuration error: DB_FILE_NAME must be set if Turso is not configured."
120
- );
121
- }
122
- return {
123
- url: env.DB_FILE_NAME
124
- };
109
+ return { connectionString: env.DATABASE_URL };
125
110
  };
126
111
  var dbClient = agentsCore.createDatabaseClient(getDbConfig());
127
112
  var dbClient_default = dbClient;
@@ -796,7 +781,7 @@ app3.openapi(
796
781
  201
797
782
  );
798
783
  } catch (error) {
799
- if (error?.cause?.code === "SQLITE_CONSTRAINT_FOREIGNKEY" || error?.cause?.rawCode === 787) {
784
+ if (error?.cause?.code === "23503") {
800
785
  throw agentsCore.createApiError({
801
786
  code: "bad_request",
802
787
  message: "Invalid agentId - agent does not exist"
@@ -1033,7 +1018,7 @@ app4.openapi(
1033
1018
  });
1034
1019
  return c.json({ data: artifactComponent }, 201);
1035
1020
  } catch (error) {
1036
- if (error?.cause?.code === "SQLITE_CONSTRAINT_PRIMARYKEY" || error?.cause?.rawCode === 1555) {
1021
+ if (error?.cause?.code === "23505") {
1037
1022
  throw agentsCore.createApiError({
1038
1023
  code: "conflict",
1039
1024
  message: `Artifact component with ID '${finalId}' already exists`
@@ -2753,7 +2738,7 @@ app12.openapi(
2753
2738
  });
2754
2739
  return c.json({ data: project }, 201);
2755
2740
  } catch (error) {
2756
- if (error?.message?.includes("UNIQUE constraint") || error?.message?.includes("UNIQUE") || error?.code === "SQLITE_CONSTRAINT" || error?.code === "SQLITE_ERROR") {
2741
+ if (error?.cause?.code === "23505") {
2757
2742
  throw agentsCore.createApiError({
2758
2743
  code: "conflict",
2759
2744
  message: "Project with this ID already exists"
@@ -4403,7 +4388,7 @@ app19.openapi(
4403
4388
  });
4404
4389
  return c.json({ data: agentToolRelation }, 201);
4405
4390
  } catch (error) {
4406
- if (error instanceof Error && (error.message.includes("FOREIGN KEY constraint failed") || error.message.includes("foreign key constraint") || error.message.includes("SQLITE_CONSTRAINT_FOREIGNKEY") || error.code === "SQLITE_CONSTRAINT_FOREIGNKEY" || error?.cause?.code === "SQLITE_CONSTRAINT_FOREIGNKEY")) {
4391
+ if (error?.cause?.code === "23503") {
4407
4392
  throw agentsCore.createApiError({
4408
4393
  code: "bad_request",
4409
4394
  message: "Invalid subAgent ID or tool ID - referenced entity does not exist"
@@ -5269,7 +5254,8 @@ app23.openapi(
5269
5254
  );
5270
5255
  return c.json({ data: createdProject }, 201);
5271
5256
  } catch (error) {
5272
- if (error?.cause?.code === "SQLITE_CONSTRAINT_PRIMARYKEY" || error?.cause?.rawCode === 1555) {
5257
+ logger8.error({ error }, "Error creating project");
5258
+ if (error?.cause?.code === "23505") {
5273
5259
  throw agentsCore.createApiError({
5274
5260
  code: "conflict",
5275
5261
  message: `Project with ID '${projectData.id}' already exists`
package/dist/index.js CHANGED
@@ -19,9 +19,7 @@ var envSchema = z.object({
19
19
  ENVIRONMENT: z.enum(["development", "production", "pentest", "test"]).optional(),
20
20
  AGENTS_MANAGE_API_URL: z.string().optional().default("http://localhost:3002"),
21
21
  AGENTS_RUN_API_URL: z.string().optional().default("http://localhost:3003"),
22
- DB_FILE_NAME: z.string().optional(),
23
- TURSO_DATABASE_URL: z.string().optional(),
24
- TURSO_AUTH_TOKEN: z.string().optional(),
22
+ DATABASE_URL: z.string().optional(),
25
23
  LOG_LEVEL: z.enum(["trace", "debug", "info", "warn", "error"]).optional().default("debug"),
26
24
  NANGO_SERVER_URL: z.string().optional().default("https://api.nango.dev"),
27
25
  NANGO_SECRET_KEY: z.string().optional(),
@@ -102,22 +100,9 @@ function setupOpenAPIRoutes(app25) {
102
100
  }
103
101
  var getDbConfig = () => {
104
102
  if (env.ENVIRONMENT === "test") {
105
- return { url: ":memory:" };
103
+ return {};
106
104
  }
107
- if (env.TURSO_DATABASE_URL && env.TURSO_AUTH_TOKEN) {
108
- return {
109
- url: env.TURSO_DATABASE_URL,
110
- authToken: env.TURSO_AUTH_TOKEN
111
- };
112
- }
113
- if (!env.DB_FILE_NAME) {
114
- throw new Error(
115
- "Database configuration error: DB_FILE_NAME must be set if Turso is not configured."
116
- );
117
- }
118
- return {
119
- url: env.DB_FILE_NAME
120
- };
105
+ return { connectionString: env.DATABASE_URL };
121
106
  };
122
107
  var dbClient = createDatabaseClient(getDbConfig());
123
108
  var dbClient_default = dbClient;
@@ -792,7 +777,7 @@ app3.openapi(
792
777
  201
793
778
  );
794
779
  } catch (error) {
795
- if (error?.cause?.code === "SQLITE_CONSTRAINT_FOREIGNKEY" || error?.cause?.rawCode === 787) {
780
+ if (error?.cause?.code === "23503") {
796
781
  throw createApiError({
797
782
  code: "bad_request",
798
783
  message: "Invalid agentId - agent does not exist"
@@ -1029,7 +1014,7 @@ app4.openapi(
1029
1014
  });
1030
1015
  return c.json({ data: artifactComponent }, 201);
1031
1016
  } catch (error) {
1032
- if (error?.cause?.code === "SQLITE_CONSTRAINT_PRIMARYKEY" || error?.cause?.rawCode === 1555) {
1017
+ if (error?.cause?.code === "23505") {
1033
1018
  throw createApiError({
1034
1019
  code: "conflict",
1035
1020
  message: `Artifact component with ID '${finalId}' already exists`
@@ -2749,7 +2734,7 @@ app12.openapi(
2749
2734
  });
2750
2735
  return c.json({ data: project }, 201);
2751
2736
  } catch (error) {
2752
- if (error?.message?.includes("UNIQUE constraint") || error?.message?.includes("UNIQUE") || error?.code === "SQLITE_CONSTRAINT" || error?.code === "SQLITE_ERROR") {
2737
+ if (error?.cause?.code === "23505") {
2753
2738
  throw createApiError({
2754
2739
  code: "conflict",
2755
2740
  message: "Project with this ID already exists"
@@ -4399,7 +4384,7 @@ app19.openapi(
4399
4384
  });
4400
4385
  return c.json({ data: agentToolRelation }, 201);
4401
4386
  } catch (error) {
4402
- if (error instanceof Error && (error.message.includes("FOREIGN KEY constraint failed") || error.message.includes("foreign key constraint") || error.message.includes("SQLITE_CONSTRAINT_FOREIGNKEY") || error.code === "SQLITE_CONSTRAINT_FOREIGNKEY" || error?.cause?.code === "SQLITE_CONSTRAINT_FOREIGNKEY")) {
4387
+ if (error?.cause?.code === "23503") {
4403
4388
  throw createApiError({
4404
4389
  code: "bad_request",
4405
4390
  message: "Invalid subAgent ID or tool ID - referenced entity does not exist"
@@ -5265,7 +5250,8 @@ app23.openapi(
5265
5250
  );
5266
5251
  return c.json({ data: createdProject }, 201);
5267
5252
  } catch (error) {
5268
- if (error?.cause?.code === "SQLITE_CONSTRAINT_PRIMARYKEY" || error?.cause?.rawCode === 1555) {
5253
+ logger8.error({ error }, "Error creating project");
5254
+ if (error?.cause?.code === "23505") {
5269
5255
  throw createApiError({
5270
5256
  code: "conflict",
5271
5257
  message: `Project with ID '${projectData.id}' already exists`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-manage-api",
3
- "version": "0.31.7",
3
+ "version": "0.32.1",
4
4
  "description": "Agents Manage API for Inkeep Agent Framework - handles CRUD operations and OAuth",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -17,13 +17,13 @@
17
17
  "@nangohq/types": "^0.69.5",
18
18
  "dotenv": "^17.2.1",
19
19
  "drizzle-orm": "^0.44.4",
20
- "hono": "^4.10.3",
20
+ "hono": "^4.10.4",
21
21
  "hono-pino": "^0.10.1",
22
22
  "nanoid": "^5.1.5",
23
23
  "openid-client": "^6.6.4",
24
24
  "pino": "^9.7.0",
25
25
  "zod": "^4.1.11",
26
- "@inkeep/agents-core": "^0.31.7"
26
+ "@inkeep/agents-core": "^0.32.1"
27
27
  },
28
28
  "optionalDependencies": {
29
29
  "keytar": "^7.9.0"
@@ -38,7 +38,8 @@
38
38
  "typescript": "^5.3.3",
39
39
  "vite": "^7.1.11",
40
40
  "vite-tsconfig-paths": "^5.1.4",
41
- "vitest": "^3.2.4"
41
+ "vitest": "^3.2.4",
42
+ "@electric-sql/pglite": "^0.3.13"
42
43
  },
43
44
  "engines": {
44
45
  "node": ">=22.0.0"