@aglyn/plugins-ai 1.0.0-beta.229 → 1.0.0-beta.230
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/package.json +17 -17
- package/src/lib/activity/ai-activity-actions.js +7 -1
- package/src/lib/activity/ai-activity-actions.js.map +1 -1
- package/src/lib/components/ai-automation-zones.d.ts +38 -0
- package/src/lib/components/ai-automation-zones.js +5 -1
- package/src/lib/components/ai-automation-zones.js.map +1 -1
- package/src/lib/components/ai-brief-dialog.component.d.ts +20 -2
- package/src/lib/components/ai-brief-dialog.component.js +87 -8
- package/src/lib/components/ai-brief-dialog.component.js.map +1 -1
- package/src/lib/components/ai-campaign-create.component.d.ts +54 -0
- package/src/lib/components/ai-campaign-create.component.js +270 -0
- package/src/lib/components/ai-campaign-create.component.js.map +1 -0
- package/src/lib/components/ai-describe-automation.component.d.ts +8 -3
- package/src/lib/components/ai-describe-automation.component.js +15 -6
- package/src/lib/components/ai-describe-automation.component.js.map +1 -1
- package/src/lib/components/ai-describe-button.component.d.ts +20 -8
- package/src/lib/components/ai-describe-button.component.js +19 -36
- package/src/lib/components/ai-describe-button.component.js.map +1 -1
- package/src/lib/components/ai-describe-email.component.d.ts +31 -0
- package/src/lib/components/ai-describe-email.component.js +22 -0
- package/src/lib/components/ai-describe-email.component.js.map +1 -0
- package/src/lib/components/ai-describe-org-automation.component.d.ts +36 -0
- package/src/lib/components/ai-describe-org-automation.component.js +238 -0
- package/src/lib/components/ai-describe-org-automation.component.js.map +1 -0
- package/src/lib/components/ai-experiment-cards.component.d.ts +9 -1
- package/src/lib/components/ai-experiment-cards.component.js +104 -18
- package/src/lib/components/ai-experiment-cards.component.js.map +1 -1
- package/src/lib/components/ai-explain-automation.component.js +1 -5
- package/src/lib/components/ai-explain-automation.component.js.map +1 -1
- package/src/lib/components/ai-funnel-zones.component.d.ts +61 -0
- package/src/lib/components/ai-funnel-zones.component.js +178 -0
- package/src/lib/components/ai-funnel-zones.component.js.map +1 -0
- package/src/lib/components/ai-insight-card.component.d.ts +42 -0
- package/src/lib/components/ai-insight-card.component.js +137 -0
- package/src/lib/components/ai-insight-card.component.js.map +1 -0
- package/src/lib/components/ai-insight-dialog.component.d.ts +6 -0
- package/src/lib/components/ai-insight-dialog.component.js +9 -3
- package/src/lib/components/ai-insight-dialog.component.js.map +1 -1
- package/src/lib/components/ai-job-plan.component.d.ts +7 -2
- package/src/lib/components/ai-job-plan.component.js +35 -5
- package/src/lib/components/ai-job-plan.component.js.map +1 -1
- package/src/lib/components/ai-job-requests.d.ts +17 -1
- package/src/lib/components/ai-job-requests.js +39 -3
- package/src/lib/components/ai-job-requests.js.map +1 -1
- package/src/lib/components/ai-logic-zones.d.ts +64 -0
- package/src/lib/components/ai-logic-zones.js +18 -0
- package/src/lib/components/ai-logic-zones.js.map +1 -0
- package/src/lib/components/ai-logic.component.d.ts +77 -0
- package/src/lib/components/ai-logic.component.js +553 -0
- package/src/lib/components/ai-logic.component.js.map +1 -0
- package/src/lib/components/ai-marketing-insight.component.d.ts +30 -0
- package/src/lib/components/ai-marketing-insight.component.js +80 -0
- package/src/lib/components/ai-marketing-insight.component.js.map +1 -0
- package/src/lib/components/ai-media-create.component.d.ts +55 -0
- package/src/lib/components/ai-media-create.component.js +433 -0
- package/src/lib/components/ai-media-create.component.js.map +1 -0
- package/src/lib/components/ai-overlay-cards.component.d.ts +83 -0
- package/src/lib/components/ai-overlay-cards.component.js +505 -0
- package/src/lib/components/ai-overlay-cards.component.js.map +1 -0
- package/src/lib/components/ai-product-zones.d.ts +5 -0
- package/src/lib/components/ai-product-zones.js +1 -1
- package/src/lib/components/ai-product-zones.js.map +1 -1
- package/src/lib/components/ai-products-create-button.component.d.ts +42 -0
- package/src/lib/components/ai-products-create-button.component.js +67 -0
- package/src/lib/components/ai-products-create-button.component.js.map +1 -0
- package/src/lib/components/ai-products-hub-card.component.js +100 -81
- package/src/lib/components/ai-products-hub-card.component.js.map +1 -1
- package/src/lib/components/ai-revise-automation.component.d.ts +16 -0
- package/src/lib/components/ai-revise-automation.component.js +207 -0
- package/src/lib/components/ai-revise-automation.component.js.map +1 -0
- package/src/lib/components/ai-site-build-page.component.js +140 -16
- package/src/lib/components/ai-site-build-page.component.js.map +1 -1
- package/src/lib/components/ai-upsell-dialog.component.d.ts +53 -0
- package/src/lib/components/ai-upsell-dialog.component.js +177 -0
- package/src/lib/components/ai-upsell-dialog.component.js.map +1 -0
- package/src/lib/components/assist-build-card.component.d.ts +42 -0
- package/src/lib/components/assist-build-card.component.js +183 -0
- package/src/lib/components/assist-build-card.component.js.map +1 -0
- package/src/lib/components/assist-edit-canvas.d.ts +2 -0
- package/src/lib/components/assist-edit-canvas.js +56 -1
- package/src/lib/components/assist-edit-canvas.js.map +1 -1
- package/src/lib/components/assist-jobs-drawer.component.js +48 -3
- package/src/lib/components/assist-jobs-drawer.component.js.map +1 -1
- package/src/lib/components/assist-panel.component.js +51 -2
- package/src/lib/components/assist-panel.component.js.map +1 -1
- package/src/lib/components/use-ai-job-run.d.ts +3 -14
- package/src/lib/components/use-ai-job-run.js +0 -50
- package/src/lib/components/use-ai-job-run.js.map +1 -1
- package/src/lib/jobs/ai-build-capabilities.d.ts +58 -0
- package/src/lib/jobs/ai-build-capabilities.js +256 -0
- package/src/lib/jobs/ai-build-capabilities.js.map +1 -0
- package/src/lib/jobs/ai-build-unit-outcome.d.ts +52 -0
- package/src/lib/jobs/ai-build-unit-outcome.js +138 -0
- package/src/lib/jobs/ai-build-unit-outcome.js.map +1 -0
- package/src/lib/jobs/ai-job-build-step.d.ts +144 -0
- package/src/lib/jobs/ai-job-build-step.js +657 -0
- package/src/lib/jobs/ai-job-build-step.js.map +1 -0
- package/src/lib/jobs/ai-job-draft-ids.js +9 -1
- package/src/lib/jobs/ai-job-draft-ids.js.map +1 -1
- package/src/lib/jobs/ai-job-drafts.d.ts +14 -4
- package/src/lib/jobs/ai-job-drafts.js +25 -4
- package/src/lib/jobs/ai-job-drafts.js.map +1 -1
- package/src/lib/jobs/ai-job-logic-step.d.ts +107 -0
- package/src/lib/jobs/ai-job-logic-step.js +395 -0
- package/src/lib/jobs/ai-job-logic-step.js.map +1 -0
- package/src/lib/jobs/ai-job-overlay-copy.d.ts +70 -0
- package/src/lib/jobs/ai-job-overlay-copy.js +178 -0
- package/src/lib/jobs/ai-job-overlay-copy.js.map +1 -0
- package/src/lib/jobs/ai-job-page-step.js +6 -6
- package/src/lib/jobs/ai-job-page-step.js.map +1 -1
- package/src/lib/jobs/ai-job-plan-step.d.ts +26 -1
- package/src/lib/jobs/ai-job-plan-step.js +79 -11
- package/src/lib/jobs/ai-job-plan-step.js.map +1 -1
- package/src/lib/jobs/ai-job-site-step.d.ts +15 -1
- package/src/lib/jobs/ai-job-site-step.js +200 -58
- package/src/lib/jobs/ai-job-site-step.js.map +1 -1
- package/src/lib/jobs/ai-job-text-step.d.ts +22 -1
- package/src/lib/jobs/ai-job-text-step.js +12 -0
- package/src/lib/jobs/ai-job-text-step.js.map +1 -1
- package/src/lib/jobs/ai-job-workflow-step.d.ts +54 -4
- package/src/lib/jobs/ai-job-workflow-step.js +318 -13
- package/src/lib/jobs/ai-job-workflow-step.js.map +1 -1
- package/src/lib/jobs/ai-jobs.d.ts +80 -2
- package/src/lib/jobs/ai-jobs.js +377 -13
- package/src/lib/jobs/ai-jobs.js.map +1 -1
- package/src/lib/jobs/ai-logic-records.d.ts +40 -0
- package/src/lib/jobs/ai-logic-records.js +55 -0
- package/src/lib/jobs/ai-logic-records.js.map +1 -0
- package/src/lib/jobs/ai-site-publish.d.ts +7 -0
- package/src/lib/jobs/ai-site-publish.js +9 -0
- package/src/lib/jobs/ai-site-publish.js.map +1 -1
- package/src/lib/jobs/ai-workflow-records.d.ts +4 -0
- package/src/lib/jobs/ai-workflow-records.js +40 -1
- package/src/lib/jobs/ai-workflow-records.js.map +1 -1
- package/src/lib/model/ai-automation-draft.d.ts +18 -0
- package/src/lib/model/ai-automation-draft.js +86 -0
- package/src/lib/model/ai-automation-draft.js.map +1 -1
- package/src/lib/model/ai-build-job.d.ts +201 -0
- package/src/lib/model/ai-build-job.js +471 -0
- package/src/lib/model/ai-build-job.js.map +1 -0
- package/src/lib/model/ai-build-plan.d.ts +61 -0
- package/src/lib/model/ai-build-plan.js +154 -9
- package/src/lib/model/ai-build-plan.js.map +1 -1
- package/src/lib/model/ai-build-progress.d.ts +56 -0
- package/src/lib/model/ai-build-progress.js +128 -0
- package/src/lib/model/ai-build-progress.js.map +1 -0
- package/src/lib/model/ai-insight.d.ts +20 -10
- package/src/lib/model/ai-insight.js +72 -9
- package/src/lib/model/ai-insight.js.map +1 -1
- package/src/lib/model/ai-job-activity.js +3 -1
- package/src/lib/model/ai-job-activity.js.map +1 -1
- package/src/lib/model/ai-jobs.types.d.ts +80 -2
- package/src/lib/model/ai-jobs.types.js +3 -1
- package/src/lib/model/ai-jobs.types.js.map +1 -1
- package/src/lib/model/ai-logic-job.d.ts +108 -0
- package/src/lib/model/ai-logic-job.js +327 -0
- package/src/lib/model/ai-logic-job.js.map +1 -0
- package/src/lib/model/ai-media-credits.d.ts +52 -0
- package/src/lib/model/ai-media-credits.js +61 -0
- package/src/lib/model/ai-media-credits.js.map +1 -0
- package/src/lib/model/ai-overlay-copy.d.ts +114 -0
- package/src/lib/model/ai-overlay-copy.js +175 -0
- package/src/lib/model/ai-overlay-copy.js.map +1 -0
- package/src/lib/model/ai-site-build-progress.d.ts +20 -3
- package/src/lib/model/ai-site-build-progress.js +170 -10
- package/src/lib/model/ai-site-build-progress.js.map +1 -1
- package/src/lib/model/ai-svg.d.ts +69 -0
- package/src/lib/model/ai-svg.js +265 -0
- package/src/lib/model/ai-svg.js.map +1 -0
- package/src/lib/model/ai-usage-by-user.d.ts +3 -2
- package/src/lib/model/ai-usage-by-user.js.map +1 -1
- package/src/lib/model/ai-workflow-job.d.ts +92 -4
- package/src/lib/model/ai-workflow-job.js +124 -7
- package/src/lib/model/ai-workflow-job.js.map +1 -1
- package/src/lib/model/assist-build.d.ts +58 -0
- package/src/lib/model/assist-build.js +52 -0
- package/src/lib/model/assist-build.js.map +1 -0
- package/src/lib/model/assist-edit.d.ts +48 -3
- package/src/lib/model/assist-edit.js +48 -4
- package/src/lib/model/assist-edit.js.map +1 -1
- package/src/lib/plugin-config.js +2 -0
- package/src/lib/plugin-config.js.map +1 -1
- package/src/lib/plugin.js +240 -11
- package/src/lib/plugin.js.map +1 -1
- package/src/lib/providers/catalog.d.ts +81 -4
- package/src/lib/providers/catalog.js +80 -9
- package/src/lib/providers/catalog.js.map +1 -1
- package/src/lib/providers/image-contract.d.ts +116 -0
- package/src/lib/providers/image-contract.js +74 -0
- package/src/lib/providers/image-contract.js.map +1 -0
- package/src/lib/providers/model-choice.js +11 -0
- package/src/lib/providers/model-choice.js.map +1 -1
- package/src/lib/providers/routing.js +18 -0
- package/src/lib/providers/routing.js.map +1 -1
- package/src/lib/providers/vertex-image.d.ts +121 -0
- package/src/lib/providers/vertex-image.js +312 -0
- package/src/lib/providers/vertex-image.js.map +1 -0
- package/src/lib/runtime/ai-doctrine-validators.d.ts +19 -0
- package/src/lib/runtime/ai-doctrine-validators.js +89 -0
- package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
- package/src/lib/runtime/ai-doctrine.js +11 -5
- package/src/lib/runtime/ai-doctrine.js.map +1 -1
- package/src/lib/runtime/ai-eval-live.js +4 -0
- package/src/lib/runtime/ai-eval-live.js.map +1 -1
- package/src/lib/runtime/ai-eval.d.ts +15 -1
- package/src/lib/runtime/ai-eval.js +52 -1
- package/src/lib/runtime/ai-eval.js.map +1 -1
- package/src/lib/runtime/experiment-variant-copy.d.ts +34 -0
- package/src/lib/runtime/experiment-variant-copy.js +102 -0
- package/src/lib/runtime/experiment-variant-copy.js.map +1 -0
- package/src/lib/server/ai-experiment-versions.d.ts +51 -0
- package/src/lib/server/ai-experiment-versions.js +270 -0
- package/src/lib/server/ai-experiment-versions.js.map +1 -0
- package/src/lib/server/ai-jobs-resume.js +74 -4
- package/src/lib/server/ai-jobs-resume.js.map +1 -1
- package/src/lib/server/ai-media-image.d.ts +66 -0
- package/src/lib/server/ai-media-image.js +521 -0
- package/src/lib/server/ai-media-image.js.map +1 -0
- package/src/lib/server/ai-media-svg.d.ts +91 -0
- package/src/lib/server/ai-media-svg.js +186 -0
- package/src/lib/server/ai-media-svg.js.map +1 -0
- package/src/lib/server/assist-build.d.ts +54 -0
- package/src/lib/server/assist-build.js +121 -0
- package/src/lib/server/assist-build.js.map +1 -0
- package/src/lib/server/assist-chat.js +108 -12
- package/src/lib/server/assist-chat.js.map +1 -1
- package/src/lib/server/assist-edit.js +213 -3
- package/src/lib/server/assist-edit.js.map +1 -1
- package/src/lib/server/assist-view-context.js +242 -4
- package/src/lib/server/assist-view-context.js.map +1 -1
- package/src/lib/server.js +26 -0
- package/src/lib/server.js.map +1 -1
- package/src/lib/tools/ai-logic-tool.d.ts +27 -0
- package/src/lib/tools/ai-logic-tool.js +207 -0
- package/src/lib/tools/ai-logic-tool.js.map +1 -0
- package/src/lib/tools/ai-overlay-tool.d.ts +35 -0
- package/src/lib/tools/ai-overlay-tool.js +107 -0
- package/src/lib/tools/ai-overlay-tool.js.map +1 -0
- package/src/lib/tools/ai-workflow-tool.d.ts +11 -0
- package/src/lib/tools/ai-workflow-tool.js +31 -0
- package/src/lib/tools/ai-workflow-tool.js.map +1 -1
- package/src/lib/usage/assist-job-refund.d.ts +28 -1
- package/src/lib/usage/assist-job-refund.js +44 -9
- package/src/lib/usage/assist-job-refund.js.map +1 -1
- package/src/lib/usage/assist-usage.d.ts +5 -0
- package/src/lib/usage/assist-usage.js +2 -0
- package/src/lib/usage/assist-usage.js.map +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
import type { AglynOrgBilling } from '@aglyn/aglyn/foundation/definitions/org-billing.types';
|
|
18
|
+
import { type PluginAiCapability, type ResolvedPluginAiCapability } from '@aglyn/aglyn/plugin-manager/plugin-ai-capabilities';
|
|
19
|
+
import type { AiBuildOps } from '../model/ai-build-job';
|
|
20
|
+
/** The operations this plugin owns, as it registers them. */
|
|
21
|
+
export declare const AI_OWNED_CAPABILITIES: readonly PluginAiCapability[];
|
|
22
|
+
/** Registers this plugin's build operations; the console surface calls it. */
|
|
23
|
+
export declare function registerAiBuildCapabilities(): void;
|
|
24
|
+
/** What decides which operations a build may use here. */
|
|
25
|
+
export interface AiBuildOpsContext {
|
|
26
|
+
orgId: string;
|
|
27
|
+
hostId: string | null;
|
|
28
|
+
org: Partial<AglynOrgBilling> | null;
|
|
29
|
+
/** The site document, for the plugins switched on and off on it. */
|
|
30
|
+
host: Readonly<Record<string, unknown>> | null;
|
|
31
|
+
freeTaste: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface AiBuildOpsDeps {
|
|
34
|
+
/** The registered capabilities; the core registry's otherwise. */
|
|
35
|
+
capabilities?: () => ResolvedPluginAiCapability[];
|
|
36
|
+
/** The release-flag read; the platform's otherwise. */
|
|
37
|
+
releasedPlugins?: (pluginIds: string[], orgId: string) => Promise<string[]>;
|
|
38
|
+
/** Whether a runner is registered for a kind; the machine's otherwise. */
|
|
39
|
+
hasRunner?: (kind: string) => boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The operations a build may plan on this site, by op (AGL-3616): every
|
|
43
|
+
* registered capability whose owner runs here — switched on for the
|
|
44
|
+
* workspace and the site, past its release flag — whose entitlement the plan
|
|
45
|
+
* holds, which the Free taste may use where the workspace is on it, and,
|
|
46
|
+
* for an AI-run operation, whose runner this process loaded. One release-flag
|
|
47
|
+
* read for every owner at once. What a member may do and what an allowance
|
|
48
|
+
* has left are the owner's to say when the item runs (`refusal`).
|
|
49
|
+
*/
|
|
50
|
+
export declare function aiBuildOps(context: AiBuildOpsContext, deps?: AiBuildOpsDeps): Promise<AiBuildOps>;
|
|
51
|
+
/**
|
|
52
|
+
* The lines the plan step's request lists the item operations in: each op
|
|
53
|
+
* with what it makes, its arguments and their meaning. Per site, so they ride
|
|
54
|
+
* the job's own turn and never a cached system block.
|
|
55
|
+
*/
|
|
56
|
+
export declare function aiBuildOpLines(ops: AiBuildOps, structural: readonly string[]): string[];
|
|
57
|
+
/** What a build can make here, in the owner's words, for the chat's instructions. */
|
|
58
|
+
export declare function aiBuildIntents(ops: AiBuildOps): string[];
|
|
@@ -0,0 +1,256 @@
|
|
|
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
|
+
*/ import { checkEntitlement } from "@aglyn/aglyn/app-utils/plan-entitlements";
|
|
17
|
+
import { isHostPluginEnabled } from "@aglyn/aglyn/plugin-manager/enabled-plugins";
|
|
18
|
+
import { pluginAiCapabilities, registerPluginAiCapability } from "@aglyn/aglyn/plugin-manager/plugin-ai-capabilities";
|
|
19
|
+
import { filterEnabledPluginsByReleaseFlags } from "@aglyn/tenant-data-admin/server/release-flags";
|
|
20
|
+
import { AI_TEMPLATE_SUBJECTS } from "../model/ai-template-subjects.js";
|
|
21
|
+
import { AI_SITE_PASS_CREDITS } from "../model/ai-site-job.js";
|
|
22
|
+
import { aiJobStepRunnerFor } from "./ai-jobs.js";
|
|
23
|
+
/**
|
|
24
|
+
* What THIS plugin lets a build make (AGL-3616), registered on the core's
|
|
25
|
+
* capability contract exactly as any other plugin registers its own, so the
|
|
26
|
+
* planner, the gates and the estimate read one list and name no plugin.
|
|
27
|
+
*
|
|
28
|
+
* Every one is built by a runner this plugin already has (`runnerKind`):
|
|
29
|
+
* pages, layouts, forms, components and email designs are the plan's
|
|
30
|
+
* creations and screens; templates, campaigns and automations are items with
|
|
31
|
+
* arguments. A campaign and an automation are still WRITTEN by the marketing
|
|
32
|
+
* and workflows plugins, through the writers their runners already call.
|
|
33
|
+
*/ /** This plugin's id, as its registrations name their owner. */ const AI_PLUGIN_ID = 'ai';
|
|
34
|
+
const NO_ARGS = {
|
|
35
|
+
type: 'object',
|
|
36
|
+
properties: {},
|
|
37
|
+
additionalProperties: false
|
|
38
|
+
};
|
|
39
|
+
const passes = (count)=>()=>count * AI_SITE_PASS_CREDITS;
|
|
40
|
+
/** The operations this plugin owns, as it registers them. */ export const AI_OWNED_CAPABILITIES = [
|
|
41
|
+
{
|
|
42
|
+
op: 'page',
|
|
43
|
+
noun: 'page',
|
|
44
|
+
where: 'Pages',
|
|
45
|
+
intents: [
|
|
46
|
+
'new pages: home, about, services, contact, pricing, a landing page'
|
|
47
|
+
],
|
|
48
|
+
argsSchema: NO_ARGS,
|
|
49
|
+
maxPerPlan: 8,
|
|
50
|
+
freeAllowed: true,
|
|
51
|
+
runnerKind: 'page',
|
|
52
|
+
estimateCredits: passes(6),
|
|
53
|
+
degrade: 'omit'
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
op: 'layout',
|
|
57
|
+
noun: 'layout',
|
|
58
|
+
where: 'Layouts',
|
|
59
|
+
intents: [
|
|
60
|
+
'a header and footer shared by pages'
|
|
61
|
+
],
|
|
62
|
+
argsSchema: NO_ARGS,
|
|
63
|
+
maxPerPlan: 1,
|
|
64
|
+
freeAllowed: true,
|
|
65
|
+
runnerKind: 'layout',
|
|
66
|
+
estimateCredits: passes(1),
|
|
67
|
+
degrade: 'fallback'
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
op: 'form',
|
|
71
|
+
noun: 'form',
|
|
72
|
+
where: 'Forms',
|
|
73
|
+
intents: [
|
|
74
|
+
'a contact form, a quote request, a sign-up form'
|
|
75
|
+
],
|
|
76
|
+
argsSchema: NO_ARGS,
|
|
77
|
+
maxPerPlan: 3,
|
|
78
|
+
freeAllowed: true,
|
|
79
|
+
runnerKind: 'form',
|
|
80
|
+
estimateCredits: passes(1),
|
|
81
|
+
degrade: 'omit'
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
op: 'component',
|
|
85
|
+
noun: 'component',
|
|
86
|
+
where: 'Components',
|
|
87
|
+
intents: [
|
|
88
|
+
'a reusable card or block placed on several pages'
|
|
89
|
+
],
|
|
90
|
+
argsSchema: NO_ARGS,
|
|
91
|
+
maxPerPlan: 4,
|
|
92
|
+
freeAllowed: false,
|
|
93
|
+
runnerKind: 'component',
|
|
94
|
+
estimateCredits: passes(1),
|
|
95
|
+
degrade: 'omit'
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
op: 'email',
|
|
99
|
+
noun: 'email design',
|
|
100
|
+
where: 'Emails → Templates',
|
|
101
|
+
intents: [
|
|
102
|
+
'an email design: a welcome, a reply, an announcement'
|
|
103
|
+
],
|
|
104
|
+
argsSchema: NO_ARGS,
|
|
105
|
+
maxPerPlan: 2,
|
|
106
|
+
freeAllowed: false,
|
|
107
|
+
runnerKind: 'email',
|
|
108
|
+
estimateCredits: passes(1),
|
|
109
|
+
degrade: 'omit'
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
op: 'template',
|
|
113
|
+
noun: 'page template',
|
|
114
|
+
where: 'Templates',
|
|
115
|
+
intents: [
|
|
116
|
+
'a page template for blog posts, products or authors'
|
|
117
|
+
],
|
|
118
|
+
argsSchema: {
|
|
119
|
+
type: 'object',
|
|
120
|
+
properties: {
|
|
121
|
+
subject: {
|
|
122
|
+
type: 'string',
|
|
123
|
+
description: 'What each page shows: entry (a collection entry), product or author.',
|
|
124
|
+
enum: AI_TEMPLATE_SUBJECTS
|
|
125
|
+
},
|
|
126
|
+
collectionId: {
|
|
127
|
+
type: 'string',
|
|
128
|
+
description: 'For entry: the collection id from the site inventory.',
|
|
129
|
+
maxLength: 100
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
required: [
|
|
133
|
+
'subject'
|
|
134
|
+
],
|
|
135
|
+
additionalProperties: false
|
|
136
|
+
},
|
|
137
|
+
maxPerPlan: 2,
|
|
138
|
+
freeAllowed: false,
|
|
139
|
+
runnerKind: 'template',
|
|
140
|
+
estimateCredits: passes(6),
|
|
141
|
+
degrade: 'omit'
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
op: 'campaign',
|
|
145
|
+
noun: 'email campaign',
|
|
146
|
+
where: 'Marketing → Campaigns',
|
|
147
|
+
intents: [
|
|
148
|
+
'an email campaign drafted and left unsent'
|
|
149
|
+
],
|
|
150
|
+
argsSchema: {
|
|
151
|
+
type: 'object',
|
|
152
|
+
properties: {
|
|
153
|
+
name: {
|
|
154
|
+
type: 'string',
|
|
155
|
+
description: 'What the campaign is called.',
|
|
156
|
+
maxLength: 120
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
additionalProperties: false
|
|
160
|
+
},
|
|
161
|
+
maxPerPlan: 2,
|
|
162
|
+
freeAllowed: false,
|
|
163
|
+
runnerKind: 'campaign',
|
|
164
|
+
estimateCredits: passes(2),
|
|
165
|
+
degrade: 'omit'
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
op: 'workflow',
|
|
169
|
+
noun: 'automation',
|
|
170
|
+
where: 'Automations',
|
|
171
|
+
intents: [
|
|
172
|
+
'an automation: when a form is sent, do something'
|
|
173
|
+
],
|
|
174
|
+
argsSchema: NO_ARGS,
|
|
175
|
+
maxPerPlan: 2,
|
|
176
|
+
freeAllowed: false,
|
|
177
|
+
runnerKind: 'workflow',
|
|
178
|
+
estimateCredits: passes(1),
|
|
179
|
+
degrade: 'omit'
|
|
180
|
+
}
|
|
181
|
+
];
|
|
182
|
+
/** Registers this plugin's build operations; the console surface calls it. */ export function registerAiBuildCapabilities() {
|
|
183
|
+
for (const capability of AI_OWNED_CAPABILITIES){
|
|
184
|
+
registerPluginAiCapability(capability, {
|
|
185
|
+
pluginId: AI_PLUGIN_ID
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* The operations a build may plan on this site, by op (AGL-3616): every
|
|
191
|
+
* registered capability whose owner runs here — switched on for the
|
|
192
|
+
* workspace and the site, past its release flag — whose entitlement the plan
|
|
193
|
+
* holds, which the Free taste may use where the workspace is on it, and,
|
|
194
|
+
* for an AI-run operation, whose runner this process loaded. One release-flag
|
|
195
|
+
* read for every owner at once. What a member may do and what an allowance
|
|
196
|
+
* has left are the owner's to say when the item runs (`refusal`).
|
|
197
|
+
*/ export async function aiBuildOps(context, deps = {}) {
|
|
198
|
+
var _deps_capabilities, _deps_hasRunner, _deps_releasedPlugins;
|
|
199
|
+
const all = ((_deps_capabilities = deps.capabilities) != null ? _deps_capabilities : pluginAiCapabilities)();
|
|
200
|
+
const hasRunner = (_deps_hasRunner = deps.hasRunner) != null ? _deps_hasRunner : (kind)=>aiJobStepRunnerFor(kind) !== null;
|
|
201
|
+
const owners = [
|
|
202
|
+
...new Set(all.map((one)=>one.pluginId).filter((id)=>id !== AI_PLUGIN_ID))
|
|
203
|
+
];
|
|
204
|
+
const released = new Set(owners.length ? await ((_deps_releasedPlugins = deps.releasedPlugins) != null ? _deps_releasedPlugins : (ids, orgId)=>filterEnabledPluginsByReleaseFlags(ids, {
|
|
205
|
+
orgId,
|
|
206
|
+
authorization: null
|
|
207
|
+
}))(owners, context.orgId) : []);
|
|
208
|
+
const ops = new Map();
|
|
209
|
+
for (const { pluginId, capability } of all){
|
|
210
|
+
if (pluginId !== AI_PLUGIN_ID) {
|
|
211
|
+
if (!released.has(pluginId)) continue;
|
|
212
|
+
if (!isHostPluginEnabled(context.org, context.host, pluginId)) continue;
|
|
213
|
+
}
|
|
214
|
+
if (capability.feature && !checkEntitlement(context.org, capability.feature)) continue;
|
|
215
|
+
if (context.freeTaste && !capability.freeAllowed) continue;
|
|
216
|
+
if (capability.runnerKind && !hasRunner(capability.runnerKind)) continue;
|
|
217
|
+
ops.set(capability.op, capability);
|
|
218
|
+
}
|
|
219
|
+
return ops;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* The lines the plan step's request lists the item operations in: each op
|
|
223
|
+
* with what it makes, its arguments and their meaning. Per site, so they ride
|
|
224
|
+
* the job's own turn and never a cached system block.
|
|
225
|
+
*/ export function aiBuildOpLines(ops, structural) {
|
|
226
|
+
const items = [
|
|
227
|
+
...ops.values()
|
|
228
|
+
].filter((one)=>!structural.includes(one.op));
|
|
229
|
+
if (!items.length) return [
|
|
230
|
+
'Operations for items: none on this site. Leave items empty.'
|
|
231
|
+
];
|
|
232
|
+
const lines = [
|
|
233
|
+
'Operations for items (anything else goes in create or screens):'
|
|
234
|
+
];
|
|
235
|
+
for (const one of items){
|
|
236
|
+
var _one_pageBlocks;
|
|
237
|
+
const args = Object.entries(one.argsSchema.properties).map(([name, property])=>{
|
|
238
|
+
var _one_argsSchema_required;
|
|
239
|
+
const required = ((_one_argsSchema_required = one.argsSchema.required) == null ? void 0 : _one_argsSchema_required.includes(name)) ? '' : ' (optional)';
|
|
240
|
+
const choices = property.enum ? ` one of ${property.enum.join('|')}` : '';
|
|
241
|
+
return `${name}: ${property.type}${choices}${required} — ${property.description}`;
|
|
242
|
+
});
|
|
243
|
+
lines.push(`- ${one.op}: ${aiNounWithArticle(one.noun)}, at most ${one.maxPerPlan}; for ${one.intents.join('; ')}.${((_one_pageBlocks = one.pageBlocks) == null ? void 0 : _one_pageBlocks.length) ? ` A page section that uses it places the ${one.pageBlocks.join(' or ')} block: put new:<name> in that section's uses.` : ''} Args: ${args.length ? `{ ${args.join('; ')} }` : '{}'}.`);
|
|
244
|
+
}
|
|
245
|
+
return lines;
|
|
246
|
+
}
|
|
247
|
+
function aiNounWithArticle(noun) {
|
|
248
|
+
return `${/^[aeiou]/i.test(noun) ? 'an' : 'a'} ${noun}`;
|
|
249
|
+
}
|
|
250
|
+
/** What a build can make here, in the owner's words, for the chat's instructions. */ export function aiBuildIntents(ops) {
|
|
251
|
+
return [
|
|
252
|
+
...ops.values()
|
|
253
|
+
].flatMap((one)=>one.intents);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
//# sourceMappingURL=ai-build-capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/jobs/ai-build-capabilities.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\nimport { checkEntitlement } from '@aglyn/aglyn/app-utils/plan-entitlements'\nimport type { AglynOrgBilling } from '@aglyn/aglyn/foundation/definitions/org-billing.types'\nimport { isHostPluginEnabled } from '@aglyn/aglyn/plugin-manager/enabled-plugins'\nimport {\n pluginAiCapabilities,\n registerPluginAiCapability,\n type PluginAiCapability,\n type ResolvedPluginAiCapability,\n} from '@aglyn/aglyn/plugin-manager/plugin-ai-capabilities'\nimport { filterEnabledPluginsByReleaseFlags } from '@aglyn/tenant-data-admin/server/release-flags'\nimport { AI_TEMPLATE_SUBJECTS } from '../model/ai-template-subjects'\nimport { AI_SITE_PASS_CREDITS } from '../model/ai-site-job'\nimport type { AiBuildOps } from '../model/ai-build-job'\nimport { aiJobStepRunnerFor } from './ai-jobs'\n\n/**\n * What THIS plugin lets a build make (AGL-3616), registered on the core's\n * capability contract exactly as any other plugin registers its own, so the\n * planner, the gates and the estimate read one list and name no plugin.\n *\n * Every one is built by a runner this plugin already has (`runnerKind`):\n * pages, layouts, forms, components and email designs are the plan's\n * creations and screens; templates, campaigns and automations are items with\n * arguments. A campaign and an automation are still WRITTEN by the marketing\n * and workflows plugins, through the writers their runners already call.\n */\n\n/** This plugin's id, as its registrations name their owner. */\nconst AI_PLUGIN_ID = 'ai'\n\nconst NO_ARGS = { type: 'object', properties: {}, additionalProperties: false } as const\n\nconst passes = (count: number) => () => count * AI_SITE_PASS_CREDITS\n\n/** The operations this plugin owns, as it registers them. */\nexport const AI_OWNED_CAPABILITIES: readonly PluginAiCapability[] = [\n {\n op: 'page',\n noun: 'page',\n where: 'Pages',\n intents: ['new pages: home, about, services, contact, pricing, a landing page'],\n argsSchema: NO_ARGS,\n maxPerPlan: 8,\n freeAllowed: true,\n runnerKind: 'page',\n estimateCredits: passes(6),\n degrade: 'omit',\n },\n {\n op: 'layout',\n noun: 'layout',\n where: 'Layouts',\n intents: ['a header and footer shared by pages'],\n argsSchema: NO_ARGS,\n maxPerPlan: 1,\n freeAllowed: true,\n runnerKind: 'layout',\n estimateCredits: passes(1),\n degrade: 'fallback',\n },\n {\n op: 'form',\n noun: 'form',\n where: 'Forms',\n intents: ['a contact form, a quote request, a sign-up form'],\n argsSchema: NO_ARGS,\n maxPerPlan: 3,\n freeAllowed: true,\n runnerKind: 'form',\n estimateCredits: passes(1),\n degrade: 'omit',\n },\n {\n op: 'component',\n noun: 'component',\n where: 'Components',\n intents: ['a reusable card or block placed on several pages'],\n argsSchema: NO_ARGS,\n maxPerPlan: 4,\n freeAllowed: false,\n runnerKind: 'component',\n estimateCredits: passes(1),\n degrade: 'omit',\n },\n {\n op: 'email',\n noun: 'email design',\n where: 'Emails → Templates',\n intents: ['an email design: a welcome, a reply, an announcement'],\n argsSchema: NO_ARGS,\n maxPerPlan: 2,\n freeAllowed: false,\n runnerKind: 'email',\n estimateCredits: passes(1),\n degrade: 'omit',\n },\n {\n op: 'template',\n noun: 'page template',\n where: 'Templates',\n intents: ['a page template for blog posts, products or authors'],\n argsSchema: {\n type: 'object',\n properties: {\n subject: {\n type: 'string',\n description: 'What each page shows: entry (a collection entry), product or author.',\n enum: AI_TEMPLATE_SUBJECTS,\n },\n collectionId: {\n type: 'string',\n description: 'For entry: the collection id from the site inventory.',\n maxLength: 100,\n },\n },\n required: ['subject'],\n additionalProperties: false,\n },\n maxPerPlan: 2,\n freeAllowed: false,\n runnerKind: 'template',\n estimateCredits: passes(6),\n degrade: 'omit',\n },\n {\n op: 'campaign',\n noun: 'email campaign',\n where: 'Marketing → Campaigns',\n intents: ['an email campaign drafted and left unsent'],\n argsSchema: {\n type: 'object',\n properties: {\n name: { type: 'string', description: 'What the campaign is called.', maxLength: 120 },\n },\n additionalProperties: false,\n },\n maxPerPlan: 2,\n freeAllowed: false,\n runnerKind: 'campaign',\n estimateCredits: passes(2),\n degrade: 'omit',\n },\n {\n op: 'workflow',\n noun: 'automation',\n where: 'Automations',\n intents: ['an automation: when a form is sent, do something'],\n argsSchema: NO_ARGS,\n maxPerPlan: 2,\n freeAllowed: false,\n runnerKind: 'workflow',\n estimateCredits: passes(1),\n degrade: 'omit',\n },\n]\n\n/** Registers this plugin's build operations; the console surface calls it. */\nexport function registerAiBuildCapabilities(): void {\n for (const capability of AI_OWNED_CAPABILITIES) {\n registerPluginAiCapability(capability, { pluginId: AI_PLUGIN_ID })\n }\n}\n\n/** What decides which operations a build may use here. */\nexport interface AiBuildOpsContext {\n orgId: string\n hostId: string | null\n org: Partial<AglynOrgBilling> | null\n /** The site document, for the plugins switched on and off on it. */\n host: Readonly<Record<string, unknown>> | null\n freeTaste: boolean\n}\n\nexport interface AiBuildOpsDeps {\n /** The registered capabilities; the core registry's otherwise. */\n capabilities?: () => ResolvedPluginAiCapability[]\n /** The release-flag read; the platform's otherwise. */\n releasedPlugins?: (pluginIds: string[], orgId: string) => Promise<string[]>\n /** Whether a runner is registered for a kind; the machine's otherwise. */\n hasRunner?: (kind: string) => boolean\n}\n\n/**\n * The operations a build may plan on this site, by op (AGL-3616): every\n * registered capability whose owner runs here — switched on for the\n * workspace and the site, past its release flag — whose entitlement the plan\n * holds, which the Free taste may use where the workspace is on it, and,\n * for an AI-run operation, whose runner this process loaded. One release-flag\n * read for every owner at once. What a member may do and what an allowance\n * has left are the owner's to say when the item runs (`refusal`).\n */\nexport async function aiBuildOps(context: AiBuildOpsContext, deps: AiBuildOpsDeps = {}): Promise<AiBuildOps> {\n const all = (deps.capabilities ?? pluginAiCapabilities)()\n const hasRunner = deps.hasRunner ?? ((kind: string) => aiJobStepRunnerFor(kind as never) !== null)\n const owners = [...new Set(all.map((one) => one.pluginId).filter((id) => id !== AI_PLUGIN_ID))]\n const released = new Set(\n owners.length\n ? await (deps.releasedPlugins ??\n ((ids, orgId) => filterEnabledPluginsByReleaseFlags(ids, { orgId, authorization: null })))(owners, context.orgId)\n : [],\n )\n const ops = new Map<string, PluginAiCapability>()\n for (const { pluginId, capability } of all) {\n if (pluginId !== AI_PLUGIN_ID) {\n if (!released.has(pluginId)) continue\n if (!isHostPluginEnabled(context.org as { enabledPlugins?: string[] } | null, context.host, pluginId)) continue\n }\n if (capability.feature && !checkEntitlement(context.org, capability.feature)) continue\n if (context.freeTaste && !capability.freeAllowed) continue\n if (capability.runnerKind && !hasRunner(capability.runnerKind)) continue\n ops.set(capability.op, capability)\n }\n return ops\n}\n\n/**\n * The lines the plan step's request lists the item operations in: each op\n * with what it makes, its arguments and their meaning. Per site, so they ride\n * the job's own turn and never a cached system block.\n */\nexport function aiBuildOpLines(ops: AiBuildOps, structural: readonly string[]): string[] {\n const items = [...ops.values()].filter((one) => !structural.includes(one.op))\n if (!items.length) return ['Operations for items: none on this site. Leave items empty.']\n const lines = ['Operations for items (anything else goes in create or screens):']\n for (const one of items) {\n const args = Object.entries(one.argsSchema.properties).map(([name, property]) => {\n const required = one.argsSchema.required?.includes(name) ? '' : ' (optional)'\n const choices = property.enum ? ` one of ${property.enum.join('|')}` : ''\n return `${name}: ${property.type}${choices}${required} — ${property.description}`\n })\n lines.push(\n `- ${one.op}: ${aiNounWithArticle(one.noun)}, at most ${one.maxPerPlan}; for ${one.intents.join('; ')}.${\n one.pageBlocks?.length ? ` A page section that uses it places the ${one.pageBlocks.join(' or ')} block: put new:<name> in that section's uses.` : ''\n } Args: ${args.length ? `{ ${args.join('; ')} }` : '{}'}.`,\n )\n }\n return lines\n}\n\nfunction aiNounWithArticle(noun: string): string {\n return `${/^[aeiou]/i.test(noun) ? 'an' : 'a'} ${noun}`\n}\n\n/** What a build can make here, in the owner's words, for the chat's instructions. */\nexport function aiBuildIntents(ops: AiBuildOps): string[] {\n return [...ops.values()].flatMap((one) => one.intents)\n}\n"],"names":["checkEntitlement","isHostPluginEnabled","pluginAiCapabilities","registerPluginAiCapability","filterEnabledPluginsByReleaseFlags","AI_TEMPLATE_SUBJECTS","AI_SITE_PASS_CREDITS","aiJobStepRunnerFor","AI_PLUGIN_ID","NO_ARGS","type","properties","additionalProperties","passes","count","AI_OWNED_CAPABILITIES","op","noun","where","intents","argsSchema","maxPerPlan","freeAllowed","runnerKind","estimateCredits","degrade","subject","description","enum","collectionId","maxLength","required","name","registerAiBuildCapabilities","capability","pluginId","aiBuildOps","context","deps","all","capabilities","hasRunner","kind","owners","Set","map","one","filter","id","released","length","releasedPlugins","ids","orgId","authorization","ops","Map","has","org","host","feature","freeTaste","set","aiBuildOpLines","structural","items","values","includes","lines","args","Object","entries","property","choices","join","push","aiNounWithArticle","pageBlocks","test","aiBuildIntents","flatMap"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,gBAAgB,QAAQ,2CAA0C;AAE3E,SAASC,mBAAmB,QAAQ,8CAA6C;AACjF,SACEC,oBAAoB,EACpBC,0BAA0B,QAGrB,qDAAoD;AAC3D,SAASC,kCAAkC,QAAQ,gDAA+C;AAClG,SAASC,oBAAoB,QAAQ,mCAA+B;AACpE,SAASC,oBAAoB,QAAQ,0BAAsB;AAE3D,SAASC,kBAAkB,QAAQ,eAAW;AAE9C;;;;;;;;;;CAUC,GAED,6DAA6D,GAC7D,MAAMC,eAAe;AAErB,MAAMC,UAAU;IAAEC,MAAM;IAAUC,YAAY,CAAC;IAAGC,sBAAsB;AAAM;AAE9E,MAAMC,SAAS,CAACC,QAAkB,IAAMA,QAAQR;AAEhD,2DAA2D,GAC3D,OAAO,MAAMS,wBAAuD;IAClE;QACEC,IAAI;QACJC,MAAM;QACNC,OAAO;QACPC,SAAS;YAAC;SAAqE;QAC/EC,YAAYX;QACZY,YAAY;QACZC,aAAa;QACbC,YAAY;QACZC,iBAAiBX,OAAO;QACxBY,SAAS;IACX;IACA;QACET,IAAI;QACJC,MAAM;QACNC,OAAO;QACPC,SAAS;YAAC;SAAsC;QAChDC,YAAYX;QACZY,YAAY;QACZC,aAAa;QACbC,YAAY;QACZC,iBAAiBX,OAAO;QACxBY,SAAS;IACX;IACA;QACET,IAAI;QACJC,MAAM;QACNC,OAAO;QACPC,SAAS;YAAC;SAAkD;QAC5DC,YAAYX;QACZY,YAAY;QACZC,aAAa;QACbC,YAAY;QACZC,iBAAiBX,OAAO;QACxBY,SAAS;IACX;IACA;QACET,IAAI;QACJC,MAAM;QACNC,OAAO;QACPC,SAAS;YAAC;SAAmD;QAC7DC,Y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,OAAO,IAAI,CAAC,EAAEA,MAAM;AACzD;AAEA,mFAAmF,GACnF,OAAO,SAAS8D,eAAexB,GAAe;IAC5C,OAAO;WAAIA,IAAIW,MAAM;KAAG,CAACc,OAAO,CAAC,CAAClC,MAAQA,IAAI3B,OAAO;AACvD"}
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
import { type AiBuildUnit } from '../model/ai-build-job';
|
|
18
|
+
import type { AiJobItemLedger, AiJobOutput } from '../model/ai-jobs.types';
|
|
19
|
+
import type { AiSiteBuiltRef } from './ai-job-site-step';
|
|
20
|
+
import type { AiJobItemOutcome, AiJobStepOutcome } from './ai-job-text-step';
|
|
21
|
+
/**
|
|
22
|
+
* One delegated unit's pass as an ITEM of a job settled item by item
|
|
23
|
+
* (AGL-3616) — a `build`, and a site scaffold, which is the build's preset.
|
|
24
|
+
* The runner's spend is the pass's; what the runner came to is the item's
|
|
25
|
+
* row: still running, built (or built without something that failed),
|
|
26
|
+
* failed on our side, or failed on the model's or the workspace's.
|
|
27
|
+
*
|
|
28
|
+
* Shared by both steps, and importing neither, so neither imports the other.
|
|
29
|
+
*/
|
|
30
|
+
/** What a unit says when it finished without reporting anything. */
|
|
31
|
+
export declare const AI_BUILD_UNIT_EMPTY_COPY = "It could not be built this time.";
|
|
32
|
+
/** What a unit's model declining the request says. */
|
|
33
|
+
export declare const AI_BUILD_UNIT_REFUSED_COPY = "The AI declined to build this one.";
|
|
34
|
+
/** A runner's outcome narrowed to its spend: no plan, no review, nothing the delegating job keeps. */
|
|
35
|
+
export declare function aiUnitSpend(outcome: AiJobStepOutcome): AiJobStepOutcome;
|
|
36
|
+
/**
|
|
37
|
+
* What a runner's outcome comes to for its item; `null` when the unit
|
|
38
|
+
* reported what it built and the caller decides whether that counts.
|
|
39
|
+
*/
|
|
40
|
+
export declare function aiUnitFailure(slot: string, outcome: AiJobStepOutcome): AiJobItemOutcome | null;
|
|
41
|
+
/**
|
|
42
|
+
* Whether an error a unit's runner threw is the machine's to retry — a
|
|
43
|
+
* provider that will answer later, or a budget that ended — rather than this
|
|
44
|
+
* item's failure.
|
|
45
|
+
*/
|
|
46
|
+
export declare function aiUnitErrorRetryable(error: unknown): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* What the build has created that a later unit can name: each delivered
|
|
49
|
+
* creation's record, by its plan name. A creation's first output is the
|
|
50
|
+
* record it wrote.
|
|
51
|
+
*/
|
|
52
|
+
export declare function aiBuildBuiltRefs(units: readonly AiBuildUnit[], ledger: readonly AiJobItemLedger[], outputs: readonly Pick<AiJobOutput, 'id' | 'label'>[]): Map<string, AiSiteBuiltRef>;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2026 Aglyn LLC
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/ import { aiBuildItemDelivered } from "../model/ai-build-job.js";
|
|
18
|
+
import { AiUpstreamError } from "../runtime/ai-runtime.js";
|
|
19
|
+
/**
|
|
20
|
+
* One delegated unit's pass as an ITEM of a job settled item by item
|
|
21
|
+
* (AGL-3616) — a `build`, and a site scaffold, which is the build's preset.
|
|
22
|
+
* The runner's spend is the pass's; what the runner came to is the item's
|
|
23
|
+
* row: still running, built (or built without something that failed),
|
|
24
|
+
* failed on our side, or failed on the model's or the workspace's.
|
|
25
|
+
*
|
|
26
|
+
* Shared by both steps, and importing neither, so neither imports the other.
|
|
27
|
+
*/ /** What a unit says when it finished without reporting anything. */ export const AI_BUILD_UNIT_EMPTY_COPY = 'It could not be built this time.';
|
|
28
|
+
/** What a unit's model declining the request says. */ export const AI_BUILD_UNIT_REFUSED_COPY = 'The AI declined to build this one.';
|
|
29
|
+
/** A runner's outcome narrowed to its spend: no plan, no review, nothing the delegating job keeps. */ export function aiUnitSpend(outcome) {
|
|
30
|
+
return _extends({
|
|
31
|
+
outputs: outcome.outputs,
|
|
32
|
+
usage: outcome.usage,
|
|
33
|
+
estCostUsd: outcome.estCostUsd,
|
|
34
|
+
model: outcome.model,
|
|
35
|
+
stopReason: outcome.stopReason
|
|
36
|
+
}, outcome.effort ? {
|
|
37
|
+
effort: outcome.effort
|
|
38
|
+
} : {});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* What a runner's outcome comes to for its item; `null` when the unit
|
|
42
|
+
* reported what it built and the caller decides whether that counts.
|
|
43
|
+
*/ export function aiUnitFailure(slot, outcome) {
|
|
44
|
+
const outputs = outcome.outputs.map((output)=>output.id);
|
|
45
|
+
if (outcome.refused) {
|
|
46
|
+
return {
|
|
47
|
+
slot,
|
|
48
|
+
status: 'failed',
|
|
49
|
+
failure: {
|
|
50
|
+
ours: false,
|
|
51
|
+
reason: 'refused',
|
|
52
|
+
message: AI_BUILD_UNIT_REFUSED_COPY
|
|
53
|
+
},
|
|
54
|
+
outputs
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (outcome.review) {
|
|
58
|
+
// A building rule still broken after its re-ask is ours (AGL-3596); a
|
|
59
|
+
// site at an allowance is the workspace's to change.
|
|
60
|
+
const ours = outcome.review.reason === 'doctrine';
|
|
61
|
+
return {
|
|
62
|
+
slot,
|
|
63
|
+
status: 'failed',
|
|
64
|
+
failure: {
|
|
65
|
+
ours,
|
|
66
|
+
reason: ours ? 'doctrine-refused' : 'review',
|
|
67
|
+
message: outcome.review.message || AI_BUILD_UNIT_EMPTY_COPY
|
|
68
|
+
},
|
|
69
|
+
outputs
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (outcome.failure) {
|
|
73
|
+
return {
|
|
74
|
+
slot,
|
|
75
|
+
status: 'failed',
|
|
76
|
+
failure: {
|
|
77
|
+
ours: true,
|
|
78
|
+
reason: 'step-failure',
|
|
79
|
+
message: outcome.failure
|
|
80
|
+
},
|
|
81
|
+
outputs
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (outcome.continue) return {
|
|
85
|
+
slot,
|
|
86
|
+
status: 'running',
|
|
87
|
+
outputs
|
|
88
|
+
};
|
|
89
|
+
if (!outcome.outputs.length) {
|
|
90
|
+
return {
|
|
91
|
+
slot,
|
|
92
|
+
status: 'failed',
|
|
93
|
+
failure: {
|
|
94
|
+
ours: true,
|
|
95
|
+
reason: 'step-failure',
|
|
96
|
+
message: AI_BUILD_UNIT_EMPTY_COPY
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Whether an error a unit's runner threw is the machine's to retry — a
|
|
104
|
+
* provider that will answer later, or a budget that ended — rather than this
|
|
105
|
+
* item's failure.
|
|
106
|
+
*/ export function aiUnitErrorRetryable(error) {
|
|
107
|
+
if (error instanceof AiUpstreamError && error.retryable) return true;
|
|
108
|
+
const name = error == null ? void 0 : error.name;
|
|
109
|
+
return name === 'AbortError' || name === 'TimeoutError';
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* What the build has created that a later unit can name: each delivered
|
|
113
|
+
* creation's record, by its plan name. A creation's first output is the
|
|
114
|
+
* record it wrote.
|
|
115
|
+
*/ export function aiBuildBuiltRefs(units, ledger, outputs) {
|
|
116
|
+
const rows = new Map(ledger.map((row)=>[
|
|
117
|
+
row.slot,
|
|
118
|
+
row
|
|
119
|
+
]));
|
|
120
|
+
const built = new Map();
|
|
121
|
+
for (const unit of units){
|
|
122
|
+
var _outputs_find;
|
|
123
|
+
const creation = unit.creation;
|
|
124
|
+
const row = rows.get(unit.slot);
|
|
125
|
+
if (!creation || !row || !aiBuildItemDelivered(row) || !row.outputs.length) continue;
|
|
126
|
+
if (creation.kind !== 'layout' && creation.kind !== 'form' && creation.kind !== 'component') continue;
|
|
127
|
+
const id = row.outputs[0];
|
|
128
|
+
const label = ((_outputs_find = outputs.find((output)=>output.id === id)) == null ? void 0 : _outputs_find.label) || creation.name;
|
|
129
|
+
built.set(creation.name.toLowerCase(), {
|
|
130
|
+
id,
|
|
131
|
+
label,
|
|
132
|
+
kind: creation.kind
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
return built;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
//# sourceMappingURL=ai-build-unit-outcome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/jobs/ai-build-unit-outcome.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\nimport { aiBuildItemDelivered, type AiBuildUnit } from '../model/ai-build-job'\nimport type { AiJobItemLedger, AiJobOutput } from '../model/ai-jobs.types'\nimport { AiUpstreamError } from '../runtime/ai-runtime'\nimport type { AiSiteBuiltRef } from './ai-job-site-step'\nimport type { AiJobItemOutcome, AiJobStepOutcome } from './ai-job-text-step'\n\n/**\n * One delegated unit's pass as an ITEM of a job settled item by item\n * (AGL-3616) — a `build`, and a site scaffold, which is the build's preset.\n * The runner's spend is the pass's; what the runner came to is the item's\n * row: still running, built (or built without something that failed),\n * failed on our side, or failed on the model's or the workspace's.\n *\n * Shared by both steps, and importing neither, so neither imports the other.\n */\n\n/** What a unit says when it finished without reporting anything. */\nexport const AI_BUILD_UNIT_EMPTY_COPY = 'It could not be built this time.'\n\n/** What a unit's model declining the request says. */\nexport const AI_BUILD_UNIT_REFUSED_COPY = 'The AI declined to build this one.'\n\n/** A runner's outcome narrowed to its spend: no plan, no review, nothing the delegating job keeps. */\nexport function aiUnitSpend(outcome: AiJobStepOutcome): AiJobStepOutcome {\n return {\n outputs: outcome.outputs,\n usage: outcome.usage,\n estCostUsd: outcome.estCostUsd,\n model: outcome.model,\n stopReason: outcome.stopReason,\n ...(outcome.effort ? { effort: outcome.effort } : {}),\n }\n}\n\n/**\n * What a runner's outcome comes to for its item; `null` when the unit\n * reported what it built and the caller decides whether that counts.\n */\nexport function aiUnitFailure(slot: string, outcome: AiJobStepOutcome): AiJobItemOutcome | null {\n const outputs = outcome.outputs.map((output) => output.id)\n if (outcome.refused) {\n return { slot, status: 'failed', failure: { ours: false, reason: 'refused', message: AI_BUILD_UNIT_REFUSED_COPY }, outputs }\n }\n if (outcome.review) {\n // A building rule still broken after its re-ask is ours (AGL-3596); a\n // site at an allowance is the workspace's to change.\n const ours = outcome.review.reason === 'doctrine'\n return {\n slot,\n status: 'failed',\n failure: { ours, reason: ours ? 'doctrine-refused' : 'review', message: outcome.review.message || AI_BUILD_UNIT_EMPTY_COPY },\n outputs,\n }\n }\n if (outcome.failure) {\n return { slot, status: 'failed', failure: { ours: true, reason: 'step-failure', message: outcome.failure }, outputs }\n }\n if (outcome.continue) return { slot, status: 'running', outputs }\n if (!outcome.outputs.length) {\n return { slot, status: 'failed', failure: { ours: true, reason: 'step-failure', message: AI_BUILD_UNIT_EMPTY_COPY } }\n }\n return null\n}\n\n/**\n * Whether an error a unit's runner threw is the machine's to retry — a\n * provider that will answer later, or a budget that ended — rather than this\n * item's failure.\n */\nexport function aiUnitErrorRetryable(error: unknown): boolean {\n if (error instanceof AiUpstreamError && error.retryable) return true\n const name = (error as { name?: string } | null)?.name\n return name === 'AbortError' || name === 'TimeoutError'\n}\n\n/**\n * What the build has created that a later unit can name: each delivered\n * creation's record, by its plan name. A creation's first output is the\n * record it wrote.\n */\nexport function aiBuildBuiltRefs(\n units: readonly AiBuildUnit[],\n ledger: readonly AiJobItemLedger[],\n outputs: readonly Pick<AiJobOutput, 'id' | 'label'>[],\n): Map<string, AiSiteBuiltRef> {\n const rows = new Map(ledger.map((row) => [row.slot, row]))\n const built = new Map<string, AiSiteBuiltRef>()\n for (const unit of units) {\n const creation = unit.creation\n const row = rows.get(unit.slot)\n if (!creation || !row || !aiBuildItemDelivered(row) || !row.outputs.length) continue\n if (creation.kind !== 'layout' && creation.kind !== 'form' && creation.kind !== 'component') continue\n const id = row.outputs[0]\n const label = outputs.find((output) => output.id === id)?.label || creation.name\n built.set(creation.name.toLowerCase(), { id, label, kind: creation.kind })\n }\n return built\n}\n"],"names":["aiBuildItemDelivered","AiUpstreamError","AI_BUILD_UNIT_EMPTY_COPY","AI_BUILD_UNIT_REFUSED_COPY","aiUnitSpend","outcome","outputs","usage","estCostUsd","model","stopReason","effort","aiUnitFailure","slot","map","output","id","refused","status","failure","ours","reason","message","review","continue","length","aiUnitErrorRetryable","error","retryable","name","aiBuildBuiltRefs","units","ledger","rows","Map","row","built","unit","creation","get","kind","label","find","set","toLowerCase"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,oBAAoB,QAA0B,2BAAuB;AAE9E,SAASC,eAAe,QAAQ,2BAAuB;AAIvD;;;;;;;;CAQC,GAED,kEAAkE,GAClE,OAAO,MAAMC,2BAA2B,mCAAkC;AAE1E,oDAAoD,GACpD,OAAO,MAAMC,6BAA6B,qCAAoC;AAE9E,oGAAoG,GACpG,OAAO,SAASC,YAAYC,OAAyB;IACnD,OAAO;QACLC,SAASD,QAAQC,OAAO;QACxBC,OAAOF,QAAQE,KAAK;QACpBC,YAAYH,QAAQG,UAAU;QAC9BC,OAAOJ,QAAQI,KAAK;QACpBC,YAAYL,QAAQK,UAAU;OAC1BL,QAAQM,MAAM,GAAG;QAAEA,QAAQN,QAAQM,MAAM;IAAC,IAAI,CAAC;AAEvD;AAEA;;;CAGC,GACD,OAAO,SAASC,cAAcC,IAAY,EAAER,OAAyB;IACnE,MAAMC,UAAUD,QAAQC,OAAO,CAACQ,GAAG,CAAC,CAACC,SAAWA,OAAOC,EAAE;IACzD,IAAIX,QAAQY,OAAO,EAAE;QACnB,OAAO;YAAEJ;YAAMK,QAAQ;YAAUC,SAAS;gBAAEC,MAAM;gBAAOC,QAAQ;gBAAWC,SAASnB;YAA2B;YAAGG;QAAQ;IAC7H;IACA,IAAID,QAAQkB,MAAM,EAAE;QAClB,sEAAsE;QACtE,qDAAqD;QACrD,MAAMH,OAAOf,QAAQkB,MAAM,CAACF,MAAM,KAAK;QACvC,OAAO;YACLR;YACAK,QAAQ;YACRC,SAAS;gBAAEC;gBAAMC,QAAQD,OAAO,qBAAqB;gBAAUE,SAASjB,QAAQkB,MAAM,CAACD,OAAO,IAAIpB;YAAyB;YAC3HI;QACF;IACF;IACA,IAAID,QAAQc,OAAO,EAAE;QACnB,OAAO;YAAEN;YA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