@agentica/core 0.27.3 → 0.29.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.
Files changed (92) hide show
  1. package/README.md +17 -2
  2. package/lib/Agentica.d.ts +2 -1
  3. package/lib/Agentica.js +92 -60
  4. package/lib/Agentica.js.map +1 -1
  5. package/lib/MicroAgentica.d.ts +1 -0
  6. package/lib/MicroAgentica.js +88 -60
  7. package/lib/MicroAgentica.js.map +1 -1
  8. package/lib/constants/AgenticaDefaultPrompt.js +2 -18
  9. package/lib/constants/AgenticaDefaultPrompt.js.map +1 -1
  10. package/lib/context/AgenticaContext.d.ts +1 -1
  11. package/lib/context/MicroAgenticaContext.d.ts +2 -2
  12. package/lib/context/internal/AgenticaOperationComposer.spec.js +0 -2
  13. package/lib/context/internal/AgenticaOperationComposer.spec.js.map +1 -1
  14. package/lib/events/AgenticaEventBase.d.ts +9 -0
  15. package/lib/factory/events.d.ts +1 -2
  16. package/lib/factory/events.js +71 -7
  17. package/lib/factory/events.js.map +1 -1
  18. package/lib/factory/histories.js +27 -9
  19. package/lib/factory/histories.js.map +1 -1
  20. package/lib/histories/AgenticaCancelHistory.d.ts +1 -2
  21. package/lib/histories/AgenticaExecuteHistory.d.ts +0 -4
  22. package/lib/histories/AgenticaHistoryBase.d.ts +9 -0
  23. package/lib/histories/AgenticaSelectHistory.d.ts +1 -2
  24. package/lib/index.mjs +415 -731
  25. package/lib/index.mjs.map +1 -1
  26. package/lib/json/IAgenticaEventJson.d.ts +9 -1
  27. package/lib/json/IAgenticaHistoryJson.d.ts +11 -14
  28. package/lib/orchestrate/call.d.ts +2 -2
  29. package/lib/orchestrate/call.js +43 -72
  30. package/lib/orchestrate/call.js.map +1 -1
  31. package/lib/orchestrate/cancel.d.ts +1 -2
  32. package/lib/orchestrate/cancel.js +14 -39
  33. package/lib/orchestrate/cancel.js.map +1 -1
  34. package/lib/orchestrate/describe.d.ts +1 -2
  35. package/lib/orchestrate/describe.js +5 -17
  36. package/lib/orchestrate/describe.js.map +1 -1
  37. package/lib/orchestrate/execute.d.ts +1 -2
  38. package/lib/orchestrate/execute.js +9 -13
  39. package/lib/orchestrate/execute.js.map +1 -1
  40. package/lib/orchestrate/initialize.d.ts +1 -2
  41. package/lib/orchestrate/initialize.js +4 -12
  42. package/lib/orchestrate/initialize.js.map +1 -1
  43. package/lib/orchestrate/internal/{cancelFunction.js → cancelFunctionFromContext.js} +7 -7
  44. package/lib/orchestrate/internal/cancelFunctionFromContext.js.map +1 -0
  45. package/lib/orchestrate/internal/selectFunctionFromContext.js +24 -0
  46. package/lib/orchestrate/internal/selectFunctionFromContext.js.map +1 -0
  47. package/lib/orchestrate/select.d.ts +1 -2
  48. package/lib/orchestrate/select.js +21 -52
  49. package/lib/orchestrate/select.js.map +1 -1
  50. package/lib/structures/IAgenticaConfig.d.ts +1 -3
  51. package/lib/structures/IAgenticaExecutor.d.ts +6 -7
  52. package/lib/structures/IAgenticaVendor.d.ts +14 -0
  53. package/lib/structures/IMicroAgenticaExecutor.d.ts +2 -3
  54. package/lib/transformers/transformHistory.js +13 -8
  55. package/lib/transformers/transformHistory.js.map +1 -1
  56. package/lib/utils/ChatGptCompletionMessageUtil.js +5 -353
  57. package/lib/utils/ChatGptCompletionMessageUtil.js.map +1 -1
  58. package/package.json +9 -7
  59. package/src/Agentica.ts +127 -87
  60. package/src/MicroAgentica.ts +118 -81
  61. package/src/constants/AgenticaDefaultPrompt.ts +3 -20
  62. package/src/context/AgenticaContext.ts +1 -1
  63. package/src/context/MicroAgenticaContext.ts +2 -2
  64. package/src/context/internal/AgenticaOperationComposer.spec.ts +1 -2
  65. package/src/events/AgenticaEventBase.ts +12 -0
  66. package/src/factory/events.ts +78 -8
  67. package/src/factory/histories.ts +41 -11
  68. package/src/histories/AgenticaCancelHistory.ts +1 -2
  69. package/src/histories/AgenticaExecuteHistory.ts +0 -5
  70. package/src/histories/AgenticaHistoryBase.ts +12 -0
  71. package/src/histories/AgenticaSelectHistory.ts +1 -2
  72. package/src/json/IAgenticaEventJson.ts +11 -1
  73. package/src/json/IAgenticaHistoryJson.ts +14 -17
  74. package/src/orchestrate/call.ts +59 -109
  75. package/src/orchestrate/cancel.ts +77 -100
  76. package/src/orchestrate/describe.ts +16 -36
  77. package/src/orchestrate/execute.ts +17 -37
  78. package/src/orchestrate/initialize.ts +37 -50
  79. package/src/orchestrate/internal/{cancelFunction.ts → cancelFunctionFromContext.ts} +11 -11
  80. package/src/orchestrate/internal/{selectFunction.ts → selectFunctionFromContext.ts} +18 -13
  81. package/src/orchestrate/select.ts +113 -152
  82. package/src/structures/IAgenticaConfig.ts +1 -3
  83. package/src/structures/IAgenticaExecutor.ts +10 -8
  84. package/src/structures/IAgenticaVendor.ts +15 -0
  85. package/src/structures/IMicroAgenticaExecutor.ts +2 -3
  86. package/src/transformers/transformHistory.ts +19 -20
  87. package/src/utils/ChatGptCompletionMessageUtil.ts +5 -6
  88. package/lib/orchestrate/internal/cancelFunction.js.map +0 -1
  89. package/lib/orchestrate/internal/selectFunction.js +0 -35
  90. package/lib/orchestrate/internal/selectFunction.js.map +0 -1
  91. /package/lib/orchestrate/internal/{cancelFunction.d.ts → cancelFunctionFromContext.d.ts} +0 -0
  92. /package/lib/orchestrate/internal/{selectFunction.d.ts → selectFunctionFromContext.d.ts} +0 -0
