@agentrun/sdk 0.0.1-test.2d1b17b
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 +201 -0
- package/README.md +225 -0
- package/dist/index.cjs +7452 -0
- package/dist/index.js +7447 -0
- package/dist/src/add.d.ts +2 -0
- package/dist/src/add.d.ts.map +1 -0
- package/dist/src/agent-runtime/api/control.d.ts +190 -0
- package/dist/src/agent-runtime/api/control.d.ts.map +1 -0
- package/dist/src/agent-runtime/api/data.d.ts +38 -0
- package/dist/src/agent-runtime/api/data.d.ts.map +1 -0
- package/dist/src/agent-runtime/api/index.d.ts +5 -0
- package/dist/src/agent-runtime/api/index.d.ts.map +1 -0
- package/dist/src/agent-runtime/client.d.ts +146 -0
- package/dist/src/agent-runtime/client.d.ts.map +1 -0
- package/dist/src/agent-runtime/endpoint.d.ts +132 -0
- package/dist/src/agent-runtime/endpoint.d.ts.map +1 -0
- package/dist/src/agent-runtime/index.d.ts +12 -0
- package/dist/src/agent-runtime/index.d.ts.map +1 -0
- package/dist/src/agent-runtime/model.d.ts +327 -0
- package/dist/src/agent-runtime/model.d.ts.map +1 -0
- package/dist/src/agent-runtime/runtime.d.ts +203 -0
- package/dist/src/agent-runtime/runtime.d.ts.map +1 -0
- package/dist/src/credential/api/control.d.ts +90 -0
- package/dist/src/credential/api/control.d.ts.map +1 -0
- package/dist/src/credential/api/index.d.ts +5 -0
- package/dist/src/credential/api/index.d.ts.map +1 -0
- package/dist/src/credential/client.d.ts +57 -0
- package/dist/src/credential/client.d.ts.map +1 -0
- package/dist/src/credential/credential.d.ts +68 -0
- package/dist/src/credential/credential.d.ts.map +1 -0
- package/dist/src/credential/index.d.ts +9 -0
- package/dist/src/credential/index.d.ts.map +1 -0
- package/dist/src/credential/model.d.ts +116 -0
- package/dist/src/credential/model.d.ts.map +1 -0
- package/dist/src/index.d.ts +32 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/integration/adapter.d.ts +128 -0
- package/dist/src/integration/adapter.d.ts.map +1 -0
- package/dist/src/integration/index.d.ts +14 -0
- package/dist/src/integration/index.d.ts.map +1 -0
- package/dist/src/integration/mastra/adapter.d.ts +112 -0
- package/dist/src/integration/mastra/adapter.d.ts.map +1 -0
- package/dist/src/integration/mastra/index.d.ts +15 -0
- package/dist/src/integration/mastra/index.d.ts.map +1 -0
- package/dist/src/integration/mastra/types.d.ts +62 -0
- package/dist/src/integration/mastra/types.d.ts.map +1 -0
- package/dist/src/model/api/control.d.ts +162 -0
- package/dist/src/model/api/control.d.ts.map +1 -0
- package/dist/src/model/client.d.ts +87 -0
- package/dist/src/model/client.d.ts.map +1 -0
- package/dist/src/model/index.d.ts +10 -0
- package/dist/src/model/index.d.ts.map +1 -0
- package/dist/src/model/model-proxy.d.ts +173 -0
- package/dist/src/model/model-proxy.d.ts.map +1 -0
- package/dist/src/model/model-service.d.ts +172 -0
- package/dist/src/model/model-service.d.ts.map +1 -0
- package/dist/src/model/model.d.ts +227 -0
- package/dist/src/model/model.d.ts.map +1 -0
- package/dist/src/sandbox/aio-sandbox.d.ts +235 -0
- package/dist/src/sandbox/aio-sandbox.d.ts.map +1 -0
- package/dist/src/sandbox/api/aio-data.d.ts +50 -0
- package/dist/src/sandbox/api/aio-data.d.ts.map +1 -0
- package/dist/src/sandbox/api/browser-data.d.ts +82 -0
- package/dist/src/sandbox/api/browser-data.d.ts.map +1 -0
- package/dist/src/sandbox/api/code-interpreter-data.d.ts +189 -0
- package/dist/src/sandbox/api/code-interpreter-data.d.ts.map +1 -0
- package/dist/src/sandbox/api/control.d.ts +146 -0
- package/dist/src/sandbox/api/control.d.ts.map +1 -0
- package/dist/src/sandbox/api/sandbox-data.d.ts +168 -0
- package/dist/src/sandbox/api/sandbox-data.d.ts.map +1 -0
- package/dist/src/sandbox/browser-sandbox.d.ts +91 -0
- package/dist/src/sandbox/browser-sandbox.d.ts.map +1 -0
- package/dist/src/sandbox/client.d.ts +122 -0
- package/dist/src/sandbox/client.d.ts.map +1 -0
- package/dist/src/sandbox/code-interpreter-sandbox.d.ts +218 -0
- package/dist/src/sandbox/code-interpreter-sandbox.d.ts.map +1 -0
- package/dist/src/sandbox/index.d.ts +16 -0
- package/dist/src/sandbox/index.d.ts.map +1 -0
- package/dist/src/sandbox/model.d.ts +231 -0
- package/dist/src/sandbox/model.d.ts.map +1 -0
- package/dist/src/sandbox/sandbox.d.ts +90 -0
- package/dist/src/sandbox/sandbox.d.ts.map +1 -0
- package/dist/src/sandbox/template.d.ts +115 -0
- package/dist/src/sandbox/template.d.ts.map +1 -0
- package/dist/src/server/agui-protocol.d.ts +127 -0
- package/dist/src/server/agui-protocol.d.ts.map +1 -0
- package/dist/src/server/index.d.ts +8 -0
- package/dist/src/server/index.d.ts.map +1 -0
- package/dist/src/server/model.d.ts +150 -0
- package/dist/src/server/model.d.ts.map +1 -0
- package/dist/src/server/server.d.ts +66 -0
- package/dist/src/server/server.d.ts.map +1 -0
- package/dist/src/toolset/api/control.d.ts +74 -0
- package/dist/src/toolset/api/control.d.ts.map +1 -0
- package/dist/src/toolset/api/index.d.ts +10 -0
- package/dist/src/toolset/api/index.d.ts.map +1 -0
- package/dist/src/toolset/api/mcp.d.ts +79 -0
- package/dist/src/toolset/api/mcp.d.ts.map +1 -0
- package/dist/src/toolset/client.d.ts +65 -0
- package/dist/src/toolset/client.d.ts.map +1 -0
- package/dist/src/toolset/index.d.ts +15 -0
- package/dist/src/toolset/index.d.ts.map +1 -0
- package/dist/src/toolset/model.d.ts +246 -0
- package/dist/src/toolset/model.d.ts.map +1 -0
- package/dist/src/toolset/openapi.d.ts +174 -0
- package/dist/src/toolset/openapi.d.ts.map +1 -0
- package/dist/src/toolset/toolset.d.ts +154 -0
- package/dist/src/toolset/toolset.d.ts.map +1 -0
- package/dist/src/utils/config.d.ts +124 -0
- package/dist/src/utils/config.d.ts.map +1 -0
- package/dist/src/utils/control-api.d.ts +24 -0
- package/dist/src/utils/control-api.d.ts.map +1 -0
- package/dist/src/utils/data-api.d.ts +163 -0
- package/dist/src/utils/data-api.d.ts.map +1 -0
- package/dist/src/utils/exception.d.ts +67 -0
- package/dist/src/utils/exception.d.ts.map +1 -0
- package/dist/src/utils/helper.d.ts +2 -0
- package/dist/src/utils/helper.d.ts.map +1 -0
- package/dist/src/utils/index.d.ts +9 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/log.d.ts +25 -0
- package/dist/src/utils/log.d.ts.map +1 -0
- package/dist/src/utils/model.d.ts +77 -0
- package/dist/src/utils/model.d.ts.map +1 -0
- package/dist/src/utils/resource.d.ts +72 -0
- package/dist/src/utils/resource.d.ts.map +1 -0
- package/dist/tests/e2e/a.test.d.ts +2 -0
- package/dist/tests/e2e/a.test.d.ts.map +1 -0
- package/dist/tests/e2e/agent-runtime/agent-runtime.test.d.ts +14 -0
- package/dist/tests/e2e/agent-runtime/agent-runtime.test.d.ts.map +1 -0
- package/dist/tests/e2e/credential/credential.test.d.ts +2 -0
- package/dist/tests/e2e/credential/credential.test.d.ts.map +1 -0
- package/dist/tests/e2e/model/model.test.d.ts +20 -0
- package/dist/tests/e2e/model/model.test.d.ts.map +1 -0
- package/dist/tests/e2e/model/model_service.test.d.ts +12 -0
- package/dist/tests/e2e/model/model_service.test.d.ts.map +1 -0
- package/dist/tests/e2e/sandbox/aio-sandbox.test.d.ts +18 -0
- package/dist/tests/e2e/sandbox/aio-sandbox.test.d.ts.map +1 -0
- package/dist/tests/e2e/sandbox/browser-sandbox.test.d.ts +15 -0
- package/dist/tests/e2e/sandbox/browser-sandbox.test.d.ts.map +1 -0
- package/dist/tests/e2e/sandbox/code-interpreter-sandbox.test.d.ts +16 -0
- package/dist/tests/e2e/sandbox/code-interpreter-sandbox.test.d.ts.map +1 -0
- package/dist/tests/e2e/sandbox/sandbox.test.d.ts +13 -0
- package/dist/tests/e2e/sandbox/sandbox.test.d.ts.map +1 -0
- package/dist/tests/e2e/sandbox/template.test.d.ts +12 -0
- package/dist/tests/e2e/sandbox/template.test.d.ts.map +1 -0
- package/dist/tests/e2e/toolset/toolset.test.d.ts +2 -0
- package/dist/tests/e2e/toolset/toolset.test.d.ts.map +1 -0
- package/dist/tests/integration/adapter.test.d.ts +8 -0
- package/dist/tests/integration/adapter.test.d.ts.map +1 -0
- package/dist/tests/setup.d.ts +8 -0
- package/dist/tests/setup.d.ts.map +1 -0
- package/dist/tests/unittests/integration/mastra.test.d.ts +8 -0
- package/dist/tests/unittests/integration/mastra.test.d.ts.map +1 -0
- package/dist/tests/unittests/server/agui-protocol.test.d.ts +7 -0
- package/dist/tests/unittests/server/agui-protocol.test.d.ts.map +1 -0
- package/dist/tests/unittests/server/server.test.d.ts +7 -0
- package/dist/tests/unittests/server/server.test.d.ts.map +1 -0
- package/dist/tests/unittests/toolset/openapi.test.d.ts +10 -0
- package/dist/tests/unittests/toolset/openapi.test.d.ts.map +1 -0
- package/dist/tests/unittests/toolset/toolset.test.d.ts +8 -0
- package/dist/tests/unittests/toolset/toolset.test.d.ts.map +1 -0
- package/dist/tests/unittests/utils/config.test.d.ts +7 -0
- package/dist/tests/unittests/utils/config.test.d.ts.map +1 -0
- package/dist/tests/unittests/utils/data-api.test.d.ts +8 -0
- package/dist/tests/unittests/utils/data-api.test.d.ts.map +1 -0
- package/dist/tests/unittests/utils/exception.test.d.ts +5 -0
- package/dist/tests/unittests/utils/exception.test.d.ts.map +1 -0
- package/package.json +98 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credential Client
|
|
3
|
+
*
|
|
4
|
+
* 此模块提供 Credential 的客户端 API。
|
|
5
|
+
* This module provides the client API for Credential.
|
|
6
|
+
*/
|
|
7
|
+
import { Config } from '../utils/config';
|
|
8
|
+
import { Credential } from './credential';
|
|
9
|
+
import { CredentialCreateInput, CredentialListInput, CredentialListOutput, CredentialUpdateInput } from './model';
|
|
10
|
+
/**
|
|
11
|
+
* Credential Client
|
|
12
|
+
*
|
|
13
|
+
* 提供 Credential 的创建、删除、更新、查询功能。
|
|
14
|
+
* Provides create, delete, update, query functions for Credential.
|
|
15
|
+
*/
|
|
16
|
+
export declare class CredentialClient {
|
|
17
|
+
private config?;
|
|
18
|
+
private controlApi;
|
|
19
|
+
constructor(config?: Config);
|
|
20
|
+
/**
|
|
21
|
+
* Create a Credential
|
|
22
|
+
*/
|
|
23
|
+
create(params: {
|
|
24
|
+
input: CredentialCreateInput;
|
|
25
|
+
config?: Config;
|
|
26
|
+
}): Promise<Credential>;
|
|
27
|
+
/**
|
|
28
|
+
* Delete a Credential
|
|
29
|
+
*/
|
|
30
|
+
delete(params: {
|
|
31
|
+
name: string;
|
|
32
|
+
config?: Config;
|
|
33
|
+
}): Promise<Credential>;
|
|
34
|
+
/**
|
|
35
|
+
* Update a Credential
|
|
36
|
+
*/
|
|
37
|
+
update(params: {
|
|
38
|
+
name: string;
|
|
39
|
+
input: CredentialUpdateInput;
|
|
40
|
+
config?: Config;
|
|
41
|
+
}): Promise<Credential>;
|
|
42
|
+
/**
|
|
43
|
+
* Get a Credential
|
|
44
|
+
*/
|
|
45
|
+
get(params: {
|
|
46
|
+
name: string;
|
|
47
|
+
config?: Config;
|
|
48
|
+
}): Promise<Credential>;
|
|
49
|
+
/**
|
|
50
|
+
* List Credentials
|
|
51
|
+
*/
|
|
52
|
+
list(params: {
|
|
53
|
+
input?: CredentialListInput;
|
|
54
|
+
config?: Config;
|
|
55
|
+
}): Promise<CredentialListOutput[]>;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/credential/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAKzC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAEjB;;;;;GAKG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,UAAU,CAAuB;gBAE7B,MAAM,CAAC,EAAE,MAAM;IAK3B;;OAEG;IACG,MAAM,CAAC,MAAM,EAAE;QACnB,KAAK,EAAE,qBAAqB,CAAC;QAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC,UAAU,CAAC;IA4DvB;;OAEG;IACG,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,CAAC;IAmB5E;;OAEG;IACG,MAAM,CAAC,MAAM,EAAE;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,qBAAqB,CAAC;QAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC,UAAU,CAAC;IAsDvB;;OAEG;IACG,GAAG,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,CAAC;IAkBzE;;OAEG;IACG,IAAI,CAAC,MAAM,EAAE;QACjB,KAAK,CAAC,EAAE,mBAAmB,CAAC;QAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;CAiBpC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credential Resource
|
|
3
|
+
*
|
|
4
|
+
* 此模块定义 Credential 资源类。
|
|
5
|
+
* This module defines the Credential resource class.
|
|
6
|
+
*/
|
|
7
|
+
import { Config } from '../utils/config';
|
|
8
|
+
import { ResourceBase } from '../utils/resource';
|
|
9
|
+
import { CredentialAuthType, CredentialInterface, CredentialListInput, CredentialListOutput, CredentialSourceType, RelatedResource } from './model';
|
|
10
|
+
export declare class Credential extends ResourceBase implements CredentialInterface {
|
|
11
|
+
credentialName?: string;
|
|
12
|
+
/** 描述 */
|
|
13
|
+
description?: string;
|
|
14
|
+
/** 是否启用 */
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
credentialId?: string;
|
|
17
|
+
createdAt?: string;
|
|
18
|
+
updatedAt?: string;
|
|
19
|
+
relatedResources?: RelatedResource[];
|
|
20
|
+
/** 凭证认证类型 */
|
|
21
|
+
credentialAuthType?: CredentialAuthType;
|
|
22
|
+
/** 凭证来源类型 */
|
|
23
|
+
credentialSourceType?: CredentialSourceType;
|
|
24
|
+
/** 凭证公共配置 */
|
|
25
|
+
credentialPublicConfig?: Record<string, any>;
|
|
26
|
+
/** 凭证密钥 */
|
|
27
|
+
credentialSecret?: string;
|
|
28
|
+
_config?: Config;
|
|
29
|
+
constructor(data?: CredentialInterface, config?: Config);
|
|
30
|
+
private static getClient;
|
|
31
|
+
/**
|
|
32
|
+
* Create a new Credential
|
|
33
|
+
*/
|
|
34
|
+
static create: (paramsOrInput: any) => Promise<Credential>;
|
|
35
|
+
/**
|
|
36
|
+
* Delete a Credential by name
|
|
37
|
+
*/
|
|
38
|
+
static delete: (paramsOrName: any) => Promise<Credential>;
|
|
39
|
+
/**
|
|
40
|
+
* Update a Credential by name
|
|
41
|
+
*/
|
|
42
|
+
static update: (paramsOrName: any) => Promise<Credential>;
|
|
43
|
+
/**
|
|
44
|
+
* Get a Credential by name
|
|
45
|
+
*/
|
|
46
|
+
static get: (paramsOrName: any) => Promise<Credential>;
|
|
47
|
+
/**
|
|
48
|
+
* List all Credentials (with pagination)
|
|
49
|
+
*/
|
|
50
|
+
static list: (paramsOrUndefined?: any) => Promise<CredentialListOutput[]>;
|
|
51
|
+
static listAll: (params?: {
|
|
52
|
+
input?: CredentialListInput;
|
|
53
|
+
config?: Config;
|
|
54
|
+
}) => Promise<CredentialListOutput[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Delete this credential
|
|
57
|
+
*/
|
|
58
|
+
delete: (params?: any) => Promise<this>;
|
|
59
|
+
/**
|
|
60
|
+
* Update this credential
|
|
61
|
+
*/
|
|
62
|
+
update: (params: any) => Promise<this>;
|
|
63
|
+
/**
|
|
64
|
+
* Refresh this credential's data
|
|
65
|
+
*/
|
|
66
|
+
get: (params?: any) => Promise<Credential>;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=credential.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential.d.ts","sourceRoot":"","sources":["../../../src/credential/credential.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAIzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EACL,kBAAkB,EAElB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EAEpB,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,qBAAa,UAAW,SAAQ,YAAa,YAAW,mBAAmB;IACzE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS;IACT,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IACrC,aAAa;IACb,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,aAAa;IACb,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,aAAa;IACb,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7C,WAAW;IACX,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,OAAO,CAAC,EAAE,MAAM,CAAC;gBAEL,IAAI,CAAC,EAAE,mBAAmB,EAAE,MAAM,CAAC,EAAE,MAAM;IAOvD,OAAO,CAAC,MAAM,CAAC,SAAS,CAEtB;IAEF;;OAEG;IACH,MAAM,CAAC,MAAM,GAAU,eAAe,GAAG,yBAkBvC;IAEF;;OAEG;IACH,MAAM,CAAC,MAAM,GAAU,cAAc,GAAG,yBAgBtC;IAEF;;OAEG;IACH,MAAM,CAAC,MAAM,GAAU,cAAc,GAAG,yBActC;IAEF;;OAEG;IACH,MAAM,CAAC,GAAG,GAAU,cAAc,GAAG,yBAgBnC;IAEF;;OAEG;IACH,MAAM,CAAC,IAAI,GAAU,oBAAoB,GAAG,qCAY1C;IAEF,MAAM,CAAC,OAAO,GAAU,SAAS;QAC/B,KAAK,CAAC,EAAE,mBAAmB,CAAC;QAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,qCAOC;IAEF;;OAEG;IACH,MAAM,GAAU,SAAS,GAAG,mBAY1B;IAEF;;OAEG;IACH,MAAM,GAAU,QAAQ,GAAG,mBAkBzB;IAEF;;OAEG;IACH,GAAG,GAAU,SAAS,GAAG,KAAG,OAAO,CAAC,UAAU,CAAC,CAY7C;CACH"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credential module exports
|
|
3
|
+
*/
|
|
4
|
+
export { CredentialClient } from './client';
|
|
5
|
+
export { Credential } from './credential';
|
|
6
|
+
export { CredentialControlAPI } from './api/control';
|
|
7
|
+
export { CredentialConfig } from './model';
|
|
8
|
+
export type { CredentialBasicAuth, RelatedResource, CredentialCreateInput, CredentialUpdateInput, CredentialListInput, CredentialListOutput, } from './model';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/credential/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,YAAY,EACV,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credential Data Models
|
|
3
|
+
*
|
|
4
|
+
* 此模块定义 Credential 相关的所有数据模型。
|
|
5
|
+
* This module defines all data models related to Credential.
|
|
6
|
+
*/
|
|
7
|
+
import { PageableInput } from '../utils/model';
|
|
8
|
+
import { Config } from '../utils/config';
|
|
9
|
+
/** 凭证认证类型 / Credential Authentication Types */
|
|
10
|
+
export type CredentialAuthType = 'jwt' | 'api_key' | 'basic' | 'aksk' | 'custom_header';
|
|
11
|
+
/** 凭证来源类型 / Credential Source Types */
|
|
12
|
+
export type CredentialSourceType = 'external_llm' | 'external_tool' | 'internal';
|
|
13
|
+
/**
|
|
14
|
+
* Credential basic authentication configuration
|
|
15
|
+
*/
|
|
16
|
+
export interface CredentialBasicAuth {
|
|
17
|
+
/** Username */
|
|
18
|
+
username?: string;
|
|
19
|
+
/** Password */
|
|
20
|
+
password?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Related resource for credential
|
|
24
|
+
*/
|
|
25
|
+
export interface RelatedResource {
|
|
26
|
+
/** 资源 IDj*/
|
|
27
|
+
resourceId?: string;
|
|
28
|
+
/** 资源名称j*/
|
|
29
|
+
resourceName?: string;
|
|
30
|
+
/** 资源类型j*/
|
|
31
|
+
resourceType?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface CredentialConfigInterface {
|
|
34
|
+
/** 凭证认证类型 */
|
|
35
|
+
credentialAuthType?: CredentialAuthType;
|
|
36
|
+
/** 凭证来源类型 */
|
|
37
|
+
credentialSourceType?: CredentialSourceType;
|
|
38
|
+
/** 凭证公共配置 */
|
|
39
|
+
credentialPublicConfig?: Record<string, any>;
|
|
40
|
+
/** 凭证密钥 */
|
|
41
|
+
credentialSecret?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* 凭证配置 / Credential configuration
|
|
45
|
+
*/
|
|
46
|
+
export declare class CredentialConfig implements CredentialConfigInterface {
|
|
47
|
+
constructor(data?: CredentialConfigInterface);
|
|
48
|
+
/** 配置访问 AgentRun 的 api key 凭证 */
|
|
49
|
+
static inboundApiKey(apiKey: string, headerKey?: string): CredentialConfig;
|
|
50
|
+
/** 配置访问 AgentRun 的静态 JWKS 凭证 */
|
|
51
|
+
static inboundStaticJwt(jwks: string): CredentialConfig;
|
|
52
|
+
/** 配置访问 AgentRun 的远程 JWT 凭证 */
|
|
53
|
+
static inboundRemoteJwt(uri: string, timeout?: number, ttl?: number, publicConfig?: Record<string, any>): CredentialConfig;
|
|
54
|
+
/** 配置访问 AgentRun 的 Basic 凭证 */
|
|
55
|
+
static inboundBasic(users: CredentialBasicAuth[]): CredentialConfig;
|
|
56
|
+
/** 配置访问第三方工具的 api key 凭证 */
|
|
57
|
+
static outboundLLMApiKey(apiKey: string, provider: string): CredentialConfig;
|
|
58
|
+
/** 配置访问第三方工具的 ak/sk 凭证 */
|
|
59
|
+
static outboundLLMAKSK(provider: string, accessKeyId: string, accessKeySecret: string, accountId: string): CredentialConfig;
|
|
60
|
+
/** 配置访问第三方工具的自定义凭证 */
|
|
61
|
+
static outboundToolAKSKCustom(authConfig: Record<string, string>): CredentialConfig;
|
|
62
|
+
/** 配置访问第三方工具的自定义 Header 凭证 */
|
|
63
|
+
static outboundToolCustomHeader(headers: Record<string, string>): CredentialConfig;
|
|
64
|
+
}
|
|
65
|
+
/** 凭证公共配置 */
|
|
66
|
+
export interface CredentialMutableProps {
|
|
67
|
+
/** 描述 */
|
|
68
|
+
description?: string;
|
|
69
|
+
/** 是否启用 */
|
|
70
|
+
enabled?: boolean;
|
|
71
|
+
}
|
|
72
|
+
export interface CredentialImmutableProps {
|
|
73
|
+
credentialName?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface CredentialSystemProps {
|
|
76
|
+
credentialId?: string;
|
|
77
|
+
createdAt?: string;
|
|
78
|
+
updatedAt?: string;
|
|
79
|
+
relatedResources?: RelatedResource[];
|
|
80
|
+
}
|
|
81
|
+
export interface CredentialCreateInput extends CredentialMutableProps, CredentialImmutableProps {
|
|
82
|
+
credentialConfig?: CredentialConfig;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Credential update input
|
|
86
|
+
*/
|
|
87
|
+
export interface CredentialUpdateInput extends CredentialMutableProps {
|
|
88
|
+
credentialConfig?: CredentialConfig;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Credential list input
|
|
92
|
+
*/
|
|
93
|
+
export interface CredentialListInput extends PageableInput {
|
|
94
|
+
credentialAuthType?: CredentialAuthType;
|
|
95
|
+
credentialName?: string;
|
|
96
|
+
credentialSourceType?: CredentialSourceType;
|
|
97
|
+
provider?: string;
|
|
98
|
+
}
|
|
99
|
+
export declare class CredentialListOutput {
|
|
100
|
+
createdAt?: string;
|
|
101
|
+
credentialAuthType?: CredentialAuthType;
|
|
102
|
+
credentialId?: string;
|
|
103
|
+
credentialName?: string;
|
|
104
|
+
credentialSourceType?: CredentialSourceType;
|
|
105
|
+
enabled?: boolean;
|
|
106
|
+
relatedResourceCount?: number;
|
|
107
|
+
updatedAt?: string;
|
|
108
|
+
constructor(data?: any);
|
|
109
|
+
toCredential(config?: Config): Promise<import("./credential").Credential>;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Credential resource class
|
|
113
|
+
*/
|
|
114
|
+
export interface CredentialInterface extends CredentialMutableProps, CredentialImmutableProps, CredentialSystemProps, CredentialConfigInterface {
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/credential/model.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,+CAA+C;AAC/C,MAAM,MAAM,kBAAkB,GAC1B,KAAK,GACL,SAAS,GACT,OAAO,GACP,MAAM,GACN,eAAe,CAAC;AAEpB,uCAAuC;AACvC,MAAM,MAAM,oBAAoB,GAAG,cAAc,GAAG,eAAe,GAAG,UAAU,CAAC;AAEjF;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,eAAe;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,YAAY;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW;IACX,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW;IACX,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,yBAAyB;IACxC,aAAa;IACb,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,aAAa;IACb,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,aAAa;IACb,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7C,WAAW;IACX,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,qBAAa,gBAAiB,YAAW,yBAAyB;gBACpD,IAAI,CAAC,EAAE,yBAAyB;IAI5C,iCAAiC;IACjC,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,GAAE,MAAwB;IASxE,gCAAgC;IAChC,MAAM,CAAC,gBAAg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,sBAAsB;IACnE,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,oBAAoB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;gBAEP,IAAI,CAAC,EAAE,GAAG;IAIhB,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM;CAOnC;AAED;;GAEG;AAEH,MAAM,WAAW,mBACf,SAAQ,sBAAsB,EAC5B,wBAAwB,EACxB,qBAAqB,EACrB,yBAAyB;CAAG"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentRun SDK for Node.js
|
|
3
|
+
*
|
|
4
|
+
* AgentRun SDK 是阿里云 AgentRun 服务的 Node.js 客户端库。
|
|
5
|
+
* Provides simple and easy-to-use APIs for managing AI Agent runtime environments,
|
|
6
|
+
* model services, sandbox environments, etc.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
export declare const VERSION = "0.0.1";
|
|
11
|
+
export { Config, type ConfigOptions } from './utils/config';
|
|
12
|
+
export { AgentRunError, ClientError, ServerError, HTTPError, ResourceNotExistError, ResourceAlreadyExistError, } from './utils/exception';
|
|
13
|
+
export { Status } from './utils/model';
|
|
14
|
+
export { AgentRuntimeClient, AgentRuntime, AgentRuntimeEndpoint, AgentRuntimeControlAPI, } from './agent-runtime';
|
|
15
|
+
export type { AgentRuntimeCreateInput, AgentRuntimeUpdateInput, AgentRuntimeListInput, AgentRuntimeEndpointCreateInput, AgentRuntimeEndpointUpdateInput, AgentRuntimeEndpointListInput, AgentRuntimeCode, AgentRuntimeContainer, AgentRuntimeHealthCheckConfig, AgentRuntimeLogConfig, AgentRuntimeProtocolConfig, AgentRuntimeEndpointRoutingConfig, AgentRuntimeEndpointRoutingWeight, AgentRuntimeVersion, } from './agent-runtime';
|
|
16
|
+
export { AgentRuntimeArtifact, AgentRuntimeLanguage, AgentRuntimeProtocolType, } from './agent-runtime';
|
|
17
|
+
export { CredentialClient, Credential, CredentialControlAPI, CredentialConfig, } from './credential';
|
|
18
|
+
export type { CredentialCreateInput, CredentialUpdateInput, CredentialListInput, CredentialBasicAuth, RelatedResource, } from './credential';
|
|
19
|
+
export { SandboxClient, Sandbox, Template, BrowserSandbox, CodeInterpreterSandbox, AioSandbox, SandboxDataAPI, CodeInterpreterDataAPI, BrowserDataAPI, AioDataAPI, } from "./sandbox";
|
|
20
|
+
export { TemplateType, SandboxState, CodeLanguage, TemplateNetworkMode, TemplateOSSPermission } from "./sandbox";
|
|
21
|
+
export type { TemplateNetworkConfiguration, TemplateOssConfiguration, TemplateLogConfiguration, TemplateCredentialConfiguration, TemplateArmsConfiguration, TemplateContainerConfiguration, TemplateMcpOptions, TemplateMcpState, TemplateCreateInput, TemplateUpdateInput, TemplateListInput, SandboxCreateInput, SandboxListInput, TemplateData, SandboxData, ExecuteCodeResult, FileInfo, } from "./sandbox";
|
|
22
|
+
export { ModelClient, ModelService, ModelProxy, ModelControlAPI, } from './model';
|
|
23
|
+
export type { ModelServiceCreateInput, ModelServiceUpdateInput, ModelServiceListInput, ModelProxyCreateInput, ModelProxyUpdateInput, ModelProxyListInput, ProviderSettings, ModelFeatures, ModelProperties, ModelParameterRule, ModelInfoConfig, ProxyConfigEndpoint, ProxyConfigFallback, ProxyConfigPolicies, ProxyConfig, } from './model';
|
|
24
|
+
export { BackendType, ModelType, Provider } from './model';
|
|
25
|
+
export { ToolSetClient, ToolSet } from './toolset';
|
|
26
|
+
export type { ToolSetData, ToolSetCreateInput, ToolSetUpdateInput, ToolSetListInput, ToolSetSpec, ToolSetStatus, ToolSetStatusOutputs, ToolSetSchema, ToolSetAuthorization, MCPToolMeta, } from './toolset';
|
|
27
|
+
export { ToolSetSchemaType } from './toolset';
|
|
28
|
+
export { AgentRunServer } from './server';
|
|
29
|
+
export type { AgentRequest, AgentResult, Message, ServerConfig, } from './server';
|
|
30
|
+
export { MessageRole, EventType } from './server';
|
|
31
|
+
export * from './integration';
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG5D,OAAO,EACL,aAAa,EACb,WAAW,EACX,WAAW,EACX,SAAS,EACT,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGvC,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,+BAA+B,EAC/B,+BAA+B,EAC/B,6BAA6B,EAC7B,gBAAgB,EAChB,qBAAqB,EACrB,6BAA6B,EAC7B,qBAAqB,EACrB,0BAA0B,EAC1B,iCAAiC,EACjC,iCAAiC,EACjC,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,O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E,MAAM,WAAW,CAAC;AACnD,YAAY,EACV,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAG9C,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,YAAY,EACV,YAAY,EACZ,WAAW,EACX,OAAO,EACP,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGlD,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter Interface Definition
|
|
3
|
+
*
|
|
4
|
+
* 定义统一的适配器接口,所有框架适配器都实现这些接口。
|
|
5
|
+
* Defines unified adapter interfaces that all framework adapters implement.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* 标准消息格式 (OpenAI 兼容)
|
|
9
|
+
* Canonical message format (OpenAI compatible)
|
|
10
|
+
*/
|
|
11
|
+
export interface CanonicalMessage {
|
|
12
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
13
|
+
content: string | null;
|
|
14
|
+
name?: string;
|
|
15
|
+
toolCalls?: ToolCall[];
|
|
16
|
+
toolCallId?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 工具调用
|
|
20
|
+
* Tool call
|
|
21
|
+
*/
|
|
22
|
+
export interface ToolCall {
|
|
23
|
+
id: string;
|
|
24
|
+
type: "function";
|
|
25
|
+
function: {
|
|
26
|
+
name: string;
|
|
27
|
+
arguments: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 标准工具定义
|
|
32
|
+
* Canonical tool definition
|
|
33
|
+
*/
|
|
34
|
+
export interface CanonicalTool {
|
|
35
|
+
name: string;
|
|
36
|
+
description: string;
|
|
37
|
+
parameters?: Record<string, unknown>;
|
|
38
|
+
func?: (...args: unknown[]) => unknown | Promise<unknown>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 通用模型配置
|
|
42
|
+
* Common model configuration
|
|
43
|
+
*/
|
|
44
|
+
export interface CommonModelConfig {
|
|
45
|
+
/** 模型端点 URL */
|
|
46
|
+
endpoint?: string;
|
|
47
|
+
/** API Key */
|
|
48
|
+
apiKey?: string;
|
|
49
|
+
/** 模型名称 */
|
|
50
|
+
modelName?: string;
|
|
51
|
+
/** 温度参数 */
|
|
52
|
+
temperature?: number;
|
|
53
|
+
/** 最大 tokens */
|
|
54
|
+
maxTokens?: number;
|
|
55
|
+
/** 超时时间 (毫秒) */
|
|
56
|
+
timeout?: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 消息适配器接口
|
|
60
|
+
* Message adapter interface
|
|
61
|
+
*
|
|
62
|
+
* 用于在不同框架消息格式之间进行转换。
|
|
63
|
+
* Used to convert between different framework message formats.
|
|
64
|
+
*/
|
|
65
|
+
export interface MessageAdapter<TFrameworkMessage = unknown> {
|
|
66
|
+
/**
|
|
67
|
+
* 将框架消息转换为标准格式
|
|
68
|
+
* Convert framework messages to canonical format
|
|
69
|
+
*/
|
|
70
|
+
toCanonical(messages: TFrameworkMessage[]): CanonicalMessage[];
|
|
71
|
+
/**
|
|
72
|
+
* 将标准消息转换为框架格式
|
|
73
|
+
* Convert canonical messages to framework format
|
|
74
|
+
*/
|
|
75
|
+
fromCanonical(messages: CanonicalMessage[]): TFrameworkMessage[];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* 工具适配器接口
|
|
79
|
+
* Tool adapter interface
|
|
80
|
+
*
|
|
81
|
+
* 用于将标准工具定义转换为框架特定格式。
|
|
82
|
+
* Used to convert canonical tool definitions to framework-specific format.
|
|
83
|
+
*/
|
|
84
|
+
export interface ToolAdapter<TFrameworkTool = unknown> {
|
|
85
|
+
/**
|
|
86
|
+
* 将标准工具转换为框架格式
|
|
87
|
+
* Convert canonical tools to framework format
|
|
88
|
+
*/
|
|
89
|
+
fromCanonical(tools: CanonicalTool[]): TFrameworkTool[];
|
|
90
|
+
/**
|
|
91
|
+
* 将框架工具转换为标准格式 (可选)
|
|
92
|
+
* Convert framework tools to canonical format (optional)
|
|
93
|
+
*/
|
|
94
|
+
toCanonical?(tools: TFrameworkTool[]): CanonicalTool[];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* 模型适配器接口
|
|
98
|
+
* Model adapter interface
|
|
99
|
+
*
|
|
100
|
+
* 用于包装框架模型,使其能够与 AgentRun 协同工作。
|
|
101
|
+
* Used to wrap framework models to work with AgentRun.
|
|
102
|
+
*/
|
|
103
|
+
export interface ModelAdapter<TFrameworkModel = unknown> {
|
|
104
|
+
/**
|
|
105
|
+
* 使用 AgentRun 模型配置创建框架模型
|
|
106
|
+
* Create framework model with AgentRun model configuration
|
|
107
|
+
*/
|
|
108
|
+
createModel(config: CommonModelConfig): TFrameworkModel;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* 框架集成适配器
|
|
112
|
+
* Framework integration adapter
|
|
113
|
+
*
|
|
114
|
+
* 组合消息、工具和模型适配器的完整框架集成。
|
|
115
|
+
* Complete framework integration combining message, tool, and model adapters.
|
|
116
|
+
*/
|
|
117
|
+
export interface FrameworkAdapter<TMessage = unknown, TTool = unknown, TModel = unknown> {
|
|
118
|
+
name: string;
|
|
119
|
+
message: MessageAdapter<TMessage>;
|
|
120
|
+
tool: ToolAdapter<TTool>;
|
|
121
|
+
model: ModelAdapter<TModel>;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* 将 JSON Schema 类型转换为 TypeScript 类型
|
|
125
|
+
* Convert JSON Schema type to TypeScript type
|
|
126
|
+
*/
|
|
127
|
+
export declare function schemaToType(schema: Record<string, unknown>): string;
|
|
128
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/integration/adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;IAC/C,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC3D;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,eAAe;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,cAAc,CAAC,iBAAiB,GAAG,OAAO;IACzD;;;OAGG;IACH,WAAW,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAE/D;;;OAGG;IACH,aAAa,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,iBAAiB,EAAE,CAAC;CAClE;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW,CAAC,cAAc,GAAG,OAAO;IACnD;;;OAGG;IACH,aAAa,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,cAAc,EAAE,CAAC;IAExD;;;OAGG;IACH,WAAW,CAAC,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,aAAa,EAAE,CAAC;CACxD;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY,CAAC,eAAe,GAAG,OAAO;IACrD;;;OAGG;IACH,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,eAAe,CAAC;CACzD;AAED;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB,CAC/B,QAAQ,GAAG,OAAO,EAClB,KAAK,GAAG,OAAO,EACf,MAAM,GAAG,OAAO;IAEhB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IACzB,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CA6BpE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration Module
|
|
3
|
+
*
|
|
4
|
+
* 提供与主流 AI 框架的集成适配器。
|
|
5
|
+
* Provides integration adapters for mainstream AI frameworks.
|
|
6
|
+
*
|
|
7
|
+
* 支持的框架 / Supported Frameworks:
|
|
8
|
+
* - Mastra: 现代 TypeScript AI Agent 框架 / Modern TypeScript AI agent framework
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
export * from "./adapter";
|
|
13
|
+
export * from "./mastra";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integration/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mastra Adapter
|
|
3
|
+
*
|
|
4
|
+
* Mastra 框架的集成适配器。
|
|
5
|
+
* Integration adapter for Mastra framework.
|
|
6
|
+
*/
|
|
7
|
+
import { CanonicalMessage, CanonicalTool, CommonModelConfig, FrameworkAdapter, MessageAdapter, ModelAdapter, ToolAdapter } from "../adapter";
|
|
8
|
+
import { MastraAgentConfig, MastraMessage, MastraModelConfig, MastraTool } from "./types";
|
|
9
|
+
/**
|
|
10
|
+
* Mastra 消息适配器
|
|
11
|
+
* Mastra message adapter
|
|
12
|
+
*/
|
|
13
|
+
export declare class MastraMessageAdapter implements MessageAdapter<MastraMessage> {
|
|
14
|
+
/**
|
|
15
|
+
* 将 Mastra 消息转换为标准格式
|
|
16
|
+
*/
|
|
17
|
+
toCanonical(messages: MastraMessage[]): CanonicalMessage[];
|
|
18
|
+
/**
|
|
19
|
+
* 将标准消息转换为 Mastra 格式
|
|
20
|
+
*/
|
|
21
|
+
fromCanonical(messages: CanonicalMessage[]): MastraMessage[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Mastra 工具适配器
|
|
25
|
+
* Mastra tool adapter
|
|
26
|
+
*/
|
|
27
|
+
export declare class MastraToolAdapter implements ToolAdapter<MastraTool> {
|
|
28
|
+
/**
|
|
29
|
+
* 将标准工具转换为 Mastra 格式
|
|
30
|
+
*/
|
|
31
|
+
fromCanonical(tools: CanonicalTool[]): MastraTool[];
|
|
32
|
+
/**
|
|
33
|
+
* 将 Mastra 工具转换为标准格式
|
|
34
|
+
*/
|
|
35
|
+
toCanonical(tools: MastraTool[]): CanonicalTool[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Mastra 模型适配器
|
|
39
|
+
* Mastra model adapter
|
|
40
|
+
*/
|
|
41
|
+
export declare class MastraModelAdapter implements ModelAdapter<MastraModelConfig> {
|
|
42
|
+
/**
|
|
43
|
+
* 使用 AgentRun 配置创建 Mastra 模型配置
|
|
44
|
+
*/
|
|
45
|
+
createModel(config: CommonModelConfig): MastraModelConfig;
|
|
46
|
+
/**
|
|
47
|
+
* 检测模型提供商
|
|
48
|
+
*/
|
|
49
|
+
private detectProvider;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Mastra 完整框架适配器
|
|
53
|
+
* Mastra complete framework adapter
|
|
54
|
+
*/
|
|
55
|
+
export declare class MastraAdapter implements FrameworkAdapter<MastraMessage, MastraTool, MastraModelConfig> {
|
|
56
|
+
readonly name = "mastra";
|
|
57
|
+
readonly message: MastraMessageAdapter;
|
|
58
|
+
readonly tool: MastraToolAdapter;
|
|
59
|
+
readonly model: MastraModelAdapter;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* 创建 Mastra 适配器实例
|
|
63
|
+
* Create Mastra adapter instance
|
|
64
|
+
*/
|
|
65
|
+
export declare function createMastraAdapter(): MastraAdapter;
|
|
66
|
+
/**
|
|
67
|
+
* 将 AgentRun 工具包装为 Mastra 工具
|
|
68
|
+
* Wrap AgentRun tools as Mastra tools
|
|
69
|
+
*/
|
|
70
|
+
export declare function wrapTools(tools: CanonicalTool[]): MastraTool[];
|
|
71
|
+
/**
|
|
72
|
+
* 将 AgentRun 模型配置转换为 Mastra 模型配置
|
|
73
|
+
* Convert AgentRun model config to Mastra model config
|
|
74
|
+
*/
|
|
75
|
+
export declare function wrapModel(config: CommonModelConfig): MastraModelConfig;
|
|
76
|
+
/**
|
|
77
|
+
* Agent 包装器配置参数
|
|
78
|
+
* Agent wrapper configuration parameters
|
|
79
|
+
*/
|
|
80
|
+
export interface WrapAgentParams {
|
|
81
|
+
/** Agent 名称 */
|
|
82
|
+
name: string;
|
|
83
|
+
/** Agent 指令/系统提示词 */
|
|
84
|
+
instructions?: string;
|
|
85
|
+
/** 模型配置 */
|
|
86
|
+
modelConfig: CommonModelConfig;
|
|
87
|
+
/** 工具列表 */
|
|
88
|
+
tools?: CanonicalTool[];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* 将 AgentRun 组件包装为完整的 Mastra Agent 配置
|
|
92
|
+
* Wrap AgentRun components as complete Mastra agent configuration
|
|
93
|
+
*
|
|
94
|
+
* @param params - Agent 包装器配置参数
|
|
95
|
+
* @returns Mastra Agent 配置对象
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* const agentConfig = wrapAgent({
|
|
100
|
+
* name: "MyAssistant",
|
|
101
|
+
* instructions: "You are a helpful assistant",
|
|
102
|
+
* modelConfig: {
|
|
103
|
+
* endpoint: "https://api.openai.com/v1",
|
|
104
|
+
* apiKey: "sk-...",
|
|
105
|
+
* modelName: "gpt-4"
|
|
106
|
+
* },
|
|
107
|
+
* tools: [calculatorTool, weatherTool]
|
|
108
|
+
* });
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export declare function wrapAgent(params: WrapAgentParams): MastraAgentConfig;
|
|
112
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../src/integration/mastra/adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,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,eAAe;IACf,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW;IACX,WAAW,EAAE,iBAAiB,CAAC;IAC/B,WAAW;IACX,KAAK,CAAC,EAAE,aAAa,EAAE,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,iBAAiB,CAoBpE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mastra Integration
|
|
3
|
+
*
|
|
4
|
+
* 提供与 Mastra AI 框架的集成。
|
|
5
|
+
* Provides integration with the Mastra AI framework.
|
|
6
|
+
*
|
|
7
|
+
* Mastra 是一个现代化的 TypeScript AI Agent 框架,
|
|
8
|
+
* 支持 LLM、向量存储、RAG、工具等功能。
|
|
9
|
+
*
|
|
10
|
+
* @see https://mastra.ai
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
export * from "./adapter";
|
|
14
|
+
export * from "./types";
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/integration/mastra/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mastra Types
|
|
3
|
+
*
|
|
4
|
+
* Mastra 框架相关的类型定义。
|
|
5
|
+
* Type definitions for Mastra framework.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Mastra 消息格式
|
|
9
|
+
* Mastra message format
|
|
10
|
+
*/
|
|
11
|
+
export interface MastraMessage {
|
|
12
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
13
|
+
content: string | null;
|
|
14
|
+
name?: string;
|
|
15
|
+
tool_call_id?: string;
|
|
16
|
+
tool_calls?: MastraToolCall[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Mastra 工具调用
|
|
20
|
+
* Mastra tool call
|
|
21
|
+
*/
|
|
22
|
+
export interface MastraToolCall {
|
|
23
|
+
id: string;
|
|
24
|
+
type: "function";
|
|
25
|
+
function: {
|
|
26
|
+
name: string;
|
|
27
|
+
arguments: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Mastra 工具定义
|
|
32
|
+
* Mastra tool definition
|
|
33
|
+
*/
|
|
34
|
+
export interface MastraTool {
|
|
35
|
+
name: string;
|
|
36
|
+
description: string;
|
|
37
|
+
inputSchema?: Record<string, unknown>;
|
|
38
|
+
execute?: (...args: unknown[]) => Promise<unknown>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Mastra 模型配置
|
|
42
|
+
* Mastra model configuration
|
|
43
|
+
*/
|
|
44
|
+
export interface MastraModelConfig {
|
|
45
|
+
provider: string;
|
|
46
|
+
modelId: string;
|
|
47
|
+
apiKey?: string;
|
|
48
|
+
baseUrl?: string;
|
|
49
|
+
temperature?: number;
|
|
50
|
+
maxTokens?: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Mastra Agent 配置
|
|
54
|
+
* Mastra agent configuration
|
|
55
|
+
*/
|
|
56
|
+
export interface MastraAgentConfig {
|
|
57
|
+
name: string;
|
|
58
|
+
instructions?: string;
|
|
59
|
+
model: MastraModelConfig;
|
|
60
|
+
tools?: MastraTool[];
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=types.d.ts.map
|