@aigne/transport 0.5.2 → 0.6.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.6.1](https://github.com/AIGNE-io/aigne-framework/compare/transport-v0.6.0...transport-v0.6.1) (2025-06-26)
4
+
5
+
6
+ ### Dependencies
7
+
8
+ * The following workspace dependencies were updated
9
+ * dependencies
10
+ * @aigne/openai bumped to 0.4.1
11
+ * devDependencies
12
+ * @aigne/agent-library bumped to 1.17.1
13
+ * @aigne/core bumped to 1.24.1
14
+ * @aigne/test-utils bumped to 0.4.8
15
+
16
+ ## [0.6.0](https://github.com/AIGNE-io/aigne-framework/compare/transport-v0.5.2...transport-v0.6.0) (2025-06-26)
17
+
18
+
19
+ ### Features
20
+
21
+ * **transport:** support invoke server side chat model ([#182](https://github.com/AIGNE-io/aigne-framework/issues/182)) ([f81a1bf](https://github.com/AIGNE-io/aigne-framework/commit/f81a1bf883abda1845ccee09b270e5f583e287ab))
22
+
23
+
24
+ ### Dependencies
25
+
26
+ * The following workspace dependencies were updated
27
+ * dependencies
28
+ * @aigne/openai bumped to 0.4.0
29
+ * devDependencies
30
+ * @aigne/agent-library bumped to 1.17.0
31
+ * @aigne/core bumped to 1.24.0
32
+ * @aigne/test-utils bumped to 0.4.7
33
+
3
34
  ## [0.5.2](https://github.com/AIGNE-io/aigne-framework/compare/transport-v0.5.1...transport-v0.5.2) (2025-06-25)
4
35
 
5
36
 
@@ -0,0 +1 @@
1
+ export declare const ChatModelName = "$CHAT_MODEL";
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChatModelName = void 0;
4
+ exports.ChatModelName = "$CHAT_MODEL";
@@ -0,0 +1,9 @@
1
+ import { type AgentInvokeOptions, type AgentProcessResult, ChatModel, type ChatModelInput, type ChatModelOutput } from "@aigne/core";
2
+ import type { PromiseOrValue } from "@aigne/core/utils/type-utils.js";
3
+ import type { AIGNEHTTPClient } from "./client.js";
4
+ export declare class ClientChatModel extends ChatModel {
5
+ client: AIGNEHTTPClient;
6
+ constructor(client: AIGNEHTTPClient);
7
+ name: string;
8
+ process(input: ChatModelInput, options: AgentInvokeOptions): PromiseOrValue<AgentProcessResult<ChatModelOutput>>;
9
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientChatModel = void 0;
4
+ const core_1 = require("@aigne/core");
5
+ const constants_js_1 = require("../constants.js");
6
+ class ClientChatModel extends core_1.ChatModel {
7
+ client;
8
+ constructor(client) {
9
+ super();
10
+ this.client = client;
11
+ }
12
+ name = constants_js_1.ChatModelName;
13
+ process(input, options) {
14
+ return this.client._invoke(this.name, input, options);
15
+ }
16
+ }
17
+ exports.ClientChatModel = ClientChatModel;
@@ -1,6 +1,7 @@
1
1
  import { type Agent, type AgentResponse, type AgentResponseStream, type Context, type ContextEmitEventMap, type ContextEventMap, type ContextUsage, type InvokeOptions, type Message, type MessagePayload, type MessageQueueListener, type Unsubscribe, type UserAgent, type UserContext } from "@aigne/core";
2
2
  import type { Args, Listener } from "@aigne/core/utils/typed-event-emtter.js";
3
3
  import { ClientAgent, type ClientAgentOptions } from "./client-agent.js";
4
+ import { ClientChatModel } from "./client-chat-model.js";
4
5
  /**
5
6
  * Configuration options for the AIGNEHTTPClient.
6
7
  */
@@ -48,6 +49,7 @@ export declare class AIGNEHTTPClient<U extends UserContext = UserContext> implem
48
49
  usage: ContextUsage;
49
50
  userContext: U;
50
51
  memories: Context["memories"];
52
+ model: ClientChatModel;
51
53
  invoke<I extends Message, O extends Message>(agent: Agent<I, O> | string): UserAgent<I, O>;
52
54
  invoke<I extends Message, O extends Message>(agent: Agent<I, O> | string, message: I, options: AIGNEHTTPClientInvokeOptions & {
53
55
  returnActiveAgent: true;
@@ -6,6 +6,7 @@ const event_stream_js_1 = require("@aigne/core/utils/event-stream.js");
6
6
  const type_utils_js_1 = require("@aigne/core/utils/type-utils.js");
7
7
  const uuid_1 = require("uuid");
8
8
  const client_agent_js_1 = require("./client-agent.js");
9
+ const client_chat_model_js_1 = require("./client-chat-model.js");
9
10
  /**
10
11
  * Http client for interacting with a remote AIGNE server.
11
12
  * AIGNEHTTPClient provides a client-side interface that matches the AIGNE API,
@@ -34,37 +35,43 @@ class AIGNEHTTPClient {
34
35
  usage = (0, core_1.newEmptyContextUsage)();
35
36
  userContext = {};
36
37
  memories = [];
38
+ model = new client_chat_model_js_1.ClientChatModel(this);
37
39
  invoke(agent, message, options) {
38
40
  if (options?.returnActiveAgent)
39
41
  throw new Error("Method not implemented.");
40
42
  if (!message)
41
43
  throw new Error("Message is required for invoking an agent");
42
44
  const a = typeof agent === "string" ? this.getAgent({ name: agent }) : Promise.resolve(agent);
43
- return a.then((agent) => agent.invoke(message, options));
45
+ return a.then((agent) => agent.invoke(message, { ...options, context: this }));
44
46
  }
45
47
  publish(_topic, _payload, _options) {
46
- throw new Error("Method not implemented.");
48
+ console.error("Method not implemented.");
47
49
  }
48
50
  subscribe(_topic, _listener) {
49
- throw new Error("Method not implemented.");
51
+ console.error("Method not implemented.");
52
+ return () => { };
50
53
  }
51
54
  unsubscribe(_topic, _listener) {
52
- throw new Error("Method not implemented.");
55
+ console.error("Method not implemented.");
53
56
  }
54
57
  newContext(_options) {
55
58
  throw new Error("Method not implemented.");
56
59
  }
57
60
  emit(_eventName, ..._args) {
58
- throw new Error("Method not implemented.");
61
+ console.error("Method not implemented.");
62
+ return false;
59
63
  }
60
64
  on(_eventName, _listener) {
61
- throw new Error("Method not implemented.");
65
+ console.error("Method not implemented.");
66
+ return this;
62
67
  }
63
68
  once(_eventName, _listener) {
64
- throw new Error("Method not implemented.");
69
+ console.error("Method not implemented.");
70
+ return this;
65
71
  }
66
72
  off(_eventName, _listener) {
67
- throw new Error("Method not implemented.");
73
+ console.error("Method not implemented.");
74
+ return this;
68
75
  }
69
76
  async _invoke(agent, input, options) {
70
77
  // Send the agent invocation request to the AIGNE server
@@ -75,7 +82,7 @@ class AIGNEHTTPClient {
75
82
  "Content-Type": "application/json",
76
83
  ...options?.fetchOptions?.headers,
77
84
  },
78
- body: JSON.stringify({ agent, input, options }),
85
+ body: JSON.stringify({ agent, input, options: options && (0, type_utils_js_1.omit)(options, "context") }),
79
86
  });
80
87
  // For non-streaming responses, simply parse the JSON response and return it
81
88
  if (!options?.streaming) {
@@ -26,54 +26,54 @@ export declare const invokePayloadSchema: z.ZodObject<{
26
26
  content: object;
27
27
  }[] | null | undefined>;
28
28
  }, "strip", z.ZodTypeAny, {
29
- streaming?: boolean | undefined;
30
- userContext?: Record<string, unknown> | undefined;
31
29
  memories?: {
32
30
  content: object;
33
31
  }[] | undefined;
32
+ streaming?: boolean | undefined;
33
+ userContext?: Record<string, unknown> | undefined;
34
34
  returnProgressChunks?: boolean | undefined;
35
35
  }, {
36
- streaming?: boolean | null | undefined;
37
- userContext?: Record<string, unknown> | null | undefined;
38
36
  memories?: {
39
37
  content: object;
40
38
  }[] | null | undefined;
39
+ streaming?: boolean | null | undefined;
40
+ userContext?: Record<string, unknown> | null | undefined;
41
41
  returnProgressChunks?: boolean | null | undefined;
42
42
  }>>>, {
43
- streaming?: boolean | undefined;
44
- userContext?: Record<string, unknown> | undefined;
45
43
  memories?: {
46
44
  content: object;
47
45
  }[] | undefined;
46
+ streaming?: boolean | undefined;
47
+ userContext?: Record<string, unknown> | undefined;
48
48
  returnProgressChunks?: boolean | undefined;
49
49
  } | undefined, {
50
- streaming?: boolean | null | undefined;
51
- userContext?: Record<string, unknown> | null | undefined;
52
50
  memories?: {
53
51
  content: object;
54
52
  }[] | null | undefined;
53
+ streaming?: boolean | null | undefined;
54
+ userContext?: Record<string, unknown> | null | undefined;
55
55
  returnProgressChunks?: boolean | null | undefined;
56
56
  } | null | undefined>;
57
57
  }, "strip", z.ZodTypeAny, {
58
58
  agent: string;
59
59
  input: Record<string, unknown>;
60
60
  options?: {
61
- streaming?: boolean | undefined;
62
- userContext?: Record<string, unknown> | undefined;
63
61
  memories?: {
64
62
  content: object;
65
63
  }[] | undefined;
64
+ streaming?: boolean | undefined;
65
+ userContext?: Record<string, unknown> | undefined;
66
66
  returnProgressChunks?: boolean | undefined;
67
67
  } | undefined;
68
68
  }, {
69
69
  agent: string;
70
70
  input: Record<string, unknown>;
71
71
  options?: {
72
- streaming?: boolean | null | undefined;
73
- userContext?: Record<string, unknown> | null | undefined;
74
72
  memories?: {
75
73
  content: object;
76
74
  }[] | null | undefined;
75
+ streaming?: boolean | null | undefined;
76
+ userContext?: Record<string, unknown> | null | undefined;
77
77
  returnProgressChunks?: boolean | null | undefined;
78
78
  } | null | undefined;
79
79
  }>;
@@ -10,6 +10,7 @@ const type_utils_js_1 = require("@aigne/core/utils/type-utils.js");
10
10
  const content_type_1 = __importDefault(require("content-type"));
11
11
  const raw_body_1 = __importDefault(require("raw-body"));
12
12
  const zod_1 = require("zod");
13
+ const constants_js_1 = require("../constants.js");
13
14
  const error_js_1 = require("./error.js");
14
15
  /**
15
16
  * Default maximum allowed size for request bodies when parsing raw HTTP requests.
@@ -103,7 +104,7 @@ class AIGNEHTTPServer {
103
104
  try {
104
105
  const payload = await this._prepareInput(request);
105
106
  const { agent: agentName, input, options: { streaming, ...opts } = {}, } = (0, type_utils_js_1.tryOrThrow)(() => (0, type_utils_js_1.checkArguments)(`Invoke agent ${payload.agent}`, exports.invokePayloadSchema, payload), (error) => new error_js_1.ServerError(400, error.message));
106
- const agent = aigne.agents[agentName];
107
+ const agent = agentName === constants_js_1.ChatModelName ? aigne.model : aigne.agents[agentName];
107
108
  if (!agent)
108
109
  throw new error_js_1.ServerError(404, `Agent ${agentName} not found`);
109
110
  const mergedOptions = {
@@ -0,0 +1 @@
1
+ export declare const ChatModelName = "$CHAT_MODEL";
@@ -0,0 +1,9 @@
1
+ import { type AgentInvokeOptions, type AgentProcessResult, ChatModel, type ChatModelInput, type ChatModelOutput } from "@aigne/core";
2
+ import type { PromiseOrValue } from "@aigne/core/utils/type-utils.js";
3
+ import type { AIGNEHTTPClient } from "./client.js";
4
+ export declare class ClientChatModel extends ChatModel {
5
+ client: AIGNEHTTPClient;
6
+ constructor(client: AIGNEHTTPClient);
7
+ name: string;
8
+ process(input: ChatModelInput, options: AgentInvokeOptions): PromiseOrValue<AgentProcessResult<ChatModelOutput>>;
9
+ }
@@ -1,6 +1,7 @@
1
1
  import { type Agent, type AgentResponse, type AgentResponseStream, type Context, type ContextEmitEventMap, type ContextEventMap, type ContextUsage, type InvokeOptions, type Message, type MessagePayload, type MessageQueueListener, type Unsubscribe, type UserAgent, type UserContext } from "@aigne/core";
2
2
  import type { Args, Listener } from "@aigne/core/utils/typed-event-emtter.js";
3
3
  import { ClientAgent, type ClientAgentOptions } from "./client-agent.js";
4
+ import { ClientChatModel } from "./client-chat-model.js";
4
5
  /**
5
6
  * Configuration options for the AIGNEHTTPClient.
6
7
  */
@@ -48,6 +49,7 @@ export declare class AIGNEHTTPClient<U extends UserContext = UserContext> implem
48
49
  usage: ContextUsage;
49
50
  userContext: U;
50
51
  memories: Context["memories"];
52
+ model: ClientChatModel;
51
53
  invoke<I extends Message, O extends Message>(agent: Agent<I, O> | string): UserAgent<I, O>;
52
54
  invoke<I extends Message, O extends Message>(agent: Agent<I, O> | string, message: I, options: AIGNEHTTPClientInvokeOptions & {
53
55
  returnActiveAgent: true;
@@ -26,54 +26,54 @@ export declare const invokePayloadSchema: z.ZodObject<{
26
26
  content: object;
27
27
  }[] | null | undefined>;
28
28
  }, "strip", z.ZodTypeAny, {
29
- streaming?: boolean | undefined;
30
- userContext?: Record<string, unknown> | undefined;
31
29
  memories?: {
32
30
  content: object;
33
31
  }[] | undefined;
32
+ streaming?: boolean | undefined;
33
+ userContext?: Record<string, unknown> | undefined;
34
34
  returnProgressChunks?: boolean | undefined;
35
35
  }, {
36
- streaming?: boolean | null | undefined;
37
- userContext?: Record<string, unknown> | null | undefined;
38
36
  memories?: {
39
37
  content: object;
40
38
  }[] | null | undefined;
39
+ streaming?: boolean | null | undefined;
40
+ userContext?: Record<string, unknown> | null | undefined;
41
41
  returnProgressChunks?: boolean | null | undefined;
42
42
  }>>>, {
43
- streaming?: boolean | undefined;
44
- userContext?: Record<string, unknown> | undefined;
45
43
  memories?: {
46
44
  content: object;
47
45
  }[] | undefined;
46
+ streaming?: boolean | undefined;
47
+ userContext?: Record<string, unknown> | undefined;
48
48
  returnProgressChunks?: boolean | undefined;
49
49
  } | undefined, {
50
- streaming?: boolean | null | undefined;
51
- userContext?: Record<string, unknown> | null | undefined;
52
50
  memories?: {
53
51
  content: object;
54
52
  }[] | null | undefined;
53
+ streaming?: boolean | null | undefined;
54
+ userContext?: Record<string, unknown> | null | undefined;
55
55
  returnProgressChunks?: boolean | null | undefined;
56
56
  } | null | undefined>;
57
57
  }, "strip", z.ZodTypeAny, {
58
58
  agent: string;
59
59
  input: Record<string, unknown>;
60
60
  options?: {
61
- streaming?: boolean | undefined;
62
- userContext?: Record<string, unknown> | undefined;
63
61
  memories?: {
64
62
  content: object;
65
63
  }[] | undefined;
64
+ streaming?: boolean | undefined;
65
+ userContext?: Record<string, unknown> | undefined;
66
66
  returnProgressChunks?: boolean | undefined;
67
67
  } | undefined;
68
68
  }, {
69
69
  agent: string;
70
70
  input: Record<string, unknown>;
71
71
  options?: {
72
- streaming?: boolean | null | undefined;
73
- userContext?: Record<string, unknown> | null | undefined;
74
72
  memories?: {
75
73
  content: object;
76
74
  }[] | null | undefined;
75
+ streaming?: boolean | null | undefined;
76
+ userContext?: Record<string, unknown> | null | undefined;
77
77
  returnProgressChunks?: boolean | null | undefined;
78
78
  } | null | undefined;
79
79
  }>;
@@ -0,0 +1 @@
1
+ export declare const ChatModelName = "$CHAT_MODEL";
@@ -0,0 +1 @@
1
+ export const ChatModelName = "$CHAT_MODEL";
@@ -0,0 +1,9 @@
1
+ import { type AgentInvokeOptions, type AgentProcessResult, ChatModel, type ChatModelInput, type ChatModelOutput } from "@aigne/core";
2
+ import type { PromiseOrValue } from "@aigne/core/utils/type-utils.js";
3
+ import type { AIGNEHTTPClient } from "./client.js";
4
+ export declare class ClientChatModel extends ChatModel {
5
+ client: AIGNEHTTPClient;
6
+ constructor(client: AIGNEHTTPClient);
7
+ name: string;
8
+ process(input: ChatModelInput, options: AgentInvokeOptions): PromiseOrValue<AgentProcessResult<ChatModelOutput>>;
9
+ }
@@ -0,0 +1,13 @@
1
+ import { ChatModel, } from "@aigne/core";
2
+ import { ChatModelName } from "../constants.js";
3
+ export class ClientChatModel extends ChatModel {
4
+ client;
5
+ constructor(client) {
6
+ super();
7
+ this.client = client;
8
+ }
9
+ name = ChatModelName;
10
+ process(input, options) {
11
+ return this.client._invoke(this.name, input, options);
12
+ }
13
+ }
@@ -1,6 +1,7 @@
1
1
  import { type Agent, type AgentResponse, type AgentResponseStream, type Context, type ContextEmitEventMap, type ContextEventMap, type ContextUsage, type InvokeOptions, type Message, type MessagePayload, type MessageQueueListener, type Unsubscribe, type UserAgent, type UserContext } from "@aigne/core";
2
2
  import type { Args, Listener } from "@aigne/core/utils/typed-event-emtter.js";
3
3
  import { ClientAgent, type ClientAgentOptions } from "./client-agent.js";
4
+ import { ClientChatModel } from "./client-chat-model.js";
4
5
  /**
5
6
  * Configuration options for the AIGNEHTTPClient.
6
7
  */
@@ -48,6 +49,7 @@ export declare class AIGNEHTTPClient<U extends UserContext = UserContext> implem
48
49
  usage: ContextUsage;
49
50
  userContext: U;
50
51
  memories: Context["memories"];
52
+ model: ClientChatModel;
51
53
  invoke<I extends Message, O extends Message>(agent: Agent<I, O> | string): UserAgent<I, O>;
52
54
  invoke<I extends Message, O extends Message>(agent: Agent<I, O> | string, message: I, options: AIGNEHTTPClientInvokeOptions & {
53
55
  returnActiveAgent: true;
@@ -1,8 +1,9 @@
1
1
  import { newEmptyContextUsage, } from "@aigne/core";
2
2
  import { AgentResponseStreamParser, EventStreamParser } from "@aigne/core/utils/event-stream.js";
3
- import { tryOrThrow } from "@aigne/core/utils/type-utils.js";
3
+ import { omit, tryOrThrow } from "@aigne/core/utils/type-utils.js";
4
4
  import { v7 } from "uuid";
5
5
  import { ClientAgent } from "./client-agent.js";
6
+ import { ClientChatModel } from "./client-chat-model.js";
6
7
  /**
7
8
  * Http client for interacting with a remote AIGNE server.
8
9
  * AIGNEHTTPClient provides a client-side interface that matches the AIGNE API,
@@ -31,37 +32,43 @@ export class AIGNEHTTPClient {
31
32
  usage = newEmptyContextUsage();
32
33
  userContext = {};
33
34
  memories = [];
35
+ model = new ClientChatModel(this);
34
36
  invoke(agent, message, options) {
35
37
  if (options?.returnActiveAgent)
36
38
  throw new Error("Method not implemented.");
37
39
  if (!message)
38
40
  throw new Error("Message is required for invoking an agent");
39
41
  const a = typeof agent === "string" ? this.getAgent({ name: agent }) : Promise.resolve(agent);
40
- return a.then((agent) => agent.invoke(message, options));
42
+ return a.then((agent) => agent.invoke(message, { ...options, context: this }));
41
43
  }
42
44
  publish(_topic, _payload, _options) {
43
- throw new Error("Method not implemented.");
45
+ console.error("Method not implemented.");
44
46
  }
45
47
  subscribe(_topic, _listener) {
46
- throw new Error("Method not implemented.");
48
+ console.error("Method not implemented.");
49
+ return () => { };
47
50
  }
48
51
  unsubscribe(_topic, _listener) {
49
- throw new Error("Method not implemented.");
52
+ console.error("Method not implemented.");
50
53
  }
51
54
  newContext(_options) {
52
55
  throw new Error("Method not implemented.");
53
56
  }
54
57
  emit(_eventName, ..._args) {
55
- throw new Error("Method not implemented.");
58
+ console.error("Method not implemented.");
59
+ return false;
56
60
  }
57
61
  on(_eventName, _listener) {
58
- throw new Error("Method not implemented.");
62
+ console.error("Method not implemented.");
63
+ return this;
59
64
  }
60
65
  once(_eventName, _listener) {
61
- throw new Error("Method not implemented.");
66
+ console.error("Method not implemented.");
67
+ return this;
62
68
  }
63
69
  off(_eventName, _listener) {
64
- throw new Error("Method not implemented.");
70
+ console.error("Method not implemented.");
71
+ return this;
65
72
  }
66
73
  async _invoke(agent, input, options) {
67
74
  // Send the agent invocation request to the AIGNE server
@@ -72,7 +79,7 @@ export class AIGNEHTTPClient {
72
79
  "Content-Type": "application/json",
73
80
  ...options?.fetchOptions?.headers,
74
81
  },
75
- body: JSON.stringify({ agent, input, options }),
82
+ body: JSON.stringify({ agent, input, options: options && omit(options, "context") }),
76
83
  });
77
84
  // For non-streaming responses, simply parse the JSON response and return it
78
85
  if (!options?.streaming) {
@@ -26,54 +26,54 @@ export declare const invokePayloadSchema: z.ZodObject<{
26
26
  content: object;
27
27
  }[] | null | undefined>;
28
28
  }, "strip", z.ZodTypeAny, {
29
- streaming?: boolean | undefined;
30
- userContext?: Record<string, unknown> | undefined;
31
29
  memories?: {
32
30
  content: object;
33
31
  }[] | undefined;
32
+ streaming?: boolean | undefined;
33
+ userContext?: Record<string, unknown> | undefined;
34
34
  returnProgressChunks?: boolean | undefined;
35
35
  }, {
36
- streaming?: boolean | null | undefined;
37
- userContext?: Record<string, unknown> | null | undefined;
38
36
  memories?: {
39
37
  content: object;
40
38
  }[] | null | undefined;
39
+ streaming?: boolean | null | undefined;
40
+ userContext?: Record<string, unknown> | null | undefined;
41
41
  returnProgressChunks?: boolean | null | undefined;
42
42
  }>>>, {
43
- streaming?: boolean | undefined;
44
- userContext?: Record<string, unknown> | undefined;
45
43
  memories?: {
46
44
  content: object;
47
45
  }[] | undefined;
46
+ streaming?: boolean | undefined;
47
+ userContext?: Record<string, unknown> | undefined;
48
48
  returnProgressChunks?: boolean | undefined;
49
49
  } | undefined, {
50
- streaming?: boolean | null | undefined;
51
- userContext?: Record<string, unknown> | null | undefined;
52
50
  memories?: {
53
51
  content: object;
54
52
  }[] | null | undefined;
53
+ streaming?: boolean | null | undefined;
54
+ userContext?: Record<string, unknown> | null | undefined;
55
55
  returnProgressChunks?: boolean | null | undefined;
56
56
  } | null | undefined>;
57
57
  }, "strip", z.ZodTypeAny, {
58
58
  agent: string;
59
59
  input: Record<string, unknown>;
60
60
  options?: {
61
- streaming?: boolean | undefined;
62
- userContext?: Record<string, unknown> | undefined;
63
61
  memories?: {
64
62
  content: object;
65
63
  }[] | undefined;
64
+ streaming?: boolean | undefined;
65
+ userContext?: Record<string, unknown> | undefined;
66
66
  returnProgressChunks?: boolean | undefined;
67
67
  } | undefined;
68
68
  }, {
69
69
  agent: string;
70
70
  input: Record<string, unknown>;
71
71
  options?: {
72
- streaming?: boolean | null | undefined;
73
- userContext?: Record<string, unknown> | null | undefined;
74
72
  memories?: {
75
73
  content: object;
76
74
  }[] | null | undefined;
75
+ streaming?: boolean | null | undefined;
76
+ userContext?: Record<string, unknown> | null | undefined;
77
77
  returnProgressChunks?: boolean | null | undefined;
78
78
  } | null | undefined;
79
79
  }>;
@@ -4,6 +4,7 @@ import { checkArguments, isRecord, tryOrThrow } from "@aigne/core/utils/type-uti
4
4
  import contentType from "content-type";
5
5
  import getRawBody from "raw-body";
6
6
  import { z } from "zod";
7
+ import { ChatModelName } from "../constants.js";
7
8
  import { ServerError } from "./error.js";
8
9
  /**
9
10
  * Default maximum allowed size for request bodies when parsing raw HTTP requests.
@@ -97,7 +98,7 @@ export class AIGNEHTTPServer {
97
98
  try {
98
99
  const payload = await this._prepareInput(request);
99
100
  const { agent: agentName, input, options: { streaming, ...opts } = {}, } = tryOrThrow(() => checkArguments(`Invoke agent ${payload.agent}`, invokePayloadSchema, payload), (error) => new ServerError(400, error.message));
100
- const agent = aigne.agents[agentName];
101
+ const agent = agentName === ChatModelName ? aigne.model : aigne.agents[agentName];
101
102
  if (!agent)
102
103
  throw new ServerError(404, `Agent ${agentName} not found`);
103
104
  const mergedOptions = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/transport",
3
- "version": "0.5.2",
3
+ "version": "0.6.1",
4
4
  "description": "AIGNE Transport SDK providing HTTP client and server implementations for communication between AIGNE components",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -39,7 +39,7 @@
39
39
  }
40
40
  },
41
41
  "dependencies": {
42
- "@aigne/openai": "^0.3.6"
42
+ "@aigne/openai": "^0.4.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/bun": "^1.2.12",
@@ -54,9 +54,9 @@
54
54
  "rimraf": "^6.0.1",
55
55
  "typescript": "^5.8.3",
56
56
  "uuid": "^11.1.0",
57
- "@aigne/agent-library": "^1.16.1",
58
- "@aigne/core": "^1.23.1",
59
- "@aigne/test-utils": "^0.4.6"
57
+ "@aigne/agent-library": "^1.17.1",
58
+ "@aigne/core": "^1.24.1",
59
+ "@aigne/test-utils": "^0.4.8"
60
60
  },
61
61
  "scripts": {
62
62
  "lint": "tsc --noEmit",