@memberjunction/core-actions 5.28.0 → 5.30.0

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 (39) hide show
  1. package/dist/custom/ai/actionsmith-agent.d.ts +78 -0
  2. package/dist/custom/ai/actionsmith-agent.d.ts.map +1 -0
  3. package/dist/custom/ai/actionsmith-agent.js +373 -0
  4. package/dist/custom/ai/actionsmith-agent.js.map +1 -0
  5. package/dist/custom/ai/create-runtime-action.action.d.ts +32 -0
  6. package/dist/custom/ai/create-runtime-action.action.d.ts.map +1 -0
  7. package/dist/custom/ai/create-runtime-action.action.js +220 -0
  8. package/dist/custom/ai/create-runtime-action.action.js.map +1 -0
  9. package/dist/custom/ai/execute-agent.action.d.ts +45 -0
  10. package/dist/custom/ai/execute-agent.action.d.ts.map +1 -0
  11. package/dist/custom/ai/execute-agent.action.js +192 -0
  12. package/dist/custom/ai/execute-agent.action.js.map +1 -0
  13. package/dist/custom/ai/test-runtime-action.action.d.ts +37 -0
  14. package/dist/custom/ai/test-runtime-action.action.d.ts.map +1 -0
  15. package/dist/custom/ai/test-runtime-action.action.js +317 -0
  16. package/dist/custom/ai/test-runtime-action.action.js.map +1 -0
  17. package/dist/custom/data/get-entity-details.action.d.ts.map +1 -1
  18. package/dist/custom/data/get-entity-details.action.js +15 -2
  19. package/dist/custom/data/get-entity-details.action.js.map +1 -1
  20. package/dist/custom/data/get-entity-list.action.d.ts.map +1 -1
  21. package/dist/custom/data/get-entity-list.action.js +7 -2
  22. package/dist/custom/data/get-entity-list.action.js.map +1 -1
  23. package/dist/custom/lists/create-list.action.d.ts.map +1 -1
  24. package/dist/custom/lists/create-list.action.js +22 -29
  25. package/dist/custom/lists/create-list.action.js.map +1 -1
  26. package/dist/custom/lists/remove-records-from-list.action.d.ts.map +1 -1
  27. package/dist/custom/lists/remove-records-from-list.action.js +25 -29
  28. package/dist/custom/lists/remove-records-from-list.action.js.map +1 -1
  29. package/dist/custom/lists/update-list-item-status.action.d.ts.map +1 -1
  30. package/dist/custom/lists/update-list-item-status.action.js +25 -29
  31. package/dist/custom/lists/update-list-item-status.action.js.map +1 -1
  32. package/dist/custom/user-management/assign-user-roles.action.d.ts.map +1 -1
  33. package/dist/custom/user-management/assign-user-roles.action.js +25 -18
  34. package/dist/custom/user-management/assign-user-roles.action.js.map +1 -1
  35. package/dist/index.d.ts +4 -0
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +4 -0
  38. package/dist/index.js.map +1 -1
  39. package/package.json +29 -29
