@aglyn/aglyn 1.23.1 → 1.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/package.json +11 -11
  2. package/src/lib/app-utils/activity-presenter.d.ts +11 -0
  3. package/src/lib/app-utils/activity-presenter.js +9 -0
  4. package/src/lib/app-utils/activity-presenter.js.map +1 -1
  5. package/src/lib/app-utils/activity-search.d.ts +1 -0
  6. package/src/lib/app-utils/activity-search.js +1 -0
  7. package/src/lib/app-utils/activity-search.js.map +1 -1
  8. package/src/lib/app-utils/agent-api-catalog.d.ts +18 -0
  9. package/src/lib/app-utils/agent-api-catalog.js +8 -1
  10. package/src/lib/app-utils/agent-api-catalog.js.map +1 -1
  11. package/src/lib/app-utils/binding-token-catalog.d.ts +15 -0
  12. package/src/lib/app-utils/binding-token-catalog.js +16 -0
  13. package/src/lib/app-utils/binding-token-catalog.js.map +1 -1
  14. package/src/lib/app-utils/connector-discovery.d.ts +80 -0
  15. package/src/lib/app-utils/connector-discovery.js +107 -0
  16. package/src/lib/app-utils/connector-discovery.js.map +1 -0
  17. package/src/lib/app-utils/docs-help-sections.generated.js +1 -0
  18. package/src/lib/app-utils/docs-help-sections.generated.js.map +1 -1
  19. package/src/lib/app-utils/docs-help.generated.d.ts +4 -4
  20. package/src/lib/app-utils/docs-help.generated.js +5 -3
  21. package/src/lib/app-utils/docs-help.generated.js.map +1 -1
  22. package/src/lib/app-utils/docs-index.generated.js +122 -3
  23. package/src/lib/app-utils/docs-index.generated.js.map +1 -1
  24. package/src/lib/app-utils/entity-picker-context.d.ts +6 -0
  25. package/src/lib/app-utils/entity-picker-context.js.map +1 -1
  26. package/src/lib/app-utils/expand-repeatables.js +25 -2
  27. package/src/lib/app-utils/expand-repeatables.js.map +1 -1
  28. package/src/lib/app-utils/native-app-association.d.ts +4 -2
  29. package/src/lib/app-utils/native-app-association.js +5 -2
  30. package/src/lib/app-utils/native-app-association.js.map +1 -1
  31. package/src/lib/app-utils/organizations.js +4 -2
  32. package/src/lib/app-utils/organizations.js.map +1 -1
  33. package/src/lib/app-utils/plugin-release-flags.generated.js +2 -2
  34. package/src/lib/app-utils/plugin-release-flags.generated.js.map +1 -1
  35. package/src/lib/plugin-manager/plugin-contact-capture.d.ts +2 -0
  36. package/src/lib/plugin-manager/plugin-contact-capture.js.map +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/aglyn",
3
- "version": "1.23.1",
3
+ "version": "1.24.0",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://aglyn.com",
6
6
  "repository": {
@@ -37,16 +37,16 @@
37
37
  "./package.json": "./package.json"
38
38
  },
39
39
  "dependencies": {
40
- "@aglyn/shared-data-enums": "1.23.1",
41
- "@aglyn/shared-data-mdi": "1.23.1",
42
- "@aglyn/shared-data-types": "1.23.1",
43
- "@aglyn/shared-util-email": "1.23.1",
44
- "@aglyn/shared-util-first-touch": "1.23.1",
45
- "@aglyn/shared-util-http": "1.23.1",
46
- "@aglyn/shared-util-logger": "1.23.1",
47
- "@aglyn/shared-util-timestamp": "1.23.1",
48
- "@aglyn/shared-util-tools": "1.23.1",
49
- "@aglyn/shared-util-vendor": "1.23.1",
40
+ "@aglyn/shared-data-enums": "1.24.0",
41
+ "@aglyn/shared-data-mdi": "1.24.0",
42
+ "@aglyn/shared-data-types": "1.24.0",
43
+ "@aglyn/shared-util-email": "1.24.0",
44
+ "@aglyn/shared-util-first-touch": "1.24.0",
45
+ "@aglyn/shared-util-http": "1.24.0",
46
+ "@aglyn/shared-util-logger": "1.24.0",
47
+ "@aglyn/shared-util-timestamp": "1.24.0",
48
+ "@aglyn/shared-util-tools": "1.24.0",
49
+ "@aglyn/shared-util-vendor": "1.24.0",
50
50
  "@data-driven-forms/react-form-renderer": "^4.2.3",
51
51
  "@msgpack/msgpack": "^3.1.3",
52
52
  "@types/unist": "^3.0.3",
@@ -47,6 +47,8 @@ export interface ActivityEntryLike {
47
47
  staffActorEmail?: string | null;
48
48
  /** The name of the API key that wrote the entry, when a key did (AGL-2632). */
49
49
  apiKeyName?: string | null;
50
+ /** The name of the connected app that wrote it, when one did (AGL-4225). */
51
+ connectedAppName?: string | null;
50
52
  }
51
53
  /**
52
54
  * Who a host activity entry is attributed to — the writer's half of the
@@ -63,6 +65,8 @@ export interface HostActivityActor {
63
65
  email?: string | null;
64
66
  /** The API key's name, for an entry an integration wrote. */
65
67
  apiKeyName?: string | null;
68
+ /** A connected app's own name, for an entry a connection wrote (AGL-4225). */
69
+ connectedAppName?: string | null;
66
70
  }
67
71
  /**
68
72
  * What the presenter needs to build a link. `host` is the `[host]` URL
@@ -108,6 +112,12 @@ export declare function activityEntryGroupId(entry: ActivityEntryLike): string |
108
112
  export declare function activityPrimaryText(entry: ActivityEntryLike): string;
109
113
  /** How an integration's key is named wherever an actor is: `API key Zapier`. */
110
114
  export declare function apiKeyActorLabel(name: string): string;
115
+ /**
116
+ * How a connected app is named wherever an actor is: `Connected app Cursor`
117
+ * (AGL-4225). Its name is the one the app registered under, so it is always
118
+ * shown behind this label and never on its own.
119
+ */
120
+ export declare function connectedAppActorLabel(name: string): string;
111
121
  /**
112
122
  * The "who" line for an entry — always someone a reader can narrow down.
113
123
  *
@@ -135,6 +145,7 @@ export interface RunTriggeredByLike {
135
145
  uid?: string;
136
146
  email?: string;
137
147
  apiKeyName?: string;
148
+ connectedAppName?: string;
138
149
  name?: string;
139
150
  }
140
151
  /**
@@ -94,6 +94,13 @@ import { ACTIVITY_TYPE_LABELS } from "./activity-type-labels.js";
94
94
  /** How an integration's key is named wherever an actor is: `API key Zapier`. */ export function apiKeyActorLabel(name) {
95
95
  return `API key ${name}`;
96
96
  }
