@inkeep/agents-manage-api 0.1.1 → 0.1.6

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.
Files changed (114) hide show
  1. package/LICENSE.md +29 -17
  2. package/README.md +1 -1
  3. package/SUPPLEMENTAL_TERMS.md +40 -0
  4. package/dist/index.cjs +5083 -0
  5. package/dist/index.d.cts +15 -0
  6. package/dist/index.d.ts +15 -4
  7. package/dist/index.js +5046 -35
  8. package/package.json +15 -13
  9. package/dist/ManagementServer.d.ts +0 -28
  10. package/dist/ManagementServer.d.ts.map +0 -1
  11. package/dist/ManagementServer.js +0 -41
  12. package/dist/__tests__/setup.d.ts +0 -2
  13. package/dist/__tests__/setup.d.ts.map +0 -1
  14. package/dist/__tests__/setup.js +0 -26
  15. package/dist/__tests__/utils/testProject.d.ts +0 -18
  16. package/dist/__tests__/utils/testProject.d.ts.map +0 -1
  17. package/dist/__tests__/utils/testProject.js +0 -26
  18. package/dist/__tests__/utils/testRequest.d.ts +0 -2
  19. package/dist/__tests__/utils/testRequest.d.ts.map +0 -1
  20. package/dist/__tests__/utils/testRequest.js +0 -11
  21. package/dist/__tests__/utils/testTenant.d.ts +0 -64
  22. package/dist/__tests__/utils/testTenant.d.ts.map +0 -1
  23. package/dist/__tests__/utils/testTenant.js +0 -71
  24. package/dist/app.d.ts +0 -4
  25. package/dist/app.d.ts.map +0 -1
  26. package/dist/app.js +0 -140
  27. package/dist/data/conversations.d.ts +0 -59
  28. package/dist/data/conversations.d.ts.map +0 -1
  29. package/dist/data/conversations.js +0 -216
  30. package/dist/data/db/clean.d.ts +0 -6
  31. package/dist/data/db/clean.d.ts.map +0 -1
  32. package/dist/data/db/clean.js +0 -77
  33. package/dist/data/db/dbClient.d.ts +0 -3
  34. package/dist/data/db/dbClient.d.ts.map +0 -1
  35. package/dist/data/db/dbClient.js +0 -13
  36. package/dist/data/graphFull.d.ts +0 -11
  37. package/dist/data/graphFull.d.ts.map +0 -1
  38. package/dist/data/graphFull.js +0 -90
  39. package/dist/data/graphFullClient.d.ts +0 -22
  40. package/dist/data/graphFullClient.d.ts.map +0 -1
  41. package/dist/data/graphFullClient.js +0 -189
  42. package/dist/data/tools.d.ts +0 -81
  43. package/dist/data/tools.d.ts.map +0 -1
  44. package/dist/data/tools.js +0 -266
  45. package/dist/env.d.ts +0 -41
  46. package/dist/env.d.ts.map +0 -1
  47. package/dist/env.js +0 -59
  48. package/dist/index.d.ts.map +0 -1
  49. package/dist/logger.d.ts +0 -4
  50. package/dist/logger.d.ts.map +0 -1
  51. package/dist/logger.js +0 -32
  52. package/dist/middleware/auth.d.ts +0 -12
  53. package/dist/middleware/auth.d.ts.map +0 -1
  54. package/dist/middleware/auth.js +0 -36
  55. package/dist/openapi.d.ts +0 -2
  56. package/dist/openapi.d.ts.map +0 -1
  57. package/dist/openapi.js +0 -38
  58. package/dist/routes/agentArtifactComponents.d.ts +0 -4
  59. package/dist/routes/agentArtifactComponents.d.ts.map +0 -1
  60. package/dist/routes/agentArtifactComponents.js +0 -230
  61. package/dist/routes/agentDataComponents.d.ts +0 -4
  62. package/dist/routes/agentDataComponents.d.ts.map +0 -1
  63. package/dist/routes/agentDataComponents.js +0 -225
  64. package/dist/routes/agentGraph.d.ts +0 -4
  65. package/dist/routes/agentGraph.d.ts.map +0 -1
  66. package/dist/routes/agentGraph.js +0 -289
  67. package/dist/routes/agentRelations.d.ts +0 -4
  68. package/dist/routes/agentRelations.d.ts.map +0 -1
  69. package/dist/routes/agentRelations.js +0 -290
  70. package/dist/routes/agentToolRelations.d.ts +0 -4
  71. package/dist/routes/agentToolRelations.d.ts.map +0 -1
  72. package/dist/routes/agentToolRelations.js +0 -342
  73. package/dist/routes/agents.d.ts +0 -4
  74. package/dist/routes/agents.d.ts.map +0 -1
  75. package/dist/routes/agents.js +0 -213
  76. package/dist/routes/apiKeys.d.ts +0 -4
  77. package/dist/routes/apiKeys.d.ts.map +0 -1
  78. package/dist/routes/apiKeys.js +0 -236
  79. package/dist/routes/artifactComponents.d.ts +0 -4
  80. package/dist/routes/artifactComponents.d.ts.map +0 -1
  81. package/dist/routes/artifactComponents.js +0 -202
  82. package/dist/routes/contextConfigs.d.ts +0 -4
  83. package/dist/routes/contextConfigs.d.ts.map +0 -1
  84. package/dist/routes/contextConfigs.js +0 -181
  85. package/dist/routes/credentials.d.ts +0 -4
  86. package/dist/routes/credentials.d.ts.map +0 -1
  87. package/dist/routes/credentials.js +0 -219
  88. package/dist/routes/dataComponents.d.ts +0 -4
  89. package/dist/routes/dataComponents.d.ts.map +0 -1
  90. package/dist/routes/dataComponents.js +0 -188
  91. package/dist/routes/externalAgents.d.ts +0 -4
  92. package/dist/routes/externalAgents.d.ts.map +0 -1
  93. package/dist/routes/externalAgents.js +0 -216
  94. package/dist/routes/graphFull.d.ts +0 -4
  95. package/dist/routes/graphFull.d.ts.map +0 -1
  96. package/dist/routes/graphFull.js +0 -248
  97. package/dist/routes/index.d.ts +0 -4
  98. package/dist/routes/index.d.ts.map +0 -1
  99. package/dist/routes/index.js +0 -37
  100. package/dist/routes/oauth.d.ts +0 -14
  101. package/dist/routes/oauth.d.ts.map +0 -1
  102. package/dist/routes/oauth.js +0 -191
  103. package/dist/routes/projects.d.ts +0 -4
  104. package/dist/routes/projects.d.ts.map +0 -1
  105. package/dist/routes/projects.js +0 -221
  106. package/dist/routes/tools.d.ts +0 -4
  107. package/dist/routes/tools.d.ts.map +0 -1
  108. package/dist/routes/tools.js +0 -547
  109. package/dist/utils/auth-detection.d.ts +0 -22
  110. package/dist/utils/auth-detection.d.ts.map +0 -1
  111. package/dist/utils/auth-detection.js +0 -149
  112. package/dist/utils/oauth-service.d.ts +0 -88
  113. package/dist/utils/oauth-service.d.ts.map +0 -1
  114. package/dist/utils/oauth-service.js +0 -240
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-manage-api",
3
- "version": "0.1.1",
3
+ "version": "0.1.6",
4
4
  "description": "Management API for Inkeep Agent Framework - handles CRUD operations and OAuth",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -23,18 +23,20 @@
