@memberjunction/ng-agents 6.1.0-edge.1 → 6.1.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-invocations.component.js","sourceRoot":"","sources":["../../../src/lib/components/agent-invocations.component.ts","../../../src/lib/components/agent-invocations.component.html"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EACH,uBAAuB,EAEvB,SAAS,EACT,YAAY,EACZ,KAAK,EACL,MAAM,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAWrE,OAAO,EACH,YAAY,EACZ,uBAAuB,EACvB,YAAY,EACZ,gBAAgB,EAChB,MAAM,EACN,sBAAsB,EACtB,oBAAoB,GAIvB,MAAM,2BAA2B,CAAC;;;;;;;ICnD/B,gCAA0F;;;IAE1F,8BAA2D;;;IAAjC,0CAAqB;;;IAoB7C,qCAIiB;;;;IA0BH,kCACoC;IADiB,yRAAS,iCAAuB,KAAC;IAEpF,gCAAsC;IAAA,YAAmB;IAAA,iBAAO;IAChE,gCAAwC;IAAA,YAAqB;IAC/D,AAD+D,iBAAO,EAC7D;;;IAHP,kDAAiC;IACK,eAAmB;IAAnB,sCAAmB;IACjB,eAAqB;IAArB,wCAAqB;;;IAI7D,AADF,+BAAmE,eAC3B;IAAA,YAAmB;IAAA,iBAAO;IAChE,gCAAwC;IAAA,YAAqB;IAC/D,AAD+D,iBAAO,EAChE;;;IAFkC,eAAmB;IAAnB,sCAAmB;IACjB,eAAqB;IAArB,wCAAqB;;;IAM7D,gCAAsD;IACpD,wBAAsD;IAAC,YACzD;IAAA,iBAAO;;IADkD,eACzD;IADyD,oCACzD;;;IAGA,gCAAsD;IACpD,wBAAgE;IAAC,YACnE;IAAA,iBAAO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AI,CAAC,OAAO,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,2CAA2C,CAAC;QACpJ,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,wBAAwB,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC;IACtE,CAAC;mHAzVQ,yBAAyB;6DAAzB,yBAAyB;YCvEtC,8BAA0B;YAKtB,AAFA,AAFF,kGAA+B,0EAEP,4DAEf;YAwFX,iBAAM;;YA5FJ,cA2FC;YA3FD,6EA2FC;;;iFDrBU,yBAAyB;cAPrC,SAAS;6BACM,KAAK,YACP,sBAAsB,mBAGf,uBAAuB,CAAC,MAAM;;kBAO9C,KAAK;;kBAkBL,KAAK;;kBAUL,KAAK;;kBAGL,KAAK;;kBACL,KAAK;;kBAGL,MAAM;;kFAxCE,yBAAyB","sourcesContent":["/**\n * @fileoverview \"Everywhere this agent runs without anyone pressing Run.\"\n *\n * **The gap this closes.** MJ has never lacked ways to invoke an agent automatically — Scheduled\n * Jobs, User Routines, Entity Action bindings, Record Processes, a Sub-Agent step inside another\n * agent's flow. What it lacked was the *inverse* index. Every one of those substrates knows which\n * agent it calls; none of them can be asked the question from the other end, so standing on an agent\n * record there was no way to learn what fires it short of checking five admin surfaces by hand. In\n * practice that means nobody checked — and an agent quietly running on a schedule somebody set up\n * months ago is exactly the thing an owner needs to see first.\n *\n * **Read-only, by design.** This surface answers a question; it does not change any answer. Editing\n * a schedule belongs in Scheduling, editing a binding belongs in Entity Actions, and putting a\n * second editor here would be a second set of rules about what a valid trigger is. Every row instead\n * emits {@link AgentInvocationsComponent.RecordOpenRequested} so the host can navigate to the\n * substrate that owns it.\n *\n * **Layer: `widgets`.** No Router, no `NavigationService`, no global provider. Navigation leaves as\n * intent; data is read through `this.ProviderToUse`.\n *\n * @module @memberjunction/ng-agents\n */\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n Input,\n Output,\n} from '@angular/core';\nimport { RunView } from '@memberjunction/core';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport type {\n MJAIAgentRelationshipEntity,\n MJAIAgentStepEntity,\n MJEntityActionEntity,\n MJEntityActionInvocationEntity,\n MJEntityActionParamEntity,\n MJRecordProcessEntity,\n MJScheduledJobEntity,\n MJUserRoutineEntity,\n} from '@memberjunction/core-entities';\nimport {\n DescribeCron,\n DescribeInvocationTypes,\n DescribeWhen,\n GroupInvocations,\n IsUUID,\n ResolveInvocationState,\n SummarizeInvocations,\n type AgentInvocationGroup,\n type AgentInvocationPathway,\n type AgentInvocationSummary,\n} from './agent-invocations.model';\n\n/** Emitted when a row is activated. The host decides how to open it — this widget has no Router. */\nexport class AgentInvocationOpenRequestedEventArgs {\n constructor(\n public readonly EntityName: string,\n public readonly RecordID: string,\n public readonly Pathway: AgentInvocationPathway,\n ) {}\n}\n\n@Component({\n standalone: false,\n selector: 'mj-agent-invocations',\n templateUrl: './agent-invocations.component.html',\n styleUrls: ['./agent-invocations.component.css'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AgentInvocationsComponent extends BaseAngularComponent {\n /**\n * The agent to index. Setter-based per repo convention — the reaction is explicit and runs only\n * when the id actually changes, rather than on every change-detection pass.\n */\n @Input()\n public set AgentID(value: string | null) {\n if (value === this.agentID) return;\n this.agentID = value;\n this.HasLoaded = false;\n if (value && this.Active) void this.Load();\n }\n public get AgentID(): string | null {\n return this.agentID;\n }\n\n /**\n * Whether the surface is currently on screen.\n *\n * The host keeps this component alive across tab switches (so a return trip is instant), which\n * means without this it would issue six queries for a tab nobody has opened. Flipping to true\n * triggers the first load; flipping back does nothing.\n */\n @Input()\n public set Active(value: boolean) {\n this.active = value;\n if (value && this.agentID && !this.HasLoaded && !this.IsLoading) void this.Load();\n }\n public get Active(): boolean {\n return this.active;\n }\n\n /** The agent's own `ExposeAsAction` flag — a pathway that lives on the agent, not in another table. */\n @Input() public ExposeAsAction: boolean = false;\n\n /** The agent's parent, when it is a child sub-agent. Named so the row can say who calls it. */\n @Input() public ParentAgentName: string | null = null;\n @Input() public ParentAgentID: string | null = null;\n\n /** Intent only — the host navigates. */\n @Output() public RecordOpenRequested = new EventEmitter<AgentInvocationOpenRequestedEventArgs>();\n\n public IsLoading = false;\n public HasLoaded = false;\n public LoadError: string | null = null;\n public Groups: AgentInvocationGroup[] = [];\n public Summary: AgentInvocationSummary = { Total: 0, Live: 0, IsAutomated: false, NextRunAt: null };\n\n private agentID: string | null = null;\n private active = false;\n\n constructor(private cdr: ChangeDetectorRef) {\n super();\n }\n\n /**\n * Rebuilds the index.\n *\n * Public so a host can offer Refresh, and so an agent-context tool can drive it — the same\n * entry point either way, rather than a private loader plus a public wrapper that can drift.\n */\n public async Load(): Promise<void> {\n const id = this.agentID;\n if (!id || !IsUUID(id)) {\n this.Groups = [];\n this.Summary = SummarizeInvocations([]);\n this.HasLoaded = true;\n this.cdr.markForCheck();\n return;\n }\n\n this.IsLoading = true;\n this.LoadError = null;\n this.cdr.markForCheck();\n try {\n const pathways = [\n ...(await this.loadDirectPathways(id)),\n ...(await this.loadDataChangePathways(id)),\n ...this.loadAgentPathways(),\n ];\n this.Groups = GroupInvocations(pathways);\n this.Summary = SummarizeInvocations(pathways);\n this.HasLoaded = true;\n } catch (e) {\n this.LoadError = e instanceof Error ? e.message : String(e);\n this.Groups = [];\n this.Summary = SummarizeInvocations([]);\n } finally {\n this.IsLoading = false;\n this.cdr.markForCheck();\n }\n }\n\n /**\n * The four substrates that name the agent by id on their own row, in one round trip.\n *\n * Batched through `RunViews` rather than four awaited calls: this is one screen, and four\n * sequential round trips is the difference between a tab that opens and a tab that loads.\n */\n private async loadDirectPathways(agentID: string): Promise<AgentInvocationPathway[]> {\n const rv = RunView.FromMetadataProvider(this.ProviderToUse);\n const [jobs, routines, processes, steps, relationships] = await rv.RunViews([\n {\n EntityName: 'MJ: Scheduled Jobs',\n // `Configuration` is free-form JSON, so there is no column to equal. The id is\n // UUID-checked above, which is what makes this concatenation safe.\n ExtraFilter: `Configuration LIKE '%${agentID}%'`,\n OrderBy: 'Name ASC',\n ResultType: 'entity_object',\n },\n {\n EntityName: 'MJ: User Routines',\n ExtraFilter: `TargetType='Agent' AND TargetID='${agentID}'`,\n OrderBy: 'Name ASC',\n ResultType: 'entity_object',\n },\n {\n EntityName: 'MJ: Record Processes',\n ExtraFilter: `WorkType='Agent' AND AgentID='${agentID}'`,\n OrderBy: 'Name ASC',\n ResultType: 'entity_object',\n },\n {\n EntityName: 'MJ: AI Agent Steps',\n ExtraFilter: `SubAgentID='${agentID}'`,\n OrderBy: 'Name ASC',\n ResultType: 'entity_object',\n },\n {\n EntityName: 'MJ: AI Agent Relationships',\n ExtraFilter: `SubAgentID='${agentID}'`,\n ResultType: 'entity_object',\n },\n ]);\n\n const out: AgentInvocationPathway[] = [];\n\n if (jobs.Success) {\n for (const job of jobs.Results as MJScheduledJobEntity[]) {\n out.push({\n Kind: 'Schedule',\n Title: job.Name,\n Trigger: DescribeCron(job.CronExpression, job.Timezone),\n State: ResolveInvocationState(job.Status),\n StateDetail: this.explainState(job.Status),\n EntityName: 'MJ: Scheduled Jobs',\n RecordID: job.ID,\n LastRunAt: job.LastRunAt,\n NextRunAt: job.NextRunAt,\n });\n }\n }\n\n if (routines.Success) {\n for (const routine of routines.Results as MJUserRoutineEntity[]) {\n out.push({\n Kind: 'Routine',\n Title: routine.Name,\n // A Monitoring routine still runs on a cron; what differs is that it only speaks\n // up when its condition holds, which is worth saying rather than implying.\n Trigger:\n routine.RoutineType === 'Monitoring'\n ? `${DescribeCron(routine.CronExpression, routine.Timezone)} — reports only when something changed`\n : DescribeCron(routine.CronExpression, routine.Timezone),\n State: ResolveInvocationState(routine.Status),\n StateDetail: this.explainState(routine.Status),\n EntityName: 'MJ: User Routines',\n RecordID: routine.ID,\n LastRunAt: routine.LastRunAt,\n NextRunAt: routine.NextRunAt,\n });\n }\n }\n\n if (processes.Success) {\n for (const process of processes.Results as MJRecordProcessEntity[]) {\n out.push({\n Kind: 'BulkOperation',\n Title: process.Name,\n Trigger: `Across ${process.Entity} records, when the operation is run`,\n State: ResolveInvocationState(process.Status),\n StateDetail: this.explainState(process.Status),\n EntityName: 'MJ: Record Processes',\n RecordID: process.ID,\n });\n }\n }\n\n if (steps.Success) {\n for (const step of steps.Results as MJAIAgentStepEntity[]) {\n out.push({\n Kind: 'CalledByAgent',\n Title: step.Agent ?? 'Another agent',\n Trigger: `As the \"${step.Name}\" step`,\n State: ResolveInvocationState(step.Status),\n StateDetail: this.explainState(step.Status),\n // The step's owner is what someone wants to open, not the step row — the step is\n // only reachable, and only meaningful, inside that agent's editor.\n EntityName: 'MJ: AI Agents',\n RecordID: step.AgentID,\n });\n }\n }\n\n if (relationships.Success) {\n for (const rel of relationships.Results as MJAIAgentRelationshipEntity[]) {\n out.push({\n Kind: 'CalledByAgent',\n Title: rel.Agent ?? 'Another agent',\n Trigger: 'As a related sub-agent',\n State: ResolveInvocationState(rel.Status),\n StateDetail: this.explainState(rel.Status),\n EntityName: 'MJ: AI Agents',\n RecordID: rel.AgentID,\n });\n }\n }\n\n return out;\n }\n\n /**\n * Entity-change bindings, which name the agent one table further out.\n *\n * An Entity Action does not reference an agent; it references the `Execute Agent` action, and the\n * agent lives in that binding's `AgentID` **parameter**. So this walks params → bindings →\n * invocation types. Three steps, but each one is a single batched query, and skipping straight to\n * the bindings would find every agent-dispatching binding rather than this agent's.\n */\n private async loadDataChangePathways(agentID: string): Promise<AgentInvocationPathway[]> {\n const rv = RunView.FromMetadataProvider(this.ProviderToUse);\n const params = await rv.RunView<MJEntityActionParamEntity>({\n EntityName: 'MJ: Entity Action Params',\n ExtraFilter: `ActionParam='AgentID' AND Value='${agentID}'`,\n ResultType: 'entity_object',\n });\n if (!params.Success || (params.Results ?? []).length === 0) return [];\n\n const bindingIDs = [...new Set((params.Results ?? []).map((p) => p.EntityActionID))].filter(IsUUID);\n if (bindingIDs.length === 0) return [];\n const idList = bindingIDs.map((id) => `'${id}'`).join(',');\n\n const [bindings, invocations] = await rv.RunViews([\n {\n EntityName: 'MJ: Entity Actions',\n ExtraFilter: `ID IN (${idList})`,\n ResultType: 'entity_object',\n },\n {\n EntityName: 'MJ: Entity Action Invocations',\n ExtraFilter: `EntityActionID IN (${idList})`,\n ResultType: 'entity_object',\n },\n ]);\n if (!bindings.Success) return [];\n\n const invocationsByBinding = new Map<string, MJEntityActionInvocationEntity[]>();\n if (invocations.Success) {\n for (const inv of invocations.Results as MJEntityActionInvocationEntity[]) {\n const list = invocationsByBinding.get(inv.EntityActionID) ?? [];\n list.push(inv);\n invocationsByBinding.set(inv.EntityActionID, list);\n }\n }\n\n return (bindings.Results as MJEntityActionEntity[]).map((binding) => {\n // Only the ACTIVE invocation types describe when this actually fires. Including disabled\n // ones would tell someone the agent runs on delete when that hook is switched off.\n const live = (invocationsByBinding.get(binding.ID) ?? []).filter((i) => i.Status === 'Active');\n return {\n Kind: 'DataChange' as const,\n Title: binding.Entity,\n Trigger: DescribeInvocationTypes(live.map((i) => i.InvocationType)),\n State: ResolveInvocationState(binding.Status),\n StateDetail: this.explainState(binding.Status),\n EntityName: 'MJ: Entity Actions',\n RecordID: binding.ID,\n };\n });\n }\n\n /** The pathways carried on the agent's own record rather than in another table. */\n private loadAgentPathways(): AgentInvocationPathway[] {\n const out: AgentInvocationPathway[] = [];\n\n if (this.ExposeAsAction) {\n out.push({\n Kind: 'ExposedAsAction',\n Title: 'Exposed as an action',\n Trigger: 'Any action caller — another agent, a binding, an integration — can run this',\n State: 'Live',\n });\n }\n\n if (this.ParentAgentName) {\n out.push({\n Kind: 'CalledByAgent',\n Title: this.ParentAgentName,\n Trigger: 'As a child sub-agent',\n State: 'Live',\n EntityName: this.ParentAgentID ? 'MJ: AI Agents' : undefined,\n RecordID: this.ParentAgentID ?? undefined,\n });\n }\n\n return out;\n }\n\n /** Says why a pathway will not fire. Returns undefined when it will — there is nothing to explain. */\n private explainState(status: string | null | undefined): string | undefined {\n const normalized = (status ?? '').trim();\n switch (ResolveInvocationState(normalized)) {\n case 'Live':\n return undefined;\n case 'Paused':\n return 'Paused — it will not fire until someone resumes it';\n default:\n return normalized ? `${normalized} — it will not fire` : 'Switched off';\n }\n }\n\n public OnRowActivated(pathway: AgentInvocationPathway): void {\n if (!pathway.EntityName || !pathway.RecordID) return;\n this.RecordOpenRequested.emit(\n new AgentInvocationOpenRequestedEventArgs(pathway.EntityName, pathway.RecordID, pathway),\n );\n }\n\n /** Template helper — coarse relative time, computed at render rather than stored. */\n public When(value: Date | null | undefined): string | null {\n return DescribeWhen(value, new Date());\n }\n\n /** Template helper: the header line, phrased for whichever case the agent is in. */\n public get SummaryLine(): string {\n if (this.Summary.Total === 0) {\n return 'Nothing runs this agent automatically — it only runs when someone asks it to.';\n }\n if (this.Summary.Live === 0) {\n const n = this.Summary.Total;\n return `${n} pathway${n === 1 ? '' : 's'} point here, but none of them can fire right now.`;\n }\n const next = this.When(this.Summary.NextRunAt);\n const base = `${this.Summary.Live} of ${this.Summary.Total} pathway${this.Summary.Total === 1 ? '' : 's'} can run this agent without anyone asking`;\n return next ? `${base}. Next scheduled run ${next}.` : `${base}.`;\n }\n}\n","<div class=\"mj-agent-inv\">\n @if (IsLoading && !HasLoaded) {\n <mj-loading text=\"Finding everywhere this agent is invoked...\" size=\"medium\"></mj-loading>\n } @else if (LoadError) {\n <mj-alert Variant=\"error\" [Message]=\"LoadError\"></mj-alert>\n } @else {\n <!-- The one-glance answer. Stated as a sentence rather than a row of numbers, because the\n question this surface exists for (\"does this thing run on its own?\") has a yes/no shape. -->\n <div class=\"mj-agent-inv__summary\" [class.mj-agent-inv__summary--automated]=\"Summary.IsAutomated\">\n <span class=\"mj-agent-inv__summary-icon\">\n <i class=\"fa-solid\" [ngClass]=\"Summary.IsAutomated ? 'fa-tower-broadcast' : 'fa-hand'\" aria-hidden=\"true\"></i>\n </span>\n <div class=\"mj-agent-inv__summary-text\">\n <span class=\"mj-agent-inv__summary-line\">{{ SummaryLine }}</span>\n <span class=\"mj-agent-inv__summary-hint\">\n Manual runs are not listed — this is only what happens without anyone present.\n </span>\n </div>\n <button mjButton variant=\"outline\" size=\"sm\" (click)=\"Load()\" [disabled]=\"IsLoading\" title=\"Re-check every source\">\n <i class=\"fa-solid fa-refresh\" [class.fa-spin]=\"IsLoading\" aria-hidden=\"true\"></i>\n </button>\n </div>\n\n @if (Groups.length === 0) {\n <mj-empty-state\n Icon=\"fa-solid fa-hand\"\n Title=\"Nothing invokes this agent automatically\"\n Message=\"Give it a schedule, bind it to a data change, or call it from another agent — and every one of those will show up here.\">\n </mj-empty-state>\n } @else {\n <div class=\"mj-agent-inv__groups\">\n @for (group of Groups; track group.Kind) {\n <section class=\"mj-agent-inv__group\">\n <header class=\"mj-agent-inv__group-head\">\n <span class=\"mj-agent-inv__group-icon\"><i [class]=\"group.Icon\" aria-hidden=\"true\"></i></span>\n <div class=\"mj-agent-inv__group-title\">\n <h3>{{ group.Label }}</h3>\n <p>{{ group.Blurb }}</p>\n </div>\n <span\n class=\"mj-agent-inv__group-count\"\n [class.mj-agent-inv__group-count--live]=\"group.LiveCount > 0\"\n [title]=\"group.LiveCount + ' of ' + group.Pathways.length + ' can fire right now'\">\n {{ group.LiveCount }}/{{ group.Pathways.length }}\n </span>\n </header>\n\n <ul class=\"mj-agent-inv__rows\">\n @for (pathway of group.Pathways; track $index) {\n <li class=\"mj-agent-inv__row\" [class.mj-agent-inv__row--muted]=\"pathway.State !== 'Live'\">\n <!-- A row with a record behind it is a button so it is reachable by keyboard; one\n without (Exposed as an action is a flag, not a row) is plain text rather than a\n button that would look clickable and do nothing. -->\n @if (pathway.EntityName && pathway.RecordID) {\n <button type=\"button\" class=\"mj-agent-inv__row-main\" (click)=\"OnRowActivated(pathway)\"\n [title]=\"'Open ' + pathway.Title\">\n <span class=\"mj-agent-inv__row-title\">{{ pathway.Title }}</span>\n <span class=\"mj-agent-inv__row-trigger\">{{ pathway.Trigger }}</span>\n </button>\n } @else {\n <div class=\"mj-agent-inv__row-main mj-agent-inv__row-main--static\">\n <span class=\"mj-agent-inv__row-title\">{{ pathway.Title }}</span>\n <span class=\"mj-agent-inv__row-trigger\">{{ pathway.Trigger }}</span>\n </div>\n }\n\n <div class=\"mj-agent-inv__row-meta\">\n @if (When(pathway.NextRunAt); as next) {\n <span class=\"mj-agent-inv__row-next\" title=\"Next run\">\n <i class=\"fa-solid fa-forward\" aria-hidden=\"true\"></i> {{ next }}\n </span>\n }\n @if (When(pathway.LastRunAt); as last) {\n <span class=\"mj-agent-inv__row-last\" title=\"Last run\">\n <i class=\"fa-solid fa-clock-rotate-left\" aria-hidden=\"true\"></i> {{ last }}\n </span>\n }\n <span\n class=\"mj-agent-inv__state\"\n [class.mj-agent-inv__state--live]=\"pathway.State === 'Live'\"\n [class.mj-agent-inv__state--paused]=\"pathway.State === 'Paused'\"\n [title]=\"pathway.StateDetail || 'This can fire right now'\">\n {{ pathway.State }}\n </span>\n </div>\n </li>\n }\n </ul>\n </section>\n }\n </div>\n }\n }\n</div>\n"]}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * @fileoverview The shape of "everywhere this agent runs without anyone pressing Run", and the pure
3
+ * functions that derive it.
4
+ *
5
+ * **Why this exists.** MJ already has every mechanism an agent needs to be invoked automatically —
6
+ * Scheduled Jobs, User Routines, Entity Actions, Record Processes, a step inside another agent's
7
+ * flow. What it has never had is the *inverse* index: standing on an agent and asking "what fires
8
+ * me?" Answering that meant knowing all five substrates existed and checking each one by hand, so in
9
+ * practice nobody answered it — which is how an agent ends up quietly running on a schedule someone
10
+ * set up months ago and forgot.
11
+ *
12
+ * **Pure on purpose.** Everything here is data-in/data-out so the interesting decisions — what counts
13
+ * as live, how a cron reads in English, which pathway outranks which — are unit-testable without a
14
+ * database or a browser. The component does the querying; this does the thinking.
15
+ *
16
+ * @module @memberjunction/ng-agents
17
+ */
18
+ /**
19
+ * The substrates an agent can be invoked from.
20
+ *
21
+ * Not an open-ended string: each arm has a runner behind it, and a pathway with no substrate is a
22
+ * pathway nobody can trace back to a row.
23
+ */
24
+ export type AgentInvocationKind =
25
+ /** A Scheduled Job whose configuration names this agent. */
26
+ 'Schedule'
27
+ /** A User Routine targeting this agent — a person's own recurring ask. */
28
+ | 'Routine'
29
+ /** An Entity Action binding: a data change on some entity dispatches this agent. */
30
+ | 'DataChange'
31
+ /** A Record Process that runs this agent across a set of records. */
32
+ | 'BulkOperation'
33
+ /** A step or relationship inside another agent that delegates here. */
34
+ | 'CalledByAgent'
35
+ /** `ExposeAsAction` — anything that can run an Action can run this agent. */
36
+ | 'ExposedAsAction';
37
+ /**
38
+ * Whether a pathway can actually fire right now.
39
+ *
40
+ * Three states rather than a boolean because "switched off" and "switched on but its owner is
41
+ * disabled" are different problems with different fixes, and collapsing them would hide the second.
42
+ */
43
+ export type AgentInvocationState = 'Live' | 'Paused' | 'Off';
44
+ /** One concrete way this agent gets invoked, traceable back to the row that says so. */
45
+ export type AgentInvocationPathway = {
46
+ Kind: AgentInvocationKind;
47
+ /** What the user reads first — the job's name, the calling agent's name, the entity. */
48
+ Title: string;
49
+ /** One line answering "when does this fire?" in the user's language, never cron syntax alone. */
50
+ Trigger: string;
51
+ State: AgentInvocationState;
52
+ /** Why it is not Live, when it is not. Absent for a Live pathway — nothing to explain. */
53
+ StateDetail?: string;
54
+ /** The row behind this pathway, so the host can open it. Absent for `ExposedAsAction`, which is a flag on the agent itself. */
55
+ EntityName?: string;
56
+ RecordID?: string;
57
+ LastRunAt?: Date | null;
58
+ NextRunAt?: Date | null;
59
+ };
60
+ /** Pathways of one kind, with the chrome needed to render the group. */
61
+ export type AgentInvocationGroup = {
62
+ Kind: AgentInvocationKind;
63
+ Label: string;
64
+ Icon: string;
65
+ /** What this substrate *is*, for someone who has not met it before. */
66
+ Blurb: string;
67
+ Pathways: AgentInvocationPathway[];
68
+ /** How many of them can fire right now. */
69
+ LiveCount: number;
70
+ };
71
+ /** The one-glance answer at the top of the surface. */
72
+ export type AgentInvocationSummary = {
73
+ Total: number;
74
+ Live: number;
75
+ /** True when at least one pathway can fire without a person. */
76
+ IsAutomated: boolean;
77
+ /** The soonest scheduled run across every pathway that knows its next run. */
78
+ NextRunAt: Date | null;
79
+ };
80
+ /**
81
+ * Buckets pathways into their groups, in a fixed order, dropping the empty ones.
82
+ *
83
+ * Empty groups are dropped rather than shown greyed: a surface answering "what invokes this?" that
84
+ * lists six headings with nothing under five of them buries the one real answer.
85
+ */
86
+ export declare function GroupInvocations(pathways: readonly AgentInvocationPathway[]): AgentInvocationGroup[];
87
+ /** The header line: how many pathways exist, how many are live, and when the next one fires. */
88
+ export declare function SummarizeInvocations(pathways: readonly AgentInvocationPathway[]): AgentInvocationSummary;
89
+ /**
90
+ * Maps a lifecycle status onto the three states this surface cares about.
91
+ *
92
+ * Every substrate spells its statuses differently (`Disabled`, `Paused`, `Revoked`, `Draft`,
93
+ * `Pending`) but they collapse into the same three questions, so the mapping lives here once rather
94
+ * than being re-decided per query.
95
+ */
96
+ export declare function ResolveInvocationState(status: string | null | undefined): AgentInvocationState;
97
+ /**
98
+ * Renders a cron expression as a sentence, and refuses to invent one it cannot justify.
99
+ *
100
+ * Covers the shapes people actually write — every N minutes, daily at a time, weekly on a day — and
101
+ * falls back to showing the raw expression for anything else. A humanizer that guesses produces a
102
+ * confident sentence describing a schedule the job does not have, which on this surface is worse
103
+ * than showing five fields the reader can look up.
104
+ */
105
+ export declare function DescribeCron(expression: string | null | undefined, timezone?: string | null): string;
106
+ /**
107
+ * Turns invocation-type names into the phrase a person would say.
108
+ *
109
+ * MJ names them `Create`, `Update`, `Delete`, `Validate`, `BeforeSave` and so on; a list of those on
110
+ * screen reads like schema. "when a record is created or updated" reads like an answer.
111
+ */
112
+ export declare function DescribeInvocationTypes(typeNames: readonly string[]): string;
113
+ /** `a`, `a or b`, `a, b or c` — the Oxford-free form people speak. */
114
+ export declare function joinWithOr(items: readonly string[]): string;
115
+ /**
116
+ * Whether a string is a plain UUID.
117
+ *
118
+ * Guards the one place a value reaches an `ExtraFilter` as a literal: `ScheduledJob.Configuration`
119
+ * is free-form JSON, so finding the jobs that name an agent means a `LIKE` against it, and a `LIKE`
120
+ * is string concatenation into SQL. Every id used that way is checked here first — the agent's own
121
+ * primary key always passes, and anything that does not is not queried at all.
122
+ */
123
+ export declare function IsUUID(value: string | null | undefined): boolean;
124
+ /**
125
+ * Renders a moment as something scannable — "in 3 hours", "2 days ago".
126
+ *
127
+ * Coarse on purpose: on this surface nobody needs the second, they need to know whether the last run
128
+ * was recent enough that the agent is still doing its job.
129
+ */
130
+ export declare function DescribeWhen(when: Date | null | undefined, now: Date): string | null;
131
+ //# sourceMappingURL=agent-invocations.model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-invocations.model.d.ts","sourceRoot":"","sources":["../../../src/lib/components/agent-invocations.model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB;AAC3B,4DAA4D;AAC1D,UAAU;AACZ,0EAA0E;GACxE,SAAS;AACX,oFAAoF;GAClF,YAAY;AACd,qEAAqE;GACnE,eAAe;AACjB,uEAAuE;GACrE,eAAe;AACjB,6EAA6E;GAC3E,iBAAiB,CAAC;AAExB;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE7D,wFAAwF;AACxF,MAAM,MAAM,sBAAsB,GAAG;IACjC,IAAI,EAAE,mBAAmB,CAAC;IAC1B,wFAAwF;IACxF,KAAK,EAAE,MAAM,CAAC;IACd,iGAAiG;IACjG,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,oBAAoB,CAAC;IAC5B,0FAA0F;IAC1F,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+HAA+H;IAC/H,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE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I3D;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAEhE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CASpF"}
@@ -0,0 +1,253 @@
1
+ /**
2
+ * @fileoverview The shape of "everywhere this agent runs without anyone pressing Run", and the pure
3
+ * functions that derive it.
4
+ *
5
+ * **Why this exists.** MJ already has every mechanism an agent needs to be invoked automatically —
6
+ * Scheduled Jobs, User Routines, Entity Actions, Record Processes, a step inside another agent's
7
+ * flow. What it has never had is the *inverse* index: standing on an agent and asking "what fires
8
+ * me?" Answering that meant knowing all five substrates existed and checking each one by hand, so in
9
+ * practice nobody answered it — which is how an agent ends up quietly running on a schedule someone
10
+ * set up months ago and forgot.
11
+ *
12
+ * **Pure on purpose.** Everything here is data-in/data-out so the interesting decisions — what counts
13
+ * as live, how a cron reads in English, which pathway outranks which — are unit-testable without a
14
+ * database or a browser. The component does the querying; this does the thinking.
15
+ *
16
+ * @module @memberjunction/ng-agents
17
+ */
18
+ /**
19
+ * Display order and copy for each substrate.
20
+ *
21
+ * Ordered by how surprising the pathway is to someone auditing an agent: a schedule you set up is
22
+ * expected, another agent calling you is less so, and `ExposeAsAction` — which opens the agent to
23
+ * *anything* that can run an action — is the one most worth seeing last and largest.
24
+ */
25
+ const GROUP_CHROME = [
26
+ {
27
+ Kind: 'Schedule',
28
+ Label: 'Schedules',
29
+ Icon: 'fa-solid fa-clock',
30
+ Blurb: 'Runs on a recurring schedule, with no one present.',
31
+ },
32
+ {
33
+ Kind: 'Routine',
34
+ Label: 'Routines',
35
+ Icon: 'fa-solid fa-repeat',
36
+ Blurb: "Someone's own recurring request, run on their behalf.",
37
+ },
38
+ {
39
+ Kind: 'DataChange',
40
+ Label: 'Data changes',
41
+ Icon: 'fa-solid fa-bolt',
42
+ Blurb: 'Fires when a record is created, updated or deleted.',
43
+ },
44
+ {
45
+ Kind: 'BulkOperation',
46
+ Label: 'Bulk operations',
47
+ Icon: 'fa-solid fa-layer-group',
48
+ Blurb: 'Runs across a whole set of records in one pass.',
49
+ },
50
+ {
51
+ Kind: 'CalledByAgent',
52
+ Label: 'Called by other agents',
53
+ Icon: 'fa-solid fa-diagram-project',
54
+ Blurb: 'Another agent delegates part of its work here.',
55
+ },
56
+ {
57
+ Kind: 'ExposedAsAction',
58
+ Label: 'Available as an action',
59
+ Icon: 'fa-solid fa-plug',
60
+ Blurb: 'Anything that can run an action can run this agent.',
61
+ },
62
+ ];
63
+ /**
64
+ * Buckets pathways into their groups, in a fixed order, dropping the empty ones.
65
+ *
66
+ * Empty groups are dropped rather than shown greyed: a surface answering "what invokes this?" that
67
+ * lists six headings with nothing under five of them buries the one real answer.
68
+ */
69
+ export function GroupInvocations(pathways) {
70
+ const groups = [];
71
+ for (const chrome of GROUP_CHROME) {
72
+ const members = pathways.filter((p) => p.Kind === chrome.Kind);
73
+ if (members.length === 0)
74
+ continue;
75
+ groups.push({
76
+ ...chrome,
77
+ Pathways: members,
78
+ LiveCount: members.filter((p) => p.State === 'Live').length,
79
+ });
80
+ }
81
+ return groups;
82
+ }
83
+ /** The header line: how many pathways exist, how many are live, and when the next one fires. */
84
+ export function SummarizeInvocations(pathways) {
85
+ const live = pathways.filter((p) => p.State === 'Live');
86
+ const nextRuns = live
87
+ .map((p) => p.NextRunAt)
88
+ .filter((d) => d instanceof Date && !Number.isNaN(d.getTime()));
89
+ return {
90
+ Total: pathways.length,
91
+ Live: live.length,
92
+ IsAutomated: live.length > 0,
93
+ NextRunAt: nextRuns.length > 0 ? new Date(Math.min(...nextRuns.map((d) => d.getTime()))) : null,
94
+ };
95
+ }
96
+ /**
97
+ * Maps a lifecycle status onto the three states this surface cares about.
98
+ *
99
+ * Every substrate spells its statuses differently (`Disabled`, `Paused`, `Revoked`, `Draft`,
100
+ * `Pending`) but they collapse into the same three questions, so the mapping lives here once rather
101
+ * than being re-decided per query.
102
+ */
103
+ export function ResolveInvocationState(status) {
104
+ switch ((status ?? '').trim().toLowerCase()) {
105
+ case 'active':
106
+ return 'Live';
107
+ case 'paused':
108
+ return 'Paused';
109
+ // 'Pending' and 'Draft' are pre-live rather than switched off, but neither fires, and telling
110
+ // someone auditing an agent that a Draft "might run" would be the wrong kind of wrong.
111
+ default:
112
+ return 'Off';
113
+ }
114
+ }
115
+ /** Field-count-preserving cron parts, so a malformed expression is described as itself, not guessed at. */
116
+ const CRON_DOW = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
117
+ /**
118
+ * Renders a cron expression as a sentence, and refuses to invent one it cannot justify.
119
+ *
120
+ * Covers the shapes people actually write — every N minutes, daily at a time, weekly on a day — and
121
+ * falls back to showing the raw expression for anything else. A humanizer that guesses produces a
122
+ * confident sentence describing a schedule the job does not have, which on this surface is worse
123
+ * than showing five fields the reader can look up.
124
+ */
125
+ export function DescribeCron(expression, timezone) {
126
+ const raw = (expression ?? '').trim();
127
+ if (!raw)
128
+ return 'No schedule set';
129
+ const suffix = timezone && timezone.trim() && timezone.trim().toLowerCase() !== 'utc' ? ` (${timezone.trim()})` : '';
130
+ const parts = raw.split(/\s+/);
131
+ if (parts.length < 5)
132
+ return raw;
133
+ const [minute, hour, dayOfMonth, month, dayOfWeek] = parts;
134
+ const everyDate = dayOfMonth === '*' && month === '*';
135
+ // Captured explicitly rather than read back off `RegExp.$1`: that global is rewritten by the very
136
+ // next `.test()` in the same condition, so `*/6` in the hour field silently became "every 0 hours"
137
+ // the moment the minute field was checked alongside it.
138
+ const minuteStep = stepOf(minute);
139
+ const hourStep = stepOf(hour);
140
+ const isNumber = (v) => /^\d+$/.test(v);
141
+ if (everyDate && dayOfWeek === '*') {
142
+ if (hour === '*' && minuteStep !== null) {
143
+ return `Every ${minuteStep} minute${minuteStep === 1 ? '' : 's'}${suffix}`;
144
+ }
145
+ if (hour === '*' && isNumber(minute))
146
+ return `Hourly, at :${minute.padStart(2, '0')}${suffix}`;
147
+ if (hourStep !== null && isNumber(minute)) {
148
+ return `Every ${hourStep} hour${hourStep === 1 ? '' : 's'}${suffix}`;
149
+ }
150
+ if (isNumber(hour) && isNumber(minute))
151
+ return `Daily at ${formatClock(hour, minute)}${suffix}`;
152
+ }
153
+ if (everyDate && /^[0-6]$/.test(dayOfWeek) && /^\d+$/.test(hour) && /^\d+$/.test(minute)) {
154
+ return `Every ${CRON_DOW[Number(dayOfWeek)]} at ${formatClock(hour, minute)}${suffix}`;
155
+ }
156
+ // Nothing above matched with confidence. The expression itself is more honest than a guess.
157
+ return `${raw}${suffix}`;
158
+ }
159
+ function formatClock(hour, minute) {
160
+ return `${hour.padStart(2, '0')}:${minute.padStart(2, '0')}`;
161
+ }
162
+ /** The N in a `*&#47;N` cron field, or null when the field is not a step. */
163
+ function stepOf(field) {
164
+ const match = /^\*\/(\d+)$/.exec(field);
165
+ if (!match)
166
+ return null;
167
+ const n = Number(match[1]);
168
+ return Number.isFinite(n) && n > 0 ? n : null;
169
+ }
170
+ /**
171
+ * Turns invocation-type names into the phrase a person would say.
172
+ *
173
+ * MJ names them `Create`, `Update`, `Delete`, `Validate`, `BeforeSave` and so on; a list of those on
174
+ * screen reads like schema. "when a record is created or updated" reads like an answer.
175
+ */
176
+ export function DescribeInvocationTypes(typeNames) {
177
+ const verbs = typeNames
178
+ .map((n) => (n ?? '').trim())
179
+ .filter((n) => n.length > 0)
180
+ .map((n) => INVOCATION_VERBS[n.toLowerCase()] ?? n.toLowerCase());
181
+ const unique = [...new Set(verbs)];
182
+ if (unique.length === 0)
183
+ return 'On a data change';
184
+ return `When a record is ${joinWithOr(unique)}`;
185
+ }
186
+ const INVOCATION_VERBS = {
187
+ create: 'created',
188
+ created: 'created',
189
+ aftercreate: 'created',
190
+ update: 'updated',
191
+ updated: 'updated',
192
+ afterupdate: 'updated',
193
+ delete: 'deleted',
194
+ deleted: 'deleted',
195
+ afterdelete: 'deleted',
196
+ validate: 'validated',
197
+ beforesave: 'saved',
198
+ aftersave: 'saved',
199
+ beforedelete: 'deleted',
200
+ read: 'read',
201
+ };
202
+ /** `a`, `a or b`, `a, b or c` — the Oxford-free form people speak. */
203
+ export function joinWithOr(items) {
204
+ if (items.length === 0)
205
+ return '';
206
+ if (items.length === 1)
207
+ return items[0];
208
+ return `${items.slice(0, -1).join(', ')} or ${items[items.length - 1]}`;
209
+ }
210
+ /**
211
+ * Whether a string is a plain UUID.
212
+ *
213
+ * Guards the one place a value reaches an `ExtraFilter` as a literal: `ScheduledJob.Configuration`
214
+ * is free-form JSON, so finding the jobs that name an agent means a `LIKE` against it, and a `LIKE`
215
+ * is string concatenation into SQL. Every id used that way is checked here first — the agent's own
216
+ * primary key always passes, and anything that does not is not queried at all.
217
+ */
218
+ export function IsUUID(value) {
219
+ return /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test((value ?? '').trim());
220
+ }
221
+ /**
222
+ * Renders a moment as something scannable — "in 3 hours", "2 days ago".
223
+ *
224
+ * Coarse on purpose: on this surface nobody needs the second, they need to know whether the last run
225
+ * was recent enough that the agent is still doing its job.
226
+ */
227
+ export function DescribeWhen(when, now) {
228
+ if (!(when instanceof Date) || Number.isNaN(when.getTime()))
229
+ return null;
230
+ const deltaMs = when.getTime() - now.getTime();
231
+ const future = deltaMs > 0;
232
+ const mins = Math.round(Math.abs(deltaMs) / 60_000);
233
+ if (mins < 1)
234
+ return future ? 'in under a minute' : 'just now';
235
+ const phrase = describeSpan(mins);
236
+ return future ? `in ${phrase}` : `${phrase} ago`;
237
+ }
238
+ function describeSpan(mins) {
239
+ if (mins < 60)
240
+ return `${mins} minute${mins === 1 ? '' : 's'}`;
241
+ const hours = Math.round(mins / 60);
242
+ if (hours < 24)
243
+ return `${hours} hour${hours === 1 ? '' : 's'}`;
244
+ const days = Math.round(hours / 24);
245
+ if (days < 30)
246
+ return `${days} day${days === 1 ? '' : 's'}`;
247
+ const months = Math.round(days / 30);
248
+ if (months < 12)
249
+ return `${months} month${months === 1 ? '' : 's'}`;
250
+ const years = Math.round(months / 12);
251
+ return `${years} year${years === 1 ? '' : 's'}`;
252
+ }
253
+ //# sourceMappingURL=agent-invocations.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-invocations.model.js","sourceRoot":"","sources":["../../../src/lib/components/agent-invocations.model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAqEH;;;;;;GAMG;AACH,MAAM,YAAY,GAA6F;IAC3G;QACI,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,mBAAmB;QACzB,KAAK,EAAE,oDAAoD;KAC9D;IACD;QACI,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,oBAAoB;QAC1B,KAAK,EAAE,uDAAuD;KACjE;IACD;QACI,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE,qDAAqD;KAC/D;IACD;QACI,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,iBAAiB;QACxB,IAAI,EAAE,yBAAyB;QAC/B,KAAK,EAAE,iDAAiD;KAC3D;IACD;QACI,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,wBAAwB;QAC/B,IAAI,EAAE,6BAA6B;QACnC,KAAK,EAAE,gDAAgD;KAC1D;IACD;QACI,IAAI,EAAE,iBAAiB;QACvB,KAAK,EAAE,wBAAwB;QAC/B,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE,qDAAqD;KAC/D;CACJ,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAA2C;IACxE,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,MAAM,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,OAAO,GAAG,MAAM,SAAS,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;IACpE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IACtC,OAAO,GAAG,KAAK,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AACpD,CAAC","sourcesContent":["/**\n * @fileoverview The shape of \"everywhere this agent runs without anyone pressing Run\", and the pure\n * functions that derive it.\n *\n * **Why this exists.** MJ already has every mechanism an agent needs to be invoked automatically —\n * Scheduled Jobs, User Routines, Entity Actions, Record Processes, a step inside another agent's\n * flow. What it has never had is the *inverse* index: standing on an agent and asking \"what fires\n * me?\" Answering that meant knowing all five substrates existed and checking each one by hand, so in\n * practice nobody answered it — which is how an agent ends up quietly running on a schedule someone\n * set up months ago and forgot.\n *\n * **Pure on purpose.** Everything here is data-in/data-out so the interesting decisions — what counts\n * as live, how a cron reads in English, which pathway outranks which — are unit-testable without a\n * database or a browser. The component does the querying; this does the thinking.\n *\n * @module @memberjunction/ng-agents\n */\n\n/**\n * The substrates an agent can be invoked from.\n *\n * Not an open-ended string: each arm has a runner behind it, and a pathway with no substrate is a\n * pathway nobody can trace back to a row.\n */\nexport type AgentInvocationKind =\n /** A Scheduled Job whose configuration names this agent. */\n | 'Schedule'\n /** A User Routine targeting this agent — a person's own recurring ask. */\n | 'Routine'\n /** An Entity Action binding: a data change on some entity dispatches this agent. */\n | 'DataChange'\n /** A Record Process that runs this agent across a set of records. */\n | 'BulkOperation'\n /** A step or relationship inside another agent that delegates here. */\n | 'CalledByAgent'\n /** `ExposeAsAction` — anything that can run an Action can run this agent. */\n | 'ExposedAsAction';\n\n/**\n * Whether a pathway can actually fire right now.\n *\n * Three states rather than a boolean because \"switched off\" and \"switched on but its owner is\n * disabled\" are different problems with different fixes, and collapsing them would hide the second.\n */\nexport type AgentInvocationState = 'Live' | 'Paused' | 'Off';\n\n/** One concrete way this agent gets invoked, traceable back to the row that says so. */\nexport type AgentInvocationPathway = {\n Kind: AgentInvocationKind;\n /** What the user reads first — the job's name, the calling agent's name, the entity. */\n Title: string;\n /** One line answering \"when does this fire?\" in the user's language, never cron syntax alone. */\n Trigger: string;\n State: AgentInvocationState;\n /** Why it is not Live, when it is not. Absent for a Live pathway — nothing to explain. */\n StateDetail?: string;\n /** The row behind this pathway, so the host can open it. Absent for `ExposedAsAction`, which is a flag on the agent itself. */\n EntityName?: string;\n RecordID?: string;\n LastRunAt?: Date | null;\n NextRunAt?: Date | null;\n};\n\n/** Pathways of one kind, with the chrome needed to render the group. */\nexport type AgentInvocationGroup = {\n Kind: AgentInvocationKind;\n Label: string;\n Icon: string;\n /** What this substrate *is*, for someone who has not met it before. */\n Blurb: string;\n Pathways: AgentInvocationPathway[];\n /** How many of them can fire right now. */\n LiveCount: number;\n};\n\n/** The one-glance answer at the top of the surface. */\nexport type AgentInvocationSummary = {\n Total: number;\n Live: number;\n /** True when at least one pathway can fire without a person. */\n IsAutomated: boolean;\n /** The soonest scheduled run across every pathway that knows its next run. */\n NextRunAt: Date | null;\n};\n\n/**\n * Display order and copy for each substrate.\n *\n * Ordered by how surprising the pathway is to someone auditing an agent: a schedule you set up is\n * expected, another agent calling you is less so, and `ExposeAsAction` — which opens the agent to\n * *anything* that can run an action — is the one most worth seeing last and largest.\n */\nconst GROUP_CHROME: ReadonlyArray<{ Kind: AgentInvocationKind; Label: string; Icon: string; Blurb: string }> = [\n {\n Kind: 'Schedule',\n Label: 'Schedules',\n Icon: 'fa-solid fa-clock',\n Blurb: 'Runs on a recurring schedule, with no one present.',\n },\n {\n Kind: 'Routine',\n Label: 'Routines',\n Icon: 'fa-solid fa-repeat',\n Blurb: \"Someone's own recurring request, run on their behalf.\",\n },\n {\n Kind: 'DataChange',\n Label: 'Data changes',\n Icon: 'fa-solid fa-bolt',\n Blurb: 'Fires when a record is created, updated or deleted.',\n },\n {\n Kind: 'BulkOperation',\n Label: 'Bulk operations',\n Icon: 'fa-solid fa-layer-group',\n Blurb: 'Runs across a whole set of records in one pass.',\n },\n {\n Kind: 'CalledByAgent',\n Label: 'Called by other agents',\n Icon: 'fa-solid fa-diagram-project',\n Blurb: 'Another agent delegates part of its work here.',\n },\n {\n Kind: 'ExposedAsAction',\n Label: 'Available as an action',\n Icon: 'fa-solid fa-plug',\n Blurb: 'Anything that can run an action can run this agent.',\n },\n];\n\n/**\n * Buckets pathways into their groups, in a fixed order, dropping the empty ones.\n *\n * Empty groups are dropped rather than shown greyed: a surface answering \"what invokes this?\" that\n * lists six headings with nothing under five of them buries the one real answer.\n */\nexport function GroupInvocations(pathways: readonly AgentInvocationPathway[]): AgentInvocationGroup[] {\n const groups: AgentInvocationGroup[] = [];\n for (const chrome of GROUP_CHROME) {\n const members = pathways.filter((p) => p.Kind === chrome.Kind);\n if (members.length === 0) continue;\n groups.push({\n ...chrome,\n Pathways: members,\n LiveCount: members.filter((p) => p.State === 'Live').length,\n });\n }\n return groups;\n}\n\n/** The header line: how many pathways exist, how many are live, and when the next one fires. */\nexport function SummarizeInvocations(pathways: readonly AgentInvocationPathway[]): AgentInvocationSummary {\n const live = pathways.filter((p) => p.State === 'Live');\n const nextRuns = live\n .map((p) => p.NextRunAt)\n .filter((d): d is Date => d instanceof Date && !Number.isNaN(d.getTime()));\n return {\n Total: pathways.length,\n Live: live.length,\n IsAutomated: live.length > 0,\n NextRunAt: nextRuns.length > 0 ? new Date(Math.min(...nextRuns.map((d) => d.getTime()))) : null,\n };\n}\n\n/**\n * Maps a lifecycle status onto the three states this surface cares about.\n *\n * Every substrate spells its statuses differently (`Disabled`, `Paused`, `Revoked`, `Draft`,\n * `Pending`) but they collapse into the same three questions, so the mapping lives here once rather\n * than being re-decided per query.\n */\nexport function ResolveInvocationState(status: string | null | undefined): AgentInvocationState {\n switch ((status ?? '').trim().toLowerCase()) {\n case 'active':\n return 'Live';\n case 'paused':\n return 'Paused';\n // 'Pending' and 'Draft' are pre-live rather than switched off, but neither fires, and telling\n // someone auditing an agent that a Draft \"might run\" would be the wrong kind of wrong.\n default:\n return 'Off';\n }\n}\n\n/** Field-count-preserving cron parts, so a malformed expression is described as itself, not guessed at. */\nconst CRON_DOW = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];\n\n/**\n * Renders a cron expression as a sentence, and refuses to invent one it cannot justify.\n *\n * Covers the shapes people actually write — every N minutes, daily at a time, weekly on a day — and\n * falls back to showing the raw expression for anything else. A humanizer that guesses produces a\n * confident sentence describing a schedule the job does not have, which on this surface is worse\n * than showing five fields the reader can look up.\n */\nexport function DescribeCron(expression: string | null | undefined, timezone?: string | null): string {\n const raw = (expression ?? '').trim();\n if (!raw) return 'No schedule set';\n\n const suffix = timezone && timezone.trim() && timezone.trim().toLowerCase() !== 'utc' ? ` (${timezone.trim()})` : '';\n const parts = raw.split(/\\s+/);\n if (parts.length < 5) return raw;\n\n const [minute, hour, dayOfMonth, month, dayOfWeek] = parts;\n const everyDate = dayOfMonth === '*' && month === '*';\n // Captured explicitly rather than read back off `RegExp.$1`: that global is rewritten by the very\n // next `.test()` in the same condition, so `*/6` in the hour field silently became \"every 0 hours\"\n // the moment the minute field was checked alongside it.\n const minuteStep = stepOf(minute);\n const hourStep = stepOf(hour);\n const isNumber = (v: string) => /^\\d+$/.test(v);\n\n if (everyDate && dayOfWeek === '*') {\n if (hour === '*' && minuteStep !== null) {\n return `Every ${minuteStep} minute${minuteStep === 1 ? '' : 's'}${suffix}`;\n }\n if (hour === '*' && isNumber(minute)) return `Hourly, at :${minute.padStart(2, '0')}${suffix}`;\n if (hourStep !== null && isNumber(minute)) {\n return `Every ${hourStep} hour${hourStep === 1 ? '' : 's'}${suffix}`;\n }\n if (isNumber(hour) && isNumber(minute)) return `Daily at ${formatClock(hour, minute)}${suffix}`;\n }\n\n if (everyDate && /^[0-6]$/.test(dayOfWeek) && /^\\d+$/.test(hour) && /^\\d+$/.test(minute)) {\n return `Every ${CRON_DOW[Number(dayOfWeek)]} at ${formatClock(hour, minute)}${suffix}`;\n }\n\n // Nothing above matched with confidence. The expression itself is more honest than a guess.\n return `${raw}${suffix}`;\n}\n\nfunction formatClock(hour: string, minute: string): string {\n return `${hour.padStart(2, '0')}:${minute.padStart(2, '0')}`;\n}\n\n/** The N in a `*&#47;N` cron field, or null when the field is not a step. */\nfunction stepOf(field: string): number | null {\n const match = /^\\*\\/(\\d+)$/.exec(field);\n if (!match) return null;\n const n = Number(match[1]);\n return Number.isFinite(n) && n > 0 ? n : null;\n}\n\n/**\n * Turns invocation-type names into the phrase a person would say.\n *\n * MJ names them `Create`, `Update`, `Delete`, `Validate`, `BeforeSave` and so on; a list of those on\n * screen reads like schema. \"when a record is created or updated\" reads like an answer.\n */\nexport function DescribeInvocationTypes(typeNames: readonly string[]): string {\n const verbs = typeNames\n .map((n) => (n ?? '').trim())\n .filter((n) => n.length > 0)\n .map((n) => INVOCATION_VERBS[n.toLowerCase()] ?? n.toLowerCase());\n const unique = [...new Set(verbs)];\n if (unique.length === 0) return 'On a data change';\n return `When a record is ${joinWithOr(unique)}`;\n}\n\nconst INVOCATION_VERBS: Record<string, string> = {\n create: 'created',\n created: 'created',\n aftercreate: 'created',\n update: 'updated',\n updated: 'updated',\n afterupdate: 'updated',\n delete: 'deleted',\n deleted: 'deleted',\n afterdelete: 'deleted',\n validate: 'validated',\n beforesave: 'saved',\n aftersave: 'saved',\n beforedelete: 'deleted',\n read: 'read',\n};\n\n/** `a`, `a or b`, `a, b or c` — the Oxford-free form people speak. */\nexport function joinWithOr(items: readonly string[]): string {\n if (items.length === 0) return '';\n if (items.length === 1) return items[0];\n return `${items.slice(0, -1).join(', ')} or ${items[items.length - 1]}`;\n}\n\n/**\n * Whether a string is a plain UUID.\n *\n * Guards the one place a value reaches an `ExtraFilter` as a literal: `ScheduledJob.Configuration`\n * is free-form JSON, so finding the jobs that name an agent means a `LIKE` against it, and a `LIKE`\n * is string concatenation into SQL. Every id used that way is checked here first — the agent's own\n * primary key always passes, and anything that does not is not queried at all.\n */\nexport function IsUUID(value: string | null | undefined): boolean {\n return /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test((value ?? '').trim());\n}\n\n/**\n * Renders a moment as something scannable — \"in 3 hours\", \"2 days ago\".\n *\n * Coarse on purpose: on this surface nobody needs the second, they need to know whether the last run\n * was recent enough that the agent is still doing its job.\n */\nexport function DescribeWhen(when: Date | null | undefined, now: Date): string | null {\n if (!(when instanceof Date) || Number.isNaN(when.getTime())) return null;\n const deltaMs = when.getTime() - now.getTime();\n const future = deltaMs > 0;\n const mins = Math.round(Math.abs(deltaMs) / 60_000);\n\n if (mins < 1) return future ? 'in under a minute' : 'just now';\n const phrase = describeSpan(mins);\n return future ? `in ${phrase}` : `${phrase} ago`;\n}\n\nfunction describeSpan(mins: number): string {\n if (mins < 60) return `${mins} minute${mins === 1 ? '' : 's'}`;\n const hours = Math.round(mins / 60);\n if (hours < 24) return `${hours} hour${hours === 1 ? '' : 's'}`;\n const days = Math.round(hours / 24);\n if (days < 30) return `${days} day${days === 1 ? '' : 's'}`;\n const months = Math.round(days / 30);\n if (months < 12) return `${months} month${months === 1 ? '' : 's'}`;\n const years = Math.round(months / 12);\n return `${years} year${years === 1 ? '' : 's'}`;\n}\n"]}
@@ -10,4 +10,6 @@ export * from './lib/components/skill-permissions-dialog.component';
10
10
  export * from './lib/components/create-agent-panel.component';