@@ -21,17 +21,25 @@ import type { AgenticaUserMessageContent } from "../histories";
21
21
  import type { AgenticaExecuteHistory } from "../histories/AgenticaExecuteHistory";
22
22
  import type { IAgenticaEventJson } from "../json/IAgenticaEventJson";
23
23
 
24
- import { createExecuteHistory, createSelectHistory, createUserMessageHistory } from "./histories";
24
+ import {
25
+ createExecuteHistory,
26
+ createSelectHistory,
27
+ createUserMessageHistory,
28
+ } from "./histories";
25
29
 
26
30
  /* -----------------------------------------------------------
27
31
  FUNCTION SELECTS
28
32
  ----------------------------------------------------------- */
29
33
  export function createInitializeEvent(): AgenticaInitializeEvent {
30
34
  const event: IAgenticaEventJson.IInitialize = {
35
+ id: v4(),
31
36
  type: "initialize",
37
+ created_at: new Date().toISOString(),
32
38
  };
33
39
  return {
40
+ id: event.id,
34
41
  type: event.type,
42
+ created_at: event.created_at,
35
43
  toJSON: () => event,
36
44
  };
37
45
  }
@@ -39,16 +47,23 @@ export function createInitializeEvent(): AgenticaInitializeEvent {
39
47
  export function createSelectEvent<Model extends ILlmSchema.Model>(props: {
40
48
  selection: AgenticaOperationSelection<Model>;
41
49
  }): AgenticaSelectEvent<Model> {
50
+ const id: string = v4();
51
+ const created_at: string = new Date().toISOString();
42
52
  return {
43
53
  type: "select",
54
+ id,
55
+ created_at,
44
56
  selection: props.selection,
45
57
  toJSON: () => ({
46
58
  type: "select",
59
+ id,
60
+ created_at,
47
61
  selection: props.selection.toJSON(),
48
62
  }),
49
63
  toHistory: () => createSelectHistory({
50
- id: v4(),
51
- selections: [props.selection],
64
+ id,
65
+ created_at,
66
+ selection: props.selection,
52
67
  }),
53
68
  };
54
69
  }
@@ -56,11 +71,17 @@ export function createSelectEvent<Model extends ILlmSchema.Model>(props: {
56
71
  export function createCancelEvent<Model extends ILlmSchema.Model>(props: {
57
72
  selection: AgenticaOperationSelection<Model>;
58
73
  }): AgenticaCancelEvent<Model> {
74
+ const id: string = v4();
75
+ const created_at: string = new Date().toISOString();
59
76
  return {
60
77
  type: "cancel",
78
+ id,
79
+ created_at,
61
80
  selection: props.selection,
62
81
  toJSON: () => ({
63
82
  type: "cancel",
83
+ id,
84
+ created_at,
64
85
  selection: props.selection.toJSON(),
65
86
  }),
66
87
  };
@@ -74,14 +95,17 @@ export function createCallEvent<Model extends ILlmSchema.Model>(props: {
74
95
  operation: AgenticaOperation<Model>;
75
96
  arguments: Record<string, any>;
76
97
  }): AgenticaCallEvent<Model> {
98
+ const created_at: string = new Date().toISOString();
77
99
  return {
78
100
  type: "call",
79
101
  id: props.id,
102
+ created_at,
80
103
  operation: props.operation,
81
104
  arguments: props.arguments,
82
105
  toJSON: () => ({
83
106
  type: "call",
84
107
  id: props.id,
108
+ created_at,
85
109
  operation: props.operation.toJSON(),
86
110
  arguments: props.arguments,
87
111
  }),
@@ -93,14 +117,17 @@ export function createValidateEvent<Model extends ILlmSchema.Model>(props: {
93
117
  operation: AgenticaOperation<Model>;
94
118
  result: IValidation.IFailure;
95
119
  }): AgenticaValidateEvent<Model> {
120
+ const created_at: string = new Date().toISOString();
96
121
  return {
97
122
  type: "validate",
98
123
  id: props.id,
124
+ created_at,
99
125
  operation: props.operation,
100
126
  result: props.result,
101
127
  toJSON: () => ({
102
128
  type: "validate",
103
129
  id: props.id,
130
+ created_at,
104
131
  operation: props.operation.toJSON(),
105
132
  result: props.result,
106
133
  }),
@@ -108,28 +135,35 @@ export function createValidateEvent<Model extends ILlmSchema.Model>(props: {
108
135
  }
109
136
 
110
137
  export function createExecuteEvent<Model extends ILlmSchema.Model>(props: {
111
- id: string;
112
138
  operation: AgenticaOperation<Model>;
113
139
  arguments: Record<string, unknown>;
114
140
  value: unknown;
115
141
  }): AgenticaExecuteEvent<Model> {
142
+ const id: string = v4();
143
+ const created_at: string = new Date().toISOString();
116
144
  return {
117
145
  type: "execute",
146
+ id,
147
+ created_at,
118
148
  protocol: props.operation.protocol as "class",
119
- id: props.id,
120
149
  operation: props.operation as AgenticaOperation.Class<Model>,
121
150
  arguments: props.arguments,
122
151
  value: props.value as any,
123
152
  toJSON: () => ({
124
153
  type: "execute",
154
+ id,
155
+ created_at,
125
156
  protocol: props.operation.protocol as "class",
126
- id: props.id,
127
157
  operation: props.operation.toJSON(),
128
158
  arguments: props.arguments,
129
159
  value: props.value,
130
160
  }),
131
161
  toHistory: () =>
132
- createExecuteHistory(props) as AgenticaExecuteHistory.Class<Model>,
162
+ createExecuteHistory({
163
+ id,
164
+ created_at,
165
+ ...props,
166
+ }) as AgenticaExecuteHistory.Class<Model>,
133
167
  };
134
168
  }
135
169
 
@@ -139,39 +173,57 @@ export function createExecuteEvent<Model extends ILlmSchema.Model>(props: {
139
173
  export function createUserMessageEvent(props: {
140
174
  contents: Array<AgenticaUserMessageContent>;
141
175
  }): AgenticaUserMessageEvent {
176
+ const id: string = v4();
177
+ const created_at: string = new Date().toISOString();
142
178
  return {
143
179
  type: "userMessage",
180
+ id,
181
+ created_at,
144
182
  contents: props.contents,
145
183
  toJSON: () => ({
146
184
  type: "userMessage",
185
+ id,
186
+ created_at,
147
187
  contents: props.contents,
148
188
  }),
149
189
  toHistory: () => createUserMessageHistory({
190
+ id,
191
+ created_at,
150
192
  contents: props.contents,
151
193
  }),
152
194
  };
153
195
  }
154
196
 
155
- export function creatAssistantEvent(props: {
197
+ export function creatAssistantMessageEvent(props: {
156
198
  stream: AsyncGenerator<string, undefined, undefined>;
157
199
  done: () => boolean;
158
200
  get: () => string;
159
201
  join: () => Promise<string>;
160
202
  }): AgenticaAssistantMessageEvent {
203
+ const id: string = v4();
204
+ const created_at: string = new Date().toISOString();
161
205
  return {
162
206
  type: "assistantMessage",
207
+ id,
208
+ created_at,
163
209
  stream: props.stream,
164
210
  join: props.join,
165
211
  toJSON: () => ({
166
212
  type: "assistantMessage",
213
+ id,
214
+ created_at,
167
215
  done: props.done(),
168
216
  text: props.get(),
169
217
  }),
170
218
  toHistory: () => ({
171
219
  type: "assistantMessage",
220
+ id,
221
+ created_at,
172
222
  text: props.get(),
173
223
  toJSON: () => ({
174
224
  type: "assistantMessage",
225
+ id,
226
+ created_at,
175
227
  text: props.get(),
176
228
  }),
177
229
  }),
@@ -185,23 +237,33 @@ export function createDescribeEvent<Model extends ILlmSchema.Model>(props: {
185
237
  get: () => string;
186
238
  join: () => Promise<string>;
187
239
  }): AgenticaDescribeEvent<Model> {
240
+ const id: string = v4();
241
+ const created_at: string = new Date().toISOString();
188
242
  return {
189
243
  type: "describe",
244
+ id,
245
+ created_at,
190
246
  executes: props.executes,
191
247
  stream: props.stream,
192
248
  join: props.join,
193
249
  toJSON: () => ({
194
250
  type: "describe",
251
+ id,
252
+ created_at,
195
253
  executes: props.executes.map(execute => execute.toJSON()),
196
254
  done: props.done(),
197
255
  text: props.get(),
198
256
  }),
199
257
  toHistory: () => ({
200
258
  type: "describe",
259
+ id,
260
+ created_at,
201
261
  executes: props.executes,
202
262
  text: props.get(),
203
263
  toJSON: () => ({
204
264
  type: "describe",
265
+ id,
266
+ created_at,
205
267
  executes: props.executes.map(execute => execute.toJSON()),
206
268
  text: props.get(),
207
269
  }),
@@ -217,8 +279,12 @@ export function createRequestEvent(props: {
217
279
  body: OpenAI.ChatCompletionCreateParamsStreaming;
218
280
  options?: OpenAI.RequestOptions | undefined;
219
281
  }): AgenticaRequestEvent {
282
+ const id: string = v4();
283
+ const created_at: string = new Date().toISOString();
220
284
  return {
221
285
  type: "request",
286
+ id,
287
+ created_at,
222
288
  source: props.source,
223
289
  body: props.body,
224
290
  options: props.options,
@@ -232,8 +298,12 @@ export function createResponseEvent(props: {
232
298
  stream: AsyncGenerator<OpenAI.ChatCompletionChunk, undefined, undefined>;
233
299
  join: () => Promise<OpenAI.ChatCompletion>;
234
300
  }): AgenticaResponseEvent {
301
+ const id: string = v4();
302
+ const created_at: string = new Date().toISOString();
235
303
  return {
236
304
  type: "response",
305
+ id,
306
+ created_at,
237
307
  source: props.source,
238
308
  body: props.body,
239
309
  options: props.options,
@@ -1,5 +1,6 @@
1
1
  import type { IHttpResponse, ILlmSchema } from "@samchon/openapi";
2
2
  import type OpenAI from "openai";
3
+ import type { tags } from "typia";
3
4
 
4
5
  import type { AgenticaOperation } from "../context/AgenticaOperation";
5
6
  import type { AgenticaOperationSelection } from "../context/AgenticaOperationSelection";
@@ -33,10 +34,10 @@ export function decodeHistory<Model extends ILlmSchema.Model>(history: AgenticaH
33
34
  function: {
34
35
  name: `${history.type}Functions`,
35
36
  arguments: JSON.stringify({
36
- functions: history.selections.map(s => ({
37
- name: s.operation.function.name,
38
- reason: s.reason,
39
- })),
37
+ function: {
38
+ name: history.selection.operation.name,
39
+ reason: history.selection.reason,
40
+ },
40
41
  }),
41
42
  },
42
43
  },
@@ -178,13 +179,19 @@ export function decodeUserMessageContent(content: AgenticaUserMessageContent): O
178
179
  * @internal
179
180
  */
180
181
  export function createUserMessageHistory(props: {
182
+ id: string;
183
+ created_at: string & tags.Format<"date-time">;
181
184
  contents: Array<AgenticaUserMessageContent>;
182
185
  }): AgenticaUserMessageHistory {
183
186
  return {
184
187
  type: "userMessage",
188
+ id: props.id,
189
+ created_at: props.created_at,
185
190
  contents: props.contents,
186
191
  toJSON: () => ({
187
192
  type: "userMessage",
193
+ id: props.id,
194
+ created_at: props.created_at,
188
195
  contents: props.contents,
189
196
  }),
190
197
  };
@@ -197,10 +204,14 @@ export function createUserMessageHistory(props: {
197
204
  * @internal
198
205
  */
199
206
  export function createAssistantMessageHistory(props: {
207
+ id: string;
208
+ created_at: string & tags.Format<"date-time">;
200
209
  text: string;
201
210
  }): AgenticaAssistantMessageHistory {
202
211
  const prompt: IAgenticaHistoryJson.IAssistantMessage = {
203
212
  type: "assistantMessage",
213
+ id: props.id,
214
+ created_at: props.created_at,
204
215
  text: props.text,
205
216
  };
206
217
  return {
@@ -213,10 +224,14 @@ export function createAssistantMessageHistory(props: {
213
224
  * @internal
214
225
  */
215
226
  export function createSystemMessageHistory(props: {
227
+ id: string;
228
+ created_at: string & tags.Format<"date-time">;
216
229
  text: string;
217
230
  }): AgenticaSystemMessageHistory {
218
231
  const prompt: IAgenticaHistoryJson.ISystemMessage = {
219
232
  type: "systemMessage",
233
+ id: props.id,
234
+ created_at: props.created_at,
220
235
  text: props.text,
221
236
  };
222
237
  return {
@@ -229,15 +244,21 @@ export function createSystemMessageHistory(props: {
229
244
  * @internal
230
245
  */
231
246
  export function createDescribeHistory<Model extends ILlmSchema.Model>(props: {
247
+ id: string;
248
+ created_at: string & tags.Format<"date-time">;
232
249
  executes: AgenticaExecuteHistory<Model>[];
233
250
  text: string;
234
251
  }): AgenticaDescribeHistory<Model> {
235
252
  return {
236
253
  type: "describe",
254
+ id: props.id,
255
+ created_at: props.created_at,
237
256
  text: props.text,
238
257
  executes: props.executes,
239
258
  toJSON: () => ({
240
259
  type: "describe",
260
+ id: props.id,
261
+ created_at: props.created_at,
241
262
  text: props.text,
242
263
  executes: props.executes.map(execute => execute.toJSON()),
243
264
  }),
@@ -252,16 +273,19 @@ export function createDescribeHistory<Model extends ILlmSchema.Model>(props: {
252
273
  */
253
274
  export function createSelectHistory<Model extends ILlmSchema.Model>(props: {
254
275
  id: string;
255
- selections: AgenticaOperationSelection<Model>[];
276
+ created_at: string & tags.Format<"date-time">;
277
+ selection: AgenticaOperationSelection<Model>;
256
278
  }): AgenticaSelectHistory<Model> {
257
279
  return {
258
280
  type: "select",
259
281
  id: props.id,
260
- selections: props.selections,
282
+ selection: props.selection,
283
+ created_at: props.created_at,
261
284
  toJSON: () => ({
262
285
  type: "select",
263
286
  id: props.id,
264
- selections: props.selections.map(selection => selection.toJSON()),
287
+ created_at: props.created_at,
288
+ selection: props.selection.toJSON(),
265
289
  }),
266
290
  };
267
291
  }
@@ -271,16 +295,19 @@ export function createSelectHistory<Model extends ILlmSchema.Model>(props: {
271
295
  */
272
296
  export function createCancelHistory<Model extends ILlmSchema.Model>(props: {
273
297
  id: string;
274
- selections: AgenticaOperationSelection<Model>[];
298
+ created_at: string & tags.Format<"date-time">;
299
+ selection: AgenticaOperationSelection<Model>;
275
300
  }): AgenticaCancelHistory<Model> {
276
301
  return {
277
302
  type: "cancel",
278
303
  id: props.id,
279
- selections: props.selections,
304
+ created_at: props.created_at,
305
+ selection: props.selection,
280
306
  toJSON: () => ({
281
307
  type: "cancel",
282
308
  id: props.id,
283
- selections: props.selections.map(selection => selection.toJSON()),
309
+ created_at: props.created_at,
310
+ selection: props.selection.toJSON(),
284
311
  }),
285
312
  };
286
313
  }
@@ -292,6 +319,7 @@ export function createExecuteHistory<
292
319
  Model extends ILlmSchema.Model,
293
320
  >(props: {
294
321
  id: string;
322
+ created_at: string & tags.Format<"date-time">;
295
323
  operation: AgenticaOperation<Model>;
296
324
  arguments: Record<string, any>;
297
325
  value: unknown;
@@ -300,13 +328,15 @@ export function createExecuteHistory<
300
328
  type: "execute",
301
329
  protocol: props.operation.protocol as "class",
302
330
  id: props.id,
331
+ created_at: props.created_at,
303
332
  operation: props.operation as AgenticaOperation.Class<Model>,
304
333
  arguments: props.arguments,
305
334
  value: props.value,
306
335
  toJSON: () => ({
307
336
  type: "execute",
308
- protocol: props.operation.protocol,
309
337
  id: props.id,
338
+ created_at: props.created_at,
339
+ protocol: props.operation.protocol,
310
340
  operation: props.operation.toJSON(),
311
341
  arguments: props.arguments,
312
342
  value: props.value,
@@ -8,6 +8,5 @@ import type { AgenticaHistoryBase } from "./AgenticaHistoryBase";
8
8
  export interface AgenticaCancelHistory<
9
9
  Model extends ILlmSchema.Model,
10
10
  > extends AgenticaHistoryBase<"cancel", IAgenticaHistoryJson.ICancel> {
11
- id: string;
12
- selections: AgenticaOperationSelection<Model>[];
11
+ selection: AgenticaOperationSelection<Model>;
13
12
  }
@@ -31,11 +31,6 @@ export namespace AgenticaExecuteHistory {
31
31
  Operation extends AgenticaOperation<any>,
32
32
  Value,
33
33
  > extends AgenticaHistoryBase<"execute", IAgenticaHistoryJson.IExecute> {
34
- /**
35
- * ID of the LLM tool call result.
36
- */
37
- id: string;
38
-
39
34
  /**
40
35
  * Protocol of the operation.
41
36
  */
@@ -1,3 +1,5 @@
1
+ import type { tags } from "typia";
2
+
1
3
  /**
2
4
  * Base type for all histories in Agentica.
3
5
  *
@@ -14,10 +16,20 @@ export interface AgenticaHistoryBase<
14
16
  Type extends string,
15
17
  Json extends { type: Type },
16
18
  > {
19
+ /**
20
+ * Primary key of the history.
21
+ */
22
+ id: string;
23
+
17
24
  /**
18
25
  * Discriminator type.
19
26
  */
20
27
  type: Type;
21
28
 
29
+ /**
30
+ * Creation timestamp of the history.
31
+ */
32
+ created_at: string & tags.Format<"date-time">;
33
+
22
34
  toJSON: () => Json;
23
35
  }
@@ -8,6 +8,5 @@ import type { AgenticaHistoryBase } from "./AgenticaHistoryBase";
8
8
  export interface AgenticaSelectHistory<
9
9
  Model extends ILlmSchema.Model,
10
10
  > extends AgenticaHistoryBase<"select", IAgenticaHistoryJson.ISelect> {
11
- id: string;
12
- selections: AgenticaOperationSelection<Model>[];
11
+ selection: AgenticaOperationSelection<Model>;
13
12
  }
@@ -1,5 +1,5 @@
1
1
  import type OpenAI from "openai";
2
- import type { IValidation } from "typia";
2
+ import type { IValidation, tags } from "typia";
3
3
 
4
4
  import type { AgenticaEventSource } from "../events/AgenticaEventSource";
5
5
  import type { AgenticaUserMessageContent } from "../histories";
@@ -214,9 +214,19 @@ export namespace IAgenticaEventJson {
214
214
  }
215
215
 
216
216
  interface IBase<Type extends string> {
217
+ /**
218
+ * Primary key of the event.
219
+ */
220
+ id: string;
221
+
217
222
  /**
218
223
  * Discriminator type.
219
224
  */
220
225
  type: Type;
226
+
227
+ /**
228
+ * Creation timestamp of the event.
229
+ */
230
+ created_at: string & tags.Format<"date-time">;
221
231
  }
222
232
  }
@@ -1,3 +1,5 @@
1
+ import type { tags } from "typia";
2
+
1
3
  import type { AgenticaUserMessageContent } from "../histories";
2
4
 
3
5
  import type { IAgenticaOperationJson } from "./IAgenticaOperationJson";
@@ -77,15 +79,10 @@ export namespace IAgenticaHistoryJson {
77
79
  * Selection prompt about candidate functions to call.
78
80
  */
79
81
  export interface ISelect extends IBase<"select"> {
80
- /**
81
- * ID of the LLM tool call result.
82
- */
83
- id: string;
84
-
85
82
  /**
86
83
  * Operations that have been selected.
87
84
  */
88
- selections: IAgenticaOperationSelectionJson[];
85
+ selection: IAgenticaOperationSelectionJson;
89
86
  }
90
87
 
91
88
  /**
@@ -94,15 +91,10 @@ export namespace IAgenticaHistoryJson {
94
91
  * Cancellation prompt about the candidate functions to be discarded.
95
92
  */
96
93
  export interface ICancel extends IBase<"cancel"> {
97
- /**
98
- * ID of the LLM tool call result.
99
- */
100
- id: string;
101
-
102
94
  /**
103
95
  * Operations that have been cancelled.
104
96
  */
105
- selections: IAgenticaOperationSelectionJson[];
97
+ selection: IAgenticaOperationSelectionJson;
106
98
  }
107
99
 
108
100
  /**
@@ -111,11 +103,6 @@ export namespace IAgenticaHistoryJson {
111
103
  * Execution prompt about the LLM function calling.
112
104
  */
113
105
  export interface IExecute extends IBase<"execute"> {
114
- /**
115
- * ID of the LLM tool call result.
116
- */
117
- id: string;
118
-
119
106
  /**
120
107
  * Target operation to call.
121
108
  */
@@ -152,9 +139,19 @@ export namespace IAgenticaHistoryJson {
152
139
  }
153
140
 
154
141
  interface IBase<Type extends string> {
142
+ /**
143
+ * Primary key of the history.
144
+ */
145
+ id: string;
146
+
155
147
  /**
156
148
  * Discriminator type.
157
149
  */
158
150
  type: Type;
151
+
152
+ /**
153
+ * Creation timestamp of the history.
154
+ */
155
+ created_at: string & tags.Format<"date-time">;
159
156
  }
160
157
  }