23
23
  "nanoid": "^5.1.5",
24
24
  "openid-client": "^6.6.4",
25
25
  "pino": "^9.7.0",
26
- "pino-pretty": "^13.0.0",
27
26
  "zod": "^4.1.5",
28
- "@inkeep/agents-core": "0.1.0"
27
+ "@inkeep/agents-core": "^0.1.6"
29
28
  },
30
29
  "devDependencies": {
31
- "@biomejs/biome": "2.1.4",
30
+ "@hono/vite-dev-server": "^0.20.1",
32
31
  "@types/node": "^20.11.24",
33
32
  "@vitest/coverage-v8": "^2.0.0",
34
33
  "drizzle-kit": "^0.31.4",
35
34
  "nodemon": "^3.1.0",
35
+ "pino-pretty": "^13.0.0",
36
36
  "tsx": "^4.7.1",
37
37
  "typescript": "^5.3.3",
38
+ "vite": "^7.1.4",
39
+ "vite-tsconfig-paths": "^5.1.4",
38
40
  "vitest": "^3.1.4"
39
41
  },
40
42
  "engines": {
@@ -47,21 +49,21 @@
47
49
  "files": [
48
50
  "dist",
49
51
  "README.md",
50
- "LICENSE"
52
+ "LICENSE.md",
53
+ "SUPPLEMENTAL_TERMS.md"
51
54
  ],
52
55
  "repository": {
53
56
  "type": "git",
54
- "url": "git+https://github.com/inkeep/agent-framework.git",
57
+ "url": "git+https://github.com/inkeep/agents.git",
55
58
  "directory": "agents-manage-api"
56
59
  },
57
60
  "scripts": {
58
- "dev": "nodemon --watch src --ext ts --exec 'tsx src/index.ts'",
59
- "dev:apis": "nodemon --watch src --ext ts --exec 'tsx src/index.ts'",
60
- "build": "tsc",
61
- "start": "node dist/index.js",
62
- "test": "ENVIRONMENT=test vitest --run",
63
- "test:watch": "ENVIRONMENT=test vitest",
64
- "test:coverage": "ENVIRONMENT=test vitest --run --coverage",
61
+ "dev": "vite",
62
+ "build": "tsup",
63
+ "start": "node dist/server.js",
64
+ "test": "vitest --run",
65
+ "test:watch": "vitest",
66
+ "test:coverage": "vitest --run --coverage",
65
67
  "typecheck": "tsc --noEmit"
66
68
  }
67
69
  }
