@aglyn/plugins-ai 1.0.0-beta.278 → 1.0.0-beta.282
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/package.json +17 -17
- package/src/lib/activity/ai-activity-actions.d.ts +2 -26
- package/src/lib/activity/ai-activity-actions.js +5 -42
- package/src/lib/activity/ai-activity-actions.js.map +1 -1
- package/src/lib/activity/ai-activity-words.d.ts +42 -0
- package/src/lib/activity/ai-activity-words.js +63 -0
- package/src/lib/activity/ai-activity-words.js.map +1 -0
- package/src/lib/components/ai-insight-card.component.d.ts +2 -6
- package/src/lib/components/ai-insight-card.component.js +2 -6
- package/src/lib/components/ai-insight-card.component.js.map +1 -1
- package/src/lib/components/ai-insight-dialog.component.js +22 -32
- package/src/lib/components/ai-insight-dialog.component.js.map +1 -1
- package/src/lib/components/ai-job-links.js +15 -0
- package/src/lib/components/ai-job-links.js.map +1 -1
- package/src/lib/components/assist-panel.component.js +3 -1
- package/src/lib/components/assist-panel.component.js.map +1 -1
- package/src/lib/jobs/ai-build-capabilities.js +23 -0
- package/src/lib/jobs/ai-build-capabilities.js.map +1 -1
- package/src/lib/jobs/ai-job-build-step.js +2 -1
- package/src/lib/jobs/ai-job-build-step.js.map +1 -1
- package/src/lib/jobs/ai-job-import-step.d.ts +1 -0
- package/src/lib/jobs/ai-job-import-step.js +17 -11
- package/src/lib/jobs/ai-job-import-step.js.map +1 -1
- package/src/lib/jobs/ai-job-plan-step.js +3 -2
- package/src/lib/jobs/ai-job-plan-step.js.map +1 -1
- package/src/lib/jobs/ai-job-privacy-step.d.ts +184 -0
- package/src/lib/jobs/ai-job-privacy-step.js +471 -0
- package/src/lib/jobs/ai-job-privacy-step.js.map +1 -0
- package/src/lib/jobs/ai-site-inspiration.d.ts +10 -0
- package/src/lib/jobs/ai-site-inspiration.js +15 -0
- package/src/lib/jobs/ai-site-inspiration.js.map +1 -1
- package/src/lib/model/ai-insight-ask.d.ts +57 -0
- package/src/lib/model/ai-insight-ask.js +64 -0
- package/src/lib/model/ai-insight-ask.js.map +1 -0
- package/src/lib/model/ai-insight.d.ts +1 -6
- package/src/lib/model/ai-insight.js +2 -8
- package/src/lib/model/ai-insight.js.map +1 -1
- package/src/lib/model/ai-job-activity.js +1 -0
- package/src/lib/model/ai-job-activity.js.map +1 -1
- package/src/lib/model/ai-jobs.types.d.ts +5 -1
- package/src/lib/model/ai-jobs.types.js +1 -0
- package/src/lib/model/ai-jobs.types.js.map +1 -1
- package/src/lib/model/ai-permissions.js +6 -2
- package/src/lib/model/ai-permissions.js.map +1 -1
- package/src/lib/model/ai-site-import.d.ts +2 -0
- package/src/lib/model/ai-site-import.js +2 -0
- package/src/lib/model/ai-site-import.js.map +1 -1
- package/src/lib/model/ai-site-kinds.d.ts +10 -28
- package/src/lib/model/ai-site-kinds.js +12 -496
- package/src/lib/model/ai-site-kinds.js.map +1 -1
- package/src/lib/providers/anthropic.js +23 -14
- package/src/lib/providers/anthropic.js.map +1 -1
- package/src/lib/providers/contract.d.ts +39 -4
- package/src/lib/providers/contract.js +28 -0
- package/src/lib/providers/contract.js.map +1 -1
- package/src/lib/providers/routing.d.ts +3 -0
- package/src/lib/providers/routing.js +4 -3
- package/src/lib/providers/routing.js.map +1 -1
- package/src/lib/runtime/ai-dev-env.d.ts +3 -2
- package/src/lib/runtime/ai-dev-env.js +3 -2
- package/src/lib/runtime/ai-dev-env.js.map +1 -1
- package/src/lib/runtime/ai-page-links.d.ts +5 -2
- package/src/lib/runtime/ai-page-links.js +11 -3
- package/src/lib/runtime/ai-page-links.js.map +1 -1
- package/src/lib/runtime/ai-runtime.js +5 -2
- package/src/lib/runtime/ai-runtime.js.map +1 -1
- package/src/lib/server/assist-chat.js +58 -30
- package/src/lib/server/assist-chat.js.map +1 -1
- package/src/lib/server.js +2 -0
- package/src/lib/server.js.map +1 -1
- package/src/lib/site-import/fixtures/site-import-crawl-recordings.d.ts +3 -1
- package/src/lib/site-import/fixtures/site-import-crawl-recordings.js +19 -1
- package/src/lib/site-import/fixtures/site-import-crawl-recordings.js.map +1 -1
- package/src/lib/site-import/site-import-page.d.ts +2 -2
- package/src/lib/site-import/site-import-page.js +11 -1
- package/src/lib/site-import/site-import-page.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aglyn/plugins-ai",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.282",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://aglyn.com",
|
|
6
6
|
"repository": {
|
|
@@ -25,22 +25,22 @@
|
|
|
25
25
|
"./package.json": "./package.json"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aglyn/aglyn": "1.0.0-beta.
|
|
29
|
-
"@aglyn/shared-data-enums": "1.0.0-beta.
|
|
30
|
-
"@aglyn/shared-data-mdi": "1.0.0-beta.
|
|
31
|
-
"@aglyn/shared-data-types": "1.0.0-beta.
|
|
32
|
-
"@aglyn/shared-ui-email-campaigns": "1.0.0-beta.
|
|
33
|
-
"@aglyn/shared-ui-jsx": "1.0.0-beta.
|
|
34
|
-
"@aglyn/shared-ui-snackstack": "1.0.0-beta.
|
|
35
|
-
"@aglyn/shared-ui-theme": "1.0.0-beta.
|
|
36
|
-
"@aglyn/shared-util-email": "1.0.0-beta.
|
|
37
|
-
"@aglyn/shared-util-errors": "1.0.0-beta.
|
|
38
|
-
"@aglyn/shared-util-http": "1.0.0-beta.
|
|
39
|
-
"@aglyn/shared-util-timestamp": "1.0.0-beta.
|
|
40
|
-
"@aglyn/shared-util-tools": "1.0.0-beta.
|
|
41
|
-
"@aglyn/tenant-data-admin": "1.0.0-beta.
|
|
42
|
-
"@aglyn/tenant-feature-instance": "1.0.0-beta.
|
|
43
|
-
"@aglyn/tenant-runtime": "1.0.0-beta.
|
|
28
|
+
"@aglyn/aglyn": "1.0.0-beta.282",
|
|
29
|
+
"@aglyn/shared-data-enums": "1.0.0-beta.282",
|
|
30
|
+
"@aglyn/shared-data-mdi": "1.0.0-beta.282",
|
|
31
|
+
"@aglyn/shared-data-types": "1.0.0-beta.282",
|
|
32
|
+
"@aglyn/shared-ui-email-campaigns": "1.0.0-beta.282",
|
|
33
|
+
"@aglyn/shared-ui-jsx": "1.0.0-beta.282",
|
|
34
|
+
"@aglyn/shared-ui-snackstack": "1.0.0-beta.282",
|
|
35
|
+
"@aglyn/shared-ui-theme": "1.0.0-beta.282",
|
|
36
|
+
"@aglyn/shared-util-email": "1.0.0-beta.282",
|
|
37
|
+
"@aglyn/shared-util-errors": "1.0.0-beta.282",
|
|
38
|
+
"@aglyn/shared-util-http": "1.0.0-beta.282",
|
|
39
|
+
"@aglyn/shared-util-timestamp": "1.0.0-beta.282",
|
|
40
|
+
"@aglyn/shared-util-tools": "1.0.0-beta.282",
|
|
41
|
+
"@aglyn/tenant-data-admin": "1.0.0-beta.282",
|
|
42
|
+
"@aglyn/tenant-feature-instance": "1.0.0-beta.282",
|
|
43
|
+
"@aglyn/tenant-runtime": "1.0.0-beta.282",
|
|
44
44
|
"@swc/helpers": "0.5.23"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
@@ -29,32 +29,8 @@
|
|
|
29
29
|
* `AI_ACTIVITY_ACTION_LABELS` fails the type, not the reader.
|
|
30
30
|
*/
|
|
31
31
|
import type { AiJobOutputResource } from '../model/ai-jobs.types';
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
readonly jobCreated: "ai.job.created";
|
|
35
|
-
readonly jobOutput: "ai.job.output";
|
|
36
|
-
readonly jobCanceled: "ai.job.canceled";
|
|
37
|
-
readonly jobNeedsInput: "ai.job.needs_input";
|
|
38
|
-
readonly editApplied: "ai.edit.applied";
|
|
39
|
-
readonly seoApplied: "ai.seo.applied";
|
|
40
|
-
readonly assistSection: "ai.assist.section";
|
|
41
|
-
readonly overageHardCap: "ai.overage.hardCap";
|
|
42
|
-
readonly overageCap: "ai.overage.cap";
|
|
43
|
-
readonly allotmentChanged: "ai.allotment.changed";
|
|
44
|
-
readonly permissionChanged: "ai.permission.changed";
|
|
45
|
-
readonly addonPurchased: "ai.addon.purchased";
|
|
46
|
-
readonly addonRemoved: "ai.addon.removed";
|
|
47
|
-
};
|
|
48
|
-
export type AiActivityAction = (typeof AI_ACTIVITY_ACTIONS)[keyof typeof AI_ACTIVITY_ACTIONS];
|
|
49
|
-
/** What a person reads for each code, in the feed and the actor table. */
|
|
50
|
-
export declare const AI_ACTIVITY_ACTION_LABELS: Record<AiActivityAction, string>;
|
|
51
|
-
/**
|
|
52
|
-
* The codes whose row reads as a sentence about its target (AGL-3660):
|
|
53
|
-
* `{target}` is the target's noun and name, so an output row reads
|
|
54
|
-
* `Created page Home with Aglyn AI` rather than `AI generated` beside a
|
|
55
|
-
* Target cell that had to finish the thought.
|
|
56
|
-
*/
|
|
57
|
-
export declare const AI_ACTIVITY_ACTION_SENTENCES: Partial<Record<AiActivityAction, string>>;
|
|
32
|
+
export { AI_ACTIVITY_ACTIONS, AI_ACTIVITY_ACTION_LABELS, AI_ACTIVITY_ACTION_SENTENCES, type AiActivityAction, } from './ai-activity-words';
|
|
33
|
+
import { type AiActivityAction } from './ai-activity-words';
|
|
58
34
|
/**
|
|
59
35
|
* What the staff audit trail reads for each code the AI doors write to
|
|
60
36
|
* `adminAudit` (AGL-3660). `ai.job.output` is spelled out per row by the
|
|
@@ -29,47 +29,8 @@
|
|
|
29
29
|
*/ import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
30
30
|
import { PLATFORM_BRAND_NAME } from "@aglyn/aglyn/app-utils/platform-brand";
|
|
31
31
|
import { pluginStaffAuditActionGroup, pluginStaffAuditActionGroupLabel, registerPluginActivityActions } from "@aglyn/aglyn/plugin-manager/plugin-activity-actions";
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
jobOutput: 'ai.job.output',
|
|
35
|
-
jobCanceled: 'ai.job.canceled',
|
|
36
|
-
jobNeedsInput: 'ai.job.needs_input',
|
|
37
|
-
editApplied: 'ai.edit.applied',
|
|
38
|
-
seoApplied: 'ai.seo.applied',
|
|
39
|
-
assistSection: 'ai.assist.section',
|
|
40
|
-
overageHardCap: 'ai.overage.hardCap',
|
|
41
|
-
overageCap: 'ai.overage.cap',
|
|
42
|
-
allotmentChanged: 'ai.allotment.changed',
|
|
43
|
-
permissionChanged: 'ai.permission.changed',
|
|
44
|
-
addonPurchased: 'ai.addon.purchased',
|
|
45
|
-
addonRemoved: 'ai.addon.removed'
|
|
46
|
-
};
|
|
47
|
-
/** What a person reads for each code, in the feed and the actor table. */ export const AI_ACTIVITY_ACTION_LABELS = {
|
|
48
|
-
'ai.job.created': 'Started an AI generation',
|
|
49
|
-
'ai.job.output': 'AI generated',
|
|
50
|
-
'ai.job.canceled': 'Canceled an AI generation',
|
|
51
|
-
'ai.job.needs_input': 'AI generation paused for input',
|
|
52
|
-
'ai.edit.applied': 'Applied AI edits',
|
|
53
|
-
'ai.seo.applied': 'Applied AI SEO fixes as drafts',
|
|
54
|
-
'ai.assist.section': 'AI generated a section',
|
|
55
|
-
'ai.overage.hardCap': 'AI stop-at-band switch',
|
|
56
|
-
'ai.overage.cap': 'AI overage ceiling',
|
|
57
|
-
'ai.allotment.changed': 'AI allotment changed',
|
|
58
|
-
'ai.permission.changed': 'AI permission changed',
|
|
59
|
-
'ai.addon.purchased': 'Added the AI add-on',
|
|
60
|
-
'ai.addon.removed': 'Removed the AI add-on'
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* The codes whose row reads as a sentence about its target (AGL-3660):
|
|
64
|
-
* `{target}` is the target's noun and name, so an output row reads
|
|
65
|
-
* `Created page Home with Aglyn AI` rather than `AI generated` beside a
|
|
66
|
-
* Target cell that had to finish the thought.
|
|
67
|
-
*/ export const AI_ACTIVITY_ACTION_SENTENCES = {
|
|
68
|
-
'ai.job.output': `Created {target} with ${PLATFORM_BRAND_NAME} AI`,
|
|
69
|
-
'ai.edit.applied': `Applied ${PLATFORM_BRAND_NAME} AI edits to {target}`,
|
|
70
|
-
'ai.seo.applied': `Applied ${PLATFORM_BRAND_NAME} AI search fixes to {target}`,
|
|
71
|
-
'ai.assist.section': `Added a section to {target} with ${PLATFORM_BRAND_NAME} AI`
|
|
72
|
-
};
|
|
32
|
+
export { AI_ACTIVITY_ACTIONS, AI_ACTIVITY_ACTION_LABELS, AI_ACTIVITY_ACTION_SENTENCES } from "./ai-activity-words.js";
|
|
33
|
+
import { AI_ACTIVITY_ACTIONS, AI_ACTIVITY_ACTION_LABELS, AI_ACTIVITY_ACTION_SENTENCES } from "./ai-activity-words.js";
|
|
73
34
|
/**
|
|
74
35
|
* What the staff audit trail reads for each code the AI doors write to
|
|
75
36
|
* `adminAudit` (AGL-3660). `ai.job.output` is spelled out per row by the
|
|
@@ -185,7 +146,9 @@ export const AI_JOB_NEEDS_INPUT_REASON_LABELS = {
|
|
|
185
146
|
// Files a build organized in the site's media library (AGL-3752), filed with its content.
|
|
186
147
|
media: 'content',
|
|
187
148
|
// A site's tracking tags a build saved (AGL-3751), filed with its settings.
|
|
188
|
-
tracking: 'content'
|
|
149
|
+
tracking: 'content',
|
|
150
|
+
// Who can see the site, as a build changed it (AGL-4033), filed with its content.
|
|
151
|
+
privacy: 'content'
|
|
189
152
|
};
|
|
190
153
|
export function aiOutputTargetType(resource) {
|
|
191
154
|
return AI_OUTPUT_TARGET_TYPES[resource];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/activity/ai-activity-actions.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * The AI actions an activity log can carry (AGL-2929).\n *\n * Every other action in `orgs/{orgId}/activity` and `hosts/{hostId}/activity`\n * is a prose sentence written at the call site — \"Saved the screen\". The AI\n * rows are CODES instead, because they are read by more than a person: the\n * org feed's \"AI\" chip, the staff audit facet and the actor table all need\n * to recognize an AI row without parsing a sentence, and a sentence that\n * three writers phrase three ways is three rows that look unrelated.\n *\n * One list, so the writers in `ai-activity.ts`, the feed presenter and the\n * staff facet cannot disagree about what counts as AI. A code missing from\n * `AI_ACTIVITY_ACTION_LABELS` fails the type, not the reader.\n */\n\nimport type { AiJobOutputResource } from '../model/ai-jobs.types'\nimport { PLATFORM_BRAND_NAME } from '@aglyn/aglyn/app-utils/platform-brand'\nimport {\n pluginStaffAuditActionGroup,\n pluginStaffAuditActionGroupLabel,\n registerPluginActivityActions,\n type PluginActivityScope,\n} from '@aglyn/aglyn/plugin-manager/plugin-activity-actions'\n\n/** The action code each AI writer stores. */\nexport const AI_ACTIVITY_ACTIONS = {\n jobCreated: 'ai.job.created',\n jobOutput: 'ai.job.output',\n jobCanceled: 'ai.job.canceled',\n jobNeedsInput: 'ai.job.needs_input',\n editApplied: 'ai.edit.applied',\n seoApplied: 'ai.seo.applied',\n assistSection: 'ai.assist.section',\n overageHardCap: 'ai.overage.hardCap',\n overageCap: 'ai.overage.cap',\n allotmentChanged: 'ai.allotment.changed',\n permissionChanged: 'ai.permission.changed',\n addonPurchased: 'ai.addon.purchased',\n addonRemoved: 'ai.addon.removed',\n} as const\n\nexport type AiActivityAction =\n (typeof AI_ACTIVITY_ACTIONS)[keyof typeof AI_ACTIVITY_ACTIONS]\n\n/** What a person reads for each code, in the feed and the actor table. */\nexport const AI_ACTIVITY_ACTION_LABELS: Record<AiActivityAction, string> = {\n 'ai.job.created': 'Started an AI generation',\n 'ai.job.output': 'AI generated',\n 'ai.job.canceled': 'Canceled an AI generation',\n 'ai.job.needs_input': 'AI generation paused for input',\n 'ai.edit.applied': 'Applied AI edits',\n 'ai.seo.applied': 'Applied AI SEO fixes as drafts',\n 'ai.assist.section': 'AI generated a section',\n 'ai.overage.hardCap': 'AI stop-at-band switch',\n 'ai.overage.cap': 'AI overage ceiling',\n 'ai.allotment.changed': 'AI allotment changed',\n 'ai.permission.changed': 'AI permission changed',\n 'ai.addon.purchased': 'Added the AI add-on',\n 'ai.addon.removed': 'Removed the AI add-on',\n}\n\n/**\n * The codes whose row reads as a sentence about its target (AGL-3660):\n * `{target}` is the target's noun and name, so an output row reads\n * `Created page Home with Aglyn AI` rather than `AI generated` beside a\n * Target cell that had to finish the thought.\n */\nexport const AI_ACTIVITY_ACTION_SENTENCES: Partial<Record<AiActivityAction, string>> = {\n 'ai.job.output': `Created {target} with ${PLATFORM_BRAND_NAME} AI`,\n 'ai.edit.applied': `Applied ${PLATFORM_BRAND_NAME} AI edits to {target}`,\n 'ai.seo.applied': `Applied ${PLATFORM_BRAND_NAME} AI search fixes to {target}`,\n 'ai.assist.section': `Added a section to {target} with ${PLATFORM_BRAND_NAME} AI`,\n}\n\n/**\n * What the staff audit trail reads for each code the AI doors write to\n * `adminAudit` (AGL-3660). `ai.job.output` is spelled out per row by the\n * shared describer, which names the thing made.\n */\nexport const AI_STAFF_AUDIT_LABELS: Readonly<Record<string, string>> = {\n 'ai.job.output': `Created a draft with ${PLATFORM_BRAND_NAME} AI`,\n 'ai.job.cancel': `Canceled an ${PLATFORM_BRAND_NAME} AI job`,\n 'ai.job.resume': `Confirmed an ${PLATFORM_BRAND_NAME} AI plan`,\n 'ai.job.apply': `Applied an ${PLATFORM_BRAND_NAME} AI result`,\n 'ai.generate': `Generated with ${PLATFORM_BRAND_NAME} AI`,\n 'ai.allotments.set': 'Set AI allotments',\n 'ai.credits.giveBack': 'Gave AI credits back',\n 'ai.credits.reset': 'Reset AI credits',\n 'ai.overage.clearCeiling': 'Cleared the AI overage ceiling',\n 'ai.overage.liftPause': 'Lifted the AI pause',\n 'ai.overage.resetStep': 'Reset the AI overage step',\n 'ai.overage.setCeiling': 'Set the AI overage ceiling',\n 'platform.aiFreeSpend.paused': 'Paused free AI for the day',\n 'org.ai-viewed': 'Viewed the organization’s AI usage',\n 'user.ai-usage-viewed': 'Viewed the account’s AI usage',\n 'org.ai-conversations-viewed': `Viewed the organization’s ${PLATFORM_BRAND_NAME} AI requests`,\n 'user.ai-requests-viewed': `Viewed the account’s ${PLATFORM_BRAND_NAME} AI requests`,\n ...Object.fromEntries(\n Object.entries(AI_ACTIVITY_ACTION_LABELS).filter(([key]) => key !== 'ai.job.output'),\n ),\n}\n\n/** A job output's `resource`, as the noun the audit sentence uses. */\nconst AI_OUTPUT_NOUNS: Readonly<Record<string, string>> = {\n screen: 'page',\n reusableComponent: 'component',\n emailScreen: 'email',\n orgAutomation: 'automation',\n workflow: 'automation',\n entry: 'post',\n text: 'copy',\n seo: 'search fixes',\n crm: 'CRM answer',\n insight: 'insight',\n}\n\n/**\n * An `ai.job.output` audit row in words (AGL-3660), from the `after` the\n * job writer stores — `{ resource, label }`: `Created page Home with Aglyn\n * AI`, and its outcome, a draft.\n */\nexport function aiStaffAuditDescribe(entry: {\n action: string\n after: Readonly<Record<string, unknown>>\n}): { action?: string; result?: string } | undefined {\n if (entry.action !== AI_ACTIVITY_ACTIONS.jobOutput) return undefined\n const resource = typeof entry.after['resource'] === 'string' ? entry.after['resource'] : ''\n const label = typeof entry.after['label'] === 'string' ? entry.after['label'].trim() : ''\n const noun =\n AI_OUTPUT_NOUNS[resource] ??\n (resource ? resource.replace(/([a-z])([A-Z])/g, '$1 $2').toLowerCase() : 'draft')\n return {\n action: `Created ${noun}${label ? ` ${label}` : ''} with ${PLATFORM_BRAND_NAME} AI`,\n result: 'Draft created',\n }\n}\n\n/** Every code, in catalog order — what a filter sends as `isAnyOf`. */\nexport const AI_ACTIVITY_ACTION_LIST: readonly AiActivityAction[] =\n Object.values(AI_ACTIVITY_ACTIONS)\n\n/** The feed's filter chip and the staff facet's group, by one name. */\nexport const AI_ACTIVITY_FILTER_LABEL = 'AI'\n\n/**\n * Why a generation stopped and asked for a person (AGL-2904): the plan's\n * band ran out, the org's own ceiling refused, the monthly message cap or\n * the job's own token budget did — or, on the Free taste (AGL-2925), one of\n * its own precautions: the account's credits, its daily request cap, a\n * pause after declined briefs, or the platform's day of free spend. Those\n * are the meter's `AssistRefusedBy` less its `null`, so a ceiling the meter\n * can name is one the feed can label. The last five are the job's own: its\n * plan is ready for review, or an answer broke a building rule on its re-ask\n * (AGL-2935), or the site is at an allowance its plan sets for what the job\n * writes (AGL-2909), or a site import's wave waits for its review or for the\n * site to be verified again (AGL-3976).\n */\nexport type AiJobNeedsInputReason =\n | 'band'\n | 'cap'\n | 'messages'\n | 'budget'\n | 'allotment'\n | 'account'\n | 'requests'\n | 'refusals'\n | 'platform'\n | 'plan'\n | 'doctrine'\n | 'limit'\n | 'wave'\n | 'ownership'\n | 'input'\n\nexport const AI_JOB_NEEDS_INPUT_REASON_LABELS: Record<\n AiJobNeedsInputReason,\n string\n> = {\n plan: 'its plan is ready for review',\n doctrine: 'its answer broke a building rule twice',\n limit: 'the site reached an allowance of its plan',\n // A site import (AGL-3976): its next wave waits to be started, or for the site to be verified again.\n wave: 'a wave of the site it brings in is ready for review',\n ownership: 'the site it brings in must be verified again',\n input: 'it needs an ID only the person can give',\n band: 'the included AI band is used up',\n cap: 'the overage ceiling was reached',\n messages: 'the monthly message cap was reached',\n budget: 'the job budget was reached',\n allotment: 'the creator’s or the site’s AI allotment is used up',\n account: 'the account’s free AI credits are used up',\n requests: 'the daily free request cap was reached',\n refusals: 'free generation is paused for the day after declined briefs',\n platform: 'free AI generation is paused for the day',\n}\n\n/**\n * The feed target types a generation job's output can be filed under: the\n * kinds both activity logs know, so the org row and its host copy share a\n * shape.\n */\nexport type AiOutputTargetType =\n | 'screen'\n | 'layout'\n | 'component'\n | 'template'\n | 'workflow'\n | 'content'\n | 'theme'\n\n/**\n * Where the feed files each resource kind a job can write (AGL-2904).\n *\n * A job names its output by the resource it wrote, and the activity logs\n * know a narrower set of targets. The map is total, so a resource kind\n * added to the job document must say where the feed shows it before the\n * machine can log it. `reusableComponent` is the feed's `component`; a\n * `text` output is copy, which the feed files as `content`; a `theme`\n * proposal is filed under the site's theme, which the host feed links to the\n * Theme section (AGL-2938); the kinds whose runners have not shipped are\n * content of the site too, and are filed there until a target of their own\n * exists.\n */\nconst AI_OUTPUT_TARGET_TYPES: Record<AiJobOutputResource, AiOutputTargetType> = {\n screen: 'screen',\n reusableComponent: 'component',\n layout: 'layout',\n template: 'template',\n form: 'content',\n emailScreen: 'content',\n campaign: 'content',\n product: 'content',\n experiment: 'content',\n workflow: 'workflow',\n // An SEO proposal (AGL-2910) is about the site's content, and is filed there.\n seo: 'content',\n text: 'content',\n theme: 'theme',\n // An insight answer (AGL-2915) is about the site's figures; the feed row\n // names it and never what it says.\n insight: 'content',\n // A CRM proposal (AGL-2917) writes nothing; the feed files it with content.\n crm: 'content',\n // Another plugin's draft a build asked its writer for (AGL-3616).\n draft: 'content',\n // A logic proposal (AGL-3603) writes nothing either.\n logic: 'content',\n // So does an org automation's (AGL-3603): the editor's Save is the write.\n orgAutomation: 'content',\n // A blog post a guided start wrote (AGL-3676) is the site's content.\n entry: 'content',\n // A site's settings a build saved (AGL-3748) describe the site, filed with its content.\n settings: 'content',\n // Files a build organized in the site's media library (AGL-3752), filed with its content.\n media: 'content',\n // A site's tracking tags a build saved (AGL-3751), filed with its settings.\n tracking: 'content',\n}\n\nexport function aiOutputTargetType(resource: AiJobOutputResource): AiOutputTargetType {\n return AI_OUTPUT_TARGET_TYPES[resource]\n}\n\n/** Whether a stored action is one of the AI codes above. */\nexport function isAiActivityAction(action: unknown): action is AiActivityAction {\n return (\n typeof action === 'string' &&\n (AI_ACTIVITY_ACTION_LIST as readonly string[]).includes(action)\n )\n}\n\n/** The readable label for an AI code; `undefined` for any other action. */\nexport function aiActivityActionLabel(action: unknown): string | undefined {\n return isAiActivityAction(action)\n ? AI_ACTIVITY_ACTION_LABELS[action]\n : undefined\n}\n\n/**\n * Staff audit rows that are ABOUT AI without carrying an `ai.` code: the\n * customer's overage controls already write `billing.assistOverage.*`, and\n * the platform's free-spend auto-pause writes `platform.aiFreeSpend.*`\n * (AGL-2925). The audit page's facet folds them under the same group as the\n * codes, because \"what did we do about AI this week\" is one question.\n */\nexport const AI_STAFF_AUDIT_ACTION_PREFIXES: readonly string[] = [\n 'ai.',\n 'billing.assistOverage.',\n 'platform.aiFreeSpend.',\n]\n\n/** The facet group an `adminAudit` action belongs to. */\nexport const STAFF_AUDIT_AI_GROUP = 'ai'\n\n/**\n * Which log each code is written to. The job and edit codes land in both\n * the org feed and the host's copy; the billing and permission codes are\n * org-level facts and land in the org feed alone.\n */\nconst AI_ACTIVITY_ACTION_SCOPES: Record<\n AiActivityAction,\n PluginActivityScope | readonly PluginActivityScope[]\n> = {\n 'ai.job.created': ['org', 'host'],\n 'ai.job.output': ['org', 'host'],\n 'ai.job.canceled': ['org', 'host'],\n 'ai.job.needs_input': ['org', 'host'],\n 'ai.edit.applied': ['org', 'host'],\n 'ai.seo.applied': ['org', 'host'],\n 'ai.assist.section': ['org', 'host'],\n 'ai.overage.hardCap': 'org',\n 'ai.overage.cap': 'org',\n 'ai.allotment.changed': 'org',\n 'ai.permission.changed': 'org',\n 'ai.addon.purchased': 'org',\n 'ai.addon.removed': 'org',\n}\n\n/**\n * The catalog, declared through the generic activity-action seam\n * (AGL-2940) so the feed's chip, the actor table's filter and the staff\n * facet read it from the registry beside every other plugin's codes.\n * `registerAiDeclarations` calls it, in both apps and in the browser.\n */\nexport function registerAiActivityActions(): void {\n registerPluginActivityActions({\n pluginId: 'ai',\n group: {\n id: STAFF_AUDIT_AI_GROUP,\n label: AI_ACTIVITY_FILTER_LABEL,\n staffAuditPrefixes: AI_STAFF_AUDIT_ACTION_PREFIXES.filter(\n (prefix) => prefix !== 'ai.',\n ),\n // The staff cards opening on an org (AGL-2930) and on one account\n // (AGL-2928), which no longer write these, so the rows already in the\n // log still classify as reads; and a staff member reading what an org\n // asked Aglyn AI (AGL-3675), which writes one per page.\n // An account's AI requests on the staff user page (AGL-3660) likewise.\n staffAuditAccessActions: [\n 'org.ai-viewed',\n 'user.ai-usage-viewed',\n 'org.ai-conversations-viewed',\n 'user.ai-requests-viewed',\n ],\n staffAuditLabels: AI_STAFF_AUDIT_LABELS,\n // The audit trail's words for a job's output, its job collection and\n // the feed's job rows, read by core's shared describer (AGL-3660).\n staffAuditDescribe: aiStaffAuditDescribe,\n staffAuditCollections: { aiJobs: { noun: `${PLATFORM_BRAND_NAME} AI job`, job: true } },\n jobTargetTypes: ['aiJob'],\n },\n actions: AI_ACTIVITY_ACTION_LIST.map((key) => ({\n key,\n label: AI_ACTIVITY_ACTION_LABELS[key],\n ...(AI_ACTIVITY_ACTION_SENTENCES[key] ? { sentence: AI_ACTIVITY_ACTION_SENTENCES[key] } : {}),\n scope: AI_ACTIVITY_ACTION_SCOPES[key],\n })),\n // A generation job (AGL-2904): the org feed names the job, and each of\n // its outputs names the resource it produced. Filed as `aiJob` since\n // before plugin target types were namespaced, so the noun is declared\n // here rather than read off the type (AGL-3080).\n targetTypes: { aiJob: 'AI generation' },\n })\n}\n\n/**\n * The group the staff audit facet files an action under: `ai` for every\n * AI row, otherwise the action's leading namespace (`billing`, `org`,\n * `plugins`). Roughly seventy distinct actions write to `adminAudit`, so\n * the facet offers namespaces rather than a seventy-entry menu. Answered\n * by the registry, so every plugin's group is filed the same way.\n */\nexport function staffAuditActionGroup(action: unknown): string {\n return pluginStaffAuditActionGroup(action)\n}\n\n/** How a facet group reads in the menu: `ai` → `AI`, `billing` → `billing`. */\nexport function staffAuditActionGroupLabel(group: string): string {\n return pluginStaffAuditActionGroupLabel(group)\n}\n"],"names":["PLATFORM_BRAND_NAME","pluginStaffAuditActionGroup","pluginStaffAuditActionGroupLabel","registerPluginActivityActions","AI_ACTIVITY_ACTIONS","jobCreated","jobOutput","jobCanceled","jobNeedsInput","editApplied","seoApplied","assistSection","overageHardCap","overageCap","allotmentChanged","permissionChanged","addonPurchased","addonRemoved","AI_ACTIVITY_ACTION_LABELS","AI_ACTIVITY_ACTION_SENTENCES","AI_STAFF_AUDIT_LABELS","Object","fromEntries","entries","filter","key","AI_OUTPUT_NOUNS","screen","reusableComponent","emailScreen","orgAutomation","workflow","entry","text","seo","crm","insight","aiStaffAuditDescribe","action","undefined","resource","after","label","trim","noun","replace","toLowerCase","result","AI_ACTIVITY_ACTION_LIST","values","AI_ACTIVITY_FILTER_LABEL","AI_JOB_NEEDS_INPUT_REASON_LABELS","plan","doctrine","limit","wave","ownership","input","band","cap","messages","budget","allotment","account","requests","refusals","platform","AI_OUTPUT_TARGET_TYPES","layout","template","form","campaign","product","experiment","theme","draft","logic","settings","media","tracking","aiOutputTargetType","isAiActivityAction","includes","aiActivityActionLabel","AI_STAFF_AUDIT_ACTION_PREFIXES","STAFF_AUDIT_AI_GROUP","AI_ACTIVITY_ACTION_SCOPES","registerAiActivityActions","pluginId","group","id","staffAuditPrefixes","prefix","staffAuditAccessActions","staffAuditLabels","staffAuditDescribe","staffAuditCollections","aiJobs","job","jobTargetTypes","actions","map","sentence","scope","targetTypes","aiJob","staffAuditActionGroup","staffAuditActionGroupLabel"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;CAaC;AAGD,SAASA,mBAAmB,QAAQ,wCAAuC;AAC3E,SACEC,2BAA2B,EAC3BC,gCAAgC,EAChCC,6BAA6B,QAExB,sDAAqD;AAE5D,2CAA2C,GAC3C,OAAO,MAAMC,sBAAsB;IACjCC,YAAY;IACZC,WAAW;IACXC,aAAa;IACbC,eAAe;IACfC,aAAa;IACbC,YAAY;IACZC,eAAe;IACfC,gBAAgB;IAChBC,YAAY;IACZC,kBAAkB;IAClBC,mBAAmB;IACnBC,gBAAgB;IAChBC,cAAc;AAChB,EAAU;AAKV,wEAAwE,GACxE,OAAO,MAAMC,4BAA8D;IACzE,kBAA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AOQ;YACPyC,oBAAoBP,+BAA+B5D,MAAM,CACvD,CAACoE,SAAWA,WAAW;YAEzB,kEAAkE;YAClE,sEAAsE;YACtE,sEAAsE;YACtE,wDAAwD;YACxD,uEAAuE;YACvEC,yBAAyB;gBACvB;gBACA;gBACA;gBACA;aACD;YACDC,kBAAkB1E;YAClB,qEAAqE;YACrE,mEAAmE;YACnE2E,oBAAoB1D;YACpB2D,uBAAuB;gBAAEC,QAAQ;oBAAErD,MAAM,GAAG5C,oBAAoB,OAAO,CAAC;oBAAEkG,KAAK;gBAAK;YAAE;YACtFC,gBAAgB;gBAAC;aAAQ;QAC3B;QACAC,SAASpD,wBAAwBqD,GAAG,CAAC,CAAC5E,MAAS;gBAC7CA;gBACAiB,OAAOxB,yBAAyB,CAACO,IAAI;eACjCN,4BAA4B,CAACM,IAAI,GAAG;gBAAE6E,UAAUnF,4BAA4B,CAACM,IAAI;YAAC,IAAI,CAAC;gBAC3F8E,OAAOjB,yBAAyB,CAAC7D,IAAI;;QAEvC,uEAAuE;QACvE,qEAAqE;QACrE,sEAAsE;QACtE,iDAAiD;QACjD+E,aAAa;YAAEC,OAAO;QAAgB;IACxC;AACF;AAEA;;;;;;CAMC,GACD,OAAO,SAASC,sBAAsBpE,MAAe;IACnD,OAAOrC,4BAA4BqC;AACrC;AAEA,6EAA6E,GAC7E,OAAO,SAASqE,2BAA2BlB,KAAa;IACtD,OAAOvF,iCAAiCuF;AAC1C"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/activity/ai-activity-actions.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * The AI actions an activity log can carry (AGL-2929).\n *\n * Every other action in `orgs/{orgId}/activity` and `hosts/{hostId}/activity`\n * is a prose sentence written at the call site — \"Saved the screen\". The AI\n * rows are CODES instead, because they are read by more than a person: the\n * org feed's \"AI\" chip, the staff audit facet and the actor table all need\n * to recognize an AI row without parsing a sentence, and a sentence that\n * three writers phrase three ways is three rows that look unrelated.\n *\n * One list, so the writers in `ai-activity.ts`, the feed presenter and the\n * staff facet cannot disagree about what counts as AI. A code missing from\n * `AI_ACTIVITY_ACTION_LABELS` fails the type, not the reader.\n */\n\nimport type { AiJobOutputResource } from '../model/ai-jobs.types'\nimport { PLATFORM_BRAND_NAME } from '@aglyn/aglyn/app-utils/platform-brand'\nimport {\n pluginStaffAuditActionGroup,\n pluginStaffAuditActionGroupLabel,\n registerPluginActivityActions,\n type PluginActivityScope,\n} from '@aglyn/aglyn/plugin-manager/plugin-activity-actions'\n\nexport {\n AI_ACTIVITY_ACTIONS,\n AI_ACTIVITY_ACTION_LABELS,\n AI_ACTIVITY_ACTION_SENTENCES,\n type AiActivityAction,\n} from './ai-activity-words'\nimport {\n AI_ACTIVITY_ACTIONS,\n AI_ACTIVITY_ACTION_LABELS,\n AI_ACTIVITY_ACTION_SENTENCES,\n type AiActivityAction,\n} from './ai-activity-words'\n\n/**\n * What the staff audit trail reads for each code the AI doors write to\n * `adminAudit` (AGL-3660). `ai.job.output` is spelled out per row by the\n * shared describer, which names the thing made.\n */\nexport const AI_STAFF_AUDIT_LABELS: Readonly<Record<string, string>> = {\n 'ai.job.output': `Created a draft with ${PLATFORM_BRAND_NAME} AI`,\n 'ai.job.cancel': `Canceled an ${PLATFORM_BRAND_NAME} AI job`,\n 'ai.job.resume': `Confirmed an ${PLATFORM_BRAND_NAME} AI plan`,\n 'ai.job.apply': `Applied an ${PLATFORM_BRAND_NAME} AI result`,\n 'ai.generate': `Generated with ${PLATFORM_BRAND_NAME} AI`,\n 'ai.allotments.set': 'Set AI allotments',\n 'ai.credits.giveBack': 'Gave AI credits back',\n 'ai.credits.reset': 'Reset AI credits',\n 'ai.overage.clearCeiling': 'Cleared the AI overage ceiling',\n 'ai.overage.liftPause': 'Lifted the AI pause',\n 'ai.overage.resetStep': 'Reset the AI overage step',\n 'ai.overage.setCeiling': 'Set the AI overage ceiling',\n 'platform.aiFreeSpend.paused': 'Paused free AI for the day',\n 'org.ai-viewed': 'Viewed the organization’s AI usage',\n 'user.ai-usage-viewed': 'Viewed the account’s AI usage',\n 'org.ai-conversations-viewed': `Viewed the organization’s ${PLATFORM_BRAND_NAME} AI requests`,\n 'user.ai-requests-viewed': `Viewed the account’s ${PLATFORM_BRAND_NAME} AI requests`,\n ...Object.fromEntries(\n Object.entries(AI_ACTIVITY_ACTION_LABELS).filter(([key]) => key !== 'ai.job.output'),\n ),\n}\n\n/** A job output's `resource`, as the noun the audit sentence uses. */\nconst AI_OUTPUT_NOUNS: Readonly<Record<string, string>> = {\n screen: 'page',\n reusableComponent: 'component',\n emailScreen: 'email',\n orgAutomation: 'automation',\n workflow: 'automation',\n entry: 'post',\n text: 'copy',\n seo: 'search fixes',\n crm: 'CRM answer',\n insight: 'insight',\n}\n\n/**\n * An `ai.job.output` audit row in words (AGL-3660), from the `after` the\n * job writer stores — `{ resource, label }`: `Created page Home with Aglyn\n * AI`, and its outcome, a draft.\n */\nexport function aiStaffAuditDescribe(entry: {\n action: string\n after: Readonly<Record<string, unknown>>\n}): { action?: string; result?: string } | undefined {\n if (entry.action !== AI_ACTIVITY_ACTIONS.jobOutput) return undefined\n const resource = typeof entry.after['resource'] === 'string' ? entry.after['resource'] : ''\n const label = typeof entry.after['label'] === 'string' ? entry.after['label'].trim() : ''\n const noun =\n AI_OUTPUT_NOUNS[resource] ??\n (resource ? resource.replace(/([a-z])([A-Z])/g, '$1 $2').toLowerCase() : 'draft')\n return {\n action: `Created ${noun}${label ? ` ${label}` : ''} with ${PLATFORM_BRAND_NAME} AI`,\n result: 'Draft created',\n }\n}\n\n/** Every code, in catalog order — what a filter sends as `isAnyOf`. */\nexport const AI_ACTIVITY_ACTION_LIST: readonly AiActivityAction[] =\n Object.values(AI_ACTIVITY_ACTIONS)\n\n/** The feed's filter chip and the staff facet's group, by one name. */\nexport const AI_ACTIVITY_FILTER_LABEL = 'AI'\n\n/**\n * Why a generation stopped and asked for a person (AGL-2904): the plan's\n * band ran out, the org's own ceiling refused, the monthly message cap or\n * the job's own token budget did — or, on the Free taste (AGL-2925), one of\n * its own precautions: the account's credits, its daily request cap, a\n * pause after declined briefs, or the platform's day of free spend. Those\n * are the meter's `AssistRefusedBy` less its `null`, so a ceiling the meter\n * can name is one the feed can label. The last five are the job's own: its\n * plan is ready for review, or an answer broke a building rule on its re-ask\n * (AGL-2935), or the site is at an allowance its plan sets for what the job\n * writes (AGL-2909), or a site import's wave waits for its review or for the\n * site to be verified again (AGL-3976).\n */\nexport type AiJobNeedsInputReason =\n | 'band'\n | 'cap'\n | 'messages'\n | 'budget'\n | 'allotment'\n | 'account'\n | 'requests'\n | 'refusals'\n | 'platform'\n | 'plan'\n | 'doctrine'\n | 'limit'\n | 'wave'\n | 'ownership'\n | 'input'\n\nexport const AI_JOB_NEEDS_INPUT_REASON_LABELS: Record<\n AiJobNeedsInputReason,\n string\n> = {\n plan: 'its plan is ready for review',\n doctrine: 'its answer broke a building rule twice',\n limit: 'the site reached an allowance of its plan',\n // A site import (AGL-3976): its next wave waits to be started, or for the site to be verified again.\n wave: 'a wave of the site it brings in is ready for review',\n ownership: 'the site it brings in must be verified again',\n input: 'it needs an ID only the person can give',\n band: 'the included AI band is used up',\n cap: 'the overage ceiling was reached',\n messages: 'the monthly message cap was reached',\n budget: 'the job budget was reached',\n allotment: 'the creator’s or the site’s AI allotment is used up',\n account: 'the account’s free AI credits are used up',\n requests: 'the daily free request cap was reached',\n refusals: 'free generation is paused for the day after declined briefs',\n platform: 'free AI generation is paused for the day',\n}\n\n/**\n * The feed target types a generation job's output can be filed under: the\n * kinds both activity logs know, so the org row and its host copy share a\n * shape.\n */\nexport type AiOutputTargetType =\n | 'screen'\n | 'layout'\n | 'component'\n | 'template'\n | 'workflow'\n | 'content'\n | 'theme'\n\n/**\n * Where the feed files each resource kind a job can write (AGL-2904).\n *\n * A job names its output by the resource it wrote, and the activity logs\n * know a narrower set of targets. The map is total, so a resource kind\n * added to the job document must say where the feed shows it before the\n * machine can log it. `reusableComponent` is the feed's `component`; a\n * `text` output is copy, which the feed files as `content`; a `theme`\n * proposal is filed under the site's theme, which the host feed links to the\n * Theme section (AGL-2938); the kinds whose runners have not shipped are\n * content of the site too, and are filed there until a target of their own\n * exists.\n */\nconst AI_OUTPUT_TARGET_TYPES: Record<AiJobOutputResource, AiOutputTargetType> = {\n screen: 'screen',\n reusableComponent: 'component',\n layout: 'layout',\n template: 'template',\n form: 'content',\n emailScreen: 'content',\n campaign: 'content',\n product: 'content',\n experiment: 'content',\n workflow: 'workflow',\n // An SEO proposal (AGL-2910) is about the site's content, and is filed there.\n seo: 'content',\n text: 'content',\n theme: 'theme',\n // An insight answer (AGL-2915) is about the site's figures; the feed row\n // names it and never what it says.\n insight: 'content',\n // A CRM proposal (AGL-2917) writes nothing; the feed files it with content.\n crm: 'content',\n // Another plugin's draft a build asked its writer for (AGL-3616).\n draft: 'content',\n // A logic proposal (AGL-3603) writes nothing either.\n logic: 'content',\n // So does an org automation's (AGL-3603): the editor's Save is the write.\n orgAutomation: 'content',\n // A blog post a guided start wrote (AGL-3676) is the site's content.\n entry: 'content',\n // A site's settings a build saved (AGL-3748) describe the site, filed with its content.\n settings: 'content',\n // Files a build organized in the site's media library (AGL-3752), filed with its content.\n media: 'content',\n // A site's tracking tags a build saved (AGL-3751), filed with its settings.\n tracking: 'content',\n // Who can see the site, as a build changed it (AGL-4033), filed with its content.\n privacy: 'content',\n}\n\nexport function aiOutputTargetType(resource: AiJobOutputResource): AiOutputTargetType {\n return AI_OUTPUT_TARGET_TYPES[resource]\n}\n\n/** Whether a stored action is one of the AI codes above. */\nexport function isAiActivityAction(action: unknown): action is AiActivityAction {\n return (\n typeof action === 'string' &&\n (AI_ACTIVITY_ACTION_LIST as readonly string[]).includes(action)\n )\n}\n\n/** The readable label for an AI code; `undefined` for any other action. */\nexport function aiActivityActionLabel(action: unknown): string | undefined {\n return isAiActivityAction(action)\n ? AI_ACTIVITY_ACTION_LABELS[action]\n : undefined\n}\n\n/**\n * Staff audit rows that are ABOUT AI without carrying an `ai.` code: the\n * customer's overage controls already write `billing.assistOverage.*`, and\n * the platform's free-spend auto-pause writes `platform.aiFreeSpend.*`\n * (AGL-2925). The audit page's facet folds them under the same group as the\n * codes, because \"what did we do about AI this week\" is one question.\n */\nexport const AI_STAFF_AUDIT_ACTION_PREFIXES: readonly string[] = [\n 'ai.',\n 'billing.assistOverage.',\n 'platform.aiFreeSpend.',\n]\n\n/** The facet group an `adminAudit` action belongs to. */\nexport const STAFF_AUDIT_AI_GROUP = 'ai'\n\n/**\n * Which log each code is written to. The job and edit codes land in both\n * the org feed and the host's copy; the billing and permission codes are\n * org-level facts and land in the org feed alone.\n */\nconst AI_ACTIVITY_ACTION_SCOPES: Record<\n AiActivityAction,\n PluginActivityScope | readonly PluginActivityScope[]\n> = {\n 'ai.job.created': ['org', 'host'],\n 'ai.job.output': ['org', 'host'],\n 'ai.job.canceled': ['org', 'host'],\n 'ai.job.needs_input': ['org', 'host'],\n 'ai.edit.applied': ['org', 'host'],\n 'ai.seo.applied': ['org', 'host'],\n 'ai.assist.section': ['org', 'host'],\n 'ai.overage.hardCap': 'org',\n 'ai.overage.cap': 'org',\n 'ai.allotment.changed': 'org',\n 'ai.permission.changed': 'org',\n 'ai.addon.purchased': 'org',\n 'ai.addon.removed': 'org',\n}\n\n/**\n * The catalog, declared through the generic activity-action seam\n * (AGL-2940) so the feed's chip, the actor table's filter and the staff\n * facet read it from the registry beside every other plugin's codes.\n * `registerAiDeclarations` calls it, in both apps and in the browser.\n */\nexport function registerAiActivityActions(): void {\n registerPluginActivityActions({\n pluginId: 'ai',\n group: {\n id: STAFF_AUDIT_AI_GROUP,\n label: AI_ACTIVITY_FILTER_LABEL,\n staffAuditPrefixes: AI_STAFF_AUDIT_ACTION_PREFIXES.filter(\n (prefix) => prefix !== 'ai.',\n ),\n // The staff cards opening on an org (AGL-2930) and on one account\n // (AGL-2928), which no longer write these, so the rows already in the\n // log still classify as reads; and a staff member reading what an org\n // asked Aglyn AI (AGL-3675), which writes one per page.\n // An account's AI requests on the staff user page (AGL-3660) likewise.\n staffAuditAccessActions: [\n 'org.ai-viewed',\n 'user.ai-usage-viewed',\n 'org.ai-conversations-viewed',\n 'user.ai-requests-viewed',\n ],\n staffAuditLabels: AI_STAFF_AUDIT_LABELS,\n // The audit trail's words for a job's output, its job collection and\n // the feed's job rows, read by core's shared describer (AGL-3660).\n staffAuditDescribe: aiStaffAuditDescribe,\n staffAuditCollections: { aiJobs: { noun: `${PLATFORM_BRAND_NAME} AI job`, job: true } },\n jobTargetTypes: ['aiJob'],\n },\n actions: AI_ACTIVITY_ACTION_LIST.map((key) => ({\n key,\n label: AI_ACTIVITY_ACTION_LABELS[key],\n ...(AI_ACTIVITY_ACTION_SENTENCES[key] ? { sentence: AI_ACTIVITY_ACTION_SENTENCES[key] } : {}),\n scope: AI_ACTIVITY_ACTION_SCOPES[key],\n })),\n // A generation job (AGL-2904): the org feed names the job, and each of\n // its outputs names the resource it produced. Filed as `aiJob` since\n // before plugin target types were namespaced, so the noun is declared\n // here rather than read off the type (AGL-3080).\n targetTypes: { aiJob: 'AI generation' },\n })\n}\n\n/**\n * The group the staff audit facet files an action under: `ai` for every\n * AI row, otherwise the action's leading namespace (`billing`, `org`,\n * `plugins`). Roughly seventy distinct actions write to `adminAudit`, so\n * the facet offers namespaces rather than a seventy-entry menu. Answered\n * by the registry, so every plugin's group is filed the same way.\n */\nexport function staffAuditActionGroup(action: unknown): string {\n return pluginStaffAuditActionGroup(action)\n}\n\n/** How a facet group reads in the menu: `ai` → `AI`, `billing` → `billing`. */\nexport function staffAuditActionGroupLabel(group: string): string {\n return pluginStaffAuditActionGroupLabel(group)\n}\n"],"names":["PLATFORM_BRAND_NAME","pluginStaffAuditActionGroup","pluginStaffAuditActionGroupLabel","registerPluginActivityActions","AI_ACTIVITY_ACTIONS","AI_ACTIVITY_ACTION_LABELS","AI_ACTIVITY_ACTION_SENTENCES","AI_STAFF_AUDIT_LABELS","Object","fromEntries","entries","filter","key","AI_OUTPUT_NOUNS","screen","reusableComponent","emailScreen","orgAutomation","workflow","entry","text","seo","crm","insight","aiStaffAuditDescribe","action","jobOutput","undefined","resource","after","label","trim","noun","replace","toLowerCase","result","AI_ACTIVITY_ACTION_LIST","values","AI_ACTIVITY_FILTER_LABEL","AI_JOB_NEEDS_INPUT_REASON_LABELS","plan","doctrine","limit","wave","ownership","input","band","cap","messages","budget","allotment","account","requests","refusals","platform","AI_OUTPUT_TARGET_TYPES","layout","template","form","campaign","product","experiment","theme","draft","logic","settings","media","tracking","privacy","aiOutputTargetType","isAiActivityAction","includes","aiActivityActionLabel","AI_STAFF_AUDIT_ACTION_PREFIXES","STAFF_AUDIT_AI_GROUP","AI_ACTIVITY_ACTION_SCOPES","registerAiActivityActions","pluginId","group","id","staffAuditPrefixes","prefix","staffAuditAccessActions","staffAuditLabels","staffAuditDescribe","staffAuditCollections","aiJobs","job","jobTargetTypes","actions","map","sentence","scope","targetTypes","aiJob","staffAuditActionGroup","staffAuditActionGroupLabel"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;CAaC;AAGD,SAASA,mBAAmB,QAAQ,wCAAuC;AAC3E,SACEC,2BAA2B,EAC3BC,gCAAgC,EAChCC,6BAA6B,QAExB,sDAAqD;AAE5D,SACEC,mBAAmB,EACnBC,yBAAyB,EACzBC,4BAA4B,QAEvB,yBAAqB;AAC5B,SACEF,mBAAmB,EACnBC,yBAAyB,EACzBC,4BAA4B,QAEvB,yBAAqB;AAE5B;;;;CAIC,GACD,OAAO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B,CAACO,IAAI;eACjCN,4BAA4B,CAACM,IAAI,GAAG;gBAAE+E,UAAUrF,4BAA4B,CAACM,IAAI;YAAC,IAAI,CAAC;gBAC3FgF,OAAOjB,yBAAyB,CAAC/D,IAAI;;QAEvC,uEAAuE;QACvE,qEAAqE;QACrE,sEAAsE;QACtE,iDAAiD;QACjDiF,aAAa;YAAEC,OAAO;QAAgB;IACxC;AACF;AAEA;;;;;;CAMC,GACD,OAAO,SAASC,sBAAsBtE,MAAe;IACnD,OAAOxB,4BAA4BwB;AACrC;AAEA,6EAA6E,GAC7E,OAAO,SAASuE,2BAA2BlB,KAAa;IACtD,OAAO5E,iCAAiC4E;AAC1C"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/** The action code each AI writer stores. */
|
|
18
|
+
export declare const AI_ACTIVITY_ACTIONS: {
|
|
19
|
+
readonly jobCreated: "ai.job.created";
|
|
20
|
+
readonly jobOutput: "ai.job.output";
|
|
21
|
+
readonly jobCanceled: "ai.job.canceled";
|
|
22
|
+
readonly jobNeedsInput: "ai.job.needs_input";
|
|
23
|
+
readonly editApplied: "ai.edit.applied";
|
|
24
|
+
readonly seoApplied: "ai.seo.applied";
|
|
25
|
+
readonly assistSection: "ai.assist.section";
|
|
26
|
+
readonly overageHardCap: "ai.overage.hardCap";
|
|
27
|
+
readonly overageCap: "ai.overage.cap";
|
|
28
|
+
readonly allotmentChanged: "ai.allotment.changed";
|
|
29
|
+
readonly permissionChanged: "ai.permission.changed";
|
|
30
|
+
readonly addonPurchased: "ai.addon.purchased";
|
|
31
|
+
readonly addonRemoved: "ai.addon.removed";
|
|
32
|
+
};
|
|
33
|
+
export type AiActivityAction = (typeof AI_ACTIVITY_ACTIONS)[keyof typeof AI_ACTIVITY_ACTIONS];
|
|
34
|
+
/** What a person reads for each code, in the feed and the actor table. */
|
|
35
|
+
export declare const AI_ACTIVITY_ACTION_LABELS: Record<AiActivityAction, string>;
|
|
36
|
+
/**
|
|
37
|
+
* The codes whose row reads as a sentence about its target (AGL-3660):
|
|
38
|
+
* `{target}` is the target's noun and name, so an output row reads
|
|
39
|
+
* `Created page Home with Aglyn AI` rather than `AI generated` beside a
|
|
40
|
+
* Target cell that had to finish the thought.
|
|
41
|
+
*/
|
|
42
|
+
export declare const AI_ACTIVITY_ACTION_SENTENCES: Partial<Record<AiActivityAction, string>>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ /**
|
|
17
|
+
* The AI activity codes and the words a reader sees for them (AGL-2929, AGL-3660), apart from the registration in
|
|
18
|
+
* `ai-activity-actions.ts` so the native apps read the same words from the contracts: this file imports only the
|
|
19
|
+
* platform's brand name (AGL-4011).
|
|
20
|
+
*/ import { PLATFORM_BRAND_NAME } from "@aglyn/aglyn/app-utils/platform-brand";
|
|
21
|
+
/** The action code each AI writer stores. */ export const AI_ACTIVITY_ACTIONS = {
|
|
22
|
+
jobCreated: 'ai.job.created',
|
|
23
|
+
jobOutput: 'ai.job.output',
|
|
24
|
+
jobCanceled: 'ai.job.canceled',
|
|
25
|
+
jobNeedsInput: 'ai.job.needs_input',
|
|
26
|
+
editApplied: 'ai.edit.applied',
|
|
27
|
+
seoApplied: 'ai.seo.applied',
|
|
28
|
+
assistSection: 'ai.assist.section',
|
|
29
|
+
overageHardCap: 'ai.overage.hardCap',
|
|
30
|
+
overageCap: 'ai.overage.cap',
|
|
31
|
+
allotmentChanged: 'ai.allotment.changed',
|
|
32
|
+
permissionChanged: 'ai.permission.changed',
|
|
33
|
+
addonPurchased: 'ai.addon.purchased',
|
|
34
|
+
addonRemoved: 'ai.addon.removed'
|
|
35
|
+
};
|
|
36
|
+
/** What a person reads for each code, in the feed and the actor table. */ export const AI_ACTIVITY_ACTION_LABELS = {
|
|
37
|
+
'ai.job.created': 'Started an AI generation',
|
|
38
|
+
'ai.job.output': 'AI generated',
|
|
39
|
+
'ai.job.canceled': 'Canceled an AI generation',
|
|
40
|
+
'ai.job.needs_input': 'AI generation paused for input',
|
|
41
|
+
'ai.edit.applied': 'Applied AI edits',
|
|
42
|
+
'ai.seo.applied': 'Applied AI SEO fixes as drafts',
|
|
43
|
+
'ai.assist.section': 'AI generated a section',
|
|
44
|
+
'ai.overage.hardCap': 'AI stop-at-band switch',
|
|
45
|
+
'ai.overage.cap': 'AI overage ceiling',
|
|
46
|
+
'ai.allotment.changed': 'AI allotment changed',
|
|
47
|
+
'ai.permission.changed': 'AI permission changed',
|
|
48
|
+
'ai.addon.purchased': 'Added the AI add-on',
|
|
49
|
+
'ai.addon.removed': 'Removed the AI add-on'
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* The codes whose row reads as a sentence about its target (AGL-3660):
|
|
53
|
+
* `{target}` is the target's noun and name, so an output row reads
|
|
54
|
+
* `Created page Home with Aglyn AI` rather than `AI generated` beside a
|
|
55
|
+
* Target cell that had to finish the thought.
|
|
56
|
+
*/ export const AI_ACTIVITY_ACTION_SENTENCES = {
|
|
57
|
+
'ai.job.output': `Created {target} with ${PLATFORM_BRAND_NAME} AI`,
|
|
58
|
+
'ai.edit.applied': `Applied ${PLATFORM_BRAND_NAME} AI edits to {target}`,
|
|
59
|
+
'ai.seo.applied': `Applied ${PLATFORM_BRAND_NAME} AI search fixes to {target}`,
|
|
60
|
+
'ai.assist.section': `Added a section to {target} with ${PLATFORM_BRAND_NAME} AI`
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=ai-activity-words.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/activity/ai-activity-words.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * The AI activity codes and the words a reader sees for them (AGL-2929, AGL-3660), apart from the registration in\n * `ai-activity-actions.ts` so the native apps read the same words from the contracts: this file imports only the\n * platform's brand name (AGL-4011).\n */\n\nimport { PLATFORM_BRAND_NAME } from '@aglyn/aglyn/app-utils/platform-brand'\n\n/** The action code each AI writer stores. */\nexport const AI_ACTIVITY_ACTIONS = {\n jobCreated: 'ai.job.created',\n jobOutput: 'ai.job.output',\n jobCanceled: 'ai.job.canceled',\n jobNeedsInput: 'ai.job.needs_input',\n editApplied: 'ai.edit.applied',\n seoApplied: 'ai.seo.applied',\n assistSection: 'ai.assist.section',\n overageHardCap: 'ai.overage.hardCap',\n overageCap: 'ai.overage.cap',\n allotmentChanged: 'ai.allotment.changed',\n permissionChanged: 'ai.permission.changed',\n addonPurchased: 'ai.addon.purchased',\n addonRemoved: 'ai.addon.removed',\n} as const\n\nexport type AiActivityAction =\n (typeof AI_ACTIVITY_ACTIONS)[keyof typeof AI_ACTIVITY_ACTIONS]\n\n/** What a person reads for each code, in the feed and the actor table. */\nexport const AI_ACTIVITY_ACTION_LABELS: Record<AiActivityAction, string> = {\n 'ai.job.created': 'Started an AI generation',\n 'ai.job.output': 'AI generated',\n 'ai.job.canceled': 'Canceled an AI generation',\n 'ai.job.needs_input': 'AI generation paused for input',\n 'ai.edit.applied': 'Applied AI edits',\n 'ai.seo.applied': 'Applied AI SEO fixes as drafts',\n 'ai.assist.section': 'AI generated a section',\n 'ai.overage.hardCap': 'AI stop-at-band switch',\n 'ai.overage.cap': 'AI overage ceiling',\n 'ai.allotment.changed': 'AI allotment changed',\n 'ai.permission.changed': 'AI permission changed',\n 'ai.addon.purchased': 'Added the AI add-on',\n 'ai.addon.removed': 'Removed the AI add-on',\n}\n\n/**\n * The codes whose row reads as a sentence about its target (AGL-3660):\n * `{target}` is the target's noun and name, so an output row reads\n * `Created page Home with Aglyn AI` rather than `AI generated` beside a\n * Target cell that had to finish the thought.\n */\nexport const AI_ACTIVITY_ACTION_SENTENCES: Partial<Record<AiActivityAction, string>> = {\n 'ai.job.output': `Created {target} with ${PLATFORM_BRAND_NAME} AI`,\n 'ai.edit.applied': `Applied ${PLATFORM_BRAND_NAME} AI edits to {target}`,\n 'ai.seo.applied': `Applied ${PLATFORM_BRAND_NAME} AI search fixes to {target}`,\n 'ai.assist.section': `Added a section to {target} with ${PLATFORM_BRAND_NAME} AI`,\n}\n"],"names":["PLATFORM_BRAND_NAME","AI_ACTIVITY_ACTIONS","jobCreated","jobOutput","jobCanceled","jobNeedsInput","editApplied","seoApplied","assistSection","overageHardCap","overageCap","allotmentChanged","permissionChanged","addonPurchased","addonRemoved","AI_ACTIVITY_ACTION_LABELS","AI_ACTIVITY_ACTION_SENTENCES"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;CAIC,GAED,SAASA,mBAAmB,QAAQ,wCAAuC;AAE3E,2CAA2C,GAC3C,OAAO,MAAMC,sBAAsB;IACjCC,YAAY;IACZC,WAAW;IACXC,aAAa;IACbC,eAAe;IACfC,aAAa;IACbC,YAAY;IACZC,eAAe;IACfC,gBAAgB;IAChBC,YAAY;IACZC,kBAAkB;IAClBC,mBAAmB;IACnBC,gBAAgB;IAChBC,cAAc;AAChB,EAAU;AAKV,wEAAwE,GACxE,OAAO,MAAMC,4BAA8D;IACzE,kBAAkB;IAClB,iBAAiB;IACjB,mBAAmB;IACnB,sBAAsB;IACtB,mBAAmB;IACnB,kBAAkB;IAClB,qBAAqB;IACrB,sBAAsB;IACtB,kBAAkB;IAClB,wBAAwB;IACxB,yBAAyB;IACzB,sBAAsB;IACtB,oBAAoB;AACtB,EAAC;AAED;;;;;CAKC,GACD,OAAO,MAAMC,+BAA0E;IACrF,iBAAiB,CAAC,sBAAsB,EAAEhB,oBAAoB,GAAG,CAAC;IAClE,mBAAmB,CAAC,QAAQ,EAAEA,oBAAoB,qBAAqB,CAAC;IACxE,kBAAkB,CAAC,QAAQ,EAAEA,oBAAoB,4BAA4B,CAAC;IAC9E,qBAAqB,CAAC,iCAAiC,EAAEA,oBAAoB,GAAG,CAAC;AACnF,EAAC"}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import type { ConsoleWidgetEntitlementProps } from '@aglyn/aglyn/plugin-manager/feature-plugins';
|
|
18
18
|
import type { ConsolePluginOrgMount } from '@aglyn/aglyn';
|
|
19
|
+
import { AI_INSIGHT_CARD_COPY } from '../model/ai-insight-ask';
|
|
19
20
|
/**
|
|
20
21
|
* "Ask AI about these numbers" (AGL-3603): a tile on a site's dashboard and
|
|
21
22
|
* Analytics page (`hostDashboard`, which both draw) and on the workspace's
|
|
@@ -26,12 +27,7 @@ import type { ConsolePluginOrgMount } from '@aglyn/aglyn';
|
|
|
26
27
|
* (AGL-3601): nothing asks a server until a question is asked, and on a plan
|
|
27
28
|
* without the AI add-on the same tile opens the add-on's dialog.
|
|
28
29
|
*/
|
|
29
|
-
export
|
|
30
|
-
readonly title: "Ask AI about these numbers";
|
|
31
|
-
readonly site: "Ask a question about this site’s traffic, sales, bookings, automation runs and pipeline. Every answer shows the figures it is built from.";
|
|
32
|
-
readonly workspace: "Ask a question about your workspace’s pipeline, the deals it closed and your datasets. Every answer shows the figures it is built from.";
|
|
33
|
-
readonly action: "Ask a question";
|
|
34
|
-
};
|
|
30
|
+
export { AI_INSIGHT_CARD_COPY };
|
|
35
31
|
/** On a site's dashboard and its Analytics page. */
|
|
36
32
|
export declare function AiInsightHostCard({ hostId, entitled, upgrade, }: {
|
|
37
33
|
hostId: string;
|
|
@@ -8,6 +8,7 @@ import { Button, Stack, Typography } from "@mui/material";
|
|
|
8
8
|
import { useState } from "react";
|
|
9
9
|
import { AiInsightDialog } from "./ai-insight-dialog.component.js";
|
|
10
10
|
import { AiUpsellDialog } from "./ai-upsell-dialog.component.js";
|
|
11
|
+
import { AI_INSIGHT_CARD_COPY } from "../model/ai-insight-ask.js";
|
|
11
12
|
/**
|
|
12
13
|
* "Ask AI about these numbers" (AGL-3603): a tile on a site's dashboard and
|
|
13
14
|
* Analytics page (`hostDashboard`, which both draw) and on the workspace's
|
|
@@ -17,12 +18,7 @@ import { AiUpsellDialog } from "./ai-upsell-dialog.component.js";
|
|
|
17
18
|
* it cites — charged as that job is. Drawn from the shell's gates alone
|
|
18
19
|
* (AGL-3601): nothing asks a server until a question is asked, and on a plan
|
|
19
20
|
* without the AI add-on the same tile opens the add-on's dialog.
|
|
20
|
-
*/ export
|
|
21
|
-
title: 'Ask AI about these numbers',
|
|
22
|
-
site: 'Ask a question about this site’s traffic, sales, bookings, automation runs and pipeline. Every answer shows the figures it is built from.',
|
|
23
|
-
workspace: 'Ask a question about your workspace’s pipeline, the deals it closed and your datasets. Every answer shows the figures it is built from.',
|
|
24
|
-
action: 'Ask a question'
|
|
25
|
-
};
|
|
21
|
+
*/ export { AI_INSIGHT_CARD_COPY };
|
|
26
22
|
function InsightTile(props) {
|
|
27
23
|
const help = pluginDocsHelp('aiInsights', {
|
|
28
24
|
anchor: '#asking-a-question'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/components/ai-insight-card.component.tsx"],"sourcesContent":["'use client'\n\n/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ConsoleWidgetEntitlementProps } from '@aglyn/aglyn/plugin-manager/feature-plugins'\nimport type { ConsolePluginOrgMount } from '@aglyn/aglyn'\nimport { pluginDocsHelp } from '@aglyn/aglyn/app-utils/docs-help'\nimport { mdiCreation } from '@aglyn/shared-data-mdi'\nimport { CardDisplay, MdiIcon } from '@aglyn/shared-ui-jsx'\nimport { useConsoleHostRoute, useHostOrgId, useUser } from '@aglyn/tenant-feature-instance'\nimport { Button, Stack, Typography } from '@mui/material'\nimport { useState } from 'react'\nimport { AiInsightDialog } from './ai-insight-dialog.component'\nimport { AiUpsellDialog } from './ai-upsell-dialog.component'\n\n/**\n * \"Ask AI about these numbers\" (AGL-3603): a tile on a site's dashboard and\n * Analytics page (`hostDashboard`, which both draw) and on the workspace's\n * sites page (`orgDashboard`), opening the insight dialog the Assist panel\n * opens. A question becomes an `insight` job — the figures read by code\n * through the readers the surface offers, every insight traced to the rows\n * it cites — charged as that job is. Drawn from the shell's gates alone\n * (AGL-3601): nothing asks a server until a question is asked, and on a plan\n * without the AI add-on the same tile opens the add-on's dialog.\n */\n\nexport
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/components/ai-insight-card.component.tsx"],"sourcesContent":["'use client'\n\n/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ConsoleWidgetEntitlementProps } from '@aglyn/aglyn/plugin-manager/feature-plugins'\nimport type { ConsolePluginOrgMount } from '@aglyn/aglyn'\nimport { pluginDocsHelp } from '@aglyn/aglyn/app-utils/docs-help'\nimport { mdiCreation } from '@aglyn/shared-data-mdi'\nimport { CardDisplay, MdiIcon } from '@aglyn/shared-ui-jsx'\nimport { useConsoleHostRoute, useHostOrgId, useUser } from '@aglyn/tenant-feature-instance'\nimport { Button, Stack, Typography } from '@mui/material'\nimport { useState } from 'react'\nimport { AiInsightDialog } from './ai-insight-dialog.component'\nimport { AiUpsellDialog } from './ai-upsell-dialog.component'\nimport { AI_INSIGHT_CARD_COPY } from '../model/ai-insight-ask'\n\n/**\n * \"Ask AI about these numbers\" (AGL-3603): a tile on a site's dashboard and\n * Analytics page (`hostDashboard`, which both draw) and on the workspace's\n * sites page (`orgDashboard`), opening the insight dialog the Assist panel\n * opens. A question becomes an `insight` job — the figures read by code\n * through the readers the surface offers, every insight traced to the rows\n * it cites — charged as that job is. Drawn from the shell's gates alone\n * (AGL-3601): nothing asks a server until a question is asked, and on a plan\n * without the AI add-on the same tile opens the add-on's dialog.\n */\n\nexport { AI_INSIGHT_CARD_COPY }\n\nfunction InsightTile(props: {\n text: string\n onAsk: () => void\n}) {\n const help = pluginDocsHelp('aiInsights', { anchor: '#asking-a-question' })\n return (\n <CardDisplay header={AI_INSIGHT_CARD_COPY.title} help={help} contentGutterX contentGutterY>\n <Stack spacing={1.5} sx={{ alignItems: 'flex-start' }}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {props.text}\n </Typography>\n <Button\n size=\"small\"\n variant=\"outlined\"\n startIcon={<MdiIcon path={mdiCreation.path} />}\n onClick={props.onAsk}\n >\n {AI_INSIGHT_CARD_COPY.action}\n </Button>\n </Stack>\n </CardDisplay>\n )\n}\n\n/** The tile on a plan without the AI add-on: the same tile, opening the add-on's dialog. */\nfunction InsightUpsellTile({ text, upgrade }: { text: string; upgrade: ConsoleWidgetEntitlementProps['upgrade'] }) {\n const [open, setOpen] = useState(false)\n if (!upgrade) return null\n return (\n <>\n <InsightTile text={text} onAsk={() => setOpen(true)} />\n <AiUpsellDialog kind=\"insight\" open={open} onClose={() => setOpen(false)} upgrade={upgrade} />\n </>\n )\n}\n\n/** On a site's dashboard and its Analytics page. */\nexport function AiInsightHostCard({\n hostId,\n entitled,\n upgrade,\n}: { hostId: string } & ConsoleWidgetEntitlementProps) {\n const { data: user } = useUser()\n const orgId = useHostOrgId(hostId)\n const route = useConsoleHostRoute(hostId)\n const [open, setOpen] = useState(false)\n if (entitled === false) return <InsightUpsellTile text={AI_INSIGHT_CARD_COPY.site} upgrade={upgrade} />\n if (!orgId) return null\n return (\n <>\n <InsightTile text={AI_INSIGHT_CARD_COPY.site} onAsk={() => setOpen(true)} />\n {open ? (\n <AiInsightDialog\n open\n onClose={() => setOpen(false)}\n orgId={orgId}\n orgSlug={route.orgSlug ?? ''}\n hostId={hostId}\n host={route.subdomain}\n surface=\"analytics\"\n user={user}\n uid={(user as { uid?: string } | null | undefined)?.uid ?? null}\n />\n ) : null}\n </>\n )\n}\n\n/** On the workspace's sites page, totaling the organization rather than one site. */\nexport function AiInsightOrgCard({\n orgMount,\n entitled,\n upgrade,\n}: { orgMount?: ConsolePluginOrgMount | null } & ConsoleWidgetEntitlementProps) {\n const { data: user } = useUser()\n const orgId = orgMount?.orgId ?? null\n const [open, setOpen] = useState(false)\n if (entitled === false) return <InsightUpsellTile text={AI_INSIGHT_CARD_COPY.workspace} upgrade={upgrade} />\n if (!orgId) return null\n return (\n <>\n <InsightTile text={AI_INSIGHT_CARD_COPY.workspace} onAsk={() => setOpen(true)} />\n {open ? (\n <AiInsightDialog\n open\n onClose={() => setOpen(false)}\n orgId={orgId}\n orgSlug={orgMount?.orgSlug ?? ''}\n hostId={null}\n host={null}\n surface=\"workspace\"\n user={user}\n uid={(user as { uid?: string } | null | undefined)?.uid ?? null}\n />\n ) : null}\n </>\n )\n}\n"],"names":["pluginDocsHelp","mdiCreation","CardDisplay","MdiIcon","useConsoleHostRoute","useHostOrgId","useUser","Button","Stack","Typography","useState","AiInsightDialog","AiUpsellDialog","AI_INSIGHT_CARD_COPY","InsightTile","props","help","anchor","header","title","contentGutterX","contentGutterY","spacing","sx","alignItems","variant","color","text","size","startIcon","path","onClick","onAsk","action","InsightUpsellTile","upgrade","open","setOpen","kind","onClose","AiInsightHostCard","hostId","entitled","route","data","user","orgId","site","orgSlug","host","subdomain","surface","uid","AiInsightOrgCard","orgMount","workspace"],"mappings":"AAAA;;AAqBA,SAASA,cAAc,QAAQ,mCAAkC;AACjE,SAASC,WAAW,QAAQ,yBAAwB;AACpD,SAASC,WAAW,EAAEC,OAAO,QAAQ,uBAAsB;AAC3D,SAASC,mBAAmB,EAAEC,YAAY,EAAEC,OAAO,QAAQ,iCAAgC;AAC3F,SAASC,MAAM,EAAEC,KAAK,EAAEC,UAAU,QAAQ,gBAAe;AACzD,SAASC,QAAQ,QAAQ,QAAO;AAChC,SAASC,eAAe,QAAQ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