@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.
Files changed (174) hide show
  1. package/README.md +76 -0
  2. package/dist/custom/ai/base-find-actions.action.d.ts +8 -0
  3. package/dist/custom/ai/base-find-actions.action.d.ts.map +1 -1
  4. package/dist/custom/ai/base-find-actions.action.js +18 -2
  5. package/dist/custom/ai/base-find-actions.action.js.map +1 -1
  6. package/dist/custom/ai/communication-oauth-service.d.ts +228 -0
  7. package/dist/custom/ai/communication-oauth-service.d.ts.map +1 -0
  8. package/dist/custom/ai/communication-oauth-service.js +309 -0
  9. package/dist/custom/ai/communication-oauth-service.js.map +1 -0
  10. package/dist/custom/ai/configure-agent-user-policy.action.d.ts +26 -0
  11. package/dist/custom/ai/configure-agent-user-policy.action.d.ts.map +1 -0
  12. package/dist/custom/ai/configure-agent-user-policy.action.js +270 -0
  13. package/dist/custom/ai/configure-agent-user-policy.action.js.map +1 -0
  14. package/dist/custom/ai/execute-agent.action.d.ts +49 -0
  15. package/dist/custom/ai/execute-agent.action.d.ts.map +1 -1
  16. package/dist/custom/ai/execute-agent.action.js +125 -52
  17. package/dist/custom/ai/execute-agent.action.js.map +1 -1
  18. package/dist/custom/ai/prepare-outbound-call-brief.action.d.ts +37 -0
  19. package/dist/custom/ai/prepare-outbound-call-brief.action.d.ts.map +1 -0
  20. package/dist/custom/ai/prepare-outbound-call-brief.action.js +224 -0
  21. package/dist/custom/ai/prepare-outbound-call-brief.action.js.map +1 -0
  22. package/dist/custom/ai/schedule-next-agent-wake.action.d.ts +26 -0
  23. package/dist/custom/ai/schedule-next-agent-wake.action.d.ts.map +1 -0
  24. package/dist/custom/ai/schedule-next-agent-wake.action.js +278 -0
  25. package/dist/custom/ai/schedule-next-agent-wake.action.js.map +1 -0
  26. package/dist/custom/ai/send-inter-agent-request.action.d.ts +42 -0
  27. package/dist/custom/ai/send-inter-agent-request.action.d.ts.map +1 -0
  28. package/dist/custom/ai/send-inter-agent-request.action.js +213 -0
  29. package/dist/custom/ai/send-inter-agent-request.action.js.map +1 -0
  30. package/dist/custom/ai/user-scoped-communication.action.d.ts +109 -0
  31. package/dist/custom/ai/user-scoped-communication.action.d.ts.map +1 -0
  32. package/dist/custom/ai/user-scoped-communication.action.js +1258 -0
  33. package/dist/custom/ai/user-scoped-communication.action.js.map +1 -0
  34. package/dist/custom/crud/base-record-mutation.action.d.ts +66 -21
  35. package/dist/custom/crud/base-record-mutation.action.d.ts.map +1 -1
  36. package/dist/custom/crud/base-record-mutation.action.js +178 -66
  37. package/dist/custom/crud/base-record-mutation.action.js.map +1 -1
  38. package/dist/custom/crud/create-record.action.d.ts +2 -2
  39. package/dist/custom/crud/create-record.action.d.ts.map +1 -1
  40. package/dist/custom/crud/create-record.action.js +7 -3
  41. package/dist/custom/crud/create-record.action.js.map +1 -1
  42. package/dist/custom/crud/delete-record.action.d.ts +2 -1
  43. package/dist/custom/crud/delete-record.action.d.ts.map +1 -1
  44. package/dist/custom/crud/delete-record.action.js +8 -6
  45. package/dist/custom/crud/delete-record.action.js.map +1 -1
  46. package/dist/custom/crud/get-record.action.d.ts +2 -1
  47. package/dist/custom/crud/get-record.action.d.ts.map +1 -1
  48. package/dist/custom/crud/get-record.action.js +8 -6
  49. package/dist/custom/crud/get-record.action.js.map +1 -1
  50. package/dist/custom/crud/get-records.action.d.ts.map +1 -1
  51. package/dist/custom/crud/get-records.action.js +19 -2
  52. package/dist/custom/crud/get-records.action.js.map +1 -1
  53. package/dist/custom/crud/update-record.action.d.ts +4 -3
  54. package/dist/custom/crud/update-record.action.d.ts.map +1 -1
  55. package/dist/custom/crud/update-record.action.js +23 -23
  56. package/dist/custom/crud/update-record.action.js.map +1 -1
  57. package/dist/custom/data/explore-database-schema.action.d.ts.map +1 -1
  58. package/dist/custom/data/explore-database-schema.action.js +22 -1
  59. package/dist/custom/data/explore-database-schema.action.js.map +1 -1
  60. package/dist/custom/data/get-entity-details.action.d.ts.map +1 -1
  61. package/dist/custom/data/get-entity-details.action.js +33 -7
  62. package/dist/custom/data/get-entity-details.action.js.map +1 -1
  63. package/dist/custom/data/run-adhoc-query.action.d.ts +2 -0
  64. package/dist/custom/data/run-adhoc-query.action.d.ts.map +1 -1
  65. package/dist/custom/data/run-adhoc-query.action.js +64 -9
  66. package/dist/custom/data/run-adhoc-query.action.js.map +1 -1
  67. package/dist/custom/data/run-record-process.action.d.ts +2 -0
  68. package/dist/custom/data/run-record-process.action.d.ts.map +1 -1
  69. package/dist/custom/data/run-record-process.action.js +10 -4
  70. package/dist/custom/data/run-record-process.action.js.map +1 -1
  71. package/dist/custom/data/run-stored-query.action.d.ts +1 -0
  72. package/dist/custom/data/run-stored-query.action.d.ts.map +1 -1
  73. package/dist/custom/data/run-stored-query.action.js +21 -5
  74. package/dist/custom/data/run-stored-query.action.js.map +1 -1
  75. package/dist/custom/files/base-file-storage.action.d.ts +53 -5
  76. package/dist/custom/files/base-file-storage.action.d.ts.map +1 -1
  77. package/dist/custom/files/base-file-storage.action.js +72 -14
  78. package/dist/custom/files/base-file-storage.action.js.map +1 -1
  79. package/dist/custom/files/copy-object.action.d.ts +3 -0
  80. package/dist/custom/files/copy-object.action.d.ts.map +1 -1
  81. package/dist/custom/files/copy-object.action.js +9 -1
  82. package/dist/custom/files/copy-object.action.js.map +1 -1
  83. package/dist/custom/files/create-directory.action.d.ts +3 -0
  84. package/dist/custom/files/create-directory.action.d.ts.map +1 -1
  85. package/dist/custom/files/create-directory.action.js +4 -0
  86. package/dist/custom/files/create-directory.action.js.map +1 -1
  87. package/dist/custom/files/create-document.action.d.ts.map +1 -1
  88. package/dist/custom/files/create-document.action.js +12 -0
  89. package/dist/custom/files/create-document.action.js.map +1 -1
  90. package/dist/custom/files/delete-directory.action.d.ts +3 -0
  91. package/dist/custom/files/delete-directory.action.d.ts.map +1 -1
  92. package/dist/custom/files/delete-directory.action.js +4 -0
  93. package/dist/custom/files/delete-directory.action.js.map +1 -1
  94. package/dist/custom/files/delete-object.action.d.ts +3 -0
  95. package/dist/custom/files/delete-object.action.d.ts.map +1 -1
  96. package/dist/custom/files/delete-object.action.js +9 -1
  97. package/dist/custom/files/delete-object.action.js.map +1 -1
  98. package/dist/custom/files/get-download-url.action.d.ts.map +1 -1
  99. package/dist/custom/files/get-download-url.action.js +5 -1
  100. package/dist/custom/files/get-download-url.action.js.map +1 -1
  101. package/dist/custom/files/get-file-content.action.d.ts +0 -20
  102. package/dist/custom/files/get-file-content.action.d.ts.map +1 -1
  103. package/dist/custom/files/get-file-content.action.js +18 -66
  104. package/dist/custom/files/get-file-content.action.js.map +1 -1
  105. package/dist/custom/files/get-metadata.action.d.ts.map +1 -1
  106. package/dist/custom/files/get-metadata.action.js +5 -1
  107. package/dist/custom/files/get-metadata.action.js.map +1 -1
  108. package/dist/custom/files/get-object.action.d.ts.map +1 -1
  109. package/dist/custom/files/get-object.action.js +5 -1
  110. package/dist/custom/files/get-object.action.js.map +1 -1
  111. package/dist/custom/files/get-upload-url.action.d.ts +3 -0
  112. package/dist/custom/files/get-upload-url.action.d.ts.map +1 -1
  113. package/dist/custom/files/get-upload-url.action.js +9 -1
  114. package/dist/custom/files/get-upload-url.action.js.map +1 -1
  115. package/dist/custom/files/list-objects.action.d.ts.map +1 -1
  116. package/dist/custom/files/list-objects.action.js +7 -3
  117. package/dist/custom/files/list-objects.action.js.map +1 -1
  118. package/dist/custom/files/list-storage-providers.action.d.ts +5 -4
  119. package/dist/custom/files/list-storage-providers.action.d.ts.map +1 -1
  120. package/dist/custom/files/list-storage-providers.action.js +15 -11
  121. package/dist/custom/files/list-storage-providers.action.js.map +1 -1
  122. package/dist/custom/files/move-object.action.d.ts +3 -0
  123. package/dist/custom/files/move-object.action.d.ts.map +1 -1
  124. package/dist/custom/files/move-object.action.js +9 -1
  125. package/dist/custom/files/move-object.action.js.map +1 -1
  126. package/dist/custom/files/search-storage-files.action.d.ts.map +1 -1
  127. package/dist/custom/files/search-storage-files.action.js +10 -6
  128. package/dist/custom/files/search-storage-files.action.js.map +1 -1
  129. package/dist/custom/lists/get-list-records.action.d.ts.map +1 -1
  130. package/dist/custom/lists/get-list-records.action.js +1 -0
  131. package/dist/custom/lists/get-list-records.action.js.map +1 -1
  132. package/dist/custom/search/scoped-search.action.d.ts +112 -22
  133. package/dist/custom/search/scoped-search.action.d.ts.map +1 -1
  134. package/dist/custom/search/scoped-search.action.js +351 -95
  135. package/dist/custom/search/scoped-search.action.js.map +1 -1
  136. package/dist/custom/search/search.action.d.ts +30 -0
  137. package/dist/custom/search/search.action.d.ts.map +1 -1
  138. package/dist/custom/search/search.action.js +77 -32
  139. package/dist/custom/search/search.action.js.map +1 -1
  140. package/dist/custom/security/password-strength.action.d.ts.map +1 -1
  141. package/dist/custom/security/password-strength.action.js +3 -4
  142. package/dist/custom/security/password-strength.action.js.map +1 -1
  143. package/dist/custom/utilities/artifact-builder-service.d.ts +3 -3
  144. package/dist/custom/utilities/artifact-builder-service.d.ts.map +1 -1
  145. package/dist/custom/utilities/artifact-builder-service.js +9 -9
  146. package/dist/custom/utilities/artifact-builder-service.js.map +1 -1
  147. package/dist/custom/utilities/base-file-handler.d.ts +14 -6
  148. package/dist/custom/utilities/base-file-handler.d.ts.map +1 -1
  149. package/dist/custom/utilities/base-file-handler.js +36 -28
  150. package/dist/custom/utilities/base-file-handler.js.map +1 -1
  151. package/dist/custom/web/web-page-content.action.d.ts.map +1 -1
  152. package/dist/custom/web/web-page-content.action.js +11 -12
  153. package/dist/custom/web/web-page-content.action.js.map +1 -1
  154. package/dist/custom/workflow/conditional.action.d.ts.map +1 -1
  155. package/dist/custom/workflow/conditional.action.js +5 -0
  156. package/dist/custom/workflow/conditional.action.js.map +1 -1
  157. package/dist/custom/workflow/loop.action.d.ts.map +1 -1
  158. package/dist/custom/workflow/loop.action.js +5 -0
  159. package/dist/custom/workflow/loop.action.js.map +1 -1
  160. package/dist/custom/workflow/parallel-execute.action.d.ts.map +1 -1
  161. package/dist/custom/workflow/parallel-execute.action.js +8 -2
  162. package/dist/custom/workflow/parallel-execute.action.js.map +1 -1
  163. package/dist/custom/workflow/retry.action.d.ts.map +1 -1
  164. package/dist/custom/workflow/retry.action.js +5 -0
  165. package/dist/custom/workflow/retry.action.js.map +1 -1
  166. package/dist/custom/workflow/workflow-run-scope.d.ts +15 -0
  167. package/dist/custom/workflow/workflow-run-scope.d.ts.map +1 -0
  168. package/dist/custom/workflow/workflow-run-scope.js +24 -0
  169. package/dist/custom/workflow/workflow-run-scope.js.map +1 -0
  170. package/dist/index.d.ts +7 -0
  171. package/dist/index.d.ts.map +1 -1
  172. package/dist/index.js +7 -0
  173. package/dist/index.js.map +1 -1
  174. package/package.json +44 -44
