@agentrun/sdk 0.0.1-test.eab07a8 → 0.0.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/README.md +0 -55
- package/dist/index.cjs +80 -1171
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -516
- package/dist/index.d.ts +3 -516
- package/dist/index.js +81 -1160
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -3584,7 +3584,7 @@ declare class ModelProxy extends ResourceBase implements ModelProxyImmutableProp
|
|
|
3584
3584
|
stream?: boolean;
|
|
3585
3585
|
config?: Config;
|
|
3586
3586
|
[key: string]: any;
|
|
3587
|
-
}) => Promise<ai.StreamTextResult<
|
|
3587
|
+
}) => Promise<ai.StreamTextResult<ai.ToolSet, any> | ai.GenerateTextResult<ai.ToolSet, any>>;
|
|
3588
3588
|
/**
|
|
3589
3589
|
* 获取响应 / Get responses
|
|
3590
3590
|
*
|
|
@@ -3756,7 +3756,7 @@ declare class ModelService extends ResourceBase implements ModelServiceImmutable
|
|
|
3756
3756
|
stream?: boolean;
|
|
3757
3757
|
config?: Config;
|
|
3758
3758
|
[key: string]: any;
|
|
3759
|
-
}) => Promise<ai.StreamTextResult<
|
|
3759
|
+
}) => Promise<ai.StreamTextResult<ai.ToolSet, any> | ai.GenerateTextResult<ai.ToolSet, any>>;
|
|
3760
3760
|
/**
|
|
3761
3761
|
* 获取响应 / Get responses
|
|
3762
3762
|
*
|
|
@@ -4282,519 +4282,6 @@ declare class ToolSetClient {
|
|
|
4282
4282
|
}) => Promise<ToolSet[]>;
|
|
4283
4283
|
}
|
|
4284
4284
|
|
|
4285
|
-
/**
|
|
4286
|
-
* Server Data Models
|
|
4287
|
-
*
|
|
4288
|
-
* 此模块定义 Server 相关的所有数据模型。
|
|
4289
|
-
* This module defines all data models related to Server.
|
|
4290
|
-
*/
|
|
4291
|
-
/**
|
|
4292
|
-
* Message role enum
|
|
4293
|
-
*/
|
|
4294
|
-
declare enum MessageRole {
|
|
4295
|
-
SYSTEM = "system",
|
|
4296
|
-
USER = "user",
|
|
4297
|
-
ASSISTANT = "assistant",
|
|
4298
|
-
TOOL = "tool"
|
|
4299
|
-
}
|
|
4300
|
-
/**
|
|
4301
|
-
* Event type enum for AgentEvent (Protocol agnostic)
|
|
4302
|
-
*
|
|
4303
|
-
* 定义核心事件类型,框架会自动转换为对应协议格式(OpenAI、AG-UI 等)。
|
|
4304
|
-
*/
|
|
4305
|
-
declare enum EventType {
|
|
4306
|
-
TEXT = "TEXT",// 文本内容块
|
|
4307
|
-
TOOL_CALL = "TOOL_CALL",// 完整工具调用(含 id, name, args)
|
|
4308
|
-
TOOL_CALL_CHUNK = "TOOL_CALL_CHUNK",// 工具调用参数片段(流式场景)
|
|
4309
|
-
TOOL_RESULT = "TOOL_RESULT",// 工具执行结果
|
|
4310
|
-
TOOL_RESULT_CHUNK = "TOOL_RESULT_CHUNK",// 工具执行结果片段(流式输出场景)
|
|
4311
|
-
ERROR = "ERROR",// 错误事件
|
|
4312
|
-
STATE = "STATE",// 状态更新(快照或增量)
|
|
4313
|
-
HITL = "HITL",// Human-in-the-Loop,请求人类介入
|
|
4314
|
-
CUSTOM = "CUSTOM",// 自定义事件
|
|
4315
|
-
RAW = "RAW"
|
|
4316
|
-
}
|
|
4317
|
-
/**
|
|
4318
|
-
* Tool call definition
|
|
4319
|
-
*/
|
|
4320
|
-
interface ToolCall$1 {
|
|
4321
|
-
id: string;
|
|
4322
|
-
type?: string;
|
|
4323
|
-
function: {
|
|
4324
|
-
name: string;
|
|
4325
|
-
arguments: string;
|
|
4326
|
-
};
|
|
4327
|
-
}
|
|
4328
|
-
/**
|
|
4329
|
-
* Tool definition
|
|
4330
|
-
*/
|
|
4331
|
-
interface Tool {
|
|
4332
|
-
type: string;
|
|
4333
|
-
function: {
|
|
4334
|
-
name: string;
|
|
4335
|
-
description?: string;
|
|
4336
|
-
parameters?: Record<string, unknown>;
|
|
4337
|
-
};
|
|
4338
|
-
}
|
|
4339
|
-
/**
|
|
4340
|
-
* Message in a conversation
|
|
4341
|
-
*/
|
|
4342
|
-
interface Message {
|
|
4343
|
-
id?: string;
|
|
4344
|
-
role: MessageRole;
|
|
4345
|
-
content?: string | Array<Record<string, unknown>>;
|
|
4346
|
-
name?: string;
|
|
4347
|
-
toolCalls?: ToolCall$1[];
|
|
4348
|
-
toolCallId?: string;
|
|
4349
|
-
}
|
|
4350
|
-
/**
|
|
4351
|
-
* Agent request
|
|
4352
|
-
*/
|
|
4353
|
-
interface AgentRequest {
|
|
4354
|
-
/** Protocol name */
|
|
4355
|
-
protocol?: string;
|
|
4356
|
-
/** Messages in the conversation */
|
|
4357
|
-
messages: Message[];
|
|
4358
|
-
/** Whether to stream the response */
|
|
4359
|
-
stream?: boolean;
|
|
4360
|
-
/** Model to use */
|
|
4361
|
-
model?: string;
|
|
4362
|
-
/** Available tools */
|
|
4363
|
-
tools?: Tool[];
|
|
4364
|
-
/** Additional metadata */
|
|
4365
|
-
metadata?: Record<string, unknown>;
|
|
4366
|
-
/** Raw HTTP request (for accessing headers, etc.) */
|
|
4367
|
-
rawRequest?: unknown;
|
|
4368
|
-
}
|
|
4369
|
-
/**
|
|
4370
|
-
* Merge options for addition field
|
|
4371
|
-
*/
|
|
4372
|
-
interface MergeOptions {
|
|
4373
|
-
noNewField?: boolean;
|
|
4374
|
-
concatList?: boolean;
|
|
4375
|
-
ignoreEmptyList?: boolean;
|
|
4376
|
-
}
|
|
4377
|
-
/**
|
|
4378
|
-
* Agent event (for streaming)
|
|
4379
|
-
*
|
|
4380
|
-
* 标准化的事件结构,协议无关设计。
|
|
4381
|
-
* 框架层会自动将 AgentEvent 转换为对应协议的格式(OpenAI、AG-UI 等)。
|
|
4382
|
-
*/
|
|
4383
|
-
interface AgentEvent {
|
|
4384
|
-
/** Event type */
|
|
4385
|
-
event: EventType;
|
|
4386
|
-
/** Event data */
|
|
4387
|
-
data?: Record<string, unknown>;
|
|
4388
|
-
/** Additional fields for protocol extension */
|
|
4389
|
-
addition?: Record<string, unknown>;
|
|
4390
|
-
/** Merge options for addition */
|
|
4391
|
-
additionMergeOptions?: MergeOptions;
|
|
4392
|
-
}
|
|
4393
|
-
/**
|
|
4394
|
-
* Agent result (alias for AgentEvent)
|
|
4395
|
-
*/
|
|
4396
|
-
type AgentResult = AgentEvent;
|
|
4397
|
-
/**
|
|
4398
|
-
* Protocol configuration base
|
|
4399
|
-
*/
|
|
4400
|
-
interface ProtocolConfig {
|
|
4401
|
-
prefix?: string;
|
|
4402
|
-
enable?: boolean;
|
|
4403
|
-
}
|
|
4404
|
-
/**
|
|
4405
|
-
* OpenAI protocol configuration
|
|
4406
|
-
*/
|
|
4407
|
-
interface OpenAIProtocolConfig extends ProtocolConfig {
|
|
4408
|
-
modelName?: string;
|
|
4409
|
-
}
|
|
4410
|
-
/**
|
|
4411
|
-
* AG-UI protocol configuration
|
|
4412
|
-
*/
|
|
4413
|
-
interface AGUIProtocolConfig extends ProtocolConfig {
|
|
4414
|
-
}
|
|
4415
|
-
/**
|
|
4416
|
-
* Server configuration
|
|
4417
|
-
*/
|
|
4418
|
-
interface ServerConfig {
|
|
4419
|
-
/** OpenAI protocol config */
|
|
4420
|
-
openai?: OpenAIProtocolConfig;
|
|
4421
|
-
/** AG-UI protocol config */
|
|
4422
|
-
agui?: AGUIProtocolConfig;
|
|
4423
|
-
/** CORS origins */
|
|
4424
|
-
corsOrigins?: string[];
|
|
4425
|
-
/** Port to listen on */
|
|
4426
|
-
port?: number;
|
|
4427
|
-
/** Host to listen on */
|
|
4428
|
-
host?: string;
|
|
4429
|
-
}
|
|
4430
|
-
|
|
4431
|
-
/**
|
|
4432
|
-
* AgentRun HTTP Server
|
|
4433
|
-
*
|
|
4434
|
-
* 基于 Node.js 的 HTTP 服务器实现。
|
|
4435
|
-
* HTTP server implementation based on Node.js.
|
|
4436
|
-
*/
|
|
4437
|
-
|
|
4438
|
-
/**
|
|
4439
|
-
* Agent invoke handler type
|
|
4440
|
-
*/
|
|
4441
|
-
type InvokeAgentHandler = (request: AgentRequest) => Promise<string | AgentResult | AsyncIterable<string | AgentResult>> | string | AgentResult | AsyncIterable<string | AgentResult>;
|
|
4442
|
-
/**
|
|
4443
|
-
* AgentRun HTTP Server
|
|
4444
|
-
*
|
|
4445
|
-
* 提供 HTTP 服务器功能,支持 OpenAI 和 AG-UI 协议。
|
|
4446
|
-
*/
|
|
4447
|
-
declare class AgentRunServer {
|
|
4448
|
-
private invokeAgent;
|
|
4449
|
-
private config;
|
|
4450
|
-
private server?;
|
|
4451
|
-
private aguiHandler;
|
|
4452
|
-
constructor(options: {
|
|
4453
|
-
invokeAgent: InvokeAgentHandler;
|
|
4454
|
-
config?: ServerConfig;
|
|
4455
|
-
});
|
|
4456
|
-
/**
|
|
4457
|
-
* Start the HTTP server
|
|
4458
|
-
*/
|
|
4459
|
-
start(options?: {
|
|
4460
|
-
host?: string;
|
|
4461
|
-
port?: number;
|
|
4462
|
-
}): void;
|
|
4463
|
-
/**
|
|
4464
|
-
* Stop the HTTP server
|
|
4465
|
-
*/
|
|
4466
|
-
stop(): Promise<void>;
|
|
4467
|
-
/**
|
|
4468
|
-
* Handle CORS headers
|
|
4469
|
-
*/
|
|
4470
|
-
private handleCors;
|
|
4471
|
-
/**
|
|
4472
|
-
* Handle HTTP request
|
|
4473
|
-
*/
|
|
4474
|
-
private handleRequest;
|
|
4475
|
-
/**
|
|
4476
|
-
* Handle AG-UI endpoint
|
|
4477
|
-
*/
|
|
4478
|
-
private handleAGUI;
|
|
4479
|
-
/**
|
|
4480
|
-
* Handle OpenAI chat completions endpoint
|
|
4481
|
-
*/
|
|
4482
|
-
private handleChatCompletions;
|
|
4483
|
-
/**
|
|
4484
|
-
* Parse request body
|
|
4485
|
-
*/
|
|
4486
|
-
private parseBody;
|
|
4487
|
-
/**
|
|
4488
|
-
* Check if value is async iterable
|
|
4489
|
-
*/
|
|
4490
|
-
private isAsyncIterable;
|
|
4491
|
-
/**
|
|
4492
|
-
* Convert result to async iterable
|
|
4493
|
-
*/
|
|
4494
|
-
private toAsyncIterable;
|
|
4495
|
-
}
|
|
4496
|
-
|
|
4497
|
-
/**
|
|
4498
|
-
* Adapter Interface Definition
|
|
4499
|
-
*
|
|
4500
|
-
* 定义统一的适配器接口,所有框架适配器都实现这些接口。
|
|
4501
|
-
* Defines unified adapter interfaces that all framework adapters implement.
|
|
4502
|
-
*/
|
|
4503
|
-
/**
|
|
4504
|
-
* 标准消息格式 (OpenAI 兼容)
|
|
4505
|
-
* Canonical message format (OpenAI compatible)
|
|
4506
|
-
*/
|
|
4507
|
-
interface CanonicalMessage {
|
|
4508
|
-
role: "system" | "user" | "assistant" | "tool";
|
|
4509
|
-
content: string | null;
|
|
4510
|
-
name?: string;
|
|
4511
|
-
toolCalls?: ToolCall[];
|
|
4512
|
-
toolCallId?: string;
|
|
4513
|
-
}
|
|
4514
|
-
/**
|
|
4515
|
-
* 工具调用
|
|
4516
|
-
* Tool call
|
|
4517
|
-
*/
|
|
4518
|
-
interface ToolCall {
|
|
4519
|
-
id: string;
|
|
4520
|
-
type: "function";
|
|
4521
|
-
function: {
|
|
4522
|
-
name: string;
|
|
4523
|
-
arguments: string;
|
|
4524
|
-
};
|
|
4525
|
-
}
|
|
4526
|
-
/**
|
|
4527
|
-
* 标准工具定义
|
|
4528
|
-
* Canonical tool definition
|
|
4529
|
-
*/
|
|
4530
|
-
interface CanonicalTool {
|
|
4531
|
-
name: string;
|
|
4532
|
-
description: string;
|
|
4533
|
-
parameters?: Record<string, unknown>;
|
|
4534
|
-
func?: (...args: unknown[]) => unknown | Promise<unknown>;
|
|
4535
|
-
}
|
|
4536
|
-
/**
|
|
4537
|
-
* 通用模型配置
|
|
4538
|
-
* Common model configuration
|
|
4539
|
-
*/
|
|
4540
|
-
interface CommonModelConfig {
|
|
4541
|
-
/** 模型端点 URL */
|
|
4542
|
-
endpoint?: string;
|
|
4543
|
-
/** API Key */
|
|
4544
|
-
apiKey?: string;
|
|
4545
|
-
/** 模型名称 */
|
|
4546
|
-
modelName?: string;
|
|
4547
|
-
/** 温度参数 */
|
|
4548
|
-
temperature?: number;
|
|
4549
|
-
/** 最大 tokens */
|
|
4550
|
-
maxTokens?: number;
|
|
4551
|
-
/** 超时时间 (毫秒) */
|
|
4552
|
-
timeout?: number;
|
|
4553
|
-
}
|
|
4554
|
-
/**
|
|
4555
|
-
* 消息适配器接口
|
|
4556
|
-
* Message adapter interface
|
|
4557
|
-
*
|
|
4558
|
-
* 用于在不同框架消息格式之间进行转换。
|
|
4559
|
-
* Used to convert between different framework message formats.
|
|
4560
|
-
*/
|
|
4561
|
-
interface MessageAdapter<TFrameworkMessage = unknown> {
|
|
4562
|
-
/**
|
|
4563
|
-
* 将框架消息转换为标准格式
|
|
4564
|
-
* Convert framework messages to canonical format
|
|
4565
|
-
*/
|
|
4566
|
-
toCanonical(messages: TFrameworkMessage[]): CanonicalMessage[];
|
|
4567
|
-
/**
|
|
4568
|
-
* 将标准消息转换为框架格式
|
|
4569
|
-
* Convert canonical messages to framework format
|
|
4570
|
-
*/
|
|
4571
|
-
fromCanonical(messages: CanonicalMessage[]): TFrameworkMessage[];
|
|
4572
|
-
}
|
|
4573
|
-
/**
|
|
4574
|
-
* 工具适配器接口
|
|
4575
|
-
* Tool adapter interface
|
|
4576
|
-
*
|
|
4577
|
-
* 用于将标准工具定义转换为框架特定格式。
|
|
4578
|
-
* Used to convert canonical tool definitions to framework-specific format.
|
|
4579
|
-
*/
|
|
4580
|
-
interface ToolAdapter<TFrameworkTool = unknown> {
|
|
4581
|
-
/**
|
|
4582
|
-
* 将标准工具转换为框架格式
|
|
4583
|
-
* Convert canonical tools to framework format
|
|
4584
|
-
*/
|
|
4585
|
-
fromCanonical(tools: CanonicalTool[]): TFrameworkTool[];
|
|
4586
|
-
/**
|
|
4587
|
-
* 将框架工具转换为标准格式 (可选)
|
|
4588
|
-
* Convert framework tools to canonical format (optional)
|
|
4589
|
-
*/
|
|
4590
|
-
toCanonical?(tools: TFrameworkTool[]): CanonicalTool[];
|
|
4591
|
-
}
|
|
4592
|
-
/**
|
|
4593
|
-
* 模型适配器接口
|
|
4594
|
-
* Model adapter interface
|
|
4595
|
-
*
|
|
4596
|
-
* 用于包装框架模型,使其能够与 AgentRun 协同工作。
|
|
4597
|
-
* Used to wrap framework models to work with AgentRun.
|
|
4598
|
-
*/
|
|
4599
|
-
interface ModelAdapter<TFrameworkModel = unknown> {
|
|
4600
|
-
/**
|
|
4601
|
-
* 使用 AgentRun 模型配置创建框架模型
|
|
4602
|
-
* Create framework model with AgentRun model configuration
|
|
4603
|
-
*/
|
|
4604
|
-
createModel(config: CommonModelConfig): TFrameworkModel;
|
|
4605
|
-
}
|
|
4606
|
-
/**
|
|
4607
|
-
* 框架集成适配器
|
|
4608
|
-
* Framework integration adapter
|
|
4609
|
-
*
|
|
4610
|
-
* 组合消息、工具和模型适配器的完整框架集成。
|
|
4611
|
-
* Complete framework integration combining message, tool, and model adapters.
|
|
4612
|
-
*/
|
|
4613
|
-
interface FrameworkAdapter<TMessage = unknown, TTool = unknown, TModel = unknown> {
|
|
4614
|
-
name: string;
|
|
4615
|
-
message: MessageAdapter<TMessage>;
|
|
4616
|
-
tool: ToolAdapter<TTool>;
|
|
4617
|
-
model: ModelAdapter<TModel>;
|
|
4618
|
-
}
|
|
4619
|
-
/**
|
|
4620
|
-
* 将 JSON Schema 类型转换为 TypeScript 类型
|
|
4621
|
-
* Convert JSON Schema type to TypeScript type
|
|
4622
|
-
*/
|
|
4623
|
-
declare function schemaToType(schema: Record<string, unknown>): string;
|
|
4624
|
-
|
|
4625
|
-
/**
|
|
4626
|
-
* Mastra Types
|
|
4627
|
-
*
|
|
4628
|
-
* Mastra 框架相关的类型定义。
|
|
4629
|
-
* Type definitions for Mastra framework.
|
|
4630
|
-
*/
|
|
4631
|
-
/**
|
|
4632
|
-
* Mastra 消息格式
|
|
4633
|
-
* Mastra message format
|
|
4634
|
-
*/
|
|
4635
|
-
interface MastraMessage {
|
|
4636
|
-
role: "system" | "user" | "assistant" | "tool";
|
|
4637
|
-
content: string | null;
|
|
4638
|
-
name?: string;
|
|
4639
|
-
tool_call_id?: string;
|
|
4640
|
-
tool_calls?: MastraToolCall[];
|
|
4641
|
-
}
|
|
4642
|
-
/**
|
|
4643
|
-
* Mastra 工具调用
|
|
4644
|
-
* Mastra tool call
|
|
4645
|
-
*/
|
|
4646
|
-
interface MastraToolCall {
|
|
4647
|
-
id: string;
|
|
4648
|
-
type: "function";
|
|
4649
|
-
function: {
|
|
4650
|
-
name: string;
|
|
4651
|
-
arguments: string;
|
|
4652
|
-
};
|
|
4653
|
-
}
|
|
4654
|
-
/**
|
|
4655
|
-
* Mastra 工具定义
|
|
4656
|
-
* Mastra tool definition
|
|
4657
|
-
*/
|
|
4658
|
-
interface MastraTool {
|
|
4659
|
-
name: string;
|
|
4660
|
-
description: string;
|
|
4661
|
-
inputSchema?: Record<string, unknown>;
|
|
4662
|
-
execute?: (...args: unknown[]) => Promise<unknown>;
|
|
4663
|
-
}
|
|
4664
|
-
/**
|
|
4665
|
-
* Mastra 模型配置
|
|
4666
|
-
* Mastra model configuration
|
|
4667
|
-
*/
|
|
4668
|
-
interface MastraModelConfig {
|
|
4669
|
-
provider: string;
|
|
4670
|
-
modelId: string;
|
|
4671
|
-
apiKey?: string;
|
|
4672
|
-
baseUrl?: string;
|
|
4673
|
-
temperature?: number;
|
|
4674
|
-
maxTokens?: number;
|
|
4675
|
-
}
|
|
4676
|
-
/**
|
|
4677
|
-
* Mastra Agent 配置
|
|
4678
|
-
* Mastra agent configuration
|
|
4679
|
-
*/
|
|
4680
|
-
interface MastraAgentConfig {
|
|
4681
|
-
name: string;
|
|
4682
|
-
instructions?: string;
|
|
4683
|
-
model: MastraModelConfig;
|
|
4684
|
-
tools?: MastraTool[];
|
|
4685
|
-
}
|
|
4686
|
-
|
|
4687
|
-
/**
|
|
4688
|
-
* Mastra Adapter
|
|
4689
|
-
*
|
|
4690
|
-
* Mastra 框架的集成适配器。
|
|
4691
|
-
* Integration adapter for Mastra framework.
|
|
4692
|
-
*/
|
|
4693
|
-
|
|
4694
|
-
/**
|
|
4695
|
-
* Mastra 消息适配器
|
|
4696
|
-
* Mastra message adapter
|
|
4697
|
-
*/
|
|
4698
|
-
declare class MastraMessageAdapter implements MessageAdapter<MastraMessage> {
|
|
4699
|
-
/**
|
|
4700
|
-
* 将 Mastra 消息转换为标准格式
|
|
4701
|
-
*/
|
|
4702
|
-
toCanonical(messages: MastraMessage[]): CanonicalMessage[];
|
|
4703
|
-
/**
|
|
4704
|
-
* 将标准消息转换为 Mastra 格式
|
|
4705
|
-
*/
|
|
4706
|
-
fromCanonical(messages: CanonicalMessage[]): MastraMessage[];
|
|
4707
|
-
}
|
|
4708
|
-
/**
|
|
4709
|
-
* Mastra 工具适配器
|
|
4710
|
-
* Mastra tool adapter
|
|
4711
|
-
*/
|
|
4712
|
-
declare class MastraToolAdapter implements ToolAdapter<MastraTool> {
|
|
4713
|
-
/**
|
|
4714
|
-
* 将标准工具转换为 Mastra 格式
|
|
4715
|
-
*/
|
|
4716
|
-
fromCanonical(tools: CanonicalTool[]): MastraTool[];
|
|
4717
|
-
/**
|
|
4718
|
-
* 将 Mastra 工具转换为标准格式
|
|
4719
|
-
*/
|
|
4720
|
-
toCanonical(tools: MastraTool[]): CanonicalTool[];
|
|
4721
|
-
}
|
|
4722
|
-
/**
|
|
4723
|
-
* Mastra 模型适配器
|
|
4724
|
-
* Mastra model adapter
|
|
4725
|
-
*/
|
|
4726
|
-
declare class MastraModelAdapter implements ModelAdapter<MastraModelConfig> {
|
|
4727
|
-
/**
|
|
4728
|
-
* 使用 AgentRun 配置创建 Mastra 模型配置
|
|
4729
|
-
*/
|
|
4730
|
-
createModel(config: CommonModelConfig): MastraModelConfig;
|
|
4731
|
-
/**
|
|
4732
|
-
* 检测模型提供商
|
|
4733
|
-
*/
|
|
4734
|
-
private detectProvider;
|
|
4735
|
-
}
|
|
4736
|
-
/**
|
|
4737
|
-
* Mastra 完整框架适配器
|
|
4738
|
-
* Mastra complete framework adapter
|
|
4739
|
-
*/
|
|
4740
|
-
declare class MastraAdapter implements FrameworkAdapter<MastraMessage, MastraTool, MastraModelConfig> {
|
|
4741
|
-
readonly name = "mastra";
|
|
4742
|
-
readonly message: MastraMessageAdapter;
|
|
4743
|
-
readonly tool: MastraToolAdapter;
|
|
4744
|
-
readonly model: MastraModelAdapter;
|
|
4745
|
-
}
|
|
4746
|
-
/**
|
|
4747
|
-
* 创建 Mastra 适配器实例
|
|
4748
|
-
* Create Mastra adapter instance
|
|
4749
|
-
*/
|
|
4750
|
-
declare function createMastraAdapter(): MastraAdapter;
|
|
4751
|
-
/**
|
|
4752
|
-
* 将 AgentRun 工具包装为 Mastra 工具
|
|
4753
|
-
* Wrap AgentRun tools as Mastra tools
|
|
4754
|
-
*/
|
|
4755
|
-
declare function wrapTools(tools: CanonicalTool[]): MastraTool[];
|
|
4756
|
-
/**
|
|
4757
|
-
* 将 AgentRun 模型配置转换为 Mastra 模型配置
|
|
4758
|
-
* Convert AgentRun model config to Mastra model config
|
|
4759
|
-
*/
|
|
4760
|
-
declare function wrapModel(config: CommonModelConfig): MastraModelConfig;
|
|
4761
|
-
/**
|
|
4762
|
-
* Agent 包装器配置参数
|
|
4763
|
-
* Agent wrapper configuration parameters
|
|
4764
|
-
*/
|
|
4765
|
-
interface WrapAgentParams {
|
|
4766
|
-
/** Agent 名称 */
|
|
4767
|
-
name: string;
|
|
4768
|
-
/** Agent 指令/系统提示词 */
|
|
4769
|
-
instructions?: string;
|
|
4770
|
-
/** 模型配置 */
|
|
4771
|
-
modelConfig: CommonModelConfig;
|
|
4772
|
-
/** 工具列表 */
|
|
4773
|
-
tools?: CanonicalTool[];
|
|
4774
|
-
}
|
|
4775
|
-
/**
|
|
4776
|
-
* 将 AgentRun 组件包装为完整的 Mastra Agent 配置
|
|
4777
|
-
* Wrap AgentRun components as complete Mastra agent configuration
|
|
4778
|
-
*
|
|
4779
|
-
* @param params - Agent 包装器配置参数
|
|
4780
|
-
* @returns Mastra Agent 配置对象
|
|
4781
|
-
*
|
|
4782
|
-
* @example
|
|
4783
|
-
* ```typescript
|
|
4784
|
-
* const agentConfig = wrapAgent({
|
|
4785
|
-
* name: "MyAssistant",
|
|
4786
|
-
* instructions: "You are a helpful assistant",
|
|
4787
|
-
* modelConfig: {
|
|
4788
|
-
* endpoint: "https://api.openai.com/v1",
|
|
4789
|
-
* apiKey: "sk-...",
|
|
4790
|
-
* modelName: "gpt-4"
|
|
4791
|
-
* },
|
|
4792
|
-
* tools: [calculatorTool, weatherTool]
|
|
4793
|
-
* });
|
|
4794
|
-
* ```
|
|
4795
|
-
*/
|
|
4796
|
-
declare function wrapAgent(params: WrapAgentParams): MastraAgentConfig;
|
|
4797
|
-
|
|
4798
4285
|
/**
|
|
4799
4286
|
* AgentRun SDK for Node.js
|
|
4800
4287
|
*
|
|
@@ -4806,4 +4293,4 @@ declare function wrapAgent(params: WrapAgentParams): MastraAgentConfig;
|
|
|
4806
4293
|
*/
|
|
4807
4294
|
declare const VERSION = "0.0.1";
|
|
4808
4295
|
|
|
4809
|
-
export {
|
|
4296
|
+
export { AgentRunError, AgentRuntime, AgentRuntimeArtifact, AgentRuntimeClient, type AgentRuntimeCode, type AgentRuntimeContainer, AgentRuntimeControlAPI, type AgentRuntimeCreateInput, AgentRuntimeEndpoint, type AgentRuntimeEndpointCreateInput, type AgentRuntimeEndpointListInput, type AgentRuntimeEndpointRoutingConfig, type AgentRuntimeEndpointRoutingWeight, type AgentRuntimeEndpointUpdateInput, type AgentRuntimeHealthCheckConfig, AgentRuntimeLanguage, type AgentRuntimeListInput, type AgentRuntimeLogConfig, type AgentRuntimeProtocolConfig, AgentRuntimeProtocolType, type AgentRuntimeUpdateInput, type AgentRuntimeVersion, AioDataAPI, AioSandbox, BackendType, BrowserDataAPI, BrowserSandbox, ClientError, CodeInterpreterDataAPI, CodeInterpreterSandbox, CodeLanguage, Config, type ConfigOptions, Credential, type CredentialBasicAuth, CredentialClient, CredentialConfig, CredentialControlAPI, type CredentialCreateInput, type CredentialListInput, type CredentialUpdateInput, type ExecuteCodeResult, type FileInfo, HTTPError, type MCPToolMeta, ModelClient, ControlAPI as ModelControlAPI, type ModelFeatures, type ModelInfoConfig, type ModelParameterRule, type ModelProperties, ModelProxy, type ModelProxyCreateInput, type ModelProxyListInput, type ModelProxyUpdateInput, ModelService, type ModelServiceCreateInput, type ModelServiceListInput, type ModelServiceUpdateInput, ModelType, Provider, type ProviderSettings, type ProxyConfig, type ProxyConfigEndpoint, type ProxyConfigFallback, type ProxyConfigPolicies, type RelatedResource, ResourceAlreadyExistError, ResourceNotExistError, Sandbox, SandboxClient, type SandboxCreateInput, type SandboxData, SandboxDataAPI, type SandboxListInput, SandboxState, ServerError, Status, Template, type TemplateArmsConfiguration, type TemplateContainerConfiguration, type TemplateCreateInput, type TemplateCredentialConfiguration, type TemplateData, type TemplateListInput, type TemplateLogConfiguration, type TemplateMcpOptions, type TemplateMcpState, type TemplateNetworkConfiguration, TemplateNetworkMode, TemplateOSSPermission, type TemplateOssConfiguration, TemplateType, type TemplateUpdateInput, ToolSet, type ToolSetAuthorization, ToolSetClient, type ToolSetCreateInput, type ToolSetData, type ToolSetListInput, type ToolSetSchema, ToolSetSchemaType, type ToolSetSpec, type ToolSetStatus, type ToolSetStatusOutputs, type ToolSetUpdateInput, VERSION };
|