11
11
  export * from './lib/components/create-agent-dialog.component';
12
12
  export * from './lib/components/create-agent-slidein.component';
13
+ export * from './lib/components/agent-invocations.model';
14
+ export * from './lib/components/agent-invocations.component';
13
15
  //# sourceMappingURL=public-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAKA,cAAc,qBAAqB,CAAC;AAGpC,cAAc,0CAA0C,CAAC;AACzD,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AAGpD,cAAc,oDAAoD,CAAC;AACnE,cAAc,qDAAqD,CAAC;AACpE,cAAc,wDAAwD,CAAC;AAGvE,cAAc,oDAAoD,CAAC;AACnE,cAAc,qDAAqD,CAAC;AAGpE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,iDAAiD,CAAC"}
1
+ {"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAKA,cAAc,qBAAqB,CAAC;AAGpC,cAAc,0CAA0C,CAAC;AACzD,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AAGpD,cAAc,oDAAoD,CAAC;AACnE,cAAc,qDAAqD,CAAC;AACpE,cAAc,wDAAwD,CAAC;AAGvE,cAAc,oDAAoD,CAAC;AACnE,cAAc,qDAAqD,CAAC;AAGpE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,iDAAiD,CAAC;AAGhE,cAAc,0CAA0C,CAAC;AACzD,cAAc,8CAA8C,CAAC"}
@@ -18,4 +18,7 @@ export * from './lib/components/skill-permissions-dialog.component';
18
18
  export * from './lib/components/create-agent-panel.component';
