@capybara-hq/kernel 0.1.0-rc.135 → 0.1.0-rc.137

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 (242) hide show
  1. package/dist/admin/admin.module.js +3 -0
  2. package/dist/admin/audit-log.service.d.ts +96 -12
  3. package/dist/admin/audit-log.service.js +508 -44
  4. package/dist/admin/audit-targets.d.ts +17 -0
  5. package/dist/admin/audit-targets.js +84 -0
  6. package/dist/admin/audit.controller.d.ts +12 -9
  7. package/dist/admin/audit.controller.js +29 -8
  8. package/dist/admin/audit.schemas.d.ts +20 -4
  9. package/dist/admin/audit.schemas.js +42 -17
  10. package/dist/admin/health.service.d.ts +2 -2
  11. package/dist/admin/health.service.js +6 -2
  12. package/dist/agents/templates.js +3 -10
  13. package/dist/app.d.ts +3 -1
  14. package/dist/app.js +1 -0
  15. package/dist/automations/automations.service.js +4 -5
  16. package/dist/catalog/catalog-content.d.ts +1 -1
  17. package/dist/catalog/catalog-content.js +17 -22
  18. package/dist/catalog/catalog-items.d.ts +5 -10
  19. package/dist/catalog/catalog-items.js +27 -51
  20. package/dist/catalog/catalog-scope.service.d.ts +4 -2
  21. package/dist/catalog/catalog-scope.service.js +105 -141
  22. package/dist/catalog/catalog.module.js +2 -0
  23. package/dist/catalog/catalog.service.d.ts +3 -3
  24. package/dist/catalog/catalog.service.js +33 -8
  25. package/dist/catalog/cli.js +17 -0
  26. package/dist/catalog/component-promotion.js +8 -4
  27. package/dist/catalog/component-scope.service.d.ts +3 -1
  28. package/dist/catalog/component-scope.service.js +101 -140
  29. package/dist/catalog/component-state.d.ts +10 -8
  30. package/dist/catalog/component-state.js +42 -30
  31. package/dist/catalog/dependency-edges.d.ts +25 -0
  32. package/dist/catalog/dependency-edges.js +125 -0
  33. package/dist/catalog/install-status.d.ts +2 -3
  34. package/dist/catalog/install-status.js +2 -3
  35. package/dist/catalog/marketplaces.service.d.ts +1 -1
  36. package/dist/catalog/org-catalog.service.d.ts +3 -1
  37. package/dist/catalog/org-catalog.service.js +33 -94
  38. package/dist/catalog/org-intent.d.ts +43 -0
  39. package/dist/catalog/org-intent.js +184 -0
  40. package/dist/catalog/owned-items.d.ts +1 -1
  41. package/dist/catalog/owned-items.js +9 -29
  42. package/dist/catalog/ownership.d.ts +2 -3
  43. package/dist/catalog/ownership.js +10 -28
  44. package/dist/catalog/platform-components.d.ts +3 -1
  45. package/dist/catalog/platform-components.js +9 -1
  46. package/dist/catalog/plugin-import.js +12 -16
  47. package/dist/catalog/plugin-install.d.ts +3 -4
  48. package/dist/catalog/plugin-install.js +25 -49
  49. package/dist/catalog/plugin-upgrade.d.ts +2 -2
  50. package/dist/catalog/plugin-upgrade.js +18 -34
  51. package/dist/catalog/request-rules.js +20 -8
  52. package/dist/catalog/scope-orgs.js +2 -7
  53. package/dist/catalog/scope-state.d.ts +6 -6
  54. package/dist/catalog/scope-state.js +24 -43
  55. package/dist/catalog/scope-sync.d.ts +0 -2
  56. package/dist/catalog/scope-sync.js +11 -39
  57. package/dist/catalog/scope-writer.d.ts +78 -0
  58. package/dist/catalog/scope-writer.js +181 -0
  59. package/dist/catalog/unshare.js +8 -41
  60. package/dist/channels/connections.service.js +6 -6
  61. package/dist/channels/supervisor.js +3 -7
  62. package/dist/client/client-access.service.js +2 -12
  63. package/dist/config/schema.d.ts +6 -0
  64. package/dist/config/schema.js +29 -1
  65. package/dist/conversations/access.d.ts +15 -7
  66. package/dist/conversations/access.js +59 -10
  67. package/dist/conversations/conversation-agent.d.ts +18 -0
  68. package/dist/conversations/conversation-agent.js +23 -0
  69. package/dist/conversations/conversation-ref.d.ts +3 -2
  70. package/dist/conversations/conversation-ref.js +6 -1
  71. package/dist/conversations/conversations.controller.d.ts +28 -5
  72. package/dist/conversations/conversations.controller.js +99 -10
  73. package/dist/conversations/conversations.module.js +10 -0
  74. package/dist/conversations/conversations.schemas.d.ts +6 -0
  75. package/dist/conversations/conversations.schemas.js +15 -0
  76. package/dist/conversations/conversations.service.d.ts +125 -21
  77. package/dist/conversations/conversations.service.js +260 -90
  78. package/dist/conversations/event-log.d.ts +9 -1
  79. package/dist/conversations/event-log.js +2 -0
  80. package/dist/conversations/events.d.ts +57 -0
  81. package/dist/conversations/events.js +73 -1
  82. package/dist/conversations/external/external-calls.d.ts +75 -0
  83. package/dist/conversations/external/external-calls.js +91 -0
  84. package/dist/conversations/external/external-calls.processor.d.ts +45 -0
  85. package/dist/conversations/external/external-calls.processor.js +144 -0
  86. package/dist/conversations/external/external-conversations.service.d.ts +266 -0
  87. package/dist/conversations/external/external-conversations.service.js +1138 -0
  88. package/dist/conversations/external/external.schemas.d.ts +63 -0
  89. package/dist/conversations/external/external.schemas.js +52 -0
  90. package/dist/conversations/external/token.d.ts +6 -0
  91. package/dist/conversations/external/token.js +6 -0
  92. package/dist/conversations/permission-profile-store.d.ts +4 -1
  93. package/dist/conversations/permission-profiles.controller.d.ts +33 -9
  94. package/dist/conversations/permission-profiles.controller.js +86 -6
  95. package/dist/conversations/prompt-suggestions.js +2 -1
  96. package/dist/conversations/queue.js +2 -1
  97. package/dist/conversations/titles.js +4 -3
  98. package/dist/ctx/create-ctx.d.ts +9 -2
  99. package/dist/ctx/create-ctx.js +47 -62
  100. package/dist/ctx/guard-db.d.ts +6 -0
  101. package/dist/ctx/guard-db.js +55 -0
  102. package/dist/db/extension-handoff-schema.d.ts +1 -1
  103. package/dist/db/extension-handoff-schema.js +48 -10
  104. package/dist/db/extension-schema-transfer.js +5 -2
  105. package/dist/db/kernel-schema.d.ts +42 -5
  106. package/dist/device-access/host-services.d.ts +2 -2
  107. package/dist/device-access/host-services.js +8 -8
  108. package/dist/device-access/person-handles.d.ts +16 -7
  109. package/dist/device-access/person-handles.js +14 -9
  110. package/dist/devices/conversation-devices.d.ts +5 -0
  111. package/dist/devices/conversation-devices.js +16 -0
  112. package/dist/erasure/org-catalog.js +2 -2
  113. package/dist/erasure/org-rules.js +5 -0
  114. package/dist/errors.d.ts +34 -0
  115. package/dist/errors.js +34 -0
  116. package/dist/evals/snapshot.js +3 -1
  117. package/dist/evals/trajectory.service.d.ts +2 -2
  118. package/dist/evals/trajectory.service.js +11 -7
  119. package/dist/extensions/admin-ops.d.ts +9 -5
  120. package/dist/extensions/admin-ops.js +52 -8
  121. package/dist/extensions/admin-view.js +1 -4
  122. package/dist/extensions/bootstrap.js +4 -1
  123. package/dist/extensions/cli.js +1 -0
  124. package/dist/extensions/effective-config.js +1 -4
  125. package/dist/extensions/enabled.d.ts +23 -29
  126. package/dist/extensions/enabled.js +141 -62
  127. package/dist/extensions/extensions.module.js +3 -0
  128. package/dist/extensions/host.d.ts +71 -45
  129. package/dist/extensions/host.js +454 -128
  130. package/dist/extensions/installs.d.ts +9 -0
  131. package/dist/extensions/installs.js +23 -0
  132. package/dist/extensions/isolated/admission.d.ts +10 -0
  133. package/dist/extensions/isolated/admission.js +206 -0
  134. package/dist/extensions/isolated/authorization.d.ts +37 -0
  135. package/dist/extensions/isolated/authorization.js +146 -0
  136. package/dist/extensions/isolated/broker.d.ts +15 -0
  137. package/dist/extensions/isolated/broker.js +452 -0
  138. package/dist/extensions/isolated/child-protocol.d.ts +84 -0
  139. package/dist/extensions/isolated/child-protocol.js +21 -0
  140. package/dist/extensions/isolated/child-registration.d.ts +22 -0
  141. package/dist/extensions/isolated/child-registration.js +152 -0
  142. package/dist/extensions/isolated/child-session.d.ts +6 -0
  143. package/dist/extensions/isolated/child-session.js +343 -0
  144. package/dist/extensions/isolated/child-streams.d.ts +4 -0
  145. package/dist/extensions/isolated/child-streams.js +142 -0
  146. package/dist/extensions/isolated/child.d.ts +1 -0
  147. package/dist/extensions/isolated/child.js +10 -0
  148. package/dist/extensions/isolated/configured-package.d.ts +15 -0
  149. package/dist/extensions/isolated/configured-package.js +73 -0
  150. package/dist/extensions/isolated/lanes.d.ts +100 -0
  151. package/dist/extensions/isolated/lanes.js +699 -0
  152. package/dist/extensions/isolated/postgres-gate.d.ts +14 -0
  153. package/dist/extensions/isolated/postgres-gate.js +255 -0
  154. package/dist/extensions/isolated/revision.d.ts +32 -0
  155. package/dist/extensions/isolated/revision.js +358 -0
  156. package/dist/extensions/isolated/rpc-frame.d.ts +50 -0
  157. package/dist/extensions/isolated/rpc-frame.js +193 -0
  158. package/dist/extensions/isolated/rpc.d.ts +66 -0
  159. package/dist/extensions/isolated/rpc.js +314 -0
  160. package/dist/extensions/isolated/sandbox.d.ts +35 -0
  161. package/dist/extensions/isolated/sandbox.js +372 -0
  162. package/dist/extensions/isolated/tier.d.ts +6 -0
  163. package/dist/extensions/isolated/tier.js +45 -0
  164. package/dist/extensions/ledger.d.ts +1 -1
  165. package/dist/extensions/lifecycle-topics.d.ts +1 -0
  166. package/dist/extensions/lifecycle-topics.js +1 -0
  167. package/dist/extensions/lifecycle.d.ts +3 -1
  168. package/dist/extensions/lifecycle.js +32 -5
  169. package/dist/extensions/locks.d.ts +2 -0
  170. package/dist/extensions/locks.js +7 -0
  171. package/dist/extensions/org-config.d.ts +17 -27
  172. package/dist/extensions/org-config.js +114 -129
  173. package/dist/extensions/permission-view.d.ts +3 -1
  174. package/dist/extensions/permission-view.js +4 -1
  175. package/dist/extensions/plugin-guides.d.ts +5 -10
  176. package/dist/extensions/plugin-guides.js +18 -37
  177. package/dist/extensions/plugin-icons.d.ts +3 -21
  178. package/dist/extensions/plugin-icons.js +9 -44
  179. package/dist/extensions/plugin-items.d.ts +10 -30
  180. package/dist/extensions/plugin-items.js +32 -73
  181. package/dist/extensions/point-defaults.d.ts +13 -21
  182. package/dist/extensions/point-defaults.js +32 -72
  183. package/dist/extensions/point-serving.d.ts +56 -0
  184. package/dist/extensions/point-serving.js +120 -0
  185. package/dist/extensions/source-intent.d.ts +14 -0
  186. package/dist/extensions/source-intent.js +77 -0
  187. package/dist/inbox/inbox-items.service.d.ts +11 -0
  188. package/dist/inbox/inbox-items.service.js +39 -0
  189. package/dist/index.d.ts +2 -1
  190. package/dist/index.js +2 -1
  191. package/dist/infra/database/database.module.js +6 -1
  192. package/dist/infra/database/kernel-db.d.ts +3 -1
  193. package/dist/infra/database/kernel-db.js +4 -0
  194. package/dist/infra/outbox/registry.d.ts +70 -0
  195. package/dist/infra/outbox/registry.js +44 -0
  196. package/dist/infra/paging/paged-read.d.ts +56 -0
  197. package/dist/infra/paging/paged-read.js +78 -0
  198. package/dist/infra/queue/queue-names.d.ts +1 -1
  199. package/dist/infra/queue/queue-names.js +1 -0
  200. package/dist/kernel.d.ts +3 -2
  201. package/dist/kernel.js +21 -2
  202. package/dist/kernel.module.js +4 -0
  203. package/dist/lifecycle/kernel-lifecycle.d.ts +3 -1
  204. package/dist/lifecycle/kernel-lifecycle.js +22 -12
  205. package/dist/lifecycle/tokens.d.ts +8 -0
  206. package/dist/lifecycle/tokens.js +2 -0
  207. package/dist/orgs/directory-sync.js +1 -4
  208. package/dist/platform/exclusions.js +10 -0
  209. package/dist/platform/ops/admin.ops.js +14 -3
  210. package/dist/platform/ops/conversations.ops.d.ts +8 -1
  211. package/dist/platform/ops/conversations.ops.js +52 -14
  212. package/dist/platform/ops/orgs.ops.js +13 -3
  213. package/dist/plugin-reads/plugin-reads.service.js +4 -1
  214. package/dist/push/recipients.js +5 -2
  215. package/dist/retention/worker.js +2 -1
  216. package/dist/roles/worker-role.d.ts +3 -1
  217. package/dist/roles/worker-role.js +8 -2
  218. package/dist/roles/worker.module.js +3 -0
  219. package/dist/runtime/context/build.js +8 -0
  220. package/dist/runtime/context/compaction.js +7 -0
  221. package/dist/runtime/idle-arm.js +3 -1
  222. package/dist/runtime/idle-compaction.js +2 -1
  223. package/dist/runtime/run-finish.js +2 -1
  224. package/dist/runtime/run-jobs.js +2 -1
  225. package/dist/runtime/run-queue.js +4 -2
  226. package/dist/runtime/run-worker.js +5 -2
  227. package/dist/runtime/stream.js +10 -0
  228. package/dist/runtime/usage-report.js +2 -1
  229. package/dist/runtime/waits.js +2 -1
  230. package/dist/setup/setup-checks.service.js +3 -2
  231. package/dist/skills/usable.js +41 -30
  232. package/dist/themes/theme-state.js +3 -3
  233. package/dist/tools/approvals.service.js +6 -2
  234. package/dist/tools/builtins/skill-load.js +3 -2
  235. package/dist/tools/registry.d.ts +1 -1
  236. package/dist/tools/registry.js +1 -1
  237. package/dist/tools/tool-watch.service.js +3 -1
  238. package/package.json +3 -3
  239. package/src/migrations/0227_external_conversations.sql +33 -0
  240. package/src/migrations/0228_extension_org_switches.sql +56 -0
  241. package/src/migrations/0229_catalog_dependency_edges.sql +17 -0
  242. package/src/migrations/0230_audit_filter_idx.sql +18 -0
