@futdevpro/nts-dynamo 1.15.464 → 1.15.466
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/_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/_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 +14 -0
- package/build/_modules/ai/index.d.ts.map +1 -1
- package/build/_modules/ai/index.js +15 -0
- package/build/_modules/ai/index.js.map +1 -1
- package/build/_modules/messaging/index.d.ts +9 -0
- package/build/_modules/messaging/index.d.ts.map +1 -1
- package/build/_modules/messaging/index.js +10 -0
- package/build/_modules/messaging/index.js.map +1 -1
- package/build/_modules/messaging/input-draft/msg-input-draft-call.interface.d.ts +13 -0
- package/build/_modules/messaging/input-draft/msg-input-draft-call.interface.d.ts.map +1 -0
- package/build/_modules/messaging/input-draft/msg-input-draft-call.interface.js +3 -0
- package/build/_modules/messaging/input-draft/msg-input-draft-call.interface.js.map +1 -0
- package/build/_modules/messaging/input-draft/msg-input-draft-default-settings.const.d.ts +6 -0
- package/build/_modules/messaging/input-draft/msg-input-draft-default-settings.const.d.ts.map +1 -0
- package/build/_modules/messaging/input-draft/msg-input-draft-default-settings.const.js +16 -0
- package/build/_modules/messaging/input-draft/msg-input-draft-default-settings.const.js.map +1 -0
- package/build/_modules/messaging/input-draft/msg-input-draft-routing.util.d.ts +22 -0
- package/build/_modules/messaging/input-draft/msg-input-draft-routing.util.d.ts.map +1 -0
- package/build/_modules/messaging/input-draft/msg-input-draft-routing.util.js +34 -0
- package/build/_modules/messaging/input-draft/msg-input-draft-routing.util.js.map +1 -0
- package/build/_modules/messaging/input-draft/msg-input-draft-save-result.interface.d.ts +15 -0
- package/build/_modules/messaging/input-draft/msg-input-draft-save-result.interface.d.ts.map +1 -0
- package/build/_modules/messaging/input-draft/msg-input-draft-save-result.interface.js +3 -0
- package/build/_modules/messaging/input-draft/msg-input-draft-save-result.interface.js.map +1 -0
- package/build/_modules/messaging/input-draft/msg-input-draft-settings.interface.d.ts +20 -0
- package/build/_modules/messaging/input-draft/msg-input-draft-settings.interface.d.ts.map +1 -0
- package/build/_modules/messaging/input-draft/msg-input-draft-settings.interface.js +3 -0
- package/build/_modules/messaging/input-draft/msg-input-draft-settings.interface.js.map +1 -0
- package/build/_modules/messaging/input-draft/msg-input-draft.controller.d.ts +46 -0
- package/build/_modules/messaging/input-draft/msg-input-draft.controller.d.ts.map +1 -0
- package/build/_modules/messaging/input-draft/msg-input-draft.controller.js +139 -0
- package/build/_modules/messaging/input-draft/msg-input-draft.controller.js.map +1 -0
- package/build/_modules/messaging/input-draft/msg-input-draft.data-model.d.ts +38 -0
- package/build/_modules/messaging/input-draft/msg-input-draft.data-model.d.ts.map +1 -0
- package/build/_modules/messaging/input-draft/msg-input-draft.data-model.js +60 -0
- package/build/_modules/messaging/input-draft/msg-input-draft.data-model.js.map +1 -0
- package/build/_modules/messaging/input-draft/msg-input-draft.data-service.d.ts +55 -0
- package/build/_modules/messaging/input-draft/msg-input-draft.data-service.d.ts.map +1 -0
- package/build/_modules/messaging/input-draft/msg-input-draft.data-service.js +123 -0
- package/build/_modules/messaging/input-draft/msg-input-draft.data-service.js.map +1 -0
- package/build/_modules/messaging/input-draft/msg-input-draft.util.d.ts +20 -0
- package/build/_modules/messaging/input-draft/msg-input-draft.util.d.ts.map +1 -0
- package/build/_modules/messaging/input-draft/msg-input-draft.util.js +71 -0
- package/build/_modules/messaging/input-draft/msg-input-draft.util.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { DyFM_AI_CallSettings, DyFM_AI_Message } from '@futdevpro/fsm-dynamo/ai';
|
|
2
|
+
import { DyNTS_AI_Agent_ContextProvider_Interface } from '../_models/interfaces/dynts-ai-agent-context-provider.interface';
|
|
3
|
+
import { DyNTS_AI_Agent_Draft_Interface } from '../_models/interfaces/dynts-ai-agent-draft.interface';
|
|
4
|
+
import { DyNTS_AI_Agent_RenderedContext_Interface } from '../_models/interfaces/dynts-ai-agent-rendered-context.interface';
|
|
5
|
+
import { DyNTS_AI_Agent_Result_Interface } from '../_models/interfaces/dynts-ai-agent-result.interface';
|
|
6
|
+
import { DyNTS_AI_Agent_Settings_Interface } from '../_models/interfaces/dynts-ai-agent-settings.interface';
|
|
7
|
+
import { DyNTS_AI_Agent_Tool_Interface } from '../_models/interfaces/dynts-ai-agent-tool.interface';
|
|
8
|
+
import { DyNTS_AI_Agent_Turn_Interface } from '../_models/interfaces/dynts-ai-agent-turn.interface';
|
|
9
|
+
/**
|
|
10
|
+
* BFR-MYASSISTANT-026 — a plain, general agentic loop: the project gives the tools and the context providers, the
|
|
11
|
+
* model (any `DyNTS_AI_LLM_ServiceBase` provider) runs the tool loop.
|
|
12
|
+
*
|
|
13
|
+
* - **tools:** `addTool({ name, description, parameters, handler })` — the definition and the handler in one object;
|
|
14
|
+
* a tool's error becomes an `ERROR …` result for the model, a long result is cut (`maxToolResultLength`);
|
|
15
|
+
* - **context bound to the user message, NOT to the history:** `prepare` runs the context providers (e.g. RAG) for a
|
|
16
|
+
* message and gives a draft; the user adjusts it (switches items off, edits, reorders, adds); `run` sends the
|
|
17
|
+
* message with exactly that context. The history sent later holds only the messages and the answers — the context
|
|
18
|
+
* stays in the turn (shown / audited), it is not resent;
|
|
19
|
+
* - the context is sent as DATA between markers (`DyNTS_AI_AgentContext_Util`), within `maxContextLength`, and the
|
|
20
|
+
* result reports which item was sent, cut, dropped or switched off;
|
|
21
|
+
* - stateless between requests: the project stores the turns; one instance serves any number of requests.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const agent = new DyNTS_AI_Agent_ControlService({ llm: openAiService, systemPrompt: 'You are the order assistant.' })
|
|
26
|
+
* .addTool({ name: 'find_order', description: 'Finds an order by id.', parameters: orderIdSchema,
|
|
27
|
+
* handler: (args) => this.orders.describe(`${args.id}`) })
|
|
28
|
+
* .addContextProvider({ name: 'docs', provide: ({ message }) => this.rag.search(message) });
|
|
29
|
+
*
|
|
30
|
+
* const draft = await agent.prepare({ message: text, history: turns }); // ⇒ to the client, adjusted there
|
|
31
|
+
* const result = await agent.run({ draft: adjustedDraft, history: turns, issuer: accountId });
|
|
32
|
+
* turns.push(result.turn);
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare class DyNTS_AI_Agent_ControlService {
|
|
36
|
+
private readonly settings;
|
|
37
|
+
/** The longest user message accepted (characters). */
|
|
38
|
+
static readonly maxMessageLength: number;
|
|
39
|
+
/** The most context items of one message. */
|
|
40
|
+
static readonly maxContextItems: number;
|
|
41
|
+
/** A tool name the providers accept (OpenAI / Anthropic / Gemini). */
|
|
42
|
+
static readonly toolNamePattern: RegExp;
|
|
43
|
+
/** The defaults of the optional settings. */
|
|
44
|
+
static readonly defaults: {
|
|
45
|
+
maxIterations: number;
|
|
46
|
+
historyLimit: number;
|
|
47
|
+
maxContextLength: number;
|
|
48
|
+
maxToolResultLength: number;
|
|
49
|
+
};
|
|
50
|
+
/** The tools, by name. */
|
|
51
|
+
private readonly tools;
|
|
52
|
+
/** The context providers, in their order. */
|
|
53
|
+
private readonly contextProviders;
|
|
54
|
+
/** An agent with its model and limits; the tools and the context providers are added after. */
|
|
55
|
+
constructor(settings: DyNTS_AI_Agent_Settings_Interface);
|
|
56
|
+
/** The registered tools' names. */
|
|
57
|
+
getToolNames(): string[];
|
|
58
|
+
/** The registered context providers' names. */
|
|
59
|
+
getContextProviderNames(): string[];
|
|
60
|
+
/** Adds a tool (a unique, provider-safe name). */
|
|
61
|
+
addTool(tool: DyNTS_AI_Agent_Tool_Interface): this;
|
|
62
|
+
/** Adds a context provider (a unique name). */
|
|
63
|
+
addContextProvider(provider: DyNTS_AI_Agent_ContextProvider_Interface): this;
|
|
64
|
+
/** Runs the context providers for a message ⇒ the draft to adjust before sending. */
|
|
65
|
+
prepare(set: {
|
|
66
|
+
message: string;
|
|
67
|
+
history?: DyNTS_AI_Agent_Turn_Interface[];
|
|
68
|
+
}): Promise<DyNTS_AI_Agent_Draft_Interface>;
|
|
69
|
+
/** Sends the (adjusted) draft: the tool loop until the final answer ⇒ the turn to store. */
|
|
70
|
+
run(set: {
|
|
71
|
+
draft: DyNTS_AI_Agent_Draft_Interface;
|
|
72
|
+
history?: DyNTS_AI_Agent_Turn_Interface[];
|
|
73
|
+
issuer: string;
|
|
74
|
+
signal?: AbortSignal;
|
|
75
|
+
}): Promise<DyNTS_AI_Agent_Result_Interface>;
|
|
76
|
+
/** `prepare` + `run` in one step (no adjusting): the providers' context is sent as it came. */
|
|
77
|
+
ask(set: {
|
|
78
|
+
message: string;
|
|
79
|
+
history?: DyNTS_AI_Agent_Turn_Interface[];
|
|
80
|
+
issuer: string;
|
|
81
|
+
signal?: AbortSignal;
|
|
82
|
+
}): Promise<DyNTS_AI_Agent_Result_Interface>;
|
|
83
|
+
/**
|
|
84
|
+
* What `run` sends (for a preview / a test): the history as plain messages + answers, then the message with its
|
|
85
|
+
* context block; the call settings with the agent's system prompt (+ the context rule when context goes).
|
|
86
|
+
*/
|
|
87
|
+
build(set: {
|
|
88
|
+
draft: DyNTS_AI_Agent_Draft_Interface;
|
|
89
|
+
history: DyNTS_AI_Agent_Turn_Interface[];
|
|
90
|
+
}): {
|
|
91
|
+
conversation: DyFM_AI_Message[];
|
|
92
|
+
settings: DyFM_AI_CallSettings;
|
|
93
|
+
context: DyNTS_AI_Agent_RenderedContext_Interface;
|
|
94
|
+
};
|
|
95
|
+
/** The handlers of one run: each records its run, and cuts a long result. */
|
|
96
|
+
private handlers;
|
|
97
|
+
/** The message, trimmed (a 400 when empty or too long). */
|
|
98
|
+
private static validMessage;
|
|
99
|
+
/** The draft's context, checked (it comes back from the client). */
|
|
100
|
+
private static validContext;
|
|
101
|
+
/** The reason the user sees (the error's user message, or a plain one); the technical text goes to the log. */
|
|
102
|
+
private static reason;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=ai-agent.control-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-agent.control-service.d.ts","sourceRoot":"","sources":["../../../../src/_modules/ai/_services/ai-agent.control-service.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EAAwB,eAAe,EAE5D,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EACL,wCAAwC,EACzC,MAAM,iEAAiE,CAAC;AAEzE,OAAO,EAAE,8BAA8B,EAAE,MAAM,sDAAsD,CAAC;AACtG,OAAO,EACL,wCAAwC,EACzC,MAAM,iEAAiE,CAAC;AACzE,OAAO,EAAE,+BAA+B,EAAE,MAAM,uDAAuD,CAAC;AACxG,OAAO,EAAE,iCAAiC,EAAE,MAAM,yDAAyD,CAAC;AAC5G,OAAO,EAAE,6BAA6B,EAAE,MAAM,qDAAqD,CAAC;AAEpG,OAAO,EAAE,6BAA6B,EAAE,MAAM,qDAAqD,CAAC;AAEpG;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,6BAA6B;IAmB5B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAlBrC,sDAAsD;IACtD,MAAM,CAAC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAS;IACjD,6C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AAE,CAAC;QAC1C,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GAAG,OAAO,CAAC,+BAA+B,CAAC;IAM5C;;;OAGG;IACH,KAAK,CAAC,GAAG,EAAE;QAAE,KAAK,EAAE,8BAA8B,CAAC;QAAC,OAAO,EAAE,6BAA6B,EAAE,CAAA;KAAE,GAAG;QAC/F,YAAY,EAAE,eAAe,EAAE,CAAC;QAAC,QAAQ,EAAE,oBAAoB,CAAC;QAAC,OAAO,EAAE,wCAAwC,CAAC;KACpH;IA6BD,6EAA6E;IAC7E,OAAO,CAAC,QAAQ;IAuChB,2DAA2D;IAC3D,OAAO,CAAC,MAAM,CAAC,YAAY;IAiB3B,oEAAoE;IACpE,OAAO,CAAC,MAAM,CAAC,YAAY;IA0B3B,+GAA+G;IAC/G,OAAO,CAAC,MAAM,CAAC,MAAM;CAStB"}
|
|
@@ -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;;;;;;;;;;;;;;;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,CAAC,CAAC,kCAAkC,CAAC;IACzC,CAAC;;AArSH,sEAsSC"}
|
|
@@ -12,6 +12,20 @@ export * from './_models/interfaces/dynts-ai-field-assist-messages.interface';
|
|
|
12
12
|
export * from './_models/interfaces/dynts-ai-field-assist-result.interface';
|
|
13
13
|
export * from './_models/interfaces/dynts-ai-field-assist-complete.type';
|
|
14
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';
|
|
15
29
|
export * from './_services/ai-provider.service-base';
|
|
16
30
|
export * from './_services/ai-llm.service-base';
|
|
17
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,6DAA6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;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"}
|
|
@@ -22,6 +22,21 @@ tslib_1.__exportStar(require("./_models/interfaces/dynts-ai-field-assist-message
|
|
|
22
22
|
tslib_1.__exportStar(require("./_models/interfaces/dynts-ai-field-assist-result.interface"), exports);
|
|
23
23
|
tslib_1.__exportStar(require("./_models/interfaces/dynts-ai-field-assist-complete.type"), exports);
|
|
24
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);
|
|
25
40
|
// Abstract Services
|
|
26
41
|
tslib_1.__exportStar(require("./_services/ai-provider.service-base"), exports);
|
|
27
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,2GAA2G;AAC3G,wFAA8D;AAC9D,uGAA6E;AAC7E,wGAA8E;AAC9E,sGAA4E;AAC5E,mGAAyE;AACzE,8EAAoD;AAEpD,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"}
|
|
@@ -8,4 +8,13 @@ export * from './_services/msg-events.service';
|
|
|
8
8
|
export * from './_services/msg-main.control-service';
|
|
9
9
|
export * from './_services/msg-message.data-service';
|
|
10
10
|
export * from './_services/msg.controller';
|
|
11
|
+
export * from './input-draft/msg-input-draft.data-model';
|
|
12
|
+
export * from './input-draft/msg-input-draft-settings.interface';
|
|
13
|
+
export * from './input-draft/msg-input-draft-default-settings.const';
|
|
14
|
+
export * from './input-draft/msg-input-draft-save-result.interface';
|
|
15
|
+
export * from './input-draft/msg-input-draft.util';
|
|
16
|
+
export * from './input-draft/msg-input-draft.data-service';
|
|
17
|
+
export * from './input-draft/msg-input-draft.controller';
|
|
18
|
+
export * from './input-draft/msg-input-draft-routing.util';
|
|
19
|
+
export * from './input-draft/msg-input-draft-call.interface';
|
|
11
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/_modules/messaging/index.ts"],"names":[],"mappings":"AASA,cAAc,iCAAiC,CAAC;AAGhD,cAAc,yCAAyC,CAAC;AAGxD,cAAc,kDAAkD,CAAC;AACjE,cAAc,0CAA0C,CAAC;AACzD,cAAc,yBAAyB,CAAC;AAMxC,cAAc,2CAA2C,CAAC;AAC1D,cAAc,gCAAgC,CAAC;AAE/C,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AACrD,cAAc,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/_modules/messaging/index.ts"],"names":[],"mappings":"AASA,cAAc,iCAAiC,CAAC;AAGhD,cAAc,yCAAyC,CAAC;AAGxD,cAAc,kDAAkD,CAAC;AACjE,cAAc,0CAA0C,CAAC;AACzD,cAAc,yBAAyB,CAAC;AAMxC,cAAc,2CAA2C,CAAC;AAC1D,cAAc,gCAAgC,CAAC;AAE/C,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AACrD,cAAc,4BAA4B,CAAC;AAG3C,cAAc,0CAA0C,CAAC;AACzD,cAAc,kDAAkD,CAAC;AACjE,cAAc,sDAAsD,CAAC;AACrE,cAAc,qDAAqD,CAAC;AACpE,cAAc,oCAAoC,CAAC;AACnD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,8CAA8C,CAAC"}
|
|
@@ -25,4 +25,14 @@ tslib_1.__exportStar(require("./_services/msg-events.service"), exports);
|
|
|
25
25
|
tslib_1.__exportStar(require("./_services/msg-main.control-service"), exports);
|
|
26
26
|
tslib_1.__exportStar(require("./_services/msg-message.data-service"), exports);
|
|
27
27
|
tslib_1.__exportStar(require("./_services/msg.controller"), exports);
|
|
28
|
+
// INPUT DRAFT (BFR-CCAPREVISIONED-030 part 2)
|
|
29
|
+
tslib_1.__exportStar(require("./input-draft/msg-input-draft.data-model"), exports);
|
|
30
|
+
tslib_1.__exportStar(require("./input-draft/msg-input-draft-settings.interface"), exports);
|
|
31
|
+
tslib_1.__exportStar(require("./input-draft/msg-input-draft-default-settings.const"), exports);
|
|
32
|
+
tslib_1.__exportStar(require("./input-draft/msg-input-draft-save-result.interface"), exports);
|
|
33
|
+
tslib_1.__exportStar(require("./input-draft/msg-input-draft.util"), exports);
|
|
34
|
+
tslib_1.__exportStar(require("./input-draft/msg-input-draft.data-service"), exports);
|
|
35
|
+
tslib_1.__exportStar(require("./input-draft/msg-input-draft.controller"), exports);
|
|
36
|
+
tslib_1.__exportStar(require("./input-draft/msg-input-draft-routing.util"), exports);
|
|
37
|
+
tslib_1.__exportStar(require("./input-draft/msg-input-draft-call.interface"), exports);
|
|
28
38
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/_modules/messaging/index.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,mBAAmB;AACnB,EAAE;AACF,mEAAmE;AACnE,4CAA4C;AAC5C,wCAAwC;AACxC,EAAE;;;AAEF,uBAAuB;AACvB,0EAAgD;AAEhD,SAAS;AACT,kFAAwD;AAExD,cAAc;AACd,2FAAiE;AACjE,mFAAyD;AACzD,kEAAwC;AAExC,QAAQ;AACR,2DAA2D;AAE3D,WAAW;AACX,oFAA0D;AAC1D,yEAA+C;AAC/C,kEAAkE;AAClE,+EAAqD;AACrD,+EAAqD;AACrD,qEAA2C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/_modules/messaging/index.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,mBAAmB;AACnB,EAAE;AACF,mEAAmE;AACnE,4CAA4C;AAC5C,wCAAwC;AACxC,EAAE;;;AAEF,uBAAuB;AACvB,0EAAgD;AAEhD,SAAS;AACT,kFAAwD;AAExD,cAAc;AACd,2FAAiE;AACjE,mFAAyD;AACzD,kEAAwC;AAExC,QAAQ;AACR,2DAA2D;AAE3D,WAAW;AACX,oFAA0D;AAC1D,yEAA+C;AAC/C,kEAAkE;AAClE,+EAAqD;AACrD,+EAAqD;AACrD,qEAA2C;AAE3C,8CAA8C;AAC9C,mFAAyD;AACzD,2FAAiE;AACjE,+FAAqE;AACrE,8FAAoE;AACpE,6EAAmD;AACnD,qFAA2D;AAC3D,mFAAyD;AACzD,qFAA2D;AAC3D,uFAA6D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Request, Response } from 'express';
|
|
2
|
+
/**
|
|
3
|
+
* BFR-CCAPREVISIONED-030 part 2 - one endpoint call, as the input-draft handlers get it.
|
|
4
|
+
*/
|
|
5
|
+
export interface DyNTS_Msg_InputDraft_Call_Interface {
|
|
6
|
+
/** The incoming request. */
|
|
7
|
+
req: Request;
|
|
8
|
+
/** The answer. */
|
|
9
|
+
res: Response;
|
|
10
|
+
/** The issuer the endpoint resolved (for the logs; the OWNER comes from the auth service). */
|
|
11
|
+
issuer: string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=msg-input-draft-call.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"msg-input-draft-call.interface.d.ts","sourceRoot":"","sources":["../../../../src/_modules/messaging/input-draft/msg-input-draft-call.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,mCAAmC;IAClD,4BAA4B;IAC5B,GAAG,EAAE,OAAO,CAAC;IACb,kBAAkB;IAClB,GAAG,EAAE,QAAQ,CAAC;IACd,8FAA8F;IAC9F,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"msg-input-draft-call.interface.js","sourceRoot":"","sources":["../../../../src/_modules/messaging/input-draft/msg-input-draft-call.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DyNTS_Msg_InputDraft_Settings_Interface } from './msg-input-draft-settings.interface';
|
|
2
|
+
/**
|
|
3
|
+
* BFR-CCAPREVISIONED-030 part 2 - the input-draft defaults: a draft lives 30 days after its last save.
|
|
4
|
+
*/
|
|
5
|
+
export declare const DyNTS_msgInputDraft_defaultSettings: Required<DyNTS_Msg_InputDraft_Settings_Interface>;
|
|
6
|
+
//# sourceMappingURL=msg-input-draft-default-settings.const.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"msg-input-draft-default-settings.const.d.ts","sourceRoot":"","sources":["../../../../src/_modules/messaging/input-draft/msg-input-draft-default-settings.const.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uCAAuC,EAAE,MAAM,sCAAsC,CAAC;AAE/F;;GAEG;AACH,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CAAC,uCAAuC,CAOjG,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DyNTS_msgInputDraft_defaultSettings = void 0;
|
|
4
|
+
const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
|
|
5
|
+
/**
|
|
6
|
+
* BFR-CCAPREVISIONED-030 part 2 - the input-draft defaults: a draft lives 30 days after its last save.
|
|
7
|
+
*/
|
|
8
|
+
exports.DyNTS_msgInputDraft_defaultSettings = {
|
|
9
|
+
route: '/input-draft',
|
|
10
|
+
preProcesses: [],
|
|
11
|
+
maxAgeMs: 30 * fsm_dynamo_1.day,
|
|
12
|
+
maxContentLength: 100000,
|
|
13
|
+
maxFieldKeyLength: 200,
|
|
14
|
+
maxListCount: 500,
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=msg-input-draft-default-settings.const.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"msg-input-draft-default-settings.const.js","sourceRoot":"","sources":["../../../../src/_modules/messaging/input-draft/msg-input-draft-default-settings.const.ts"],"names":[],"mappings":";;;AAAA,sDAA4C;AAI5C;;GAEG;AACU,QAAA,mCAAmC,GAAsD;IACpG,KAAK,EAAE,cAAc;IACrB,YAAY,EAAE,EAAE;IAChB,QAAQ,EAAE,EAAE,GAAG,gBAAG;IAClB,gBAAgB,EAAE,MAAM;IACxB,iBAAiB,EAAE,GAAG;IACtB,YAAY,EAAE,GAAG;CAClB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DyNTS_RoutingModule } from '../../../_services/route/routing-module.service';
|
|
2
|
+
import { DyNTS_Msg_InputDraft_Settings_Interface } from './msg-input-draft-settings.interface';
|
|
3
|
+
/**
|
|
4
|
+
* BFR-CCAPREVISIONED-030 part 2 - the input-draft routing module (`/input-draft/save | get | list | clear`): the
|
|
5
|
+
* unsent text of an input field, per account and field key, so it comes back in another browser too.
|
|
6
|
+
*
|
|
7
|
+
* Needs the app's auth service on `DyNTS_GlobalService` (the owner is the authenticated issuer) and the
|
|
8
|
+
* `DyNTS_msgInputDraft_dataParams` collection among the app's db models.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* DyNTS_Msg_InputDraftRouting_Util.getRoutingModule({
|
|
13
|
+
* preProcesses: [ authService.authenticate_tokenSelf ],
|
|
14
|
+
* maxAgeMs: 14 * day,
|
|
15
|
+
* })
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare class DyNTS_Msg_InputDraftRouting_Util {
|
|
19
|
+
/** The routing module with the given settings (the defaults for the missing ones). */
|
|
20
|
+
static getRoutingModule(settings?: DyNTS_Msg_InputDraft_Settings_Interface): DyNTS_RoutingModule;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=msg-input-draft-routing.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"msg-input-draft-routing.util.d.ts","sourceRoot":"","sources":["../../../../src/_modules/messaging/input-draft/msg-input-draft-routing.util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAEtF,OAAO,EAAE,uCAAuC,EAAE,MAAM,sCAAsC,CAAC;AAG/F;;;;;;;;;;;;;;GAcG;AACH,qBAAa,gCAAgC;IAC3C,sFAAsF;IACtF,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,uCAAuC,GAAG,mBAAmB;CAUjG"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DyNTS_Msg_InputDraftRouting_Util = void 0;
|
|
4
|
+
const routing_module_service_1 = require("../../../_services/route/routing-module.service");
|
|
5
|
+
const msg_input_draft_controller_1 = require("./msg-input-draft.controller");
|
|
6
|
+
const msg_input_draft_util_1 = require("./msg-input-draft.util");
|
|
7
|
+
/**
|
|
8
|
+
* BFR-CCAPREVISIONED-030 part 2 - the input-draft routing module (`/input-draft/save | get | list | clear`): the
|
|
9
|
+
* unsent text of an input field, per account and field key, so it comes back in another browser too.
|
|
10
|
+
*
|
|
11
|
+
* Needs the app's auth service on `DyNTS_GlobalService` (the owner is the authenticated issuer) and the
|
|
12
|
+
* `DyNTS_msgInputDraft_dataParams` collection among the app's db models.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* DyNTS_Msg_InputDraftRouting_Util.getRoutingModule({
|
|
17
|
+
* preProcesses: [ authService.authenticate_tokenSelf ],
|
|
18
|
+
* maxAgeMs: 14 * day,
|
|
19
|
+
* })
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
class DyNTS_Msg_InputDraftRouting_Util {
|
|
23
|
+
/** The routing module with the given settings (the defaults for the missing ones). */
|
|
24
|
+
static getRoutingModule(settings) {
|
|
25
|
+
msg_input_draft_controller_1.DyNTS_Msg_InputDraft_Controller.configure(settings);
|
|
26
|
+
const set = {
|
|
27
|
+
route: msg_input_draft_util_1.DyNTS_Msg_InputDraft_Util.resolve(settings).route,
|
|
28
|
+
controllers: [msg_input_draft_controller_1.DyNTS_Msg_InputDraft_Controller.getInstance()],
|
|
29
|
+
};
|
|
30
|
+
return new routing_module_service_1.DyNTS_RoutingModule(set);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.DyNTS_Msg_InputDraftRouting_Util = DyNTS_Msg_InputDraftRouting_Util;
|
|
34
|
+
//# sourceMappingURL=msg-input-draft-routing.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"msg-input-draft-routing.util.js","sourceRoot":"","sources":["../../../../src/_modules/messaging/input-draft/msg-input-draft-routing.util.ts"],"names":[],"mappings":";;;AACA,4FAAsF;AACtF,6EAA+E;AAE/E,iEAAmE;AAEnE;;;;;;;;;;;;;;GAcG;AACH,MAAa,gCAAgC;IAC3C,sFAAsF;IACtF,MAAM,CAAC,gBAAgB,CAAC,QAAkD;QACxE,4DAA+B,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAEpD,MAAM,GAAG,GAAiC;YACxC,KAAK,EAAE,gDAAyB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK;YACxD,WAAW,EAAE,CAAE,4DAA+B,CAAC,WAAW,EAAE,CAAE;SAC/D,CAAC;QAEF,OAAO,IAAI,4CAAmB,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;CACF;AAZD,4EAYC"}
|