@crewai-ts/core 0.1.12 → 0.2.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 (56) hide show
  1. package/README.md +174 -0
  2. package/dist/agent.d.ts +16 -18
  3. package/dist/auth.cjs +598 -0
  4. package/dist/auth.js +40 -0
  5. package/dist/{chunk-3PVW4JKT.js → chunk-C43UEMCX.js} +6712 -7268
  6. package/dist/chunk-CCOE6MLE.js +896 -0
  7. package/dist/chunk-HFQTF332.js +4455 -0
  8. package/dist/{chunk-BE4JYKSG.js → chunk-MM4ROIFG.js} +12 -1490
  9. package/dist/chunk-RH43TNKN.js +238 -0
  10. package/dist/chunk-S477WFUT.js +565 -0
  11. package/dist/chunk-SB7ADUQA.js +110 -0
  12. package/dist/chunk-T32G6KDW.js +40 -0
  13. package/dist/crew.d.ts +24 -26
  14. package/dist/events.cjs +7513 -0
  15. package/dist/events.js +406 -0
  16. package/dist/experimental-conversational.cjs +272 -0
  17. package/dist/experimental-conversational.js +26 -0
  18. package/dist/feature-hooks.cjs +149 -0
  19. package/dist/feature-hooks.d.ts +94 -0
  20. package/dist/feature-hooks.js +36 -0
  21. package/dist/index.cjs +33923 -64381
  22. package/dist/index.d.ts +2 -15
  23. package/dist/index.js +16720 -49562
  24. package/dist/input-provider.d.ts +3 -4
  25. package/dist/lite-agent.d.ts +4 -4
  26. package/dist/llm.cjs +7467 -0
  27. package/dist/llm.d.ts +0 -4
  28. package/dist/llm.js +225 -0
  29. package/dist/optional-yaml.d.ts +8 -0
  30. package/dist/project.d.ts +1 -1
  31. package/dist/schema-utils.cjs +968 -0
  32. package/dist/schema-utils.d.ts +1 -1
  33. package/dist/schema-utils.js +102 -0
  34. package/dist/state-provider-core.js +3 -2
  35. package/dist/task.d.ts +3 -4
  36. package/dist/tools.cjs +6872 -0
  37. package/dist/tools.d.ts +0 -60
  38. package/dist/tools.js +114 -0
  39. package/dist/types.cjs +68 -0
  40. package/dist/types.js +14 -0
  41. package/package.json +52 -111
  42. package/dist/a2a.d.ts +0 -1684
  43. package/dist/a2ui-schemas.d.ts +0 -3312
  44. package/dist/a2ui.d.ts +0 -379
  45. package/dist/flow-conversation.d.ts +0 -90
  46. package/dist/flow-definition.d.ts +0 -195
  47. package/dist/flow-persistence.d.ts +0 -107
  48. package/dist/flow-visualization.d.ts +0 -77
  49. package/dist/flow.d.ts +0 -927
  50. package/dist/knowledge.d.ts +0 -353
  51. package/dist/mcp-DS7UMYAM.js +0 -62
  52. package/dist/mcp.d.ts +0 -315
  53. package/dist/memory.d.ts +0 -915
  54. package/dist/openai-completion.d.ts +0 -327
  55. package/dist/provider-completions.d.ts +0 -596
  56. package/dist/rag.d.ts +0 -1074