@@ -0,0 +1,78 @@
1
+ import { BaseAgentNextStep, ExecuteAgentParams, MJAIAgentRunEntityExtended, MJAIAgentRunStepEntityExtended } from '@memberjunction/ai-core-plus';
2
+ import { BaseAgent } from '@memberjunction/ai-agents';
3
+ /**
4
+ * Custom BaseAgent subclass for the **ActionSmith Agent**. Keeps the full
5
+ * LLM-driven Loop for the creative work (contract design, Codesmith
6
+ * delegation, test iteration) but adds a deterministic validation +
7
+ * rescue hook at the "I'm done" moment so:
8
+ *
9
+ * 1. The agent cannot return `Success` with an incomplete payload.
10
+ * If it tries, `validateSuccessNextStep` downgrades the step to
11
+ * `Retry` with explicit `retryInstructions` telling the LLM
12
+ * exactly which fields are missing.
13
+ * 2. If tests didn't all pass, `Success` is refused — the LLM is
14
+ * sent back with the failing test names.
15
+ * 3. If the payload IS valid but the LLM forgot to call
16
+ * `Create Runtime Action`, the override runs it deterministically
17
+ * here, stamps `actionId` + `approvalStatus: 'Pending'` onto the
18
+ * payload, and returns Success. The LLM can't accidentally skip
19
+ * persistence.
20
+ *
21
+ * Pattern mirrors Skip-Brain's `SoftwareArchitectAgent`
22
+ * (packages/resolvers/src/agents/software-architect-agent.ts) — see
23
+ * `validateSuccessNextStep` there for the reference implementation.
24
+ *
25
+ * Wired into the `ActionSmith Agent` metadata via the `DriverClass`
26
+ * field: `"DriverClass": "ActionSmithAgent"`. No other metadata or
27
+ * prompt changes required — the framework handles the dispatch.
28
+ */
29
+ export declare class ActionSmithAgent extends BaseAgent {
30
+ /**
31
+ * Gate on `Chat` steps. Chat is legitimate in exactly three cases:
32
+ * (a) The LLM attached a structured `responseForm` — it's asking for
33
+ * deliberate user input via a form, not a freeform question. Pass
34
+ * through.
35
+ * (b) No code has been generated yet — the pipeline hasn't really
36
+ * started, so a clarification chat is fine. Pass through.
37
+ * (c) The action has already been persisted (`actionId` present) —
38
+ * this is the terminal success-reporting chat. Pass through.
39
+ *
40
+ * Otherwise the Chat is a mid-pipeline stall (the LLM forgot to run the
41
+ * next step, or is bubbling up a sub-agent's clarification request). We
42
+ * either:
43
+ * - Rescue deterministically: if tests passed and an actionId is the
44
+ * only thing missing, persist the action ourselves and convert the
45
+ * Chat step into Success with the populated actionId. The LLM's
46
+ * intent ("I'm done") is respected; we just finish the job it
47
+ * forgot to finish.
48
+ * - Redirect to Retry with explicit guidance: if tests haven't run or
49
+ * failed, send the LLM back with instructions telling it which
50
+ * `Actions` step to execute next.
51
+ */
52
+ protected validateChatNextStep<P>(params: ExecuteAgentParams, nextStep: BaseAgentNextStep<P>, currentPayload: P, agentRun: MJAIAgentRunEntityExtended, currentStep: MJAIAgentRunStepEntityExtended): Promise<BaseAgentNextStep<P>>;
53
+ /**
54
+ * Gate on `Success` steps. Runs after the LLM claims it's done.
55
+ * Returns either the original nextStep (pass — agent terminates)
56
+ * or a `Retry` step with `retryInstructions` explaining what's
57
+ * still missing. When everything is valid but the LLM forgot to
58
+ * call Create Runtime Action, we call it ourselves.
59
+ */
60
+ protected validateSuccessNextStep<P>(params: ExecuteAgentParams, nextStep: BaseAgentNextStep<P>, currentPayload: P, agentRun: MJAIAgentRunEntityExtended, currentStep: MJAIAgentRunStepEntityExtended): Promise<BaseAgentNextStep<P>>;
61
+ /**
62
+ * Checks the bare minimum needed to persist a valid Runtime action.
63
+ * Order-sensitive: we return every missing field so the LLM can fix
64
+ * them all in one retry pass rather than chasing them one at a time.
65
+ */
66
+ private checkRequiredFields;
67
+ /**
68
+ * Deterministic fallback persistence path — calls the existing
69
+ * `Create Runtime Action` action via ActionEngineServer, mapping
70
+ * ActionSmith payload fields to its input param names. Keeps the
71
+ * persistence logic in exactly one place (the action itself) so
72
+ * there's no duplication between the agent and the action.
73
+ */
74
+ private persistRuntimeAction;
75
+ private schemaToParamSpec;
76
+ private readOutputParam;
77
+ }
78
+ //# sourceMappingURL=actionsmith-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actionsmith-agent.d.ts","sourceRoot":"","sources":["../../../src/custom/ai/actionsmith-agent.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,iBAAiB,EACjB,kBAAkB,EAClB,0BAA0B,EAC1B,8BAA8B,EACjC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AA6CtD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBACa,gBAAiB,SAAQ,SAAS;IAC3C;;;;;;;;;;;;;;;;;;;;;OAqBG;cACsB,oBAAoB,CAAC,CAAC,EAC3C,MAAM,EAAE,kBAAkB,EAC1B,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAC9B,cAAc,EAAE,CAAC,EACjB,QAAQ,EAAE,0BAA0B,EACpC,WAAW,EAAE,8BAA8B,GAC5C,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAkIhC;;;;;;OAMG;cACsB,uBAAuB,CAAC,CAAC,EAC9C,MAAM,EAAE,kBAAkB,EAC1B,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAC9B,cAAc,EAAE,CAAC,EACjB,QAAQ,EAAE,0BAA0B,EACpC,WAAW,EAAE,8BAA8B,GAC5C,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAsGhC;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAW3B;;;;;;OAMG;YACW,oBAAoB;IA0ElC,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,eAAe;CAY1B"}
@@ -0,0 +1,373 @@
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 { RegisterClass, UUIDsEqual } from '@memberjunction/global';
8
+ import { LogError } from '@memberjunction/core';
9
+ import { BaseAgent } from '@memberjunction/ai-agents';
10
+ import { ActionEngineServer } from '@memberjunction/actions';
11
+ import { ActionParam } from '@memberjunction/actions-base';
12
+ /**
13
+ * Custom BaseAgent subclass for the **ActionSmith Agent**. Keeps the full
14
+ * LLM-driven Loop for the creative work (contract design, Codesmith
15
+ * delegation, test iteration) but adds a deterministic validation +
16
+ * rescue hook at the "I'm done" moment so:
17
+ *
18
+ * 1. The agent cannot return `Success` with an incomplete payload.
19
+ * If it tries, `validateSuccessNextStep` downgrades the step to
20
+ * `Retry` with explicit `retryInstructions` telling the LLM
21
+ * exactly which fields are missing.
22
+ * 2. If tests didn't all pass, `Success` is refused — the LLM is
23
+ * sent back with the failing test names.
24
+ * 3. If the payload IS valid but the LLM forgot to call
25
+ * `Create Runtime Action`, the override runs it deterministically
26
+ * here, stamps `actionId` + `approvalStatus: 'Pending'` onto the
27
+ * payload, and returns Success. The LLM can't accidentally skip
28
+ * persistence.
29
+ *
30
+ * Pattern mirrors Skip-Brain's `SoftwareArchitectAgent`
31
+ * (packages/resolvers/src/agents/software-architect-agent.ts) — see
32
+ * `validateSuccessNextStep` there for the reference implementation.
33
+ *
34
+ * Wired into the `ActionSmith Agent` metadata via the `DriverClass`
35
+ * field: `"DriverClass": "ActionSmithAgent"`. No other metadata or
36
+ * prompt changes required — the framework handles the dispatch.
37
+ */
38
+ let ActionSmithAgent = class ActionSmithAgent extends BaseAgent {
39
+ /**
40
+ * Gate on `Chat` steps. Chat is legitimate in exactly three cases:
41
+ * (a) The LLM attached a structured `responseForm` — it's asking for
42
+ * deliberate user input via a form, not a freeform question. Pass
43
+ * through.
44
+ * (b) No code has been generated yet — the pipeline hasn't really
45
+ * started, so a clarification chat is fine. Pass through.
46
+ * (c) The action has already been persisted (`actionId` present) —
47
+ * this is the terminal success-reporting chat. Pass through.
48
+ *
49
+ * Otherwise the Chat is a mid-pipeline stall (the LLM forgot to run the
50
+ * next step, or is bubbling up a sub-agent's clarification request). We
51
+ * either:
52
+ * - Rescue deterministically: if tests passed and an actionId is the
53
+ * only thing missing, persist the action ourselves and convert the
54
+ * Chat step into Success with the populated actionId. The LLM's
55
+ * intent ("I'm done") is respected; we just finish the job it
56
+ * forgot to finish.
57
+ * - Redirect to Retry with explicit guidance: if tests haven't run or
58
+ * failed, send the LLM back with instructions telling it which
59
+ * `Actions` step to execute next.
60
+ */
61
+ async validateChatNextStep(params, nextStep, currentPayload, agentRun, currentStep) {
62
+ const base = await super.validateChatNextStep(params, nextStep, currentPayload, agentRun, currentStep);
63
+ if (base.step === 'Retry') {
64
+ return base;
65
+ }
66
+ // Coalesce through empty-object fallback so subsequent `payload.X`
67
+ // field accesses don't throw when the LLM emits a step before any
68
+ // payload has been populated (e.g., early Chat step with no
69
+ // `newPayload` AND no parent currentPayload yet). Hitting an
70
+ // undefined here bubbles up as a generic "Cannot read properties
71
+ // of undefined (reading 'code')" error that surfaces as a failed
72
+ // prompt step — stalling the whole run.
73
+ const payload = (nextStep.newPayload ?? currentPayload ?? {});
74
+ const hasCode = !!payload.code?.trim();
75
+ const hasActionId = !!payload.actionId;
76
+ // Legit structured interaction — the LLM built an actual form, not a
77
+ // freeform "are we good?" question. This is always allowed.
78
+ const hasResponseForm = !!nextStep.responseForm;
79
+ // (a) responseForm present → user-directed structured input. Pass through.
80
+ if (hasResponseForm) {
81
+ return base;
82
+ }
83
+ // (b) No code yet → pipeline hasn't really begun, early clarification is fine.
84
+ if (!hasCode) {
85
+ return base;
86
+ }
87
+ // (c) Action already persisted → terminal reporting chat. Pass through.
88
+ if (hasActionId) {
89
+ return base;
90
+ }
91
+ // ---- Mid-pipeline stall. Decide rescue vs. redirect based on test state. ----
92
+ const testsPassed = payload.testResults?.AllPassed === true;
93
+ // Rescue path: tests passed, actionId just missing. Persist deterministically
94
+ // and convert Chat → Success. Same logic as validateSuccessNextStep's rescue
95
+ // branch — centralizing it would risk coupling the two validators in
96
+ // subtle ways, so we duplicate the 10-line call site rather than abstract.
97
+ if (testsPassed) {
98
+ const missing = this.checkRequiredFields(payload);
99
+ if (missing.length === 0) {
100
+ try {
101
+ const persisted = await this.persistRuntimeAction(payload, params.contextUser, params.agent?.ID);
102
+ return {
103
+ ...base,
104
+ step: 'Success',
105
+ terminate: true,
106
+ newPayload: {
107
+ ...payload,
108
+ actionId: persisted.actionId,
109
+ approvalStatus: 'Pending',
110
+ status: 'completed',
111
+ message: payload.message ??
112
+ `Runtime action '${payload.name}' created (ID ${persisted.actionId}), pending approval.`
113
+ }
114
+ };
115
+ }
116
+ catch (err) {
117
+ const message = err instanceof Error ? err.message : String(err);
118
+ LogError(`ActionSmithAgent rescue-persist via Chat path failed: ${message}`);
119
+ return {
120
+ ...base,
121
+ step: 'Retry',
122
+ terminate: false,
123
+ retryReason: 'Create Runtime Action failed during Chat rescue',
124
+ retryInstructions: `You attempted to return Chat with tests passing but Create Runtime Action failed: ${message}. ` +
125
+ `Inspect the error, correct the affected payload fields, and invoke Create Runtime Action again.`,
126
+ newPayload: payload
127
+ };
128
+ }
129
+ }
130
+ }
131
+ // Redirect path: tests didn't pass (or haven't run). Send the LLM back
132
+ // with explicit guidance on which Actions step to execute next.
133
+ const testsStatus = payload.testResults
134
+ ? payload.testResults.AllPassed
135
+ ? 'passed'
136
+ : 'failed'
137
+ : 'not run';
138
+ let nextInstruction;
139
+ if (testsStatus === 'not run') {
140
+ nextInstruction =
141
+ `You have \`code\` in your payload but have not yet invoked Test Runtime Action. ` +
142
+ `Your NEXT step MUST be an \`Actions\` step invoking \`Test Runtime Action\` with the code + configuration + testCases from your payload. Do not return Chat here.`;
143
+ }
144
+ else if (testsStatus === 'failed') {
145
+ const failing = (payload.testResults?.TestResults ?? [])
146
+ .filter((r) => !r.passed)
147
+ .map((r) => r.name || '(unnamed)')
148
+ .join(', ');
149
+ nextInstruction =
150
+ `You have \`code\` and failing test results (failing cases: ${failing || 'unknown'}) but returned Chat instead of iterating. ` +
151
+ `Call Codesmith again with the failing case details and re-run Test Runtime Action. Do not surface the failure to the user as Chat — resolve it or return a terminal Failed step.`;
152
+ }
153
+ else {
154
+ // tests passed but we reached here only if checkRequiredFields flagged
155
+ // something missing (e.g., no description). Treat as incomplete payload.
156
+ const missing = this.checkRequiredFields(payload);
157
+ nextInstruction =
158
+ `Tests passed but required payload fields are missing: [${missing.join(', ')}]. ` +
159
+ `Fill those in and then invoke Create Runtime Action.`;
160
+ }
161
+ return {
162
+ ...base,
163
+ step: 'Retry',
164
+ terminate: false,
165
+ retryReason: 'Mid-pipeline Chat blocked',
166
+ retryInstructions: nextInstruction,
167
+ newPayload: payload
168
+ };
169
+ }
170
+ /**
171
+ * Gate on `Success` steps. Runs after the LLM claims it's done.
172
+ * Returns either the original nextStep (pass — agent terminates)
173
+ * or a `Retry` step with `retryInstructions` explaining what's
174
+ * still missing. When everything is valid but the LLM forgot to
175
+ * call Create Runtime Action, we call it ourselves.
176
+ */
177
+ async validateSuccessNextStep(params, nextStep, currentPayload, agentRun, currentStep) {
178
+ // 1. Let the base class run its generic checks first
179
+ // (min execution count, FinalPayloadValidation schema).
180
+ const base = await super.validateSuccessNextStep(params, nextStep, currentPayload, agentRun, currentStep);
181
+ if (base.step === 'Retry') {
182
+ return base;
183
+ }
184
+ // Coalesce through empty-object fallback so subsequent `payload.X`
185
+ // field accesses don't throw when the LLM emits a step before any
186
+ // payload has been populated (e.g., early Chat step with no
187
+ // `newPayload` AND no parent currentPayload yet). Hitting an
188
+ // undefined here bubbles up as a generic "Cannot read properties
189
+ // of undefined (reading 'code')" error that surfaces as a failed
190
+ // prompt step — stalling the whole run.
191
+ const payload = (nextStep.newPayload ?? currentPayload ?? {});
192
+ // 2. Structured completeness check with specific retry guidance.
193
+ const missing = this.checkRequiredFields(payload);
194
+ if (missing.length > 0) {
195
+ return {
196
+ ...base,
197
+ step: 'Retry',
198
+ terminate: false,
199
+ retryReason: 'Incomplete payload',
200
+ retryInstructions: `You returned Success but your payload is missing required fields: [${missing.join(', ')}]. ` +
201
+ `Complete the pipeline in order: define the contract → delegate to Codesmith (the generated code auto-merges into your payload's \`code\` field) → ` +
202
+ `invoke Test Runtime Action with that code and confirm \`AllPassed=true\` → then invoke Create Runtime Action. ` +
203
+ `Do NOT return Success until \`actionId\` is populated in your payload.`,
204
+ newPayload: payload
205
+ };
206
+ }
207
+ // 3. Test gate — if the test harness didn't pass, don't persist.
208
+ if (payload.testResults && payload.testResults.AllPassed === false) {
209
+ const failing = (payload.testResults.TestResults ?? [])
210
+ .filter((r) => !r.passed)
211
+ .map((r) => r.name || '(unnamed)')
212
+ .join(', ');
213
+ return {
214
+ ...base,
215
+ step: 'Retry',
216
+ terminate: false,
217
+ retryReason: 'Test failures',
218
+ retryInstructions: `Tests did not all pass (failing: ${failing || 'unknown'}). ` +
219
+ `Brief Codesmith with the failure details from \`testResults.TestResults\`, ` +
220
+ `iterate until \`AllPassed=true\`, then re-run Test Runtime Action before returning Success.`,
221
+ newPayload: payload
222
+ };
223
+ }
224
+ // 4. Happy path A — the LLM already called Create Runtime Action
225
+ // and `actionId` is in the payload. Let it through.
226
+ if (payload.actionId) {
227
+ return base;
228
+ }
229
+ // 5. Happy path B — payload is complete + tests passed but
230
+ // `actionId` is missing. Rather than kicking the LLM back
231
+ // for another iteration, persist deterministically here.
232
+ try {
233
+ const persisted = await this.persistRuntimeAction(payload, params.contextUser, params.agent?.ID);
234
+ return {
235
+ ...base,
236
+ newPayload: {
237
+ ...payload,
238
+ actionId: persisted.actionId,
239
+ approvalStatus: 'Pending',
240
+ status: payload.status ?? 'completed',
241
+ message: payload.message ??
242
+ `Runtime action '${payload.name}' created (ID ${persisted.actionId}), pending approval.`
243
+ }
244
+ };
245
+ }
246
+ catch (err) {
247
+ const message = err instanceof Error ? err.message : String(err);
248
+ LogError(`ActionSmithAgent deterministic persist failed: ${message}`);
249
+ return {
250
+ ...base,
251
+ step: 'Retry',
252
+ terminate: false,
253
+ retryReason: 'Create Runtime Action failed',
254
+ retryInstructions: `Attempted to persist your Runtime action on your behalf but Create Runtime Action failed: ${message}. ` +
255
+ `Inspect the error, correct the affected payload fields, and try again.`,
256
+ newPayload: payload
257
+ };
258
+ }
259
+ }
260
+ /**
261
+ * Checks the bare minimum needed to persist a valid Runtime action.
262
+ * Order-sensitive: we return every missing field so the LLM can fix
263
+ * them all in one retry pass rather than chasing them one at a time.
264
+ */
265
+ checkRequiredFields(p) {
266
+ const missing = [];
267
+ if (!p.name?.trim())
268
+ missing.push('name');
269
+ if (!p.description?.trim())
270
+ missing.push('description');
271
+ if (!p.code?.trim())
272
+ missing.push('code');
273
+ if (!p.permissions)
274
+ missing.push('permissions');
275
+ if (!p.resultCodes || p.resultCodes.length === 0)
276
+ missing.push('resultCodes');
277
+ if (!p.testResults)
278
+ missing.push('testResults');
279
+ return missing;
280
+ }
281
+ /**
282
+ * Deterministic fallback persistence path — calls the existing
283
+ * `Create Runtime Action` action via ActionEngineServer, mapping
284
+ * ActionSmith payload fields to its input param names. Keeps the
285
+ * persistence logic in exactly one place (the action itself) so
286
+ * there's no duplication between the agent and the action.
287
+ */
288
+ async persistRuntimeAction(payload, contextUser, createdByAgentId) {
289
+ const engine = ActionEngineServer.Instance;
290
+ if (!engine.Actions || engine.Actions.length === 0) {
291
+ await engine.Config(false, contextUser);
292
+ }
293
+ const createAction = engine.Actions.find((a) => a.Name?.trim().toLowerCase() === 'create runtime action');
294
+ if (!createAction) {
295
+ throw new Error('Create Runtime Action record not found in the ActionEngine catalog. ' +
296
+ 'Ensure ActionSmith has access to it or that the metadata is loaded.');
297
+ }
298
+ const runParams = [];
299
+ const push = (name, value) => {
300
+ const p = new ActionParam();
301
+ p.Name = name;
302
+ p.Value = value;
303
+ p.Type = 'Input';
304
+ runParams.push(p);
305
+ };
306
+ push('Name', payload.name);
307
+ push('Description', payload.description);
308
+ push('Code', payload.code);
309
+ // `Create Runtime Action` expects the whole RuntimeActionConfiguration
310
+ // JSON — permissions + limits. It re-validates via the Zod schema
311
+ // internally, so a malformed shape surfaces as INVALID_CONFIG there
312
+ // and we catch it as an error thrown on !Success.
313
+ push('Configuration', {
314
+ permissions: payload.permissions ?? {},
315
+ limits: payload.limits ?? {}
316
+ });
317
+ push('InputParams', this.schemaToParamSpec(payload.inputSchema, 'Input'));
318
+ push('OutputParams', this.schemaToParamSpec(payload.outputSchema, 'Output'));
319
+ push('ResultCodes', payload.resultCodes ?? []);
320
+ if (payload.categoryId)
321
+ push('CategoryID', payload.categoryId);
322
+ if (payload.limits?.maxExecutionTimeMs != null) {
323
+ push('MaxExecutionTimeMS', payload.limits.maxExecutionTimeMs);
324
+ }
325
+ if (createdByAgentId)
326
+ push('CreatedByAgentID', createdByAgentId);
327
+ const result = await engine.RunAction({
328
+ Action: createAction,
329
+ ContextUser: contextUser,
330
+ Filters: [],
331
+ Params: runParams,
332
+ SkipActionLog: false
333
+ });
334
+ if (!result.Success) {
335
+ throw new Error(result.Message ??
336
+ `Create Runtime Action returned Success=false with no message.`);
337
+ }
338
+ const actionId = this.readOutputParam(result.Params, 'ActionID');
339
+ const approvalStatus = this.readOutputParam(result.Params, 'CodeApprovalStatus') ?? 'Pending';
340
+ if (!actionId) {
341
+ throw new Error(`Create Runtime Action reported Success but did not return an ActionID output.`);
342
+ }
343
+ return { actionId, approvalStatus };
344
+ }
345
+ schemaToParamSpec(schema, type) {
346
+ if (!schema)
347
+ return [];
348
+ return Object.entries(schema).map(([name, rawDef]) => {
349
+ const def = (rawDef ?? {});
350
+ return {
351
+ name,
352
+ type: def.type ?? 'string',
353
+ description: def.description ?? undefined,
354
+ required: type === 'Input' ? Boolean(def.required) : false
355
+ };
356
+ });
357
+ }
358
+ readOutputParam(params, name) {
359
+ if (!params)
360
+ return undefined;
361
+ const hit = params.find((p) => p?.Name?.trim().toLowerCase() === name.toLowerCase() &&
362
+ (p.Type === 'Output' || p.Type === 'Both'));
363
+ return hit?.Value == null ? undefined : String(hit.Value);
364
+ }
365
+ };
366
+ ActionSmithAgent = __decorate([
367
+ RegisterClass(BaseAgent, 'ActionSmithAgent')
368
+ ], ActionSmithAgent);
369
+ export { ActionSmithAgent };
370
+ // Silence the unused-import warning — UUIDsEqual is kept for future use
371
+ // by subclasses that want to match on action IDs rather than names.
372
+ void UUIDsEqual;
373
+ //# sourceMappingURL=actionsmith-agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actionsmith-agent.js","sourceRoot":"","sources":["../../../src/custom/ai/actionsmith-agent.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAY,MAAM,sBAAsB,CAAC;AAO1D,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AA2C3D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,SAAS;IAC3C;;;;;;;;;;;;;;;;;;;;;OAqBG;IACgB,KAAK,CAAC,oBAAoB,CACzC,MAA0B,EAC1B,QAA8B,EAC9B,cAAiB,EACjB,QAAoC,EACpC,WAA2C;QAE3C,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,oBAAoB,CAC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CAAC,CAAC,EAAE,EAAE,CACF,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,WAAW,EAAE;YACpD,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CACjD,CAAC;QACF,OAAO,GAAG,EAAE,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC9D,CAAC;CACJ,CAAA;AA/YY,gBAAgB;IAD5B,aAAa,CAAC,SAAS,EAAE,kBAAkB,CAAC;GAChC,gBAAgB,CA+Y5B;;AAED,wEAAwE;AACxE,oEAAoE;AACpE,KAAK,UAAU,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { ActionResultSimple, RunActionParams } from '@memberjunction/actions-base';
2
+ import { BaseAction } from '@memberjunction/actions';
3
+ /**
4
+ * Persists a new Runtime action to the Actions catalog with
5
+ * `CodeApprovalStatus='Pending'`. Used by the ActionSmith agent as the
6
+ * last step of the "generate, test, submit for approval" pipeline.
7
+ *
8
+ * Responsibilities:
9
+ * - Validate the supplied `RuntimeActionConfiguration` against the Zod
10
+ * schema — invalid configs are rejected before anything hits the DB.
11
+ * - Create the Action row with Type='Runtime', the author-agent link,
12
+ * and the JSON-serialized configuration stored via the generated
13
+ * `RuntimeActionConfigurationObject` accessor.
14
+ * - Create ActionParam rows for declared inputs and outputs.
15
+ * - Create ActionResultCode rows for declared result codes.
16
+ *
17
+ * The action record is NOT activated. `CodeApprovalStatus` is 'Pending'
18
+ * until a human reviews the code + permissions through the approval UI.
19
+ */
20
+ export declare class CreateRuntimeActionAction extends BaseAction {
21
+ protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
22
+ private createActionParam;
23
+ private createResultCode;
24
+ private getParamValue;
25
+ private getStringParam;
26
+ private getNumericParam;
27
+ private getObjectParam;
28
+ private setOutputParam;
29
+ }
30
+ /** Tree-shaking prevention hook called from the CoreActions public API. */
31
+ export declare function LoadCreateRuntimeActionAction(): void;
32
+ //# sourceMappingURL=create-runtime-action.action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-runtime-action.action.d.ts","sourceRoot":"","sources":["../../../src/custom/ai/create-runtime-action.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAChG,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAWrD;;;;;;;;;;;;;;;;GAgBG;AACH,qBACa,yBAA0B,SAAQ,UAAU;cACrC,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;YAsGzE,iBAAiB;YAgCjB,gBAAgB;IA+B9B,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,cAAc;CAgBzB;AA0BD,2EAA2E;AAC3E,wBAAgB,6BAA6B,IAAI,IAAI,CAEpD"}