@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
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
|
|
package/README.md
CHANGED
|
@@ -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
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/__tests__/setup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/__tests__/setup.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAYlD,QAAA,MAAM,GAAG,SAgBP,CAAC;AA6BH,OAAO,EAAE,GAAG,EAAE,CAAC"}
|
package/dist/__tests__/setup.js
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
|
+
// Mock the local logger module globally - this will be hoisted automatically by Vitest
|
|
3
|
+
vi.mock('../logger.js', () => {
|
|
4
|
+
const mockLogger = {
|
|
5
|
+
info: vi.fn(),
|
|
6
|
+
warn: vi.fn(),
|
|
7
|
+
error: vi.fn(),
|
|
8
|
+
debug: vi.fn(),
|
|
9
|
+
child: vi.fn().mockReturnThis(),
|
|
10
|
+
};
|
|
11
|
+
return {
|
|
12
|
+
getLogger: vi.fn(() => mockLogger),
|
|
13
|
+
withRequestContext: vi.fn(async (id, fn) => await fn()),
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
// Also mock the agents-core logger since api-key-auth imports from there
|
|
17
|
+
vi.mock('@inkeep/agents-core', async (importOriginal) => {
|
|
18
|
+
const actual = await importOriginal();
|
|
19
|
+
const mockLogger = {
|
|
20
|
+
info: vi.fn(),
|
|
21
|
+
warn: vi.fn(),
|
|
22
|
+
error: vi.fn(),
|
|
23
|
+
debug: vi.fn(),
|
|
24
|
+
child: vi.fn().mockReturnThis(),
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
...actual,
|
|
28
|
+
getLogger: vi.fn(() => mockLogger),
|
|
29
|
+
};
|
|
30
|
+
});
|
|
1
31
|
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
|
|
2
32
|
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-proto';
|
|
3
33
|
import { ConsoleMetricExporter, PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics';
|
|
@@ -7,8 +37,8 @@ const { SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-base');
|
|
|
7
37
|
import { sql } from 'drizzle-orm';
|
|
8
38
|
import { migrate } from 'drizzle-orm/libsql/migrator';
|
|
9
39
|
import { afterAll, afterEach, beforeAll } from 'vitest';
|
|
10
|
-
import dbClient from '../data/db/dbClient
|
|
11
|
-
import { getLogger } from '
|
|
40
|
+
import dbClient from '../data/db/dbClient';
|
|
41
|
+
import { getLogger } from '../logger';
|
|
12
42
|
getLogger('Test Setup').debug({}, 'Setting up instrumentation');
|
|
13
43
|
const sdk = new NodeSDK({
|
|
14
44
|
serviceName: 'inkeep-execution-api',
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* ```typescript
|
|
12
|
-
* import { createTestTenantId } from './utils/testTenant
|
|
12
|
+
* import { createTestTenantId } from './utils/testTenant';
|
|
13
13
|
*
|
|
14
14
|
* describe('My test suite', () => {
|
|
15
15
|
* const tenantId = createTestTenantId('agents');
|
|
@@ -33,7 +33,7 @@ export declare function createTestTenantId(prefix?: string): string;
|
|
|
33
33
|
*
|
|
34
34
|
* @example
|
|
35
35
|
* ```typescript
|
|
36
|
-
* import { createTestTenantIds } from './utils/testTenant
|
|
36
|
+
* import { createTestTenantIds } from './utils/testTenant';
|
|
37
37
|
*
|
|
38
38
|
* describe('Multi-tenant test suite', () => {
|
|
39
39
|
* const [tenantA, tenantB] = createTestTenantIds(2, 'multi-tenant');
|
|
@@ -53,7 +53,7 @@ export declare function createTestTenantIds(count: number, prefix?: string): str
|
|
|
53
53
|
*
|
|
54
54
|
* @example
|
|
55
55
|
* ```typescript
|
|
56
|
-
* import { isTestTenant } from './utils/testTenant
|
|
56
|
+
* import { isTestTenant } from './utils/testTenant';
|
|
57
57
|
*
|
|
58
58
|
* const tenantId = createTestTenantId();
|
|
59
59
|
* console.log(isTestTenant(tenantId)); // true
|
|
@@ -10,7 +10,7 @@ import { randomUUID } from 'node:crypto';
|
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```typescript
|
|
13
|
-
* import { createTestTenantId } from './utils/testTenant
|
|
13
|
+
* import { createTestTenantId } from './utils/testTenant';
|
|
14
14
|
*
|
|
15
15
|
* describe('My test suite', () => {
|
|
16
16
|
* const tenantId = createTestTenantId('agents');
|
|
@@ -37,7 +37,7 @@ export function createTestTenantId(prefix) {
|
|
|
37
37
|
*
|
|
38
38
|
* @example
|
|
39
39
|
* ```typescript
|
|
40
|
-
* import { createTestTenantIds } from './utils/testTenant
|
|
40
|
+
* import { createTestTenantIds } from './utils/testTenant';
|
|
41
41
|
*
|
|
42
42
|
* describe('Multi-tenant test suite', () => {
|
|
43
43
|
* const [tenantA, tenantB] = createTestTenantIds(2, 'multi-tenant');
|
|
@@ -59,7 +59,7 @@ export function createTestTenantIds(count, prefix) {
|
|
|
59
59
|
*
|
|
60
60
|
* @example
|
|
61
61
|
* ```typescript
|
|
62
|
-
* import { isTestTenant } from './utils/testTenant
|
|
62
|
+
* import { isTestTenant } from './utils/testTenant';
|
|
63
63
|
*
|
|
64
64
|
* const tenantId = createTestTenantId();
|
|
65
65
|
* console.log(isTestTenant(tenantId)); // true
|
package/dist/a2a/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/a2a/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/a2a/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,SAAS,EACT,kBAAkB,EAClB,qCAAqC,EACrC,eAAe,EAKf,OAAO,EACP,iBAAiB,EACjB,mBAAmB,EAGnB,qCAAqC,EACrC,IAAI,EACJ,uBAAuB,EACvB,YAAY,EACZ,0BAA0B,EAC1B,eAAe,EACf,qBAAqB,EACtB,MAAM,qBAAqB,CAAC;AAM7B,KAAK,kBAAkB,GAAG,OAAO,GAAG,IAAI,GAAG,qBAAqB,GAAG,uBAAuB,CAAC;AAG3F,MAAM,MAAM,eAAe,GAAG;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GACpB;IACE,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEN,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AA0CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,gBAAgB,CAAqB;IAC7C,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,kBAAkB,CAAC,CAAS;IACpC,O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package/dist/a2a/handlers.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Context } from 'hono';
|
|
2
|
-
import type { RegisteredAgent } from './types
|
|
2
|
+
import type { RegisteredAgent } from './types';
|
|
3
3
|
export declare function a2aHandler(c: Context, agent: RegisteredAgent): Promise<Response>;
|
|
4
4
|
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/a2a/handlers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/a2a/handlers.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAKpC,OAAO,KAAK,EAA4C,eAAe,EAAE,MAAM,SAAS,CAAC;AAIzF,wBAAsB,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC,CAiEtF"}
|
package/dist/a2a/handlers.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import { createMessage, createTask, getRequestExecutionContext, TaskState, updateTask, } from '@inkeep/agents-core';
|
|
1
2
|
import { streamSSE } from 'hono/streaming';
|
|
2
3
|
import { nanoid } from 'nanoid';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { getLogger } from '../logger.js';
|
|
6
|
-
import { TaskState } from '@inkeep/agents-core';
|
|
4
|
+
import dbClient from '../data/db/dbClient';
|
|
5
|
+
import { getLogger } from '../logger';
|
|
7
6
|
const logger = getLogger('a2aHandler');
|
|
8
7
|
export async function a2aHandler(c, agent) {
|
|
9
8
|
try {
|
package/dist/a2a/transfer.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../../src/a2a/transfer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../../src/a2a/transfer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAGhD;;GAEG;AACH,wBAAsB,eAAe,CAAC,EACpC,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,aAAa,GACd,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC;IACV,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC,CAQD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,gBAAgB,CAI1E"}
|
package/dist/a2a/transfer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { setActiveAgentForThread } from '@inkeep/agents-core';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import dbClient from '../data/db/dbClient';
|
|
3
|
+
import { getLogger } from '../logger';
|
|
4
4
|
const logger = getLogger('Transfer');
|
|
5
5
|
/**
|
|
6
6
|
* Executes a transfer by sending the original message to the target agent
|
package/dist/agents/Agent.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { type AgentConversationHistoryConfig, type Artifact, type ArtifactComponentApiInsert, type CredentialStoreRegistry, type DataComponentApiInsert, type McpTool, type Models } from '@inkeep/agents-core';
|
|
1
2
|
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';
|
|
4
|
-
import type { StreamHelper } from '../utils/stream-helpers.js';
|
|
3
|
+
import type { StreamHelper } from '../utils/stream-helpers';
|
|
5
4
|
/**
|
|
6
5
|
* Creates a stopWhen condition that stops when any tool call name starts with the given prefix
|
|
7
6
|
* @param prefix - The prefix to check for in tool call names
|
|
@@ -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":"
|
|
1
|
+
{"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../../src/agents/Agent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,8BAA8B,EACnC,KAAK,QAAQ,EACb,KAAK,0BAA0B,EAE/B,KAAK,uBAAuB,EAE5B,KAAK,sBAAsB,EAU3B,KAAK,OAAO,EAGZ,KAAK,MAAM,EAEZ,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAA4C,KAAK,OAAO,EAAQ,MAAM,IAAI,CAAC;AAgBlF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAU5D;;;;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,MAA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H,EACD,SAAS,CAAC,EAAE,MAAM;IAsDd,WAAW,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,eAAe,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;IAuH/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
|
@@ -1,25 +1,24 @@
|
|
|
1
|
+
import { ContextResolver, CredentialStuffer, getContextConfigById, getCredentialReference, getFullGraphDefinition, getLedgerArtifacts, graphHasArtifactComponents, listTaskIdsByContextId, McpClient, TemplateEngine, } from '@inkeep/agents-core';
|
|
1
2
|
import { SpanStatusCode, trace } from '@opentelemetry/api';
|
|
2
3
|
import { generateObject, generateText, streamText, tool } from 'ai';
|
|
3
4
|
import { z } from 'zod';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { toolSessionManager } from './ToolSessionManager.js';
|
|
22
|
-
import { V1Config } from './versions/V1Config.js';
|
|
5
|
+
import { createDefaultConversationHistoryConfig, getFormattedConversationHistory, } from '../data/conversations';
|
|
6
|
+
import dbClient from '../data/db/dbClient';
|
|
7
|
+
import { getLogger } from '../logger';
|
|
8
|
+
import { createSpanName, forceFlushTracer, getGlobalTracer, handleSpanError } from '../tracer';
|
|
9
|
+
import { generateToolId } from '../utils/agent-operations';
|
|
10
|
+
import { ArtifactReferenceSchema } from '../utils/artifact-component-schema';
|
|
11
|
+
import { jsonSchemaToZod } from '../utils/data-component-schema';
|
|
12
|
+
import { graphSessionManager } from '../utils/graph-session';
|
|
13
|
+
import { IncrementalStreamParser } from '../utils/incremental-stream-parser';
|
|
14
|
+
import { ResponseFormatter } from '../utils/response-formatter';
|
|
15
|
+
import { getStreamHelper } from '../utils/stream-registry';
|
|
16
|
+
import { createSaveToolResultTool } from './artifactTools';
|
|
17
|
+
import { ModelFactory } from './ModelFactory';
|
|
18
|
+
import { createDelegateToAgentTool, createTransferToAgentTool } from './relationTools';
|
|
19
|
+
import { SystemPromptBuilder } from './SystemPromptBuilder';
|
|
20
|
+
import { toolSessionManager } from './ToolSessionManager';
|
|
21
|
+
import { V1Config } from './versions/V1Config';
|
|
23
22
|
/**
|
|
24
23
|
* Creates a stopWhen condition that stops when any tool call name starts with the given prefix
|
|
25
24
|
* @param prefix - The prefix to check for in tool call names
|
|
@@ -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
|
}),
|
|
@@ -558,7 +560,10 @@ Key requirements:
|
|
|
558
560
|
let processedPrompt = this.config.agentPrompt;
|
|
559
561
|
if (resolvedContext) {
|
|
560
562
|
try {
|
|
561
|
-
processedPrompt = TemplateEngine.render(this.config.agentPrompt, resolvedContext, {
|
|
563
|
+
processedPrompt = TemplateEngine.render(this.config.agentPrompt, resolvedContext, {
|
|
564
|
+
strict: false,
|
|
565
|
+
preserveUnresolved: false,
|
|
566
|
+
});
|
|
562
567
|
}
|
|
563
568
|
catch (error) {
|
|
564
569
|
logger.error({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelFactory.d.ts","sourceRoot":"","sources":["../../src/agents/ModelFactory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAKxC,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C;AAED;;;GAGG;AACH,qBAAa,YAAY;IACvB;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAE1C;IAEF;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG,IAAI,GAAG,aAAa;IAiDhE;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAoC;IAE/E;;;;OAIG;IACH,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;IA+BrF;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,oBAAoB;
|
|
1
|
+
{"version":3,"file":"ModelFactory.d.ts","sourceRoot":"","sources":["../../src/agents/ModelFactory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAKxC,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C;AAED;;;GAGG;AACH,qBAAa,YAAY;IACvB;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAE1C;IAEF;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG,IAAI,GAAG,aAAa;IAiDhE;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAoC;IAE/E;;;;OAIG;IACH,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;IA+BrF;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAqCnC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAgChC;;;OAGG;IACH,MAAM,CAAC,mBAAmB,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAoB9F;;;;OAIG;IACH,MAAM,CAAC,uBAAuB,CAC5B,aAAa,CAAC,EAAE,aAAa,GAC5B;QAAE,KAAK,EAAE,aAAa,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAsB3E;;;OAGG;IACH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,EAAE;CA4BvD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { anthropic, createAnthropic } from '@ai-sdk/anthropic';
|
|
2
2
|
import { createOpenAI, openai } from '@ai-sdk/openai';
|
|
3
|
-
import { getLogger } from '../logger
|
|
3
|
+
import { getLogger } from '../logger';
|
|
4
4
|
const logger = getLogger('ModelFactory');
|
|
5
5
|
/**
|
|
6
6
|
* Factory for creating AI SDK language models from configuration
|
|
@@ -23,7 +23,7 @@ export class ModelFactory {
|
|
|
23
23
|
const modelSettings = config || ModelFactory.DEFAULT_MODEL_CONFIG;
|
|
24
24
|
// Extract provider from model string (e.g., "anthropic/claude-4-sonnet" -> "anthropic")
|
|
25
25
|
// Handle empty strings by falling back to default
|
|
26
|
-
const modelString =
|
|
26
|
+
const modelString = modelSettings.model?.trim() || ModelFactory.DEFAULT_MODEL_CONFIG.model;
|
|
27
27
|
const { provider, modelName } = ModelFactory.parseModelString(modelString);
|
|
28
28
|
logger.debug({
|
|
29
29
|
provider,
|
|
@@ -163,7 +163,7 @@ export class ModelFactory {
|
|
|
163
163
|
* Includes maxDuration if specified in provider options (in seconds, following Vercel standard)
|
|
164
164
|
*/
|
|
165
165
|
static prepareGenerationConfig(modelSettings) {
|
|
166
|
-
const modelString =
|
|
166
|
+
const modelString = modelSettings?.model?.trim() || 'anthropic/claude-4-sonnet-20250514';
|
|
167
167
|
// Create the model instance
|
|
168
168
|
const model = ModelFactory.createModel({
|
|
169
169
|
model: modelString,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemPromptBuilder.d.ts","sourceRoot":"","sources":["../../src/agents/SystemPromptBuilder.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SystemPromptBuilder.d.ts","sourceRoot":"","sources":["../../src/agents/SystemPromptBuilder.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAI7C,qBAAa,mBAAmB,CAAC,OAAO;IAKpC,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,aAAa;IALvB,OAAO,CAAC,SAAS,CAA6B;IAC9C,OAAO,CAAC,MAAM,CAAS;gBAGb,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,aAAa,CAAC,OAAO,CAAC;YAGjC,aAAa;IA6Bd,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAUhE,OAAO,CAAC,yBAAyB;IAW1B,kBAAkB,IAAI,MAAM,EAAE;IAI9B,QAAQ,IAAI,OAAO;CAG3B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
2
|
import { dirname, join } from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { getLogger } from '../logger
|
|
4
|
+
import { getLogger } from '../logger';
|
|
5
5
|
const logger = getLogger('SystemPromptBuilder');
|
|
6
6
|
export class SystemPromptBuilder {
|
|
7
7
|
version;
|
|
@@ -17,7 +17,7 @@ export class SystemPromptBuilder {
|
|
|
17
17
|
return;
|
|
18
18
|
try {
|
|
19
19
|
const currentDir = dirname(fileURLToPath(import.meta.url));
|
|
20
|
-
const templatesDir = join(currentDir, '..', 'templates', this.version);
|
|
20
|
+
const templatesDir = join(currentDir, '..', '..', 'templates', this.version);
|
|
21
21
|
// Load all required template files for this version
|
|
22
22
|
const templatePromises = this.versionConfig.templateFiles.map(async (filename) => {
|
|
23
23
|
const filePath = join(templatesDir, filename);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifactTools.d.ts","sourceRoot":"","sources":["../../src/agents/artifactTools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"artifactTools.d.ts","sourceRoot":"","sources":["../../src/agents/artifactTools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAmOtE,wBAAgB,wBAAwB,CACtC,SAAS,CAAC,EAAE,MAAM,EAClB,eAAe,CAAC,EAAE,MAAM,EAAE,6BAA6B;AACvD,OAAO,CAAC,EAAE,MAAM,EAChB,kBAAkB,CAAC,EAAE,0BAA0B,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;GAkUlD"}
|
|
@@ -2,10 +2,10 @@ import { tool } from 'ai';
|
|
|
2
2
|
import jmespath from 'jmespath';
|
|
3
3
|
import { nanoid } from 'nanoid';
|
|
4
4
|
import z from 'zod';
|
|
5
|
-
import { getLogger } from '../logger
|
|
6
|
-
import { graphSessionManager } from '../utils/graph-session
|
|
7
|
-
import { parseEmbeddedJson } from './generateTaskHandler
|
|
8
|
-
import { toolSessionManager } from './ToolSessionManager
|
|
5
|
+
import { getLogger } from '../logger';
|
|
6
|
+
import { graphSessionManager } from '../utils/graph-session';
|
|
7
|
+
import { parseEmbeddedJson } from './generateTaskHandler';
|
|
8
|
+
import { toolSessionManager } from './ToolSessionManager';
|
|
9
9
|
const logger = getLogger('artifactTools');
|
|
10
10
|
function buildKeyNestingMap(data, prefix = '', map = new Map()) {
|
|
11
11
|
if (typeof data === 'object' && data !== null) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
1
|
+
import { type AgentApiSelect, type AgentConversationHistoryConfig, type CredentialStoreRegistry } from '@inkeep/agents-core';
|
|
2
|
+
import type { A2ATask, A2ATaskResult } from '../a2a/types';
|
|
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":"
|
|
1
|
+
{"version":3,"file":"generateTaskHandler.d.ts","sourceRoot":"","sources":["../../src/agents/generateTaskHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,8BAA8B,EACnC,KAAK,uBAAuB,EAU7B,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAK3D,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,GAC5B,QAAQ,iBAAiB,EACzB,0BAA0B,uBAAuB,MAEnC,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"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { getAgentById, getAgentGraph, getArtifactComponentsForAgent, getDataComponentsForAgent, getRelatedAgentsForGraph, getToolsForAgent, TaskState, } from '@inkeep/agents-core';
|
|
1
2
|
import destr from 'destr'; // safe JSON.parse-if-JSON
|
|
2
3
|
import { nanoid } from 'nanoid';
|
|
3
4
|
import traverse from 'traverse'; // tiny object walker
|
|
4
|
-
import
|
|
5
|
-
import { getLogger } from '../logger
|
|
6
|
-
import { Agent } from './Agent
|
|
7
|
-
import dbClient from '../data/db/dbClient.js';
|
|
5
|
+
import dbClient from '../data/db/dbClient';
|
|
6
|
+
import { getLogger } from '../logger';
|
|
7
|
+
import { Agent } from './Agent';
|
|
8
8
|
/** Turn any string value that is valid JSON into an object/array (in place). */
|
|
9
9
|
export function parseEmbeddedJson(data) {
|
|
10
10
|
return traverse(data).map(function (x) {
|
|
@@ -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
|