19
19
  export * from './lib/components/create-agent-dialog.component';
20
20
  export * from './lib/components/create-agent-slidein.component';
21
+ // Invocations — the inverse index: everywhere an agent is invoked without a person
22
+ export * from './lib/components/agent-invocations.model';
23
+ export * from './lib/components/agent-invocations.component';
21
24
  //# sourceMappingURL=public-api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"public-api.js","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,SAAS;AACT,cAAc,qBAAqB,CAAC;AAEpC,WAAW;AACX,cAAc,0CAA0C,CAAC;AACzD,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AAEpD,yBAAyB;AACzB,cAAc,oDAAoD,CAAC;AACnE,cAAc,qDAAqD,CAAC;AACpE,cAAc,wDAAwD,CAAC;AAEvE,+BAA+B;AAC/B,cAAc,oDAAoD,CAAC;AACnE,cAAc,qDAAqD,CAAC;AAEpE,0BAA0B;AAC1B,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,iDAAiD,CAAC","sourcesContent":["/*\n * Public API Surface of @memberjunction/ng-agents\n */\n\n// Module\nexport * from './lib/agents.module';\n\n// Services\nexport * from './lib/services/agent-permissions.service';\nexport * from './lib/services/skill-permissions.service';\nexport * from './lib/services/create-agent.service';\n\n// Permissions Components\nexport * from './lib/components/agent-permissions-panel.component';\nexport * from './lib/components/agent-permissions-dialog.component';\nexport * from './lib/components/agent-permissions-slideover.component';\n\n// Skill Permissions Components\nexport * from './lib/components/skill-permissions-panel.component';\nexport * from './lib/components/skill-permissions-dialog.component';\n\n// Create Agent Components\nexport * from './lib/components/create-agent-panel.component';\nexport * from './lib/components/create-agent-dialog.component';\nexport * from './lib/components/create-agent-slidein.component';\n"]}