package/README.md CHANGED
@@ -81,6 +81,7 @@ Several abstract base classes reduce duplication across related actions:
81
81
  | `BaseRecordMutationAction` | `crud/base-record-mutation.action.ts` | Shared parameter extraction, entity loading, error analysis for Create/Update/Delete |
82
82
  | `BaseFileStorageAction` | `files/base-file-storage.action.ts` | Common storage-provider resolution for all `File Storage: *` actions |
83
83
  | `BaseFileHandlerAction` | `utilities/base-file-handler.ts` | Multi-source file loading (Storage, URL, direct data) |
84
+ | `BaseUserScopedCommunicationAction` | `ai/user-scoped-communication.action.ts` | Mailbox security gate and provider resolution for the Chief of Staff `* My *` email/calendar actions; pins every mailbox operation to `ContextUser.Email` |
84
85
 
85
86
  ### Generated Actions
86
87
 
@@ -149,6 +150,23 @@ Actions for prompt execution, agent discovery, image generation, and content sum
149
150
  | `Load Agent Spec` | `LoadAgentSpecAction` | Load full specification for an AI agent |
150
151
  | `Generate Image` | `GenerateImageAction` | Generate images using AI models |
151
152
 
153
+ ### Chief of Staff / agent governance (8 actions)
154
+
155
+ Actions used by the Chief of Staff agent (and other autonomous agents) to manage their own policy, schedule, coordination and user-scoped communication. All of them bind to `ContextUser` -- an agent can only act on, and read for, the calling user. The four `* My *` actions extend `BaseUserScopedCommunicationAction` and are also registered under a `__`-prefixed alias (for example `__ManageMyEmailInbox`).
156
+
157
+ | Registration Name | Class | Description |
158
+ |---|---|---|
159
+ | `Configure Agent User Policy` | `ConfigureAgentUserPolicyAction` | Create or update the caller's `MJ: AI Agent User Policies` row for an agent (channel modes, coordination mode, action and entity rules); always bound to `ContextUser.ID` |
160
+ | `Schedule Next Agent Wake` | `ScheduleNextAgentWakeAction` | Upsert the agent's next `AgentWake` row in `MJ: User Routines`, keyed by `(UserID, TargetID, WorkstreamKey)`; one-shot or cron schedule |
161
+ | `Send Inter-Agent Request` | `SendInterAgentRequestAction` | Send a structured follow-up to another user, or that user's Chief of Staff, as an `MJ: AI Agent Requests` row; checks both users' coordination policy |
162
+ | `Prepare Outbound Call Brief` | `PrepareOutboundCallBriefAction` | Validate `PhoneChannelMode` and approval rules, then build a locked outbound-call brief with mandatory upfront AI disclosure |
163
+ | `Verify My Communication Capabilities` | `VerifyMyCommunicationCapabilitiesAction` | Preflight: reports the enterprise communication posture, active providers, the caller's channel permissions, utility mailboxes and external scheduling connectors |
164
+ | `Get My Calendar Events and Availability` | `GetMyCalendarAndAvailabilityAction` | Read the caller's events, free/busy, meeting-time suggestions, or HubSpot/Calendly availability |
165
+ | `Manage My Calendar Event` | `ManageMyCalendarEventAction` | Create, update, respond to or cancel an event on the caller's calendar, or create a Calendly single-use link; enforces `CalendarChannelMode` |
166
+ | `Manage My Email Inbox and Drafts` | `ManageMyEmailInboxAction` | Read, search and draft/reply/forward in the caller's own mailbox or dedicated utility mailbox; enforces `EmailChannelMode`; never accepts a `From` or `Mailbox` parameter |
167
+
168
+ The mailbox actions run through the enterprise provider's app-level credential (Microsoft Graph or Gmail) and the gate in `BaseUserScopedCommunicationAction`: the caller's email domain must match the provider's `AllowedEmailDomains`, the provider's `EnterpriseScopeMode` must allow personal mailboxes (otherwise the action falls back to the user's `MJ: AI Bridge Agent Identities` utility inbox), and the provider's mailbox-access preflight must succeed. The per-user OAuth service described below is a separate, not-yet-wired path to the same mailboxes.
169
+
152
170
  ### Communication (3 actions)
153
171
 
154
172
  Send messages via the MJ Communication Framework or webhook integrations.
@@ -374,6 +392,64 @@ AI-generated entity-specific child actions. These are maintained by CodeGen and
374
392
  | `Create Conversation Record` | `Create_Conversation_Record_Action` | Create a Conversations entity record (child of Create Record) |
375
393
  | `Get AI Model Cost` | `Get_AI_Model_Cost_Action` | Look up cost information for an AI model (child of Get Record) |
376
394
 
395
+ ## Per-user OAuth 2.0 (3LO) service -- prototype
396
+
397
+ `CommunicationUserOAuthService` (`src/custom/ai/communication-oauth-service.ts`) is a `BaseSingleton` that lets an individual user connect their own Microsoft Graph or Google Workspace mailbox to MJ through three-legged OAuth, instead of the app-level credential the mailbox actions above use today. It is not an action; it is a service a host (MJServer route, test harness) drives directly.
398
+
399
+ **Status: prototype, off by default.** Gates 1 to 3 are administrator settings on `MJ: Communication Providers`: `AllowUserDelegatedOAuth` (bit, default 0), `AllowedEmailDomains` and `AllowedOAuthTenantIDs` (both comma-separated, optional). `ReadProviderUserOAuthGates(providerEntity)` lifts them into the gate fields of a `ProviderUserOAuthPolicyConfig`; the caller adds the OAuth client settings (endpoints, client id, redirect URI, scopes), which are not yet stored anywhere. Unless an administrator sets `AllowUserDelegatedOAuth = 1` on a provider, no user can initiate a personal OAuth flow. See "Current limitations" below before relying on it.
400
+
401
+ ### Flow
402
+
403
+ ```mermaid
404
+ sequenceDiagram
405
+ participant Host as Host (route / caller)
406
+ participant Svc as CommunicationUserOAuthService
407
+ participant IdP as Microsoft / Google
408
+ participant Store as IUserDelegatedCredentialStore
409
+
410
+ Host->>Svc: InitiateAuthorizationFlow(policy, contextUser)
411
+ Svc->>Svc: Gate 1, Gate 2 (contextUser.Email)
412
+ Svc-->>Host: AuthorizationUrl + State (PKCE S256, 10-minute session)
413
+ Host->>IdP: redirect user, user consents
414
+ IdP-->>Host: code + state
415
+ Host->>Svc: HandleOAuthCallback({ state, code, policy, contextUser, transport })
416
+ Svc->>Svc: state valid, same user, Gate 1 again
417
+ Svc->>IdP: transport.ExchangeAuthorizationCode (code + code_verifier)
418
+ Svc->>Svc: Gate 2 (token email), Gate 3, Gate 4
419
+ Svc->>Store: StoreUserDelegatedCredential(...)
420
+ Svc-->>Host: OAuthCallbackResult (CredentialID, PrincipalEmail)
421
+ ```
422
+
423
+ 1. **Initiate** -- `InitiateAuthorizationFlow(policy, contextUser)` checks Gates 1 and 2, generates a PKCE `S256` verifier/challenge pair (`GeneratePkcePair`) and a random `state`, keeps them in an in-memory session for 10 minutes, and returns an `OAuthInitiateResult` whose `AuthorizationUrl` includes `code_challenge`, `code_challenge_method=S256` and `login_hint`.
424
+ 2. **Consent** -- the host redirects the browser to `AuthorizationUrl`; the identity provider redirects back with `code` and `state`.
425
+ 3. **Callback** -- `HandleOAuthCallback(params)` consumes the session (one use), rejects an expired or unknown `state` (`INVALID_OR_EXPIRED_STATE`) or a different calling user (`STATE_USER_MISMATCH`), exchanges the code through the injected `IOAuthTokenTransport`, runs Gates 2 through 4 against the verified token identity, and stores the result.
426
+ 4. **Store** -- the credential is written through `IUserDelegatedCredentialStore.StoreUserDelegatedCredential` under the name `UserOAuth3LO:<provider>:<ownerUserId>` with `ownerUserId` inside the encrypted values. See `@memberjunction/credentials` for the owner-binding rules.
427
+ 5. **Disconnect** -- `DisconnectAndRevokeUserOAuth(params)` revokes the refresh (or access) token at the provider when the transport implements `RevokeToken`, then deactivates the stored credential and wipes its token values. Revocation failure at the provider is reported in `RevokedAtProvider` but does not stop the local deactivation.
428
+
429
+ ### The four gates
430
+
431
+ | Gate | Checked at | Rule | Result code on failure |
432
+ |---|---|---|---|
433
+ | 1 | initiate and callback | `policy.AllowUserDelegatedOAuth === true` | `GATE_1_USER_OAUTH_DISABLED` |
434
+ | 2 | initiate (on `contextUser.Email`) and callback (on the token's verified email) | domain is in `policy.AllowedEmailDomains` (comma-separated; empty means any) | `GATE_2_DOMAIN_MISMATCH` |
435
+ | 3 | callback | token's tenant (`tid` for Azure AD, `hd` for Google Workspace) is in `policy.AllowedOAuthTenantIDs` (empty means any) | `GATE_3_TENANT_MISMATCH` |
436
+ | 4 | callback | the authenticated principal's email equals `contextUser.Email`, case-insensitive -- a user cannot link a personal or someone else's mailbox to their MJ identity | `GATE_4_PRINCIPAL_EMAIL_MISMATCH` |
437
+
438
+ Gates 2 and 3 are opt-in narrowing; Gates 1 and 4 always apply. All result codes are the `CommunicationOAuthResultCode` union.
439
+
440
+ ### Injection points
441
+
442
+ - **`ProviderUserOAuthPolicyConfig`** -- the caller builds this: `ProviderName`, the four gate fields, `ClientId`/`ClientSecret`, `AuthorizationEndpoint`, `TokenEndpoint`, optional `RevocationEndpoint`, `RedirectUri`, `Scopes`.
443
+ - **`IOAuthTokenTransport`** (required on callback) -- `ExchangeAuthorizationCode` must return a `VerifiedOAuthTokenExchangeResult` whose `PrincipalEmail` and `TenantID` come from a verified source (`id_token` claims or the provider's userinfo endpoint), because Gates 2 to 4 trust them. `RevokeToken` is optional.
444
+ - **`IUserDelegatedCredentialStore`** (optional) -- defaults to `CredentialEngine.Instance` from `@memberjunction/credentials`, which owns credential naming (`UserOAuth3LO:<provider>:<ownerUserId>`), owner binding, the required credential type, encryption and audit logging. Inject another store only for tests.
445
+
446
+ ### Current limitations
447
+
448
+ - **No stored OAuth client settings and no admin UI beyond the generated form.** The gate fields live on `MJ: Communication Providers` (editable through its generated Explorer form), but `ClientId`, `ClientSecret`, endpoints, `RedirectUri` and `Scopes` still come from the caller.
449
+ - **No built-in transport and no routes.** `IOAuthTokenTransport` has no shipped implementation. The file header mentions `/api/v1/communication-oauth/initiate` and `/callback`, but no MJServer routes exist yet; a host must build them with `ApiRoute()` and call the service.
450
+ - **No consumer of the stored token.** The Microsoft Graph and Gmail communication providers still authenticate with app-level credentials; a connected 3LO credential is stored but not yet used by any mailbox action.
451
+ - **Pending sessions are process-local.** The initiate/callback session map lives in memory, so both calls must reach the same process, and a restart drops in-flight authorizations.
452
+
377
453
  ## Usage Examples
378
454
 
379
455
  ### Executing an Action via the Engine
@@ -17,6 +17,14 @@ export declare abstract class BaseFindActionsAction extends BaseAction {
17
17
  protected get entityName(): string;
18
18
  /** Verb used in error messages (e.g. "find best action"). */
19
19
  protected abstract get actionLabel(): string;
20
+ /**
21
+ * The action's parameters minus any the calling agent run binds (`Context.BoundActionParams`): keys are
22
+ * Action IDs compared as UUIDs, names compare case-insensitively. The same rule `@memberjunction/ai-agents`
23
+ * applies to its catalog, `UnboundParams(params, BindingsForAction(bound, actionID))` in
24
+ * `packages/AI/Agents/src/bound-action-params.ts`; it is kept inline so this action module does not load the agent
25
+ * runtime. `__tests__/bound-params-parity.test.ts` runs both on the same inputs: change them together.
26
+ */
27
+ private visibleParams;
20
28
  protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
21
29
  }
22
30
  //# sourceMappingURL=base-find-actions.action.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-find-actions.action.d.ts","sourceRoot":"","sources":["../../../src/custom/ai/base-find-actions.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAMrD;;;;;;;;;;;GAWG;AACH,8BAAsB,qBAAsB,SAAQ,UAAU;IAC1D,sCAAsC;IACtC,SAAS,KAAK,UAAU,IAAI,MAAM,CAA0B;IAC5D,6DAA6D;IAC7D,SAAS,CAAC,QAAQ,KAAK,WAAW,IAAI,MAAM,CAAC;cAE7B,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;CA2G1F"}
1
+ {"version":3,"file":"base-find-actions.action.d.ts","sourceRoot":"","sources":["../../../src/custom/ai/base-find-actions.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAGnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAMrD;;;;;;;;;;;GAWG;AACH,8BAAsB,qBAAsB,SAAQ,UAAU;IAC1D,sCAAsC;IACtC,SAAS,KAAK,UAAU,IAAI,MAAM,CAA0B;IAC5D,6DAA6D;IAC7D,SAAS,CAAC,QAAQ,KAAK,WAAW,IAAI,MAAM,CAAC;IAE7C;;;;;;OAMG;IACH,OAAO,CAAC,aAAa;cAML,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;CA+G1F"}
@@ -1,4 +1,4 @@
1
- import { NormalizeUUID } from "@memberjunction/global";
1
+ import { NormalizeUUID, UUIDsEqual } from "@memberjunction/global";
2
2
  import { BaseAction } from "@memberjunction/actions";
3
3
  import { AIEngine } from "@memberjunction/aiengine";
4
4
  import { RunView } from "@memberjunction/core";
@@ -18,6 +18,18 @@ import { RunSemanticEntitySearch, GetActionParamValue, GetActionBooleanParam } f
18
18
  export class BaseFindActionsAction extends BaseAction {
19
19
  /** Entity searched by this action. */
20
20
  get entityName() { return 'MJ: Actions'; }
21
+ /**
22
+ * The action's parameters minus any the calling agent run binds (`Context.BoundActionParams`): keys are
23
+ * Action IDs compared as UUIDs, names compare case-insensitively. The same rule `@memberjunction/ai-agents`
24
+ * applies to its catalog, `UnboundParams(params, BindingsForAction(bound, actionID))` in
25
+ * `packages/AI/Agents/src/bound-action-params.ts`; it is kept inline so this action module does not load the agent
26
+ * runtime. `__tests__/bound-params-parity.test.ts` runs both on the same inputs: change them together.
27
+ */
28
+ visibleParams(definitions, bound, actionID) {
29
+ const key = bound ? Object.keys(bound).find(id => UUIDsEqual(id, actionID)) : undefined;
30
+ const hidden = bound && key ? Object.keys(bound[key]).map(n => n.trim().toLowerCase()) : [];
31
+ return hidden.length === 0 ? definitions : definitions.filter(p => !hidden.includes((p.Name ?? '').trim().toLowerCase()));
32
+ }
21
33
  async InternalRunAction(params) {
22
34
  try {
23
35
  const taskDescription = GetActionParamValue(params, 'taskdescription');
@@ -78,6 +90,10 @@ export class BaseFindActionsAction extends BaseAction {
78
90
  paramsByActionId.set(param.ActionID, list);
79
91
  }
80
92
  }
93
+ // A parameter the calling agent run binds (ExecuteAgentParams.boundActionParams, stamped on the
94
+ // action Context as BoundActionParams) is left out, exactly as the agent's own catalog leaves it out:
95
+ // this action is where a model is sent to learn an action's parameters, so it must hide the same names.
96
+ const bound = params.Context?.BoundActionParams;
81
97
  const actionsWithParams = matched.map(m => ({
82
98
  actionId: m.action.ID,
83
99
  actionName: m.action.Name,
@@ -86,7 +102,7 @@ export class BaseFindActionsAction extends BaseAction {
86
102
  categoryName: m.action.Category,
87
103
  status: m.action.Status,
88
104
  driverClass: m.action.DriverClass,
89
- parameters: (paramsByActionId.get(m.action.ID) || []).map(p => ({
105
+ parameters: this.visibleParams(paramsByActionId.get(m.action.ID) || [], bound, m.action.ID).map(p => ({
90
106
  name: p.Name,
91
107
  type: p.Type,
92
108
  valueType: p.ValueType,
@@ -1 +1 @@
1
- {"version":3,"file":"base-find-actions.action.js","sourceRoot":"","sources":["../../../src/custom/ai/base-find-actions.action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAEtH;;;;;;;;;;;GAWG;AACH,MAAM,OAAgB,qBAAsB,SAAQ,UAAU;IAC1D,sCAAsC;IACtC,IAAc,UAAU,KAAa,OAAO,aAAa,CAAC,CAAC,CAAC;IAIlD,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QACrD,IAAI,CAAC;YACD,MAAM,eAAe,GAAG,mBAAmB,CAAC,MAAM,EAAE,iBAAiB,CAAuB,CAAC;YAC7F,MAAM,UAAU,GAAG,QAAQ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AAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC,CAAC;YACzF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,iBAAiB,CAAC,MAAM,EAAE,CAAC,CAAC;YAE5F,MAAM,YAAY,GAAG;gBACjB,OAAO,EAAE,SAAS,iBAAiB,CAAC,MAAM,qBAAqB;gBAC/D,eAAe;gBACf,UAAU,EAAE,iBAAiB,CAAC,MAAM;gBACpC,UAAU,EAAE,iBAAiB;aAChC,CAAC;YAEF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;QACpG,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO;gBACH,OAAO,EAAE,KAAK;gBACd,UAAU,EAAE,iBAAiB;gBAC7B,OAAO,EAAE,aAAa,IAAI,CAAC,WAAW,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;aACtG,CAAC;QACN,CAAC;IACL,CAAC;CACJ"}
@@ -0,0 +1,228 @@
1
+ /**
2
+ * @fileoverview Posture 3 Per-User OAuth 2.0 (`3LO`) Service & Route Handlers for Enterprise
3
+ * Communication Providers (Microsoft Graph & Google Workspace).
4
+ *
5
+ * Implements Stage 8, Deliverable 4 of the Chief of Staff architecture:
6
+ * - **PKCE (`S256`) Authorization Flow (`/api/v1/communication-oauth/initiate`)**
7
+ * - **OAuth 2.0 Callback & Token Exchange (`/api/v1/communication-oauth/callback`)**
8
+ * - **Four Mandatory Enterprise Security Gates**:
9
+ * 1. `AllowUserDelegatedOAuth === true` (admin opt-in gate)
10
+ * 2. `AllowedEmailDomains` match on both `contextUser.Email` and the authenticated OAuth identity
11
+ * 3. `AllowedOAuthTenantIDs` match on the token's tenant/workspace claim (`tid` / `hd`)
12
+ * 4. Strict Principal Match (`tokenProfile.email === contextUser.Email`, case-insensitive) — blocks
13
+ * a user from linking a personal `@gmail.com` or another employee's mailbox to their corporate MJ identity
14
+ * - **Per-User `OwnerUserID` Isolation in `CredentialEngine`** — credentials are stored through
15
+ * `CredentialEngine.Instance` (`@memberjunction/credentials`) unless a caller injects another
16
+ * `IUserDelegatedCredentialStore`
17
+ * - **Gates 1–3 are administrator settings on `MJ: Communication Providers`** (`AllowUserDelegatedOAuth`,
18
+ * `AllowedEmailDomains`, `AllowedOAuthTenantIDs`); `ReadProviderUserOAuthGates` lifts them off the row
19
+ * - **One-Click Disconnect & Token Revocation**
20
+ *
21
+ * @module @memberjunction/core-actions
22
+ */
23
+ import { UserInfo } from '@memberjunction/core';
24
+ import { BaseSingleton } from '@memberjunction/global';
25
+ import { MJCommunicationProviderEntity, MJCredentialEntity } from '@memberjunction/core-entities';
26
+ /**
27
+ * Values stored in a per-user delegated OAuth 2.0 (`3LO`) credential.
28
+ */
29
+ export interface UserDelegatedOAuthStoredValues {
30
+ [key: string]: string;
31
+ ownerUserId: string;
32
+ principalEmail: string;
33
+ providerName: string;
34
+ accessToken: string;
35
+ refreshToken: string;
36
+ tokenType: string;
37
+ scope: string;
38
+ tenantId: string;
39
+ issuedAt: string;
40
+ }
41
+ /**
42
+ * Options for storing a per-user delegated OAuth 2.0 (`3LO`) credential.
43
+ */
44
+ export interface StoreUserDelegatedOAuthInput {
45
+ providerName: string;
46
+ ownerUserId: string;
47
+ principalEmail: string;
48
+ accessToken: string;
49
+ refreshToken?: string;
50
+ tokenType?: string;
51
+ scope?: string;
52
+ tenantId?: string;
53
+ expiresAt?: Date;
54
+ }
55
+ /**
56
+ * Structural interface satisfied by `CredentialEngine.Instance` in `@memberjunction/credentials`.
57
+ */
58
+ export interface IUserDelegatedCredentialStore {
59
+ StoreUserDelegatedCredential(options: StoreUserDelegatedOAuthInput, contextUser: UserInfo): Promise<Pick<MJCredentialEntity, 'ID'>>;
60
+ GetUserDelegatedCredential(providerName: string, contextUser: UserInfo): Promise<{
61
+ values: UserDelegatedOAuthStoredValues;
62
+ } | null>;
63
+ RevokeUserDelegatedCredential(providerName: string, contextUser: UserInfo): Promise<boolean>;
64
+ }
65
+ /**
66
+ * Admin-configured Posture 3 OAuth 2.0 (`3LO`) policy for a communication provider.
67
+ */
68
+ export interface ProviderUserOAuthPolicyConfig {
69
+ ProviderName: 'Microsoft Graph' | 'Gmail' | string;
70
+ /** Gate 1: Admin must explicitly enable Posture 3 per-user delegated OAuth. */
71
+ AllowUserDelegatedOAuth: boolean;
72
+ /** Gate 2: Optional comma-separated list of permitted corporate email domains (e.g., "company.com,sub.company.com"). */
73
+ AllowedEmailDomains?: string | null;
74
+ /** Gate 3: Optional list of permitted Azure AD Tenant IDs (`tid`) or Google Workspace hosted domains (`hd`). */
75
+ AllowedOAuthTenantIDs?: string[] | null;
76
+ ClientId: string;
77
+ ClientSecret?: string;
78
+ AuthorizationEndpoint: string;
79
+ TokenEndpoint: string;
80
+ RevocationEndpoint?: string;
81
+ RedirectUri: string;
82
+ Scopes: string[];
83
+ }
84
+ /** The administrator-controlled gate fields of `ProviderUserOAuthPolicyConfig`, as stored on `MJ: Communication Providers`. */
85
+ export type ProviderUserOAuthGates = Pick<ProviderUserOAuthPolicyConfig, 'ProviderName' | 'AllowUserDelegatedOAuth' | 'AllowedEmailDomains' | 'AllowedOAuthTenantIDs'>;
86
+ /**
87
+ * Lift Gates 1–3 off a `MJ: Communication Providers` row. `AllowedOAuthTenantIDs` is stored comma-separated
88
+ * and returned as a trimmed list, or null when the column is empty (no tenant restriction).
89
+ * The caller merges the result with the OAuth client settings (endpoints, client id, scopes) to form the
90
+ * full `ProviderUserOAuthPolicyConfig`.
91
+ */
92
+ export declare function ReadProviderUserOAuthGates(provider: MJCommunicationProviderEntity): ProviderUserOAuthGates;
93
+ /**
94
+ * Ephemeral PKCE (`S256`) authorization session created by `/api/v1/communication-oauth/initiate`.
95
+ */
96
+ export interface PendingOAuthAuthorizationSession {
97
+ State: string;
98
+ CodeVerifier: string;
99
+ CodeChallenge: string;
100
+ CodeChallengeMethod: 'S256';
101
+ UserID: string;
102
+ UserEmail: string;
103
+ ProviderName: string;
104
+ RedirectUri: string;
105
+ CreatedAtMs: number;
106
+ ExpiresAtMs: number;
107
+ }
108
+ /**
109
+ * Verified identity and token payload returned by the OAuth provider's token & userinfo/id_token exchange.
110
+ */
111
+ export interface VerifiedOAuthTokenExchangeResult {
112
+ AccessToken: string;
113
+ RefreshToken?: string;
114
+ TokenType?: string;
115
+ Scope?: string;
116
+ ExpiresInSeconds?: number;
117
+ /** Verified email address of the authenticated OAuth principal (from `id_token` or `/me` / `/userinfo`). */
118
+ PrincipalEmail: string;
119
+ /** Verified Azure AD `tid` or Google Workspace `hd` tenant identifier. */
120
+ TenantID?: string | null;
121
+ }
122
+ /**
123
+ * Injectable token exchange & revocation transport seam (defaults to `fetch` against Microsoft/Google endpoints).
124
+ */
125
+ export interface IOAuthTokenTransport {
126
+ ExchangeAuthorizationCode(params: {
127
+ policy: ProviderUserOAuthPolicyConfig;
128
+ code: string;
129
+ codeVerifier: string;
130
+ redirectUri: string;
131
+ }): Promise<VerifiedOAuthTokenExchangeResult>;
132
+ RevokeToken?(params: {
133
+ policy: ProviderUserOAuthPolicyConfig;
134
+ token: string;
135
+ }): Promise<boolean>;
136
+ }
137
+ /**
138
+ * Result codes returned by `CommunicationUserOAuthService`.
139
+ */
140
+ export type CommunicationOAuthResultCode = 'AUTHORIZATION_INITIATED' | 'OAUTH_CONNECTED' | 'OAUTH_DISCONNECTED' | 'GATE_1_USER_OAUTH_DISABLED' | 'GATE_2_DOMAIN_MISMATCH' | 'GATE_3_TENANT_MISMATCH' | 'GATE_4_PRINCIPAL_EMAIL_MISMATCH' | 'INVALID_OR_EXPIRED_STATE' | 'STATE_USER_MISMATCH' | 'TOKEN_EXCHANGE_FAILED';
141
+ /**
142
+ * Outcome of `/api/v1/communication-oauth/initiate`.
143
+ */
144
+ export interface OAuthInitiateResult {
145
+ Success: boolean;
146
+ ResultCode: CommunicationOAuthResultCode;
147
+ Message: string;
148
+ AuthorizationUrl: string | null;
149
+ State: string | null;
150
+ CodeChallenge: string | null;
151
+ CodeChallengeMethod: 'S256' | null;
152
+ }
153
+ /**
154
+ * Outcome of `/api/v1/communication-oauth/callback`.
155
+ */
156
+ export interface OAuthCallbackResult {
157
+ Success: boolean;
158
+ ResultCode: CommunicationOAuthResultCode;
159
+ Message: string;
160
+ CredentialID: string | null;
161
+ ProviderName: string | null;
162
+ OwnerUserID: string | null;
163
+ PrincipalEmail: string | null;
164
+ }
165
+ /**
166
+ * Outcome of disconnecting & revoking a user's 3LO OAuth credential.
167
+ */
168
+ export interface OAuthDisconnectResult {
169
+ Success: boolean;
170
+ ResultCode: CommunicationOAuthResultCode;
171
+ Message: string;
172
+ RevokedAtProvider: boolean;
173
+ CredentialDeactivated: boolean;
174
+ }
175
+ /**
176
+ * Service implementing Posture 3 Per-User OAuth 2.0 (`3LO`) with PKCE (`S256`),
177
+ * the 4 mandatory enterprise security gates, `OwnerUserID` credential isolation,
178
+ * and one-click token revocation.
179
+ */
180
+ export declare class CommunicationUserOAuthService extends BaseSingleton<CommunicationUserOAuthService> {
181
+ private readonly pendingSessions;
182
+ constructor();
183
+ static get Instance(): CommunicationUserOAuthService;
184
+ /**
185
+ * Generates a RFC 7636 PKCE (`S256`) `code_verifier` and `code_challenge` pair.
186
+ */
187
+ GeneratePkcePair(): {
188
+ codeVerifier: string;
189
+ codeChallenge: string;
190
+ codeChallengeMethod: 'S256';
191
+ };
192
+ /**
193
+ * Initiates a Posture 3 OAuth 2.0 (`3LO`) authorization flow (`/api/v1/communication-oauth/initiate`).
194
+ * Enforces Gate 1 (`AllowUserDelegatedOAuth === true`) and Gate 2 (`AllowedEmailDomains` on `contextUser.Email`)
195
+ * before issuing a PKCE (`S256`) authorization URL.
196
+ */
197
+ InitiateAuthorizationFlow(policy: ProviderUserOAuthPolicyConfig, contextUser: UserInfo, nowMs?: number): OAuthInitiateResult;
198
+ /**
199
+ * Completes the Posture 3 OAuth 2.0 (`3LO`) callback (`/api/v1/communication-oauth/callback`),
200
+ * enforcing all 4 security gates before persisting the user-isolated credential in `CredentialEngine`.
201
+ */
202
+ HandleOAuthCallback(params: {
203
+ state: string;
204
+ code: string;
205
+ policy: ProviderUserOAuthPolicyConfig;
206
+ contextUser: UserInfo;
207
+ transport: IOAuthTokenTransport;
208
+ /** Defaults to `CredentialEngine.Instance`. */
209
+ credentialStore?: IUserDelegatedCredentialStore;
210
+ nowMs?: number;
211
+ }): Promise<OAuthCallbackResult>;
212
+ /**
213
+ * One-click Disconnect & Revoke flow: revokes the user's OAuth token with the upstream provider
214
+ * (when `RevokeToken` is supported) and deactivates/wipes the user's isolated credential in `CredentialEngine`.
215
+ */
216
+ DisconnectAndRevokeUserOAuth(params: {
217
+ policy: ProviderUserOAuthPolicyConfig;
218
+ contextUser: UserInfo;
219
+ transport?: IOAuthTokenTransport;
220
+ /** Defaults to `CredentialEngine.Instance`. */
221
+ credentialStore?: IUserDelegatedCredentialStore;
222
+ }): Promise<OAuthDisconnectResult>;
223
+ /** `CredentialEngine` owns delegated-credential naming, owner binding, encryption and audit; it is the default store. */
224
+ private resolveCredentialStore;
225
+ /** Clear pending in-memory authorization sessions (for unit testing). */
226
+ ClearPendingSessions(): void;
227
+ }
228
+ //# sourceMappingURL=communication-oauth-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"communication-oauth-service.d.ts","sourceRoot":"","sources":["../../../src/custom/ai/communication-oauth-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,aAAa,EAA6B,MAAM,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