@inkeep/agents-run-api 0.1.1 → 0.1.3
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.md +22 -17
- package/README.md +1 -1
- package/dist/AgentExecutionServer.d.ts +6 -1
- package/dist/AgentExecutionServer.d.ts.map +1 -1
- package/dist/AgentExecutionServer.js +10 -1
- package/dist/__tests__/setup.d.ts.map +1 -1
- package/dist/__tests__/setup.js +32 -2
- package/dist/__tests__/utils/testProject.js +1 -1
- package/dist/__tests__/utils/testRequest.js +1 -1
- package/dist/__tests__/utils/testTenant.d.ts +3 -3
- package/dist/__tests__/utils/testTenant.js +3 -3
- package/dist/a2a/client.d.ts.map +1 -1
- package/dist/a2a/client.js +1 -1
- package/dist/a2a/handlers.d.ts +1 -1
- package/dist/a2a/handlers.d.ts.map +1 -1
- package/dist/a2a/handlers.js +3 -4
- package/dist/a2a/transfer.d.ts +1 -1
- package/dist/a2a/transfer.d.ts.map +1 -1
- package/dist/a2a/transfer.js +2 -2
- package/dist/agents/Agent.d.ts +4 -4
- package/dist/agents/Agent.d.ts.map +1 -1
- package/dist/agents/Agent.js +31 -26
- package/dist/agents/ModelFactory.d.ts.map +1 -1
- package/dist/agents/ModelFactory.js +3 -3
- package/dist/agents/SystemPromptBuilder.d.ts +1 -1
- package/dist/agents/SystemPromptBuilder.d.ts.map +1 -1
- package/dist/agents/SystemPromptBuilder.js +2 -2
- package/dist/agents/ToolSessionManager.js +1 -1
- package/dist/agents/artifactTools.d.ts.map +1 -1
- package/dist/agents/artifactTools.js +4 -4
- package/dist/agents/generateTaskHandler.d.ts +3 -3
- package/dist/agents/generateTaskHandler.d.ts.map +1 -1
- package/dist/agents/generateTaskHandler.js +6 -6
- package/dist/agents/relationTools.d.ts +4 -2
- package/dist/agents/relationTools.d.ts.map +1 -1
- package/dist/agents/relationTools.js +13 -12
- package/dist/agents/types.d.ts +1 -1
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/versions/V1Config.d.ts +1 -1
- package/dist/agents/versions/V1Config.d.ts.map +1 -1
- package/dist/app.d.ts +11 -3
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +195 -173
- package/dist/data/agentGraph.d.ts +1 -1
- package/dist/data/agentGraph.d.ts.map +1 -1
- package/dist/data/agentGraph.js +2 -2
- package/dist/data/agents.d.ts +3 -3
- package/dist/data/agents.d.ts.map +1 -1
- package/dist/data/agents.js +11 -6
- package/dist/data/conversations.d.ts +1 -1
- package/dist/data/conversations.d.ts.map +1 -1
- package/dist/data/conversations.js +2 -2
- package/dist/data/db/clean.js +3 -3
- package/dist/data/db/dbClient.js +1 -1
- package/dist/env.d.ts +7 -5
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +1 -0
- package/dist/handlers/executionHandler.d.ts +1 -1
- package/dist/handlers/executionHandler.d.ts.map +1 -1
- package/dist/handlers/executionHandler.js +10 -13
- package/dist/index.d.ts +22 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -37
- package/dist/instrumentation.js +3 -3
- package/dist/logger.js +1 -1
- package/dist/middleware/api-key-auth.d.ts.map +1 -1
- package/dist/middleware/api-key-auth.js +4 -4
- package/dist/middleware/index.d.ts +1 -1
- package/dist/middleware/index.d.ts.map +1 -1
- package/dist/middleware/index.js +1 -1
- package/dist/openapi.js +1 -1
- package/dist/routes/agents.d.ts +7 -1
- package/dist/routes/agents.d.ts.map +1 -1
- package/dist/routes/agents.js +12 -9
- package/dist/routes/chat.d.ts +7 -1
- package/dist/routes/chat.d.ts.map +1 -1
- package/dist/routes/chat.js +7 -8
- package/dist/routes/chatDataStream.d.ts +7 -1
- package/dist/routes/chatDataStream.d.ts.map +1 -1
- package/dist/routes/chatDataStream.js +7 -7
- package/dist/routes/mcp.d.ts +7 -1
- package/dist/routes/mcp.d.ts.map +1 -1
- package/dist/routes/mcp.js +15 -15
- package/dist/server.d.ts +5 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +61 -0
- package/dist/tracer.d.ts.map +1 -1
- package/dist/tracer.js +11 -1
- package/dist/utils/agent-operations.d.ts +14 -1
- package/dist/utils/agent-operations.d.ts.map +1 -1
- package/dist/utils/agent-operations.js +11 -0
- package/dist/utils/artifact-component-schema.d.ts +1 -1
- package/dist/utils/artifact-component-schema.d.ts.map +1 -1
- package/dist/utils/artifact-component-schema.js +4 -4
- package/dist/utils/artifact-parser.js +2 -2
- package/dist/utils/cleanup.js +1 -1
- package/dist/utils/data-component-schema.js +1 -1
- package/dist/utils/graph-session.d.ts +1 -1
- package/dist/utils/graph-session.d.ts.map +1 -1
- package/dist/utils/graph-session.js +22 -15
- package/dist/utils/incremental-stream-parser.d.ts +2 -2
- package/dist/utils/incremental-stream-parser.d.ts.map +1 -1
- package/dist/utils/incremental-stream-parser.js +5 -3
- package/dist/utils/response-formatter.d.ts.map +1 -1
- package/dist/utils/response-formatter.js +3 -3
- package/dist/utils/stream-helpers.d.ts +13 -1
- package/dist/utils/stream-helpers.d.ts.map +1 -1
- package/dist/utils/stream-helpers.js +111 -30
- package/dist/utils/stream-registry.d.ts +1 -1
- package/dist/utils/stream-registry.d.ts.map +1 -1
- package/package.json +19 -12
- package/templates/v1/artifact.xml +7 -0
- package/templates/v1/data-component.xml +9 -0
- package/templates/v1/system-prompt.xml +52 -0
- package/templates/v1/thinking-preparation.xml +34 -0
- package/templates/v1/tool.xml +12 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { nanoid } from 'nanoid';
|
|
2
|
-
import dbClient from './db/dbClient.js';
|
|
3
1
|
import { createMessage, getConversationHistory, } from '@inkeep/agents-core';
|
|
2
|
+
import { nanoid } from 'nanoid';
|
|
3
|
+
import dbClient from './db/dbClient';
|
|
4
4
|
/**
|
|
5
5
|
* Creates default conversation history configuration
|
|
6
6
|
* @param mode - The conversation history mode ('full' | 'scoped' | 'none')
|
package/dist/data/db/clean.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { sql } from 'drizzle-orm';
|
|
2
|
-
import { env } from '../../env.js';
|
|
3
1
|
import { agentArtifactComponents, agentDataComponents, agentGraph, agentRelations, agents, agentToolRelations, artifactComponents, contextCache, contextConfigs, conversations, credentialReferences, dataComponents, externalAgents, ledgerArtifacts, messages, taskRelations, tasks, tools, } from '@inkeep/agents-core';
|
|
4
|
-
import
|
|
2
|
+
import { sql } from 'drizzle-orm';
|
|
3
|
+
import { env } from '../../env';
|
|
4
|
+
import dbClient from './dbClient';
|
|
5
5
|
/**
|
|
6
6
|
* Truncates all tables in the database, respecting foreign key constraints
|
|
7
7
|
* Tables are cleared in dependency order (child tables first, then parent tables)
|
package/dist/data/db/dbClient.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { env } from '../../env.js';
|
|
2
1
|
import { createDatabaseClient } from '@inkeep/agents-core';
|
|
2
|
+
import { env } from '../../env';
|
|
3
3
|
// Create database URL - use in-memory for tests, file for other environments
|
|
4
4
|
const getDbUrl = () => {
|
|
5
5
|
// Use in-memory database for tests - each worker gets its own isolated database
|
package/dist/env.d.ts
CHANGED
|
@@ -7,36 +7,38 @@ declare const envSchema: z.ZodObject<{
|
|
|
7
7
|
}>>;
|
|
8
8
|
ENVIRONMENT: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
9
9
|
development: "development";
|
|
10
|
-
production: "production";
|
|
11
10
|
pentest: "pentest";
|
|
11
|
+
production: "production";
|
|
12
12
|
test: "test";
|
|
13
13
|
}>>>;
|
|
14
14
|
DB_FILE_NAME: z.ZodDefault<z.ZodString>;
|
|
15
15
|
PORT: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
16
16
|
AGENT_BASE_URL: z.ZodOptional<z.ZodString>;
|
|
17
17
|
LOG_LEVEL: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
18
|
-
|
|
18
|
+
error: "error";
|
|
19
19
|
debug: "debug";
|
|
20
20
|
info: "info";
|
|
21
|
+
trace: "trace";
|
|
21
22
|
warn: "warn";
|
|
22
|
-
error: "error";
|
|
23
23
|
}>>>;
|
|
24
24
|
NANGO_SECRET_KEY: z.ZodOptional<z.ZodString>;
|
|
25
25
|
OPENAI_API_KEY: z.ZodOptional<z.ZodString>;
|
|
26
26
|
ANTHROPIC_API_KEY: z.ZodString;
|
|
27
27
|
INKEEP_AGENTS_RUN_BYPASS_SECRET: z.ZodOptional<z.ZodString>;
|
|
28
|
+
OTEL_TRACES_FORCE_FLUSH_ENABLED: z.ZodOptional<z.ZodCodec<z.ZodString, z.ZodBoolean>>;
|
|
28
29
|
}, z.core.$strip>;
|
|
29
30
|
export declare const env: {
|
|
30
|
-
ENVIRONMENT: "development" | "
|
|
31
|
+
ENVIRONMENT: "development" | "pentest" | "production" | "test";
|
|
31
32
|
DB_FILE_NAME: string;
|
|
32
33
|
PORT: number;
|
|
33
|
-
LOG_LEVEL: "
|
|
34
|
+
LOG_LEVEL: "error" | "debug" | "info" | "trace" | "warn";
|
|
34
35
|
ANTHROPIC_API_KEY: string;
|
|
35
36
|
NODE_ENV?: "development" | "production" | "test" | undefined;
|
|
36
37
|
AGENT_BASE_URL?: string | undefined;
|
|
37
38
|
NANGO_SECRET_KEY?: string | undefined;
|
|
38
39
|
OPENAI_API_KEY?: string | undefined;
|
|
39
40
|
INKEEP_AGENTS_RUN_BYPASS_SECRET?: string | undefined;
|
|
41
|
+
OTEL_TRACES_FORCE_FLUSH_ENABLED?: boolean | undefined;
|
|
40
42
|
};
|
|
41
43
|
export type Env = z.infer<typeof envSchema>;
|
|
42
44
|
export {};
|
package/dist/env.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkCxB,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAeb,CAAC;AAuBH,eAAO,MAAM,GAAG;;;;;;;;;;;;CAAa,CAAC;AAC9B,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC"}
|
package/dist/env.js
CHANGED
|
@@ -42,6 +42,7 @@ const envSchema = z.object({
|
|
|
42
42
|
OPENAI_API_KEY: z.string().optional(),
|
|
43
43
|
ANTHROPIC_API_KEY: z.string(),
|
|
44
44
|
INKEEP_AGENTS_RUN_BYPASS_SECRET: z.string().optional(),
|
|
45
|
+
OTEL_TRACES_FORCE_FLUSH_ENABLED: z.stringbool().optional(),
|
|
45
46
|
});
|
|
46
47
|
const parseEnv = () => {
|
|
47
48
|
try {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { StreamHelper } from '../utils/stream-helpers.js';
|
|
2
1
|
import type { ExecutionContext } from '@inkeep/agents-core';
|
|
2
|
+
import type { StreamHelper } from '../utils/stream-helpers';
|
|
3
3
|
interface ExecutionHandlerParams {
|
|
4
4
|
executionContext: ExecutionContext;
|
|
5
5
|
conversationId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executionHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/executionHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"executionHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/executionHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAyB5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAM5D,UAAU,sBAAsB;IAC9B,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,YAAY,CAAC;CACzB;AAED,UAAU,eAAe;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,gBAAgB;IAE3B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAK;IAEhC;;;;;;;;;;;;;OAaG;IACG,OAAO,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,eAAe,CAAC;CA8cxE"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { createMessage, createTask, getActiveAgentForConversation, getFullGraph, getTask, updateTask, } from '@inkeep/agents-core';
|
|
1
2
|
import { trace } from '@opentelemetry/api';
|
|
2
|
-
import { A2AClient } from '../a2a/client.js';
|
|
3
|
-
import { executeTransfer, isTransferResponse } from '../a2a/transfer.js';
|
|
4
|
-
import { createMessage, getActiveAgentForConversation, createTask, getTask, updateTask, getFullGraph, } from '@inkeep/agents-core';
|
|
5
|
-
import { getLogger } from '../logger.js';
|
|
6
|
-
import { agentInitializingOp, agentReadyOp, completionOp, errorOp, } from '../utils/agent-operations.js';
|
|
7
|
-
import { graphSessionManager } from '../utils/graph-session.js';
|
|
8
|
-
import { MCPStreamHelper } from '../utils/stream-helpers.js';
|
|
9
|
-
import { registerStreamHelper, unregisterStreamHelper } from '../utils/stream-registry.js';
|
|
10
|
-
import dbClient from '../data/db/dbClient.js';
|
|
11
3
|
import { nanoid } from 'nanoid';
|
|
4
|
+
import { A2AClient } from '../a2a/client';
|
|
5
|
+
import { executeTransfer, isTransferResponse } from '../a2a/transfer';
|
|
6
|
+
import dbClient from '../data/db/dbClient';
|
|
7
|
+
import { getLogger } from '../logger';
|
|
8
|
+
import { agentInitializingOp, agentReadyOp, agentThinkingOp, completionOp, errorOp, } from '../utils/agent-operations';
|
|
9
|
+
import { graphSessionManager } from '../utils/graph-session';
|
|
10
|
+
import { MCPStreamHelper } from '../utils/stream-helpers';
|
|
11
|
+
import { registerStreamHelper, unregisterStreamHelper } from '../utils/stream-registry';
|
|
12
12
|
const logger = getLogger('ExecutionHandler');
|
|
13
13
|
export class ExecutionHandler {
|
|
14
14
|
// Hardcoded error limit - separate from configurable stopWhen
|
|
@@ -59,10 +59,7 @@ export class ExecutionHandler {
|
|
|
59
59
|
await sseHelper.writeOperation(agentInitializingOp(requestId, graphId));
|
|
60
60
|
await sseHelper.writeOperation(agentReadyOp(requestId, graphId));
|
|
61
61
|
// Send agent thinking operation after ready
|
|
62
|
-
await sseHelper.
|
|
63
|
-
type: 'agent_thinking',
|
|
64
|
-
ctx: { agent: 'system' },
|
|
65
|
-
});
|
|
62
|
+
await sseHelper.writeOperation(agentThinkingOp('system'));
|
|
66
63
|
// Check for existing task first to prevent race conditions
|
|
67
64
|
const taskId = `task_${conversationId}-${requestId}`;
|
|
68
65
|
const existingTask = await getTask(dbClient)({ id: taskId });
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
import './instrumentation
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import './instrumentation';
|
|
2
|
+
import { type CredentialStore, CredentialStoreRegistry, type ServerConfig } from '@inkeep/agents-core';
|
|
3
|
+
import { createExecutionHono } from './app';
|
|
4
|
+
declare const app: import("@hono/zod-openapi").OpenAPIHono<{
|
|
5
|
+
Variables: {
|
|
6
|
+
executionContext: import("@inkeep/agents-core").ExecutionContext;
|
|
7
|
+
serverConfig: ServerConfig;
|
|
8
|
+
credentialStores: CredentialStoreRegistry;
|
|
9
|
+
};
|
|
10
|
+
}, {}, "/">;
|
|
11
|
+
export default app;
|
|
12
|
+
export { createExecutionHono };
|
|
13
|
+
export declare function createExecutionApp(config?: {
|
|
14
|
+
serverConfig?: ServerConfig;
|
|
15
|
+
credentialStores?: CredentialStore[];
|
|
16
|
+
}): import("@hono/zod-openapi").OpenAPIHono<{
|
|
17
|
+
Variables: {
|
|
18
|
+
executionContext: import("@inkeep/agents-core").ExecutionContext;
|
|
19
|
+
serverConfig: ServerConfig;
|
|
20
|
+
credentialStores: CredentialStoreRegistry;
|
|
21
|
+
};
|
|
22
|
+
}, {}, "/">;
|
|
5
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,eAAe,EACpB,uBAAuB,EAEvB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAiB5C,QAAA,MAAM,GAAG;;;;;;WAAsD,CAAC;AAGhE,eAAe,GAAG,CAAC;AAGnB,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAG/B,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE;IAC1C,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;CACtC;;;;;;YAMA"}
|
package/dist/index.js
CHANGED
|
@@ -1,43 +1,28 @@
|
|
|
1
|
-
import './instrumentation
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// Create credential stores
|
|
8
|
-
const credentialStores = [
|
|
9
|
-
new InMemoryCredentialStore('memory-default'), // In-memory store + env vars
|
|
10
|
-
// Nango store (only loads if NANGO_SECRET_KEY is set)
|
|
11
|
-
...(process.env.NANGO_SECRET_KEY
|
|
12
|
-
? [
|
|
13
|
-
createNangoCredentialStore('nango-default', {
|
|
14
|
-
apiUrl: process.env.NANGO_HOST || 'https://api.nango.dev',
|
|
15
|
-
secretKey: process.env.NANGO_SECRET_KEY,
|
|
16
|
-
}),
|
|
17
|
-
]
|
|
18
|
-
: []),
|
|
19
|
-
createKeyChainStore('keychain-default'),
|
|
20
|
-
];
|
|
21
|
-
// Initialize Execution Server
|
|
22
|
-
const executionServer = new AgentExecutionServer({
|
|
23
|
-
port: EXECUTION_API_PORT,
|
|
24
|
-
credentialStores,
|
|
1
|
+
import './instrumentation';
|
|
2
|
+
import { CredentialStoreRegistry, createDefaultCredentialStores, } from '@inkeep/agents-core';
|
|
3
|
+
import { createExecutionHono } from './app';
|
|
4
|
+
// Create default configuration
|
|
5
|
+
const defaultConfig = {
|
|
6
|
+
port: 3003,
|
|
25
7
|
serverOptions: {
|
|
26
8
|
requestTimeout: 120000, // 120 seconds for execution requests
|
|
27
9
|
keepAliveTimeout: 60000,
|
|
28
10
|
keepAlive: true,
|
|
29
11
|
},
|
|
30
|
-
}
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
12
|
+
};
|
|
13
|
+
// Create default credential stores
|
|
14
|
+
const defaultStores = createDefaultCredentialStores();
|
|
15
|
+
const defaultRegistry = new CredentialStoreRegistry(defaultStores);
|
|
16
|
+
// Create default app instance for simple usage
|
|
17
|
+
const app = createExecutionHono(defaultConfig, defaultRegistry);
|
|
18
|
+
// Export the default app for Vite dev server and simple deployments
|
|
19
|
+
export default app;
|
|
20
|
+
// Also export the factory function for advanced usage
|
|
21
|
+
export { createExecutionHono };
|
|
22
|
+
// Export a helper to create app with custom credential stores - fallsback to default configs
|
|
23
|
+
export function createExecutionApp(config) {
|
|
24
|
+
const serverConfig = config?.serverConfig ?? defaultConfig;
|
|
25
|
+
const stores = config?.credentialStores ?? defaultStores;
|
|
26
|
+
const registry = new CredentialStoreRegistry(stores);
|
|
27
|
+
return createExecutionHono(serverConfig, registry);
|
|
42
28
|
}
|
|
43
|
-
export { executionServer };
|
package/dist/instrumentation.js
CHANGED
|
@@ -29,9 +29,9 @@ const spanProcessor = new FanOutSpanProcessor([
|
|
|
29
29
|
new BatchSpanProcessor(otlpExporter, {
|
|
30
30
|
maxExportBatchSize: 1, // Send immediately (vs 512)
|
|
31
31
|
scheduledDelayMillis: 100, // 100ms delay (vs 5000ms)
|
|
32
|
-
exportTimeoutMillis: 5000, // 5s timeout (vs 30s)
|
|
33
|
-
maxQueueSize: 512 // Smaller queue
|
|
34
|
-
})
|
|
32
|
+
exportTimeoutMillis: 5000, // 5s timeout (vs 30s)
|
|
33
|
+
maxQueueSize: 512, // Smaller queue
|
|
34
|
+
}),
|
|
35
35
|
]);
|
|
36
36
|
export const sdk = new NodeSDK({
|
|
37
37
|
serviceName: 'inkeep-chat',
|
package/dist/logger.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
2
|
import { pino } from 'pino';
|
|
3
3
|
// import { createGcpLoggingPinoConfig } from '@google-cloud/pino-logging-gcp-config';
|
|
4
|
-
import { env } from './env
|
|
4
|
+
import { env } from './env';
|
|
5
5
|
const logger = pino({
|
|
6
6
|
level: env.LOG_LEVEL,
|
|
7
7
|
serializers: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-key-auth.d.ts","sourceRoot":"","sources":["../../src/middleware/api-key-auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api-key-auth.d.ts","sourceRoot":"","sources":["../../src/middleware/api-key-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAmC,MAAM,qBAAqB,CAAC;AAQ7F;;;;GAIG;AACH,eAAO,MAAM,UAAU;eAER;QACT,gBAAgB,EAAE,gBAAgB,CAAC;KACpC;cAoHD,CAAC;AAEL,eAAO,MAAM,wBAAwB,GAAU,QAAQ,MAAM,8BAgB5D,CAAC;AACF;;;GAGG;AACH,eAAO,MAAM,YAAY;eAEV;QACT,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;KACrC;cAYD,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { getLogger, validateAndGetApiKey } from '@inkeep/agents-core';
|
|
1
2
|
import { createMiddleware } from 'hono/factory';
|
|
2
3
|
import { HTTPException } from 'hono/http-exception';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { createExecutionContext } from '../types/execution-context
|
|
6
|
-
import { env } from '../env.js';
|
|
4
|
+
import dbClient from '../data/db/dbClient';
|
|
5
|
+
import { env } from '../env';
|
|
6
|
+
import { createExecutionContext } from '../types/execution-context';
|
|
7
7
|
const logger = getLogger('env-key-auth');
|
|
8
8
|
/**
|
|
9
9
|
* Middleware to authenticate API requests using Bearer token authentication
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './api-key-auth
|
|
1
|
+
export * from './api-key-auth';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/middleware/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/middleware/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
package/dist/middleware/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './api-key-auth
|
|
1
|
+
export * from './api-key-auth';
|
package/dist/openapi.js
CHANGED
package/dist/routes/agents.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
-
|
|
2
|
+
import { type CredentialStoreRegistry } from '@inkeep/agents-core';
|
|
3
|
+
type AppVariables = {
|
|
4
|
+
credentialStores: CredentialStoreRegistry;
|
|
5
|
+
};
|
|
6
|
+
declare const app: OpenAPIHono<{
|
|
7
|
+
Variables: AppVariables;
|
|
8
|
+
}, {}, "/">;
|
|
3
9
|
export default app;
|
|
4
10
|
//# sourceMappingURL=agents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/routes/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/routes/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EACL,KAAK,uBAAuB,EAI7B,MAAM,qBAAqB,CAAC;AAS7B,KAAK,YAAY,GAAG;IAClB,gBAAgB,EAAE,uBAAuB,CAAC;CAC3C,CAAC;AAEF,QAAA,MAAM,GAAG;eAAgC,YAAY;WAAK,CAAC;AAqM3D,eAAe,GAAG,CAAC"}
|
package/dist/routes/agents.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { a2aHandler } from '../a2a/handlers.js';
|
|
4
2
|
import { getAgentGraphWithDefaultAgent, getRequestExecutionContext, HeadersScopeSchema, } from '@inkeep/agents-core';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { a2aHandler } from '../a2a/handlers';
|
|
5
|
+
import { getRegisteredGraph } from '../data/agentGraph';
|
|
6
|
+
import { getRegisteredAgent } from '../data/agents';
|
|
7
|
+
import dbClient from '../data/db/dbClient';
|
|
8
|
+
import { getLogger } from '../logger';
|
|
9
9
|
const app = new OpenAPIHono();
|
|
10
10
|
const logger = getLogger('agents');
|
|
11
11
|
// A2A Agent Card Discovery (REST with OpenAPI)
|
|
@@ -61,7 +61,8 @@ app.openapi(createRoute({
|
|
|
61
61
|
graphId,
|
|
62
62
|
agentId,
|
|
63
63
|
}, 'agent-level well-known agent.json');
|
|
64
|
-
const
|
|
64
|
+
const credentialStores = c.get('credentialStores');
|
|
65
|
+
const agent = await getRegisteredAgent(executionContext, credentialStores);
|
|
65
66
|
logger.info({ agent }, 'agent registered: well-known agent.json');
|
|
66
67
|
if (!agent) {
|
|
67
68
|
return c.json({ error: 'Agent not found' }, 404);
|
|
@@ -108,7 +109,8 @@ app.post('/a2a', async (c) => {
|
|
|
108
109
|
agentId,
|
|
109
110
|
}, 'agent-level a2a endpoint');
|
|
110
111
|
// Ensure agent is registered (lazy loading)
|
|
111
|
-
const
|
|
112
|
+
const credentialStores = c.get('credentialStores');
|
|
113
|
+
const agent = await getRegisteredAgent(executionContext, credentialStores);
|
|
112
114
|
if (!agent) {
|
|
113
115
|
return c.json({
|
|
114
116
|
jsonrpc: '2.0',
|
|
@@ -140,7 +142,8 @@ app.post('/a2a', async (c) => {
|
|
|
140
142
|
}
|
|
141
143
|
executionContext.agentId = graph.defaultAgentId;
|
|
142
144
|
// fetch the default agent and use it as entry point for the graph
|
|
143
|
-
const
|
|
145
|
+
const credentialStores = c.get('credentialStores');
|
|
146
|
+
const defaultAgent = await getRegisteredAgent(executionContext, credentialStores);
|
|
144
147
|
if (!defaultAgent) {
|
|
145
148
|
return c.json({
|
|
146
149
|
jsonrpc: '2.0',
|
package/dist/routes/chat.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
-
|
|
2
|
+
import { CredentialStoreRegistry } from '@inkeep/agents-core';
|
|
3
|
+
type AppVariables = {
|
|
4
|
+
credentialStores: CredentialStoreRegistry;
|
|
5
|
+
};
|
|
6
|
+
declare const app: OpenAPIHono<{
|
|
7
|
+
Variables: AppVariables;
|
|
8
|
+
}, {}, "/">;
|
|
3
9
|
export default app;
|
|
4
10
|
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/routes/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/routes/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAIL,uBAAuB,EAQxB,MAAM,qBAAqB,CAAC;AAY7B,KAAK,YAAY,GAAG;IAClB,gBAAgB,EAAE,uBAAuB,CAAC;CAC3C,CAAC;AAEF,QAAA,MAAM,GAAG;eAAgC,YAAY;WAAK,CAAC;AA2W3D,eAAe,GAAG,CAAC"}
|
package/dist/routes/chat.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
+
import { contextValidationMiddleware, createMessage, createOrGetConversation, getActiveAgentForConversation, getAgentById, getAgentGraphWithDefaultAgent, getFullGraph, getRequestExecutionContext, handleContextResolution, setActiveAgentForConversation, } from '@inkeep/agents-core';
|
|
2
3
|
// import { Hono } from 'hono';
|
|
3
4
|
import { trace } from '@opentelemetry/api';
|
|
4
5
|
import { streamSSE } from 'hono/streaming';
|
|
5
6
|
import { nanoid } from 'nanoid';
|
|
6
7
|
import { z } from 'zod';
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { contextValidationMiddleware } from '@inkeep/agents-core';
|
|
12
|
-
import { createSSEStreamHelper } from '../utils/stream-helpers.js';
|
|
13
|
-
import dbClient from '../data/db/dbClient.js';
|
|
8
|
+
import dbClient from '../data/db/dbClient';
|
|
9
|
+
import { ExecutionHandler } from '../handlers/executionHandler';
|
|
10
|
+
import { getLogger } from '../logger';
|
|
11
|
+
import { createSSEStreamHelper } from '../utils/stream-helpers';
|
|
14
12
|
const app = new OpenAPIHono();
|
|
15
13
|
const logger = getLogger('completionsHandler');
|
|
16
14
|
// Define the OpenAPI route schema
|
|
@@ -211,8 +209,9 @@ app.openapi(chatCompletionsRoute, async (c) => {
|
|
|
211
209
|
}
|
|
212
210
|
// Get validated context from middleware (falls back to body.context if no validation)
|
|
213
211
|
const validatedContext = c.get('validatedContext') || body.requestContext || {};
|
|
212
|
+
const credentialStores = c.get('credentialStores');
|
|
214
213
|
// Context resolution with intelligent conversation state detection
|
|
215
|
-
await handleContextResolution(tenantId, projectId, conversationId, graphId, validatedContext, dbClient);
|
|
214
|
+
await handleContextResolution(tenantId, projectId, conversationId, graphId, validatedContext, dbClient, credentialStores);
|
|
216
215
|
logger.info({
|
|
217
216
|
tenantId,
|
|
218
217
|
graphId,
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
-
|
|
2
|
+
import { CredentialStoreRegistry } from '@inkeep/agents-core';
|
|
3
|
+
type AppVariables = {
|
|
4
|
+
credentialStores: CredentialStoreRegistry;
|
|
5
|
+
};
|
|
6
|
+
declare const app: OpenAPIHono<{
|
|
7
|
+
Variables: AppVariables;
|
|
8
|
+
}, {}, "/">;
|
|
3
9
|
export default app;
|
|
4
10
|
//# sourceMappingURL=chatDataStream.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatDataStream.d.ts","sourceRoot":"","sources":["../../src/routes/chatDataStream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAK,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"chatDataStream.d.ts","sourceRoot":"","sources":["../../src/routes/chatDataStream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAK,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAIL,uBAAuB,EAOxB,MAAM,qBAAqB,CAAC;AAU7B,KAAK,YAAY,GAAG;IAClB,gBAAgB,EAAE,uBAAuB,CAAC;CAC3C,CAAC;AAEF,QAAA,MAAM,GAAG;eAAgC,YAAY;WAAK,CAAC;AAuM3D,eAAe,GAAG,CAAC"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { createRoute, OpenAPIHono, z } from '@hono/zod-openapi';
|
|
2
|
+
import { commonGetErrorResponses, contextValidationMiddleware, createMessage, getActiveAgentForConversation, getAgentById, getAgentGraphWithDefaultAgent, getRequestExecutionContext, handleContextResolution, setActiveAgentForConversation, } from '@inkeep/agents-core';
|
|
2
3
|
import { trace } from '@opentelemetry/api';
|
|
3
4
|
import { createUIMessageStream, JsonToSseTransformStream } from 'ai';
|
|
4
5
|
import { stream } from 'hono/streaming';
|
|
5
6
|
import { nanoid } from 'nanoid';
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { createVercelStreamHelper } from '../utils/stream-helpers.js';
|
|
11
|
-
import dbClient from '../data/db/dbClient.js';
|
|
7
|
+
import dbClient from '../data/db/dbClient';
|
|
8
|
+
import { ExecutionHandler } from '../handlers/executionHandler';
|
|
9
|
+
import { getLogger } from '../logger';
|
|
10
|
+
import { createVercelStreamHelper } from '../utils/stream-helpers';
|
|
12
11
|
const app = new OpenAPIHono();
|
|
13
12
|
const logger = getLogger('chatDataStream');
|
|
14
13
|
const chatDataStreamRoute = createRoute({
|
|
@@ -108,8 +107,9 @@ app.openapi(chatDataStreamRoute, async (c) => {
|
|
|
108
107
|
}
|
|
109
108
|
// Get validated context from middleware (falls back to body.context if no validation)
|
|
110
109
|
const validatedContext = c.get('validatedContext') || body.requestContext || {};
|
|
110
|
+
const credentialStores = c.get('credentialStores');
|
|
111
111
|
// Context resolution with intelligent conversation state detection
|
|
112
|
-
await handleContextResolution(tenantId, projectId, conversationId, graphId, validatedContext, dbClient);
|
|
112
|
+
await handleContextResolution(tenantId, projectId, conversationId, graphId, validatedContext, dbClient, credentialStores);
|
|
113
113
|
// Store last user message
|
|
114
114
|
const lastUserMessage = body.messages.filter((m) => m.role === 'user').slice(-1)[0];
|
|
115
115
|
const userText = typeof lastUserMessage?.content === 'string'
|
package/dist/routes/mcp.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
-
|
|
2
|
+
import { CredentialStoreRegistry } from '@inkeep/agents-core';
|
|
3
|
+
type AppVariables = {
|
|
4
|
+
credentialStores: CredentialStoreRegistry;
|
|
5
|
+
};
|
|
6
|
+
declare const app: OpenAPIHono<{
|
|
7
|
+
Variables: AppVariables;
|
|
8
|
+
}, {}, "/">;
|
|
3
9
|
export default app;
|
|
4
10
|
//# sourceMappingURL=mcp.d.ts.map
|
package/dist/routes/mcp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/routes/mcp.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/routes/mcp.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAa7D,OAAO,EACL,uBAAuB,EASxB,MAAM,qBAAqB,CAAC;AAgX7B,KAAK,YAAY,GAAG;IAClB,gBAAgB,EAAE,uBAAuB,CAAC;CAC3C,CAAC;AAEF,QAAA,MAAM,GAAG;eAAgC,YAAY;WAAK,CAAC;AA6T3D,eAAe,GAAG,CAAC"}
|
package/dist/routes/mcp.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
+
import { contextValidationMiddleware, HeadersScopeSchema } from '@inkeep/agents-core';
|
|
2
3
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
4
|
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
4
5
|
import { z } from 'zod/v3';
|
|
5
|
-
import { contextValidationMiddleware, HeadersScopeSchema } from '@inkeep/agents-core';
|
|
6
6
|
// Type bridge for MCP SDK compatibility with Zod v4
|
|
7
7
|
function createMCPSchema(schema) {
|
|
8
8
|
return schema;
|
|
9
9
|
}
|
|
10
|
+
import { createMessage, createOrGetConversation, getAgentById, getAgentGraphWithDefaultAgent, getConversation, getRequestExecutionContext, handleContextResolution, updateConversation, } from '@inkeep/agents-core';
|
|
10
11
|
import { trace } from '@opentelemetry/api';
|
|
11
12
|
import { toFetchResponse, toReqRes } from 'fetch-to-node';
|
|
12
13
|
import { nanoid } from 'nanoid';
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { createMCPStreamHelper } from '../utils/stream-helpers.js';
|
|
18
|
-
import dbClient from '../data/db/dbClient.js';
|
|
14
|
+
import dbClient from '../data/db/dbClient';
|
|
15
|
+
import { ExecutionHandler } from '../handlers/executionHandler';
|
|
16
|
+
import { getLogger } from '../logger';
|
|
17
|
+
import { createMCPStreamHelper } from '../utils/stream-helpers';
|
|
19
18
|
const logger = getLogger('mcp');
|
|
20
19
|
/**
|
|
21
20
|
* Singleton mock response object for spoof initialization
|
|
@@ -221,7 +220,7 @@ const executeAgentQuery = async (executionContext, conversationId, query, defaul
|
|
|
221
220
|
/**
|
|
222
221
|
* Creates and configures an MCP server for the given context
|
|
223
222
|
*/
|
|
224
|
-
const getServer = async (requestContext, executionContext, conversationId) => {
|
|
223
|
+
const getServer = async (requestContext, executionContext, conversationId, credentialStores) => {
|
|
225
224
|
const { tenantId, projectId, graphId } = executionContext;
|
|
226
225
|
setupTracing(conversationId, tenantId, graphId);
|
|
227
226
|
const agentGraph = await getAgentGraphWithDefaultAgent(dbClient)({
|
|
@@ -256,7 +255,7 @@ const getServer = async (requestContext, executionContext, conversationId) => {
|
|
|
256
255
|
isError: true,
|
|
257
256
|
};
|
|
258
257
|
}
|
|
259
|
-
const resolvedContext = await handleContextResolution(tenantId, projectId, conversationId, graphId, requestContext, dbClient);
|
|
258
|
+
const resolvedContext = await handleContextResolution(tenantId, projectId, conversationId, graphId, requestContext, dbClient, credentialStores);
|
|
260
259
|
logger.info({
|
|
261
260
|
tenantId,
|
|
262
261
|
graphId,
|
|
@@ -315,7 +314,7 @@ const validateRequestParameters = (c) => {
|
|
|
315
314
|
/**
|
|
316
315
|
* Creates a new MCP session and handles initialization
|
|
317
316
|
*/
|
|
318
|
-
const handleInitializationRequest = async (body, executionContext, validatedContext, req, res, c) => {
|
|
317
|
+
const handleInitializationRequest = async (body, executionContext, validatedContext, req, res, c, credentialStores) => {
|
|
319
318
|
const { tenantId, projectId, graphId } = executionContext;
|
|
320
319
|
logger.info({ body }, 'Received initialization request');
|
|
321
320
|
const sessionId = nanoid();
|
|
@@ -351,7 +350,7 @@ const handleInitializationRequest = async (body, executionContext, validatedCont
|
|
|
351
350
|
const transport = new StreamableHTTPServerTransport({
|
|
352
351
|
sessionIdGenerator: () => sessionId,
|
|
353
352
|
});
|
|
354
|
-
const server = await getServer(validatedContext, executionContext, sessionId);
|
|
353
|
+
const server = await getServer(validatedContext, executionContext, sessionId, credentialStores);
|
|
355
354
|
await server.connect(transport);
|
|
356
355
|
logger.info({ sessionId }, 'Server connected for initialization');
|
|
357
356
|
// Tell client the session ID
|
|
@@ -368,7 +367,7 @@ const handleInitializationRequest = async (body, executionContext, validatedCont
|
|
|
368
367
|
/**
|
|
369
368
|
* Handles requests for existing MCP sessions
|
|
370
369
|
*/
|
|
371
|
-
const handleExistingSessionRequest = async (body, executionContext, validatedContext, req, res) => {
|
|
370
|
+
const handleExistingSessionRequest = async (body, executionContext, validatedContext, req, res, credentialStores) => {
|
|
372
371
|
const { tenantId, projectId, graphId } = executionContext;
|
|
373
372
|
// Validate the session id
|
|
374
373
|
const conversation = await validateSession(req, res, body, tenantId, projectId, graphId);
|
|
@@ -388,7 +387,7 @@ const handleExistingSessionRequest = async (body, executionContext, validatedCon
|
|
|
388
387
|
const transport = new StreamableHTTPServerTransport({
|
|
389
388
|
sessionIdGenerator: () => sessionId,
|
|
390
389
|
});
|
|
391
|
-
const server = await getServer(validatedContext, executionContext, sessionId);
|
|
390
|
+
const server = await getServer(validatedContext, executionContext, sessionId, credentialStores);
|
|
392
391
|
await server.connect(transport);
|
|
393
392
|
// Spoof initialization to set the transport's _initialized flag
|
|
394
393
|
await spoofTransportInitialization(transport, req, sessionId, conversation.metadata?.session_data?.mcpProtocolVersion);
|
|
@@ -460,13 +459,14 @@ app.openapi(createRoute({
|
|
|
460
459
|
const isInitRequest = body.method === 'initialize';
|
|
461
460
|
const { req, res } = toReqRes(c.req.raw);
|
|
462
461
|
const validatedContext = c.get('validatedContext') || {};
|
|
462
|
+
const credentialStores = c.get('credentialStores');
|
|
463
463
|
logger.info({ validatedContext }, 'Validated context');
|
|
464
464
|
logger.info({ req }, 'request');
|
|
465
465
|
if (isInitRequest) {
|
|
466
|
-
return await handleInitializationRequest(body, executionContext, validatedContext, req, res, c);
|
|
466
|
+
return await handleInitializationRequest(body, executionContext, validatedContext, req, res, c, credentialStores);
|
|
467
467
|
}
|
|
468
468
|
else {
|
|
469
|
-
return await handleExistingSessionRequest(body, executionContext, validatedContext, req, res);
|
|
469
|
+
return await handleExistingSessionRequest(body, executionContext, validatedContext, req, res, credentialStores);
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
472
|
catch (e) {
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAM9B,OAAO,EAAE,oBAAoB,EAAsB,MAAM,2BAA2B,CAAC;AAsBrF,QAAA,MAAM,eAAe,sBAQnB,CAAC;AAmCH,OAAO,EAAE,eAAe,EAAE,CAAC"}
|