@aglyn/aglyn 1.0.0-beta.270 → 1.0.0-beta.271

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 (75) hide show
  1. package/package.json +11 -11
  2. package/src/lib/app-utils/activity-labels.js +2 -0
  3. package/src/lib/app-utils/activity-labels.js.map +1 -1
  4. package/src/lib/app-utils/analytics-events.d.ts +13 -0
  5. package/src/lib/app-utils/analytics-events.js +2 -0
  6. package/src/lib/app-utils/analytics-events.js.map +1 -1
  7. package/src/lib/app-utils/append-only-history.d.ts +94 -0
  8. package/src/lib/app-utils/append-only-history.js +73 -0
  9. package/src/lib/app-utils/append-only-history.js.map +1 -0
  10. package/src/lib/app-utils/bundle-intent.d.ts +186 -0
  11. package/src/lib/app-utils/bundle-intent.js +386 -0
  12. package/src/lib/app-utils/bundle-intent.js.map +1 -0
  13. package/src/lib/app-utils/client-build.d.ts +204 -0
  14. package/src/lib/app-utils/client-build.js +237 -0
  15. package/src/lib/app-utils/client-build.js.map +1 -0
  16. package/src/lib/app-utils/console-routes.d.ts +4 -0
  17. package/src/lib/app-utils/console-routes.js +2 -0
  18. package/src/lib/app-utils/console-routes.js.map +1 -1
  19. package/src/lib/app-utils/docs-help-sections.generated.js +7 -5
  20. package/src/lib/app-utils/docs-help-sections.generated.js.map +1 -1
  21. package/src/lib/app-utils/docs-help.generated.d.ts +5 -5
  22. package/src/lib/app-utils/docs-help.generated.js +9 -2
  23. package/src/lib/app-utils/docs-help.generated.js.map +1 -1
  24. package/src/lib/app-utils/docs-index.generated.js +101 -31
  25. package/src/lib/app-utils/docs-index.generated.js.map +1 -1
  26. package/src/lib/app-utils/margin-utilization.js +6 -4
  27. package/src/lib/app-utils/margin-utilization.js.map +1 -1
  28. package/src/lib/app-utils/media-filter.d.ts +26 -0
  29. package/src/lib/app-utils/media-filter.js +32 -0
  30. package/src/lib/app-utils/media-filter.js.map +1 -1
  31. package/src/lib/app-utils/onboarding-deep-link.d.ts +36 -2
  32. package/src/lib/app-utils/onboarding-deep-link.js +48 -5
  33. package/src/lib/app-utils/onboarding-deep-link.js.map +1 -1
  34. package/src/lib/app-utils/operator-alerts.js +21 -0
  35. package/src/lib/app-utils/operator-alerts.js.map +1 -1
  36. package/src/lib/app-utils/owner-approval-record.d.ts +102 -0
  37. package/src/lib/app-utils/owner-approval-record.js +148 -0
  38. package/src/lib/app-utils/owner-approval-record.js.map +1 -0
  39. package/src/lib/app-utils/plan-entitlements.d.ts +183 -67
  40. package/src/lib/app-utils/plan-entitlements.js +213 -58
  41. package/src/lib/app-utils/plan-entitlements.js.map +1 -1
  42. package/src/lib/app-utils/release-flags.d.ts +1 -1
  43. package/src/lib/app-utils/release-flags.js +10 -0
  44. package/src/lib/app-utils/release-flags.js.map +1 -1
  45. package/src/lib/app-utils/server.d.ts +4 -0
  46. package/src/lib/app-utils/server.js +7 -0
  47. package/src/lib/app-utils/server.js.map +1 -1
  48. package/src/lib/app-utils/site-care-project.d.ts +227 -0
  49. package/src/lib/app-utils/site-care-project.js +423 -0
  50. package/src/lib/app-utils/site-care-project.js.map +1 -0
  51. package/src/lib/app-utils/site-care.d.ts +268 -0
  52. package/src/lib/app-utils/site-care.js +283 -0
  53. package/src/lib/app-utils/site-care.js.map +1 -0
  54. package/src/lib/app-utils/upgrade-proposal.d.ts +29 -4
  55. package/src/lib/app-utils/upgrade-proposal.js +60 -9
  56. package/src/lib/app-utils/upgrade-proposal.js.map +1 -1
  57. package/src/lib/foundation/definitions/org-billing.types.d.ts +40 -10
  58. package/src/lib/foundation/definitions/org-billing.types.js.map +1 -1
  59. package/src/lib/foundation/definitions/organization.types.d.ts +3 -1
  60. package/src/lib/foundation/definitions/organization.types.js.map +1 -1
  61. package/src/lib/foundation/index.d.ts +1 -1
  62. package/src/lib/foundation/index.js.map +1 -1
  63. package/src/lib/plugin-manager/feature-plugins.d.ts +48 -0
  64. package/src/lib/plugin-manager/feature-plugins.js.map +1 -1
  65. package/src/lib/plugin-manager/plugin-ai-capabilities.d.ts +19 -0
  66. package/src/lib/plugin-manager/plugin-ai-capabilities.js.map +1 -1
  67. package/src/lib/plugin-manager/plugin-domain-search.d.ts +81 -0
  68. package/src/lib/plugin-manager/plugin-domain-search.js +63 -0
  69. package/src/lib/plugin-manager/plugin-domain-search.js.map +1 -0
  70. package/src/lib/plugin-manager/plugin-entitlements.d.ts +23 -5
  71. package/src/lib/plugin-manager/plugin-entitlements.js +10 -0
  72. package/src/lib/plugin-manager/plugin-entitlements.js.map +1 -1
  73. package/src/lib/plugin-manager/purchase-gate-preclearance.d.ts +61 -0
  74. package/src/lib/plugin-manager/purchase-gate-preclearance.js +102 -0
  75. package/src/lib/plugin-manager/purchase-gate-preclearance.js.map +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/purchase-gate-preclearance.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 * WHO MAY WAIVE A PURCHASE GATE, ONCE (AGL-3955).\n *\n * A plugin that sells something can hold a purchase behind a gate the\n * workspace has to earn: the domains plugin refuses to register a name until\n * the workspace has a paid platform invoice at least 72 hours old. Core owns\n * the one thing that can stand in for that history: a staff member who met\n * the owner in person and minted a single-use bundle link for that one\n * workspace, accountable for it in `adminAudit`.\n *\n * The plugin cannot read core's bundle-link records (a plugin never imports\n * core's storage, and never another plugin), so the waiver is a contract\n * here. The plugin asks `check` while deciding whether the gate refuses, and\n * calls `consume` after it has taken its own hold and before it charges: a\n * `false` from `consume` refuses the purchase, so one preclearance buys\n * exactly one thing.\n *\n * Only the named gate is waived. Every other refusal the plugin makes (a\n * brand lookalike, its per-workspace caps) stands, and an implementation has\n * no say in them.\n *\n * ## FAILS CLOSED\n *\n * {@link checkPurchaseGatePreclearance} answers null on any error and when\n * nothing is registered, and {@link consumePurchaseGatePreclearance} answers\n * false: a waiver that cannot be confirmed is no waiver, and the gate keeps\n * refusing.\n */\n\nimport {\n definePluginServiceContract,\n registerPluginService,\n resolvePluginServices,\n} from './plugin-services'\n\n/** The gates a preclearance may waive. One today. */\nexport type PurchaseGate = 'domain-payment-history'\n\nexport interface PurchaseGatePreclearanceInput {\n /** The workspace the purchase is for. */\n orgId: string\n gate: PurchaseGate\n}\n\nexport interface PurchaseGatePreclearance {\n /**\n * A live, unused waiver for this workspace and gate, or null. Reads only:\n * asking does not spend it.\n */\n check(input: PurchaseGatePreclearanceInput): Promise<{ preclearanceId: string } | null>\n /**\n * Spend the waiver: true exactly once per id, in a transaction that marks it\n * used only if nothing has. False for an id this implementation does not\n * hold, one already spent, or one that expired.\n */\n consume(preclearanceId: string): Promise<boolean>\n}\n\n/**\n * A set: more than one surface may mint a waiver (a bundle link today), and\n * the gate asks each in turn.\n */\nexport const PURCHASE_GATE_PRECLEARANCE =\n definePluginServiceContract<PurchaseGatePreclearance>('core.purchase-gate-preclearance', {\n multiple: true,\n })\n\n/** Installs an implementation. The console registers the bundle links at boot. */\nexport function registerPurchaseGatePreclearance(\n impl: PurchaseGatePreclearance,\n options?: { pluginId?: string; key?: string },\n): void {\n if (typeof impl?.check !== 'function' || typeof impl?.consume !== 'function') {\n throw new Error('a purchase gate preclearance needs check and consume functions')\n }\n registerPluginService(PURCHASE_GATE_PRECLEARANCE, impl, {\n ...(options?.pluginId ? { pluginId: options.pluginId } : {}),\n ...(options?.key ? { key: options.key } : {}),\n })\n}\n\n/**\n * The first live waiver any implementation holds for the workspace and gate,\n * or null. Never throws; an implementation that throws is skipped and\n * logged, so it can only ever cost a waiver, never grant one.\n */\nexport async function checkPurchaseGatePreclearance(\n input: PurchaseGatePreclearanceInput,\n): Promise<{ preclearanceId: string } | null> {\n const orgId = String(input?.orgId ?? '').trim()\n if (!orgId || input?.gate !== 'domain-payment-history') return null\n for (const registration of resolvePluginServices(PURCHASE_GATE_PRECLEARANCE)) {\n try {\n const found = await registration.impl.check({ orgId, gate: input.gate })\n const preclearanceId = String(found?.preclearanceId ?? '').trim()\n if (preclearanceId) return { preclearanceId }\n } catch (error) {\n console.error(\n `[purchase-gate-preclearance] check failed in \"${registration.pluginId}\"`,\n error,\n )\n }\n }\n return null\n}\n\n/**\n * Spend a waiver. True only when an implementation marked it used just now.\n * Never throws: a failure answers false, which refuses the purchase.\n */\nexport async function consumePurchaseGatePreclearance(\n preclearanceId: string,\n): Promise<boolean> {\n const id = String(preclearanceId ?? '').trim()\n if (!id) return false\n for (const registration of resolvePluginServices(PURCHASE_GATE_PRECLEARANCE)) {\n try {\n if ((await registration.impl.consume(id)) === true) return true\n } catch (error) {\n console.error(\n `[purchase-gate-preclearance] consume failed in \"${registration.pluginId}\"`,\n error,\n )\n }\n }\n return false\n}\n"],"names":["definePluginServiceContract","registerPluginService","resolvePluginServices","PURCHASE_GATE_PRECLEARANCE","multiple","registerPurchaseGatePreclearance","impl","options","check","consume","Error","pluginId","key","checkPurchaseGatePreclearance","input","orgId","String","trim","gate","registration","found","preclearanceId","error","console","consumePurchaseGatePreclearance","id"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BC,GAED,SACEA,2BAA2B,EAC3BC,qBAAqB,EACrBC,qBAAqB,QAChB,uBAAmB;AAyB1B;;;CAGC,GACD,OAAO,MAAMC,6BACXH,4BAAsD,mCAAmC;IACvFI,UAAU;AACZ,GAAE;AAEJ,gFAAgF,GAChF,OAAO,SAASC,iCACdC,IAA8B,EAC9BC,OAA6C;IAE7C,IAAI,QAAOD,wBAAAA,KAAME,KAAK,MAAK,cAAc,QAAOF,wBAAAA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