97
+ /**
98
+ * How a connected app is named wherever an actor is: `Connected app Cursor`
99
+ * (AGL-4225). Its name is the one the app registered under, so it is always
100
+ * shown behind this label and never on its own.
101
+ */ export function connectedAppActorLabel(name) {
102
+ return `Connected app ${name}`;
103
+ }
97
104
  /**
98
105
  * The "who" line for an entry — always someone a reader can narrow down.
99
106
  *
@@ -113,6 +120,7 @@ import { ACTIVITY_TYPE_LABELS } from "./activity-type-labels.js";
113
120
  var _entry_target, _ref;
114
121
  var _entry_actorId;
115
122
  if (entry.actorEmail) return entry.actorEmail;
123
+ if (entry.connectedAppName) return connectedAppActorLabel(entry.connectedAppName);
116
124
  if (entry.apiKeyName) return apiKeyActorLabel(entry.apiKeyName);
117
125
  const actorId = (_entry_actorId = entry.actorId) == null ? void 0 : _entry_actorId.trim();
118
126
  if (actorId === 'api') return 'API key';
@@ -141,6 +149,7 @@ import { ACTIVITY_TYPE_LABELS } from "./activity-type-labels.js";
141
149
  case 'member':
142
150
  return by.email || (by.uid ? `Account ${by.uid}` : 'A member');
143
151
  case 'apiKey':
152
+ if (by.connectedAppName) return connectedAppActorLabel(by.connectedAppName);
144
153
  return by.apiKeyName ? apiKeyActorLabel(by.apiKeyName) : 'API key';
145
154
  case 'visitor':
146
155
  return by.email ? `Site visitor (${by.email})` : 'Site visitor';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/activity-presenter.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// Activity-feed presenter (AGL-810). The `hosts/{id}/activity` and\n// `orgs/{id}/activity` logs store a free-text `action` plus a `{ type, id,\n// name }` target, written from ~40 scattered call sites. The three renderers\n// (host card, host table, org card) used to each format entries their own\n// way — one dropped the target entirely, one printed the raw Firestore doc\n// id when no name was recorded. This module is the single place that turns a\n// stored entry into something a human reads, and into a deep link to the\n// thing that changed. It is deliberately light (the string route table and\n// the record-route registry) so plugin libs and the console app can both\n// import it via `@aglyn/aglyn/app-utils/activity-presenter`.\n\nimport { Route, buildRoute } from './console-routes'\nimport {\n pluginRecordHref,\n pluginRecordListHref,\n type PluginRecordRouteContext,\n} from '../plugin-manager/plugin-record-routes'\nimport { PLATFORM_BRAND_NAME } from './platform-brand'\nimport { hostEventLabel } from './host-events'\nimport { duplicateActivityActionLabel } from './duplicate-resource'\nimport {\n pluginActivityActionLabel,\n pluginActivityGroupForAction,\n pluginActivityTargetLabel,\n pluginActivityTargetNoun,\n} from '../plugin-manager/plugin-activity-actions'\nimport { ACTIVITY_TYPE_LABELS } from './activity-type-labels'\n\n/** The stored `target` sub-object, read defensively (any field may be absent). */\nexport interface ActivityTargetLike {\n type?: string\n id?: string\n name?: string\n /** Present on screen saves so the deep link can hit the exact version. */\n versionId?: string\n}\n\n/** A stored activity document, read defensively. */\nexport interface ActivityEntryLike {\n action?: string\n target?: ActivityTargetLike | null\n // Some early org entries carried the type/target id at the top level rather\n // than nested under `target` — tolerate both so no entry renders blank.\n type?: string\n targetId?: string\n /**\n * The acting uid: a person's, the literal `'api'` for a key, a\n * `system:` id for a platform process, or null when no person acted.\n */\n actorId?: string | null\n /** The address the actor had when the entry was written; null for a key. */\n actorEmail?: string | null\n /**\n * The address `actorId` holds TODAY, looked up on read by a route with the\n * Admin SDK, for an entry that recorded a uid and no address.\n */\n actorEmailNow?: string | null\n /**\n * For a STAFF reader only: the staff member behind an entry the workspace\n * did not perform (a staff cancellation), resolved by the route.\n */\n staffActorEmail?: string | null\n /** The name of the API key that wrote the entry, when a key did (AGL-2632). */\n apiKeyName?: string | null\n}\n\n/**\n * Who a host activity entry is attributed to — the writer's half of the\n * contract whose reader is {@link activityActorLabel}.\n *\n * A person is their verified uid and the address they had at the time. An\n * integration is the literal uid `'api'`, no address, and the name the\n * organization gave its key — carried because a feed that says \"Someone\"\n * about every write a key made is an audit trail with a hole in it: three\n * Zapier zaps and a nightly import all read as the same nobody.\n */\nexport interface HostActivityActor {\n uid: string\n email?: string | null\n /** The API key's name, for an entry an integration wrote. */\n apiKeyName?: string | null\n}\n\n/**\n * What the presenter needs to build a link. `host` is the `[host]` URL\n * segment — the site SLUG the console routes by (AGL-622), NOT the host doc\n * id — so pass `useParams().host`, not the doc id. When it is present the\n * entry is treated as host-scoped, otherwise org-scoped — which\n * disambiguates `member`, the one type both logs use.\n */\nexport interface ActivityLinkContext {\n orgSlug?: string\n host?: string\n}\n\n/** Human, singular noun for a target type. Falls back to the raw type. */\nconst TYPE_LABELS = ACTIVITY_TYPE_LABELS\n\n/**\n * A plugin's record, where its owner publishes an address for the kind\n * (`plugin-record-routes`): its own page, or the list it lives on when the\n * entry named no id — a deleted record still has a list to land on.\n * `undefined` for a kind no plugin publishes here.\n */\nfunction pluginRecordActivityHref(\n type: string | undefined,\n id: string | undefined,\n context: PluginRecordRouteContext,\n): string | undefined {\n if (!type) return undefined\n return (id ? pluginRecordHref(type, context, id) : pluginRecordListHref(type, context)) ?? undefined\n}\n\n/**\n * Human noun for a target type, e.g. `'screen'` → `'Screen'`. A plugin's\n * own resource is stored as `pluginId:noun` (AGL-2978), and a reader sees\n * the noun: `acme-mail:mailbox` → `Mailbox`.\n */\nexport function activityTypeLabel(type: string | undefined): string {\n if (!type) return 'Item'\n const known = TYPE_LABELS[type] ?? pluginActivityTargetLabel(type)\n if (known) return known\n const noun = pluginActivityTargetNoun(type) ?? type\n return noun.charAt(0).toUpperCase() + noun.slice(1)\n}\n\n/**\n * A label for the target column/link. Prefers the recorded name; when none\n * was written (older entries, id-only saves) it degrades to the humanized\n * type — NEVER the raw doc id, which is meaningless to a reader.\n */\nexport function activityTargetLabel(\n target: ActivityTargetLike | null | undefined,\n): string {\n if (target?.name) return target.name\n return activityTypeLabel(target?.type)\n}\n\n/**\n * What the action column reads (AGL-2929). Most actions are the sentence\n * their writer stored; a plugin's rows store a code (`ai.job.output`) so\n * that three surfaces can recognize them without parsing prose, and the\n * code is translated here — once, from the plugin-declared catalog\n * (AGL-2940) — rather than shown to a reader as a dotted path.\n */\nexport function activityActionLabel(action: string | undefined): string {\n const stored = action?.trim() ?? ''\n return (\n pluginActivityActionLabel(stored) ??\n duplicateActivityActionLabel(stored) ??\n stored\n )\n}\n\n/**\n * The filter group an entry's code belongs to — the chip that keeps it —\n * or `undefined` for a prose action no plugin declared.\n */\nexport function activityEntryGroupId(entry: ActivityEntryLike): string | undefined {\n return pluginActivityGroupForAction(entry.action?.trim())?.id\n}\n\n/**\n * The primary line for a feed entry: the action, suffixed with the target\n * name when one is known, so \"Saved the screen\" becomes \"Saved the screen —\n * Home\". A missing action degrades to the target label rather than blank.\n */\nexport function activityPrimaryText(entry: ActivityEntryLike): string {\n const action = activityActionLabel(entry.action)\n const name = entry.target?.name?.trim()\n if (action && name) return `${action} — ${name}`\n if (action) return action\n return activityTargetLabel(entry.target)\n}\n\n/** How an integration's key is named wherever an actor is: `API key Zapier`. */\nexport function apiKeyActorLabel(name: string): string {\n return `API key ${name}`\n}\n\n/**\n * The \"who\" line for an entry — always someone a reader can narrow down.\n *\n * In order: the address recorded when the entry was written; the key that\n * wrote it, by name; the address the recorded uid holds now, when the writer\n * held a uid and no address (the billing webhook, before it carried the\n * address stamped at the console act); else the uid itself, for an account\n * that no longer resolves.\n *\n * An entry with no uid at all is not an anonymous one. Every writer that\n * leaves `actorId` null is a platform process, so the feed names it: a\n * workflow run by its workflow, anything else — the billing webhook,\n * inbound CRM mail, a background AI job, a staff cancellation — as the\n * platform; a staff reader is also told which staff member. Never \"Someone\", which read as a person nobody could identify\n * (AGL-3369).\n */\nexport function activityActorLabel(entry: ActivityEntryLike): string {\n if (entry.actorEmail) return entry.actorEmail\n if (entry.apiKeyName) return apiKeyActorLabel(entry.apiKeyName)\n const actorId = entry.actorId?.trim()\n if (actorId === 'api') return 'API key'\n if (actorId && !actorId.startsWith('system:')) {\n return entry.actorEmailNow || `Account ${actorId}`\n }\n const target = entry.target ?? undefined\n if ((target?.type ?? entry.type) === 'workflow') {\n const name = target?.name?.trim()\n return name ? `Workflow ${name}` : 'Workflow'\n }\n if (entry.staffActorEmail) {\n return `${PLATFORM_BRAND_NAME} staff (${entry.staffActorEmail})`\n }\n return PLATFORM_BRAND_NAME\n}\n\n/**\n * Who set a run off (AGL-3376), as a run row stores it: the actor the event's\n * door named, carried through the engine. `webhook` is an inbound webhook's\n * caller, named by the hook.\n */\nexport interface RunTriggeredByLike {\n kind?: string\n uid?: string\n email?: string\n apiKeyName?: string\n name?: string\n}\n\n/**\n * The run history's Who: whoever set the run off, never the automation\n * itself — every row in a run history is that automation, so naming it\n * again would answer nothing. A run written before its trigger was recorded\n * says so rather than guessing from the event's name.\n */\nexport function runTriggeredByLabel(entry: {\n triggeredBy?: RunTriggeredByLike | null\n}): string {\n const by = entry.triggeredBy\n switch (by?.kind) {\n case 'member':\n return by.email || (by.uid ? `Account ${by.uid}` : 'A member')\n case 'apiKey':\n return by.apiKeyName ? apiKeyActorLabel(by.apiKeyName) : 'API key'\n case 'visitor':\n return by.email ? `Site visitor (${by.email})` : 'Site visitor'\n case 'webhook':\n return by.name ? `Inbound webhook ${by.name}` : 'Inbound webhook'\n case 'platform':\n return PLATFORM_BRAND_NAME\n default:\n return 'Not recorded'\n }\n}\n\n/**\n * A deep link to the resource an entry points at, or `undefined` when it\n * cannot be built (missing context, or a type with nowhere sensible to go).\n * `buildRoute` emits `<orgSlug?>` placeholders for missing params, so every\n * branch guards its inputs and returns `undefined` rather than a dead link.\n */\nexport function activityHref(\n entry: ActivityEntryLike,\n ctx: ActivityLinkContext,\n): string | undefined {\n const { orgSlug, host } = ctx\n if (!orgSlug) return undefined\n const target = entry.target ?? undefined\n const type = target?.type ?? entry.type\n const id = target?.id ?? entry.targetId\n const versionId = target?.versionId\n\n // Host-scoped entries: every host route needs both orgSlug and host.\n if (host) {\n switch (type) {\n case 'host':\n return buildRoute(Route.HOST_DASHBOARD, { orgSlug, host })\n case 'screen':\n // The screen detail page is version-addressed; without a versionId\n // there is no \"current\" pointer to route through, so land on the list.\n return id && versionId\n ? buildRoute(Route.SCREEN_DETAILS, {\n orgSlug,\n host,\n screenId: id,\n versionId,\n })\n : buildRoute(Route.HOST_SCREENS, { orgSlug, host })\n case 'component':\n return id\n ? buildRoute(Route.COMPONENT_DETAILS, {\n orgSlug,\n host,\n componentId: id,\n })\n : buildRoute(Route.HOST_COMPONENTS, { orgSlug, host })\n case 'template':\n return id\n ? buildRoute(Route.TEMPLATE_DETAILS, {\n orgSlug,\n host,\n templateId: id,\n })\n : buildRoute(Route.HOST_TEMPLATES, { orgSlug, host })\n case 'layout':\n return id\n ? buildRoute(Route.LAYOUT_DETAILS, { orgSlug, host, layoutId: id })\n : buildRoute(Route.HOST_LAYOUTS, { orgSlug, host })\n case 'theme':\n return buildRoute(Route.HOST_SETUP_THEME, { orgSlug, host })\n case 'media':\n return buildRoute(Route.HOST_MEDIA, { orgSlug, host })\n case 'content':\n return buildRoute(Route.HOST_CONTENT, { orgSlug, host })\n case 'variable':\n return buildRoute(Route.HOST_DATA, { orgSlug, host })\n case 'function':\n return buildRoute(Route.HOST_LOGIC, { orgSlug, host })\n case 'workflow':\n return buildRoute(Route.HOST_AUTOMATION, { orgSlug, host })\n case 'member':\n // Site team is managed on the Setup page — there is no per-member\n // host route.\n return buildRoute(Route.HOST_SETUP, { orgSlug, host })\n default:\n // A plugin's record — a contact, a deal, an order — at the address\n // its owner publishes, which the route table does not hold.\n return pluginRecordActivityHref(type, id, { orgSlug, host })\n }\n }\n\n // Org-scoped entries.\n switch (type) {\n case 'org':\n return buildRoute(Route.ORG_SETTINGS, { orgSlug })\n case 'member':\n return id\n ? buildRoute(Route.MANAGE_TEAM_MEMBER, { orgSlug, uid: id })\n : buildRoute(Route.MANAGE_TEAM, { orgSlug })\n case 'invite':\n return buildRoute(Route.MANAGE_TEAM, { orgSlug })\n default:\n // A plugin's record acted on at the ORGANIZATION level (AGL-2634) — a\n // deal moved from the org board, a merge, a bulk bar's action — at the\n // organization address its owner publishes; a bulk line names no\n // record and lands on the list.\n return pluginRecordActivityHref(type, id, { orgSlug, host: null })\n }\n}\n\n/**\n * How an automation run ended (AGL-2171).\n *\n * `skipped` is a first-class outcome, not an absence. An unmet condition\n * used to be a bare `continue` that wrote nothing, so \"why didn't my\n * automation fire?\" — the most common support question about automations —\n * had no answer anywhere in the product, while `/product/workflows`\n * advertises an amber `Skipped` row that answers it.\n */\nexport type ActionRunResult = 'succeeded' | 'failed' | 'skipped'\n\n/** A stored run entry: an activity document with the run fields on it. */\nexport interface ActionRunEntryLike extends ActivityEntryLike {\n result?: string\n trigger?: string\n summary?: string\n}\n\n/**\n * `formSubmission` → `Form submitted`.\n *\n * The console rendered the raw camelCase identifier in the trigger select\n * and in every run row. The words are each event's declared label\n * (`host-events.ts`) — one map, so the picker an author chose from and the\n * run row they read afterwards cannot name the same event differently.\n */\nexport function actionTriggerLabel(event: string | undefined): string {\n return hostEventLabel(event)\n}\n\n/**\n * The run's outcome, tolerating rows written before it was recorded.\n *\n * A legacy entry carries only the prose `action` string, so it is read\n * back: `with errors:` means it failed and `Action ran on` means it\n * succeeded. Anything else is not a run at all — the activity collection\n * also holds publishes, media saves and member changes, and calling one of\n * those `succeeded` would put it in the run history under a verdict that\n * means nothing for it.\n */\nexport function actionRunResult(\n entry: ActionRunEntryLike,\n): ActionRunResult | undefined {\n const stored = String(entry.result ?? '').trim()\n if (stored === 'succeeded' || stored === 'failed' || stored === 'skipped') {\n return stored\n }\n const action = String(entry.action ?? '')\n if (!action.startsWith('Action ran on')) return undefined\n return action.includes('with errors:') ? 'failed' : 'succeeded'\n}\n\n/**\n * The `What happened` column: `Sent email · saved to Leads · webhook 200`.\n *\n * Falls back to the legacy prose, minus its `Action ran on <event>` prefix\n * — that fact is the Trigger column now, and repeating it in the summary\n * would make every historic row say the same thing twice.\n */\nexport function actionRunSummary(entry: ActionRunEntryLike): string {\n const summary = String(entry.summary ?? '').trim()\n if (summary) return summary\n const action = String(entry.action ?? '').trim()\n const errors = action.match(/with errors:\\s*(.+)$/)\n if (errors) return errors[1]\n // A pre-AGL-2171 success recorded nothing but the fact that it ran.\n if (action.startsWith('Action ran on')) return 'Ran'\n return action\n}\n"],"names":["Route","buildRoute","pluginRecordHref","pluginRecordListHref","PLATFORM_BRAND_NAME","hostEventLabel","duplicateActivityActionLabel","pluginActivityActionLabel","pluginActivityGroupForAction","pluginActivityTargetLabel","pluginActivityTargetNoun","ACTIVITY_TYPE_LABELS","TYPE_LABELS","pluginRecordActivityHref","type","id","context","undefined","activityTypeLabel","known","noun","charAt","toUpperCase","slice","activityTargetLabel","target","name","activityActionLabel","action","stored","trim","activityEntryGroupId","entry","activityPrimaryText","apiKeyActorLabel","activityActorLabel","actorEmail","apiKeyName","actorId","startsWith","actorEmailNow","staffActorEmail","runTriggeredByLabel","by","triggeredBy","kind","email","uid","activityHref","ctx","orgSlug","host","targetId","versionId","HOST_DASHBOARD","SCREEN_DETAILS","screenId","HOST_SCREENS","COMPONENT_DETAILS","componentId","HOST_COMPONENTS","TEMPLATE_DETAILS","templateId","HOST_TEMPLATES","LAYOUT_DETAILS","layoutId","HOST_LAYOUTS","HOST_SETUP_THEME","HOST_MEDIA","HOST_CONTENT","HOST_DATA","HOST_LOGIC","HOST_AUTOMATION","HOST_SETUP","ORG_SETTINGS","MANAGE_TEAM_MEMBER","MANAGE_TEAM","actionTriggerLabel","event","actionRunResult","String","result","includes","actionRunSummary","summary","errors","match"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,mEAAmE;AACnE,2EAA2E;AAC3E,6EAA6E;AAC7E,0EAA0E;AAC1E,2EAA2E;AAC3E,6EAA6E;AAC7E,yEAAyE;AACzE,2EAA2E;AAC3E,yEAAyE;AACzE,6DAA6D;AAE7D,SAASA,KAAK,EAAEC,UAAU,QAAQ,sBAAkB;AACpD,SACEC,gBAAgB,EAChBC,oBAAoB,QAEf,4CAAwC;AAC/C,SAASC,mBAAm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IsD,SAAS,OAAOA;IACpB,MAAMxD,SAASoD,QAAOhD,gBAAAA,MAAMJ,MAAM,YAAZI,gBAAgB,IAAIF,IAAI;IAC9C,MAAMuD,SAASzD,OAAO0D,KAAK,CAAC;IAC5B,IAAID,QAAQ,OAAOA,MAAM,CAAC,EAAE;IAC5B,oEAAoE;IACpE,IAAIzD,OAAOW,UAAU,CAAC,kBAAkB,OAAO;IAC/C,OAAOX;AACT"}
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/activity-presenter.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// Activity-feed presenter (AGL-810). The `hosts/{id}/activity` and\n// `orgs/{id}/activity` logs store a free-text `action` plus a `{ type, id,\n// name }` target, written from ~40 scattered call sites. The three renderers\n// (host card, host table, org card) used to each format entries their own\n// way — one dropped the target entirely, one printed the raw Firestore doc\n// id when no name was recorded. This module is the single place that turns a\n// stored entry into something a human reads, and into a deep link to the\n// thing that changed. It is deliberately light (the string route table and\n// the record-route registry) so plugin libs and the console app can both\n// import it via `@aglyn/aglyn/app-utils/activity-presenter`.\n\nimport { Route, buildRoute } from './console-routes'\nimport {\n pluginRecordHref,\n pluginRecordListHref,\n type PluginRecordRouteContext,\n} from '../plugin-manager/plugin-record-routes'\nimport { PLATFORM_BRAND_NAME } from './platform-brand'\nimport { hostEventLabel } from './host-events'\nimport { duplicateActivityActionLabel } from './duplicate-resource'\nimport {\n pluginActivityActionLabel,\n pluginActivityGroupForAction,\n pluginActivityTargetLabel,\n pluginActivityTargetNoun,\n} from '../plugin-manager/plugin-activity-actions'\nimport { ACTIVITY_TYPE_LABELS } from './activity-type-labels'\n\n/** The stored `target` sub-object, read defensively (any field may be absent). */\nexport interface ActivityTargetLike {\n type?: string\n id?: string\n name?: string\n /** Present on screen saves so the deep link can hit the exact version. */\n versionId?: string\n}\n\n/** A stored activity document, read defensively. */\nexport interface ActivityEntryLike {\n action?: string\n target?: ActivityTargetLike | null\n // Some early org entries carried the type/target id at the top level rather\n // than nested under `target` — tolerate both so no entry renders blank.\n type?: string\n targetId?: string\n /**\n * The acting uid: a person's, the literal `'api'` for a key, a\n * `system:` id for a platform process, or null when no person acted.\n */\n actorId?: string | null\n /** The address the actor had when the entry was written; null for a key. */\n actorEmail?: string | null\n /**\n * The address `actorId` holds TODAY, looked up on read by a route with the\n * Admin SDK, for an entry that recorded a uid and no address.\n */\n actorEmailNow?: string | null\n /**\n * For a STAFF reader only: the staff member behind an entry the workspace\n * did not perform (a staff cancellation), resolved by the route.\n */\n staffActorEmail?: string | null\n /** The name of the API key that wrote the entry, when a key did (AGL-2632). */\n apiKeyName?: string | null\n /** The name of the connected app that wrote it, when one did (AGL-4225). */\n connectedAppName?: string | null\n}\n\n/**\n * Who a host activity entry is attributed to — the writer's half of the\n * contract whose reader is {@link activityActorLabel}.\n *\n * A person is their verified uid and the address they had at the time. An\n * integration is the literal uid `'api'`, no address, and the name the\n * organization gave its key — carried because a feed that says \"Someone\"\n * about every write a key made is an audit trail with a hole in it: three\n * Zapier zaps and a nightly import all read as the same nobody.\n */\nexport interface HostActivityActor {\n uid: string\n email?: string | null\n /** The API key's name, for an entry an integration wrote. */\n apiKeyName?: string | null\n /** A connected app's own name, for an entry a connection wrote (AGL-4225). */\n connectedAppName?: string | null\n}\n\n/**\n * What the presenter needs to build a link. `host` is the `[host]` URL\n * segment — the site SLUG the console routes by (AGL-622), NOT the host doc\n * id — so pass `useParams().host`, not the doc id. When it is present the\n * entry is treated as host-scoped, otherwise org-scoped — which\n * disambiguates `member`, the one type both logs use.\n */\nexport interface ActivityLinkContext {\n orgSlug?: string\n host?: string\n}\n\n/** Human, singular noun for a target type. Falls back to the raw type. */\nconst TYPE_LABELS = ACTIVITY_TYPE_LABELS\n\n/**\n * A plugin's record, where its owner publishes an address for the kind\n * (`plugin-record-routes`): its own page, or the list it lives on when the\n * entry named no id — a deleted record still has a list to land on.\n * `undefined` for a kind no plugin publishes here.\n */\nfunction pluginRecordActivityHref(\n type: string | undefined,\n id: string | undefined,\n context: PluginRecordRouteContext,\n): string | undefined {\n if (!type) return undefined\n return (id ? pluginRecordHref(type, context, id) : pluginRecordListHref(type, context)) ?? undefined\n}\n\n/**\n * Human noun for a target type, e.g. `'screen'` → `'Screen'`. A plugin's\n * own resource is stored as `pluginId:noun` (AGL-2978), and a reader sees\n * the noun: `acme-mail:mailbox` → `Mailbox`.\n */\nexport function activityTypeLabel(type: string | undefined): string {\n if (!type) return 'Item'\n const known = TYPE_LABELS[type] ?? pluginActivityTargetLabel(type)\n if (known) return known\n const noun = pluginActivityTargetNoun(type) ?? type\n return noun.charAt(0).toUpperCase() + noun.slice(1)\n}\n\n/**\n * A label for the target column/link. Prefers the recorded name; when none\n * was written (older entries, id-only saves) it degrades to the humanized\n * type — NEVER the raw doc id, which is meaningless to a reader.\n */\nexport function activityTargetLabel(\n target: ActivityTargetLike | null | undefined,\n): string {\n if (target?.name) return target.name\n return activityTypeLabel(target?.type)\n}\n\n/**\n * What the action column reads (AGL-2929). Most actions are the sentence\n * their writer stored; a plugin's rows store a code (`ai.job.output`) so\n * that three surfaces can recognize them without parsing prose, and the\n * code is translated here — once, from the plugin-declared catalog\n * (AGL-2940) — rather than shown to a reader as a dotted path.\n */\nexport function activityActionLabel(action: string | undefined): string {\n const stored = action?.trim() ?? ''\n return (\n pluginActivityActionLabel(stored) ??\n duplicateActivityActionLabel(stored) ??\n stored\n )\n}\n\n/**\n * The filter group an entry's code belongs to — the chip that keeps it —\n * or `undefined` for a prose action no plugin declared.\n */\nexport function activityEntryGroupId(entry: ActivityEntryLike): string | undefined {\n return pluginActivityGroupForAction(entry.action?.trim())?.id\n}\n\n/**\n * The primary line for a feed entry: the action, suffixed with the target\n * name when one is known, so \"Saved the screen\" becomes \"Saved the screen —\n * Home\". A missing action degrades to the target label rather than blank.\n */\nexport function activityPrimaryText(entry: ActivityEntryLike): string {\n const action = activityActionLabel(entry.action)\n const name = entry.target?.name?.trim()\n if (action && name) return `${action} — ${name}`\n if (action) return action\n return activityTargetLabel(entry.target)\n}\n\n/** How an integration's key is named wherever an actor is: `API key Zapier`. */\nexport function apiKeyActorLabel(name: string): string {\n return `API key ${name}`\n}\n\n/**\n * How a connected app is named wherever an actor is: `Connected app Cursor`\n * (AGL-4225). Its name is the one the app registered under, so it is always\n * shown behind this label and never on its own.\n */\nexport function connectedAppActorLabel(name: string): string {\n return `Connected app ${name}`\n}\n\n/**\n * The \"who\" line for an entry — always someone a reader can narrow down.\n *\n * In order: the address recorded when the entry was written; the key that\n * wrote it, by name; the address the recorded uid holds now, when the writer\n * held a uid and no address (the billing webhook, before it carried the\n * address stamped at the console act); else the uid itself, for an account\n * that no longer resolves.\n *\n * An entry with no uid at all is not an anonymous one. Every writer that\n * leaves `actorId` null is a platform process, so the feed names it: a\n * workflow run by its workflow, anything else — the billing webhook,\n * inbound CRM mail, a background AI job, a staff cancellation — as the\n * platform; a staff reader is also told which staff member. Never \"Someone\", which read as a person nobody could identify\n * (AGL-3369).\n */\nexport function activityActorLabel(entry: ActivityEntryLike): string {\n if (entry.actorEmail) return entry.actorEmail\n if (entry.connectedAppName) return connectedAppActorLabel(entry.connectedAppName)\n if (entry.apiKeyName) return apiKeyActorLabel(entry.apiKeyName)\n const actorId = entry.actorId?.trim()\n if (actorId === 'api') return 'API key'\n if (actorId && !actorId.startsWith('system:')) {\n return entry.actorEmailNow || `Account ${actorId}`\n }\n const target = entry.target ?? undefined\n if ((target?.type ?? entry.type) === 'workflow') {\n const name = target?.name?.trim()\n return name ? `Workflow ${name}` : 'Workflow'\n }\n if (entry.staffActorEmail) {\n return `${PLATFORM_BRAND_NAME} staff (${entry.staffActorEmail})`\n }\n return PLATFORM_BRAND_NAME\n}\n\n/**\n * Who set a run off (AGL-3376), as a run row stores it: the actor the event's\n * door named, carried through the engine. `webhook` is an inbound webhook's\n * caller, named by the hook.\n */\nexport interface RunTriggeredByLike {\n kind?: string\n uid?: string\n email?: string\n apiKeyName?: string\n connectedAppName?: string\n name?: string\n}\n\n/**\n * The run history's Who: whoever set the run off, never the automation\n * itself — every row in a run history is that automation, so naming it\n * again would answer nothing. A run written before its trigger was recorded\n * says so rather than guessing from the event's name.\n */\nexport function runTriggeredByLabel(entry: {\n triggeredBy?: RunTriggeredByLike | null\n}): string {\n const by = entry.triggeredBy\n switch (by?.kind) {\n case 'member':\n return by.email || (by.uid ? `Account ${by.uid}` : 'A member')\n case 'apiKey':\n if (by.connectedAppName) return connectedAppActorLabel(by.connectedAppName)\n return by.apiKeyName ? apiKeyActorLabel(by.apiKeyName) : 'API key'\n case 'visitor':\n return by.email ? `Site visitor (${by.email})` : 'Site visitor'\n case 'webhook':\n return by.name ? `Inbound webhook ${by.name}` : 'Inbound webhook'\n case 'platform':\n return PLATFORM_BRAND_NAME\n default:\n return 'Not recorded'\n }\n}\n\n/**\n * A deep link to the resource an entry points at, or `undefined` when it\n * cannot be built (missing context, or a type with nowhere sensible to go).\n * `buildRoute` emits `<orgSlug?>` placeholders for missing params, so every\n * branch guards its inputs and returns `undefined` rather than a dead link.\n */\nexport function activityHref(\n entry: ActivityEntryLike,\n ctx: ActivityLinkContext,\n): string | undefined {\n const { orgSlug, host } = ctx\n if (!orgSlug) return undefined\n const target = entry.target ?? undefined\n const type = target?.type ?? entry.type\n const id = target?.id ?? entry.targetId\n const versionId = target?.versionId\n\n // Host-scoped entries: every host route needs both orgSlug and host.\n if (host) {\n switch (type) {\n case 'host':\n return buildRoute(Route.HOST_DASHBOARD, { orgSlug, host })\n case 'screen':\n // The screen detail page is version-addressed; without a versionId\n // there is no \"current\" pointer to route through, so land on the list.\n return id && versionId\n ? buildRoute(Route.SCREEN_DETAILS, {\n orgSlug,\n host,\n screenId: id,\n versionId,\n })\n : buildRoute(Route.HOST_SCREENS, { orgSlug, host })\n case 'component':\n return id\n ? buildRoute(Route.COMPONENT_DETAILS, {\n orgSlug,\n host,\n componentId: id,\n })\n : buildRoute(Route.HOST_COMPONENTS, { orgSlug, host })\n case 'template':\n return id\n ? buildRoute(Route.TEMPLATE_DETAILS, {\n orgSlug,\n host,\n templateId: id,\n })\n : buildRoute(Route.HOST_TEMPLATES, { orgSlug, host })\n case 'layout':\n return id\n ? buildRoute(Route.LAYOUT_DETAILS, { orgSlug, host, layoutId: id })\n : buildRoute(Route.HOST_LAYOUTS, { orgSlug, host })\n case 'theme':\n return buildRoute(Route.HOST_SETUP_THEME, { orgSlug, host })\n case 'media':\n return buildRoute(Route.HOST_MEDIA, { orgSlug, host })\n case 'content':\n return buildRoute(Route.HOST_CONTENT, { orgSlug, host })\n case 'variable':\n return buildRoute(Route.HOST_DATA, { orgSlug, host })\n case 'function':\n return buildRoute(Route.HOST_LOGIC, { orgSlug, host })\n case 'workflow':\n return buildRoute(Route.HOST_AUTOMATION, { orgSlug, host })\n case 'member':\n // Site team is managed on the Setup page — there is no per-member\n // host route.\n return buildRoute(Route.HOST_SETUP, { orgSlug, host })\n default:\n // A plugin's record — a contact, a deal, an order — at the address\n // its owner publishes, which the route table does not hold.\n return pluginRecordActivityHref(type, id, { orgSlug, host })\n }\n }\n\n // Org-scoped entries.\n switch (type) {\n case 'org':\n return buildRoute(Route.ORG_SETTINGS, { orgSlug })\n case 'member':\n return id\n ? buildRoute(Route.MANAGE_TEAM_MEMBER, { orgSlug, uid: id })\n : buildRoute(Route.MANAGE_TEAM, { orgSlug })\n case 'invite':\n return buildRoute(Route.MANAGE_TEAM, { orgSlug })\n default:\n // A plugin's record acted on at the ORGANIZATION level (AGL-2634) — a\n // deal moved from the org board, a merge, a bulk bar's action — at the\n // organization address its owner publishes; a bulk line names no\n // record and lands on the list.\n return pluginRecordActivityHref(type, id, { orgSlug, host: null })\n }\n}\n\n/**\n * How an automation run ended (AGL-2171).\n *\n * `skipped` is a first-class outcome, not an absence. An unmet condition\n * used to be a bare `continue` that wrote nothing, so \"why didn't my\n * automation fire?\" — the most common support question about automations —\n * had no answer anywhere in the product, while `/product/workflows`\n * advertises an amber `Skipped` row that answers it.\n */\nexport type ActionRunResult = 'succeeded' | 'failed' | 'skipped'\n\n/** A stored run entry: an activity document with the run fields on it. */\nexport interface ActionRunEntryLike extends ActivityEntryLike {\n result?: string\n trigger?: string\n summary?: string\n}\n\n/**\n * `formSubmission` → `Form submitted`.\n *\n * The console rendered the raw camelCase identifier in the trigger select\n * and in every run row. The words are each event's declared label\n * (`host-events.ts`) — one map, so the picker an author chose from and the\n * run row they read afterwards cannot name the same event differently.\n */\nexport function actionTriggerLabel(event: string | undefined): string {\n return hostEventLabel(event)\n}\n\n/**\n * The run's outcome, tolerating rows written before it was recorded.\n *\n * A legacy entry carries only the prose `action` string, so it is read\n * back: `with errors:` means it failed and `Action ran on` means it\n * succeeded. Anything else is not a run at all — the activity collection\n * also holds publishes, media saves and member changes, and calling one of\n * those `succeeded` would put it in the run history under a verdict that\n * means nothing for it.\n */\nexport function actionRunResult(\n entry: ActionRunEntryLike,\n): ActionRunResult | undefined {\n const stored = String(entry.result ?? '').trim()\n if (stored === 'succeeded' || stored === 'failed' || stored === 'skipped') {\n return stored\n }\n const action = String(entry.action ?? '')\n if (!action.startsWith('Action ran on')) return undefined\n return action.includes('with errors:') ? 'failed' : 'succeeded'\n}\n\n/**\n * The `What happened` column: `Sent email · saved to Leads · webhook 200`.\n *\n * Falls back to the legacy prose, minus its `Action ran on <event>` prefix\n * — that fact is the Trigger column now, and repeating it in the summary\n * would make every historic row say the same thing twice.\n */\nexport function actionRunSummary(entry: ActionRunEntryLike): string {\n const summary = String(entry.summary ?? '').trim()\n if (summary) return summary\n const action = String(entry.action ?? '').trim()\n const errors = action.match(/with errors:\\s*(.+)$/)\n if (errors) return errors[1]\n // A pre-AGL-2171 success recorded nothing but the fact that it ran.\n if (action.startsWith('Action ran on')) return 'Ran'\n return action\n}\n"],"names":["Route","buildRoute","pluginRecordHref","pluginRecordListHref","PLATFORM_BRAND_NAME","hostEventLabel","duplicateActivityActionLabel","pluginActivityActionLabel","pluginActivityGroupForAction","pluginActivityTargetLabel","pluginActivityTargetNoun","ACTIVITY_TYPE_LABELS","TYPE_LABELS","pluginRecordActivityHref","type","id","context","undefined","activityTypeLabel","known","noun","charAt","toUpperCase","slice","activityTargetLabel","target","name","activityActionLabel","action","stored","trim","activityEntryGroupId","entry","activityPrimaryText","apiKeyActorLabel","connectedAppActorLabel","activityActorLabel","actorEmail","connectedAppName","apiKeyName","actorId","startsWith","actorEmailNow","staffActorEmail","runTriggeredByLabel","by","triggeredBy","kind","email","uid","activityHref","ctx","orgSlug","host","targetId","versionId","HOST_DASHBOARD","SCREEN_DETAILS","screenId","HOST_SCREENS","COMPONENT_DETAILS","componentId","HOST_COMPONENTS","TEMPLATE_DETAILS","templateId","HOST_TEMPLATES","LAYOUT_DETAILS","layoutId","HOST_LAYOUTS","HOST_SETUP_THEME","HOST_MEDIA","HOST_CONTENT","HOST_DATA","HOST_LOGIC","HOST_AUTOMATION","HOST_SETUP","ORG_SETTINGS","MANAGE_TEAM_MEMBER","MANAGE_TEAM","actionTriggerLabel","event","actionRunResult","String","result","includes","actionRunSummary","summary","errors","match"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,mEAAmE;AACnE,2EAA2E;AAC3E,6EAA6E;AAC7E,0EAA0E;AAC1E,2EAA2E;AAC3E,6EAA6E;AAC7E,yEAAyE;AACzE,2EAA2E;AAC3E,yEAAyE;AACzE,6DAA6D;AAE7D,SAASA,KAAK,EAAEC,UAAU,QAAQ,sBAAkB;AACpD,SACEC,gBAAgB,EAChBC,oBAAoB,QAEf,4CAAwC;AAC/C,SAASC,mBAAmB,QAAQ,sBAAkB;AACtD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AAOwD,QAAQ,CAAC,kBAAkB,WAAW;AACtD;AAEA;;;;;;CAMC,GACD,OAAO,SAASC,iBAAiBrD,KAAyB;QACjCA,gBAEDA;IAFtB,MAAMsD,UAAUJ,QAAOlD,iBAAAA,MAAMsD,OAAO,YAAbtD,iBAAiB,IAAIF,IAAI;IAChD,IAAIwD,SAAS,OAAOA;IACpB,MAAM1D,SAASsD,QAAOlD,gBAAAA,MAAMJ,MAAM,YAAZI,gBAAgB,IAAIF,IAAI;IAC9C,MAAMyD,SAAS3D,OAAO4D,KAAK,CAAC;IAC5B,IAAID,QAAQ,OAAOA,MAAM,CAAC,EAAE;IAC5B,oEAAoE;IACpE,IAAI3D,OAAOa,UAAU,CAAC,kBAAkB,OAAO;IAC/C,OAAOb;AACT"}
@@ -20,6 +20,7 @@ export declare const ACTIVITY_SEARCH_TOKENS_PATH = "searchTokens";
20
20
  export interface ActivitySearchSource {
21
21
  actorEmail?: unknown;
22
22
  apiKeyName?: unknown;
23
+ connectedAppName?: unknown;
23
24
  /** The entry's target as stored — only its `name` is read. */
24
25
  target?: {
25
26
  name?: unknown;
@@ -77,6 +77,7 @@ const text = (value)=>typeof value === 'string' ? value.trim() : '';
77
77
  const words = [
78
78
  ...addressSearchWords(entry.actorEmail),
79
79
  text(entry.apiKeyName),
80
+ text(entry.connectedAppName),
80
81
  text((_entry_target = entry.target) == null ? void 0 : _entry_target.name)
81
82
  ].filter(Boolean);
82
83
  return nameSearchTokens(words.join(' '));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/activity-search.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 { nameSearchTokens } from './name-search'\n\n/*\n * WHAT AN ACTIVITY LOG'S SEARCH BOX FINDS (AGL-3321).\n *\n * Every activity log — a site's (`hosts/{hostId}/activity`), an\n * organization's (`orgs/{orgId}/activity`), and the person-centred feeds read\n * across both — searches the same written token array, so the box promises\n * the same thing wherever it appears: a word typed there finds an entry when\n * it is the START of\n *\n * - the address the actor had when the entry was written, of its local\n * part or its domain, or of any run of letters and digits in it —\n * `ada`, `lovelace`, `ada.lovelace@`, `example.com`, `example` all find\n * `ada.lovelace@example.com`;\n * - a word of the API key's name, for an entry an integration wrote;\n * - a word of the name of what changed (`target.name`) — the screen, the\n * member, the workflow.\n *\n * Not the action sentence: it is prose written by forty call sites, some of\n * it three hundred characters of run errors, and every word of it would be\n * an index entry. Action is a Filters field instead.\n *\n * The array is `nameSearchTokens` over those words — the same normalizer the\n * query plan asks with (`nameSearchNormalizers`), so a typed word and a\n * stored token cannot disagree about case, whitespace or prefix length.\n *\n * ⚠️ Every writer stamps it, through `activitySearchTokens`: the site logger\n * in the browser, the two server loggers, the workflow engine's run rows, the\n * inbound-webhook runner, the site importer and the reconstruction backfill.\n * A writer that forgets writes an entry the log still LISTS and that no\n * search can find. The scripts that write or backfill entries use its\n * script-side twin, `tools/scripts/lib/activity-search-tokens.mjs`, held to\n * the same worked examples (`activity-search-tokens.fixtures.json` beside\n * it), which this library's spec asserts too.\n */\n\n/** The written field every activity search reads. */\nexport const ACTIVITY_SEARCH_TOKENS_PATH = 'searchTokens'\n\n/** What an entry's search tokens are derived from; every field may be absent. */\nexport interface ActivitySearchSource {\n actorEmail?: unknown\n apiKeyName?: unknown\n /** The entry's target as stored — only its `name` is read. */\n target?: { name?: unknown } | null\n}\n\nconst text = (value: unknown): string =>\n typeof value === 'string' ? value.trim() : ''\n\n/**\n * An address as the words a reader might start typing it by: the whole\n * address, its local part, its domain, and each run of letters and digits.\n * Shared by every search that finds a record by an address — the activity\n * logs' actor, and a site account's own address (the Site users list).\n */\nexport function addressSearchWords(address: unknown): string[] {\n const whole = text(address).toLowerCase()\n if (!whole) return []\n const at = whole.lastIndexOf('@')\n const halves = at > 0 ? [whole.slice(0, at), whole.slice(at + 1)] : []\n const runs = whole.split(/[^\\p{L}\\p{N}]+/u).filter(Boolean)\n return [whole, ...halves, ...runs].filter(Boolean)\n}\n\n/**\n * The search tokens one activity entry carries. Stamped by every writer as\n * `searchTokens`; see the note at the top of this file for what it promises.\n */\nexport function activitySearchTokens(entry: ActivitySearchSource): string[] {\n const words = [\n ...addressSearchWords(entry.actorEmail),\n text(entry.apiKeyName),\n text(entry.target?.name),\n ].filter(Boolean)\n return nameSearchTokens(words.join(' '))\n}\n"],"names":["nameSearchTokens","ACTIVITY_SEARCH_TOKENS_PATH","text","value","trim","addressSearchWords","address","whole","toLowerCase","at","lastIndexOf","halves","slice","runs","split","filter","Boolean","activitySearchTokens","entry","words","actorEmail","apiKeyName","target","name","join"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,gBAAgB,QAAQ,mBAAe;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCC,GAED,mDAAmD,GACnD,OAAO,MAAMC,8BAA8B,eAAc;AAUzD,MAAMC,OAAO,CAACC,QACZ,OAAOA,UAAU,WAAWA,MAAMC,IAAI,KAAK;AAE7C;;;;;CAKC,GACD,OAAO,SAASC,mBAAmBC,OAAgB;IACjD,MAAMC,QAAQL,KAAKI,SAASE,WAAW;IACvC,IAAI,CAACD,OAAO,OAAO,EAAE;IACrB,MAAME,KAAKF,MAAMG,WAAW,CAAC;IAC7B,MAAMC,SAASF,KAAK,IAAI;QAACF,MAAMK,KAAK,CAAC,GAAGH;QAAKF,MAAMK,KAAK,CAACH,KAAK;KAAG,GAAG,EAAE;IACtE,MAAMI,OAAON,MAAMO,KAAK,CAAC,8maAAmBC,MAAM,CAACC;IACnD,OAAO;QAACT;WAAUI;WAAWE;KAAK,CAACE,MAAM,CAACC;AAC5C;AAEA;;;CAGC,GACD,OAAO,SAASC,qBAAqBC,KAA2B;QAIvDA;IAHP,MAAMC,QAAQ;WACTd,mBAAmBa,MAAME,UAAU;QACtClB,KAAKgB,MAAMG,UAAU;QACrBnB,MAAKgB,gBAAAA,MAAMI,MAAM,qBAAZJ,cAAcK,IAAI;KACxB,CAACR,MAAM,CAACC;IACT,OAAOhB,iBAAiBmB,MAAMK,IAAI,CAAC;AACrC"}
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/activity-search.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 { nameSearchTokens } from './name-search'\n\n/*\n * WHAT AN ACTIVITY LOG'S SEARCH BOX FINDS (AGL-3321).\n *\n * Every activity log — a site's (`hosts/{hostId}/activity`), an\n * organization's (`orgs/{orgId}/activity`), and the person-centred feeds read\n * across both — searches the same written token array, so the box promises\n * the same thing wherever it appears: a word typed there finds an entry when\n * it is the START of\n *\n * - the address the actor had when the entry was written, of its local\n * part or its domain, or of any run of letters and digits in it —\n * `ada`, `lovelace`, `ada.lovelace@`, `example.com`, `example` all find\n * `ada.lovelace@example.com`;\n * - a word of the API key's name, for an entry an integration wrote;\n * - a word of the name of what changed (`target.name`) — the screen, the\n * member, the workflow.\n *\n * Not the action sentence: it is prose written by forty call sites, some of\n * it three hundred characters of run errors, and every word of it would be\n * an index entry. Action is a Filters field instead.\n *\n * The array is `nameSearchTokens` over those words — the same normalizer the\n * query plan asks with (`nameSearchNormalizers`), so a typed word and a\n * stored token cannot disagree about case, whitespace or prefix length.\n *\n * ⚠️ Every writer stamps it, through `activitySearchTokens`: the site logger\n * in the browser, the two server loggers, the workflow engine's run rows, the\n * inbound-webhook runner, the site importer and the reconstruction backfill.\n * A writer that forgets writes an entry the log still LISTS and that no\n * search can find. The scripts that write or backfill entries use its\n * script-side twin, `tools/scripts/lib/activity-search-tokens.mjs`, held to\n * the same worked examples (`activity-search-tokens.fixtures.json` beside\n * it), which this library's spec asserts too.\n */\n\n/** The written field every activity search reads. */\nexport const ACTIVITY_SEARCH_TOKENS_PATH = 'searchTokens'\n\n/** What an entry's search tokens are derived from; every field may be absent. */\nexport interface ActivitySearchSource {\n actorEmail?: unknown\n apiKeyName?: unknown\n connectedAppName?: unknown\n /** The entry's target as stored — only its `name` is read. */\n target?: { name?: unknown } | null\n}\n\nconst text = (value: unknown): string =>\n typeof value === 'string' ? value.trim() : ''\n\n/**\n * An address as the words a reader might start typing it by: the whole\n * address, its local part, its domain, and each run of letters and digits.\n * Shared by every search that finds a record by an address — the activity\n * logs' actor, and a site account's own address (the Site users list).\n */\nexport function addressSearchWords(address: unknown): string[] {\n const whole = text(address).toLowerCase()\n if (!whole) return []\n const at = whole.lastIndexOf('@')\n const halves = at > 0 ? [whole.slice(0, at), whole.slice(at + 1)] : []\n const runs = whole.split(/[^\\p{L}\\p{N}]+/u).filter(Boolean)\n return [whole, ...halves, ...runs].filter(Boolean)\n}\n\n/**\n * The search tokens one activity entry carries. Stamped by every writer as\n * `searchTokens`; see the note at the top of this file for what it promises.\n */\nexport function activitySearchTokens(entry: ActivitySearchSource): string[] {\n const words = [\n ...addressSearchWords(entry.actorEmail),\n text(entry.apiKeyName),\n text(entry.connectedAppName),\n text(entry.target?.name),\n ].filter(Boolean)\n return nameSearchTokens(words.join(' '))\n}\n"],"names":["nameSearchTokens","ACTIVITY_SEARCH_TOKENS_PATH","text","value","trim","addressSearchWords","address","whole","toLowerCase","at","lastIndexOf","halves","slice","runs","split","filter","Boolean","activitySearchTokens","entry","words","actorEmail","apiKeyName","connectedAppName","target","name","join"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,gBAAgB,QAAQ,mBAAe;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCC,GAED,mDAAmD,GACnD,OAAO,MAAMC,8BAA8B,eAAc;AAWzD,MAAMC,OAAO,CAACC,QACZ,OAAOA,UAAU,WAAWA,MAAMC,IAAI,KAAK;AAE7C;;;;;CAKC,GACD,OAAO,SAASC,mBAAmBC,OAAgB;IACjD,MAAMC,QAAQL,KAAKI,SAASE,WAAW;IACvC,IAAI,CAACD,OAAO,OAAO,EAAE;IACrB,MAAME,KAAKF,MAAMG,WAAW,CAAC;IAC7B,MAAMC,SAASF,KAAK,IAAI;QAACF,MAAMK,KAAK,CAAC,GAAGH;QAAKF,MAAMK,KAAK,CAACH,KAAK;KAAG,GAAG,EAAE;IACtE,MAAMI,OAAON,MAAMO,KAAK,CAAC,8maAAmBC,MAAM,CAACC;IACnD,OAAO;QAACT;WAAUI;WAAWE;KAAK,CAACE,MAAM,CAACC;AAC5C;AAEA;;;CAGC,GACD,OAAO,SAASC,qBAAqBC,KAA2B;QAKvDA;IAJP,MAAMC,QAAQ;WACTd,mBAAmBa,MAAME,UAAU;QACtClB,KAAKgB,MAAMG,UAAU;QACrBnB,KAAKgB,MAAMI,gBAAgB;QAC3BpB,MAAKgB,gBAAAA,MAAMK,MAAM,qBAAZL,cAAcM,IAAI;KACxB,CAACT,MAAM,CAACC;IACT,OAAOhB,iBAAiBmB,MAAMM,IAAI,CAAC;AACrC"}
@@ -38,6 +38,24 @@ export interface CatalogApi {
38
38
  title: string;
39
39
  /** Machine-readable description: OpenAPI, published as `service-desc`. */
40
40
  specUrl?: string;
41
+ /**
42
+ * Media type of {@link specUrl}. Defaults to JSON, which is what an OpenAPI
43
+ * document is served as; an MCP Server Card has a type of its own
44
+ * (`application/mcp-server-card+json`) and says so.
45
+ */
46
+ specType?: string;
47
+ /**
48
+ * Further machine-readable metadata about the API, published as
49
+ * `service-meta` (RFC 8631 §4.3, one of the four relations RFC 9727
50
+ * Appendix A.1 names). For the MCP server: its OAuth protected-resource document
51
+ * (RFC 9728) and its authorization server's document (RFC 8414) — how a
52
+ * client signs in. No registered relation is specific to either, and
53
+ * `service-meta` is the general one RFC 9727 provides for exactly this.
54
+ */
55
+ metaLinks?: readonly {
56
+ href: string;
57
+ type: string;
58
+ }[];
41
59
  /** Human documentation, published as `service-doc`. */
42
60
  docsUrl?: string;
43
61
  /**
@@ -71,10 +71,11 @@
71
71
  anchor: api.url
72
72
  };
73
73
  if (api.specUrl) {
74
+ var _api_specType;
74
75
  context['service-desc'] = [
75
76
  {
76
77
  href: api.specUrl,
77
- type: 'application/json'
78
+ type: (_api_specType = api.specType) != null ? _api_specType : 'application/json'
78
79
  }
79
80
  ];
80
81
  }
@@ -87,6 +88,12 @@
87
88
  }
88
89
  ];
89
90
  }
91
+ if (api.metaLinks && api.metaLinks.length > 0) {
92
+ context['service-meta'] = api.metaLinks.map((link)=>({
93
+ href: link.href,
94
+ type: link.type
95
+ }));
96
+ }
90
97
  if (api.statusUrl) {
91
98
  context['status'] = [
92
99
  {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/agent-api-catalog.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\ntype Schema = Record<string, unknown>\n\n/** The well-known location RFC 9727 reserves for an API catalog. */\nexport const API_CATALOG_PATH = '/.well-known/api-catalog'\n\n/**\n * The linkset media type RFC 9727 REQUIRES the catalog to support.\n *\n * Not `application/json`. RFC 9727 §3 says a catalog \"MUST support the Linkset\n * [RFC9264] format of application/linkset+json\", and a client that content-\n * negotiates for it is entitled to get it. The `+json` structured suffix means\n * anything that parses JSON still parses this.\n */\nexport const API_CATALOG_MEDIA_TYPE = 'application/linkset+json'\n\n/** One API in the catalog. */\nexport interface CatalogApi {\n /**\n * The API's root URI. This is the linkset `anchor` — the context every one\n * of its links hangs from — so it identifies the API rather than locating a\n * document about it.\n */\n url: string\n /** Human label, carried as the `title` target attribute on the listing. */\n title: string\n /** Machine-readable description: OpenAPI, published as `service-desc`. */\n specUrl?: string\n /** Human documentation, published as `service-doc`. */\n docsUrl?: string\n /**\n * Media type of {@link docsUrl}. Defaults to HTML because that is what a\n * documentation site serves — but a tenant's own documentation is\n * `/llms.txt`, which is Markdown, and declaring it HTML in a document whose\n * entire purpose is machine-readability would be a lie a client acts on.\n */\n docsType?: string\n /** Health endpoint, published as `status`. */\n statusUrl?: string\n}\n\nexport interface AgentApiCatalogOptions {\n /** The site's public origin, no trailing slash. */\n origin: string\n /** The APIs to advertise, in the order a reader should meet them. */\n apis: readonly CatalogApi[]\n}\n\n/**\n * The site's API catalog (RFC 9727), as an RFC 9264 linkset.\n *\n * ## What this is for\n *\n * A tenant's `/openapi.json` describes the SITE: its pages as Markdown, its\n * sitemap, its feeds, and the handful of JSON reads that serve them. That is an\n * honest description of a website, and it is not the typed REST API. The typed\n * API is the platform's, it lives on another origin, and until this document\n * existed nothing on a customer's site pointed at it — an agent standing on\n * `acme.com` had no way to learn that a full CRUD API describes the same data.\n *\n * A catalog is the published answer to exactly that question, which is why this\n * follows RFC 9727 rather than inventing a `/apis.json`: an agent that knows\n * the standard finds this without being told, and one that does not can still\n * read it, because a linkset is plain JSON.\n *\n * ## The shape, and why entries are separate objects\n *\n * A linkset is a list of link CONTEXTS, each keyed by its `anchor`. The first\n * context is anchored at the catalog itself and carries the `item` links — the\n * membership list, \"these are my APIs\". Every context after it is anchored at\n * one API's own root and carries that API's `service-desc`, `service-doc` and\n * `status`. Folding the metadata into the `item` entries would say something\n * different and weaker: that the CATALOG has a description, rather than that\n * each API does.\n *\n * ## Absent members are omitted, never emitted empty\n *\n * An operator running this platform themselves configures their own console\n * and docs origins, and may have neither. A `service-doc` pointing at an empty\n * string is a link an agent will follow and a 404 it will attribute to us, so\n * an API with nothing but an anchor contributes no context object at all.\n */\nexport function buildAgentApiCatalog(options: AgentApiCatalogOptions): Schema {\n const origin = options.origin.replace(/\\/+$/, '')\n const linkset: Schema[] = [\n {\n anchor: `${origin}${API_CATALOG_PATH}`,\n item: options.apis.map((api) => ({ href: api.url, title: api.title })),\n },\n ]\n\n for (const api of options.apis) {\n const context: Schema = { anchor: api.url }\n if (api.specUrl) {\n context['service-desc'] = [\n { href: api.specUrl, type: 'application/json' },\n ]\n }\n if (api.docsUrl) {\n context['service-doc'] = [\n { href: api.docsUrl, type: api.docsType ?? 'text/html' },\n ]\n }\n if (api.statusUrl) {\n context['status'] = [{ href: api.statusUrl, type: 'application/json' }]\n }\n // An anchor and nothing else describes nothing. See the note above.\n if (Object.keys(context).length > 1) linkset.push(context)\n }\n\n return { linkset }\n}\n"],"names":["API_CATALOG_PATH","API_CATALOG_MEDIA_TYPE","buildAgentApiCatalog","options","origin","replace","linkset","anchor","item","apis","map","api","href","url","title","context","specUrl","type","docsUrl","docsType","statusUrl","Object","keys","length","push"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAID,kEAAkE,GAClE,OAAO,MAAMA,mBAAmB,2BAA0B;AAE1D;;;;;;;CAOC,GACD,OAAO,MAAMC,yBAAyB,2BAA0B;AAkChE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCC,GACD,OAAO,SAASC,qBAAqBC,OAA+B;IAClE,MAAMC,SAASD,QAAQC,MAAM,CAACC,OAAO,CAAC,QAAQ;IAC9C,MAAMC,UAAoB;QACxB;YACEC,QAAQ,GAAGH,SAASJ,kBAAkB;YACtCQ,MAAML,QAAQM,IAAI,CAACC,GAAG,CAAC,CAACC,MAAS,CAAA;oBAAEC,MAAMD,IAAIE,GAAG;oBAAEC,OAAOH,IAAIG,KAAK;gBAAC,CAAA;QACrE;KACD;IAED,KAAK,MAAMH,OAAOR,QAAQM,IAAI,CAAE;QAC9B,MAAMM,UAAkB;YAAER,QAAQI,IAAIE,GAAG;QAAC;QAC1C,IAAIF,IAAIK,OAAO,EAAE;YACfD,OAAO,CAAC,eAAe,GAAG;gBACxB;oBAAEH,MAAMD,IAAIK,OAAO;oBAAEC,MAAM;gBAAmB;aAC/C;QACH;QACA,IAAIN,IAAIO,OAAO,EAAE;gBAEcP;YAD7BI,OAAO,CAAC,cAAc,GAAG;gBACvB;oBAAEH,MAAMD,IAAIO,OAAO;oBAAED,IAAI,GAAEN,gBAAAA,IAAIQ,QAAQ,YAAZR,gBAAgB;gBAAY;aACxD;QACH;QACA,IAAIA,IAAIS,SAAS,EAAE;YACjBL,OAAO,CAAC,SAAS,GAAG;gBAAC;oBAAEH,MAAMD,IAAIS,SAAS;oBAAEH,MAAM;gBAAmB;aAAE;QACzE;QACA,oEAAoE;QACpE,IAAII,OAAOC,IAAI,CAACP,SAASQ,MAAM,GAAG,GAAGjB,QAAQkB,IAAI,CAACT;IACpD;IAEA,OAAO;QAAET;IAAQ;AACnB"}
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/agent-api-catalog.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\ntype Schema = Record<string, unknown>\n\n/** The well-known location RFC 9727 reserves for an API catalog. */\nexport const API_CATALOG_PATH = '/.well-known/api-catalog'\n\n/**\n * The linkset media type RFC 9727 REQUIRES the catalog to support.\n *\n * Not `application/json`. RFC 9727 §3 says a catalog \"MUST support the Linkset\n * [RFC9264] format of application/linkset+json\", and a client that content-\n * negotiates for it is entitled to get it. The `+json` structured suffix means\n * anything that parses JSON still parses this.\n */\nexport const API_CATALOG_MEDIA_TYPE = 'application/linkset+json'\n\n/** One API in the catalog. */\nexport interface CatalogApi {\n /**\n * The API's root URI. This is the linkset `anchor` — the context every one\n * of its links hangs from — so it identifies the API rather than locating a\n * document about it.\n */\n url: string\n /** Human label, carried as the `title` target attribute on the listing. */\n title: string\n /** Machine-readable description: OpenAPI, published as `service-desc`. */\n specUrl?: string\n /**\n * Media type of {@link specUrl}. Defaults to JSON, which is what an OpenAPI\n * document is served as; an MCP Server Card has a type of its own\n * (`application/mcp-server-card+json`) and says so.\n */\n specType?: string\n /**\n * Further machine-readable metadata about the API, published as\n * `service-meta` (RFC 8631 §4.3, one of the four relations RFC 9727\n * Appendix A.1 names). For the MCP server: its OAuth protected-resource document\n * (RFC 9728) and its authorization server's document (RFC 8414) — how a\n * client signs in. No registered relation is specific to either, and\n * `service-meta` is the general one RFC 9727 provides for exactly this.\n */\n metaLinks?: readonly { href: string; type: string }[]\n /** Human documentation, published as `service-doc`. */\n docsUrl?: string\n /**\n * Media type of {@link docsUrl}. Defaults to HTML because that is what a\n * documentation site serves — but a tenant's own documentation is\n * `/llms.txt`, which is Markdown, and declaring it HTML in a document whose\n * entire purpose is machine-readability would be a lie a client acts on.\n */\n docsType?: string\n /** Health endpoint, published as `status`. */\n statusUrl?: string\n}\n\nexport interface AgentApiCatalogOptions {\n /** The site's public origin, no trailing slash. */\n origin: string\n /** The APIs to advertise, in the order a reader should meet them. */\n apis: readonly CatalogApi[]\n}\n\n/**\n * The site's API catalog (RFC 9727), as an RFC 9264 linkset.\n *\n * ## What this is for\n *\n * A tenant's `/openapi.json` describes the SITE: its pages as Markdown, its\n * sitemap, its feeds, and the handful of JSON reads that serve them. That is an\n * honest description of a website, and it is not the typed REST API. The typed\n * API is the platform's, it lives on another origin, and until this document\n * existed nothing on a customer's site pointed at it — an agent standing on\n * `acme.com` had no way to learn that a full CRUD API describes the same data.\n *\n * A catalog is the published answer to exactly that question, which is why this\n * follows RFC 9727 rather than inventing a `/apis.json`: an agent that knows\n * the standard finds this without being told, and one that does not can still\n * read it, because a linkset is plain JSON.\n *\n * ## The shape, and why entries are separate objects\n *\n * A linkset is a list of link CONTEXTS, each keyed by its `anchor`. The first\n * context is anchored at the catalog itself and carries the `item` links — the\n * membership list, \"these are my APIs\". Every context after it is anchored at\n * one API's own root and carries that API's `service-desc`, `service-doc` and\n * `status`. Folding the metadata into the `item` entries would say something\n * different and weaker: that the CATALOG has a description, rather than that\n * each API does.\n *\n * ## Absent members are omitted, never emitted empty\n *\n * An operator running this platform themselves configures their own console\n * and docs origins, and may have neither. A `service-doc` pointing at an empty\n * string is a link an agent will follow and a 404 it will attribute to us, so\n * an API with nothing but an anchor contributes no context object at all.\n */\nexport function buildAgentApiCatalog(options: AgentApiCatalogOptions): Schema {\n const origin = options.origin.replace(/\\/+$/, '')\n const linkset: Schema[] = [\n {\n anchor: `${origin}${API_CATALOG_PATH}`,\n item: options.apis.map((api) => ({ href: api.url, title: api.title })),\n },\n ]\n\n for (const api of options.apis) {\n const context: Schema = { anchor: api.url }\n if (api.specUrl) {\n context['service-desc'] = [\n { href: api.specUrl, type: api.specType ?? 'application/json' },\n ]\n }\n if (api.docsUrl) {\n context['service-doc'] = [\n { href: api.docsUrl, type: api.docsType ?? 'text/html' },\n ]\n }\n if (api.metaLinks && api.metaLinks.length > 0) {\n context['service-meta'] = api.metaLinks.map((link) => ({\n href: link.href,\n type: link.type,\n }))\n }\n if (api.statusUrl) {\n context['status'] = [{ href: api.statusUrl, type: 'application/json' }]\n }\n // An anchor and nothing else describes nothing. See the note above.\n if (Object.keys(context).length > 1) linkset.push(context)\n }\n\n return { linkset }\n}\n"],"names":["API_CATALOG_PATH","API_CATALOG_MEDIA_TYPE","buildAgentApiCatalog","options","origin","replace","linkset","anchor","item","apis","map","api","href","url","title","context","specUrl","type","specType","docsUrl","docsType","metaLinks","length","link","statusUrl","Object","keys","push"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAID,kEAAkE,GAClE,OAAO,MAAMA,mBAAmB,2BAA0B;AAE1D;;;;;;;CAOC,GACD,OAAO,MAAMC,yBAAyB,2BAA0B;AAiDhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCC,GACD,OAAO,SAASC,qBAAqBC,OAA+B;IAClE,MAAMC,SAASD,QAAQC,MAAM,CAACC,OAAO,CAAC,QAAQ;IAC9C,MAAMC,UAAoB;QACxB;YACEC,QAAQ,GAAGH,SAASJ,kBAAkB;YACtCQ,MAAML,QAAQM,IAAI,CAACC,GAAG,CAAC,CAACC,MAAS,CAAA;oBAAEC,MAAMD,IAAIE,GAAG;oBAAEC,OAAOH,IAAIG,KAAK;gBAAC,CAAA;QACrE;KACD;IAED,KAAK,MAAMH,OAAOR,QAAQM,IAAI,CAAE;QAC9B,MAAMM,UAAkB;YAAER,QAAQI,IAAIE,GAAG;QAAC;QAC1C,IAAIF,IAAIK,OAAO,EAAE;gBAEcL;YAD7BI,OAAO,CAAC,eAAe,GAAG;gBACxB;oBAAEH,MAAMD,IAAIK,OAAO;oBAAEC,IAAI,GAAEN,gBAAAA,IAAIO,QAAQ,YAAZP,gBAAgB;gBAAmB;aAC/D;QACH;QACA,IAAIA,IAAIQ,OAAO,EAAE;gBAEcR;YAD7BI,OAAO,CAAC,cAAc,GAAG;gBACvB;oBAAEH,MAAMD,IAAIQ,OAAO;oBAAEF,IAAI,GAAEN,gBAAAA,IAAIS,QAAQ,YAAZT,gBAAgB;gBAAY;aACxD;QACH;QACA,IAAIA,IAAIU,SAAS,IAAIV,IAAIU,SAAS,CAACC,MAAM,GAAG,GAAG;YAC7CP,OAAO,CAAC,eAAe,GAAGJ,IAAIU,SAAS,CAACX,GAAG,CAAC,CAACa,OAAU,CAAA;oBACrDX,MAAMW,KAAKX,IAAI;oBACfK,MAAMM,KAAKN,IAAI;gBACjB,CAAA;QACF;QACA,IAAIN,IAAIa,SAAS,EAAE;YACjBT,OAAO,CAAC,SAAS,GAAG;gBAAC;oBAAEH,MAAMD,IAAIa,SAAS;oBAAEP,MAAM;gBAAmB;aAAE;QACzE;QACA,oEAAoE;QACpE,IAAIQ,OAAOC,IAAI,CAACX,SAASO,MAAM,GAAG,GAAGhB,QAAQqB,IAAI,CAACZ;IACpD;IAEA,OAAO;QAAET;IAAQ;AACnB"}
@@ -72,3 +72,18 @@ export declare const AUTHOR_TOKEN_CATALOG: readonly BindingTokenCatalogEntry[];
72
72
  * only, so renaming a field never breaks a binding (AGL-578).
73
73
  */
74
74
  export declare function repeatItemToken(fieldId: string, targetFieldId?: string): string;
75
+ /**
76
+ * The record field type that holds an icon (AGL-4190): `{ iconId, iconPath }`,
77
+ * the shape a reusable component's Icon property holds. Named here, in core,
78
+ * because the plugin that keeps the records declares it and the Besigner's
79
+ * Icon picker binds to it, and neither may import the other. Persisted on
80
+ * field definitions — never rename.
81
+ */
82
+ export declare const RECORD_ICON_FIELD_TYPE = "icon";
83
+ /** The part of a record's icon that is its SVG path (AGL-4190). */
84
+ export declare const RECORD_ICON_PATH_PART = "iconPath";
85
+ /**
86
+ * The field id of a token that is nothing but one record field, `{{item.x}}`,
87
+ * or `null` for anything else (a hop, words around it, another kind of token).
88
+ */
89
+ export declare function matchWholeItemToken(value: unknown): string | null;
@@ -277,5 +277,21 @@
277
277
  */ export function repeatItemToken(fieldId, targetFieldId) {
278
278
  return targetFieldId ? `{{item.${fieldId}.${targetFieldId}}}` : `{{item.${fieldId}}}`;
279
279
  }
280
+ /**
281
+ * The record field type that holds an icon (AGL-4190): `{ iconId, iconPath }`,
282
+ * the shape a reusable component's Icon property holds. Named here, in core,
283
+ * because the plugin that keeps the records declares it and the Besigner's
284
+ * Icon picker binds to it, and neither may import the other. Persisted on
285
+ * field definitions — never rename.
286
+ */ export const RECORD_ICON_FIELD_TYPE = 'icon';
287
+ /** The part of a record's icon that is its SVG path (AGL-4190). */ export const RECORD_ICON_PATH_PART = 'iconPath';
288
+ /**
289
+ * The field id of a token that is nothing but one record field, `{{item.x}}`,
290
+ * or `null` for anything else (a hop, words around it, another kind of token).
291
+ */ export function matchWholeItemToken(value) {
292
+ if (typeof value !== 'string') return null;
293
+ const match = /^\s*\{\{\s*item\.([A-Za-z][A-Za-z0-9_]*)\s*\}\}\s*$/.exec(value);
294
+ return match ? match[1] : null;
295
+ }
280
296
 
281
297
  //# sourceMappingURL=binding-token-catalog.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/binding-token-catalog.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 * Browsable data-placeholder catalogs for the designer's insert picker\n * (AGL-583). Hand-typing `{{entry.title}}` stays the advanced path; these\n * catalogs give every token a friendly label + description so editors can\n * browse and insert instead of memorizing the grammar.\n *\n * The token STRINGS are owned elsewhere — `collectionEntryTokens`\n * (collection-entries.ts) and the tenant compose pipeline resolve them —\n * this module only names them for pickers. The spec cross-checks the entry\n * catalog against the resolver so the two can never drift.\n */\nexport interface BindingTokenCatalogEntry {\n /** The literal token inserted into the prop, e.g. `{{entry.title}}`. */\n token: string\n /** Friendly picker label, e.g. `Title`. */\n label: string\n /** One-line description shown as the option's secondary text. */\n description?: string\n}\n\n/**\n * `{{entry.*}}` tokens (AGL-105/551/582) — resolve per entry inside a\n * Collection entries block and page-wide on entry-template screens.\n * Mirrors {@link collectionEntryTokens}; the spec enforces the mirror.\n */\nexport const ENTRY_TOKEN_CATALOG: readonly BindingTokenCatalogEntry[] = [\n { token: '{{entry.title}}', label: 'Title', description: 'The entry headline.' },\n {\n token: '{{entry.excerpt}}',\n label: 'Excerpt',\n description: 'Short summary text.',\n },\n {\n token: '{{entry.body}}',\n label: 'Body',\n description: 'The full entry body.',\n },\n {\n token: '{{entry.url}}',\n label: 'Link URL',\n description: 'Auto-route to the entry page.',\n },\n {\n token: '{{entry.date}}',\n label: 'Published date',\n description: 'Formatted publish date.',\n },\n /*\n Beside the readable date on purpose: a designer reaching for \"the date\" in\n a Video element's Publication date field has to see that the readable one\n is the wrong pick there, and why.\n */\n {\n token: '{{entry.publishedAt}}',\n label: 'Publish timestamp',\n description:\n 'The publish date and time in ISO 8601, for a field that needs a ' +\n 'machine-readable date, such as a Video element’s publication date.',\n },\n {\n token: '{{entry.author}}',\n label: 'Author',\n description: 'The byline set on the entry.',\n },\n {\n token: '{{entry.authorBio}}',\n label: 'Author bio',\n description: 'Blurb from the author’s record.',\n },\n {\n token: '{{entry.authorImage}}',\n label: 'Author portrait',\n description: 'Portrait or logo from the author’s record.',\n },\n {\n token: '{{entry.authorUrl}}',\n label: 'Author link',\n description: 'The author’s own page.',\n },\n {\n token: '{{entry.authorPageUrl}}',\n label: 'Author page',\n description:\n 'This author’s page on this site — everything they wrote, across every ' +\n 'collection. Separate from Author link, which is their own site.',\n },\n {\n token: '{{entry.slug}}',\n label: 'Slug',\n description: 'URL-safe entry identifier.',\n },\n /*\n Named \"Its collection…\" rather than \"Collection…\", which is what these\n describe and also exactly what the `{{collection.*}}` entries below are\n called. The picker groups options by heading, so the two sets sit apart —\n but a designer scanning it reads the LABEL, and two options reading\n \"Collection name\" three lines apart is a choice made by guessing. The\n pronoun is doing real work: on the one page where both resolve, they mean\n different collections.\n */\n {\n token: '{{entry.collection}}',\n label: 'Its collection',\n description:\n 'Which section this entry belongs to. Worth binding on a listing that ' +\n 'MIXES collections — an author page — where a card otherwise cannot ' +\n 'tell a release note from an essay.',\n },\n {\n token: '{{entry.collectionSlug}}',\n label: 'Its collection slug',\n description: 'That collection’s URL segment.',\n },\n {\n token: '{{entry.collectionUrl}}',\n label: 'Its collection link',\n description: 'The listing this entry belongs to.',\n },\n {\n token: '{{entry.coverImage}}',\n label: 'Cover image',\n description: 'Cover image URL.',\n },\n {\n token: '{{entry.coverVideo}}',\n label: 'Featured video',\n description:\n 'The featured video’s source — a library film, a video file link or ' +\n 'a video host’s link — for a Video element.',\n },\n {\n token: '{{entry.coverVideoDuration}}',\n label: 'Featured video length',\n description:\n 'How long the featured video runs, in seconds, for a Video element’s ' +\n 'duration field. Blank when the entry does not say.',\n },\n {\n token: '{{entry.category}}',\n label: 'Category',\n description: 'The entry category.',\n },\n {\n token: '{{entry.tags}}',\n label: 'Tags',\n description: 'Tags, comma separated.',\n },\n {\n token: '{{entry.seoTitle}}',\n label: 'SEO title',\n description: 'Search title; falls back to Title.',\n },\n {\n token: '{{entry.seoDescription}}',\n label: 'SEO description',\n description: 'Meta description; falls back to Excerpt.',\n },\n]\n\n/**\n * `{{collection.*}}` and `{{pagination.*}}` tokens (AGL-551/1321/1386) —\n * resolve on collection list/entry template screens (see the tenant compose\n * pipeline's collection tokens).\n *\n * The category and pagination tokens all resolve to the empty string where\n * they do not apply, so they are safe to bind unconditionally: ONE list\n * screen serves the bare listing, every `/page/{n}` and every\n * `/category/{slug}`, and a template has no runtime conditional to vary\n * itself with.\n */\nexport const COLLECTION_TOKEN_CATALOG: readonly BindingTokenCatalogEntry[] = [\n {\n token: '{{collection.name}}',\n label: 'Collection name',\n description: 'Display name of the routed collection.',\n },\n {\n token: '{{collection.slug}}',\n label: 'Collection slug',\n description: 'URL slug of the routed collection.',\n },\n {\n token: '{{collection.category}}',\n label: 'Filtered category',\n description: 'Category the URL filtered on; empty when unfiltered.',\n },\n {\n token: '{{collection.categorySlug}}',\n label: 'Filtered category slug',\n description: 'That category’s URL segment; empty when unfiltered.',\n },\n {\n token: '{{pagination.page}}',\n label: 'Current page',\n description: 'Page number this URL is showing.',\n },\n {\n token: '{{pagination.totalPages}}',\n label: 'Total pages',\n // A listing bigger than one read cannot be counted honestly (AGL-3219):\n // the count and the entries were read at two different moments, and the\n // pager built from them disagreed with itself at the page boundary. It\n // still resolves, so a template binding it keeps rendering.\n description:\n 'Pages in the listing, after any category filter. Empty on a listing too large to count — bind the next link instead.',\n },\n {\n token: '{{pagination.prevUrl}}',\n label: 'Previous page link',\n description: 'Keeps the category; empty on the first page.',\n },\n {\n token: '{{pagination.nextUrl}}',\n label: 'Next page link',\n // The reliable \"is there more\" (AGL-3219): it is set from a read that\n // asked for one entry more than the page needed, so empty means there was\n // no such entry rather than that a total said so.\n description:\n 'Keeps the category; empty when there is nothing older to show.',\n },\n]\n\n/**\n * `{{author.*}}` tokens (AGL-2518) — resolve on an author's own page,\n * `/author/{slug}`.\n *\n * Empty everywhere else, like the category tokens above and for the same\n * reason: a template has no runtime conditional, so the tokens have to be the\n * thing that varies. A heading bound to `{{author.name}}` prints a name on an\n * author page and nothing anywhere else.\n *\n * The `{{pagination.*}}` tokens resolve HERE TOO, over this author's own\n * archive — deliberately the same four names a collection listing uses, so a\n * pager built once works on both.\n */\nexport const AUTHOR_TOKEN_CATALOG: readonly BindingTokenCatalogEntry[] = [\n {\n token: '{{author.name}}',\n label: 'Name',\n description: 'The byline this page collects.',\n },\n {\n token: '{{author.bio}}',\n label: 'Bio',\n description: 'Their blurb, from the author record.',\n },\n {\n token: '{{author.image}}',\n label: 'Portrait',\n description: 'Their portrait or logo, from the author record.',\n },\n {\n token: '{{author.jobTitle}}',\n label: 'Role',\n description: 'Their job title; empty for an Organization author.',\n },\n {\n token: '{{author.worksFor}}',\n label: 'Organization',\n description: 'Who they write for; empty for an Organization author.',\n },\n {\n token: '{{author.url}}',\n label: 'Their own site',\n description:\n 'The url on their record — a personal site, not this page. Empty when ' +\n 'they have none.',\n },\n {\n token: '{{author.pageUrl}}',\n label: 'This page',\n description: 'The canonical address of the page you are designing.',\n },\n {\n token: '{{author.entryCount}}',\n label: 'Post count',\n description: 'How many entries they have published, across every collection.',\n },\n {\n token: '{{author.entryCountLabel}}',\n label: 'Post count, worded',\n description:\n '\"1 post\" or \"12 posts\" — pluralized for you, because a template has no ' +\n 'conditional to do it with.',\n },\n]\n\n/**\n * The `{{item.*}}` token for one field of the record a repeat is rendering,\n * optionally hopping one reference to a field of the referenced record\n * (AGL-180). Always takes the stable field id — display names are labels\n * only, so renaming a field never breaks a binding (AGL-578).\n */\nexport function repeatItemToken(\n fieldId: string,\n targetFieldId?: string,\n): string {\n return targetFieldId\n ? `{{item.${fieldId}.${targetFieldId}}}`\n : `{{item.${fieldId}}}`\n}\n"],"names":["ENTRY_TOKEN_CATALOG","token","label","description","COLLECTION_TOKEN_CATALOG","AUTHOR_TOKEN_CATALOG","repeatItemToken","fieldId","targetFieldId"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;CAUC,GAUD;;;;CAIC,GACD,OAAO,MAAMA,sBAA2D;IACtE;QAAEC,OAAO;QAAmBC,OAAO;QAASC,aAAa;IAAsB;IAC/E;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;;;;EAIA,GACA;QACEF,OAAO;QACPC,OAAO;QACPC,aACE,qEACA;IACJ;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aACE,2EACA;IACJ;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;;;;;;;;EAQA,GACA;QACEF,OAAO;QACPC,OAAO;QACPC,aACE,0EACA,wEACA;IACJ;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aACE,wEACA;IACJ;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aACE,yEACA;IACJ;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;CACD,CAAA;AAED;;;;;;;;;;CAUC,GACD,OAAO,MAAMC,2BAAgE;IAC3E;QACEH,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACP,wEAAwE;QACxE,wEAAwE;QACxE,uEAAuE;QACvE,4DAA4D;QAC5DC,aACE;IACJ;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACP,sEAAsE;QACtE,0EAA0E;QAC1E,kDAAkD;QAClDC,aACE;IACJ;CACD,CAAA;AAED;;;;;;;;;;;;CAYC,GACD,OAAO,MAAME,uBAA4D;IACvE;QACEJ,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aACE,0EACA;IACJ;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aACE,4EACA;IACJ;CACD,CAAA;AAED;;;;;CAKC,GACD,OAAO,SAASG,gBACdC,OAAe,EACfC,aAAsB;IAEtB,OAAOA,gBACH,CAAC,OAAO,EAAED,QAAQ,CAAC,EAAEC,cAAc,EAAE,CAAC,GACtC,CAAC,OAAO,EAAED,QAAQ,EAAE,CAAC;AAC3B"}
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/binding-token-catalog.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 * Browsable data-placeholder catalogs for the designer's insert picker\n * (AGL-583). Hand-typing `{{entry.title}}` stays the advanced path; these\n * catalogs give every token a friendly label + description so editors can\n * browse and insert instead of memorizing the grammar.\n *\n * The token STRINGS are owned elsewhere — `collectionEntryTokens`\n * (collection-entries.ts) and the tenant compose pipeline resolve them —\n * this module only names them for pickers. The spec cross-checks the entry\n * catalog against the resolver so the two can never drift.\n */\nexport interface BindingTokenCatalogEntry {\n /** The literal token inserted into the prop, e.g. `{{entry.title}}`. */\n token: string\n /** Friendly picker label, e.g. `Title`. */\n label: string\n /** One-line description shown as the option's secondary text. */\n description?: string\n}\n\n/**\n * `{{entry.*}}` tokens (AGL-105/551/582) — resolve per entry inside a\n * Collection entries block and page-wide on entry-template screens.\n * Mirrors {@link collectionEntryTokens}; the spec enforces the mirror.\n */\nexport const ENTRY_TOKEN_CATALOG: readonly BindingTokenCatalogEntry[] = [\n { token: '{{entry.title}}', label: 'Title', description: 'The entry headline.' },\n {\n token: '{{entry.excerpt}}',\n label: 'Excerpt',\n description: 'Short summary text.',\n },\n {\n token: '{{entry.body}}',\n label: 'Body',\n description: 'The full entry body.',\n },\n {\n token: '{{entry.url}}',\n label: 'Link URL',\n description: 'Auto-route to the entry page.',\n },\n {\n token: '{{entry.date}}',\n label: 'Published date',\n description: 'Formatted publish date.',\n },\n /*\n Beside the readable date on purpose: a designer reaching for \"the date\" in\n a Video element's Publication date field has to see that the readable one\n is the wrong pick there, and why.\n */\n {\n token: '{{entry.publishedAt}}',\n label: 'Publish timestamp',\n description:\n 'The publish date and time in ISO 8601, for a field that needs a ' +\n 'machine-readable date, such as a Video element’s publication date.',\n },\n {\n token: '{{entry.author}}',\n label: 'Author',\n description: 'The byline set on the entry.',\n },\n {\n token: '{{entry.authorBio}}',\n label: 'Author bio',\n description: 'Blurb from the author’s record.',\n },\n {\n token: '{{entry.authorImage}}',\n label: 'Author portrait',\n description: 'Portrait or logo from the author’s record.',\n },\n {\n token: '{{entry.authorUrl}}',\n label: 'Author link',\n description: 'The author’s own page.',\n },\n {\n token: '{{entry.authorPageUrl}}',\n label: 'Author page',\n description:\n 'This author’s page on this site — everything they wrote, across every ' +\n 'collection. Separate from Author link, which is their own site.',\n },\n {\n token: '{{entry.slug}}',\n label: 'Slug',\n description: 'URL-safe entry identifier.',\n },\n /*\n Named \"Its collection…\" rather than \"Collection…\", which is what these\n describe and also exactly what the `{{collection.*}}` entries below are\n called. The picker groups options by heading, so the two sets sit apart —\n but a designer scanning it reads the LABEL, and two options reading\n \"Collection name\" three lines apart is a choice made by guessing. The\n pronoun is doing real work: on the one page where both resolve, they mean\n different collections.\n */\n {\n token: '{{entry.collection}}',\n label: 'Its collection',\n description:\n 'Which section this entry belongs to. Worth binding on a listing that ' +\n 'MIXES collections — an author page — where a card otherwise cannot ' +\n 'tell a release note from an essay.',\n },\n {\n token: '{{entry.collectionSlug}}',\n label: 'Its collection slug',\n description: 'That collection’s URL segment.',\n },\n {\n token: '{{entry.collectionUrl}}',\n label: 'Its collection link',\n description: 'The listing this entry belongs to.',\n },\n {\n token: '{{entry.coverImage}}',\n label: 'Cover image',\n description: 'Cover image URL.',\n },\n {\n token: '{{entry.coverVideo}}',\n label: 'Featured video',\n description:\n 'The featured video’s source — a library film, a video file link or ' +\n 'a video host’s link — for a Video element.',\n },\n {\n token: '{{entry.coverVideoDuration}}',\n label: 'Featured video length',\n description:\n 'How long the featured video runs, in seconds, for a Video element’s ' +\n 'duration field. Blank when the entry does not say.',\n },\n {\n token: '{{entry.category}}',\n label: 'Category',\n description: 'The entry category.',\n },\n {\n token: '{{entry.tags}}',\n label: 'Tags',\n description: 'Tags, comma separated.',\n },\n {\n token: '{{entry.seoTitle}}',\n label: 'SEO title',\n description: 'Search title; falls back to Title.',\n },\n {\n token: '{{entry.seoDescription}}',\n label: 'SEO description',\n description: 'Meta description; falls back to Excerpt.',\n },\n]\n\n/**\n * `{{collection.*}}` and `{{pagination.*}}` tokens (AGL-551/1321/1386) —\n * resolve on collection list/entry template screens (see the tenant compose\n * pipeline's collection tokens).\n *\n * The category and pagination tokens all resolve to the empty string where\n * they do not apply, so they are safe to bind unconditionally: ONE list\n * screen serves the bare listing, every `/page/{n}` and every\n * `/category/{slug}`, and a template has no runtime conditional to vary\n * itself with.\n */\nexport const COLLECTION_TOKEN_CATALOG: readonly BindingTokenCatalogEntry[] = [\n {\n token: '{{collection.name}}',\n label: 'Collection name',\n description: 'Display name of the routed collection.',\n },\n {\n token: '{{collection.slug}}',\n label: 'Collection slug',\n description: 'URL slug of the routed collection.',\n },\n {\n token: '{{collection.category}}',\n label: 'Filtered category',\n description: 'Category the URL filtered on; empty when unfiltered.',\n },\n {\n token: '{{collection.categorySlug}}',\n label: 'Filtered category slug',\n description: 'That category’s URL segment; empty when unfiltered.',\n },\n {\n token: '{{pagination.page}}',\n label: 'Current page',\n description: 'Page number this URL is showing.',\n },\n {\n token: '{{pagination.totalPages}}',\n label: 'Total pages',\n // A listing bigger than one read cannot be counted honestly (AGL-3219):\n // the count and the entries were read at two different moments, and the\n // pager built from them disagreed with itself at the page boundary. It\n // still resolves, so a template binding it keeps rendering.\n description:\n 'Pages in the listing, after any category filter. Empty on a listing too large to count — bind the next link instead.',\n },\n {\n token: '{{pagination.prevUrl}}',\n label: 'Previous page link',\n description: 'Keeps the category; empty on the first page.',\n },\n {\n token: '{{pagination.nextUrl}}',\n label: 'Next page link',\n // The reliable \"is there more\" (AGL-3219): it is set from a read that\n // asked for one entry more than the page needed, so empty means there was\n // no such entry rather than that a total said so.\n description:\n 'Keeps the category; empty when there is nothing older to show.',\n },\n]\n\n/**\n * `{{author.*}}` tokens (AGL-2518) — resolve on an author's own page,\n * `/author/{slug}`.\n *\n * Empty everywhere else, like the category tokens above and for the same\n * reason: a template has no runtime conditional, so the tokens have to be the\n * thing that varies. A heading bound to `{{author.name}}` prints a name on an\n * author page and nothing anywhere else.\n *\n * The `{{pagination.*}}` tokens resolve HERE TOO, over this author's own\n * archive — deliberately the same four names a collection listing uses, so a\n * pager built once works on both.\n */\nexport const AUTHOR_TOKEN_CATALOG: readonly BindingTokenCatalogEntry[] = [\n {\n token: '{{author.name}}',\n label: 'Name',\n description: 'The byline this page collects.',\n },\n {\n token: '{{author.bio}}',\n label: 'Bio',\n description: 'Their blurb, from the author record.',\n },\n {\n token: '{{author.image}}',\n label: 'Portrait',\n description: 'Their portrait or logo, from the author record.',\n },\n {\n token: '{{author.jobTitle}}',\n label: 'Role',\n description: 'Their job title; empty for an Organization author.',\n },\n {\n token: '{{author.worksFor}}',\n label: 'Organization',\n description: 'Who they write for; empty for an Organization author.',\n },\n {\n token: '{{author.url}}',\n label: 'Their own site',\n description:\n 'The url on their record — a personal site, not this page. Empty when ' +\n 'they have none.',\n },\n {\n token: '{{author.pageUrl}}',\n label: 'This page',\n description: 'The canonical address of the page you are designing.',\n },\n {\n token: '{{author.entryCount}}',\n label: 'Post count',\n description: 'How many entries they have published, across every collection.',\n },\n {\n token: '{{author.entryCountLabel}}',\n label: 'Post count, worded',\n description:\n '\"1 post\" or \"12 posts\" — pluralized for you, because a template has no ' +\n 'conditional to do it with.',\n },\n]\n\n/**\n * The `{{item.*}}` token for one field of the record a repeat is rendering,\n * optionally hopping one reference to a field of the referenced record\n * (AGL-180). Always takes the stable field id — display names are labels\n * only, so renaming a field never breaks a binding (AGL-578).\n */\nexport function repeatItemToken(\n fieldId: string,\n targetFieldId?: string,\n): string {\n return targetFieldId\n ? `{{item.${fieldId}.${targetFieldId}}}`\n : `{{item.${fieldId}}}`\n}\n\n/**\n * The record field type that holds an icon (AGL-4190): `{ iconId, iconPath }`,\n * the shape a reusable component's Icon property holds. Named here, in core,\n * because the plugin that keeps the records declares it and the Besigner's\n * Icon picker binds to it, and neither may import the other. Persisted on\n * field definitions — never rename.\n */\nexport const RECORD_ICON_FIELD_TYPE = 'icon'\n\n/** The part of a record's icon that is its SVG path (AGL-4190). */\nexport const RECORD_ICON_PATH_PART = 'iconPath'\n\n/**\n * The field id of a token that is nothing but one record field, `{{item.x}}`,\n * or `null` for anything else (a hop, words around it, another kind of token).\n */\nexport function matchWholeItemToken(value: unknown): string | null {\n if (typeof value !== 'string') return null\n const match = /^\\s*\\{\\{\\s*item\\.([A-Za-z][A-Za-z0-9_]*)\\s*\\}\\}\\s*$/.exec(value)\n return match ? match[1] : null\n}\n"],"names":["ENTRY_TOKEN_CATALOG","token","label","description","COLLECTION_TOKEN_CATALOG","AUTHOR_TOKEN_CATALOG","repeatItemToken","fieldId","targetFieldId","RECORD_ICON_FIELD_TYPE","RECORD_ICON_PATH_PART","matchWholeItemToken","value","match","exec"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;CAUC,GAUD;;;;CAIC,GACD,OAAO,MAAMA,sBAA2D;IACtE;QAAEC,OAAO;QAAmBC,OAAO;QAASC,aAAa;IAAsB;IAC/E;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;;;;EAIA,GACA;QACEF,OAAO;QACPC,OAAO;QACPC,aACE,qEACA;IACJ;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aACE,2EACA;IACJ;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;;;;;;;;EAQA,GACA;QACEF,OAAO;QACPC,OAAO;QACPC,aACE,0EACA,wEACA;IACJ;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aACE,wEACA;IACJ;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aACE,yEACA;IACJ;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;CACD,CAAA;AAED;;;;;;;;;;CAUC,GACD,OAAO,MAAMC,2BAAgE;IAC3E;QACEH,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACP,wEAAwE;QACxE,wEAAwE;QACxE,uEAAuE;QACvE,4DAA4D;QAC5DC,aACE;IACJ;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACP,sEAAsE;QACtE,0EAA0E;QAC1E,kDAAkD;QAClDC,aACE;IACJ;CACD,CAAA;AAED;;;;;;;;;;;;CAYC,GACD,OAAO,MAAME,uBAA4D;IACvE;QACEJ,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aACE,0EACA;IACJ;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aAAa;IACf;IACA;QACEF,OAAO;QACPC,OAAO;QACPC,aACE,4EACA;IACJ;CACD,CAAA;AAED;;;;;CAKC,GACD,OAAO,SAASG,gBACdC,OAAe,EACfC,aAAsB;IAEtB,OAAOA,gBACH,CAAC,OAAO,EAAED,QAAQ,CAAC,EAAEC,cAAc,EAAE,CAAC,GACtC,CAAC,OAAO,EAAED,QAAQ,EAAE,CAAC;AAC3B;AAEA;;;;;;CAMC,GACD,OAAO,MAAME,yBAAyB,OAAM;AAE5C,iEAAiE,GACjE,OAAO,MAAMC,wBAAwB,WAAU;AAE/C;;;CAGC,GACD,OAAO,SAASC,oBAAoBC,KAAc;IAChD,IAAI,OAAOA,UAAU,UAAU,OAAO;IACtC,MAAMC,QAAQ,sDAAsDC,IAAI,CAACF;IACzE,OAAOC,QAAQA,KAAK,CAAC,EAAE,GAAG;AAC5B"}
@@ -0,0 +1,80 @@
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 MCP endpoint, which is the protected resource. */
18
+ export declare const CONNECTOR_RESOURCE_PATH = "/api/mcp";
19
+ /** The consent page a person is sent to. A console page, behind sign-in. */
20
+ export declare const CONNECTOR_AUTHORIZE_PATH = "/oauth/authorize";
21
+ /** Dynamic client registration (RFC 7591). */
22
+ export declare const CONNECTOR_REGISTER_PATH = "/api/oauth/register";
23
+ /** Code and refresh exchange. */
24
+ export declare const CONNECTOR_TOKEN_PATH = "/api/oauth/token";
25
+ /** Revocation (RFC 7009). */
26
+ export declare const CONNECTOR_REVOKE_PATH = "/api/oauth/revoke";
27
+ /** RFC 9728 §3: the document for the server as a whole. */
28
+ export declare const PROTECTED_RESOURCE_METADATA_PATH = "/.well-known/oauth-protected-resource";
29
+ /**
30
+ * RFC 9728 §3.1: the document for one resource, at the well-known prefix
31
+ * followed by the resource's path. What the 401 challenge names.
32
+ */
33
+ export declare const MCP_PROTECTED_RESOURCE_METADATA_PATH = "/.well-known/oauth-protected-resource/api/mcp";
34
+ /** RFC 8414 §3. The issuer has no path, so neither does this. */
35
+ export declare const AUTHORIZATION_SERVER_METADATA_PATH = "/.well-known/oauth-authorization-server";
36
+ /**
37
+ * The MCP Server Card: a static description of the MCP endpoint that a client
38
+ * or a registry can read BEFORE connecting — where it is, which transport,
39
+ * which protocol revisions.
40
+ *
41
+ * SEP-2127 (MCP Server Cards, Final, Extensions Track) reserves
42
+ * `<streamable-http-url>/server-card` as the recommended location, and its
43
+ * discovery document advises against `.well-known` for cards, so this sits
44
+ * under the endpoint it describes rather than beside the OAuth documents.
45
+ * https://modelcontextprotocol.io/seps/2127-mcp-server-cards
46
+ */
47
+ export declare const MCP_SERVER_CARD_PATH = "/api/mcp/server-card";
48
+ /** The card's media type, per the extension's `docs/discovery.md`. */
49
+ export declare const MCP_SERVER_CARD_MEDIA_TYPE = "application/mcp-server-card+json";
50
+ /**
51
+ * The `$schema` a card must carry. The extension's schema pins this exact
52
+ * URL (versioned by the `v1` segment, not by date).
53
+ */
54
+ export declare const MCP_SERVER_CARD_SCHEMA = "https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json";
55
+ /**
56
+ * The three discovery documents the console serves, by EXACT path, and the
57
+ * route handler each is rewritten to. Exactly these: any other path under
58
+ * `/.well-known/` still answers 404, which is the posture the namespace is
59
+ * held to (AGL-3016).
60
+ */
61
+ export declare const CONNECTOR_DISCOVERY_ROUTES: Readonly<Record<string, string>>;
62
+ /** The route handler serving `pathname`, or `null` when it is not one of the three. */
63
+ export declare function connectorDiscoveryRoute(pathname: string): string | null;
64
+ /** The resource identifier for the MCP endpoint on `origin`. */
65
+ export declare function connectorResourceFor(origin: string): string;
66
+ /** What a 401 from the MCP endpoint names, so a client can begin the walk. */
67
+ export declare function connectorResourceMetadataUrl(origin: string): string;
68
+ /** The authorization server's own document (RFC 8414) on `origin`. */
69
+ export declare function connectorAuthorizationServerMetadataUrl(origin: string): string;
70
+ /** The MCP Server Card (SEP-2127) on `origin`. */
71
+ export declare function mcpServerCardUrl(origin: string): string;
72
+ /**
73
+ * The card's `name`: reverse-DNS of the host that serves the endpoint, then
74
+ * `/mcp`. The card schema (and the MCP Registry's `server.json`) require
75
+ * `namespace/name` matching `^[a-zA-Z0-9.-]+/[a-zA-Z0-9._-]+$`, and a
76
+ * reverse-DNS namespace is the one a registry can verify against the domain,
77
+ * so a self-hosted console names itself rather than borrowing ours.
78
+ * `app.aglyn.com` → `com.aglyn.app/mcp`.
79
+ */
80
+ export declare function mcpServerCardName(origin: string): string;