@@ -108,9 +108,10 @@ type VersionFile = {
108
108
  sha256: string;
109
109
  };
110
110
  /** The live items (with their latest version) by name or id. */
111
- declare function latestItems(db: KernelDb, by: "name" | "id", keys: string[]): Promise<{
112
- builtin: boolean;
113
- disabled: boolean;
111
+ declare function latestItems(db: KernelDb, by: "name" | "id", keys: string[], org?: {
112
+ orgId: string;
113
+ role: OrgRole;
114
+ }): Promise<{
114
115
  files: {
115
116
  path: string;
116
117
  size: number;
@@ -120,10 +121,6 @@ declare function latestItems(db: KernelDb, by: "name" | "id", keys: string[]): P
120
121
  latest_version: string;
121
122
  manifest: unknown;
122
123
  name: string;
123
- owner_org_id: string | null;
124
- scope: "all" | "named" | "optional";
125
- shareable: boolean;
126
- shown_to_others: boolean;
127
124
  }[]>;
128
125
  /** A live item with its latest version, as {@link PluginGuides} reads it. */
129
126
  export type ItemRow = Awaited<ReturnType<typeof latestItems>>[number];
@@ -137,7 +134,7 @@ export declare const templateGuideOf: (manifest: unknown, templateId: string) =>
137
134
  * catalog item (the item of the same name, its latest version), renders a guide document for a
138
135
  * place, audience, mode and target with the place's safe variables (`guide-places.ts`; never a
139
136
  * secret), and computes the drift hashes targets record to tell when an upgrade changed their
140
- * setup. Org reads follow the catalog icon's visibility ({@link orgVisibleItems}), the platform
137
+ * setup. Org reads follow the catalog icon's visibility ({@link orgSees}), the platform
141
138
  * preview any live item. Stateless: everything comes from PG (version rows, target rows, the
142
139
  * documents in `catalog_files`).
143
140
  */
@@ -147,8 +144,6 @@ export declare class PluginGuides {
147
144
  private readonly log;
148
145
  constructor(db: KernelDb, config: Pick<KernelConfigService, "get">, log: Pick<KernelLogger, "warn">);
149
146
  private latest;
150
- /** The rows the org's catalog shows ({@link orgVisibleItems}); all of them without an org. */
151
- private visibleTo;
152
147
  /** The English documents of guides, by `<itemId>/<guideId>` (one PG read); absent when not stored. */
153
148
  private englishSources;
154
149
  /** The admin drift hash of a guide for a mode. */
@@ -13,13 +13,13 @@ import { Inject, Injectable } from "@nestjs/common";
13
13
  import { sql } from "kysely";
14
14
  import { readCatalogDisplayFiles } from "../catalog/catalog-content.js";
15
15
  import { readDisplayFiles } from "../catalog/catalog-files.js";
16
+ import { orgSees } from "../catalog/org-intent.js";
16
17
  import { ApiError } from "../errors.js";
17
18
  import { KernelConfigService } from "../infra/config/kernel-config.service.js";
18
19
  import { KernelDb } from "../infra/database/kernel-db.js";
19
20
  import { KERNEL_LOGGER } from "../infra/tokens.js";
20
21
  import { can, roleAtLeast } from "../orgs/roles.js";
21
22
  import { PLACE_ACTIONS, resolvePlace, } from "./guide-places.js";
22
- import { orgVisibleItems } from "./plugin-icons.js";
23
23
  export { PLACE_ACTIONS } from "./guide-places.js";
24
24
  const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
25
25
  const GUIDE_ID_RE = /^[a-z0-9][a-z0-9-]{0,63}$/;
@@ -28,26 +28,16 @@ const itemNotFound = () => new ApiError("catalog.item_not_found", "Catalog item
28
28
  const guideNotFound = () => new ApiError("catalog.guide_not_found", "The plugin has no such setup guide");
29
29
  const invalidQuery = (path, message) => new ApiError("validation_failed", "Request validation failed", [{ path, message }]);
30
30
  /** The live items (with their latest version) by name or id. */
31
- function latestItems(db, by, keys) {
32
- return db
31
+ function latestItems(db, by, keys, org) {
32
+ const query = db
33
33
  .selectFrom("catalog_items as i")
34
34
  .innerJoin("catalog_item_versions as v", (j) => j.onRef("v.item_id", "=", "i.id").onRef("v.version", "=", "i.latest_version"))
35
- .select([
36
- "i.id",
37
- "i.name",
38
- "i.scope",
39
- "i.builtin",
40
- "i.disabled",
41
- "i.shown_to_others",
42
- "i.owner_org_id",
43
- "i.shareable",
44
- "i.latest_version",
45
- "v.manifest",
46
- "v.files",
47
- ])
35
+ .select(["i.id", "i.name", "i.latest_version", "v.manifest", "v.files"])
48
36
  .where(by === "name" ? "i.name" : "i.id", "in", [...new Set(keys)])
49
- .where("i.deleted_at", "is", null)
50
- .execute();
37
+ .where("i.deleted_at", "is", null);
38
+ return (org === undefined
39
+ ? query
40
+ : query.where("i.id", "in", orgSees(db.db, org.orgId, roleAtLeast(org.role, "admin")).select("item.id"))).execute();
51
41
  }
52
42
  /** Whether a stored `setupGuides` entry is a v2 one (the SDK's strict shape). */
53
43
  function isV2Guide(g) {
@@ -95,7 +85,7 @@ const docMeta = (row, id, locale) => {
95
85
  * catalog item (the item of the same name, its latest version), renders a guide document for a
96
86
  * place, audience, mode and target with the place's safe variables (`guide-places.ts`; never a
97
87
  * secret), and computes the drift hashes targets record to tell when an upgrade changed their
98
- * setup. Org reads follow the catalog icon's visibility ({@link orgVisibleItems}), the platform
88
+ * setup. Org reads follow the catalog icon's visibility ({@link orgSees}), the platform
99
89
  * preview any live item. Stateless: everything comes from PG (version rows, target rows, the
100
90
  * documents in `catalog_files`).
101
91
  */
@@ -108,14 +98,8 @@ let PluginGuides = PluginGuides_1 = class PluginGuides {
108
98
  this.config = config;
109
99
  this.log = log;
110
100
  }
111
- latest(by, keys) {
112
- return latestItems(this.db, by, keys);
113
- }
114
- /** The rows the org's catalog shows ({@link orgVisibleItems}); all of them without an org. */
115
- visibleTo(rows, org) {
116
- return org === undefined
117
- ? rows
118
- : orgVisibleItems(this.db, rows, org.orgId, roleAtLeast(org.role, "admin"));
101
+ latest(by, keys, org) {
102
+ return latestItems(this.db, by, keys, org);
119
103
  }
120
104
  /** The English documents of guides, by `<itemId>/<guideId>` (one PG read); absent when not stored. */
121
105
  async englishSources(pairs) {
@@ -152,7 +136,7 @@ let PluginGuides = PluginGuides_1 = class PluginGuides {
152
136
  * also when the org's catalog does not show the item, the guide read's rule.
153
137
  */
154
138
  async currentAck(plugin, place, o) {
155
- const [row] = await this.visibleTo(await this.latest("name", [plugin]), o.org);
139
+ const [row] = await this.latest("name", [plugin], o.org);
156
140
  const guide = row && guideFor(row.manifest, place, o.templateId);
157
141
  if (!row || !guide)
158
142
  return null;
@@ -190,7 +174,7 @@ let PluginGuides = PluginGuides_1 = class PluginGuides {
190
174
  async templateAck(itemId, templateId, org) {
191
175
  if (!UUID_RE.test(itemId))
192
176
  return null;
193
- const [row] = await this.visibleTo(await this.latest("id", [itemId]), org);
177
+ const [row] = await this.latest("id", [itemId], org);
194
178
  const guide = row && guideFor(row.manifest, "connector-template", templateId);
195
179
  if (!row || !guide)
196
180
  return null;
@@ -235,9 +219,7 @@ let PluginGuides = PluginGuides_1 = class PluginGuides {
235
219
  const ids = [
236
220
  ...new Set(connectors.flatMap((c) => (c.itemId !== null && c.templateId !== null ? [c.itemId] : []))),
237
221
  ].filter((id) => UUID_RE.test(id));
238
- const rows = ids.length === 0
239
- ? []
240
- : await orgVisibleItems(this.db, await this.latest("id", ids), org.orgId, roleAtLeast(org.role, "admin"));
222
+ const rows = ids.length === 0 ? [] : await this.latest("id", ids, org);
241
223
  const byId = new Map(rows.map((r) => [r.id, r]));
242
224
  const guideOf = (c) => {
243
225
  const row = c.itemId === null ? undefined : byId.get(c.itemId);
@@ -356,10 +338,10 @@ let PluginGuides = PluginGuides_1 = class PluginGuides {
356
338
  const out = new Map();
357
339
  if (names.length === 0)
358
340
  return out;
359
- const rows = (await this.latest("name", names)).filter((r) => guideFor(r.manifest, place) !== undefined);
360
- const visible = await orgVisibleItems(this.db, rows, org.orgId, roleAtLeast(org.role, "admin"));
361
- for (const r of visible) {
341
+ for (const r of await this.latest("name", names, org)) {
362
342
  const guide = guideFor(r.manifest, place);
343
+ if (guide === undefined)
344
+ continue;
363
345
  out.set(r.name, {
364
346
  itemId: r.id,
365
347
  guideId: guide.id,
@@ -456,8 +438,7 @@ let PluginGuides = PluginGuides_1 = class PluginGuides {
456
438
  async render(org, itemId, guideId, q) {
457
439
  if (!UUID_RE.test(itemId))
458
440
  throw itemNotFound();
459
- const rows = await this.latest("id", [itemId]);
460
- const [row] = await orgVisibleItems(this.db, rows, org.orgId, roleAtLeast(org.role, "admin"));
441
+ const [row] = await this.latest("id", [itemId], org);
461
442
  if (!row)
462
443
  throw itemNotFound();
463
444
  this.warnSkipped(row);
@@ -1,5 +1,4 @@
1
1
  import { type CatalogIcon } from "../catalog/catalog-content.js";
2
- import { type PluginScope } from "../catalog/scope.js";
3
2
  import { type TemplateDescription } from "../catalog/template-description.js";
4
3
  import { KernelDb } from "../infra/database/kernel-db.js";
5
4
  import { type OrgRole } from "../orgs/roles.js";
@@ -23,23 +22,6 @@ export interface IconRef {
23
22
  templateId: string | null;
24
23
  itemId: string | null;
25
24
  }
26
- /** The catalog item columns {@link orgVisibleItems} reads. */
27
- export interface OrgVisibilityRow {
28
- id: string;
29
- scope: PluginScope;
30
- builtin: boolean;
31
- disabled: boolean;
32
- shown_to_others: boolean;
33
- owner_org_id: string | null;
34
- shareable: boolean;
35
- }
36
- /**
37
- * The rows of live catalog items the org's catalog shows (one query for the org's list rows):
38
- * members never see disabled items, an upload waiting for confirmation only its owner, another
39
- * org's item only when shareable or listed here (the share gate), a `named` item only its listed
40
- * orgs or as requestable. Shared by the plugin icons and the setup guides.
41
- */
42
- export declare function orgVisibleItems<T extends OrgVisibilityRow>(db: KernelDb, rows: T[], orgId: string, isAdmin: boolean): Promise<T[]>;
43
25
  /**
44
26
  * Plugin icons for the things a plugin brings (channels, extensions, model providers; maintainer
45
27
  * decision 2026-11-08): extension name -> the URL of its plugin's icon, the catalog item of the
@@ -49,7 +31,7 @@ export declare function orgVisibleItems<T extends OrgVisibilityRow>(db: KernelDb
49
31
  * its catalog shows (members never see disabled items, a `named` item only for its listed orgs or
50
32
  * as requestable, an org-owned item only for its owner or through the share gate, an upload
51
33
  * waiting for confirmation only for its owner). The URL carries the version, so a new icon is not
52
- * hidden by the browser cache. Stateless; one query per call (two for an org: its list rows).
34
+ * hidden by the browser cache. Stateless; one query for platform reads and a batched visibility projection for org reads.
53
35
  */
54
36
  export declare class PluginIcons {
55
37
  private readonly db;
@@ -127,11 +109,11 @@ export declare class PluginIcons {
127
109
  private sourceUrl;
128
110
  /** Template id -> its version, for the templates with an own icon the reader may see. */
129
111
  private templateIconVersions;
130
- /** Live platform connector templates (of live items) with their item's visibility columns. */
112
+ /** Live platform connector templates and their parent item IDs. */
131
113
  private templateRows;
132
114
  /**
133
115
  * The templates the reader may see: every one for the admin scope; for an org, those whose
134
- * plugin its catalog shows ({@link orgVisibleItems}) and that pass the template's own share gate
116
+ * plugin its catalog shows ({@link visibleCatalogRows}) and that pass the template's own share gate
135
117
  * (the platform's, the org's own, or shared by its owner).
136
118
  */
137
119
  private visibleTemplates;
@@ -10,8 +10,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
10
10
  import { Inject, Injectable } from "@nestjs/common";
11
11
  import { sql } from "kysely";
12
12
  import { readCatalogDisplayFiles, readCatalogIcon, } from "../catalog/catalog-content.js";
13
+ import { visibleCatalogRows } from "../catalog/org-intent.js";
13
14
  import { iconProblem } from "../catalog/plugin-package.js";
14
- import { requestable } from "../catalog/scope.js";
15
15
  import { templateDescription } from "../catalog/template-description.js";
16
16
  import { ApiError } from "../errors.js";
17
17
  import { KernelDb } from "../infra/database/kernel-db.js";
@@ -25,30 +25,6 @@ export const orgIconScope = (org) => ({
25
25
  isAdmin: roleAtLeast(org.role, "admin"),
26
26
  });
27
27
  const enc = encodeURIComponent;
28
- /**
29
- * The rows of live catalog items the org's catalog shows (one query for the org's list rows):
30
- * members never see disabled items, an upload waiting for confirmation only its owner, another
31
- * org's item only when shareable or listed here (the share gate), a `named` item only its listed
32
- * orgs or as requestable. Shared by the plugin icons and the setup guides.
33
- */
34
- export async function orgVisibleItems(db, rows, orgId, isAdmin) {
35
- if (rows.length === 0)
36
- return [];
37
- const listed = new Set((await db
38
- .selectFrom("catalog_item_scope_orgs")
39
- .select("item_id")
40
- .where("org_id", "=", orgId)
41
- .where("item_id", "in", rows.map((r) => r.id))
42
- .execute()).map((r) => r.item_id));
43
- return rows.filter((r) => {
44
- const inList = listed.has(r.id);
45
- const own = r.owner_org_id === orgId;
46
- return ((isAdmin || !r.disabled) &&
47
- // the share gate: another org's item reaches this org only when shareable or listed here
48
- (r.owner_org_id === null || own || r.shareable || inList) &&
49
- (r.builtin || r.scope !== "named" || inList || requestable(r, inList)));
50
- });
51
- }
52
28
  /**
53
29
  * Plugin icons for the things a plugin brings (channels, extensions, model providers; maintainer
54
30
  * decision 2026-11-08): extension name -> the URL of its plugin's icon, the catalog item of the
@@ -58,7 +34,7 @@ export async function orgVisibleItems(db, rows, orgId, isAdmin) {
58
34
  * its catalog shows (members never see disabled items, a `named` item only for its listed orgs or
59
35
  * as requestable, an org-owned item only for its owner or through the share gate, an upload
60
36
  * waiting for confirmation only for its owner). The URL carries the version, so a new icon is not
61
- * hidden by the browser cache. Stateless; one query per call (two for an org: its list rows).
37
+ * hidden by the browser cache. Stateless; one query for platform reads and a batched visibility projection for org reads.
62
38
  */
63
39
  let PluginIcons = class PluginIcons {
64
40
  db;
@@ -169,8 +145,9 @@ let PluginIcons = class PluginIcons {
169
145
  throw new ApiError("catalog.icon_not_found", "This connector has no icon");
170
146
  if (s.kind === "template")
171
147
  return this.readTemplateIcon(s.id, scope);
172
- // the item's visibility was decided above (the same gate as the plugin icon route)
173
- return readCatalogIcon(this.db.db, s.id, true);
148
+ return scope.kind === "org"
149
+ ? readCatalogIcon(this.db.db, s.id, scope.isAdmin, scope.orgId)
150
+ : readCatalogIcon(this.db.db, s.id, true);
174
151
  }
175
152
  /**
176
153
  * Reads a connector template's own icon (served only through kernel routes with nosniff and a
@@ -233,7 +210,7 @@ let PluginIcons = class PluginIcons {
233
210
  const rows = (await this.templateRows(ids)).filter((r) => r.iconFile !== undefined);
234
211
  return new Map((await this.visibleTemplates(rows, scope)).map((r) => [r.templateId, r.version]));
235
212
  }
236
- /** Live platform connector templates (of live items) with their item's visibility columns. */
213
+ /** Live platform connector templates and their parent item IDs. */
237
214
  async templateRows(ids) {
238
215
  const unique = [...new Set(ids)].filter((id) => UUID_RE.test(id));
239
216
  if (unique.length === 0)
@@ -251,12 +228,6 @@ let PluginIcons = class PluginIcons {
251
228
  sql `t.file->'description'`.as("description"),
252
229
  "v.files",
253
230
  "i.id",
254
- "i.scope",
255
- "i.builtin",
256
- "i.disabled",
257
- "i.shown_to_others",
258
- "i.owner_org_id",
259
- "i.shareable",
260
231
  ])
261
232
  .where("t.id", "in", unique)
262
233
  .where("t.deleted_at", "is", null)
@@ -275,7 +246,7 @@ let PluginIcons = class PluginIcons {
275
246
  }
276
247
  /**
277
248
  * The templates the reader may see: every one for the admin scope; for an org, those whose
278
- * plugin its catalog shows ({@link orgVisibleItems}) and that pass the template's own share gate
249
+ * plugin its catalog shows ({@link visibleCatalogRows}) and that pass the template's own share gate
279
250
  * (the platform's, the org's own, or shared by its owner).
280
251
  */
281
252
  async visibleTemplates(rows, scope) {
@@ -284,7 +255,7 @@ let PluginIcons = class PluginIcons {
284
255
  const shared = rows.filter((r) => r.template_owner_org_id === null ||
285
256
  r.template_owner_org_id === scope.orgId ||
286
257
  r.template_shareable);
287
- return orgVisibleItems(this.db, shared, scope.orgId, scope.isAdmin);
258
+ return visibleCatalogRows(this.db.db, shared, scope.orgId, scope.isAdmin);
288
259
  }
289
260
  async resolve(by, keys, scope) {
290
261
  const out = [];
@@ -297,12 +268,6 @@ let PluginIcons = class PluginIcons {
297
268
  .select([
298
269
  "i.id",
299
270
  "i.name",
300
- "i.scope",
301
- "i.builtin",
302
- "i.disabled",
303
- "i.shown_to_others",
304
- "i.owner_org_id",
305
- "i.shareable",
306
271
  "i.latest_version",
307
272
  sql `v.manifest->>'icon'`.as("icon"),
308
273
  "v.files",
@@ -325,7 +290,7 @@ let PluginIcons = class PluginIcons {
325
290
  }
326
291
  return out;
327
292
  }
328
- for (const r of await orgVisibleItems(this.db, withIcon, scope.orgId, scope.isAdmin)) {
293
+ for (const r of await visibleCatalogRows(this.db.db, withIcon, scope.orgId, scope.isAdmin)) {
329
294
  const url = `/api/v1/orgs/${enc(scope.orgId)}/catalog/${enc(r.id)}/icon?v=${enc(r.latest_version)}`;
330
295
  out.push({ id: r.id, name: r.name, url, version: r.latest_version });
331
296
  }
@@ -1,4 +1,5 @@
1
- import { type PluginScope } from "../catalog/scope.js";
1
+ import { type Expression } from "kysely";
2
+ import type { PluginScope } from "../catalog/scope.js";
2
3
  import type { KernelSchemaDb } from "../db/kernel-schema.js";
3
4
  /** The catalog item (the plugin) an extension ships in. */
4
5
  export interface ExtensionPluginItem {
@@ -7,6 +8,13 @@ export interface ExtensionPluginItem {
7
8
  builtin: boolean;
8
9
  disabled: boolean;
9
10
  }
11
+ /** All recorded sources, including retired items so they cannot masquerade as standalone. */
12
+ export declare function extensionSourcesQuery(db: KernelSchemaDb, plugin?: string | Expression<string>): import("kysely").SelectQueryBuilder<import("../db/kernel-schema.js").KernelDatabase & {
13
+ source_install: import("../db/kernel-schema.js").ExtensionInstallsTable;
14
+ }, "source_install", {
15
+ item_id: string;
16
+ plugin: string;
17
+ }>;
10
18
  /**
11
19
  * The live catalog items of each extension in `names`, the one recorded on its install
12
20
  * (`extension_installs.catalog_item_id`) first, then its other `extension_catalog_sources` by id.
@@ -23,35 +31,7 @@ export declare const itemLocked: (i: ExtensionPluginItem) => boolean;
23
31
  * The catalog item whose org install brings the extension into an org, or null when the
24
32
  * extension has no such plugin path: a required bootstrap plugin, a config-declared extension (no
25
33
  * live item), one several live items bring, and one whose item is builtin (on in every org without
26
- * an install). With a plugin path the extension's org switch needs that plugin installed in the
34
+ * an install). With a plugin path the extension's org switch needs that plugin usable in the
27
35
  * org (extension switch spec 2026-12-02 §3.1).
28
36
  */
29
37
  export declare function pluginPathItem(items: readonly ExtensionPluginItem[] | undefined, required: boolean): string | null;
30
- /**
31
- * Whether the extension's plugin is installed in the org, as the org's lists read it:
32
- * `installed` / `not_installed` for an extension with a plugin path ({@link pluginPathItem}), null
33
- * without one. `liveItems`: the items with a live install in the org ({@link liveInstalledItems}).
34
- */
35
- export declare function pluginInstallOf(items: readonly ExtensionPluginItem[] | undefined, required: boolean, liveItems: ReadonlySet<string>): "installed" | "not_installed" | null;
36
- /** The ids of the catalog items with a live install (installing or installed) in the org. */
37
- export declare function liveInstalledItems(db: KernelSchemaDb, orgId: string): Promise<Set<string>>;
38
- /**
39
- * Whether an org may see an extension with these live catalog items (`listed`: the items whose
40
- * `named` list has the org): one visible item is enough; without an item (config-declared, or its
41
- * items deleted) it is visible. A builtin item counts as `all`.
42
- */
43
- export declare function itemsVisible(items: readonly ExtensionPluginItem[] | undefined, listed: ReadonlySet<string>): boolean;
44
- /**
45
- * Whether the org's extension list shows an extension (`OrgExtensionConfigs.list`, which the org
46
- * readiness reads for the model providers an org admin can fix): a required bootstrap plugin
47
- * always; else under its catalog items' scope, and, while it is off in the org, only when none of
48
- * its items is disabled (nothing can newly enable it then, Ruling M-5; one already on stays).
49
- */
50
- export declare const offeredToOrg: (e: {
51
- required: boolean;
52
- enabled: boolean;
53
- items: readonly ExtensionPluginItem[] | undefined;
54
- listed: ReadonlySet<string>;
55
- }) => boolean;
56
- /** The ids of the catalog items whose `named` list has `orgId`. `db` may be a transaction. */
57
- export declare function scopeListedFor(db: KernelSchemaDb, orgId: string): Promise<Set<string>>;
@@ -1,5 +1,20 @@
1
- import { LIVE_INSTALL_STATUSES } from "../catalog/install-status.js";
2
- import { visibleTo } from "../catalog/scope.js";
1
+ import { sql } from "kysely";
2
+ /** All recorded sources, including retired items so they cannot masquerade as standalone. */
3
+ export function extensionSourcesQuery(db, plugin) {
4
+ const installed = db
5
+ .selectFrom("extension_installs as source_install")
6
+ .select(["source_install.name as plugin", "source_install.catalog_item_id as item_id"])
7
+ .where("source_install.catalog_item_id", "is not", null)
8
+ .$narrowType();
9
+ const associated = db
10
+ .selectFrom("extension_catalog_sources as source_catalog")
11
+ .select(["source_catalog.plugin", "source_catalog.item_id"]);
12
+ return plugin === undefined
13
+ ? installed.union(associated)
14
+ : installed
15
+ .where("source_install.name", "=", plugin)
16
+ .union(associated.where("source_catalog.plugin", "=", plugin));
17
+ }
3
18
  /**
4
19
  * The live catalog items of each extension in `names`, the one recorded on its install
5
20
  * (`extension_installs.catalog_item_id`) first, then its other `extension_catalog_sources` by id.
@@ -10,31 +25,23 @@ export async function pluginItemsOf(db, names) {
10
25
  const out = new Map();
11
26
  if (names.length === 0)
12
27
  return out;
13
- const add = (plugin, item) => {
14
- const list = out.get(plugin) ?? [];
15
- if (!list.some((i) => i.id === item.id))
16
- list.push(item);
17
- out.set(plugin, list);
18
- };
19
- const own = await db
20
- .selectFrom("extension_installs as e")
21
- .innerJoin("catalog_items as i", "i.id", "e.catalog_item_id")
22
- .select(["e.name as plugin", "i.id", "i.scope", "i.builtin", "i.disabled"])
23
- .where("e.name", "in", [...names])
24
- .where("i.deleted_at", "is", null)
25
- .execute();
26
- for (const r of own)
27
- add(r.plugin, r);
28
- const sources = await db
29
- .selectFrom("extension_catalog_sources as s")
30
- .innerJoin("catalog_items as i", "i.id", "s.item_id")
31
- .select(["s.plugin", "i.id", "i.scope", "i.builtin", "i.disabled"])
32
- .where("s.plugin", "in", [...names])
28
+ const rows = await db
29
+ .selectFrom(extensionSourcesQuery(db).as("source"))
30
+ .innerJoin("catalog_items as i", "i.id", "source.item_id")
31
+ .leftJoin("extension_installs as e", "e.name", "source.plugin")
32
+ .select(["source.plugin", "i.id", "i.scope", "i.builtin", "i.disabled"])
33
+ .where("source.plugin", "in", [...names])
33
34
  .where("i.deleted_at", "is", null)
35
+ .orderBy(sql `(i.id = e.catalog_item_id) desc nulls last`)
34
36
  .orderBy("i.id")
35
37
  .execute();
36
- for (const r of sources)
37
- add(r.plugin, r);
38
+ for (const { plugin, ...item } of rows) {
39
+ const sources = out.get(plugin);
40
+ if (sources === undefined)
41
+ out.set(plugin, [item]);
42
+ else
43
+ sources.push(item);
44
+ }
38
45
  return out;
39
46
  }
40
47
  /**
@@ -46,7 +53,7 @@ export const itemLocked = (i) => i.builtin;
46
53
  * The catalog item whose org install brings the extension into an org, or null when the
47
54
  * extension has no such plugin path: a required bootstrap plugin, a config-declared extension (no
48
55
  * live item), one several live items bring, and one whose item is builtin (on in every org without
49
- * an install). With a plugin path the extension's org switch needs that plugin installed in the
56
+ * an install). With a plugin path the extension's org switch needs that plugin usable in the
50
57
  * org (extension switch spec 2026-12-02 §3.1).
51
58
  */
52
59
  export function pluginPathItem(items, required) {
@@ -55,51 +62,3 @@ export function pluginPathItem(items, required) {
55
62
  const [only] = items;
56
63
  return only === undefined || itemLocked(only) ? null : only.id;
57
64
  }
58
- /**
59
- * Whether the extension's plugin is installed in the org, as the org's lists read it:
60
- * `installed` / `not_installed` for an extension with a plugin path ({@link pluginPathItem}), null
61
- * without one. `liveItems`: the items with a live install in the org ({@link liveInstalledItems}).
62
- */
63
- export function pluginInstallOf(items, required, liveItems) {
64
- const item = pluginPathItem(items, required);
65
- if (item === null)
66
- return null;
67
- return liveItems.has(item) ? "installed" : "not_installed";
68
- }
69
- /** The ids of the catalog items with a live install (installing or installed) in the org. */
70
- export async function liveInstalledItems(db, orgId) {
71
- const rows = await db
72
- .selectFrom("plugin_installs")
73
- .select("item_id")
74
- .where("org_id", "=", orgId)
75
- .where("status", "in", [...LIVE_INSTALL_STATUSES])
76
- .execute();
77
- return new Set(rows.map((r) => r.item_id));
78
- }
79
- /**
80
- * Whether an org may see an extension with these live catalog items (`listed`: the items whose
81
- * `named` list has the org): one visible item is enough; without an item (config-declared, or its
82
- * items deleted) it is visible. A builtin item counts as `all`.
83
- */
84
- export function itemsVisible(items, listed) {
85
- if (!items)
86
- return true;
87
- return items.some((i) => visibleTo({ scope: i.builtin ? "all" : i.scope }, listed.has(i.id)));
88
- }
89
- /**
90
- * Whether the org's extension list shows an extension (`OrgExtensionConfigs.list`, which the org
91
- * readiness reads for the model providers an org admin can fix): a required bootstrap plugin
92
- * always; else under its catalog items' scope, and, while it is off in the org, only when none of
93
- * its items is disabled (nothing can newly enable it then, Ruling M-5; one already on stays).
94
- */
95
- export const offeredToOrg = (e) => e.required ||
96
- (itemsVisible(e.items, e.listed) && (e.enabled || !(e.items ?? []).some((i) => i.disabled)));
97
- /** The ids of the catalog items whose `named` list has `orgId`. `db` may be a transaction. */
98
- export async function scopeListedFor(db, orgId) {
99
- const rows = await db
100
- .selectFrom("catalog_item_scope_orgs")
101
- .select("item_id")
102
- .where("org_id", "=", orgId)
103
- .execute();
104
- return new Set(rows.map((r) => r.item_id));
105
- }
@@ -1,8 +1,8 @@
1
1
  import { KernelDb } from "../infra/database/kernel-db.js";
2
2
  import { TransactionHost } from "../infra/database/transaction-host.js";
3
3
  import type { KernelLogger } from "../log.js";
4
- import { EffectiveConfigs } from "./effective-config.js";
5
4
  import { OrgExtensionConfigs } from "./org-config.js";
5
+ import { ExtensionPointServing, type PointProvider } from "./point-serving.js";
6
6
  import { ExtensionRegistry } from "./registry.js";
7
7
  /**
8
8
  * The outcome of {@link ExtensionPointDefaults.resolve}: the provider with its effective deployment
@@ -17,15 +17,7 @@ export type PointResolution<T> = {
17
17
  ok: false;
18
18
  reason: "none" | "ambiguous";
19
19
  };
20
- /**
21
- * One provider of a multi-provider extension point for an org ({@link ExtensionPointDefaults.providersFor}),
22
- * with its effective deployment config for the org, to pass back to it.
23
- */
24
- export interface PointProvider<T> {
25
- extension: string;
26
- impl: T;
27
- config: unknown;
28
- }
20
+ export type { PointProvider } from "./point-serving.js";
29
21
  /** One `org-default` extension point of an org (the admin view). */
30
22
  export interface OrgPointDefaultView {
31
23
  point: string;
@@ -50,9 +42,12 @@ export declare class ExtensionPointDefaults {
50
42
  readonly txHost: TransactionHost;
51
43
  private readonly registry;
52
44
  private readonly orgConfigs;
53
- private readonly effective;
45
+ /** One provider's candidacy (shared with the access checks, below the extensions module). */
46
+ private readonly serving;
54
47
  private readonly log;
55
- constructor(kdb: KernelDb, txHost: TransactionHost, registry: Pick<ExtensionRegistry, "list">, orgConfigs: Pick<OrgExtensionConfigs, "get">, effective: Pick<EffectiveConfigs, "get">, log: KernelLogger);
48
+ constructor(kdb: KernelDb, txHost: TransactionHost, registry: Pick<ExtensionRegistry, "list">, orgConfigs: Pick<OrgExtensionConfigs, "get">,
49
+ /** One provider's candidacy (shared with the access checks, below the extensions module). */
50
+ serving: Pick<ExtensionPointServing, "evaluate" | "serves" | "providerOf">, log: KernelLogger);
56
51
  /**
57
52
  * The provider of `point` (the name without the major, e.g. `web-search`) for `orgId`, with the
58
53
  * effective deployment config for the org to pass back to it. Throws when the point has no
@@ -94,19 +89,16 @@ export declare class ExtensionPointDefaults {
94
89
  */
95
90
  private candidates;
96
91
  /**
97
- * Whether the one provider `extension` of `point` evaluates as a candidate in `orgId`. The
98
- * provider must be loaded on this replica and provide `point`; the org must have it enabled; its
99
- * effective config must be valid; and its `configured()` must not return false.
100
- * These are exactly the criteria of {@link providersFor} / {@link resolve}, with only that one
101
- * provider evaluated. A provider whose status cannot be read counts as not serving (logged).
92
+ * Whether the one provider `extension` of `point` evaluates as a candidate in `orgId`: the
93
+ * criteria of {@link providersFor} / {@link resolve}, with only that provider evaluated
94
+ * ({@link ExtensionPointServing.serves}).
102
95
  */
103
96
  serves(orgId: string, point: string, extension: string): Promise<boolean>;
104
97
  /**
105
- * One enabled provider's candidacy: enabled, a valid effective config and `configured(config)`
106
- * not false. Undefined when it is off; a provider whose status could not be read is also added
107
- * to `failed`.
98
+ * The one provider `extension` of `point` when it {@link serves} `orgId` now (same criteria),
99
+ * with its implementation and effective config for the org; null otherwise.
108
100
  */
109
- private evaluate;
101
+ providerOf<T>(orgId: string, point: string, extension: string): Promise<PointProvider<T> | null>;
110
102
  private choose;
111
103
  /** The org's stored defaults, point → extension. */
112
104
  private storedDefaults;