@futdevpro/nts-dynamo 1.15.463 → 1.15.465
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/build/_modules/ai/_collections/ai-agent-context.util.d.ts +43 -0
- package/build/_modules/ai/_collections/ai-agent-context.util.d.ts.map +1 -0
- package/build/_modules/ai/_collections/ai-agent-context.util.js +96 -0
- package/build/_modules/ai/_collections/ai-agent-context.util.js.map +1 -0
- package/build/_modules/ai/_collections/ai-field-assist.util.d.ts +54 -0
- package/build/_modules/ai/_collections/ai-field-assist.util.d.ts.map +1 -0
- package/build/_modules/ai/_collections/ai-field-assist.util.js +163 -0
- package/build/_modules/ai/_collections/ai-field-assist.util.js.map +1 -0
- package/build/_modules/ai/_enums/dynts-ai-field-assist-mode.type-enum.d.ts +8 -0
- package/build/_modules/ai/_enums/dynts-ai-field-assist-mode.type-enum.d.ts.map +1 -0
- package/build/_modules/ai/_enums/dynts-ai-field-assist-mode.type-enum.js +12 -0
- package/build/_modules/ai/_enums/dynts-ai-field-assist-mode.type-enum.js.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-context-item.interface.d.ts +21 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-context-item.interface.d.ts.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-context-item.interface.js +3 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-context-item.interface.js.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-context-provider.interface.d.ts +17 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-context-provider.interface.d.ts.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-context-provider.interface.js +3 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-context-provider.interface.js.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-context-report.interface.d.ts +12 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-context-report.interface.d.ts.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-context-report.interface.js +3 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-context-report.interface.js.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-context-seed.interface.d.ts +19 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-context-seed.interface.d.ts.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-context-seed.interface.js +3 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-context-seed.interface.js.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-draft.interface.d.ts +17 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-draft.interface.d.ts.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-draft.interface.js +3 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-draft.interface.js.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-llm.interface.d.ts +21 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-llm.interface.d.ts.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-llm.interface.js +3 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-llm.interface.js.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-rendered-context.interface.d.ts +12 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-rendered-context.interface.d.ts.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-rendered-context.interface.js +3 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-rendered-context.interface.js.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-result.interface.d.ts +12 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-result.interface.d.ts.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-result.interface.js +3 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-result.interface.js.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-settings.interface.d.ts +20 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-settings.interface.d.ts.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-settings.interface.js +3 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-settings.interface.js.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-tool-run.interface.d.ts +16 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-tool-run.interface.d.ts.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-tool-run.interface.js +3 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-tool-run.interface.js.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-tool.interface.d.ts +13 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-tool.interface.d.ts.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-tool.interface.js +3 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-tool.interface.js.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-turn.interface.d.ts +23 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-turn.interface.d.ts.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-turn.interface.js +3 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-agent-turn.interface.js.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-field-assist-complete.type.d.ts +8 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-field-assist-complete.type.d.ts.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-field-assist-complete.type.js +3 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-field-assist-complete.type.js.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-field-assist-messages.interface.d.ts +6 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-field-assist-messages.interface.d.ts.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-field-assist-messages.interface.js +3 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-field-assist-messages.interface.js.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-field-assist-request.interface.d.ts +21 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-field-assist-request.interface.d.ts.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-field-assist-request.interface.js +3 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-field-assist-request.interface.js.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-field-assist-result.interface.d.ts +15 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-field-assist-result.interface.d.ts.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-field-assist-result.interface.js +3 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-field-assist-result.interface.js.map +1 -0
- package/build/_modules/ai/_services/ai-agent.control-service.d.ts +104 -0
- package/build/_modules/ai/_services/ai-agent.control-service.d.ts.map +1 -0
- package/build/_modules/ai/_services/ai-agent.control-service.js +266 -0
- package/build/_modules/ai/_services/ai-agent.control-service.js.map +1 -0
- package/build/_modules/ai/index.d.ts +20 -0
- package/build/_modules/ai/index.d.ts.map +1 -1
- package/build/_modules/ai/index.js +22 -0
- package/build/_modules/ai/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DyNTS_AI_Agent_ControlService = void 0;
|
|
4
|
+
const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
|
|
5
|
+
const ai_1 = require("@futdevpro/fsm-dynamo/ai");
|
|
6
|
+
const ai_agent_context_util_1 = require("../_collections/ai-agent-context.util");
|
|
7
|
+
/**
|
|
8
|
+
* BFR-MYASSISTANT-026 — a plain, general agentic loop: the project gives the tools and the context providers, the
|
|
9
|
+
* model (any `DyNTS_AI_LLM_ServiceBase` provider) runs the tool loop.
|
|
10
|
+
*
|
|
11
|
+
* - **tools:** `addTool({ name, description, parameters, handler })` — the definition and the handler in one object;
|
|
12
|
+
* a tool's error becomes an `ERROR …` result for the model, a long result is cut (`maxToolResultLength`);
|
|
13
|
+
* - **context bound to the user message, NOT to the history:** `prepare` runs the context providers (e.g. RAG) for a
|
|
14
|
+
* message and gives a draft; the user adjusts it (switches items off, edits, reorders, adds); `run` sends the
|
|
15
|
+
* message with exactly that context. The history sent later holds only the messages and the answers — the context
|
|
16
|
+
* stays in the turn (shown / audited), it is not resent;
|
|
17
|
+
* - the context is sent as DATA between markers (`DyNTS_AI_AgentContext_Util`), within `maxContextLength`, and the
|
|
18
|
+
* result reports which item was sent, cut, dropped or switched off;
|
|
19
|
+
* - stateless between requests: the project stores the turns; one instance serves any number of requests.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const agent = new DyNTS_AI_Agent_ControlService({ llm: openAiService, systemPrompt: 'You are the order assistant.' })
|
|
24
|
+
* .addTool({ name: 'find_order', description: 'Finds an order by id.', parameters: orderIdSchema,
|
|
25
|
+
* handler: (args) => this.orders.describe(`${args.id}`) })
|
|
26
|
+
* .addContextProvider({ name: 'docs', provide: ({ message }) => this.rag.search(message) });
|
|
27
|
+
*
|
|
28
|
+
* const draft = await agent.prepare({ message: text, history: turns }); // ⇒ to the client, adjusted there
|
|
29
|
+
* const result = await agent.run({ draft: adjustedDraft, history: turns, issuer: accountId });
|
|
30
|
+
* turns.push(result.turn);
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
class DyNTS_AI_Agent_ControlService {
|
|
34
|
+
settings;
|
|
35
|
+
/** The longest user message accepted (characters). */
|
|
36
|
+
static maxMessageLength = 20000;
|
|
37
|
+
/** The most context items of one message. */
|
|
38
|
+
static maxContextItems = 50;
|
|
39
|
+
/** A tool name the providers accept (OpenAI / Anthropic / Gemini). */
|
|
40
|
+
static toolNamePattern = /^[a-zA-Z0-9_-]{1,64}$/;
|
|
41
|
+
/** The defaults of the optional settings. */
|
|
42
|
+
static defaults = { maxIterations: 8, historyLimit: 20, maxContextLength: 12000, maxToolResultLength: 20000 };
|
|
43
|
+
/** The tools, by name. */
|
|
44
|
+
tools = new Map();
|
|
45
|
+
/** The context providers, in their order. */
|
|
46
|
+
contextProviders = [];
|
|
47
|
+
/** An agent with its model and limits; the tools and the context providers are added after. */
|
|
48
|
+
constructor(settings) {
|
|
49
|
+
this.settings = settings;
|
|
50
|
+
}
|
|
51
|
+
/** The registered tools' names. */
|
|
52
|
+
getToolNames() {
|
|
53
|
+
return [...this.tools.keys()];
|
|
54
|
+
}
|
|
55
|
+
/** The registered context providers' names. */
|
|
56
|
+
getContextProviderNames() {
|
|
57
|
+
return this.contextProviders.map((provider) => provider.name);
|
|
58
|
+
}
|
|
59
|
+
/** Adds a tool (a unique, provider-safe name). */
|
|
60
|
+
addTool(tool) {
|
|
61
|
+
if (!DyNTS_AI_Agent_ControlService.toolNamePattern.test(tool?.name ?? '') || typeof tool.handler !== 'function') {
|
|
62
|
+
throw new fsm_dynamo_1.DyFM_Error({
|
|
63
|
+
errorCode: 'DyNTS-AIAG-TL1',
|
|
64
|
+
message: `Invalid agent tool '${tool?.name}': the name must match `
|
|
65
|
+
+ `${DyNTS_AI_Agent_ControlService.toolNamePattern} and a handler is required.`,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
if (this.tools.has(tool.name)) {
|
|
69
|
+
throw new fsm_dynamo_1.DyFM_Error({ errorCode: 'DyNTS-AIAG-TL2', message: `The agent tool '${tool.name}' is already added.` });
|
|
70
|
+
}
|
|
71
|
+
this.tools.set(tool.name, tool);
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
/** Adds a context provider (a unique name). */
|
|
75
|
+
addContextProvider(provider) {
|
|
76
|
+
const name = provider?.name?.trim() ?? '';
|
|
77
|
+
if (!name || typeof provider.provide !== 'function' || name === ai_agent_context_util_1.DyNTS_AI_AgentContext_Util.userProviderName) {
|
|
78
|
+
throw new fsm_dynamo_1.DyFM_Error({
|
|
79
|
+
errorCode: 'DyNTS-AIAG-CP1',
|
|
80
|
+
message: `Invalid context provider '${provider?.name}': a name `
|
|
81
|
+
+ `(not '${ai_agent_context_util_1.DyNTS_AI_AgentContext_Util.userProviderName}') and a provide function are required.`,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (this.getContextProviderNames().includes(name)) {
|
|
85
|
+
throw new fsm_dynamo_1.DyFM_Error({
|
|
86
|
+
errorCode: 'DyNTS-AIAG-CP2', message: `The context provider '${name}' is already added.`,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
this.contextProviders.push({ name: name, provide: provider.provide });
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
/** Runs the context providers for a message ⇒ the draft to adjust before sending. */
|
|
93
|
+
async prepare(set) {
|
|
94
|
+
const message = DyNTS_AI_Agent_ControlService.validMessage(set.message);
|
|
95
|
+
const history = set.history ?? [];
|
|
96
|
+
const outcomes = await Promise.allSettled(
|
|
97
|
+
// a provider that throws synchronously is a failed provider too (not a failed prepare)
|
|
98
|
+
this.contextProviders.map((provider) => Promise.resolve()
|
|
99
|
+
.then(() => provider.provide({ message: message, history: history }))));
|
|
100
|
+
const draft = { message: message, context: [], failedProviders: [] };
|
|
101
|
+
outcomes.forEach((outcome, index) => {
|
|
102
|
+
const providerName = this.contextProviders[index].name;
|
|
103
|
+
if (outcome.status === 'rejected') {
|
|
104
|
+
draft.failedProviders.push({
|
|
105
|
+
providerName: providerName,
|
|
106
|
+
reason: DyNTS_AI_Agent_ControlService.reason({ providerName: providerName, error: outcome.reason }),
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
else if (!Array.isArray(outcome.value)) {
|
|
110
|
+
draft.failedProviders.push({ providerName: providerName, reason: 'The provider returned no list.' });
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
draft.context.push(...ai_agent_context_util_1.DyNTS_AI_AgentContext_Util.toItems({ seeds: outcome.value, providerName: providerName }));
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return draft;
|
|
117
|
+
}
|
|
118
|
+
/** Sends the (adjusted) draft: the tool loop until the final answer ⇒ the turn to store. */
|
|
119
|
+
async run(set) {
|
|
120
|
+
const toolRuns = [];
|
|
121
|
+
const built = this.build({ draft: set.draft, history: set.history ?? [] });
|
|
122
|
+
const response = await this.settings.llm.requestWithTools({
|
|
123
|
+
conversation: built.conversation,
|
|
124
|
+
tools: [...this.tools.values()].map((tool) => ({
|
|
125
|
+
name: tool.name, description: tool.description, parameters: tool.parameters,
|
|
126
|
+
})),
|
|
127
|
+
toolHandlers: this.handlers(toolRuns),
|
|
128
|
+
settings: built.settings,
|
|
129
|
+
issuer: set.issuer,
|
|
130
|
+
maxIterations: this.settings.maxIterations ?? DyNTS_AI_Agent_ControlService.defaults.maxIterations,
|
|
131
|
+
signal: set.signal,
|
|
132
|
+
});
|
|
133
|
+
const answer = (response?.content ?? '').trim();
|
|
134
|
+
if (!answer) {
|
|
135
|
+
throw new fsm_dynamo_1.DyFM_Error({
|
|
136
|
+
status: 502,
|
|
137
|
+
errorCode: 'DyNTS-AIAG-ANS1',
|
|
138
|
+
message: `The agent's model gave no answer (model: ${response?.model ?? 'unknown'}).`,
|
|
139
|
+
userMessage: 'The AI gave no answer. Please try again.',
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
const turn = {
|
|
143
|
+
message: set.draft.message.trim(),
|
|
144
|
+
answer: answer,
|
|
145
|
+
context: built.context.sentItems,
|
|
146
|
+
toolRuns: toolRuns,
|
|
147
|
+
model: response.model,
|
|
148
|
+
finalCallTokens: response.usage?.totalTokens,
|
|
149
|
+
createdAt: Date.now(),
|
|
150
|
+
};
|
|
151
|
+
return { answer: answer, turn: turn, contextReport: built.context.report };
|
|
152
|
+
}
|
|
153
|
+
/** `prepare` + `run` in one step (no adjusting): the providers' context is sent as it came. */
|
|
154
|
+
async ask(set) {
|
|
155
|
+
const draft = await this.prepare({ message: set.message, history: set.history });
|
|
156
|
+
return this.run({ draft: draft, history: set.history, issuer: set.issuer, signal: set.signal });
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* What `run` sends (for a preview / a test): the history as plain messages + answers, then the message with its
|
|
160
|
+
* context block; the call settings with the agent's system prompt (+ the context rule when context goes).
|
|
161
|
+
*/
|
|
162
|
+
build(set) {
|
|
163
|
+
const message = DyNTS_AI_Agent_ControlService.validMessage(set.draft?.message);
|
|
164
|
+
const items = DyNTS_AI_Agent_ControlService.validContext(set.draft.context);
|
|
165
|
+
const context = ai_agent_context_util_1.DyNTS_AI_AgentContext_Util.render({
|
|
166
|
+
items: items,
|
|
167
|
+
maxLength: this.settings.maxContextLength ?? DyNTS_AI_Agent_ControlService.defaults.maxContextLength,
|
|
168
|
+
});
|
|
169
|
+
const historyLimit = this.settings.historyLimit ?? DyNTS_AI_Agent_ControlService.defaults.historyLimit;
|
|
170
|
+
const history = (historyLimit > 0 ? set.history.slice(-historyLimit) : [])
|
|
171
|
+
.flatMap((turn) => [
|
|
172
|
+
{ role: ai_1.DyFM_AI_MessageRole.user, content: turn.message },
|
|
173
|
+
{ role: ai_1.DyFM_AI_MessageRole.assistant, content: turn.answer },
|
|
174
|
+
]);
|
|
175
|
+
const base = this.settings.callSettings ?? this.settings.llm.defaultSettings ?? {};
|
|
176
|
+
const systemPrompt = [
|
|
177
|
+
this.settings.systemPrompt ?? base.systemPrompt,
|
|
178
|
+
...(context.text ? [ai_agent_context_util_1.DyNTS_AI_AgentContext_Util.contract] : []),
|
|
179
|
+
].filter((part) => !!part?.trim()).join('\n\n');
|
|
180
|
+
return {
|
|
181
|
+
conversation: [
|
|
182
|
+
...history,
|
|
183
|
+
{ role: ai_1.DyFM_AI_MessageRole.user, content: context.text ? `${context.text}\n\n${message}` : message },
|
|
184
|
+
],
|
|
185
|
+
settings: { ...base, systemPrompt: systemPrompt },
|
|
186
|
+
context: context,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/** The handlers of one run: each records its run, and cuts a long result. */
|
|
190
|
+
handlers(toolRuns) {
|
|
191
|
+
const maxLength = this.settings.maxToolResultLength ?? DyNTS_AI_Agent_ControlService.defaults.maxToolResultLength;
|
|
192
|
+
const handlers = {};
|
|
193
|
+
for (const tool of this.tools.values()) {
|
|
194
|
+
/** Runs the tool, records the run, cuts a long result. */
|
|
195
|
+
const handler = async (args) => {
|
|
196
|
+
const start = Date.now();
|
|
197
|
+
/** Records this run. */
|
|
198
|
+
const record = (result) => {
|
|
199
|
+
toolRuns.push({
|
|
200
|
+
toolName: tool.name, arguments: args, isError: result.isError, durationMs: Date.now() - start,
|
|
201
|
+
resultLength: result.length, isResultTruncated: result.length > maxLength,
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
try {
|
|
205
|
+
const output = `${await tool.handler(args) ?? ''}`;
|
|
206
|
+
record({ isError: false, length: output.length });
|
|
207
|
+
return output.length > maxLength
|
|
208
|
+
? `${output.slice(0, maxLength)}\n…[cut: ${output.length - maxLength} more characters]`
|
|
209
|
+
: output;
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
record({ isError: true, length: 0 });
|
|
213
|
+
throw error;
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
handlers[tool.name] = handler;
|
|
217
|
+
}
|
|
218
|
+
return handlers;
|
|
219
|
+
}
|
|
220
|
+
/** The message, trimmed (a 400 when empty or too long). */
|
|
221
|
+
static validMessage(message) {
|
|
222
|
+
const text = typeof message === 'string' ? message.trim() : '';
|
|
223
|
+
if (!text || text.length > DyNTS_AI_Agent_ControlService.maxMessageLength) {
|
|
224
|
+
throw new fsm_dynamo_1.DyFM_Error({
|
|
225
|
+
status: 400,
|
|
226
|
+
errorCode: text ? 'DyNTS-AIAG-REQ2' : 'DyNTS-AIAG-REQ1',
|
|
227
|
+
message: text
|
|
228
|
+
? `The agent message is longer than ${DyNTS_AI_Agent_ControlService.maxMessageLength} characters.`
|
|
229
|
+
: 'The agent message is empty.',
|
|
230
|
+
userMessage: text ? 'The message is too long.' : 'Please write a message.',
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
return text;
|
|
234
|
+
}
|
|
235
|
+
/** The draft's context, checked (it comes back from the client). */
|
|
236
|
+
static validContext(context) {
|
|
237
|
+
const items = context ?? [];
|
|
238
|
+
const isValid = Array.isArray(items)
|
|
239
|
+
&& items.length <= DyNTS_AI_Agent_ControlService.maxContextItems
|
|
240
|
+
&& items.every((item) => typeof item?.id === 'string' && typeof item.content === 'string' && typeof item.title === 'string');
|
|
241
|
+
if (!isValid) {
|
|
242
|
+
throw new fsm_dynamo_1.DyFM_Error({
|
|
243
|
+
status: 400,
|
|
244
|
+
errorCode: 'DyNTS-AIAG-REQ3',
|
|
245
|
+
message: `Invalid agent context: at most ${DyNTS_AI_Agent_ControlService.maxContextItems} items, each with a`
|
|
246
|
+
+ ' text id, title and content.',
|
|
247
|
+
userMessage: 'The attached context is not valid.',
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
return items.map((item) => ({
|
|
251
|
+
...item,
|
|
252
|
+
providerName: item.providerName || ai_agent_context_util_1.DyNTS_AI_AgentContext_Util.userProviderName,
|
|
253
|
+
isEnabled: item.isEnabled !== false,
|
|
254
|
+
}));
|
|
255
|
+
}
|
|
256
|
+
/** The reason the user sees (the error's user message, or a plain one); the technical text goes to the log. */
|
|
257
|
+
static reason(set) {
|
|
258
|
+
const technical = set.error instanceof Error ? set.error.message : `${set.error}`;
|
|
259
|
+
fsm_dynamo_1.DyFM_Log.warn(`[DyNTS-AIAG-CP3] context provider '${set.providerName}' failed: ${technical}`);
|
|
260
|
+
return set.error instanceof fsm_dynamo_1.DyFM_Error && set.error.__userMessage
|
|
261
|
+
? set.error.__userMessage
|
|
262
|
+
: 'The context could not be loaded.';
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
exports.DyNTS_AI_Agent_ControlService = DyNTS_AI_Agent_ControlService;
|
|
266
|
+
//# sourceMappingURL=ai-agent.control-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-agent.control-service.js","sourceRoot":"","sources":["../../../../src/_modules/ai/_services/ai-agent.control-service.ts"],"names":[],"mappings":";;;AAAA,sDAA6D;AAC7D,iDAGkC;AAElC,iFAAmF;AAgBnF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAa,6BAA6B;IAmBX;IAlB7B,sDAAsD;IACtD,MAAM,CAAU,gBAAgB,GAAW,KAAK,CAAC;IACjD,6CAA6C;IAC7C,MAAM,CAAU,eAAe,GAAW,EAAE,CAAC;IAC7C,sEAAsE;IACtE,MAAM,CAAU,eAAe,GAAW,uBAAuB,CAAC;IAElE,6CAA6C;IAC7C,MAAM,CAAU,QAAQ,GAEpB,EAAE,aAAa,EAAE,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,gBAAgB,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC;IAEhG,0BAA0B;IACT,KAAK,GAA+C,IAAI,GAAG,EAAyC,CAAC;IACtH,6CAA6C;IAC5B,gBAAgB,GAA+C,EAAE,CAAC;IAEnF,+FAA+F;IAC/F,YAA6B,QAA2C;QAA3C,aAAQ,GAAR,QAAQ,CAAmC;IAAG,CAAC;IAE5E,mCAAmC;IACnC,YAAY;QACV,OAAO,CAAE,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAE,CAAC;IAClC,CAAC;IAED,+CAA+C;IAC/C,uBAAuB;QACrB,OAAO,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAkD,EAAU,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAClH,CAAC;IAED,kDAAkD;IAClD,OAAO,CAAC,IAAmC;QACzC,IAAI,CAAC,6BAA6B,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,E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,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,EAAE,CAAC;QAE1F,qBAAQ,CAAC,IAAI,CAAC,sCAAsC,GAAG,CAAC,YAAY,aAAa,SAAS,EAAE,CAAC,CAAC;QAE9F,OAAO,GAAG,CAAC,KAAK,YAAY,uBAAU,IAAI,GAAG,CAAC,KAAK,CAAC,aAAa;YAC/D,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa;YACzB,CAAC,CAAC,kCAAkC,CAAC;IACzC,CAAC;;AArSH,sEAsSC"}
|
|
@@ -6,6 +6,26 @@ export * from './_models/interfaces/dynts-ai-cost-event-callback.interface';
|
|
|
6
6
|
export * from './_models/interfaces/dynts-ai-provider-error.interface';
|
|
7
7
|
export * from './_collections/ai-provider-error.util';
|
|
8
8
|
export * from './_collections/ai-model-config-validator.util';
|
|
9
|
+
export * from './_enums/dynts-ai-field-assist-mode.type-enum';
|
|
10
|
+
export * from './_models/interfaces/dynts-ai-field-assist-request.interface';
|
|
11
|
+
export * from './_models/interfaces/dynts-ai-field-assist-messages.interface';
|
|
12
|
+
export * from './_models/interfaces/dynts-ai-field-assist-result.interface';
|
|
13
|
+
export * from './_models/interfaces/dynts-ai-field-assist-complete.type';
|
|
14
|
+
export * from './_collections/ai-field-assist.util';
|
|
15
|
+
export * from './_models/interfaces/dynts-ai-agent-tool.interface';
|
|
16
|
+
export * from './_models/interfaces/dynts-ai-agent-context-seed.interface';
|
|
17
|
+
export * from './_models/interfaces/dynts-ai-agent-context-item.interface';
|
|
18
|
+
export * from './_models/interfaces/dynts-ai-agent-context-provider.interface';
|
|
19
|
+
export * from './_models/interfaces/dynts-ai-agent-context-report.interface';
|
|
20
|
+
export * from './_models/interfaces/dynts-ai-agent-rendered-context.interface';
|
|
21
|
+
export * from './_models/interfaces/dynts-ai-agent-draft.interface';
|
|
22
|
+
export * from './_models/interfaces/dynts-ai-agent-tool-run.interface';
|
|
23
|
+
export * from './_models/interfaces/dynts-ai-agent-turn.interface';
|
|
24
|
+
export * from './_models/interfaces/dynts-ai-agent-result.interface';
|
|
25
|
+
export * from './_models/interfaces/dynts-ai-agent-llm.interface';
|
|
26
|
+
export * from './_models/interfaces/dynts-ai-agent-settings.interface';
|
|
27
|
+
export * from './_collections/ai-agent-context.util';
|
|
28
|
+
export * from './_services/ai-agent.control-service';
|
|
9
29
|
export * from './_services/ai-provider.service-base';
|
|
10
30
|
export * from './_services/ai-llm.service-base';
|
|
11
31
|
export * from './_services/ai-llm-chat.service-base';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/_modules/ai/index.ts"],"names":[],"mappings":"AACA,cAAc,0BAA0B,CAAC;AAGzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+CAA+C,CAAC;AAI9D,cAAc,oDAAoD,CAAC;AACnE,cAAc,6DAA6D,CAAC;AAI5E,cAAc,wDAAwD,CAAC;AACvE,cAAc,uCAAuC,CAAC;AACtD,cAAc,+CAA+C,CAAC;AAG9D,cAAc,sCAAsC,CAAC;AACrD,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AAGrD,cAAc,iDAAiD,CAAC;AAChE,cAAc,4CAA4C,CAAC;AAK3D,cAAc,wDAAwD,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/_modules/ai/index.ts"],"names":[],"mappings":"AACA,cAAc,0BAA0B,CAAC;AAGzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+CAA+C,CAAC;AAI9D,cAAc,oDAAoD,CAAC;AACnE,cAAc,6DAA6D,CAAC;AAI5E,cAAc,wDAAwD,CAAC;AACvE,cAAc,uCAAuC,CAAC;AACtD,cAAc,+CAA+C,CAAC;AAG9D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,8DAA8D,CAAC;AAC7E,cAAc,+DAA+D,CAAC;AAC9E,cAAc,6DAA6D,CAAC;AAC5E,cAAc,0DAA0D,CAAC;AACzE,cAAc,qCAAqC,CAAC;AAGpD,cAAc,oDAAoD,CAAC;AACnE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,4DAA4D,CAAC;AAC3E,cAAc,gEAAgE,CAAC;AAC/E,cAAc,8DAA8D,CAAC;AAC7E,cAAc,gEAAgE,CAAC;AAC/E,cAAc,qDAAqD,CAAC;AACpE,cAAc,wDAAwD,CAAC;AACvE,cAAc,oDAAoD,CAAC;AACnE,cAAc,sDAAsD,CAAC;AACrE,cAAc,mDAAmD,CAAC;AAClE,cAAc,wDAAwD,CAAC;AACvE,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AAGrD,cAAc,sCAAsC,CAAC;AACrD,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AAGrD,cAAc,iDAAiD,CAAC;AAChE,cAAc,4CAA4C,CAAC;AAK3D,cAAc,wDAAwD,CAAC"}
|
|
@@ -15,6 +15,28 @@ tslib_1.__exportStar(require("./_models/interfaces/dynts-ai-cost-event-callback.
|
|
|
15
15
|
tslib_1.__exportStar(require("./_models/interfaces/dynts-ai-provider-error.interface"), exports);
|
|
16
16
|
tslib_1.__exportStar(require("./_collections/ai-provider-error.util"), exports);
|
|
17
17
|
tslib_1.__exportStar(require("./_collections/ai-model-config-validator.util"), exports);
|
|
18
|
+
// BFR-MYASSISTANT-009 — the server side of the AI field assistant (`dynamo-ai-field-assist` in ngx-dynamo)
|
|
19
|
+
tslib_1.__exportStar(require("./_enums/dynts-ai-field-assist-mode.type-enum"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./_models/interfaces/dynts-ai-field-assist-request.interface"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./_models/interfaces/dynts-ai-field-assist-messages.interface"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./_models/interfaces/dynts-ai-field-assist-result.interface"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./_models/interfaces/dynts-ai-field-assist-complete.type"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./_collections/ai-field-assist.util"), exports);
|
|
25
|
+
// BFR-MYASSISTANT-026 — a plain, general agentic loop: custom tools + context bound to the user message
|
|
26
|
+
tslib_1.__exportStar(require("./_models/interfaces/dynts-ai-agent-tool.interface"), exports);
|
|
27
|
+
tslib_1.__exportStar(require("./_models/interfaces/dynts-ai-agent-context-seed.interface"), exports);
|
|
28
|
+
tslib_1.__exportStar(require("./_models/interfaces/dynts-ai-agent-context-item.interface"), exports);
|
|
29
|
+
tslib_1.__exportStar(require("./_models/interfaces/dynts-ai-agent-context-provider.interface"), exports);
|
|
30
|
+
tslib_1.__exportStar(require("./_models/interfaces/dynts-ai-agent-context-report.interface"), exports);
|
|
31
|
+
tslib_1.__exportStar(require("./_models/interfaces/dynts-ai-agent-rendered-context.interface"), exports);
|
|
32
|
+
tslib_1.__exportStar(require("./_models/interfaces/dynts-ai-agent-draft.interface"), exports);
|
|
33
|
+
tslib_1.__exportStar(require("./_models/interfaces/dynts-ai-agent-tool-run.interface"), exports);
|
|
34
|
+
tslib_1.__exportStar(require("./_models/interfaces/dynts-ai-agent-turn.interface"), exports);
|
|
35
|
+
tslib_1.__exportStar(require("./_models/interfaces/dynts-ai-agent-result.interface"), exports);
|
|
36
|
+
tslib_1.__exportStar(require("./_models/interfaces/dynts-ai-agent-llm.interface"), exports);
|
|
37
|
+
tslib_1.__exportStar(require("./_models/interfaces/dynts-ai-agent-settings.interface"), exports);
|
|
38
|
+
tslib_1.__exportStar(require("./_collections/ai-agent-context.util"), exports);
|
|
39
|
+
tslib_1.__exportStar(require("./_services/ai-agent.control-service"), exports);
|
|
18
40
|
// Abstract Services
|
|
19
41
|
tslib_1.__exportStar(require("./_services/ai-provider.service-base"), exports);
|
|
20
42
|
tslib_1.__exportStar(require("./_services/ai-llm.service-base"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/_modules/ai/index.ts"],"names":[],"mappings":";;;AAAA,qBAAqB;AACrB,mEAAyC;AAEzC,uCAAuC;AACvC,wEAA8C;AAC9C,wFAA8D;AAE9D,kGAAkG;AAClG,oEAAoE;AACpE,6FAAmE;AACnE,sGAA4E;AAE5E,uGAAuG;AACvG,+GAA+G;AAC/G,iGAAuE;AACvE,gFAAsD;AACtD,wFAA8D;AAE9D,oBAAoB;AACpB,+EAAqD;AACrD,0EAAgD;AAChD,+EAAqD;AACrD,gFAAsD;AACtD,+EAAqD;AAErD,2EAA2E;AAC3E,0FAAgE;AAChE,qFAA2D;AAE3D,sGAAsG;AACtG,4GAA4G;AAC5G,kHAAkH;AAClH,iGAAuE"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/_modules/ai/index.ts"],"names":[],"mappings":";;;AAAA,qBAAqB;AACrB,mEAAyC;AAEzC,uCAAuC;AACvC,wEAA8C;AAC9C,wFAA8D;AAE9D,kGAAkG;AAClG,oEAAoE;AACpE,6FAAmE;AACnE,sGAA4E;AAE5E,uGAAuG;AACvG,+GAA+G;AAC/G,iGAAuE;AACvE,gFAAsD;AACtD,wFAA8D;AAE9D,2GAA2G;AAC3G,wFAA8D;AAC9D,uGAA6E;AAC7E,wGAA8E;AAC9E,sGAA4E;AAC5E,mGAAyE;AACzE,8EAAoD;AAEpD,wGAAwG;AACxG,6FAAmE;AACnE,qGAA2E;AAC3E,qGAA2E;AAC3E,yGAA+E;AAC/E,uGAA6E;AAC7E,yGAA+E;AAC/E,8FAAoE;AACpE,iGAAuE;AACvE,6FAAmE;AACnE,+FAAqE;AACrE,4FAAkE;AAClE,iGAAuE;AACvE,+EAAqD;AACrD,+EAAqD;AAErD,oBAAoB;AACpB,+EAAqD;AACrD,0EAAgD;AAChD,+EAAqD;AACrD,gFAAsD;AACtD,+EAAqD;AAErD,2EAA2E;AAC3E,0FAAgE;AAChE,qFAA2D;AAE3D,sGAAsG;AACtG,4GAA4G;AAC5G,kHAAkH;AAClH,iGAAuE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@futdevpro/nts-dynamo",
|
|
3
|
-
"version": "01.15.
|
|
3
|
+
"version": "01.15.465",
|
|
4
4
|
"description": "Dynamic NodeTS (NodeJS-Typescript), MongoDB Backend System Framework by Future Development Program Ltd.",
|
|
5
5
|
"DyBu_settings": {
|
|
6
6
|
"packageType": "server-package",
|