@memberjunction/core-actions 6.2.0-edge.4 → 6.2.0-edge.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -0
- package/dist/custom/ai/base-find-actions.action.d.ts +8 -0
- package/dist/custom/ai/base-find-actions.action.d.ts.map +1 -1
- package/dist/custom/ai/base-find-actions.action.js +18 -2
- package/dist/custom/ai/base-find-actions.action.js.map +1 -1
- package/dist/custom/ai/communication-oauth-service.d.ts +228 -0
- package/dist/custom/ai/communication-oauth-service.d.ts.map +1 -0
- package/dist/custom/ai/communication-oauth-service.js +309 -0
- package/dist/custom/ai/communication-oauth-service.js.map +1 -0
- package/dist/custom/ai/configure-agent-user-policy.action.d.ts +26 -0
- package/dist/custom/ai/configure-agent-user-policy.action.d.ts.map +1 -0
- package/dist/custom/ai/configure-agent-user-policy.action.js +270 -0
- package/dist/custom/ai/configure-agent-user-policy.action.js.map +1 -0
- package/dist/custom/ai/execute-agent.action.d.ts +49 -0
- package/dist/custom/ai/execute-agent.action.d.ts.map +1 -1
- package/dist/custom/ai/execute-agent.action.js +125 -52
- package/dist/custom/ai/execute-agent.action.js.map +1 -1
- package/dist/custom/ai/prepare-outbound-call-brief.action.d.ts +37 -0
- package/dist/custom/ai/prepare-outbound-call-brief.action.d.ts.map +1 -0
- package/dist/custom/ai/prepare-outbound-call-brief.action.js +224 -0
- package/dist/custom/ai/prepare-outbound-call-brief.action.js.map +1 -0
- package/dist/custom/ai/schedule-next-agent-wake.action.d.ts +26 -0
- package/dist/custom/ai/schedule-next-agent-wake.action.d.ts.map +1 -0
- package/dist/custom/ai/schedule-next-agent-wake.action.js +278 -0
- package/dist/custom/ai/schedule-next-agent-wake.action.js.map +1 -0
- package/dist/custom/ai/send-inter-agent-request.action.d.ts +42 -0
- package/dist/custom/ai/send-inter-agent-request.action.d.ts.map +1 -0
- package/dist/custom/ai/send-inter-agent-request.action.js +213 -0
- package/dist/custom/ai/send-inter-agent-request.action.js.map +1 -0
- package/dist/custom/ai/user-scoped-communication.action.d.ts +109 -0
- package/dist/custom/ai/user-scoped-communication.action.d.ts.map +1 -0
- package/dist/custom/ai/user-scoped-communication.action.js +1258 -0
- package/dist/custom/ai/user-scoped-communication.action.js.map +1 -0
- package/dist/custom/crud/base-record-mutation.action.d.ts +66 -21
- package/dist/custom/crud/base-record-mutation.action.d.ts.map +1 -1
- package/dist/custom/crud/base-record-mutation.action.js +178 -66
- package/dist/custom/crud/base-record-mutation.action.js.map +1 -1
- package/dist/custom/crud/create-record.action.d.ts +2 -2
- package/dist/custom/crud/create-record.action.d.ts.map +1 -1
- package/dist/custom/crud/create-record.action.js +7 -3
- package/dist/custom/crud/create-record.action.js.map +1 -1
- package/dist/custom/crud/delete-record.action.d.ts +2 -1
- package/dist/custom/crud/delete-record.action.d.ts.map +1 -1
- package/dist/custom/crud/delete-record.action.js +8 -6
- package/dist/custom/crud/delete-record.action.js.map +1 -1
- package/dist/custom/crud/get-record.action.d.ts +2 -1
- package/dist/custom/crud/get-record.action.d.ts.map +1 -1
- package/dist/custom/crud/get-record.action.js +8 -6
- package/dist/custom/crud/get-record.action.js.map +1 -1
- package/dist/custom/crud/get-records.action.d.ts.map +1 -1
- package/dist/custom/crud/get-records.action.js +19 -2
- package/dist/custom/crud/get-records.action.js.map +1 -1
- package/dist/custom/crud/update-record.action.d.ts +4 -3
- package/dist/custom/crud/update-record.action.d.ts.map +1 -1
- package/dist/custom/crud/update-record.action.js +23 -23
- package/dist/custom/crud/update-record.action.js.map +1 -1
- package/dist/custom/data/explore-database-schema.action.d.ts.map +1 -1
- package/dist/custom/data/explore-database-schema.action.js +22 -1
- package/dist/custom/data/explore-database-schema.action.js.map +1 -1
- package/dist/custom/data/get-entity-details.action.d.ts.map +1 -1
- package/dist/custom/data/get-entity-details.action.js +33 -7
- package/dist/custom/data/get-entity-details.action.js.map +1 -1
- package/dist/custom/data/run-adhoc-query.action.d.ts +2 -0
- package/dist/custom/data/run-adhoc-query.action.d.ts.map +1 -1
- package/dist/custom/data/run-adhoc-query.action.js +64 -9
- package/dist/custom/data/run-adhoc-query.action.js.map +1 -1
- package/dist/custom/data/run-record-process.action.d.ts +2 -0
- package/dist/custom/data/run-record-process.action.d.ts.map +1 -1
- package/dist/custom/data/run-record-process.action.js +10 -4
- package/dist/custom/data/run-record-process.action.js.map +1 -1
- package/dist/custom/data/run-stored-query.action.d.ts +1 -0
- package/dist/custom/data/run-stored-query.action.d.ts.map +1 -1
- package/dist/custom/data/run-stored-query.action.js +21 -5
- package/dist/custom/data/run-stored-query.action.js.map +1 -1
- package/dist/custom/files/base-file-storage.action.d.ts +53 -5
- package/dist/custom/files/base-file-storage.action.d.ts.map +1 -1
- package/dist/custom/files/base-file-storage.action.js +72 -14
- package/dist/custom/files/base-file-storage.action.js.map +1 -1
- package/dist/custom/files/copy-object.action.d.ts +3 -0
- package/dist/custom/files/copy-object.action.d.ts.map +1 -1
- package/dist/custom/files/copy-object.action.js +9 -1
- package/dist/custom/files/copy-object.action.js.map +1 -1
- package/dist/custom/files/create-directory.action.d.ts +3 -0
- package/dist/custom/files/create-directory.action.d.ts.map +1 -1
- package/dist/custom/files/create-directory.action.js +4 -0
- package/dist/custom/files/create-directory.action.js.map +1 -1
- package/dist/custom/files/create-document.action.d.ts.map +1 -1
- package/dist/custom/files/create-document.action.js +12 -0
- package/dist/custom/files/create-document.action.js.map +1 -1
- package/dist/custom/files/delete-directory.action.d.ts +3 -0
- package/dist/custom/files/delete-directory.action.d.ts.map +1 -1
- package/dist/custom/files/delete-directory.action.js +4 -0
- package/dist/custom/files/delete-directory.action.js.map +1 -1
- package/dist/custom/files/delete-object.action.d.ts +3 -0
- package/dist/custom/files/delete-object.action.d.ts.map +1 -1
- package/dist/custom/files/delete-object.action.js +9 -1
- package/dist/custom/files/delete-object.action.js.map +1 -1
- package/dist/custom/files/get-download-url.action.d.ts.map +1 -1
- package/dist/custom/files/get-download-url.action.js +5 -1
- package/dist/custom/files/get-download-url.action.js.map +1 -1
- package/dist/custom/files/get-file-content.action.d.ts +0 -20
- package/dist/custom/files/get-file-content.action.d.ts.map +1 -1
- package/dist/custom/files/get-file-content.action.js +18 -66
- package/dist/custom/files/get-file-content.action.js.map +1 -1
- package/dist/custom/files/get-metadata.action.d.ts.map +1 -1
- package/dist/custom/files/get-metadata.action.js +5 -1
- package/dist/custom/files/get-metadata.action.js.map +1 -1
- package/dist/custom/files/get-object.action.d.ts.map +1 -1
- package/dist/custom/files/get-object.action.js +5 -1
- package/dist/custom/files/get-object.action.js.map +1 -1
- package/dist/custom/files/get-upload-url.action.d.ts +3 -0
- package/dist/custom/files/get-upload-url.action.d.ts.map +1 -1
- package/dist/custom/files/get-upload-url.action.js +9 -1
- package/dist/custom/files/get-upload-url.action.js.map +1 -1
- package/dist/custom/files/list-objects.action.d.ts.map +1 -1
- package/dist/custom/files/list-objects.action.js +7 -3
- package/dist/custom/files/list-objects.action.js.map +1 -1
- package/dist/custom/files/list-storage-providers.action.d.ts +5 -4
- package/dist/custom/files/list-storage-providers.action.d.ts.map +1 -1
- package/dist/custom/files/list-storage-providers.action.js +15 -11
- package/dist/custom/files/list-storage-providers.action.js.map +1 -1
- package/dist/custom/files/move-object.action.d.ts +3 -0
- package/dist/custom/files/move-object.action.d.ts.map +1 -1
- package/dist/custom/files/move-object.action.js +9 -1
- package/dist/custom/files/move-object.action.js.map +1 -1
- package/dist/custom/files/search-storage-files.action.d.ts.map +1 -1
- package/dist/custom/files/search-storage-files.action.js +10 -6
- package/dist/custom/files/search-storage-files.action.js.map +1 -1
- package/dist/custom/lists/get-list-records.action.d.ts.map +1 -1
- package/dist/custom/lists/get-list-records.action.js +1 -0
- package/dist/custom/lists/get-list-records.action.js.map +1 -1
- package/dist/custom/search/scoped-search.action.d.ts +112 -22
- package/dist/custom/search/scoped-search.action.d.ts.map +1 -1
- package/dist/custom/search/scoped-search.action.js +351 -95
- package/dist/custom/search/scoped-search.action.js.map +1 -1
- package/dist/custom/search/search.action.d.ts +30 -0
- package/dist/custom/search/search.action.d.ts.map +1 -1
- package/dist/custom/search/search.action.js +77 -32
- package/dist/custom/search/search.action.js.map +1 -1
- package/dist/custom/security/password-strength.action.d.ts.map +1 -1
- package/dist/custom/security/password-strength.action.js +3 -4
- package/dist/custom/security/password-strength.action.js.map +1 -1
- package/dist/custom/utilities/artifact-builder-service.d.ts +3 -3
- package/dist/custom/utilities/artifact-builder-service.d.ts.map +1 -1
- package/dist/custom/utilities/artifact-builder-service.js +9 -9
- package/dist/custom/utilities/artifact-builder-service.js.map +1 -1
- package/dist/custom/utilities/base-file-handler.d.ts +14 -6
- package/dist/custom/utilities/base-file-handler.d.ts.map +1 -1
- package/dist/custom/utilities/base-file-handler.js +36 -28
- package/dist/custom/utilities/base-file-handler.js.map +1 -1
- package/dist/custom/web/web-page-content.action.d.ts.map +1 -1
- package/dist/custom/web/web-page-content.action.js +11 -12
- package/dist/custom/web/web-page-content.action.js.map +1 -1
- package/dist/custom/workflow/conditional.action.d.ts.map +1 -1
- package/dist/custom/workflow/conditional.action.js +5 -0
- package/dist/custom/workflow/conditional.action.js.map +1 -1
- package/dist/custom/workflow/loop.action.d.ts.map +1 -1
- package/dist/custom/workflow/loop.action.js +5 -0
- package/dist/custom/workflow/loop.action.js.map +1 -1
- package/dist/custom/workflow/parallel-execute.action.d.ts.map +1 -1
- package/dist/custom/workflow/parallel-execute.action.js +8 -2
- package/dist/custom/workflow/parallel-execute.action.js.map +1 -1
- package/dist/custom/workflow/retry.action.d.ts.map +1 -1
- package/dist/custom/workflow/retry.action.js +5 -0
- package/dist/custom/workflow/retry.action.js.map +1 -1
- package/dist/custom/workflow/workflow-run-scope.d.ts +15 -0
- package/dist/custom/workflow/workflow-run-scope.d.ts.map +1 -0
- package/dist/custom/workflow/workflow-run-scope.js +24 -0
- package/dist/custom/workflow/workflow-run-scope.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/package.json +44 -44
|
@@ -17,6 +17,22 @@ import { BaseAction } from '@memberjunction/actions';
|
|
|
17
17
|
* the bridge already runs in-process with `contextUser` and doesn't need the
|
|
18
18
|
* action-catalog indirection.
|
|
19
19
|
*
|
|
20
|
+
* **`Data` cannot change what the run is.** Whoever calls this action — a browser
|
|
21
|
+
* through `RunAction`, a user routine, or a model inside another agent's run —
|
|
22
|
+
* authors `Data`, so the run is never marked `TrustReservedRunData`: `BaseAgent`
|
|
23
|
+
* drops the reserved scope and agent-type keys from it (see
|
|
24
|
+
* `ExecuteAgentParams.TrustReservedRunData`). Everything else in `Data` reaches
|
|
25
|
+
* the agent as template data.
|
|
26
|
+
*
|
|
27
|
+
* **Inside an agent run the nested run keeps the caller's bounds.** The calling run's scope
|
|
28
|
+
* (`RunActionParams.RunScope`) becomes the nested run's first-class `PrimaryScopeEntityName` /
|
|
29
|
+
* `PrimaryScopeRecordID` / `SecondaryScopes` — `Data` cannot carry them — so it searches the same
|
|
30
|
+
* tenant; its audience (`RunActionParams.Audience`) becomes an `'Intersection'` of the readers' IDs,
|
|
31
|
+
* which the nested run validates and hydrates again. The action does not declare `SupportsAudience`, so
|
|
32
|
+
* under an audience the engine refuses it before it runs: the nested run's output comes back as the
|
|
33
|
+
* whole `AgentResult` (its run record, memory context and payload), which nothing yet limits to what
|
|
34
|
+
* every reader may see.
|
|
35
|
+
*
|
|
20
36
|
* @example
|
|
21
37
|
* ```typescript
|
|
22
38
|
* await runAction({
|
|
@@ -31,6 +47,32 @@ import { BaseAction } from '@memberjunction/actions';
|
|
|
31
47
|
*/
|
|
32
48
|
export declare class ExecuteAgentAction extends BaseAction {
|
|
33
49
|
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
50
|
+
/**
|
|
51
|
+
* The agent this call names — `AgentID`, else `AgentName` — when it is a top-level agent exposed as an action,
|
|
52
|
+
* or the refusal to return.
|
|
53
|
+
*/
|
|
54
|
+
private resolveAgent;
|
|
55
|
+
/**
|
|
56
|
+
* Why an agent may not be dispatched this way, or null. Sub-agents (ParentID set) can't be exposed — their contract is
|
|
57
|
+
* governed by the parent; invoking them directly would bypass the parent agent's payload filtering. And only agents
|
|
58
|
+
* the operator has explicitly flagged as callable from outside (`ExposeAsAction`) may be — once auto-registration
|
|
59
|
+
* lands, it will only create catalog entries for agents that pass this check.
|
|
60
|
+
*/
|
|
61
|
+
private exposureRefusal;
|
|
62
|
+
/**
|
|
63
|
+
* The calling run's bounds for the nested run, as its first-class fields: the scope (`RunActionParams.RunScope` —
|
|
64
|
+
* the calling run's validated tenant and secondary dimensions; nulls become absent) and the audience
|
|
65
|
+
* ({@link nestedRunAudience}). Outside an agent run there is no `RunScope`, and the nested run is unscoped as before.
|
|
66
|
+
*/
|
|
67
|
+
private callerRunBounds;
|
|
68
|
+
/**
|
|
69
|
+
* The calling run's audience for the nested run: an `'Intersection'` of the readers' IDs, which the nested run
|
|
70
|
+
* validates and hydrates again. None when there is no audience or it names no reader. A malformed one (no
|
|
71
|
+
* `Readers` array, a reader with no ID) becomes an audience the nested run refuses — never no audience.
|
|
72
|
+
*/
|
|
73
|
+
private nestedRunAudience;
|
|
74
|
+
/** A reader's ID, or `''` (which the nested run refuses) when it has none. */
|
|
75
|
+
private readerID;
|
|
34
76
|
/**
|
|
35
77
|
* The run result as plain data, for the `AgentResult` output param.
|
|
36
78
|
*
|
|
@@ -39,8 +81,15 @@ export declare class ExecuteAgentAction extends BaseAction {
|
|
|
39
81
|
* `memoryContext` when the agent injects memory — whose event plumbing is circular, so passing
|
|
40
82
|
* any of them through fails the task after the agent has already run. Their field values carry
|
|
41
83
|
* the same information; the entities themselves stay in-process.
|
|
84
|
+
*
|
|
85
|
+
* The values are projected for the action's caller, who receives them. The notes and examples
|
|
86
|
+
* come from the AI engine's cache, which is loaded as the system user, so they are full width
|
|
87
|
+
* whoever runs the action; without the projection a field the caller may not read would reach
|
|
88
|
+
* them here and in the action log.
|
|
42
89
|
*/
|
|
43
90
|
private toStorableAgentResult;
|
|
91
|
+
/** Field values of `entities` (all of one entity type), without the fields `user` may not read. */
|
|
92
|
+
private rowsForCaller;
|
|
44
93
|
private getParamValue;
|
|
45
94
|
private getStringParam;
|
|
46
95
|
private getNumericParam;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute-agent.action.d.ts","sourceRoot":"","sources":["../../../src/custom/ai/execute-agent.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAChG,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAQrD
|
|
1
|
+
{"version":3,"file":"execute-agent.action.d.ts","sourceRoot":"","sources":["../../../src/custom/ai/execute-agent.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAChG,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAQrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,qBACa,kBAAmB,SAAQ,UAAU;cAC9B,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAoEvF;;;OAGG;YACW,YAAY;IAqB1B;;;;;OAKG;IACH,OAAO,CAAC,eAAe;IAuBvB;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAYvB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAYzB,8EAA8E;IAC9E,OAAO,CAAC,QAAQ;IAIhB;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,qBAAqB;IAc7B,mGAAmG;IACnG,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,cAAc;CAkBzB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C"}
|
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { ActionParam } from '@memberjunction/actions-base';
|
|
8
8
|
import { BaseAction } from '@memberjunction/actions';
|
|
9
9
|
import { RegisterClass, UUIDsEqual } from '@memberjunction/global';
|
|
10
|
-
import { LogError } from '@memberjunction/core';
|
|
10
|
+
import { LogError, Metadata, ProjectEntityValueRowsForUser } from '@memberjunction/core';
|
|
11
11
|
import { AgentRunner } from '@memberjunction/ai-agents';
|
|
12
12
|
import { AIEngine } from '@memberjunction/aiengine';
|
|
13
13
|
/**
|
|
@@ -27,6 +27,22 @@ import { AIEngine } from '@memberjunction/aiengine';
|
|
|
27
27
|
* the bridge already runs in-process with `contextUser` and doesn't need the
|
|
28
28
|
* action-catalog indirection.
|
|
29
29
|
*
|
|
30
|
+
* **`Data` cannot change what the run is.** Whoever calls this action — a browser
|
|
31
|
+
* through `RunAction`, a user routine, or a model inside another agent's run —
|
|
32
|
+
* authors `Data`, so the run is never marked `TrustReservedRunData`: `BaseAgent`
|
|
33
|
+
* drops the reserved scope and agent-type keys from it (see
|
|
34
|
+
* `ExecuteAgentParams.TrustReservedRunData`). Everything else in `Data` reaches
|
|
35
|
+
* the agent as template data.
|
|
36
|
+
*
|
|
37
|
+
* **Inside an agent run the nested run keeps the caller's bounds.** The calling run's scope
|
|
38
|
+
* (`RunActionParams.RunScope`) becomes the nested run's first-class `PrimaryScopeEntityName` /
|
|
39
|
+
* `PrimaryScopeRecordID` / `SecondaryScopes` — `Data` cannot carry them — so it searches the same
|
|
40
|
+
* tenant; its audience (`RunActionParams.Audience`) becomes an `'Intersection'` of the readers' IDs,
|
|
41
|
+
* which the nested run validates and hydrates again. The action does not declare `SupportsAudience`, so
|
|
42
|
+
* under an audience the engine refuses it before it runs: the nested run's output comes back as the
|
|
43
|
+
* whole `AgentResult` (its run record, memory context and payload), which nothing yet limits to what
|
|
44
|
+
* every reader may see.
|
|
45
|
+
*
|
|
30
46
|
* @example
|
|
31
47
|
* ```typescript
|
|
32
48
|
* await runAction({
|
|
@@ -43,53 +59,11 @@ let ExecuteAgentAction = class ExecuteAgentAction extends BaseAction {
|
|
|
43
59
|
async InternalRunAction(params) {
|
|
44
60
|
try {
|
|
45
61
|
// ---- Resolve agent ----
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return {
|
|
50
|
-
Success: false,
|
|
51
|
-
ResultCode: 'MISSING_AGENT_IDENTIFIER',
|
|
52
|
-
Message: 'Execute Agent requires either AgentID or AgentName parameter.'
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
// Make sure AIEngine has agent metadata loaded before we look anything up.
|
|
56
|
-
await AIEngine.Instance.Config(false, params.ContextUser);
|
|
57
|
-
const agent = agentID
|
|
58
|
-
? AIEngine.Instance.Agents.find((a) => UUIDsEqual(a.ID, agentID))
|
|
59
|
-
: AIEngine.Instance.Agents.find((a) => a.Name?.trim().toLowerCase() === agentName.trim().toLowerCase());
|
|
60
|
-
if (!agent) {
|
|
61
|
-
return {
|
|
62
|
-
Success: false,
|
|
63
|
-
ResultCode: 'AGENT_NOT_FOUND',
|
|
64
|
-
Message: agentID
|
|
65
|
-
? `No agent found with ID '${agentID}'`
|
|
66
|
-
: `No agent found with name '${agentName}'`
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
// Sub-agents (ParentID set) can't be exposed — their contract is
|
|
70
|
-
// governed by the parent; invoking them directly would bypass the
|
|
71
|
-
// parent agent's payload filtering.
|
|
72
|
-
if (agent.ParentID) {
|
|
73
|
-
return {
|
|
74
|
-
Success: false,
|
|
75
|
-
ResultCode: 'AGENT_IS_SUB_AGENT',
|
|
76
|
-
Message: `Agent '${agent.Name}' is a sub-agent (ParentID is set). ` +
|
|
77
|
-
'Only top-level agents can be invoked through Execute Agent. ' +
|
|
78
|
-
"Run the parent agent instead, or invoke this sub-agent via the parent's workflow."
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
// Only agents that the operator has explicitly flagged as callable
|
|
82
|
-
// from outside may be dispatched this way. This is the
|
|
83
|
-
// `ExposeAsAction` contract — once auto-registration lands, it
|
|
84
|
-
// will only create catalog entries for agents that pass this check.
|
|
85
|
-
if (!agent.ExposeAsAction) {
|
|
86
|
-
return {
|
|
87
|
-
Success: false,
|
|
88
|
-
ResultCode: 'AGENT_NOT_EXPOSED',
|
|
89
|
-
Message: `Agent '${agent.Name}' is not exposed as an action (AIAgent.ExposeAsAction=false). ` +
|
|
90
|
-
'Enable ExposeAsAction on the agent record to allow invocation via Execute Agent.'
|
|
91
|
-
};
|
|
62
|
+
const resolved = await this.resolveAgent(params);
|
|
63
|
+
if ('result' in resolved) {
|
|
64
|
+
return resolved.result;
|
|
92
65
|
}
|
|
66
|
+
const { agent } = resolved;
|
|
93
67
|
// ---- Collect optional inputs ----
|
|
94
68
|
const conversationMessages = this.getParamValue(params, 'conversationmessages') ?? [];
|
|
95
69
|
const data = this.getParamValue(params, 'data');
|
|
@@ -97,6 +71,7 @@ let ExecuteAgentAction = class ExecuteAgentAction extends BaseAction {
|
|
|
97
71
|
const lastRunId = this.getStringParam(params, 'lastrunid');
|
|
98
72
|
const maxExecutionTimeMs = this.getNumericParam(params, 'maxexecutiontimems');
|
|
99
73
|
const runner = new AgentRunner();
|
|
74
|
+
// Never TrustReservedRunData: Data is caller- or model-authored (see the class doc).
|
|
100
75
|
const runResult = await runner.RunAgent({
|
|
101
76
|
agent: agent,
|
|
102
77
|
conversationMessages,
|
|
@@ -104,6 +79,8 @@ let ExecuteAgentAction = class ExecuteAgentAction extends BaseAction {
|
|
|
104
79
|
// The calling run's credential scope; see execute-ai-prompt. Without keys, a 'RuntimeOnly'
|
|
105
80
|
// nested run fails rather than spending the platform's.
|
|
106
81
|
CredentialScope: params.CredentialScope,
|
|
82
|
+
// The calling run's tenant and audience, as first-class fields (see the class doc).
|
|
83
|
+
...this.callerRunBounds(params),
|
|
107
84
|
data,
|
|
108
85
|
conversationDetailId: conversationDetailId ?? undefined,
|
|
109
86
|
lastRunId: lastRunId ?? undefined,
|
|
@@ -113,7 +90,7 @@ let ExecuteAgentAction = class ExecuteAgentAction extends BaseAction {
|
|
|
113
90
|
// ---- Expose outputs for downstream action consumers ----
|
|
114
91
|
this.setOutputParam(params, 'AgentRunID', runResult.agentRun?.ID ?? null);
|
|
115
92
|
this.setOutputParam(params, 'Payload', runResult.payload ?? null);
|
|
116
|
-
this.setOutputParam(params, 'AgentResult', this.toStorableAgentResult(runResult));
|
|
93
|
+
this.setOutputParam(params, 'AgentResult', this.toStorableAgentResult(runResult, params));
|
|
117
94
|
if (runResult.success) {
|
|
118
95
|
return {
|
|
119
96
|
Success: true,
|
|
@@ -140,6 +117,89 @@ let ExecuteAgentAction = class ExecuteAgentAction extends BaseAction {
|
|
|
140
117
|
};
|
|
141
118
|
}
|
|
142
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* The agent this call names — `AgentID`, else `AgentName` — when it is a top-level agent exposed as an action,
|
|
122
|
+
* or the refusal to return.
|
|
123
|
+
*/
|
|
124
|
+
async resolveAgent(params) {
|
|
125
|
+
const agentID = this.getStringParam(params, 'agentid');
|
|
126
|
+
const agentName = this.getStringParam(params, 'agentname');
|
|
127
|
+
if (!agentID && !agentName) {
|
|
128
|
+
const message = 'Execute Agent requires either AgentID or AgentName parameter.';
|
|
129
|
+
return { result: { Success: false, ResultCode: 'MISSING_AGENT_IDENTIFIER', Message: message } };
|
|
130
|
+
}
|
|
131
|
+
// Make sure AIEngine has agent metadata loaded before we look anything up.
|
|
132
|
+
await AIEngine.Instance.Config(false, params.ContextUser);
|
|
133
|
+
const agent = agentID
|
|
134
|
+
? AIEngine.Instance.Agents.find((a) => UUIDsEqual(a.ID, agentID))
|
|
135
|
+
: AIEngine.Instance.Agents.find((a) => a.Name?.trim().toLowerCase() === agentName?.trim().toLowerCase());
|
|
136
|
+
if (!agent) {
|
|
137
|
+
const message = agentID ? `No agent found with ID '${agentID}'` : `No agent found with name '${agentName}'`;
|
|
138
|
+
return { result: { Success: false, ResultCode: 'AGENT_NOT_FOUND', Message: message } };
|
|
139
|
+
}
|
|
140
|
+
const refusal = this.exposureRefusal(agent);
|
|
141
|
+
return refusal ? { result: refusal } : { agent: agent };
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Why an agent may not be dispatched this way, or null. Sub-agents (ParentID set) can't be exposed — their contract is
|
|
145
|
+
* governed by the parent; invoking them directly would bypass the parent agent's payload filtering. And only agents
|
|
146
|
+
* the operator has explicitly flagged as callable from outside (`ExposeAsAction`) may be — once auto-registration
|
|
147
|
+
* lands, it will only create catalog entries for agents that pass this check.
|
|
148
|
+
*/
|
|
149
|
+
exposureRefusal(agent) {
|
|
150
|
+
if (agent.ParentID) {
|
|
151
|
+
return {
|
|
152
|
+
Success: false,
|
|
153
|
+
ResultCode: 'AGENT_IS_SUB_AGENT',
|
|
154
|
+
Message: `Agent '${agent.Name}' is a sub-agent (ParentID is set). ` +
|
|
155
|
+
'Only top-level agents can be invoked through Execute Agent. ' +
|
|
156
|
+
"Run the parent agent instead, or invoke this sub-agent via the parent's workflow."
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
if (!agent.ExposeAsAction) {
|
|
160
|
+
return {
|
|
161
|
+
Success: false,
|
|
162
|
+
ResultCode: 'AGENT_NOT_EXPOSED',
|
|
163
|
+
Message: `Agent '${agent.Name}' is not exposed as an action (AIAgent.ExposeAsAction=false). ` +
|
|
164
|
+
'Enable ExposeAsAction on the agent record to allow invocation via Execute Agent.'
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* The calling run's bounds for the nested run, as its first-class fields: the scope (`RunActionParams.RunScope` —
|
|
171
|
+
* the calling run's validated tenant and secondary dimensions; nulls become absent) and the audience
|
|
172
|
+
* ({@link nestedRunAudience}). Outside an agent run there is no `RunScope`, and the nested run is unscoped as before.
|
|
173
|
+
*/
|
|
174
|
+
callerRunBounds(params) {
|
|
175
|
+
const scope = params.RunScope;
|
|
176
|
+
return {
|
|
177
|
+
PrimaryScopeEntityName: scope?.PrimaryScopeEntityName ?? undefined,
|
|
178
|
+
PrimaryScopeRecordID: scope?.PrimaryScopeRecordID ?? undefined,
|
|
179
|
+
SecondaryScopes: scope?.SecondaryScopes ?? undefined,
|
|
180
|
+
Audience: this.nestedRunAudience(params.Audience),
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* The calling run's audience for the nested run: an `'Intersection'` of the readers' IDs, which the nested run
|
|
185
|
+
* validates and hydrates again. None when there is no audience or it names no reader. A malformed one (no
|
|
186
|
+
* `Readers` array, a reader with no ID) becomes an audience the nested run refuses — never no audience.
|
|
187
|
+
*/
|
|
188
|
+
nestedRunAudience(audience) {
|
|
189
|
+
if (audience === undefined) {
|
|
190
|
+
return undefined;
|
|
191
|
+
}
|
|
192
|
+
const readers = audience?.Readers;
|
|
193
|
+
if (!Array.isArray(readers)) {
|
|
194
|
+
return { Mode: 'Intersection', UserIDs: [] };
|
|
195
|
+
}
|
|
196
|
+
const list = readers;
|
|
197
|
+
return list.length === 0 ? undefined : { Mode: 'Intersection', UserIDs: list.map((reader) => this.readerID(reader)) };
|
|
198
|
+
}
|
|
199
|
+
/** A reader's ID, or `''` (which the nested run refuses) when it has none. */
|
|
200
|
+
readerID(reader) {
|
|
201
|
+
return reader !== null && typeof reader === 'object' && 'ID' in reader && typeof reader.ID === 'string' ? reader.ID : '';
|
|
202
|
+
}
|
|
143
203
|
/**
|
|
144
204
|
* The run result as plain data, for the `AgentResult` output param.
|
|
145
205
|
*
|
|
@@ -148,18 +208,31 @@ let ExecuteAgentAction = class ExecuteAgentAction extends BaseAction {
|
|
|
148
208
|
* `memoryContext` when the agent injects memory — whose event plumbing is circular, so passing
|
|
149
209
|
* any of them through fails the task after the agent has already run. Their field values carry
|
|
150
210
|
* the same information; the entities themselves stay in-process.
|
|
211
|
+
*
|
|
212
|
+
* The values are projected for the action's caller, who receives them. The notes and examples
|
|
213
|
+
* come from the AI engine's cache, which is loaded as the system user, so they are full width
|
|
214
|
+
* whoever runs the action; without the projection a field the caller may not read would reach
|
|
215
|
+
* them here and in the action log.
|
|
151
216
|
*/
|
|
152
|
-
toStorableAgentResult(runResult) {
|
|
217
|
+
toStorableAgentResult(runResult, params) {
|
|
153
218
|
const { memoryContext } = runResult;
|
|
219
|
+
const provider = params.Provider ?? new Metadata();
|
|
220
|
+
const toRows = (entities) => this.rowsForCaller(entities, provider, params.ContextUser);
|
|
154
221
|
return {
|
|
155
222
|
...runResult,
|
|
156
|
-
agentRun: runResult.agentRun
|
|
223
|
+
agentRun: runResult.agentRun ? toRows([runResult.agentRun])[0] : null,
|
|
157
224
|
memoryContext: memoryContext && {
|
|
158
|
-
notes: memoryContext.notes
|
|
159
|
-
examples: memoryContext.examples
|
|
225
|
+
notes: toRows(memoryContext.notes),
|
|
226
|
+
examples: toRows(memoryContext.examples)
|
|
160
227
|
}
|
|
161
228
|
};
|
|
162
229
|
}
|
|
230
|
+
/** Field values of `entities` (all of one entity type), without the fields `user` may not read. */
|
|
231
|
+
rowsForCaller(entities, provider, user) {
|
|
232
|
+
// fls-guard: projected by ProjectEntityValueRowsForUser below
|
|
233
|
+
const rows = entities.map((entity) => entity.GetAll());
|
|
234
|
+
return ProjectEntityValueRowsForUser(provider, entities[0]?.EntityInfo, rows, user) ?? rows;
|
|
235
|
+
}
|
|
163
236
|
// ------------------------------------------------------------------------
|
|
164
237
|
// Parameter helpers — each action keeps its own to match the existing
|
|
165
238
|
// CoreActions convention (HTTP Request, Execute AI Prompt, etc.)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute-agent.action.js","sourceRoot":"","sources":["../../../src/custom/ai/execute-agent.action.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAuC,MAAM,8BAA8B,CAAC;AAChG,OAAO,EAAE,UAAU,EAAE,MAAM,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,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC;QACnF,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;gBACjB,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC;YACvB,CAAC;YACD,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;YACjC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;YACnB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;YACrB,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAC;YACvB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/B,CAAC;IACL,CAAC;CACJ,CAAA;AA/OY,kBAAkB;IAD9B,aAAa,CAAC,UAAU,EAAE,eAAe,CAAC;GAC9B,kBAAkB,CA+O9B;;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB;IAClC,sBAAsB;AAC1B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ActionResultSimple, RunActionParams } from '@memberjunction/actions-base';
|
|
2
|
+
import { BaseAction } from '@memberjunction/actions';
|
|
3
|
+
/**
|
|
4
|
+
* Locked outbound telephony brief enforced before any Chief of Staff voice session or outbound call.
|
|
5
|
+
*/
|
|
6
|
+
export interface OutboundCallBrief {
|
|
7
|
+
briefVersion: '1.0';
|
|
8
|
+
agentID: string;
|
|
9
|
+
agentDisplayName: string;
|
|
10
|
+
onBehalfOfUserID: string;
|
|
11
|
+
onBehalfOfUserName: string;
|
|
12
|
+
targetPhoneNumber: string;
|
|
13
|
+
targetRecipientName: string;
|
|
14
|
+
isExternalRecipient: boolean;
|
|
15
|
+
objective: string;
|
|
16
|
+
requireUpfrontAiDisclosure: true;
|
|
17
|
+
mandatoryUpfrontDisclosure: string;
|
|
18
|
+
authorizedBounds: string[];
|
|
19
|
+
strictProhibitions: string[];
|
|
20
|
+
fallbackOptions: string[];
|
|
21
|
+
maxDurationSeconds: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Action that validates `PhoneChannelMode` and approval guardrails on the caller's
|
|
25
|
+
* `MJ: AI Agent User Policies` and constructs a locked `OutboundCallBrief`
|
|
26
|
+
* with mandatory upfront AI disclosure before any outbound telephony call.
|
|
27
|
+
*/
|
|
28
|
+
export declare class PrepareOutboundCallBriefAction extends BaseAction {
|
|
29
|
+
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
30
|
+
private getParamValue;
|
|
31
|
+
private getStringParam;
|
|
32
|
+
private getBooleanParam;
|
|
33
|
+
private getNumericParam;
|
|
34
|
+
private parseStringArrayParam;
|
|
35
|
+
private setOutputParam;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=prepare-outbound-call-brief.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepare-outbound-call-brief.action.d.ts","sourceRoot":"","sources":["../../../src/custom/ai/prepare-outbound-call-brief.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAChG,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAOrD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,YAAY,EAAE,KAAK,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,0BAA0B,EAAE,IAAI,CAAC;IACjC,0BAA0B,EAAE,MAAM,CAAC;IACnC,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;CAC9B;AAUD;;;;GAIG;AACH,qBACa,8BAA+B,SAAQ,UAAU;cAC1C,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAgKvF,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,qBAAqB;IAkB7B,OAAO,CAAC,cAAc;CAazB"}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { BaseAction } from '@memberjunction/actions';
|
|
8
|
+
import { RegisterClass, SafeJSONParse, UUIDsEqual } from '@memberjunction/global';
|
|
9
|
+
import { LogError, Metadata } from '@memberjunction/core';
|
|
10
|
+
import { AgentUserPolicyEngine } from '@memberjunction/ai-core-plus';
|
|
11
|
+
import { AIEngine } from '@memberjunction/aiengine';
|
|
12
|
+
const CORE_CALL_PROHIBITIONS = [
|
|
13
|
+
'Always state upfront that you are an AI assistant calling on the user\'s behalf.',
|
|
14
|
+
'Do not make financial commitments or authorize payments not explicitly listed in authorizedBounds.',
|
|
15
|
+
'Do not agree to binding contracts, legal terms, or commitments nobody authorized.',
|
|
16
|
+
'Stick strictly to the call objective and fallback options; end the call politely if asked to exceed your brief.',
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* Action that validates `PhoneChannelMode` and approval guardrails on the caller's
|
|
20
|
+
* `MJ: AI Agent User Policies` and constructs a locked `OutboundCallBrief`
|
|
21
|
+
* with mandatory upfront AI disclosure before any outbound telephony call.
|
|
22
|
+
*/
|
|
23
|
+
let PrepareOutboundCallBriefAction = class PrepareOutboundCallBriefAction extends BaseAction {
|
|
24
|
+
async InternalRunAction(params) {
|
|
25
|
+
try {
|
|
26
|
+
const contextUser = params.ContextUser;
|
|
27
|
+
if (!contextUser?.ID) {
|
|
28
|
+
return {
|
|
29
|
+
Success: false,
|
|
30
|
+
ResultCode: 'MISSING_USER_CONTEXT',
|
|
31
|
+
Message: 'Prepare Outbound Call Brief requires a valid ContextUser.',
|
|
32
|
+
Params: params.Params,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const targetPhoneNumber = this.getStringParam(params, 'TargetPhoneNumber');
|
|
36
|
+
const targetRecipientName = this.getStringParam(params, 'TargetRecipientName');
|
|
37
|
+
const objective = this.getStringParam(params, 'Objective');
|
|
38
|
+
if (!targetPhoneNumber || !targetRecipientName || !objective) {
|
|
39
|
+
return {
|
|
40
|
+
Success: false,
|
|
41
|
+
ResultCode: 'VALIDATION_ERROR',
|
|
42
|
+
Message: 'TargetPhoneNumber, TargetRecipientName, and Objective are required parameters.',
|
|
43
|
+
Params: params.Params,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
await AIEngine.Instance.Config(false, contextUser);
|
|
47
|
+
const rawAgentId = this.getStringParam(params, 'AgentID');
|
|
48
|
+
const rawAgentName = this.getStringParam(params, 'AgentName') ?? (rawAgentId ? null : 'Chief of Staff');
|
|
49
|
+
const agent = rawAgentId
|
|
50
|
+
? AIEngine.Instance.Agents.find((a) => UUIDsEqual(a.ID, rawAgentId))
|
|
51
|
+
: AIEngine.Instance.Agents.find((a) => a.Name.trim().toLowerCase() === (rawAgentName ?? '').trim().toLowerCase());
|
|
52
|
+
if (!agent) {
|
|
53
|
+
return {
|
|
54
|
+
Success: false,
|
|
55
|
+
ResultCode: 'AGENT_NOT_FOUND',
|
|
56
|
+
Message: `Agent "${rawAgentId ?? rawAgentName}" not found.`,
|
|
57
|
+
Params: params.Params,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const policy = await AgentUserPolicyEngine.Instance.GetPolicyForAgentAndUser(agent.ID, contextUser.ID, contextUser);
|
|
61
|
+
const phoneMode = policy?.PhoneChannelMode ?? 'OutboundWithApproval';
|
|
62
|
+
if (phoneMode === 'Disabled' || phoneMode === 'InboundOnly') {
|
|
63
|
+
return {
|
|
64
|
+
Success: false,
|
|
65
|
+
ResultCode: 'POLICY_DENIED',
|
|
66
|
+
Message: `Outbound calls are blocked by your Chief of Staff policy (PhoneChannelMode="${phoneMode}").`,
|
|
67
|
+
Params: params.Params,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const isExternalRecipient = this.getBooleanParam(params, 'IsExternalRecipient') ?? true;
|
|
71
|
+
const approvalGranted = this.getBooleanParam(params, 'ApprovalGranted') === true;
|
|
72
|
+
const authorizedBounds = this.parseStringArrayParam(params, 'AuthorizedBounds');
|
|
73
|
+
const customProhibitions = this.parseStringArrayParam(params, 'AdditionalProhibitions');
|
|
74
|
+
const fallbackOptions = this.parseStringArrayParam(params, 'FallbackOptions');
|
|
75
|
+
const maxDurationSeconds = Math.max(30, Math.min(1800, Math.round(this.getNumericParam(params, 'MaxDurationSeconds') ?? 300)));
|
|
76
|
+
const agentDisplayName = policy?.DisplayNameOverride?.trim() || agent.Name;
|
|
77
|
+
const callerName = contextUser.Name || contextUser.Email || 'my principal';
|
|
78
|
+
const mandatoryUpfrontDisclosure = `Hello ${targetRecipientName}, I am ${agentDisplayName}, an AI assistant calling on behalf of ${callerName}.`;
|
|
79
|
+
const brief = {
|
|
80
|
+
briefVersion: '1.0',
|
|
81
|
+
agentID: agent.ID,
|
|
82
|
+
agentDisplayName,
|
|
83
|
+
onBehalfOfUserID: contextUser.ID,
|
|
84
|
+
onBehalfOfUserName: callerName,
|
|
85
|
+
targetPhoneNumber,
|
|
86
|
+
targetRecipientName,
|
|
87
|
+
isExternalRecipient,
|
|
88
|
+
objective,
|
|
89
|
+
requireUpfrontAiDisclosure: true,
|
|
90
|
+
mandatoryUpfrontDisclosure,
|
|
91
|
+
authorizedBounds,
|
|
92
|
+
strictProhibitions: [...CORE_CALL_PROHIBITIONS, ...customProhibitions],
|
|
93
|
+
fallbackOptions,
|
|
94
|
+
maxDurationSeconds,
|
|
95
|
+
};
|
|
96
|
+
const needsApproval = !approvalGranted &&
|
|
97
|
+
(phoneMode === 'OutboundWithApproval' ||
|
|
98
|
+
(isExternalRecipient && (policy?.RequireApprovalForExternalComms ?? true)));
|
|
99
|
+
this.setOutputParam(params, 'CallBrief', brief);
|
|
100
|
+
this.setOutputParam(params, 'DisclosureStatement', mandatoryUpfrontDisclosure);
|
|
101
|
+
if (needsApproval) {
|
|
102
|
+
const approvalTypeId = await AIEngine.Instance.ResolveAgentRequestTypeID('Approval', contextUser);
|
|
103
|
+
if (!approvalTypeId) {
|
|
104
|
+
return {
|
|
105
|
+
Success: false,
|
|
106
|
+
ResultCode: 'REQUEST_TYPE_NOT_FOUND',
|
|
107
|
+
Message: 'Agent request type "Approval" is not in metadata; the call brief was prepared but cannot be queued for approval.',
|
|
108
|
+
Params: params.Params,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
const md = params.Provider ?? new Metadata();
|
|
112
|
+
const approvalReq = await md.GetEntityObject('MJ: AI Agent Requests', contextUser);
|
|
113
|
+
approvalReq.AgentID = agent.ID;
|
|
114
|
+
approvalReq.RequestTypeID = approvalTypeId;
|
|
115
|
+
approvalReq.RequestedAt = new Date();
|
|
116
|
+
approvalReq.RequestForUserID = contextUser.ID;
|
|
117
|
+
approvalReq.Status = 'Requested';
|
|
118
|
+
approvalReq.Priority = 75;
|
|
119
|
+
approvalReq.Request =
|
|
120
|
+
`[Outbound Phone Call Approval Required]\n` +
|
|
121
|
+
`Recipient: ${targetRecipientName} (${targetPhoneNumber})\n` +
|
|
122
|
+
`Objective: ${objective}\n` +
|
|
123
|
+
`Upfront Disclosure: "${mandatoryUpfrontDisclosure}"`;
|
|
124
|
+
approvalReq.Comments = JSON.stringify(brief);
|
|
125
|
+
const saved = await approvalReq.Save();
|
|
126
|
+
this.setOutputParam(params, 'Status', 'PENDING_APPROVAL');
|
|
127
|
+
this.setOutputParam(params, 'AgentRequestID', saved ? approvalReq.ID : null);
|
|
128
|
+
return {
|
|
129
|
+
Success: true,
|
|
130
|
+
ResultCode: 'APPROVAL_REQUIRED',
|
|
131
|
+
Message: `Outbound call brief prepared and queued for explicit user approval${saved ? ` (Request ID: ${approvalReq.ID})` : ''}.`,
|
|
132
|
+
Params: params.Params,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
this.setOutputParam(params, 'Status', 'READY_TO_DIAL');
|
|
136
|
+
this.setOutputParam(params, 'AgentRequestID', null);
|
|
137
|
+
return {
|
|
138
|
+
Success: true,
|
|
139
|
+
ResultCode: 'READY_TO_DIAL',
|
|
140
|
+
Message: `Outbound call brief validated and ready to dial ${targetRecipientName} (${targetPhoneNumber}) with mandatory AI disclosure.`,
|
|
141
|
+
Params: params.Params,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
146
|
+
LogError(`PrepareOutboundCallBriefAction error: ${message}`);
|
|
147
|
+
return {
|
|
148
|
+
Success: false,
|
|
149
|
+
ResultCode: 'UNEXPECTED_ERROR',
|
|
150
|
+
Message: `Error preparing outbound call brief: ${message}`,
|
|
151
|
+
Params: params.Params,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
getParamValue(params, name) {
|
|
156
|
+
const found = params.Params.find((p) => p.Name.trim().toLowerCase() === name.trim().toLowerCase());
|
|
157
|
+
return found?.Value;
|
|
158
|
+
}
|
|
159
|
+
getStringParam(params, name) {
|
|
160
|
+
const val = this.getParamValue(params, name);
|
|
161
|
+
if (val == null)
|
|
162
|
+
return null;
|
|
163
|
+
const str = String(val).trim();
|
|
164
|
+
return str.length > 0 ? str : null;
|
|
165
|
+
}
|
|
166
|
+
getBooleanParam(params, name) {
|
|
167
|
+
const val = this.getParamValue(params, name);
|
|
168
|
+
if (val == null || val === '')
|
|
169
|
+
return null;
|
|
170
|
+
if (typeof val === 'boolean')
|
|
171
|
+
return val;
|
|
172
|
+
if (typeof val === 'string') {
|
|
173
|
+
const lower = val.trim().toLowerCase();
|
|
174
|
+
if (lower === 'true' || lower === '1' || lower === 'yes')
|
|
175
|
+
return true;
|
|
176
|
+
if (lower === 'false' || lower === '0' || lower === 'no')
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
getNumericParam(params, name) {
|
|
182
|
+
const val = this.getParamValue(params, name);
|
|
183
|
+
if (val == null || val === '')
|
|
184
|
+
return null;
|
|
185
|
+
const num = typeof val === 'number' ? val : Number(val);
|
|
186
|
+
return Number.isFinite(num) ? num : null;
|
|
187
|
+
}
|
|
188
|
+
parseStringArrayParam(params, name) {
|
|
189
|
+
const val = this.getParamValue(params, name);
|
|
190
|
+
if (Array.isArray(val)) {
|
|
191
|
+
return val.map((v) => String(v).trim()).filter(Boolean);
|
|
192
|
+
}
|
|
193
|
+
if (typeof val === 'string') {
|
|
194
|
+
const parsed = SafeJSONParse(val);
|
|
195
|
+
if (Array.isArray(parsed)) {
|
|
196
|
+
return parsed.map((v) => String(v).trim()).filter(Boolean);
|
|
197
|
+
}
|
|
198
|
+
return val
|
|
199
|
+
.split('\n')
|
|
200
|
+
.map((s) => s.trim())
|
|
201
|
+
.filter(Boolean);
|
|
202
|
+
}
|
|
203
|
+
return [];
|
|
204
|
+
}
|
|
205
|
+
setOutputParam(params, name, value) {
|
|
206
|
+
const existing = params.Params.find((p) => p.Name.trim().toLowerCase() === name.trim().toLowerCase());
|
|
207
|
+
if (existing) {
|
|
208
|
+
existing.Value = value;
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
const outParam = {
|
|
212
|
+
Name: name,
|
|
213
|
+
Value: value,
|
|
214
|
+
Type: 'Output',
|
|
215
|
+
};
|
|
216
|
+
params.Params.push(outParam);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
PrepareOutboundCallBriefAction = __decorate([
|
|
221
|
+
RegisterClass(BaseAction, 'Prepare Outbound Call Brief')
|
|
222
|
+
], PrepareOutboundCallBriefAction);
|
|
223
|
+
export { PrepareOutboundCallBriefAction };
|
|
224
|
+
//# sourceMappingURL=prepare-outbound-call-brief.action.js.map
|