@@ -1,28 +0,0 @@
1
- import { BaseServer } from '@inkeep/agents-core';
2
- import type { AgentFrameworkServerConfig } from '@inkeep/agents-core';
3
- export declare const MANAGEMENT_API_PORT = 3002;
4
- /**
5
- * Management Server for CRUD operations, entity management, and OAuth
6
- * Extends BaseServer with Management API specific functionality
7
- */
8
- export declare class ManagementServer extends BaseServer {
9
- constructor(config?: AgentFrameworkServerConfig);
10
- /**
11
- * Initialize the Management API application
12
- */
13
- protected initialize(): Promise<void>;
14
- /**
15
- * Get default server options for Management API
16
- */
17
- protected getServerOptions(): {
18
- port: number;
19
- keepAliveTimeout: number;
20
- keepAlive: boolean;
21
- requestTimeout: number;
22
- };
23
- /**
24
- * Custom cleanup for Management API before shutdown
25
- */
26
- protected beforeShutdown(): Promise<void>;
27
- }
28
- //# sourceMappingURL=ManagementServer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ManagementServer.d.ts","sourceRoot":"","sources":["../src/ManagementServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAGtE,eAAO,MAAM,mBAAmB,OAAO,CAAC;AACxC;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;gBAClC,MAAM,GAAE,0BAA+B;IAInD;;OAEG;cACa,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAK3C;;OAEG;IACH,SAAS,CAAC,gBAAgB;;;;;;IAU1B;;OAEG;cACa,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CAQhD"}
@@ -1,41 +0,0 @@
1
- import { BaseServer } from '@inkeep/agents-core';
2
- import { getLogger } from './logger.js';
3
- import app from './app.js';
4
- export const MANAGEMENT_API_PORT = 3002;
5
- /**
6
- * Management Server for CRUD operations, entity management, and OAuth
7
- * Extends BaseServer with Management API specific functionality
8
- */
9
- export class ManagementServer extends BaseServer {
10
- constructor(config = {}) {
11
- super(config, getLogger('ManagementServer'));
12
- }
13
- /**
14
- * Initialize the Management API application
15
- */
16
- async initialize() {
17
- this.app = app;
18
- this.logger.info('Management API initialized');
19
- }
20
- /**
21
- * Get default server options for Management API
22
- */
23
- getServerOptions() {
24
- return {
25
- port: this.config.port || MANAGEMENT_API_PORT,
26
- keepAliveTimeout: 60000,
27
- keepAlive: true,
28
- requestTimeout: 60000,
29
- ...this.config.serverOptions,
30
- };
31
- }
32
- /**
33
- * Custom cleanup for Management API before shutdown
34
- */
35
- async beforeShutdown() {
36
- this.logger.info('Performing Management API cleanup...');
37
- // Add any Management API specific cleanup here
38
- // e.g., close database connections, cleanup OAuth sessions, etc.
39
- await super.beforeShutdown();
40
- }
41
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=setup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/__tests__/setup.ts"],"names":[],"mappings":""}
@@ -1,26 +0,0 @@
1
- import { sql } from 'drizzle-orm';
2
- import { migrate } from 'drizzle-orm/libsql/migrator';
3
- import { afterAll, afterEach, beforeAll } from 'vitest';
4
- import dbClient from '../data/db/dbClient.js';
5
- import { getLogger } from '@inkeep/agents-core';
6
- // Initialize database schema for in-memory test databases using Drizzle migrations
7
- beforeAll(async () => {
8
- const logger = getLogger('Test Setup');
9
- try {
10
- logger.debug({}, 'Applying database migrations to in-memory test database');
11
- // Temporarily disable foreign key constraints for tests due to composite key issues
12
- await dbClient.run(sql `PRAGMA foreign_keys = OFF`);
13
- await migrate(dbClient, { migrationsFolder: '../packages/agents-core/drizzle' });
14
- logger.debug({}, 'Database migrations applied successfully');
15
- }
16
- catch (error) {
17
- logger.error({ error }, 'Failed to apply database migrations');
18
- throw error;
19
- }
20
- });
21
- afterEach(() => {
22
- // Any cleanup if needed
23
- });
24
- afterAll(() => {
25
- // Any final cleanup if needed
26
- });
@@ -1,18 +0,0 @@
1
- /**
2
- * Ensures a project exists for a given tenant ID.
3
- * This is needed because of foreign key constraints in the database.
4
- *
5
- * @param tenantId - The tenant ID
6
- * @param projectId - The project ID (defaults to 'default')
7
- * @returns Promise that resolves when the project is created
8
- */
9
- export declare function ensureTestProject(tenantId: string, projectId?: string): Promise<void>;
10
- /**
11
- * Creates multiple test projects for a tenant.
12
- *
13
- * @param tenantId - The tenant ID
14
- * @param projectIds - Array of project IDs to create
15
- * @returns Promise that resolves when all projects are created
16
- */
17
- export declare function ensureTestProjects(tenantId: string, projectIds: string[]): Promise<void>;
18
- //# sourceMappingURL=testProject.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"testProject.d.ts","sourceRoot":"","sources":["../../../src/__tests__/utils/testProject.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,SAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAK9F;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAE9F"}
@@ -1,26 +0,0 @@
1
- import { sql } from 'drizzle-orm';
2
- import dbClient from '../../data/db/dbClient.js';
3
- /**
4
- * Ensures a project exists for a given tenant ID.
5
- * This is needed because of foreign key constraints in the database.
6
- *
7
- * @param tenantId - The tenant ID
8
- * @param projectId - The project ID (defaults to 'default')
9
- * @returns Promise that resolves when the project is created
10
- */
11
- export async function ensureTestProject(tenantId, projectId = 'default') {
12
- await dbClient.run(sql `
13
- INSERT OR IGNORE INTO projects (tenant_id, id, name, description, created_at, updated_at)
14
- VALUES (${tenantId}, ${projectId}, ${`Test Project ${projectId}`}, ${`Test project for ${projectId}`}, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
15
- `);
16
- }
17
- /**
18
- * Creates multiple test projects for a tenant.
19
- *
20
- * @param tenantId - The tenant ID
21
- * @param projectIds - Array of project IDs to create
22
- * @returns Promise that resolves when all projects are created
23
- */
24
- export async function ensureTestProjects(tenantId, projectIds) {
25
- await Promise.all(projectIds.map((projectId) => ensureTestProject(tenantId, projectId)));
26
- }
@@ -1,2 +0,0 @@
1
- export declare const makeRequest: (url: string, options?: RequestInit) => Promise<Response>;
2
- //# sourceMappingURL=testRequest.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"testRequest.d.ts","sourceRoot":"","sources":["../../../src/__tests__/utils/testRequest.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,GAAU,KAAK,MAAM,EAAE,UAAS,WAAgB,sBAQvE,CAAC"}
@@ -1,11 +0,0 @@
1
- import app from '../../app.js';
2
- // Helper function to make requests with JSON headers
3
- export const makeRequest = async (url, options = {}) => {
4
- return app.request(url, {
5
- ...options,
6
- headers: {
7
- 'Content-Type': 'application/json',
8
- ...options.headers,
9
- },
10
- });
11
- };
@@ -1,64 +0,0 @@
1
- /**
2
- * Creates a unique tenant ID for test isolation.
3
- *
4
- * Each test run gets its own tenant to ensure parallel tests don't interfere with each other.
5
- * The generated tenant ID follows the format: test-tenant-{prefix}-{uuid} or test-tenant-{uuid}
6
- *
7
- * @param prefix - Optional prefix to include in the tenant ID (e.g., test file name)
8
- * @returns A unique tenant ID for test isolation
9
- *
10
- * @example
11
- * ```typescript
12
- * import { createTestTenantId } from './utils/testTenant.js';
13
- *
14
- * describe('My test suite', () => {
15
- * const tenantId = createTestTenantId('agents');
16
- *
17
- * it('should work with isolated tenant', async () => {
18
- * // Your test code using the unique tenant ID
19
- * console.log(tenantId); // e.g., "test-tenant-agents-123e4567-e89b-12d3-a456-426614174000"
20
- * });
21
- * });
22
- * ```
23
- */
24
- export declare function createTestTenantId(prefix?: string): string;
25
- /**
26
- * Creates multiple unique tenant IDs for test isolation.
27
- *
28
- * Useful when you need multiple tenants in a single test.
29
- *
30
- * @param count - Number of tenant IDs to generate
31
- * @param prefix - Optional prefix to include in all tenant IDs
32
- * @returns Array of unique tenant IDs
33
- *
34
- * @example
35
- * ```typescript
36
- * import { createTestTenantIds } from './utils/testTenant.js';
37
- *
38
- * describe('Multi-tenant test suite', () => {
39
- * const [tenantA, tenantB] = createTestTenantIds(2, 'multi-tenant');
40
- *
41
- * it('should handle cross-tenant operations', async () => {
42
- * // Test operations across different tenants
43
- * });
44
- * });
45
- * ```
46
- */
47
- export declare function createTestTenantIds(count: number, prefix?: string): string[];
48
- /**
49
- * Checks if a tenant ID is a test tenant.
50
- *
51
- * @param tenantId - The tenant ID to check
52
- * @returns True if the tenant ID is a test tenant
53
- *
54
- * @example
55
- * ```typescript
56
- * import { isTestTenant } from './utils/testTenant.js';
57
- *
58
- * const tenantId = createTestTenantId();
59
- * console.log(isTestTenant(tenantId)); // true
60
- * console.log(isTestTenant('production-tenant')); // false
61
- * ```
62
- */
63
- export declare function isTestTenant(tenantId: string): boolean;
64
- //# sourceMappingURL=testTenant.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"testTenant.d.ts","sourceRoot":"","sources":["../../../src/__tests__/utils/testTenant.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAG1D;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAE5E;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEtD"}
@@ -1,71 +0,0 @@
1
- import { randomUUID } from 'node:crypto';
2
- /**
3
- * Creates a unique tenant ID for test isolation.
4
- *
5
- * Each test run gets its own tenant to ensure parallel tests don't interfere with each other.
6
- * The generated tenant ID follows the format: test-tenant-{prefix}-{uuid} or test-tenant-{uuid}
7
- *
8
- * @param prefix - Optional prefix to include in the tenant ID (e.g., test file name)
9
- * @returns A unique tenant ID for test isolation
10
- *
11
- * @example
12
- * ```typescript
13
- * import { createTestTenantId } from './utils/testTenant.js';
14
- *
15
- * describe('My test suite', () => {
16
- * const tenantId = createTestTenantId('agents');
17
- *
18
- * it('should work with isolated tenant', async () => {
19
- * // Your test code using the unique tenant ID
20
- * console.log(tenantId); // e.g., "test-tenant-agents-123e4567-e89b-12d3-a456-426614174000"
21
- * });
22
- * });
23
- * ```
24
- */
25
- export function createTestTenantId(prefix) {
26
- const uuid = randomUUID();
27
- return prefix ? `test-tenant-${prefix}-${uuid}` : `test-tenant-${uuid}`;
28
- }
29
- /**
30
- * Creates multiple unique tenant IDs for test isolation.
31
- *
32
- * Useful when you need multiple tenants in a single test.
33
- *
34
- * @param count - Number of tenant IDs to generate
35
- * @param prefix - Optional prefix to include in all tenant IDs
36
- * @returns Array of unique tenant IDs
37
- *
38
- * @example
39
- * ```typescript
40
- * import { createTestTenantIds } from './utils/testTenant.js';
41
- *
42
- * describe('Multi-tenant test suite', () => {
43
- * const [tenantA, tenantB] = createTestTenantIds(2, 'multi-tenant');
44
- *
45
- * it('should handle cross-tenant operations', async () => {
46
- * // Test operations across different tenants
47
- * });
48
- * });
49
- * ```
50
- */
51
- export function createTestTenantIds(count, prefix) {
52
- return Array.from({ length: count }, () => createTestTenantId(prefix));
53
- }
54
- /**
55
- * Checks if a tenant ID is a test tenant.
56
- *
57
- * @param tenantId - The tenant ID to check
58
- * @returns True if the tenant ID is a test tenant
59
- *
60
- * @example
61
- * ```typescript
62
- * import { isTestTenant } from './utils/testTenant.js';
63
- *
64
- * const tenantId = createTestTenantId();
65
- * console.log(isTestTenant(tenantId)); // true
66
- * console.log(isTestTenant('production-tenant')); // false
67
- * ```
68
- */
69
- export function isTestTenant(tenantId) {
70
- return tenantId.startsWith('test-tenant-');
71
- }
package/dist/app.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { OpenApiHonoWithExecutionContext } from '@inkeep/agents-core';
2
- declare const app: OpenApiHonoWithExecutionContext;
3
- export default app;
4
- //# sourceMappingURL=app.d.ts.map
package/dist/app.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AAatE,QAAA,MAAM,GAAG,iCAAwC,CAAC;AAwJlD,eAAe,GAAG,CAAC"}
package/dist/app.js DELETED
@@ -1,140 +0,0 @@
1
- import { createRoute } from '@hono/zod-openapi';
2
- import { OpenApiHonoWithExecutionContext } from '@inkeep/agents-core';
3
- import { cors } from 'hono/cors';
4
- import { HTTPException } from 'hono/http-exception';
5
- import { requestId } from 'hono/request-id';
6
- import { pinoLogger } from 'hono-pino';
7
- import { handleApiError } from '@inkeep/agents-core';
8
- import { getLogger } from './logger.js';
9
- import crudRoutes from './routes/index.js';
10
- import { apiKeyAuth } from './middleware/auth.js';
11
- import oauthRoutes from './routes/oauth.js';
12
- import { setupOpenAPIRoutes } from './openapi.js';
13
- const app = new OpenApiHonoWithExecutionContext();
14
- // Request ID middleware
15
- app.use('*', requestId());
16
- // Logging middleware
17
- app.use(pinoLogger({
18
- pino: getLogger(),
19
- http: {
20
- onResLevel(c) {
21
- if (c.res.status >= 500) {
22
- return 'error';
23
- }
24
- return 'info';
25
- },
26
- },
27
- }));
28
- // Error handling
29
- app.onError(async (err, c) => {
30
- const isExpectedError = err instanceof HTTPException;
31
- const status = isExpectedError ? err.status : 500;
32
- const requestId = c.get('requestId') || 'unknown';
33
- // Zod validation error detection
34
- let zodIssues;
35
- if (err && typeof err === 'object') {
36
- if (err.cause && Array.isArray(err.cause.issues)) {
37
- zodIssues = err.cause.issues;
38
- }
39
- else if (Array.isArray(err.issues)) {
40
- zodIssues = err.issues;
41
- }
42
- }
43
- if (status === 400 && Array.isArray(zodIssues)) {
44
- c.status(400);
45
- c.header('Content-Type', 'application/problem+json');
46
- c.header('X-Content-Type-Options', 'nosniff');
47
- return c.json({
48
- type: 'https://docs.inkeep.com/agents-api/errors#bad_request',
49
- title: 'Validation Failed',
50
- status: 400,
51
- detail: 'Request validation failed',
52
- errors: zodIssues.map((issue) => ({
53
- detail: issue.message,
54
- pointer: issue.path ? `/${issue.path.join('/')}` : undefined,
55
- name: issue.path ? issue.path.join('.') : undefined,
56
- reason: issue.message,
57
- })),
58
- });
59
- }
60
- if (status >= 500) {
61
- if (!isExpectedError) {
62
- const errorMessage = err instanceof Error ? err.message : String(err);
63
- const errorStack = err instanceof Error ? err.stack : undefined;
64
- getLogger().error({
65
- error: err,
66
- message: errorMessage,
67
- stack: errorStack,
68
- path: c.req.path,
69
- requestId,
70
- }, 'Unexpected server error occurred');
71
- }
72
- else {
73
- getLogger().error({
74
- error: err,
75
- path: c.req.path,
76
- requestId,
77
- status,
78
- }, 'Server error occurred');
79
- }
80
- }
81
- if (isExpectedError) {
82
- try {
83
- const response = err.getResponse();
84
- return response;
85
- }
86
- catch (responseError) {
87
- getLogger().error({ error: responseError }, 'Error while handling HTTPException response');
88
- }
89
- }
90
- const { status: respStatus, title, detail, instance } = await handleApiError(err, requestId);
91
- c.status(respStatus);
92
- c.header('Content-Type', 'application/problem+json');
93
- c.header('X-Content-Type-Options', 'nosniff');
94
- return c.json({
95
- type: 'https://docs.inkeep.com/agents-api/errors#internal_server_error',
96
- title,
97
- status: respStatus,
98
- detail,
99
- ...(instance && { instance }),
100
- });
101
- });
102
- // CORS middleware
103
- app.use('*', cors({
104
- origin: (origin) => {
105
- if (!origin)
106
- return origin;
107
- return origin.startsWith('http://localhost:') || origin.startsWith('https://localhost:')
108
- ? origin
109
- : null;
110
- },
111
- allowMethods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'PATCH'],
112
- allowHeaders: ['*'],
113
- exposeHeaders: ['Content-Length'],
114
- maxAge: 86400,
115
- credentials: true,
116
- }));
117
- // Health check endpoint
118
- app.openapi(createRoute({
119
- method: 'get',
120
- path: '/health',
121
- tags: ['health'],
122
- summary: 'Health check',
123
- description: 'Check if the management service is healthy',
124
- responses: {
125
- 204: {
126
- description: 'Service is healthy',
127
- },
128
- },
129
- }), (c) => {
130
- return c.body(null, 204);
131
- });
132
- // API Key authentication middleware for protected routes
133
- app.use('/tenants/*', apiKeyAuth());
134
- // Mount CRUD routes for all entities
135
- app.route('/tenants/:tenantId/crud', crudRoutes);
136
- // Mount OAuth routes - global OAuth callback endpoint
137
- app.route('/oauth', oauthRoutes);
138
- // Setup OpenAPI documentation endpoints (/openapi.json and /docs)
139
- setupOpenAPIRoutes(app);
140
- export default app;
@@ -1,59 +0,0 @@
1
- import { type ConversationScopeOptions, type ConversationHistoryConfig, type AgentConversationHistoryConfig } from '@inkeep/agents-core';
2
- /**
3
- * Creates default conversation history configuration
4
- * @param mode - The conversation history mode ('full' | 'scoped' | 'none')
5
- * @returns Default AgentConversationHistoryConfig
6
- */
7
- export declare function createDefaultConversationHistoryConfig(mode?: 'full' | 'scoped' | 'none'): AgentConversationHistoryConfig;
8
- /**
9
- * Saves the result of an A2A client sendMessage call as a conversation message
10
- * @param response - The response from a2aClient.sendMessage()
11
- * @param params - Parameters for saving the message
12
- * @returns The saved message or null if no text content was found
13
- */
14
- export declare function saveA2AMessageResponse(response: any, // SendMessageResponse type
15
- params: {
16
- tenantId: string;
17
- projectId: string;
18
- conversationId: string;
19
- messageType: 'a2a-response' | 'a2a-request';
20
- visibility: 'internal' | 'external' | 'user-facing';
21
- fromAgentId?: string;
22
- toAgentId?: string;
23
- fromExternalAgentId?: string;
24
- toExternalAgentId?: string;
25
- a2aTaskId?: string;
26
- a2aSessionId?: string;
27
- metadata?: Record<string, unknown>;
28
- }): Promise<any | null>;
29
- /**
30
- * Applies filtering based on agent, task, or both criteria
31
- * Returns the filtered messages array
32
- */
33
- export declare function getScopedHistory({ tenantId, projectId, conversationId, filters, options, }: {
34
- tenantId: string;
35
- projectId: string;
36
- conversationId: string;
37
- filters?: ConversationScopeOptions;
38
- options?: ConversationHistoryConfig;
39
- }): Promise<any[]>;
40
- /**
41
- * Get user-facing conversation history (for client display)
42
- */
43
- export declare function getUserFacingHistory(tenantId: string, projectId: string, conversationId: string, limit?: number): Promise<any[]>;
44
- /**
45
- * Get full conversation context (for agent processing)
46
- */
47
- export declare function getFullConversationContext(tenantId: string, projectId: string, conversationId: string, maxTokens?: number): Promise<any[]>;
48
- /**
49
- * Get formatted conversation history for a2a
50
- */
51
- export declare function getFormattedConversationHistory({ tenantId, projectId, conversationId, currentMessage, options, filters, }: {
52
- tenantId: string;
53
- projectId: string;
54
- conversationId: string;
55
- currentMessage?: string;
56
- options?: ConversationHistoryConfig;
57
- filters?: ConversationScopeOptions;
58
- }): Promise<string>;
59
- //# sourceMappingURL=conversations.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../src/data/conversations.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,8BAA8B,EAEpC,MAAM,qBAAqB,CAAC;AAE7B;;;;GAIG;AACH,wBAAgB,sCAAsC,CACpD,IAAI,GAAE,MAAM,GAAG,QAAQ,GAAG,MAAe,GACxC,8BAA8B,CAQhC;AAYD;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,GAAG,EAAE,2BAA2B;AAC1C,MAAM,EAAE;IACN,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,cAAc,GAAG,aAAa,CAAC;IAC5C,UAAU,EAAE,UAAU,GAAG,UAAU,GAAG,aAAa,CAAC;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,GACA,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,CAkDrB;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,QAAQ,EACR,SAAS,EACT,cAAc,EACd,OAAO,EACP,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,wBAAwB,CAAC;IACnC,OAAO,CAAC,EAAE,yBAAyB,CAAC;CACrC,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAyDjB;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,KAAK,SAAK,GACT,OAAO,CAAC,GAAG,EAAE,CAAC,CAUhB;AAED;;GAEG;AACH,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,GAAG,EAAE,CAAC,CAUhB;AAED;;GAEG;AACH,wBAAsB,+BAA+B,CAAC,EACpD,QAAQ,EACR,SAAS,EACT,cAAc,EACd,cAAc,EACd,OAAO,EACP,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,yBAAyB,CAAC;IACpC,OAAO,CAAC,EAAE,wBAAwB,CAAC;CACpC,GAAG,OAAO,CAAC,MAAM,CAAC,CAuDlB"}