@aglyn/plugins-ai 1.0.0-beta.143 → 1.0.0-beta.144

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +76 -23
  2. package/package.json +17 -17
package/README.md CHANGED
@@ -1,25 +1,78 @@
1
1
  # @aglyn/plugins-ai
2
2
 
3
- The Aglyn AI plugin (AGL-2939): the in-console assistant, the besigner copy
4
- assistant, generative building and automation jobs, and the AI add-on's
5
- billing and access keys one first-party plugin, provider-generic.
6
-
7
- - `providers/` — the provider contract, the registry (a marketplace plugin
8
- registers a provider against `AI_PROVIDER_CONTRACT`), the model catalog
9
- with rates and capabilities, the routing table, and two adapters:
10
- `anthropic.ts` and `openai-compatible.ts`.
11
- - `runtime/` the one runtime every door calls, the gate ladder, the answer
12
- cache, the palette and the node-tree validator.
13
- - `jobs/` the generation job machine, its steps and the beat.
14
- - `activity/` — the activity codes the feed and the staff facet read.
15
- - `usage/` the meter every door reserves and records through: the org
16
- and per-user monthly rollups, the refusal counters, the Free taste's
17
- account and platform halves, the account-erasure sweep, and the staff
18
- readouts' arithmetic.
19
- - `model/` the generation job model and the per-user usage shapes and
20
- arithmetic the cards and the doors share, free of any server dependency.
21
- - `server/` the API handlers, registered under the `ai` and `assist`
22
- prefixes with `registerPluginApiRoute`.
23
- - `components/` — the assistant dock, the billing, member and staff cards
24
- mounted through the console's widget zones, and the Assist signal staff
25
- page.
3
+ The AI plugin for Aglyn: the in-console assistant, the Besigner copy assistant, generative building and automation jobs, and the usage metering and access controls around them. It is provider-generic: every feature talks to a provider contract, and vendor specifics live only under `src/lib/providers`. Install it if you run the Aglyn console and want AI features in it; it is a first-party plugin, not a standalone library.
4
+
5
+ > Beta. Published from the Aglyn monorepo under the `beta` dist-tag; APIs can change between beta releases.
6
+
7
+ ## Install
8
+
9
+ npm install @aglyn/plugins-ai@beta
10
+
11
+ Peer dependencies: `react`, `next`, `@mui/material`, `@mui/x-data-grid`, `firebase`, and `firebase-admin` for the server entries.
12
+
13
+ ## What's in it
14
+
15
+ **On a published site.** Nothing. The plugin has no site registrar, and the tenant runtime loads no server surface of it, so nothing that serves a published site can reach a provider. What a job builds (a page, a component, a form) is saved as ordinary Aglyn documents.
16
+
17
+ **Console** (`registerAiConsole`, the `console` and `staff` registrar in `plugins.config.json`). The plugin adds no nav item. Everything is mounted through zones the console shell and other plugins host, so no console page imports it:
18
+
19
+ - The assistant dock (`assistPanel`) and a provider the shell mounts around every console page for the Besigner copy assistant, with controls in the `besignerToolbar` and `besignerInspector` slots.
20
+ - "Describe it" entry points and cards on the site's screens, components, layouts, templates, forms, theme, SEO and automations pages (`hostScreens`, `hostComponents`, `hostLayouts`, `hostTemplates`, `hostForms`, `hostTheme`, `hostSeo`, `seoFields`, `hostAutomations`, `automationEditor`, `automationRun`, `hostFirstRun`, `orgSites`).
21
+ - Cards in zones other plugins host: product copy, import and the products hub (`productEditor`, `productImport`, `productsHub`), record insights, email drafts and import column matching (`recordInsights`, `recordEmail`, `importMapping`), and A/B test variants and results (`experimentVariants`, `experimentResult`).
22
+ - Usage and access: credit and usage cards on billing (`orgBillingUsage`), per-member cards and columns (`orgMember`, `orgMembersListColumn`, `hostMembers`), and staff cards, columns and one staff page (`staffOrg`, `staffUser`, `staffOrgsListColumn`, `staffOrgUsageColumn`).
23
+
24
+ **Server** (`registerAiConsoleApi`, the `consoleApi` registrar, exported from `@aglyn/plugins-ai/server`). It registers the first-party providers, every job kind, and the routes under the `ai` and `assist` prefixes with `registerPluginApiRoute`:
25
+
26
+ - Assistant: `assist/chat`, `assist/feedback`, `assist/edit-applied`, `ai/assist`.
27
+ - Jobs: `ai/jobs`, `ai/jobs/batch`, `ai/jobs/:jobId/cancel`, `ai/jobs/:jobId/resume`, `ai/jobs/:jobId/events`, the scheduled jobs beat, `ai/insights/:jobId`, `ai/crm/:jobId`, `ai/seo/apply`, `ai/generate/component`.
28
+ - Usage and access: `ai/usage`, `ai/allotments`, `ai/models`, `ai/host-permissions`, `ai/billing/credits`, `ai/billing/overage`.
29
+ - Staff: `ai/admin/org`, `ai/admin/orgs-spend`, `ai/admin/user`, `ai/admin/signals`, `ai/admin/overage`.
30
+
31
+ **Declarations.** Three light entries the core reads before any surface loads:
32
+
33
+ - `registerAiDeclarations` (`@aglyn/plugins-ai/declarations`, also exported from `.`): the plugin's entitlements, its config schema and its activity codes. Idempotent.
34
+ - `registerAiServerDeclarations` (`@aglyn/plugins-ai/declarations.server`): platform event subscriptions, the account-erasure sweep for a person's AI usage, and the usage alert contributor.
35
+ - `aiSubprocessors` (`@aglyn/plugins-ai/subprocessors`): the third-party hosts the registered providers send data to, for the subprocessor inventory.
36
+
37
+ **Source layout under `src/lib`**
38
+
39
+ - `providers/`: the provider contract (`AiProvider`), the registry (`AI_PROVIDER_CONTRACT`, `registerAiProvider`), the model catalog, the routing table, and two adapters, `anthropic.ts` and `openai-compatible.ts`.
40
+ - `runtime/`: the one runtime every route calls (`runAiRequest`), the gate, the answer cache, the palette and the node-tree validator.
41
+ - `jobs/`: the generation job machine, its steps and the beat.
42
+ - `tools/`: the tool definitions the job steps hand a provider.
43
+ - `usage/` and `billing/`: the meter every route reserves and records through, per-member allotments, and overage.
44
+ - `insights/`, `activity/`, `model/`: figure readers and the digest, activity codes, and the job and usage shapes the cards and routes share, free of any server dependency.
45
+ - `components/`: the dock, the cards and the staff page.
46
+
47
+ ## Usage
48
+
49
+ The plugin is loaded through Aglyn's plugin manager: the console's generated loader manifests import the package and call the registrars named in `plugins.config.json`. An app that wires plugins by hand calls them once at startup:
50
+
51
+ ```ts
52
+ // console, client side
53
+ import { registerAiConsole } from '@aglyn/plugins-ai'
54
+ registerAiConsole()
55
+
56
+ // console, server side
57
+ import { registerAiConsoleApi } from '@aglyn/plugins-ai/server'
58
+ registerAiConsoleApi()
59
+ ```
60
+
61
+ Adding a provider. Another plugin registers its own adapter against the same contract from its server entry; the first-party adapters register themselves only when no provider is registered yet, so one registered earlier is not displaced:
62
+
63
+ ```ts
64
+ import { registerAiProvider, type AiProvider } from '@aglyn/plugins-ai/server'
65
+
66
+ declare const myProvider: AiProvider
67
+ registerAiProvider(myProvider, { pluginId: 'my-plugin' })
68
+ ```
69
+
70
+ An `AiProvider` names the environment variable that carries its key (`apiKeyEnv`), reads it itself (`readApiKey`), lists its models, and implements `complete` and `stream`. The platform default provider is the one named by the `AI_PROVIDER` environment variable when it is registered, otherwise the first registered; `AI_DEFAULT_MODEL` overrides the model for every step kind.
71
+
72
+ ## How it fits
73
+
74
+ A plugin package (`scope:plugin`). It depends on the core (`@aglyn/aglyn`), the tenant packages (`@aglyn/tenant-runtime`, `@aglyn/tenant-data-admin`, `@aglyn/tenant-feature-instance`) and generic `@aglyn/shared-*` packages. It imports no other plugin. Where a job writes another plugin's resource, such as a campaign, an email design or an automation, that plugin registers a draft writer on a core seam and this one calls the seam; where a job reads another plugin's figures or records, that plugin registers a reader. The core never imports this package, and only `src/lib/server.*` is declared as having side effects.
75
+
76
+ ## License
77
+
78
+ Apache-2.0. Source: https://github.com/aglyn/aglyn/tree/main/libs/plugins/ai
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/plugins-ai",
3
- "version": "1.0.0-beta.143",
3
+ "version": "1.0.0-beta.144",
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.143",
29
- "@aglyn/shared-data-enums": "1.0.0-beta.143",
30
- "@aglyn/shared-data-mdi": "1.0.0-beta.143",
31
- "@aglyn/shared-data-types": "1.0.0-beta.143",
32
- "@aglyn/shared-ui-email-campaigns": "1.0.0-beta.143",
33
- "@aglyn/shared-ui-jsx": "1.0.0-beta.143",
34
- "@aglyn/shared-ui-snackstack": "1.0.0-beta.143",
35
- "@aglyn/shared-ui-theme": "1.0.0-beta.143",
36
- "@aglyn/shared-util-email": "1.0.0-beta.143",
37
- "@aglyn/shared-util-errors": "1.0.0-beta.143",
38
- "@aglyn/shared-util-http": "1.0.0-beta.143",
39
- "@aglyn/shared-util-timestamp": "1.0.0-beta.143",
40
- "@aglyn/shared-util-tools": "1.0.0-beta.143",
41
- "@aglyn/tenant-data-admin": "1.0.0-beta.143",
42
- "@aglyn/tenant-feature-instance": "1.0.0-beta.143",
43
- "@aglyn/tenant-runtime": "1.0.0-beta.143",
28
+ "@aglyn/aglyn": "1.0.0-beta.144",
29
+ "@aglyn/shared-data-enums": "1.0.0-beta.144",
30
+ "@aglyn/shared-data-mdi": "1.0.0-beta.144",
31
+ "@aglyn/shared-data-types": "1.0.0-beta.144",
32
+ "@aglyn/shared-ui-email-campaigns": "1.0.0-beta.144",
33
+ "@aglyn/shared-ui-jsx": "1.0.0-beta.144",
34
+ "@aglyn/shared-ui-snackstack": "1.0.0-beta.144",
35
+ "@aglyn/shared-ui-theme": "1.0.0-beta.144",
36
+ "@aglyn/shared-util-email": "1.0.0-beta.144",
37
+ "@aglyn/shared-util-errors": "1.0.0-beta.144",
38
+ "@aglyn/shared-util-http": "1.0.0-beta.144",
39
+ "@aglyn/shared-util-timestamp": "1.0.0-beta.144",
40
+ "@aglyn/shared-util-tools": "1.0.0-beta.144",
41
+ "@aglyn/tenant-data-admin": "1.0.0-beta.144",
42
+ "@aglyn/tenant-feature-instance": "1.0.0-beta.144",
43
+ "@aglyn/tenant-runtime": "1.0.0-beta.144",
44
44
  "@swc/helpers": "0.5.23"
45
45
  },
46
46
  "peerDependencies": {