@memberjunction/core-entities-server 6.3.0-edge.2 → 6.3.0-edge.3
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 +13 -0
- package/dist/custom/ArtifactSecurityHookHelpers.d.ts.map +1 -1
- package/dist/custom/ArtifactSecurityHookHelpers.js +50 -0
- package/dist/custom/ArtifactSecurityHookHelpers.js.map +1 -1
- package/dist/custom/GraphConceptReadSecurityHook.d.ts +75 -0
- package/dist/custom/GraphConceptReadSecurityHook.d.ts.map +1 -0
- package/dist/custom/GraphConceptReadSecurityHook.js +574 -0
- package/dist/custom/GraphConceptReadSecurityHook.js.map +1 -0
- package/dist/custom/GraphRecordChangesReadSecurityHook.d.ts +45 -0
- package/dist/custom/GraphRecordChangesReadSecurityHook.d.ts.map +1 -0
- package/dist/custom/GraphRecordChangesReadSecurityHook.js +744 -0
- package/dist/custom/GraphRecordChangesReadSecurityHook.js.map +1 -0
- package/dist/custom/MJAIAgentActionEntityServer.server.d.ts +13 -0
- package/dist/custom/MJAIAgentActionEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentActionEntityServer.server.js +52 -0
- package/dist/custom/MJAIAgentActionEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIAgentCategoryEntityServer.server.d.ts +30 -0
- package/dist/custom/MJAIAgentCategoryEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentCategoryEntityServer.server.js +127 -0
- package/dist/custom/MJAIAgentCategoryEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIAgentClientToolEntityServer.server.d.ts +12 -0
- package/dist/custom/MJAIAgentClientToolEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentClientToolEntityServer.server.js +46 -0
- package/dist/custom/MJAIAgentClientToolEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIAgentEntityServer.server.d.ts +113 -7
- package/dist/custom/MJAIAgentEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIAgentEntityServer.server.js +1946 -96
- package/dist/custom/MJAIAgentEntityServer.server.js.map +1 -1
- package/dist/custom/MJAIAgentModalityEntityServer.server.d.ts +13 -0
- package/dist/custom/MJAIAgentModalityEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentModalityEntityServer.server.js +52 -0
- package/dist/custom/MJAIAgentModalityEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIAgentNoteEntityServer.server.d.ts +64 -8
- package/dist/custom/MJAIAgentNoteEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIAgentNoteEntityServer.server.js +263 -9
- package/dist/custom/MJAIAgentNoteEntityServer.server.js.map +1 -1
- package/dist/custom/MJAIAgentPersonaEntityServer.server.d.ts +2 -2
- package/dist/custom/MJAIAgentPersonaEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIAgentPersonaEntityServer.server.js +10 -8
- package/dist/custom/MJAIAgentPersonaEntityServer.server.js.map +1 -1
- package/dist/custom/MJAIAgentRelationshipEntityServer.server.d.ts +5 -2
- package/dist/custom/MJAIAgentRelationshipEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIAgentRelationshipEntityServer.server.js +25 -2
- package/dist/custom/MJAIAgentRelationshipEntityServer.server.js.map +1 -1
- package/dist/custom/MJAIAgentSkillEntityServer.server.d.ts +12 -0
- package/dist/custom/MJAIAgentSkillEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentSkillEntityServer.server.js +46 -0
- package/dist/custom/MJAIAgentSkillEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIAgentStepTypeEntityServer.server.d.ts +28 -0
- package/dist/custom/MJAIAgentStepTypeEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentStepTypeEntityServer.server.js +117 -0
- package/dist/custom/MJAIAgentStepTypeEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIAgentTypeEntityServer.server.d.ts +34 -0
- package/dist/custom/MJAIAgentTypeEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentTypeEntityServer.server.js +231 -0
- package/dist/custom/MJAIAgentTypeEntityServer.server.js.map +1 -0
- package/dist/custom/MJActionEntityServer.server.d.ts +37 -0
- package/dist/custom/MJActionEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJActionEntityServer.server.js +208 -3
- package/dist/custom/MJActionEntityServer.server.js.map +1 -1
- package/dist/custom/MJComponentEntityServer.server.d.ts +6 -0
- package/dist/custom/MJComponentEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJComponentEntityServer.server.js +20 -2
- package/dist/custom/MJComponentEntityServer.server.js.map +1 -1
- package/dist/custom/MJContentSourceEntityServer.server.d.ts +28 -0
- package/dist/custom/MJContentSourceEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJContentSourceEntityServer.server.js +73 -0
- package/dist/custom/MJContentSourceEntityServer.server.js.map +1 -0
- package/dist/custom/MJContentSourceTypeEntityServer.server.d.ts +25 -0
- package/dist/custom/MJContentSourceTypeEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJContentSourceTypeEntityServer.server.js +73 -0
- package/dist/custom/MJContentSourceTypeEntityServer.server.js.map +1 -0
- package/dist/custom/MJDashboardEntityServer.server.d.ts +6 -0
- package/dist/custom/MJDashboardEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJDashboardEntityServer.server.js +24 -2
- package/dist/custom/MJDashboardEntityServer.server.js.map +1 -1
- package/dist/custom/MJGraphConceptEntityServer.server.d.ts +175 -23
- package/dist/custom/MJGraphConceptEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJGraphConceptEntityServer.server.js +584 -41
- package/dist/custom/MJGraphConceptEntityServer.server.js.map +1 -1
- package/dist/custom/MJGraphEdgeEntityServer.server.d.ts +38 -11
- package/dist/custom/MJGraphEdgeEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJGraphEdgeEntityServer.server.js +249 -39
- package/dist/custom/MJGraphEdgeEntityServer.server.js.map +1 -1
- package/dist/custom/MJGraphEntityServer.server.d.ts +58 -0
- package/dist/custom/MJGraphEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJGraphEntityServer.server.js +357 -0
- package/dist/custom/MJGraphEntityServer.server.js.map +1 -0
- package/dist/custom/MJGraphLinkEntityServer.server.d.ts +98 -0
- package/dist/custom/MJGraphLinkEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJGraphLinkEntityServer.server.js +375 -0
- package/dist/custom/MJGraphLinkEntityServer.server.js.map +1 -0
- package/dist/custom/MJGraphPermissionEntityServer.server.d.ts +29 -0
- package/dist/custom/MJGraphPermissionEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJGraphPermissionEntityServer.server.js +141 -0
- package/dist/custom/MJGraphPermissionEntityServer.server.js.map +1 -0
- package/dist/custom/MJListDetailEntityServer.server.d.ts +4 -4
- package/dist/custom/MJListDetailEntityServer.server.js +4 -4
- package/dist/custom/MJListEntityServer.server.d.ts +2 -1
- package/dist/custom/MJListEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJListEntityServer.server.js +5 -2
- package/dist/custom/MJListEntityServer.server.js.map +1 -1
- package/dist/custom/MJQueryEntityServer.server.d.ts +51 -3
- package/dist/custom/MJQueryEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJQueryEntityServer.server.js +142 -28
- package/dist/custom/MJQueryEntityServer.server.js.map +1 -1
- package/dist/custom/MJQueryParameterEntityServer.server.d.ts +37 -0
- package/dist/custom/MJQueryParameterEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJQueryParameterEntityServer.server.js +160 -0
- package/dist/custom/MJQueryParameterEntityServer.server.js.map +1 -0
- package/dist/custom/MJQuerySQLEntityServer.server.d.ts +23 -0
- package/dist/custom/MJQuerySQLEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJQuerySQLEntityServer.server.js +106 -9
- package/dist/custom/MJQuerySQLEntityServer.server.js.map +1 -1
- package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.d.ts +1 -1
- package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.js +8 -5
- package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.js.map +1 -1
- package/dist/custom/MJUserRoleEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJUserRoleEntityServer.server.js +9 -0
- package/dist/custom/MJUserRoleEntityServer.server.js.map +1 -1
- package/dist/custom/MJUserViewEntityServer.server.d.ts +9 -0
- package/dist/custom/MJUserViewEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJUserViewEntityServer.server.js +59 -3
- package/dist/custom/MJUserViewEntityServer.server.js.map +1 -1
- package/dist/custom/agentRelationalGrantGuard.d.ts +73 -0
- package/dist/custom/agentRelationalGrantGuard.d.ts.map +1 -0
- package/dist/custom/agentRelationalGrantGuard.js +375 -0
- package/dist/custom/agentRelationalGrantGuard.js.map +1 -0
- package/dist/custom/approvalStamp.d.ts +68 -4
- package/dist/custom/approvalStamp.d.ts.map +1 -1
- package/dist/custom/approvalStamp.js +107 -13
- package/dist/custom/approvalStamp.js.map +1 -1
- package/dist/custom/canon/CanonFingerprintRecorderServer.d.ts +20 -0
- package/dist/custom/canon/CanonFingerprintRecorderServer.d.ts.map +1 -0
- package/dist/custom/canon/CanonFingerprintRecorderServer.js +148 -0
- package/dist/custom/canon/CanonFingerprintRecorderServer.js.map +1 -0
- package/dist/custom/canon/index.d.ts +2 -0
- package/dist/custom/canon/index.d.ts.map +1 -0
- package/dist/custom/canon/index.js +2 -0
- package/dist/custom/canon/index.js.map +1 -0
- package/dist/custom/graph/GraphFindPathServerOperation.d.ts +7 -5
- package/dist/custom/graph/GraphFindPathServerOperation.d.ts.map +1 -1
- package/dist/custom/graph/GraphFindPathServerOperation.js +41 -12
- package/dist/custom/graph/GraphFindPathServerOperation.js.map +1 -1
- package/dist/custom/graphPermissionGuard.d.ts +69 -0
- package/dist/custom/graphPermissionGuard.d.ts.map +1 -0
- package/dist/custom/graphPermissionGuard.js +229 -0
- package/dist/custom/graphPermissionGuard.js.map +1 -0
- package/dist/custom/graphRlsCacheInvalidation.d.ts +38 -0
- package/dist/custom/graphRlsCacheInvalidation.d.ts.map +1 -0
- package/dist/custom/graphRlsCacheInvalidation.js +111 -0
- package/dist/custom/graphRlsCacheInvalidation.js.map +1 -0
- package/dist/custom/queryParentFingerprint.d.ts +36 -0
- package/dist/custom/queryParentFingerprint.d.ts.map +1 -0
- package/dist/custom/queryParentFingerprint.js +159 -0
- package/dist/custom/queryParentFingerprint.js.map +1 -0
- package/dist/custom/queryParentSaveChain.d.ts +5 -0
- package/dist/custom/queryParentSaveChain.d.ts.map +1 -0
- package/dist/custom/queryParentSaveChain.js +25 -0
- package/dist/custom/queryParentSaveChain.js.map +1 -0
- package/dist/custom/seededMetadataPush.d.ts +7 -0
- package/dist/custom/seededMetadataPush.d.ts.map +1 -0
- package/dist/custom/seededMetadataPush.js +23 -0
- package/dist/custom/seededMetadataPush.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +31 -31
|
@@ -5,23 +5,84 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { RegisterClass } from "@memberjunction/global";
|
|
8
|
-
import { BaseEntity, LogError } from "@memberjunction/core";
|
|
9
|
-
import {
|
|
8
|
+
import { BaseEntity, BaseEntityResult, LogError, ServerOperationScopeManager, ValidationErrorInfo, ValidationErrorType, } from "@memberjunction/core";
|
|
9
|
+
import { AI_AGENT_NOTE_CANON_PROMOTION_OPERATION, IsInjectableNoteStatus, MJAIAgentNoteEntity, } from "@memberjunction/core-entities";
|
|
10
10
|
import { EmbedTextLocalHelper, IsLocalEmbeddingStaleHelper } from "./util.js";
|
|
11
11
|
import { AIEngine } from "@memberjunction/aiengine";
|
|
12
|
+
import { IsSetByTransactionVariable } from "./anonymousOwnershipKeyGuard.js";
|
|
13
|
+
const AI_AGENT_NOTES_ENTITY_NAME = 'MJ: AI Agent Notes';
|
|
14
|
+
/**
|
|
15
|
+
* Governed Canon authority columns on `MJ: AI Agent Notes` (D54).
|
|
16
|
+
* Prior to Wave 5's promotion path, `IsCanonical` transitions are permitted ONLY inside
|
|
17
|
+
* {@link AI_AGENT_NOTE_CANON_PROMOTION_OPERATION}, and `CanonApprovedByUserID` / `CanonApprovedAt`
|
|
18
|
+
* are maintained exclusively by the server.
|
|
19
|
+
*/
|
|
20
|
+
export const AGENT_NOTE_CANON_GOVERNED_FIELDS = ['IsCanonical', 'CanonApprovedByUserID', 'CanonApprovedAt'];
|
|
21
|
+
/**
|
|
22
|
+
* Server-stamped approval columns on `MJ: AI Agent Notes`; refused whenever supplied or modified
|
|
23
|
+
* by a caller, even inside a server promotion scope.
|
|
24
|
+
*/
|
|
25
|
+
export const AGENT_NOTE_CANON_STAMP_FIELDS = ['CanonApprovedByUserID', 'CanonApprovedAt'];
|
|
26
|
+
/**
|
|
27
|
+
* Material content and scope fields on `MJ: AI Agent Notes` (Finding 58).
|
|
28
|
+
* Editing any of these fields on an already-approved canonical note invalidates its approval by
|
|
29
|
+
* clearing `CanonApprovedByUserID` and `CanonApprovedAt`, so `AIAgentNoteCanonMemberAdapter`
|
|
30
|
+
* demotes it to `'Proposed'` until re-approved.
|
|
31
|
+
*/
|
|
32
|
+
export const AGENT_NOTE_CANON_MATERIAL_FIELDS = [
|
|
33
|
+
'Note',
|
|
34
|
+
'Type',
|
|
35
|
+
'AgentID',
|
|
36
|
+
'UserID',
|
|
37
|
+
'CompanyID',
|
|
38
|
+
'PrimaryScopeEntityID',
|
|
39
|
+
'PrimaryScopeRecordID',
|
|
40
|
+
'SecondaryScopes',
|
|
41
|
+
];
|
|
42
|
+
function dateToMillis(value) {
|
|
43
|
+
if (value instanceof Date) {
|
|
44
|
+
return Number.isNaN(value.getTime()) ? null : value.getTime();
|
|
45
|
+
}
|
|
46
|
+
if (typeof value === 'string' && value.trim().length > 0) {
|
|
47
|
+
const parsed = Date.parse(value);
|
|
48
|
+
return Number.isNaN(parsed) ? null : parsed;
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* True while the current async call chain is inside {@link AI_AGENT_NOTE_CANON_PROMOTION_OPERATION}
|
|
54
|
+
* scoped to `'MJ: AI Agent Notes'` for `user`. Client CRUD boundaries mask every outer scope.
|
|
55
|
+
*/
|
|
56
|
+
export function IsInAgentNoteCanonPromotionScope(user) {
|
|
57
|
+
if (!user) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
return ServerOperationScopeManager.Instance.IsOperationActive([AI_AGENT_NOTE_CANON_PROMOTION_OPERATION], AI_AGENT_NOTES_ENTITY_NAME, user);
|
|
61
|
+
}
|
|
12
62
|
/**
|
|
13
63
|
* Server-side extension of MJAIAgentNoteEntity that:
|
|
14
|
-
* 1.
|
|
15
|
-
*
|
|
64
|
+
* 1. Enforces D54 server-only governance on `IsCanonical`,
|
|
65
|
+
* `CanonApprovedByUserID`, and `CanonApprovedAt` and Finding 58 material-field invalidation:
|
|
66
|
+
* clients may never set or modify the governed Canon fields; `IsCanonical` transitions are
|
|
67
|
+
* allowed only inside {@link AI_AGENT_NOTE_CANON_PROMOTION_OPERATION}; the server stamps
|
|
68
|
+
* `CanonApprovedByUserID` / `CanonApprovedAt` on promotion and clears them on demotion,
|
|
69
|
+
* when `Status` leaves `'Active'`, or when any material field (`Note`, `Type`, `AgentID`,
|
|
70
|
+
* `UserID`, `CompanyID`, `PrimaryScopeEntityID`, `PrimaryScopeRecordID`, `SecondaryScopes`)
|
|
71
|
+
* is edited on an approved canonical note.
|
|
72
|
+
* 2. Auto-generates an embedding when the Note field is new or dirty.
|
|
73
|
+
* 3. Keeps `AIEngine._noteVectorService` in sync with the note's persisted Status.
|
|
16
74
|
* Invariant: the vector service contains an entry for a note iff its current Status
|
|
17
75
|
* is injectable ('Active' or 'Provisional' — see INJECTABLE_NOTE_STATUSES in
|
|
18
|
-
* @memberjunction/core-entities) AND it has a non-empty EmbeddingVector.
|
|
19
|
-
* write-side invariant lets the retrieval filters (`composeNoteFilters`) be pure
|
|
20
|
-
* scope filters — they don't need to consult any additional cache to decide
|
|
21
|
-
* whether a vector hit is still valid. Provisional notes (written in-flight by
|
|
22
|
-
* agents) are deliberately injectable immediately, pending Memory Manager hardening.
|
|
76
|
+
* @memberjunction/core-entities) AND it has a non-empty EmbeddingVector.
|
|
23
77
|
*/
|
|
24
78
|
let MJAIAgentNoteEntityServer = class MJAIAgentNoteEntityServer extends MJAIAgentNoteEntity {
|
|
79
|
+
constructor() {
|
|
80
|
+
super(...arguments);
|
|
81
|
+
this._serverStampedCanon = null;
|
|
82
|
+
}
|
|
83
|
+
get DefaultSkipAsyncValidation() {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
25
86
|
/**
|
|
26
87
|
* Override EmbedTextLocal to use helper
|
|
27
88
|
*/
|
|
@@ -32,8 +93,31 @@ let MJAIAgentNoteEntityServer = class MJAIAgentNoteEntityServer extends MJAIAgen
|
|
|
32
93
|
async IsEmbeddingStale(embeddingModelID) {
|
|
33
94
|
return IsLocalEmbeddingStaleHelper(this, embeddingModelID);
|
|
34
95
|
}
|
|
96
|
+
async ValidateAsync() {
|
|
97
|
+
const result = await super.ValidateAsync();
|
|
98
|
+
if (!result.Success) {
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
const canonError = this.evaluateCanonGovernanceError();
|
|
102
|
+
if (canonError) {
|
|
103
|
+
result.Errors.push(canonError);
|
|
104
|
+
result.Success = false;
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
this.applyServerCanonStamp();
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
35
110
|
async Save(options) {
|
|
36
111
|
try {
|
|
112
|
+
// 0. Enforce governed Canon field rules even when ReplayOnly or SkipAsyncValidation
|
|
113
|
+
// would bypass ValidateAsync (matching MJGraphConceptEntityServer D42 pattern).
|
|
114
|
+
if (options?.ReplayOnly || options?.SkipAsyncValidation) {
|
|
115
|
+
const canonError = this.evaluateCanonGovernanceError();
|
|
116
|
+
if (canonError) {
|
|
117
|
+
return this.refuseOperation(this.IsSaved ? 'update' : 'create', canonError.Message);
|
|
118
|
+
}
|
|
119
|
+
this.applyServerCanonStamp();
|
|
120
|
+
}
|
|
37
121
|
// 1. Generate/refresh the embedding. GenerateEmbedding skips it unless the Note is new or
|
|
38
122
|
// dirty, or its stored vector is from another model (IsEmbeddingStale).
|
|
39
123
|
if (this.Note && this.Note.trim().length > 0) {
|
|
@@ -49,6 +133,7 @@ let MJAIAgentNoteEntityServer = class MJAIAgentNoteEntityServer extends MJAIAgen
|
|
|
49
133
|
const saved = await super.Save(options);
|
|
50
134
|
if (!saved)
|
|
51
135
|
return false;
|
|
136
|
+
this._serverStampedCanon = null;
|
|
52
137
|
// 3. Sync the in-memory vector service with the just-persisted Status.
|
|
53
138
|
// - Injectable (Active/Provisional) + has embedding → (re)insert so retrieval can find it.
|
|
54
139
|
// - Anything else (Revoked/Archived/Pending, or cleared embedding) → drop the vector
|
|
@@ -81,6 +166,175 @@ let MJAIAgentNoteEntityServer = class MJAIAgentNoteEntityServer extends MJAIAgen
|
|
|
81
166
|
}
|
|
82
167
|
return deleted;
|
|
83
168
|
}
|
|
169
|
+
evaluateCanonGovernanceError() {
|
|
170
|
+
if (IsSetByTransactionVariable(this, [...AGENT_NOTE_CANON_GOVERNED_FIELDS])) {
|
|
171
|
+
return new ValidationErrorInfo('IsCanonical', 'IsCanonical, CanonApprovedByUserID, and CanonApprovedAt are server-governed Canon fields and cannot be bound via transaction variables.', this.IsCanonical, ValidationErrorType.Failure);
|
|
172
|
+
}
|
|
173
|
+
const stampError = this.evaluateClientCanonStampError();
|
|
174
|
+
if (stampError) {
|
|
175
|
+
return stampError;
|
|
176
|
+
}
|
|
177
|
+
const isCanonicalChanged = this.isCanonicalMutationRequested();
|
|
178
|
+
if (isCanonicalChanged) {
|
|
179
|
+
if (!IsInAgentNoteCanonPromotionScope(this.ContextCurrentUser)) {
|
|
180
|
+
return new ValidationErrorInfo('IsCanonical', 'Setting or modifying "IsCanonical" on MJ: AI Agent Notes is a server-only Canon governance operation until Wave 5 promotion is enabled, and cannot be set or modified by a client.', this.IsCanonical, ValidationErrorType.Failure);
|
|
181
|
+
}
|
|
182
|
+
if (this.IsCanonical === true && this.Status === 'Active' && !this.ContextCurrentUser?.ID) {
|
|
183
|
+
return new ValidationErrorInfo('IsCanonical', 'Promoting an Active AI Agent Note to Canon requires an authenticated ContextCurrentUser so CanonApprovedByUserID can be stamped.', this.IsCanonical, ValidationErrorType.Failure);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
evaluateClientCanonStampError() {
|
|
189
|
+
if (this.matchesLastServerCanonStamp()) {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
if (!this.IsSaved) {
|
|
193
|
+
if (this.CanonApprovedByUserID != null || this.GetFieldByName('CanonApprovedByUserID')?.Dirty) {
|
|
194
|
+
return this.clientStampError('CanonApprovedByUserID', this.CanonApprovedByUserID);
|
|
195
|
+
}
|
|
196
|
+
if (this.CanonApprovedAt != null || this.GetFieldByName('CanonApprovedAt')?.Dirty) {
|
|
197
|
+
return this.clientStampError('CanonApprovedAt', this.CanonApprovedAt);
|
|
198
|
+
}
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
for (const fieldName of AGENT_NOTE_CANON_STAMP_FIELDS) {
|
|
202
|
+
const field = this.GetFieldByName(fieldName);
|
|
203
|
+
if (field?.Dirty) {
|
|
204
|
+
const value = fieldName === 'CanonApprovedByUserID'
|
|
205
|
+
? this.CanonApprovedByUserID
|
|
206
|
+
: this.CanonApprovedAt;
|
|
207
|
+
return this.clientStampError(fieldName, value);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
isCanonicalMutationRequested() {
|
|
213
|
+
const nextCanonical = this.IsCanonical === true;
|
|
214
|
+
if (!this.IsSaved) {
|
|
215
|
+
return nextCanonical;
|
|
216
|
+
}
|
|
217
|
+
const field = this.GetFieldByName('IsCanonical');
|
|
218
|
+
if (field?.NotLoaded) {
|
|
219
|
+
// Fail closed when stored IsCanonical was not loaded and caller is touching or asserting true.
|
|
220
|
+
return nextCanonical || field.Dirty === true;
|
|
221
|
+
}
|
|
222
|
+
const prevCanonical = this.previousIsCanonical();
|
|
223
|
+
if (prevCanonical === null) {
|
|
224
|
+
return nextCanonical || field?.Dirty === true;
|
|
225
|
+
}
|
|
226
|
+
return prevCanonical !== nextCanonical || field?.Dirty === true;
|
|
227
|
+
}
|
|
228
|
+
previousIsCanonical() {
|
|
229
|
+
const field = this.GetFieldByName('IsCanonical');
|
|
230
|
+
if (field?.NotLoaded) {
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
const oldValue = field?.OldValue;
|
|
234
|
+
if (typeof oldValue === 'boolean') {
|
|
235
|
+
return oldValue;
|
|
236
|
+
}
|
|
237
|
+
if (oldValue === 1 || oldValue === 0) {
|
|
238
|
+
return oldValue === 1;
|
|
239
|
+
}
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
previousStatus() {
|
|
243
|
+
const field = this.GetFieldByName('Status');
|
|
244
|
+
if (field?.NotLoaded) {
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
const oldValue = field?.OldValue;
|
|
248
|
+
return oldValue === 'Pending' ||
|
|
249
|
+
oldValue === 'Active' ||
|
|
250
|
+
oldValue === 'Archived' ||
|
|
251
|
+
oldValue === 'Revoked' ||
|
|
252
|
+
oldValue === 'Provisional'
|
|
253
|
+
? oldValue
|
|
254
|
+
: null;
|
|
255
|
+
}
|
|
256
|
+
matchesLastServerCanonStamp() {
|
|
257
|
+
if (!this._serverStampedCanon) {
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
return ((this.CanonApprovedByUserID ?? null) === (this._serverStampedCanon.CanonApprovedByUserID ?? null) &&
|
|
261
|
+
dateToMillis(this.CanonApprovedAt) === this._serverStampedCanon.CanonApprovedAtMs);
|
|
262
|
+
}
|
|
263
|
+
clientStampError(field, value) {
|
|
264
|
+
return new ValidationErrorInfo(field, `"${field}" is a server-maintained Canon approval stamp (D54) and cannot be set or modified by a client.`, value, ValidationErrorType.Failure);
|
|
265
|
+
}
|
|
266
|
+
/** True when an existing note dirties or variable-binds any material content or scope field (Finding 58). */
|
|
267
|
+
hasMaterialCanonFieldChanges() {
|
|
268
|
+
if (!this.IsSaved) {
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
if (AGENT_NOTE_CANON_MATERIAL_FIELDS.some((fieldName) => this.GetFieldByName(fieldName)?.Dirty === true)) {
|
|
272
|
+
return true;
|
|
273
|
+
}
|
|
274
|
+
return IsSetByTransactionVariable(this, [...AGENT_NOTE_CANON_MATERIAL_FIELDS]);
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Applies server-owned Canon approval stamp lifecycle rules after validation passes:
|
|
278
|
+
* - Promoting to canonical (`IsCanonical === true`) while `Status === 'Active'` inside
|
|
279
|
+
* {@link AI_AGENT_NOTE_CANON_PROMOTION_OPERATION} (and without an unapproved material rewrite
|
|
280
|
+
* on an already-approved note): stamps `CanonApprovedByUserID` and `CanonApprovedAt` from
|
|
281
|
+
* `ContextCurrentUser` and current UTC time.
|
|
282
|
+
* - Demoting (`IsCanonical === false`), transitioning `Status` out of `'Active'`, or editing
|
|
283
|
+
* any material content/scope field (`Note`, `Type`, `AgentID`, `UserID`, `CompanyID`,
|
|
284
|
+
* `PrimaryScopeEntityID`, `PrimaryScopeRecordID`, `SecondaryScopes`) on an existing canonical
|
|
285
|
+
* note (Finding 58): clears `CanonApprovedByUserID` and `CanonApprovedAt` to `null`.
|
|
286
|
+
*/
|
|
287
|
+
applyServerCanonStamp() {
|
|
288
|
+
const nextCanonical = this.IsCanonical === true;
|
|
289
|
+
const prevCanonical = this.IsSaved ? this.previousIsCanonical() : false;
|
|
290
|
+
const prevStatus = this.IsSaved ? this.previousStatus() : null;
|
|
291
|
+
const nextStatus = this.Status;
|
|
292
|
+
const inScope = IsInAgentNoteCanonPromotionScope(this.ContextCurrentUser);
|
|
293
|
+
const materialEdited = this.IsSaved && prevCanonical === true && this.hasMaterialCanonFieldChanges();
|
|
294
|
+
if (materialEdited) {
|
|
295
|
+
this.CanonApprovedByUserID = null;
|
|
296
|
+
this.CanonApprovedAt = null;
|
|
297
|
+
this._serverStampedCanon = {
|
|
298
|
+
CanonApprovedByUserID: null,
|
|
299
|
+
CanonApprovedAtMs: null,
|
|
300
|
+
};
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
if (nextCanonical && nextStatus === 'Active') {
|
|
304
|
+
const enteringCanonical = !this.IsSaved || prevCanonical !== true || prevStatus !== 'Active';
|
|
305
|
+
if (enteringCanonical && inScope && this.ContextCurrentUser?.ID) {
|
|
306
|
+
const now = new Date();
|
|
307
|
+
this.CanonApprovedByUserID = this.ContextCurrentUser.ID;
|
|
308
|
+
this.CanonApprovedAt = now;
|
|
309
|
+
this._serverStampedCanon = {
|
|
310
|
+
CanonApprovedByUserID: this.ContextCurrentUser.ID,
|
|
311
|
+
CanonApprovedAtMs: now.getTime(),
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
const demoting = this.IsSaved && prevCanonical === true && !nextCanonical;
|
|
317
|
+
const leavingActive = this.IsSaved && prevCanonical === true && nextStatus !== 'Active';
|
|
318
|
+
const newNonActiveCanonical = !this.IsSaved && nextCanonical && nextStatus !== 'Active';
|
|
319
|
+
if (demoting || leavingActive || newNonActiveCanonical) {
|
|
320
|
+
this.CanonApprovedByUserID = null;
|
|
321
|
+
this.CanonApprovedAt = null;
|
|
322
|
+
this._serverStampedCanon = {
|
|
323
|
+
CanonApprovedByUserID: null,
|
|
324
|
+
CanonApprovedAtMs: null,
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
refuseOperation(type, message) {
|
|
329
|
+
const result = new BaseEntityResult();
|
|
330
|
+
result.Success = false;
|
|
331
|
+
result.Type = type;
|
|
332
|
+
result.Message = message;
|
|
333
|
+
result.StartedAt = new Date();
|
|
334
|
+
result.EndedAt = new Date();
|
|
335
|
+
this.RegisterResultHistoryEntry(result);
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
84
338
|
};
|
|
85
339
|
MJAIAgentNoteEntityServer = __decorate([
|
|
86
340
|
RegisterClass(BaseEntity, 'MJ: AI Agent Notes')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJAIAgentNoteEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJAIAgentNoteEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,
|
|
1
|
+
{"version":3,"file":"MJAIAgentNoteEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJAIAgentNoteEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EACH,UAAU,EACV,gBAAgB,EAGhB,QAAQ,EACR,2BAA2B,EAG3B,mBAAmB,EACnB,mBAAmB,GAEtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACH,uCAAuC,EACvC,sBAAsB,EACtB,mBAAmB,GACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,QAAQ,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;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rorInfo, ValidationResult } from '@memberjunction/core';
|
|
1
|
+
import { EntityDeleteOptions, IEntityDataProvider, UserInfo, ValidationErrorInfo, ValidationResult } from '@memberjunction/core';
|
|
2
2
|
import { MJAIAgentEntity, MJAIAgentPersonaEntity } from '@memberjunction/core-entities';
|
|
3
3
|
/**
|
|
4
4
|
* Pure ownership check for `MJ: AI Agent Personas` mutations by non-Owner (`UI` role) users.
|
|
5
5
|
* Non-admin users may only attach, update, or remove personas on a derived agent
|
|
6
6
|
* (`BaseAgentID != null`) whose `OwnerUserID === user.ID`.
|
|
7
7
|
*/
|
|
8
|
-
export declare function ValidateAgentPersonaOwnership(targetAgent: Pick<MJAIAgentEntity, 'ID' | 'BaseAgentID' | 'OwnerUserID'> | null, user: UserInfo | null | undefined, agentId: string | null | undefined): ValidationErrorInfo[];
|
|
8
|
+
export declare function ValidateAgentPersonaOwnership(targetAgent: Pick<MJAIAgentEntity, 'ID' | 'BaseAgentID' | 'OwnerUserID'> | null, user: UserInfo | null | undefined, agentId: string | null | undefined, provider?: IEntityDataProvider | null): ValidationErrorInfo[];
|
|
9
9
|
/**
|
|
10
10
|
* Server-side `MJ: AI Agent Personas` entity subclass enforcing non-Owner (`UI` role) sandboxing.
|
|
11
11
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJAIAgentPersonaEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJAIAgentPersonaEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"MJAIAgentPersonaEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJAIAgentPersonaEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,mBAAmB,EACnB,mBAAmB,EACnB,QAAQ,EACR,mBAAmB,EAEnB,gBAAgB,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAGxF;;;;GAIG;AACH,wBAAgB,6BAA6B,CACzC,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,GAAG,aAAa,GAAG,aAAa,CAAC,GAAG,IAAI,EAC/E,IAAI,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,EACjC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAClC,QAAQ,CAAC,EAAE,mBAAmB,GAAG,IAAI,GACtC,mBAAmB,EAAE,CAevB;AAED;;;;;;;GAOG;AACH,qBACa,4BAA6B,SAAQ,sBAAsB;IACpE,IAAoB,0BAA0B,IAAI,OAAO,CAExD;IAEqB,aAAa,IAAI,OAAO,CAAC,gBAAgB,CAAC;IA6B1C,MAAM,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;YAiB/D,SAAS;CAa1B"}
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
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
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { BaseEntity, ValidationErrorInfo, ValidationErrorType, } from '@memberjunction/core';
|
|
7
|
+
import { BaseEntity, BaseEntityResult, ValidationErrorInfo, ValidationErrorType, } from '@memberjunction/core';
|
|
8
8
|
import { RegisterClass, UUIDsEqual } from '@memberjunction/global';
|
|
9
9
|
import { MJAIAgentPersonaEntity } from '@memberjunction/core-entities';
|
|
10
10
|
import { IsAgentAdminOrOwnerUser, IsMetadataProvider } from './MJAIAgentEntityServer.server.js';
|
|
@@ -13,8 +13,8 @@ import { IsAgentAdminOrOwnerUser, IsMetadataProvider } from './MJAIAgentEntitySe
|
|
|
13
13
|
* Non-admin users may only attach, update, or remove personas on a derived agent
|
|
14
14
|
* (`BaseAgentID != null`) whose `OwnerUserID === user.ID`.
|
|
15
15
|
*/
|
|
16
|
-
export function ValidateAgentPersonaOwnership(targetAgent, user, agentId) {
|
|
17
|
-
if (IsAgentAdminOrOwnerUser(user) || !user) {
|
|
16
|
+
export function ValidateAgentPersonaOwnership(targetAgent, user, agentId, provider) {
|
|
17
|
+
if (IsAgentAdminOrOwnerUser(user, provider) || !user) {
|
|
18
18
|
return [];
|
|
19
19
|
}
|
|
20
20
|
if (!targetAgent || !targetAgent.BaseAgentID || !UUIDsEqual(targetAgent.OwnerUserID, user.ID)) {
|
|
@@ -42,7 +42,7 @@ let MJAIAgentPersonaEntityServer = class MJAIAgentPersonaEntityServer extends MJ
|
|
|
42
42
|
return result;
|
|
43
43
|
}
|
|
44
44
|
const user = this.ContextCurrentUser;
|
|
45
|
-
if (IsAgentAdminOrOwnerUser(user) || !user) {
|
|
45
|
+
if (IsAgentAdminOrOwnerUser(user, this.ProviderToUse) || !user) {
|
|
46
46
|
return result;
|
|
47
47
|
}
|
|
48
48
|
const preSaveAgentId = this.GetFieldByName('AgentID')?.OldValue ?? this.AgentID;
|
|
@@ -53,7 +53,7 @@ let MJAIAgentPersonaEntityServer = class MJAIAgentPersonaEntityServer extends MJ
|
|
|
53
53
|
targetIds.add(this.AgentID);
|
|
54
54
|
for (const agentId of targetIds) {
|
|
55
55
|
const targetAgent = await this.loadAgent(agentId);
|
|
56
|
-
const errors = ValidateAgentPersonaOwnership(targetAgent, user, agentId);
|
|
56
|
+
const errors = ValidateAgentPersonaOwnership(targetAgent, user, agentId, this.ProviderToUse);
|
|
57
57
|
if (errors.length > 0) {
|
|
58
58
|
result.Errors.push(...errors);
|
|
59
59
|
result.Success = false;
|
|
@@ -64,12 +64,14 @@ let MJAIAgentPersonaEntityServer = class MJAIAgentPersonaEntityServer extends MJ
|
|
|
64
64
|
}
|
|
65
65
|
async Delete(options) {
|
|
66
66
|
const user = this.ContextCurrentUser;
|
|
67
|
-
if (!IsAgentAdminOrOwnerUser(user) && user) {
|
|
67
|
+
if (!IsAgentAdminOrOwnerUser(user, this.ProviderToUse) && user) {
|
|
68
68
|
const preSaveAgentId = this.GetFieldByName('AgentID')?.OldValue ?? this.AgentID;
|
|
69
69
|
const targetAgent = preSaveAgentId ? await this.loadAgent(preSaveAgentId) : null;
|
|
70
|
-
const errors = ValidateAgentPersonaOwnership(targetAgent, user, preSaveAgentId);
|
|
70
|
+
const errors = ValidateAgentPersonaOwnership(targetAgent, user, preSaveAgentId, this.ProviderToUse);
|
|
71
71
|
if (errors.length > 0) {
|
|
72
|
-
|
|
72
|
+
const deleteResult = new BaseEntityResult(false, '', 'delete');
|
|
73
|
+
deleteResult.Errors = errors;
|
|
74
|
+
this.RegisterResultHistoryEntry(deleteResult);
|
|
73
75
|
return false;
|
|
74
76
|
}
|
|
75
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJAIAgentPersonaEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJAIAgentPersonaEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACH,UAAU,
|
|
1
|
+
{"version":3,"file":"MJAIAgentPersonaEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJAIAgentPersonaEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACH,UAAU,EACV,gBAAgB,EAIhB,mBAAmB,EACnB,mBAAmB,GAEtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAmB,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACxF,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAE7F;;;;GAIG;AACH,MAAM,UAAU,6BAA6B,CACzC,WAA+E,EAC/E,IAAiC,EACjC,OAAkC,EAClC,QAAqC;IAErC,IAAI,uBAAuB,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACnD,OAAO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K,CAAC,SAAS,CAAC,OAAe;QACnC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;YAC1C,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,eAAe,CAClD,eAAe,EACf,IAAI,CAAC,kBAAkB,CAC1B,CAAC;QACF,IAAI,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAA;AAhEY,4BAA4B;IADxC,aAAa,CAAC,UAAU,EAAE,uBAAuB,CAAC;GACtC,4BAA4B,CAgExC"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { ValidationErrorInfo, ValidationResult } from '@memberjunction/core';
|
|
2
2
|
import { MJAIAgentRelationshipEntity } from '@memberjunction/core-entities';
|
|
3
3
|
/**
|
|
4
|
-
* Server-side `MJ: AI Agent Relationships` entity enforcing
|
|
5
|
-
* the referenced `MJ: AI Agent Configurations` preset exists
|
|
4
|
+
* Server-side `MJ: AI Agent Relationships` entity enforcing:
|
|
5
|
+
* 1. When `ConfigurationPresetID` is set, the referenced `MJ: AI Agent Configurations` preset exists
|
|
6
|
+
* and belongs to the relationship's `SubAgentID`.
|
|
7
|
+
* 2. Derived agents (`BaseAgentID != null`) without `Configuration.allowWidenFromBase === true`
|
|
8
|
+
* cannot attach net-new `'Active'` sub-agents or loosen inherited relationship bounds.
|
|
6
9
|
*/
|
|
7
10
|
export declare class MJAIAgentRelationshipEntityServer extends MJAIAgentRelationshipEntity {
|
|
8
11
|
get DefaultSkipAsyncValidation(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJAIAgentRelationshipEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJAIAgentRelationshipEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,mBAAmB,EAAuB,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEjI,OAAO,EAAgC,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"MJAIAgentRelationshipEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJAIAgentRelationshipEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,mBAAmB,EAAuB,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEjI,OAAO,EAAgC,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAG1G;;;;;;GAMG;AACH,qBACa,iCAAkC,SAAQ,2BAA2B;IAC9E,IAAoB,0BAA0B,IAAI,OAAO,CAExD;IAEqB,aAAa,IAAI,OAAO,CAAC,gBAAgB,CAAC;YA2ClD,2BAA2B;CAoB5C;AAED;;;GAGG;AACH,wBAAgB,sCAAsC,CAClD,qBAAqB,EAAE,MAAM,GAAG,IAAI,EACpC,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,aAAa,EAAE,MAAM,GAAG,IAAI,EAC5B,UAAU,CAAC,EAAE,MAAM,GACpB,mBAAmB,GAAG,IAAI,CAsB5B"}
|
|
@@ -7,9 +7,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { BaseEntity, ValidationErrorInfo, ValidationErrorType } from '@memberjunction/core';
|
|
8
8
|
import { RegisterClass, UUIDsEqual } from '@memberjunction/global';
|
|
9
9
|
import { MJAIAgentRelationshipEntity } from '@memberjunction/core-entities';
|
|
10
|
+
import { HasRelationalGrantGuardProvider, ValidateDerivedAgentRelationalGrantLive } from './agentRelationalGrantGuard.js';
|
|
10
11
|
/**
|
|
11
|
-
* Server-side `MJ: AI Agent Relationships` entity enforcing
|
|
12
|
-
* the referenced `MJ: AI Agent Configurations` preset exists
|
|
12
|
+
* Server-side `MJ: AI Agent Relationships` entity enforcing:
|
|
13
|
+
* 1. When `ConfigurationPresetID` is set, the referenced `MJ: AI Agent Configurations` preset exists
|
|
14
|
+
* and belongs to the relationship's `SubAgentID`.
|
|
15
|
+
* 2. Derived agents (`BaseAgentID != null`) without `Configuration.allowWidenFromBase === true`
|
|
16
|
+
* cannot attach net-new `'Active'` sub-agents or loosen inherited relationship bounds.
|
|
13
17
|
*/
|
|
14
18
|
let MJAIAgentRelationshipEntityServer = class MJAIAgentRelationshipEntityServer extends MJAIAgentRelationshipEntity {
|
|
15
19
|
get DefaultSkipAsyncValidation() {
|
|
@@ -20,6 +24,25 @@ let MJAIAgentRelationshipEntityServer = class MJAIAgentRelationshipEntityServer
|
|
|
20
24
|
if (!result.Success) {
|
|
21
25
|
return result;
|
|
22
26
|
}
|
|
27
|
+
if (HasRelationalGrantGuardProvider(this)) {
|
|
28
|
+
const guardErrors = await ValidateDerivedAgentRelationalGrantLive(this, {
|
|
29
|
+
Kind: 'Sub-Agent Relationship',
|
|
30
|
+
EntityName: 'MJ: AI Agent Relationships',
|
|
31
|
+
FieldName: 'SubAgentID',
|
|
32
|
+
AgentID: this.AgentID,
|
|
33
|
+
GrantTargetID: this.SubAgentID,
|
|
34
|
+
IsActiveGrant: this.Status === 'Active',
|
|
35
|
+
TargetBounds: {
|
|
36
|
+
MessageMode: this.MessageMode,
|
|
37
|
+
MaxMessages: this.MaxMessages,
|
|
38
|
+
SubAgentContextPaths: this.SubAgentContextPaths,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
if (guardErrors.length > 0) {
|
|
42
|
+
result.Errors.push(...guardErrors);
|
|
43
|
+
result.Success = result.Success && guardErrors.every((e) => e.Type !== ValidationErrorType.Failure);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
23
46
|
if (!this.ConfigurationPresetID) {
|
|
24
47
|
return result;
|
|
25
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJAIAgentRelationshipEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJAIAgentRelationshipEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAqB,mBAAmB,EAAE,mBAAmB,EAAoB,MAAM,sBAAsB,CAAC;AACjI,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAgC,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"MJAIAgentRelationshipEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJAIAgentRelationshipEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAqB,mBAAmB,EAAE,mBAAmB,EAAoB,MAAM,sBAAsB,CAAC;AACjI,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAgC,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC1G,OAAO,EAAE,+BAA+B,EAAE,uCAAuC,EAAE,MAAM,6BAA6B,CAAC;AAEvH;;;;;;GAMG;AAEI,IAAM,iCAAiC,GAAvC,MAAM,iCAAkC,SAAQ,2BAA2B;IAC9E,IAAoB,0BAA0B;QAC1C,OAAO,KAAK,CAAC;IACjB,CAAC;IAEe,KAAK,CAAC,aAAa;QAC/B,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,aAAa,EAAE,CAAC;QAC3C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YAClB,OAAO,MAAM,CAAC;QAClB,CAAC;QAED,IAAI,+BAA+B,CAAC,IAAI,CAAC,EAAE,CAAC;YACxC,MAAM,WAAW,GAAG,MAAM,uCAAuC,CAAC,IAAI,EAAE;gBACpE,IAAI,EAAE,wBAAwB;gBAC9B,UAAU,EAAE,4BAA4B;gBACxC,SAAS,EAAE,YAAY;gBACvB,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,aAAa,EAAE,IAAI,CAAC,UAAU;gBAC9B,aAAa,EAAE,IAAI,CAAC,MAAM,KAAK,QAAQ;gB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AqB,UAAU,IAAI,EACnG,qBAAqB,EACrB,mBAAmB,CAAC,OAAO,CAC9B,CAAC;IACN,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ValidationResult } from '@memberjunction/core';
|
|
2
|
+
import { MJAIAgentSkillEntity } from '@memberjunction/core-entities';
|
|
3
|
+
/**
|
|
4
|
+
* Server-side `MJ: AI Agent Skills` entity enforcing that derived agents (`BaseAgentID != null`)
|
|
5
|
+
* without `Configuration.allowWidenFromBase === true` cannot attach net-new `'Active'` skills
|
|
6
|
+
* not inherited from their base chain (vetoes with `Status !== 'Active'` are always permitted).
|
|
7
|
+
*/
|
|
8
|
+
export declare class MJAIAgentSkillEntityServer extends MJAIAgentSkillEntity {
|
|
9
|
+
get DefaultSkipAsyncValidation(): boolean;
|
|
10
|
+
ValidateAsync(): Promise<ValidationResult>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=MJAIAgentSkillEntityServer.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJAIAgentSkillEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJAIAgentSkillEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAIrE;;;;GAIG;AACH,qBACa,0BAA2B,SAAQ,oBAAoB;IAChE,IAAoB,0BAA0B,IAAI,OAAO,CAExD;IAEqB,aAAa,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAuBnE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
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 { BaseEntity, ValidationErrorType } from '@memberjunction/core';
|
|
8
|
+
import { MJAIAgentSkillEntity } from '@memberjunction/core-entities';
|
|
9
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
10
|
+
import { HasRelationalGrantGuardProvider, ValidateDerivedAgentRelationalGrantLive } from './agentRelationalGrantGuard.js';
|
|
11
|
+
/**
|
|
12
|
+
* Server-side `MJ: AI Agent Skills` entity enforcing that derived agents (`BaseAgentID != null`)
|
|
13
|
+
* without `Configuration.allowWidenFromBase === true` cannot attach net-new `'Active'` skills
|
|
14
|
+
* not inherited from their base chain (vetoes with `Status !== 'Active'` are always permitted).
|
|
15
|
+
*/
|
|
16
|
+
let MJAIAgentSkillEntityServer = class MJAIAgentSkillEntityServer extends MJAIAgentSkillEntity {
|
|
17
|
+
get DefaultSkipAsyncValidation() {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
async ValidateAsync() {
|
|
21
|
+
const result = await super.ValidateAsync();
|
|
22
|
+
if (!result.Success) {
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
if (HasRelationalGrantGuardProvider(this)) {
|
|
26
|
+
const guardErrors = await ValidateDerivedAgentRelationalGrantLive(this, {
|
|
27
|
+
Kind: 'Skill',
|
|
28
|
+
EntityName: 'MJ: AI Agent Skills',
|
|
29
|
+
FieldName: 'SkillID',
|
|
30
|
+
AgentID: this.AgentID,
|
|
31
|
+
GrantTargetID: this.SkillID,
|
|
32
|
+
IsActiveGrant: this.Status === 'Active',
|
|
33
|
+
});
|
|
34
|
+
if (guardErrors.length > 0) {
|
|
35
|
+
result.Errors.push(...guardErrors);
|
|
36
|
+
result.Success = result.Success && guardErrors.every((e) => e.Type !== ValidationErrorType.Failure);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
MJAIAgentSkillEntityServer = __decorate([
|
|
43
|
+
RegisterClass(BaseEntity, 'MJ: AI Agent Skills')
|
|
44
|
+
], MJAIAgentSkillEntityServer);
|
|
45
|
+
export { MJAIAgentSkillEntityServer };
|
|
46
|
+
//# sourceMappingURL=MJAIAgentSkillEntityServer.server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJAIAgentSkillEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJAIAgentSkillEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAoB,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,+BAA+B,EAAE,uCAAuC,EAAE,MAAM,6BAA6B,CAAC;AAEvH;;;;GAIG;AAEI,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,oBAAoB;IAChE,IAAoB,0BAA0B;QAC1C,OAAO,KAAK,CAAC;IACjB,CAAC;IAEe,KAAK,CAAC,aAAa;QAC/B,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,aAAa,EAAE,CAAC;QAC3C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YAClB,OAAO,MAAM,CAAC;QAClB,CAAC;QAED,IAAI,+BAA+B,CAAC,IAAI,CAAC,EAAE,CAAC;YACxC,MAAM,WAAW,GAAG,MAAM,uCAAuC,CAAC,IAAI,EAAE;gBACpE,IAAI,EAAE,OAAO;gBACb,UAAU,EAAE,qBAAqB;gBACjC,SAAS,EAAE,SAAS;gBACpB,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,aAAa,EAAE,IAAI,CAAC,OAAO;gBAC3B,aAAa,EAAE,IAAI,CAAC,MAAM,KAAK,QAAQ;aAC1C,CAAC,CAAC;YACH,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACzB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC;gBACnC,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,mBAAmB,CAAC,OAAO,CAAC,CAAC;YACxG,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ,CAAA;AA5BY,0BAA0B;IADtC,aAAa,CAAC,UAAU,EAAE,qBAAqB,CAAC;GACpC,0BAA0B,CA4BtC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { EntityDeleteOptions, EntityPermissionType, IEntityDataProvider, IMetadataProvider, UserInfo, ValidationErrorInfo, ValidationResult } from '@memberjunction/core';
|
|
2
|
+
import { MJAIAgentStepTypeEntity } from '@memberjunction/core-entities';
|
|
3
|
+
/** Shape required to validate an `MJ: AI Agent Step Types` create/update mutation. */
|
|
4
|
+
export interface AgentStepTypeValidationTarget {
|
|
5
|
+
Name: string | null | undefined;
|
|
6
|
+
DriverClass: string | null | undefined;
|
|
7
|
+
AllowedInUnapprovedPlanMode: boolean | null | undefined;
|
|
8
|
+
CountsAgainstTreeBudget: boolean | null | undefined;
|
|
9
|
+
Status?: string | null | undefined;
|
|
10
|
+
}
|
|
11
|
+
/** Pure validation helper for `MJ: AI Agent Step Types` create/update rules. */
|
|
12
|
+
export declare function ValidateAgentStepTypeMutation(target: AgentStepTypeValidationTarget, contextUser: UserInfo | null | undefined, provider?: IEntityDataProvider | Pick<IMetadataProvider, 'Authorizations'> | null): ValidationErrorInfo[];
|
|
13
|
+
/** Pure validation helper for `MJ: AI Agent Step Types` delete rules. */
|
|
14
|
+
export declare function ValidateAgentStepTypeDelete(stepTypeName: string | null | undefined, stepTypeId: string | null | undefined, contextUser: UserInfo | null | undefined, provider?: IEntityDataProvider | null): ValidationErrorInfo[];
|
|
15
|
+
/**
|
|
16
|
+
* Server-side guard for `MJ: AI Agent Step Types` (`AIAgentStepType`):
|
|
17
|
+
* 1. Restricts create, update, and delete mutations to administrators/owners.
|
|
18
|
+
* 2. Locks built-in step type security invariants so metadata edits cannot disable Plan Mode
|
|
19
|
+
* restrictions (`Actions`/`Sub-Agent`), bypass tree-budget accounting, or hijack built-in
|
|
20
|
+
* `DriverClass` routing (code overrides must use `@RegisterClass(BaseAgentStepHandler, ...)`).
|
|
21
|
+
*/
|
|
22
|
+
export declare class MJAIAgentStepTypeEntityServer extends MJAIAgentStepTypeEntity {
|
|
23
|
+
get DefaultSkipAsyncValidation(): boolean;
|
|
24
|
+
CheckPermissions(type: EntityPermissionType, throwError: boolean): boolean;
|
|
25
|
+
ValidateAsync(): Promise<ValidationResult>;
|
|
26
|
+
Delete(options?: EntityDeleteOptions): Promise<boolean>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=MJAIAgentStepTypeEntityServer.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJAIAgentStepTypeEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJAIAgentStepTypeEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,EACR,mBAAmB,EAEnB,gBAAgB,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AA0BxE,sFAAsF;AACtF,MAAM,WAAW,6BAA6B;IAC1C,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAChC,WAAW,EAAE,MAAM,GAAG,IA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