@inkeep/agents-run-api 0.1.1 → 0.1.2
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/dist/AgentExecutionServer.d.ts +6 -1
- package/dist/AgentExecutionServer.d.ts.map +1 -1
- package/dist/AgentExecutionServer.js +10 -1
- package/dist/__tests__/utils/testRequest.js +1 -1
- package/dist/agents/Agent.d.ts +3 -3
- package/dist/agents/Agent.d.ts.map +1 -1
- package/dist/agents/Agent.js +9 -7
- package/dist/agents/generateTaskHandler.d.ts +2 -2
- package/dist/agents/generateTaskHandler.d.ts.map +1 -1
- package/dist/agents/generateTaskHandler.js +2 -2
- package/dist/agents/relationTools.d.ts +3 -1
- package/dist/agents/relationTools.d.ts.map +1 -1
- package/dist/agents/relationTools.js +4 -5
- package/dist/app.d.ts +11 -3
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +177 -169
- package/dist/data/agents.d.ts +2 -2
- package/dist/data/agents.d.ts.map +1 -1
- package/dist/data/agents.js +4 -4
- 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.map +1 -1
- package/dist/handlers/executionHandler.js +2 -5
- package/dist/index.d.ts +21 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -36
- package/dist/routes/agents.d.ts +7 -1
- package/dist/routes/agents.d.ts.map +1 -1
- package/dist/routes/agents.js +6 -3
- 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 +9 -0
- 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/graph-session.d.ts.map +1 -1
- package/dist/utils/graph-session.js +7 -4
- package/dist/utils/stream-helpers.d.ts +12 -0
- package/dist/utils/stream-helpers.d.ts.map +1 -1
- package/dist/utils/stream-helpers.js +111 -30
- package/package.json +13 -8
package/LICENSE.md
CHANGED
|
@@ -1,44 +1,49 @@
|
|
|
1
|
-
Elastic License
|
|
2
|
-
|
|
1
|
+
# Inkeep SDK – Elastic License 2.0 with Supplemental Terms
|
|
2
|
+
|
|
3
|
+
NOTE: The Inkeep SDK is licensed under the Elastic License 2.0 (ELv2), subject to Supplemental Terms included in [SUPPLEMENTAL_TERMS.md](SUPPLEMENTAL_TERMS.md). In the event of conflict, the Supplemental Terms control.
|
|
4
|
+
|
|
5
|
+
# Elastic License 2.0
|
|
6
|
+
|
|
7
|
+
## Acceptance
|
|
3
8
|
By using the software, you agree to all of the terms and conditions below.
|
|
4
9
|
|
|
5
|
-
Copyright License
|
|
10
|
+
## Copyright License
|
|
6
11
|
The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below.
|
|
7
12
|
|
|
8
|
-
Limitations
|
|
13
|
+
## Limitations
|
|
9
14
|
You may not provide the software to third parties as a hosted or managed service, where the service provides users with access to any substantial set of the features or functionality of the software.
|
|
10
15
|
|
|
11
16
|
You may not move, change, disable, or circumvent the license key functionality in the software, and you may not remove or obscure any functionality in the software that is protected by the license key.
|
|
12
17
|
|
|
13
18
|
You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
|
|
14
19
|
|
|
15
|
-
Patents
|
|
20
|
+
## Patents
|
|
16
21
|
The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
17
22
|
|
|
18
|
-
Notices
|
|
23
|
+
## Notices
|
|
19
24
|
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
|
|
20
25
|
|
|
21
26
|
If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
|
|
22
27
|
|
|
23
|
-
No Other Rights
|
|
28
|
+
## No Other Rights
|
|
24
29
|
These terms do not imply any licenses other than those expressly granted in these terms.
|
|
25
30
|
|
|
26
|
-
Termination
|
|
31
|
+
## Termination
|
|
27
32
|
If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
|
|
28
33
|
|
|
29
|
-
No Liability
|
|
30
|
-
As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim
|
|
34
|
+
## No Liability
|
|
35
|
+
***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
|
|
31
36
|
|
|
32
|
-
Definitions
|
|
33
|
-
The licensor is the entity offering these terms, and the software is the software the licensor makes available under these terms, including any portion of it.
|
|
37
|
+
## Definitions
|
|
38
|
+
The **licensor** is the entity offering these terms, and the **software** is the software the licensor makes available under these terms, including any portion of it.
|
|
34
39
|
|
|
35
|
-
you refers to the individual or entity agreeing to these terms.
|
|
40
|
+
**you** refers to the individual or entity agreeing to these terms.
|
|
36
41
|
|
|
37
|
-
your company is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. control means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
42
|
+
**your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
38
43
|
|
|
39
|
-
your licenses are all the licenses granted to you for the software under these terms.
|
|
44
|
+
**your licenses** are all the licenses granted to you for the software under these terms.
|
|
40
45
|
|
|
41
|
-
use means anything you do with the software requiring one of your licenses.
|
|
46
|
+
**use** means anything you do with the software requiring one of your licenses.
|
|
42
47
|
|
|
43
|
-
trademark means trademarks, service marks, and similar rights.
|
|
48
|
+
**trademark** means trademarks, service marks, and similar rights.
|
|
44
49
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type AgentFrameworkServerConfig, BaseServer } from '@inkeep/agents-core';
|
|
2
2
|
export declare const EXECUTION_API_PORT = 3003;
|
|
3
3
|
/**
|
|
4
4
|
* Execution Server for chat, agent-to-agent communication, and MCP endpoints
|
|
@@ -19,5 +19,10 @@ export declare class AgentExecutionServer extends BaseServer {
|
|
|
19
19
|
keepAlive: boolean;
|
|
20
20
|
requestTimeout: number;
|
|
21
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* Public method to initialize the server without starting HTTP listener
|
|
24
|
+
* Useful for Vite dev mode where we need credential stores but Vite handles HTTP
|
|
25
|
+
*/
|
|
26
|
+
initializeOnly(): Promise<void>;
|
|
22
27
|
}
|
|
23
28
|
//# sourceMappingURL=AgentExecutionServer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentExecutionServer.d.ts","sourceRoot":"","sources":["../src/AgentExecutionServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"AgentExecutionServer.d.ts","sourceRoot":"","sources":["../src/AgentExecutionServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAIlF,eAAO,MAAM,kBAAkB,OAAO,CAAC;AACvC;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,UAAU;gBACtC,MAAM,GAAE,0BAA+B;IAInD;;OAEG;cACa,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAK3C;;OAEG;IACH,SAAS,CAAC,gBAAgB;;;;;;IAU1B;;;OAGG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CAKtC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseServer } from '@inkeep/agents-core';
|
|
2
|
-
import { getLogger } from './logger.js';
|
|
3
2
|
import app from './app.js';
|
|
3
|
+
import { getLogger } from './logger.js';
|
|
4
4
|
export const EXECUTION_API_PORT = 3003;
|
|
5
5
|
/**
|
|
6
6
|
* Execution Server for chat, agent-to-agent communication, and MCP endpoints
|
|
@@ -29,4 +29,13 @@ export class AgentExecutionServer extends BaseServer {
|
|
|
29
29
|
...this.config.serverOptions,
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Public method to initialize the server without starting HTTP listener
|
|
34
|
+
* Useful for Vite dev mode where we need credential stores but Vite handles HTTP
|
|
35
|
+
*/
|
|
36
|
+
async initializeOnly() {
|
|
37
|
+
if (!this.app) {
|
|
38
|
+
await this.initialize();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
32
41
|
}
|
package/dist/agents/Agent.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type ToolSet } from 'ai';
|
|
2
|
-
import type
|
|
3
|
-
import { type Artifact, type DataComponentApiInsert, type McpTool, type AgentConversationHistoryConfig, type ArtifactComponentApiInsert, type Models } from '@inkeep/agents-core';
|
|
2
|
+
import { CredentialStoreRegistry, type Artifact, type DataComponentApiInsert, type McpTool, type AgentConversationHistoryConfig, type ArtifactComponentApiInsert, type Models } from '@inkeep/agents-core';
|
|
4
3
|
import type { StreamHelper } from '../utils/stream-helpers.js';
|
|
5
4
|
/**
|
|
6
5
|
* Creates a stopWhen condition that stops when any tool call name starts with the given prefix
|
|
@@ -66,7 +65,8 @@ export declare class Agent {
|
|
|
66
65
|
private artifactComponents;
|
|
67
66
|
private isDelegatedAgent;
|
|
68
67
|
private contextResolver?;
|
|
69
|
-
|
|
68
|
+
private credentialStoreRegistry?;
|
|
69
|
+
constructor(config: AgentConfig, credentialStoreRegistry?: CredentialStoreRegistry);
|
|
70
70
|
/**
|
|
71
71
|
* Get the maximum number of generation steps for this agent
|
|
72
72
|
* Uses agent's stopWhen.stepCountIs config or defaults to CONSTANTS.MAX_GENERATION_STEPS
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../../src/agents/Agent.ts"],"names":[],"mappings":"AACA,OAAO,EAA4C,KAAK,OAAO,EAAQ,MAAM,IAAI,CAAC;AAElF,OAAO,
|
|
1
|
+
{"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../../src/agents/Agent.ts"],"names":[],"mappings":"AACA,OAAO,EAA4C,KAAK,OAAO,EAAQ,MAAM,IAAI,CAAC;AAElF,OAAO,EAWL,uBAAuB,EAEvB,KAAK,QAAQ,EACb,KAAK,sBAAsB,EAC3B,KAAK,OAAO,EAEZ,KAAK,8BAA8B,EACnC,KAAK,0BAA0B,EAE/B,KAAK,MAAM,EAEZ,MAAM,qBAAqB,CAAC;AAe7B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAU/D;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,IAC1C,WAAW;IAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;CAAE,SAOzC;AAuBD,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,W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AAe,CAAC,EAAE,MAAM;IA+D9D;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAaxB,UAAU,CAAC,IAAI,EAAE,OAAO;IA0E9B,gBAAgB,CAAC,eAAe,CAAC,EAAE,MAAM;IAwBzC;;OAEG;IACG,kBAAkB,CACtB,cAAc,EAAE,MAAM,EACtB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IA8D1C;;OAEG;YACW,cAAc;IAuB5B;;OAEG;YACW,0BAA0B;IAkCxC;;;OAGG;YACW,uBAAuB;YAoCvB,iBAAiB;IAwH/B,OAAO,CAAC,gBAAgB;IAyBxB,OAAO,CAAC,0BAA0B;YAYpB,eAAe;YAsCf,0BAA0B;IAkBlC,QAAQ,CACZ,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE;YACR,cAAc,EAAE,MAAM,CAAC;YACvB,QAAQ,EAAE,MAAM,CAAC;YACjB,MAAM,EAAE,MAAM,CAAC;YACf,eAAe,EAAE,MAAM,CAAC;SACzB,CAAC;KACH;CA+dJ"}
|
package/dist/agents/Agent.js
CHANGED
|
@@ -4,7 +4,6 @@ import { z } from 'zod';
|
|
|
4
4
|
import { getContextConfigById, getLedgerArtifacts, getCredentialReference, listTaskIdsByContextId, getFullGraphDefinition, graphHasArtifactComponents, ContextResolver, TemplateEngine, McpClient, CredentialStuffer, } from '@inkeep/agents-core';
|
|
5
5
|
import { createDefaultConversationHistoryConfig, getFormattedConversationHistory, } from '../data/conversations.js';
|
|
6
6
|
import dbClient from '../data/db/dbClient.js';
|
|
7
|
-
import { executionServer } from '../index.js';
|
|
8
7
|
import { getLogger } from '../logger.js';
|
|
9
8
|
import { createSpanName, getGlobalTracer, handleSpanError, forceFlushTracer } from '../tracer.js';
|
|
10
9
|
import { generateToolId } from '../utils/agent-operations.js';
|
|
@@ -62,7 +61,8 @@ export class Agent {
|
|
|
62
61
|
artifactComponents = [];
|
|
63
62
|
isDelegatedAgent = false;
|
|
64
63
|
contextResolver;
|
|
65
|
-
|
|
64
|
+
credentialStoreRegistry;
|
|
65
|
+
constructor(config, credentialStoreRegistry) {
|
|
66
66
|
// Store artifact components separately
|
|
67
67
|
this.artifactComponents = config.artifactComponents || [];
|
|
68
68
|
// Process dataComponents (now only component-type)
|
|
@@ -83,11 +83,12 @@ export class Agent {
|
|
|
83
83
|
conversationHistoryConfig: config.conversationHistoryConfig || createDefaultConversationHistoryConfig(),
|
|
84
84
|
};
|
|
85
85
|
this.responseFormatter = new ResponseFormatter(config.tenantId);
|
|
86
|
-
//
|
|
87
|
-
|
|
88
|
-
if
|
|
89
|
-
|
|
90
|
-
this.
|
|
86
|
+
// Store the credential store registry
|
|
87
|
+
this.credentialStoreRegistry = credentialStoreRegistry;
|
|
88
|
+
// Use provided credential store registry if available
|
|
89
|
+
if (credentialStoreRegistry) {
|
|
90
|
+
this.contextResolver = new ContextResolver(config.tenantId, config.projectId, dbClient, credentialStoreRegistry);
|
|
91
|
+
this.credentialStuffer = new CredentialStuffer(credentialStoreRegistry, this.contextResolver);
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
94
|
/**
|
|
@@ -271,6 +272,7 @@ export class Agent {
|
|
|
271
272
|
},
|
|
272
273
|
sessionId,
|
|
273
274
|
agent: this,
|
|
275
|
+
credentialStoreRegistry: this.credentialStoreRegistry,
|
|
274
276
|
}), runtimeContext?.metadata?.streamRequestId, 'delegation'),
|
|
275
277
|
];
|
|
276
278
|
}),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { A2ATask, A2ATaskResult } from '../a2a/types.js';
|
|
2
|
-
import { type AgentApiSelect, type AgentConversationHistoryConfig } from '@inkeep/agents-core';
|
|
2
|
+
import { type AgentApiSelect, type AgentConversationHistoryConfig, CredentialStoreRegistry } from '@inkeep/agents-core';
|
|
3
3
|
/** Turn any string value that is valid JSON into an object/array (in place). */
|
|
4
4
|
export declare function parseEmbeddedJson<T>(data: T): T;
|
|
5
5
|
/**
|
|
@@ -18,7 +18,7 @@ export interface TaskHandlerConfig {
|
|
|
18
18
|
contextConfigId?: string;
|
|
19
19
|
conversationHistoryConfig?: AgentConversationHistoryConfig;
|
|
20
20
|
}
|
|
21
|
-
export declare const createTaskHandler: (config: TaskHandlerConfig) => (task: A2ATask) => Promise<A2ATaskResult>;
|
|
21
|
+
export declare const createTaskHandler: (config: TaskHandlerConfig, credentialStoreRegistry?: CredentialStoreRegistry) => (task: A2ATask) => Promise<A2ATaskResult>;
|
|
22
22
|
/**
|
|
23
23
|
* Serializes a TaskHandlerConfig to JSON
|
|
24
24
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateTaskHandler.d.ts","sourceRoot":"","sources":["../../src/agents/generateTaskHandler.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,8BAA8B,
|
|
1
|
+
{"version":3,"file":"generateTaskHandler.d.ts","sourceRoot":"","sources":["../../src/agents/generateTaskHandler.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,8BAA8B,EAQnC,uBAAuB,EACxB,MAAM,qBAAqB,CAAC;AAM7B,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAS/C;AAID;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,cAAc,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,yBAAyB,CAAC,EAAE,8BAA8B,CAAC;CAC5D;AAED,eAAO,MAAM,iBAAiB,GAAI,QAAQ,iBAAiB,EAAE,0BAA0B,uBAAuB,MAC9F,MAAM,OAAO,KAAG,OAAO,CAAC,aAAa,CAgUpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,GAAI,QAAQ,iBAAiB,KAAG,MAEtE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,GAAI,YAAY,MAAM,KAAG,iBAEjE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAAU,QAAQ;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,KAAG,OAAO,CAAC,iBAAiB,CAgD5B,CAAC"}
|
|
@@ -17,7 +17,7 @@ export function parseEmbeddedJson(data) {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
const logger = getLogger('generateTaskHandler');
|
|
20
|
-
export const createTaskHandler = (config) => {
|
|
20
|
+
export const createTaskHandler = (config, credentialStoreRegistry) => {
|
|
21
21
|
return async (task) => {
|
|
22
22
|
try {
|
|
23
23
|
// Extract the user message from the task
|
|
@@ -162,7 +162,7 @@ export const createTaskHandler = (config) => {
|
|
|
162
162
|
artifactComponents: artifactComponents,
|
|
163
163
|
contextConfigId: config.contextConfigId || undefined,
|
|
164
164
|
conversationHistoryConfig: config.conversationHistoryConfig,
|
|
165
|
-
});
|
|
165
|
+
}, credentialStoreRegistry);
|
|
166
166
|
// More robust contextId resolution for delegation scenarios
|
|
167
167
|
let contextId = task.context?.conversationId;
|
|
168
168
|
// If contextId is not set in task.context, try to extract it from the task.id
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CredentialStoreRegistry } from '@inkeep/agents-core';
|
|
1
2
|
import type { AgentConfig, DelegateRelation } from './Agent.js';
|
|
2
3
|
export declare const createTransferToAgentTool: ({ transferConfig, callingAgentId, agent, streamRequestId, }: {
|
|
3
4
|
transferConfig: AgentConfig;
|
|
@@ -9,7 +10,7 @@ export declare const createTransferToAgentTool: ({ transferConfig, callingAgentI
|
|
|
9
10
|
target: string;
|
|
10
11
|
fromAgentId: string;
|
|
11
12
|
}>;
|
|
12
|
-
export declare function createDelegateToAgentTool({ delegateConfig, callingAgentId, tenantId, projectId, graphId, contextId, metadata, sessionId, agent, }: {
|
|
13
|
+
export declare function createDelegateToAgentTool({ delegateConfig, callingAgentId, tenantId, projectId, graphId, contextId, metadata, sessionId, agent, credentialStoreRegistry, }: {
|
|
13
14
|
delegateConfig: DelegateRelation;
|
|
14
15
|
callingAgentId: string;
|
|
15
16
|
tenantId: string;
|
|
@@ -24,6 +25,7 @@ export declare function createDelegateToAgentTool({ delegateConfig, callingAgent
|
|
|
24
25
|
};
|
|
25
26
|
sessionId?: string;
|
|
26
27
|
agent: any;
|
|
28
|
+
credentialStoreRegistry?: CredentialStoreRegistry;
|
|
27
29
|
}): import("ai").Tool<{
|
|
28
30
|
message: string;
|
|
29
31
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relationTools.d.ts","sourceRoot":"","sources":["../../src/agents/relationTools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"relationTools.d.ts","sourceRoot":"","sources":["../../src/agents/relationTools.ts"],"names":[],"mappings":"AAKA,OAAO,EAOL,uBAAuB,EACxB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AA2BhE,eAAO,MAAM,yBAAyB,GAAI,6DAKvC;IACD,cAAc,EAAE,WAAW,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,GAAG,CAAC;IACX,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;;;;EAsCA,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,EACxC,cAAc,EACd,cAAc,EACd,QAAQ,EACR,SAAS,EACT,OAAO,EACP,SAAS,EACT,QAAQ,EACR,SAAS,EACT,KAAK,EACL,uBAAuB,GACxB,EAAE;IACD,cAAc,EAAE,gBAAgB,CAAC;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE;QACR,cAAc,EAAE,MAAM,CAAC;QACvB,QAAQ,EAAE,MAAM,CAAC;QACjB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,GAAG,CAAC;IACX,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;CACnD;;;;;GAkNA"}
|
|
@@ -6,7 +6,6 @@ import { A2AClient } from '../a2a/client.js';
|
|
|
6
6
|
import { createMessage, getCredentialReference, getExternalAgent, CredentialStuffer, ContextResolver, } from '@inkeep/agents-core';
|
|
7
7
|
import { saveA2AMessageResponse } from '../data/conversations.js';
|
|
8
8
|
import dbClient from '../data/db/dbClient.js';
|
|
9
|
-
import { executionServer } from '../index.js';
|
|
10
9
|
import { getLogger } from '../logger.js';
|
|
11
10
|
import { graphSessionManager } from '../utils/graph-session.js';
|
|
12
11
|
import { toolSessionManager } from './ToolSessionManager.js';
|
|
@@ -64,7 +63,7 @@ export const createTransferToAgentTool = ({ transferConfig, callingAgentId, agen
|
|
|
64
63
|
},
|
|
65
64
|
});
|
|
66
65
|
};
|
|
67
|
-
export function createDelegateToAgentTool({ delegateConfig, callingAgentId, tenantId, projectId, graphId, contextId, metadata, sessionId, agent, }) {
|
|
66
|
+
export function createDelegateToAgentTool({ delegateConfig, callingAgentId, tenantId, projectId, graphId, contextId, metadata, sessionId, agent, credentialStoreRegistry, }) {
|
|
68
67
|
return tool({
|
|
69
68
|
description: generateDelegateToolDescription(delegateConfig.config),
|
|
70
69
|
inputSchema: z.object({ message: z.string() }),
|
|
@@ -104,9 +103,9 @@ export function createDelegateToAgentTool({ delegateConfig, callingAgentId, tena
|
|
|
104
103
|
agentId: delegateConfig.config.id,
|
|
105
104
|
});
|
|
106
105
|
// If the external agent has a credential reference ID or headers, resolve them
|
|
107
|
-
if (externalAgent && (externalAgent.credentialReferenceId || externalAgent.headers)) {
|
|
108
|
-
const contextResolver = new ContextResolver(tenantId, projectId, dbClient,
|
|
109
|
-
const credentialStuffer = new CredentialStuffer(
|
|
106
|
+
if (externalAgent && (externalAgent.credentialReferenceId || externalAgent.headers) && credentialStoreRegistry) {
|
|
107
|
+
const contextResolver = new ContextResolver(tenantId, projectId, dbClient, credentialStoreRegistry);
|
|
108
|
+
const credentialStuffer = new CredentialStuffer(credentialStoreRegistry, contextResolver);
|
|
110
109
|
const credentialContext = {
|
|
111
110
|
tenantId,
|
|
112
111
|
projectId,
|
package/dist/app.d.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
+
import { type ExecutionContext, type ServerConfig, type CredentialStoreRegistry } from '@inkeep/agents-core';
|
|
3
|
+
type AppVariables = {
|
|
4
|
+
executionContext: ExecutionContext;
|
|
5
|
+
serverConfig: ServerConfig;
|
|
6
|
+
credentialStores: CredentialStoreRegistry;
|
|
7
|
+
};
|
|
8
|
+
declare function createExecutionHono(serverConfig: ServerConfig, credentialStores: CredentialStoreRegistry): OpenAPIHono<{
|
|
9
|
+
Variables: AppVariables;
|
|
10
|
+
}, {}, "/">;
|
|
11
|
+
export { createExecutionHono };
|
|
4
12
|
//# sourceMappingURL=app.d.ts.map
|
package/dist/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,uBAAuB,EAC7B,MAAM,qBAAqB,CAAC;AAgB7B,KAAK,YAAY,GAAG;IAClB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,YAAY,EAAE,YAAY,CAAC;IAC3B,gBAAgB,EAAE,uBAAuB,CAAC;CAC3C,CAAC;AAEF,iBAAS,mBAAmB,CAC1B,YAAY,EAAE,YAAY,EAC1B,gBAAgB,EAAE,uBAAuB;eAEA,YAAY;YA+NtD;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|