1
+ {"version":3,"file":"public-api.js","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,SAAS;AACT,cAAc,qBAAqB,CAAC;AAEpC,WAAW;AACX,cAAc,0CAA0C,CAAC;AACzD,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AAEpD,yBAAyB;AACzB,cAAc,oDAAoD,CAAC;AACnE,cAAc,qDAAqD,CAAC;AACpE,cAAc,wDAAwD,CAAC;AAEvE,+BAA+B;AAC/B,cAAc,oDAAoD,CAAC;AACnE,cAAc,qDAAqD,CAAC;AAEpE,0BAA0B;AAC1B,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,iDAAiD,CAAC;AAEhE,mFAAmF;AACnF,cAAc,0CAA0C,CAAC;AACzD,cAAc,8CAA8C,CAAC","sourcesContent":["/*\n * Public API Surface of @memberjunction/ng-agents\n */\n\n// Module\nexport * from './lib/agents.module';\n\n// Services\nexport * from './lib/services/agent-permissions.service';\nexport * from './lib/services/skill-permissions.service';\nexport * from './lib/services/create-agent.service';\n\n// Permissions Components\nexport * from './lib/components/agent-permissions-panel.component';\nexport * from './lib/components/agent-permissions-dialog.component';\nexport * from './lib/components/agent-permissions-slideover.component';\n\n// Skill Permissions Components\nexport * from './lib/components/skill-permissions-panel.component';\nexport * from './lib/components/skill-permissions-dialog.component';\n\n// Create Agent Components\nexport * from './lib/components/create-agent-panel.component';\nexport * from './lib/components/create-agent-dialog.component';\nexport * from './lib/components/create-agent-slidein.component';\n\n// Invocations — the inverse index: everywhere an agent is invoked without a person\nexport * from './lib/components/agent-invocations.model';\nexport * from './lib/components/agent-invocations.component';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-agents",
3
- "version": "6.1.0-edge.1",
3
+ "version": "6.1.0-edge.3",
4
4
  "description": "MemberJunction: Reusable Angular components for AI Agent management including permissions panel, dialog, and slideover",
5
5
  "main": "./dist/public-api.js",
6
6
  "typings": "./dist/public-api.d.ts",
@@ -9,11 +9,11 @@
9
9
  ],
10
10
  "keywords": [],
11
11
  "author": "",
12
- "license": "ISC",
12
+ "license": "BUSL-1.1",
13
13
  "devDependencies": {
14
14
  "@angular/compiler": "21.1.3",
15
15
  "@angular/compiler-cli": "21.1.3",
16
- "@memberjunction/ng-test-utils": "6.1.0-edge.1",
16
+ "@memberjunction/ng-test-utils": "6.1.0-edge.3",
17
17
  "sass": "^1.97.3",
18
18
  "vitest": "^4.0.18"
19
19
  },
@@ -23,18 +23,19 @@
23
23
  "@angular/platform-browser": "^21.1.3"
24
24
  },
