@agentica/core 0.27.2 → 0.28.0
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 +17 -2
- package/lib/Agentica.d.ts +2 -1
- package/lib/Agentica.js +92 -60
- package/lib/Agentica.js.map +1 -1
- package/lib/MicroAgentica.d.ts +1 -0
- package/lib/MicroAgentica.js +88 -60
- package/lib/MicroAgentica.js.map +1 -1
- package/lib/constants/AgenticaDefaultPrompt.js +2 -18
- package/lib/constants/AgenticaDefaultPrompt.js.map +1 -1
- package/lib/context/AgenticaContext.d.ts +1 -1
- package/lib/context/MicroAgenticaContext.d.ts +2 -2
- package/lib/context/internal/AgenticaOperationComposer.spec.js +0 -2
- package/lib/context/internal/AgenticaOperationComposer.spec.js.map +1 -1
- package/lib/events/AgenticaEventBase.d.ts +9 -0
- package/lib/factory/events.d.ts +1 -2
- package/lib/factory/events.js +71 -7
- package/lib/factory/events.js.map +1 -1
- package/lib/factory/histories.js +27 -9
- package/lib/factory/histories.js.map +1 -1
- package/lib/functional/assertMcpController.d.ts +1 -1
- package/lib/functional/assertMcpController.js.map +1 -1
- package/lib/functional/validateMcpController.d.ts +1 -1
- package/lib/functional/validateMcpController.js.map +1 -1
- package/lib/histories/AgenticaCancelHistory.d.ts +1 -2
- package/lib/histories/AgenticaExecuteHistory.d.ts +0 -4
- package/lib/histories/AgenticaHistoryBase.d.ts +9 -0
- package/lib/histories/AgenticaSelectHistory.d.ts +1 -2
- package/lib/index.mjs +413 -380
- package/lib/index.mjs.map +1 -1
- package/lib/json/IAgenticaEventJson.d.ts +9 -1
- package/lib/json/IAgenticaHistoryJson.d.ts +11 -14
- package/lib/orchestrate/call.d.ts +2 -2
- package/lib/orchestrate/call.js +41 -70
- package/lib/orchestrate/call.js.map +1 -1
- package/lib/orchestrate/cancel.d.ts +1 -2
- package/lib/orchestrate/cancel.js +13 -38
- package/lib/orchestrate/cancel.js.map +1 -1
- package/lib/orchestrate/describe.d.ts +1 -2
- package/lib/orchestrate/describe.js +5 -17
- package/lib/orchestrate/describe.js.map +1 -1
- package/lib/orchestrate/execute.d.ts +1 -2
- package/lib/orchestrate/execute.js +9 -13
- package/lib/orchestrate/execute.js.map +1 -1
- package/lib/orchestrate/initialize.d.ts +1 -2
- package/lib/orchestrate/initialize.js +3 -11
- package/lib/orchestrate/initialize.js.map +1 -1
- package/lib/orchestrate/internal/{cancelFunction.js → cancelFunctionFromContext.js} +7 -7
- package/lib/orchestrate/internal/cancelFunctionFromContext.js.map +1 -0
- package/lib/orchestrate/internal/selectFunctionFromContext.js +24 -0
- package/lib/orchestrate/internal/selectFunctionFromContext.js.map +1 -0
- package/lib/orchestrate/select.d.ts +1 -2
- package/lib/orchestrate/select.js +20 -51
- package/lib/orchestrate/select.js.map +1 -1
- package/lib/structures/IAgenticaConfig.d.ts +1 -3
- package/lib/structures/IAgenticaController.d.ts +123 -88
- package/lib/structures/IAgenticaExecutor.d.ts +6 -7
- package/lib/structures/IAgenticaVendor.d.ts +14 -0
- package/lib/structures/IMicroAgenticaExecutor.d.ts +2 -3
- package/lib/transformers/transformHistory.js +13 -8
- package/lib/transformers/transformHistory.js.map +1 -1
- package/lib/utils/ChatGptCompletionMessageUtil.js +3 -3
- package/package.json +13 -11
- package/src/Agentica.ts +127 -87
- package/src/MicroAgentica.ts +118 -81
- package/src/constants/AgenticaDefaultPrompt.ts +3 -20
- package/src/context/AgenticaContext.ts +1 -1
- package/src/context/MicroAgenticaContext.ts +2 -2
- package/src/context/internal/AgenticaOperationComposer.spec.ts +1 -2
- package/src/events/AgenticaEventBase.ts +12 -0
- package/src/factory/events.ts +78 -8
- package/src/factory/histories.ts +41 -11
- package/src/functional/assertMcpController.ts +1 -4
- package/src/functional/validateMcpController.ts +1 -4
- package/src/histories/AgenticaCancelHistory.ts +1 -2
- package/src/histories/AgenticaExecuteHistory.ts +0 -5
- package/src/histories/AgenticaHistoryBase.ts +12 -0
- package/src/histories/AgenticaSelectHistory.ts +1 -2
- package/src/json/IAgenticaEventJson.ts +11 -1
- package/src/json/IAgenticaHistoryJson.ts +14 -17
- package/src/orchestrate/call.ts +57 -107
- package/src/orchestrate/cancel.ts +76 -99
- package/src/orchestrate/describe.ts +16 -36
- package/src/orchestrate/execute.ts +17 -37
- package/src/orchestrate/initialize.ts +36 -49
- package/src/orchestrate/internal/{cancelFunction.ts → cancelFunctionFromContext.ts} +11 -11
- package/src/orchestrate/internal/{selectFunction.ts → selectFunctionFromContext.ts} +18 -13
- package/src/orchestrate/select.ts +112 -151
- package/src/structures/IAgenticaConfig.ts +1 -3
- package/src/structures/IAgenticaController.ts +4 -0
- package/src/structures/IAgenticaExecutor.ts +10 -8
- package/src/structures/IAgenticaVendor.ts +15 -0
- package/src/structures/IMicroAgenticaExecutor.ts +2 -3
- package/src/transformers/transformHistory.ts +19 -20
- package/lib/orchestrate/internal/cancelFunction.js.map +0 -1
- package/lib/orchestrate/internal/selectFunction.js +0 -35
- package/lib/orchestrate/internal/selectFunction.js.map +0 -1
- /package/lib/orchestrate/internal/{cancelFunction.d.ts → cancelFunctionFromContext.d.ts} +0 -0
- /package/lib/orchestrate/internal/{selectFunction.d.ts → selectFunctionFromContext.d.ts} +0 -0
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
IHttpConnection,
|
|
3
|
+
IHttpLlmApplication,
|
|
4
|
+
IHttpLlmFunction,
|
|
5
|
+
IHttpResponse,
|
|
6
|
+
ILlmApplication,
|
|
7
|
+
ILlmFunction,
|
|
8
|
+
ILlmSchema,
|
|
9
|
+
IMcpLlmApplication,
|
|
10
|
+
} from "@samchon/openapi";
|
|
11
|
+
|
|
2
12
|
/**
|
|
3
13
|
* Controller of the Agentica Agent.
|
|
4
14
|
*
|
|
@@ -15,105 +25,130 @@ import type { IHttpConnection, IHttpLlmApplication, IHttpLlmFunction, IHttpRespo
|
|
|
15
25
|
*
|
|
16
26
|
* @author Samchon
|
|
17
27
|
*/
|
|
18
|
-
export type IAgenticaController<Model extends ILlmSchema.Model> =
|
|
19
|
-
|
|
28
|
+
export type IAgenticaController<Model extends ILlmSchema.Model> =
|
|
29
|
+
| IAgenticaController.IHttp<Model>
|
|
30
|
+
| IAgenticaController.IClass<Model>
|
|
31
|
+
| IAgenticaController.IMcp<Model>;
|
|
32
|
+
|
|
33
|
+
export namespace IAgenticaController {
|
|
34
|
+
/**
|
|
35
|
+
* HTTP controller.
|
|
36
|
+
*
|
|
37
|
+
* You can make it by {@link validateHttpLlmApplication} function with
|
|
38
|
+
* the Swagger or OpenAPI document.
|
|
39
|
+
*/
|
|
40
|
+
export interface IHttp<Model extends ILlmSchema.Model>
|
|
41
|
+
extends IBase<"http", IHttpLlmApplication<Model>> {
|
|
20
42
|
/**
|
|
21
|
-
*
|
|
43
|
+
* Connection to the server.
|
|
22
44
|
*
|
|
23
|
-
*
|
|
24
|
-
* the Swagger or OpenAPI document.
|
|
45
|
+
* Connection to the API server including the URL and headers.
|
|
25
46
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
* Connection to the server.
|
|
29
|
-
*
|
|
30
|
-
* Connection to the API server including the URL and headers.
|
|
31
|
-
*/
|
|
32
|
-
connection: IHttpConnection;
|
|
33
|
-
/**
|
|
34
|
-
* Executor of the API function.
|
|
35
|
-
*
|
|
36
|
-
* @param props Properties of the API function call
|
|
37
|
-
* @returns HTTP response of the API function call
|
|
38
|
-
*/
|
|
39
|
-
execute?: (props: {
|
|
40
|
-
/**
|
|
41
|
-
* Connection to the server.
|
|
42
|
-
*/
|
|
43
|
-
connection: IHttpConnection;
|
|
44
|
-
/**
|
|
45
|
-
* Application schema.
|
|
46
|
-
*/
|
|
47
|
-
application: IHttpLlmApplication<Model>;
|
|
48
|
-
/**
|
|
49
|
-
* Function schema.
|
|
50
|
-
*/
|
|
51
|
-
function: IHttpLlmFunction<Model>;
|
|
52
|
-
/**
|
|
53
|
-
* Arguments of the function calling.
|
|
54
|
-
*
|
|
55
|
-
* It is an object of key-value pairs of the API function's parameters.
|
|
56
|
-
* The property keys are composed by below rules:
|
|
57
|
-
*
|
|
58
|
-
* - parameter names
|
|
59
|
-
* - query parameter as an object type if exists
|
|
60
|
-
* - body parameter if exists
|
|
61
|
-
*/
|
|
62
|
-
arguments: object;
|
|
63
|
-
}) => Promise<IHttpResponse>;
|
|
64
|
-
}
|
|
47
|
+
connection: IHttpConnection;
|
|
48
|
+
|
|
65
49
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* You can make it by `typia.llm.application<App, Model>()` function.
|
|
50
|
+
* Executor of the API function.
|
|
69
51
|
*
|
|
70
|
-
*
|
|
52
|
+
* @param props Properties of the API function call
|
|
53
|
+
* @returns HTTP response of the API function call
|
|
71
54
|
*/
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
55
|
+
execute?: (props: {
|
|
56
|
+
/**
|
|
57
|
+
* Connection to the server.
|
|
58
|
+
*/
|
|
59
|
+
connection: IHttpConnection;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Application schema.
|
|
63
|
+
*/
|
|
64
|
+
application: IHttpLlmApplication<Model>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Function schema.
|
|
68
|
+
*/
|
|
69
|
+
function: IHttpLlmFunction<Model>;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Arguments of the function calling.
|
|
73
|
+
*
|
|
74
|
+
* It is an object of key-value pairs of the API function's parameters.
|
|
75
|
+
* The property keys are composed by below rules:
|
|
76
|
+
*
|
|
77
|
+
* - parameter names
|
|
78
|
+
* - query parameter as an object type if exists
|
|
79
|
+
* - body parameter if exists
|
|
80
|
+
*/
|
|
81
|
+
arguments: object;
|
|
82
|
+
}) => Promise<IHttpResponse>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* TypeScript class controller.
|
|
87
|
+
*
|
|
88
|
+
* You can make it by `typia.llm.application<App, Model>()` function.
|
|
89
|
+
*
|
|
90
|
+
* - https://typia.io/docs/llm/application
|
|
91
|
+
*/
|
|
92
|
+
export interface IClass<Model extends ILlmSchema.Model>
|
|
93
|
+
extends IBase<"class", ILlmApplication<Model>> {
|
|
95
94
|
/**
|
|
96
|
-
*
|
|
95
|
+
* Executor of the class function.
|
|
96
|
+
*
|
|
97
|
+
* Executor of the class function, by target class instance
|
|
98
|
+
* or callback function with given schema and arguments
|
|
99
|
+
* information.
|
|
97
100
|
*/
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
*/
|
|
102
|
-
client: import("@modelcontextprotocol/sdk/client/index.d.ts").Client;
|
|
103
|
-
}
|
|
104
|
-
interface IBase<Protocol, Application> {
|
|
101
|
+
execute:
|
|
102
|
+
| object
|
|
103
|
+
| ((props: {
|
|
105
104
|
/**
|
|
106
|
-
*
|
|
105
|
+
* Target application schema.
|
|
107
106
|
*/
|
|
108
|
-
|
|
107
|
+
application: ILlmApplication<Model>;
|
|
108
|
+
|
|
109
109
|
/**
|
|
110
|
-
*
|
|
110
|
+
* Target function schema.
|
|
111
111
|
*/
|
|
112
|
-
|
|
112
|
+
function: ILlmFunction<Model>;
|
|
113
|
+
|
|
113
114
|
/**
|
|
114
|
-
*
|
|
115
|
+
* Arguments of the function calling.
|
|
115
116
|
*/
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
arguments: object;
|
|
118
|
+
}) => Promise<unknown>);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* MCP Server controller.
|
|
123
|
+
*/
|
|
124
|
+
export interface IMcp<Model extends ILlmSchema.Model> extends IBase<"mcp", IMcpLlmApplication<Model>> {
|
|
125
|
+
/**
|
|
126
|
+
* MCP client for connection.
|
|
127
|
+
*
|
|
128
|
+
* @warning You have to install `@modelcontextprotocol/sdk` package
|
|
129
|
+
* to use this type properly. If not, this type would work
|
|
130
|
+
* as an `any` type, so that you can't validate it.
|
|
131
|
+
*/
|
|
132
|
+
// @ts-ignore Type checking only when `@modelcontextprotocol/sdk` is installed.
|
|
133
|
+
// This strategy is useful for someone who does not need MCP,
|
|
134
|
+
// for someone who has not installed `@modelcontextprotocol/sdk`.
|
|
135
|
+
client: import("@modelcontextprotocol/sdk/client/index.d.ts").Client;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
interface IBase<Protocol, Application> {
|
|
139
|
+
/**
|
|
140
|
+
* Protocol discrminator.
|
|
141
|
+
*/
|
|
142
|
+
protocol: Protocol;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Name of the controller.
|
|
146
|
+
*/
|
|
147
|
+
name: string;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Application schema of function calling.
|
|
151
|
+
*/
|
|
152
|
+
application: Application;
|
|
153
|
+
}
|
|
119
154
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { ILlmSchema } from "@samchon/openapi";
|
|
2
2
|
import type { AgenticaContext } from "../context/AgenticaContext";
|
|
3
3
|
import type { AgenticaOperation } from "../context/AgenticaOperation";
|
|
4
|
-
import type {
|
|
5
|
-
import type { AgenticaHistory } from "../histories/AgenticaHistory";
|
|
4
|
+
import type { AgenticaExecuteEvent } from "../events/AgenticaExecuteEvent";
|
|
6
5
|
/**
|
|
7
6
|
* Executor of the Agentic AI.
|
|
8
7
|
*
|
|
@@ -56,7 +55,7 @@ export interface IAgenticaExecutor<Model extends ILlmSchema.Model> {
|
|
|
56
55
|
* @returns List of prompts generated by the initializer
|
|
57
56
|
* @default false
|
|
58
57
|
*/
|
|
59
|
-
initialize: boolean | null | ((ctx: AgenticaContext<Model>) => Promise<
|
|
58
|
+
initialize: boolean | null | ((ctx: AgenticaContext<Model>) => Promise<void>);
|
|
60
59
|
/**
|
|
61
60
|
* Function selector agent.
|
|
62
61
|
*
|
|
@@ -84,7 +83,7 @@ export interface IAgenticaExecutor<Model extends ILlmSchema.Model> {
|
|
|
84
83
|
* @param ctx Context of the agent
|
|
85
84
|
* @returns List of prompts generated by the selector
|
|
86
85
|
*/
|
|
87
|
-
select: (ctx: AgenticaContext<Model>) => Promise<
|
|
86
|
+
select: (ctx: AgenticaContext<Model>) => Promise<void>;
|
|
88
87
|
/**
|
|
89
88
|
* Function caller agent.
|
|
90
89
|
*
|
|
@@ -111,7 +110,7 @@ export interface IAgenticaExecutor<Model extends ILlmSchema.Model> {
|
|
|
111
110
|
* agent is the most general topic which can be universally
|
|
112
111
|
* applied to all domain fields.
|
|
113
112
|
*/
|
|
114
|
-
call: (ctx: AgenticaContext<Model>, operations: AgenticaOperation<Model>[]) => Promise<
|
|
113
|
+
call: (ctx: AgenticaContext<Model>, operations: AgenticaOperation<Model>[]) => Promise<AgenticaExecuteEvent<Model>[]>;
|
|
115
114
|
/**
|
|
116
115
|
* Describer agent of the function calling result.
|
|
117
116
|
*
|
|
@@ -125,7 +124,7 @@ export interface IAgenticaExecutor<Model extends ILlmSchema.Model> {
|
|
|
125
124
|
* @param executes List of function calling results
|
|
126
125
|
* @returns List of prompts generated by the describer
|
|
127
126
|
*/
|
|
128
|
-
describe: boolean | null | ((ctx: AgenticaContext<Model>, executes:
|
|
127
|
+
describe: boolean | null | ((ctx: AgenticaContext<Model>, executes: AgenticaExecuteEvent<Model>[]) => Promise<void>);
|
|
129
128
|
/**
|
|
130
129
|
* Function canceler agent.
|
|
131
130
|
*
|
|
@@ -148,5 +147,5 @@ export interface IAgenticaExecutor<Model extends ILlmSchema.Model> {
|
|
|
148
147
|
* @param ctx Context of the agent
|
|
149
148
|
* @returns List of prompts generated by the canceler
|
|
150
149
|
*/
|
|
151
|
-
cancel: (ctx: AgenticaContext<Model>) => Promise<
|
|
150
|
+
cancel: (ctx: AgenticaContext<Model>) => Promise<void>;
|
|
152
151
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type OpenAI from "openai";
|
|
2
|
+
import type { Semaphore } from "tstl";
|
|
2
3
|
/**
|
|
3
4
|
* LLM service vendor for Agentica Chat.
|
|
4
5
|
*
|
|
@@ -33,4 +34,17 @@ export interface IAgenticaVendor {
|
|
|
33
34
|
* Options for the request.
|
|
34
35
|
*/
|
|
35
36
|
options?: OpenAI.RequestOptions | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Number of concurrent requests allowed.
|
|
39
|
+
*
|
|
40
|
+
* If you configure this property, {@link Agentica} will constrain the
|
|
41
|
+
* number of concurrent requests to the LLM vendor. If you want to
|
|
42
|
+
* share the semaphore instance with other agents, you can directly
|
|
43
|
+
* assign the {@link Semaphore} instance to this property.
|
|
44
|
+
*
|
|
45
|
+
* Otherwise, it will not limit the number of concurrent
|
|
46
|
+
* requests, and the {@link Agentica} will send requests
|
|
47
|
+
* asynchronously without any limit.
|
|
48
|
+
*/
|
|
49
|
+
semaphore?: Semaphore | number | undefined;
|
|
36
50
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ILlmSchema } from "@samchon/openapi";
|
|
2
2
|
import type { MicroAgenticaContext } from "../context/MicroAgenticaContext";
|
|
3
3
|
import type { AgenticaExecuteHistory } from "../histories/AgenticaExecuteHistory";
|
|
4
|
-
import type { MicroAgenticaHistory } from "../histories/MicroAgenticaHistory";
|
|
5
4
|
/**
|
|
6
5
|
* Executor of the Micro Agentic AI.
|
|
7
6
|
*
|
|
@@ -42,7 +41,7 @@ export interface IMicroAgenticaExecutor<Model extends ILlmSchema.Model> {
|
|
|
42
41
|
* agent is the most general topic which can be universally
|
|
43
42
|
* applied to all domain fields.
|
|
44
43
|
*/
|
|
45
|
-
call: (ctx: MicroAgenticaContext<Model>) => Promise<
|
|
44
|
+
call: (ctx: MicroAgenticaContext<Model>) => Promise<AgenticaExecuteHistory<Model>[]>;
|
|
46
45
|
/**
|
|
47
46
|
* Describer agent of the function calling result.
|
|
48
47
|
*
|
|
@@ -56,5 +55,5 @@ export interface IMicroAgenticaExecutor<Model extends ILlmSchema.Model> {
|
|
|
56
55
|
* @param executes List of function calling results
|
|
57
56
|
* @returns List of prompts generated by the describer
|
|
58
57
|
*/
|
|
59
|
-
describe: boolean | null | ((ctx: MicroAgenticaContext<Model>, executes: AgenticaExecuteHistory<Model>[]) => Promise<
|
|
58
|
+
describe: boolean | null | ((ctx: MicroAgenticaContext<Model>, executes: AgenticaExecuteHistory<Model>[]) => Promise<void>);
|
|
60
59
|
}
|
|
@@ -62,30 +62,33 @@ function transformUserMessage(props) {
|
|
|
62
62
|
function transformSelect(props) {
|
|
63
63
|
return (0, histories_1.createSelectHistory)({
|
|
64
64
|
id: props.history.id,
|
|
65
|
-
|
|
65
|
+
created_at: props.history.created_at,
|
|
66
|
+
selection: (0, operations_1.createOperationSelection)({
|
|
66
67
|
operation: findOperation({
|
|
67
68
|
operations: props.operations,
|
|
68
|
-
input:
|
|
69
|
+
input: props.history.selection.operation,
|
|
69
70
|
}),
|
|
70
|
-
reason:
|
|
71
|
-
})
|
|
71
|
+
reason: props.history.selection.reason,
|
|
72
|
+
}),
|
|
72
73
|
});
|
|
73
74
|
}
|
|
74
75
|
function transformCancel(props) {
|
|
75
76
|
return (0, histories_1.createCancelHistory)({
|
|
76
77
|
id: props.history.id,
|
|
77
|
-
|
|
78
|
+
created_at: props.history.created_at,
|
|
79
|
+
selection: (0, operations_1.createOperationSelection)({
|
|
78
80
|
operation: findOperation({
|
|
79
81
|
operations: props.operations,
|
|
80
|
-
input:
|
|
82
|
+
input: props.history.selection.operation,
|
|
81
83
|
}),
|
|
82
|
-
reason:
|
|
83
|
-
})
|
|
84
|
+
reason: props.history.selection.reason,
|
|
85
|
+
}),
|
|
84
86
|
});
|
|
85
87
|
}
|
|
86
88
|
function transformExecute(props) {
|
|
87
89
|
return (0, histories_1.createExecuteHistory)({
|
|
88
90
|
id: props.history.id,
|
|
91
|
+
created_at: props.history.created_at,
|
|
89
92
|
operation: findOperation({
|
|
90
93
|
operations: props.operations,
|
|
91
94
|
input: props.history.operation,
|
|
@@ -100,6 +103,8 @@ function transformExecute(props) {
|
|
|
100
103
|
}
|
|
101
104
|
function transformDescribe(props) {
|
|
102
105
|
return (0, histories_1.createDescribeHistory)({
|
|
106
|
+
id: props.history.id,
|
|
107
|
+
created_at: props.history.created_at,
|
|
103
108
|
text: props.history.text,
|
|
104
109
|
executes: props.history.executes.map(next => transformExecute({
|
|
105
110
|
operations: props.operations,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformHistory.js","sourceRoot":"","sources":["../../src/transformers/transformHistory.ts"],"names":[],"mappings":";;AAmBA,4CA8CC;AApDD,oDAAkN;AAClN,sDAAiE;AAEjE;;GAEG;AACH,SAAgB,gBAAgB,CAAiC,KAGhE;IACC,OAAO;IACP,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;QACzC,OAAO,oBAAoB,CAAC;YAC1B,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC,CAAC;IACL,CAAC;IACD,YAAY;SACP,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;QACnD,OAAO,yBAAyB,CAAC;YAC/B,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC,CAAC;IACL,CAAC;IACD,SAAS;SACJ,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;QAChD,OAAO,sBAAsB,CAAC;YAC5B,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC,CAAC;IACL,CAAC;IACD,kBAAkB;SACb,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACzC,OAAO,eAAe,CAAC;YACrB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC,CAAC;IACL,CAAC;SACI,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACzC,OAAO,eAAe,CAAC;YACrB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC,CAAC;IACL,CAAC;IACD,UAAU;SACL,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC1C,OAAO,gBAAgB,CAAC;YACtB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,iBAAiB,CAAC;QACvB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAC,CAAC;AACL,CAAC;AAED,SAAS,yBAAyB,CAAC,KAElC;IACC,OAAO,IAAA,yCAA6B,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,sBAAsB,CAAC,KAE/B;IACC,OAAO,IAAA,sCAA0B,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACnD,CAAC;AAED,SAAS,oBAAoB,CAAC,KAE7B;IACC,OAAO,IAAA,oCAAwB,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACjD,CAAC;AAED,SAAS,eAAe,CAAiC,KAGxD;IACC,OAAO,IAAA,+BAAmB,EAAC;QACzB,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE;QACpB,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"transformHistory.js","sourceRoot":"","sources":["../../src/transformers/transformHistory.ts"],"names":[],"mappings":";;AAmBA,4CA8CC;AApD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C,QAAQ,GAAG,CACjG,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -44,7 +44,7 @@ const ChatGptTokenUsageAggregator_1 = require("./ChatGptTokenUsageAggregator");
|
|
|
44
44
|
function transformCompletionChunk(source) {
|
|
45
45
|
const str = source instanceof Uint8Array ? ByteArrayUtil_1.ByteArrayUtil.toUtf8(source) : source;
|
|
46
46
|
const result = JSON.parse(str);
|
|
47
|
-
const valid = (() => { const _io0 = input => "string" === typeof input.id && (Array.isArray(input.choices) && input.choices.every(elem => "object" === typeof elem && null !== elem && _io1(elem))) && "number" === typeof input.created && "string" === typeof input.model && "chat.completion.chunk" === input.object && (null === input.service_tier || undefined === input.service_tier || "
|
|
47
|
+
const valid = (() => { const _io0 = input => "string" === typeof input.id && (Array.isArray(input.choices) && input.choices.every(elem => "object" === typeof elem && null !== elem && _io1(elem))) && "number" === typeof input.created && "string" === typeof input.model && "chat.completion.chunk" === input.object && (null === input.service_tier || undefined === input.service_tier || "auto" === input.service_tier || "default" === input.service_tier || "flex" === input.service_tier) && (undefined === input.system_fingerprint || "string" === typeof input.system_fingerprint) && (null === input.usage || undefined === input.usage || "object" === typeof input.usage && null !== input.usage && _io9(input.usage)); const _io1 = input => "object" === typeof input.delta && null !== input.delta && false === Array.isArray(input.delta) && _io2(input.delta) && (null === input.finish_reason || "length" === input.finish_reason || "function_call" === input.finish_reason || "stop" === input.finish_reason || "tool_calls" === input.finish_reason || "content_filter" === input.finish_reason) && "number" === typeof input.index && (null === input.logprobs || undefined === input.logprobs || "object" === typeof input.logprobs && null !== input.logprobs && _io6(input.logprobs)); const _io2 = input => (null === input.content || undefined === input.content || "string" === typeof input.content) && (undefined === input.function_call || "object" === typeof input.function_call && null !== input.function_call && false === Array.isArray(input.function_call) && _io3(input.function_call)) && (null === input.refusal || undefined === input.refusal || "string" === typeof input.refusal) && (undefined === input.role || "user" === input.role || "developer" === input.role || "system" === input.role || "assistant" === input.role || "tool" === input.role) && (undefined === input.tool_calls || Array.isArray(input.tool_calls) && input.tool_calls.every(elem => "object" === typeof elem && null !== elem && _io4(elem))); const _io3 = input => (undefined === input.arguments || "string" === typeof input.arguments) && (undefined === input.name || "string" === typeof input.name); const _io4 = input => "number" === typeof input.index && (undefined === input.id || "string" === typeof input.id) && (undefined === input["function"] || "object" === typeof input["function"] && null !== input["function"] && false === Array.isArray(input["function"]) && _io5(input["function"])) && (undefined === input.type || "function" === input.type); const _io5 = input => (undefined === input.arguments || "string" === typeof input.arguments) && (undefined === input.name || "string" === typeof input.name); const _io6 = input => (null === input.content || Array.isArray(input.content) && input.content.every(elem => "object" === typeof elem && null !== elem && _io7(elem))) && (null === input.refusal || Array.isArray(input.refusal) && input.refusal.every(elem => "object" === typeof elem && null !== elem && _io7(elem))); const _io7 = input => "string" === typeof input.token && (null === input.bytes || Array.isArray(input.bytes) && input.bytes.every(elem => "number" === typeof elem)) && "number" === typeof input.logprob && (Array.isArray(input.top_logprobs) && input.top_logprobs.every(elem => "object" === typeof elem && null !== elem && _io8(elem))); const _io8 = input => "string" === typeof input.token && (null === input.bytes || Array.isArray(input.bytes) && input.bytes.every(elem => "number" === typeof elem)) && "number" === typeof input.logprob; const _io9 = input => "number" === typeof input.completion_tokens && "number" === typeof input.prompt_tokens && "number" === typeof input.total_tokens && (undefined === input.completion_tokens_details || "object" === typeof input.completion_tokens_details && null !== input.completion_tokens_details && false === Array.isArray(input.completion_tokens_details) && _io10(input.completion_tokens_details)) && (undefined === input.prompt_tokens_details || "object" === typeof input.prompt_tokens_details && null !== input.prompt_tokens_details && false === Array.isArray(input.prompt_tokens_details) && _io11(input.prompt_tokens_details)); const _io10 = input => (undefined === input.accepted_prediction_tokens || "number" === typeof input.accepted_prediction_tokens) && (undefined === input.audio_tokens || "number" === typeof input.audio_tokens) && (undefined === input.reasoning_tokens || "number" === typeof input.reasoning_tokens) && (undefined === input.rejected_prediction_tokens || "number" === typeof input.rejected_prediction_tokens); const _io11 = input => (undefined === input.audio_tokens || "number" === typeof input.audio_tokens) && (undefined === input.cached_tokens || "number" === typeof input.cached_tokens); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.id || _report(_exceptionable, {
|
|
48
48
|
path: _path + ".id",
|
|
49
49
|
expected: "string",
|
|
50
50
|
value: input.id
|
|
@@ -76,9 +76,9 @@ function transformCompletionChunk(source) {
|
|
|
76
76
|
path: _path + ".object",
|
|
77
77
|
expected: "\"chat.completion.chunk\"",
|
|
78
78
|
value: input.object
|
|
79
|
-
}), null === input.service_tier || undefined === input.service_tier || "
|
|
79
|
+
}), null === input.service_tier || undefined === input.service_tier || "auto" === input.service_tier || "default" === input.service_tier || "flex" === input.service_tier || _report(_exceptionable, {
|
|
80
80
|
path: _path + ".service_tier",
|
|
81
|
-
expected: "(\"default\" | \"
|
|
81
|
+
expected: "(\"auto\" | \"default\" | \"flex\" | null | undefined)",
|
|
82
82
|
value: input.service_tier
|
|
83
83
|
}), undefined === input.system_fingerprint || "string" === typeof input.system_fingerprint || _report(_exceptionable, {
|
|
84
84
|
path: _path + ".system_fingerprint",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentica/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "Agentic AI Library specialized in LLM Function Calling",
|
|
5
5
|
"author": "Wrtn Technologies",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,35 +36,37 @@
|
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@samchon/openapi": "^4.3.
|
|
40
|
-
"openai": "^
|
|
41
|
-
"typia": "^9.3.
|
|
39
|
+
"@samchon/openapi": "^4.3.3",
|
|
40
|
+
"openai": "^5.2.0",
|
|
41
|
+
"typia": "^9.3.1"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@samchon/openapi": "^4.3.
|
|
45
|
-
"
|
|
44
|
+
"@samchon/openapi": "^4.3.3",
|
|
45
|
+
"tstl": "^3.0.0",
|
|
46
|
+
"typia": "^9.3.1",
|
|
46
47
|
"uuid": "^11.0.4"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
50
|
+
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
50
51
|
"@nestia/e2e": "^6.0.1",
|
|
51
52
|
"@rollup/plugin-terser": "^0.4.4",
|
|
52
53
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
53
|
-
"@ryoppippi/unplugin-typia": "^2.6.
|
|
54
|
-
"@types/node": "^22.13.
|
|
54
|
+
"@ryoppippi/unplugin-typia": "^2.6.4",
|
|
55
|
+
"@types/node": "^22.13.9",
|
|
55
56
|
"@types/uuid": "^10.0.0",
|
|
56
57
|
"@wrtnlabs/calculator-mcp": "^0.2.1",
|
|
57
|
-
"openai": "^
|
|
58
|
+
"openai": "^5.2.0",
|
|
58
59
|
"rimraf": "^6.0.1",
|
|
59
60
|
"rollup": "^4.34.8",
|
|
60
61
|
"ts-node": "^10.9.2",
|
|
61
62
|
"ts-patch": "^3.3.0",
|
|
63
|
+
"tstl": "^3.0.0",
|
|
62
64
|
"typedoc": "^0.27.7",
|
|
63
65
|
"typescript": "~5.8.3",
|
|
64
66
|
"vitest": "^3.0.9"
|
|
65
67
|
},
|
|
66
68
|
"scripts": {
|
|
67
|
-
"build": "rimraf lib && pnpm build:prompt && tsc && rollup -c",
|
|
69
|
+
"build": "rimraf lib && pnpm build:prompt && tsc && rollup -c && node build/post.js",
|
|
68
70
|
"build:prompt": "node build/prompt.js",
|
|
69
71
|
"dev": "rimraf lib && tsc --watch",
|
|
70
72
|
"lint": "eslint .",
|