@@ -0,0 +1,238 @@
1
+ // src/experimental-conversational.ts
2
+ import { randomUUID } from "crypto";
3
+ var ConversationMessageRole = Object.freeze({ kind: "ConversationMessageRole" });
4
+ var ConversationEventVisibility = Object.freeze({ kind: "ConversationEventVisibility" });
5
+ var RouterConfig = class {
6
+ prompt;
7
+ responseFormat;
8
+ response_format;
9
+ llm;
10
+ routes;
11
+ routeDescriptions;
12
+ route_descriptions;
13
+ defaultIntent;
14
+ default_intent;
15
+ fallbackIntent;
16
+ fallback_intent;
17
+ intentField;
18
+ intent_field;
19
+ constructor(options = {}) {
20
+ this.prompt = options.prompt ?? null;
21
+ this.responseFormat = options.responseFormat ?? options.response_format ?? null;
22
+ this.response_format = this.responseFormat;
23
+ this.llm = options.llm ?? null;
24
+ this.routes = options.routes ? [...options.routes] : null;
25
+ this.routeDescriptions = options.routeDescriptions ?? options.route_descriptions ?? null;
26
+ this.route_descriptions = this.routeDescriptions;
27
+ this.defaultIntent = options.defaultIntent ?? options.default_intent ?? "converse";
28
+ this.default_intent = this.defaultIntent;
29
+ this.fallbackIntent = options.fallbackIntent ?? options.fallback_intent ?? "converse";
30
+ this.fallback_intent = this.fallbackIntent;
31
+ this.intentField = options.intentField ?? options.intent_field ?? "intent";
32
+ this.intent_field = this.intentField;
33
+ }
34
+ };
35
+ var ConversationConfig = class {
36
+ systemPrompt;
37
+ system_prompt;
38
+ llm;
39
+ router;
40
+ answerFromHistoryPrompt;
41
+ answer_from_history_prompt;
42
+ defaultIntents;
43
+ default_intents;
44
+ intentLlm;
45
+ intent_llm;
46
+ answerFromHistoryLlm;
47
+ answer_from_history_llm;
48
+ visibleAgentOutputs;
49
+ visible_agent_outputs;
50
+ deferTraceFinalization;
51
+ defer_trace_finalization;
52
+ constructor(options = {}) {
53
+ this.systemPrompt = options.systemPrompt ?? options.system_prompt ?? null;
54
+ this.system_prompt = this.systemPrompt;
55
+ this.llm = options.llm ?? null;
56
+ const router = options.router ?? null;
57
+ this.router = router instanceof RouterConfig ? router : router ? new RouterConfig(router) : null;
58
+ this.answerFromHistoryPrompt = options.answerFromHistoryPrompt ?? options.answer_from_history_prompt ?? null;
59
+ this.answer_from_history_prompt = this.answerFromHistoryPrompt;
60
+ this.defaultIntents = options.defaultIntents ?? options.default_intents ?? null;
61
+ this.default_intents = this.defaultIntents;
62
+ this.intentLlm = options.intentLlm ?? options.intent_llm ?? null;
63
+ this.intent_llm = this.intentLlm;
64
+ this.answerFromHistoryLlm = options.answerFromHistoryLlm ?? options.answer_from_history_llm ?? null;
65
+ this.answer_from_history_llm = this.answerFromHistoryLlm;
66
+ this.visibleAgentOutputs = options.visibleAgentOutputs ?? options.visible_agent_outputs ?? null;
67
+ this.visible_agent_outputs = this.visibleAgentOutputs;
68
+ this.deferTraceFinalization = options.deferTraceFinalization ?? options.defer_trace_finalization ?? true;
69
+ this.defer_trace_finalization = this.deferTraceFinalization;
70
+ }
71
+ __call__(flowClass) {
72
+ flowClass.conversational_config = this;
73
+ return flowClass;
74
+ }
75
+ };
76
+ var ConversationMessage = class {
77
+ role;
78
+ content;
79
+ name;
80
+ tool_call_id;
81
+ toolCallId;
82
+ tool_calls;
83
+ toolCalls;
84
+ files;
85
+ metadata;
86
+ constructor(options) {
87
+ this.role = options.role;
88
+ this.content = options.content;
89
+ this.name = options.name ?? null;
90
+ this.tool_call_id = options.tool_call_id ?? options.toolCallId ?? null;
91
+ this.toolCallId = this.tool_call_id;
92
+ this.tool_calls = options.tool_calls ?? options.toolCalls ?? null;
93
+ this.toolCalls = this.tool_calls;
94
+ this.files = options.files ?? null;
95
+ this.metadata = options.metadata ?? {};
96
+ }
97
+ modelDump(options = {}) {
98
+ return compactObject({
99
+ role: this.role,
100
+ content: this.content,
101
+ name: this.name,
102
+ tool_call_id: this.tool_call_id,
103
+ tool_calls: this.tool_calls,
104
+ files: this.files,
105
+ metadata: this.metadata
106
+ }, options.excludeNone ?? options.exclude_none ?? false);
107
+ }
108
+ model_dump(options = {}) {
109
+ return this.modelDump(options);
110
+ }
111
+ };
112
+ var AgentMessage = class {
113
+ role;
114
+ content;
115
+ metadata;
116
+ constructor(options) {
117
+ this.role = options.role ?? "assistant";
118
+ this.content = options.content;
119
+ this.metadata = options.metadata ?? {};
120
+ }
121
+ model_dump(options = {}) {
122
+ return compactObject({ role: this.role, content: this.content, metadata: this.metadata }, options.excludeNone ?? options.exclude_none ?? false);
123
+ }
124
+ };
125
+ var ConversationEvent = class {
126
+ type;
127
+ payload;
128
+ agent_name;
129
+ agentName;
130
+ visibility;
131
+ constructor(options) {
132
+ this.type = options.type;
133
+ this.payload = options.payload ?? {};
134
+ this.agent_name = options.agent_name ?? options.agentName ?? null;
135
+ this.agentName = this.agent_name;
136
+ this.visibility = options.visibility ?? "private";
137
+ }
138
+ model_dump(options = {}) {
139
+ return compactObject({
140
+ type: this.type,
141
+ payload: this.payload,
142
+ agent_name: this.agent_name,
143
+ visibility: this.visibility
144
+ }, options.excludeNone ?? options.exclude_none ?? false);
145
+ }
146
+ };
147
+ var ConversationState = class {
148
+ id;
149
+ messages;
150
+ current_user_message;
151
+ currentUserMessage;
152
+ last_user_message;
153
+ lastUserMessage;
154
+ last_intent;
155
+ lastIntent;
156
+ ended;
157
+ events;
158
+ agent_threads;
159
+ agentThreads;
160
+ session_ready;
161
+ sessionReady;
162
+ constructor(options = {}) {
163
+ this.id = options.id ?? randomUUID();
164
+ this.messages = (options.messages ?? []).map((message) => message instanceof ConversationMessage ? message : new ConversationMessage(message));
165
+ this.current_user_message = options.current_user_message ?? options.currentUserMessage ?? null;
166
+ this.currentUserMessage = this.current_user_message;
167
+ this.last_user_message = options.last_user_message ?? options.lastUserMessage ?? null;
168
+ this.lastUserMessage = this.last_user_message;
169
+ this.last_intent = options.last_intent ?? options.lastIntent ?? null;
170
+ this.lastIntent = this.last_intent;
171
+ this.ended = options.ended ?? false;
172
+ this.events = (options.events ?? []).map((event) => event instanceof ConversationEvent ? event : new ConversationEvent(event));
173
+ this.agent_threads = Object.fromEntries(
174
+ Object.entries(options.agent_threads ?? options.agentThreads ?? {}).map(([agent, messages]) => [
175
+ agent,
176
+ messages.map((message) => message instanceof AgentMessage ? message : new AgentMessage(message))
177
+ ])
178
+ );
179
+ this.agentThreads = this.agent_threads;
180
+ this.session_ready = options.session_ready ?? options.sessionReady ?? false;
181
+ this.sessionReady = this.session_ready;
182
+ }
183
+ isReady() {
184
+ return this.session_ready;
185
+ }
186
+ is_ready() {
187
+ return this.isReady();
188
+ }
189
+ };
190
+ function messageToLlmDict(message) {
191
+ const data = message instanceof ConversationMessage ? message.model_dump({ exclude_none: true }) : isRecord(message) ? { ...message } : { role: "user", content: stringifyMessageContent(message) };
192
+ Reflect.deleteProperty(data, "metadata");
193
+ return data;
194
+ }
195
+ var message_to_llm_dict = messageToLlmDict;
196
+ function _conversational_only(func) {
197
+ func.__conversational_only__ = true;
198
+ return func;
199
+ }
200
+ function compactObject(record, excludeNone) {
201
+ if (!excludeNone) {
202
+ return record;
203
+ }
204
+ return Object.fromEntries(Object.entries(record).filter(([, value]) => value !== null && value !== void 0));
205
+ }
206
+ function isRecord(value) {
207
+ return value !== null && typeof value === "object" && !Array.isArray(value);
208
+ }
209
+ function stringifyMessageContent(value) {
210
+ if (typeof value === "string") {
211
+ return value;
212
+ }
213
+ if (value === null || value === void 0) {
214
+ return "";
215
+ }
216
+ if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
217
+ return String(value);
218
+ }
219
+ try {
220
+ return JSON.stringify(value);
221
+ } catch {
222
+ return Object.prototype.toString.call(value);
223
+ }
224
+ }
225
+
226
+ export {
227
+ ConversationMessageRole,
228
+ ConversationEventVisibility,
229
+ RouterConfig,
230
+ ConversationConfig,
231
+ ConversationMessage,
232
+ AgentMessage,
233
+ ConversationEvent,
234
+ ConversationState,
235
+ messageToLlmDict,
236
+ message_to_llm_dict,
237
+ _conversational_only
238
+ };