25
25
  "dependencies": {
26
- "@memberjunction/ng-ui-components": "6.1.0-edge.1",
27
26
  "@angular/animations": "21.1.3",
28
27
  "@angular/cdk": "21.1.3",
29
28
  "@angular/forms": "21.1.3",
30
- "@memberjunction/core": "6.1.0-edge.1",
31
- "@memberjunction/core-entities": "6.1.0-edge.1",
32
- "@memberjunction/global": "6.1.0-edge.1",
33
- "@memberjunction/ai-core-plus": "6.1.0-edge.1",
34
- "@memberjunction/ai-engine-base": "6.1.0-edge.1",
29
+ "@memberjunction/ai-core-plus": "6.1.0-edge.3",
30
+ "@memberjunction/ai-engine-base": "6.1.0-edge.3",
31
+ "@memberjunction/core": "6.1.0-edge.3",
32
+ "@memberjunction/core-entities": "6.1.0-edge.3",
33
+ "@memberjunction/global": "6.1.0-edge.3",
34
+ "@memberjunction/ng-base-types": "6.1.0-edge.3",
35
+ "@memberjunction/ng-shared-generic": "6.1.0-edge.3",
36
+ "@memberjunction/ng-ui-components": "6.1.0-edge.3",
35
37
  "rxjs": "^7.8.2",
36
- "tslib": "^2.8.1",
37
- "@memberjunction/ng-base-types": "6.1.0-edge.1"
38
+ "tslib": "^2.8.1"
38
39
  },
39
40
  "sideEffects": false,
40
41
  "repository": {