@capybara-hq/kernel 0.1.0-rc.136 → 0.1.0-rc.138

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 (203) hide show
  1. package/dist/admin/audit-log.service.d.ts +96 -12
  2. package/dist/admin/audit-log.service.js +508 -44
  3. package/dist/admin/audit-targets.d.ts +17 -0
  4. package/dist/admin/audit-targets.js +84 -0
  5. package/dist/admin/audit.controller.d.ts +12 -9
  6. package/dist/admin/audit.controller.js +29 -8
  7. package/dist/admin/audit.schemas.d.ts +20 -4
  8. package/dist/admin/audit.schemas.js +42 -17
  9. package/dist/admin/extensions.controller.d.ts +5 -2
  10. package/dist/admin/extensions.controller.js +10 -1
  11. package/dist/admin/extensions.schemas.d.ts +4 -0
  12. package/dist/admin/extensions.schemas.js +9 -0
  13. package/dist/admin/health.service.d.ts +1 -1
  14. package/dist/admin/health.service.js +3 -3
  15. package/dist/agents/templates.js +3 -10
  16. package/dist/app.d.ts +3 -1
  17. package/dist/app.js +1 -0
  18. package/dist/automations/automations.service.js +4 -5
  19. package/dist/catalog/catalog-content.d.ts +6 -8
  20. package/dist/catalog/catalog-content.js +17 -22
  21. package/dist/catalog/catalog-items.d.ts +5 -10
  22. package/dist/catalog/catalog-items.js +27 -51
  23. package/dist/catalog/catalog-scope.service.d.ts +4 -2
  24. package/dist/catalog/catalog-scope.service.js +109 -145
  25. package/dist/catalog/catalog.module.js +7 -4
  26. package/dist/catalog/catalog.service.d.ts +10 -4
  27. package/dist/catalog/catalog.service.js +52 -10
  28. package/dist/catalog/cli.js +17 -0
  29. package/dist/catalog/component-promotion.js +8 -4
  30. package/dist/catalog/component-scope.service.d.ts +3 -1
  31. package/dist/catalog/component-scope.service.js +101 -140
  32. package/dist/catalog/component-state.d.ts +10 -8
  33. package/dist/catalog/component-state.js +42 -30
  34. package/dist/catalog/dependency-edges.d.ts +25 -0
  35. package/dist/catalog/dependency-edges.js +125 -0
  36. package/dist/catalog/effect-work.d.ts +27 -0
  37. package/dist/catalog/effect-work.js +151 -0
  38. package/dist/catalog/jobs.d.ts +4 -1
  39. package/dist/catalog/jobs.js +14 -4
  40. package/dist/catalog/org-catalog.service.d.ts +5 -1
  41. package/dist/catalog/org-catalog.service.js +101 -106
  42. package/dist/catalog/org-intent.d.ts +45 -0
  43. package/dist/catalog/org-intent.js +205 -0
  44. package/dist/catalog/owned-items.d.ts +6 -2
  45. package/dist/catalog/owned-items.js +27 -32
  46. package/dist/catalog/ownership.d.ts +2 -3
  47. package/dist/catalog/ownership.js +10 -28
  48. package/dist/catalog/platform-components.d.ts +3 -1
  49. package/dist/catalog/platform-components.js +9 -1
  50. package/dist/catalog/plugin-import.d.ts +4 -2
  51. package/dist/catalog/plugin-import.js +22 -21
  52. package/dist/catalog/plugin-install.d.ts +19 -54
  53. package/dist/catalog/plugin-install.js +221 -271
  54. package/dist/catalog/plugin-upgrade.d.ts +10 -5
  55. package/dist/catalog/plugin-upgrade.js +80 -67
  56. package/dist/catalog/request-rules.js +20 -8
  57. package/dist/catalog/scope-orgs.js +2 -7
  58. package/dist/catalog/scope-state.d.ts +6 -6
  59. package/dist/catalog/scope-state.js +24 -43
  60. package/dist/catalog/scope-sync-workers.d.ts +7 -11
  61. package/dist/catalog/scope-sync-workers.js +10 -26
  62. package/dist/catalog/scope-sync.d.ts +19 -116
  63. package/dist/catalog/scope-sync.js +228 -275
  64. package/dist/catalog/scope-writer.d.ts +87 -0
  65. package/dist/catalog/scope-writer.js +239 -0
  66. package/dist/catalog/template-connector-ensure.js +1 -1
  67. package/dist/catalog/unshare.js +9 -43
  68. package/dist/channels/connections.service.js +6 -6
  69. package/dist/channels/supervisor.js +3 -7
  70. package/dist/client/client-access.service.js +2 -12
  71. package/dist/config/schema.d.ts +6 -0
  72. package/dist/config/schema.js +32 -1
  73. package/dist/ctx/create-ctx.d.ts +2 -2
  74. package/dist/ctx/create-ctx.js +2 -60
  75. package/dist/ctx/guard-db.d.ts +6 -0
  76. package/dist/ctx/guard-db.js +55 -0
  77. package/dist/db/extension-handoff-schema.d.ts +1 -1
  78. package/dist/db/extension-handoff-schema.js +48 -10
  79. package/dist/db/extension-schema-transfer.js +5 -2
  80. package/dist/db/kernel-schema.d.ts +32 -6
  81. package/dist/device-access/host-services.d.ts +2 -2
  82. package/dist/device-access/host-services.js +5 -6
  83. package/dist/erasure/org-catalog.js +2 -2
  84. package/dist/erasure/org-rules.js +7 -0
  85. package/dist/extensions/admin-ops.d.ts +10 -6
  86. package/dist/extensions/admin-ops.js +53 -9
  87. package/dist/extensions/admin-view.d.ts +4 -1
  88. package/dist/extensions/admin-view.js +27 -14
  89. package/dist/extensions/bootstrap.d.ts +1 -1
  90. package/dist/extensions/bootstrap.js +6 -4
  91. package/dist/extensions/cli.js +1 -0
  92. package/dist/extensions/effective-config.js +1 -4
  93. package/dist/extensions/enabled.d.ts +183 -29
  94. package/dist/extensions/enabled.js +148 -62
  95. package/dist/extensions/host.d.ts +65 -45
  96. package/dist/extensions/host.js +446 -128
  97. package/dist/extensions/installs.d.ts +9 -0
  98. package/dist/extensions/installs.js +23 -0
  99. package/dist/extensions/isolated/admission.d.ts +10 -0
  100. package/dist/extensions/isolated/admission.js +206 -0
  101. package/dist/extensions/isolated/authorization.d.ts +45 -0
  102. package/dist/extensions/isolated/authorization.js +191 -0
  103. package/dist/extensions/isolated/broker.d.ts +15 -0
  104. package/dist/extensions/isolated/broker.js +471 -0
  105. package/dist/extensions/isolated/child-protocol.d.ts +84 -0
  106. package/dist/extensions/isolated/child-protocol.js +21 -0
  107. package/dist/extensions/isolated/child-registration.d.ts +22 -0
  108. package/dist/extensions/isolated/child-registration.js +152 -0
  109. package/dist/extensions/isolated/child-session.d.ts +6 -0
  110. package/dist/extensions/isolated/child-session.js +343 -0
  111. package/dist/extensions/isolated/child-streams.d.ts +4 -0
  112. package/dist/extensions/isolated/child-streams.js +142 -0
  113. package/dist/extensions/isolated/child.d.ts +1 -0
  114. package/dist/extensions/isolated/child.js +10 -0
  115. package/dist/extensions/isolated/configured-package.d.ts +15 -0
  116. package/dist/extensions/isolated/configured-package.js +73 -0
  117. package/dist/extensions/isolated/engine-binds.d.ts +9 -0
  118. package/dist/extensions/isolated/engine-binds.js +82 -0
  119. package/dist/extensions/isolated/engine-policy.d.ts +85 -0
  120. package/dist/extensions/isolated/engine-policy.js +75 -0
  121. package/dist/extensions/isolated/engine-proxy-main.d.ts +1 -0
  122. package/dist/extensions/isolated/engine-proxy-main.js +20 -0
  123. package/dist/extensions/isolated/engine-proxy.d.ts +7 -0
  124. package/dist/extensions/isolated/engine-proxy.js +408 -0
  125. package/dist/extensions/isolated/engine-vaults.d.ts +12 -0
  126. package/dist/extensions/isolated/engine-vaults.js +93 -0
  127. package/dist/extensions/isolated/lanes.d.ts +108 -0
  128. package/dist/extensions/isolated/lanes.js +726 -0
  129. package/dist/extensions/isolated/postgres-gate.d.ts +15 -0
  130. package/dist/extensions/isolated/postgres-gate.js +255 -0
  131. package/dist/extensions/isolated/revision.d.ts +32 -0
  132. package/dist/extensions/isolated/revision.js +359 -0
  133. package/dist/extensions/isolated/rpc-frame.d.ts +50 -0
  134. package/dist/extensions/isolated/rpc-frame.js +193 -0
  135. package/dist/extensions/isolated/rpc.d.ts +66 -0
  136. package/dist/extensions/isolated/rpc.js +314 -0
  137. package/dist/extensions/isolated/sandbox.d.ts +39 -0
  138. package/dist/extensions/isolated/sandbox.js +356 -0
  139. package/dist/extensions/isolated/tier.d.ts +6 -0
  140. package/dist/extensions/isolated/tier.js +45 -0
  141. package/dist/extensions/ledger.d.ts +1 -1
  142. package/dist/extensions/lifecycle-topics.d.ts +2 -0
  143. package/dist/extensions/lifecycle-topics.js +2 -0
  144. package/dist/extensions/lifecycle.d.ts +3 -1
  145. package/dist/extensions/lifecycle.js +53 -5
  146. package/dist/extensions/locks.d.ts +2 -0
  147. package/dist/extensions/locks.js +7 -0
  148. package/dist/extensions/org-config.d.ts +17 -27
  149. package/dist/extensions/org-config.js +114 -129
  150. package/dist/extensions/permission-view.d.ts +6 -1
  151. package/dist/extensions/plugin-guides.d.ts +5 -10
  152. package/dist/extensions/plugin-guides.js +18 -37
  153. package/dist/extensions/plugin-icons.d.ts +3 -21
  154. package/dist/extensions/plugin-icons.js +9 -44
  155. package/dist/extensions/plugin-items.d.ts +10 -30
  156. package/dist/extensions/plugin-items.js +32 -73
  157. package/dist/extensions/source-intent.d.ts +14 -0
  158. package/dist/extensions/source-intent.js +77 -0
  159. package/dist/inbox/platform-inbox.service.js +16 -27
  160. package/dist/index.d.ts +2 -1
  161. package/dist/index.js +2 -1
  162. package/dist/infra/database/database.module.js +6 -1
  163. package/dist/infra/database/kernel-db.d.ts +3 -1
  164. package/dist/infra/database/kernel-db.js +4 -0
  165. package/dist/infra/events/kernel-events.d.ts +4 -0
  166. package/dist/infra/outbox/registry.d.ts +3 -36
  167. package/dist/infra/outbox/registry.js +4 -49
  168. package/dist/infra/paging/paged-read.d.ts +56 -0
  169. package/dist/infra/paging/paged-read.js +78 -0
  170. package/dist/infra/queue/queue-names.d.ts +1 -1
  171. package/dist/infra/queue/queue-names.js +1 -1
  172. package/dist/kernel.d.ts +3 -2
  173. package/dist/kernel.js +21 -2
  174. package/dist/lifecycle/kernel-lifecycle.d.ts +3 -1
  175. package/dist/lifecycle/kernel-lifecycle.js +22 -12
  176. package/dist/lifecycle/tokens.d.ts +8 -0
  177. package/dist/lifecycle/tokens.js +2 -0
  178. package/dist/orgs/directory-sync.js +1 -4
  179. package/dist/orgs/org-lock.d.ts +3 -1
  180. package/dist/orgs/org-lock.js +3 -1
  181. package/dist/orgs/orgs.service.d.ts +3 -1
  182. package/dist/orgs/orgs.service.js +15 -8
  183. package/dist/overrides.d.ts +0 -3
  184. package/dist/overrides.js +0 -2
  185. package/dist/platform/ops/admin.ops.js +14 -3
  186. package/dist/platform/ops/extensions-admin.ops.js +20 -3
  187. package/dist/platform/ops/org-plugins.ops.js +5 -2
  188. package/dist/platform/ops/orgs.ops.js +13 -3
  189. package/dist/platform/ops/plugins.ops.js +11 -10
  190. package/dist/setup/setup-checks.service.js +3 -2
  191. package/dist/skills/usable.js +41 -30
  192. package/dist/themes/theme-state.js +3 -3
  193. package/dist/tools/registry.d.ts +2 -2
  194. package/dist/tools/registry.js +7 -3
  195. package/package.json +2 -2
  196. package/src/migrations/0228_extension_org_switches.sql +56 -0
  197. package/src/migrations/0229_catalog_dependency_edges.sql +17 -0
  198. package/src/migrations/0230_audit_filter_idx.sql +18 -0
  199. package/src/migrations/0231_plugin_effect_work.sql +171 -0
  200. package/dist/catalog/install-status.d.ts +0 -6
  201. package/dist/catalog/install-status.js +0 -6
  202. package/dist/catalog/scope-jobs.d.ts +0 -59
  203. package/dist/catalog/scope-jobs.js +0 -78
@@ -0,0 +1,84 @@
1
+ /** Exact action names, checked before {@link PREFIXES}. */
2
+ const EXACT = {
3
+ "org.created": "org",
4
+ "org.deleted": "org",
5
+ "org.updated": "org",
6
+ "org.settings_updated": "org",
7
+ "org.security_updated": "org",
8
+ "org.ownership_transferred": "account",
9
+ "deployment.setup_completed": "account",
10
+ "catalog.imported": "catalog_item",
11
+ "catalog.scope_changed": "catalog_item",
12
+ "catalog.shown_changed": "catalog_item",
13
+ "catalog.shareable_changed": "catalog_item",
14
+ "catalog.ownership_transferred": "catalog_item",
15
+ "catalog.removed": "catalog_item",
16
+ "plugin.platform_updated": "catalog_item",
17
+ "plugin.platform_update_failed": "catalog_item",
18
+ "plugin.scope_sync_failed": "catalog_item",
19
+ "plugin.org_installed": "plugin_install",
20
+ "plugin.org_uninstalled": "plugin_install",
21
+ "plugin.org_install_failed": "plugin_install",
22
+ "login_sources.updated": "extension",
23
+ "tool_grant.revoked": "agent",
24
+ "subagent.refused": "agent",
25
+ "automation.created": "automation",
26
+ "automation.deleted": "automation",
27
+ "automation.grants_changed": "automation",
28
+ "automation.paused": "automation",
29
+ "automation.resumed": "automation",
30
+ "automation.run_now": "automation",
31
+ "automation.updated": "automation",
32
+ "browser.view": "device",
33
+ "browser.view_closed": "device",
34
+ "permission.crossing_auto_granted": "device",
35
+ "skill.created": "skill",
36
+ "skill.deleted": "skill",
37
+ "skill.shared": "skill",
38
+ "skill.share_requested": "skill",
39
+ "skill.version_created": "skill",
40
+ "skill.version_reverted": "skill",
41
+ "eval.set_created": "eval_set",
42
+ "eval.set_updated": "eval_set",
43
+ "eval.set_deleted": "eval_set",
44
+ "eval.case_added": "eval_set",
45
+ "eval.case_removed": "eval_set",
46
+ };
47
+ /** Action prefixes whose every action targets one kind (the first match wins). */
48
+ const PREFIXES = [
49
+ ["account.", "account"],
50
+ ["identity.", "account"],
51
+ ["org.member.", "account"],
52
+ ["org.service_token.", "service_token"],
53
+ ["org.plugin_config.", "extension"],
54
+ ["org.directory.", "extension"],
55
+ ["extension.", "extension"],
56
+ ["connector.", "connector"],
57
+ ["agent.", "agent"],
58
+ ["agent_template.", "agent_template"],
59
+ ["device.", "device"],
60
+ ["channel.", "channel"],
61
+ ["marketplace.", "marketplace"],
62
+ ];
63
+ /** The kind of object `action`'s target names, or null when the log cannot name it. */
64
+ export function auditTargetKind(action) {
65
+ const exact = EXACT[action];
66
+ if (exact !== undefined)
67
+ return exact;
68
+ for (const [prefix, kind] of PREFIXES)
69
+ if (action.startsWith(prefix))
70
+ return kind;
71
+ return null;
72
+ }
73
+ /**
74
+ * The action conditions of one kind, for SQL: its exact names and its prefixes (the inverse of
75
+ * {@link auditTargetKind}, used to match `q` against names of that kind).
76
+ */
77
+ export function auditKindActions(kind) {
78
+ return {
79
+ exact: Object.entries(EXACT)
80
+ .filter(([, k]) => k === kind)
81
+ .map(([a]) => a),
82
+ prefixes: PREFIXES.filter(([, k]) => k === kind).map(([p]) => p),
83
+ };
84
+ }
@@ -1,26 +1,29 @@
1
1
  import type { z } from "zod";
2
2
  import { type OrgContext } from "../orgs/org.guard.js";
3
- import { AuditListQuery, OrgAuditListQuery } from "./audit.schemas.js";
4
- import { AuditLogService, type AuditPage } from "./audit-log.service.js";
3
+ import { AuditActorsQuery, AuditListQuery, OrgAuditActorsQuery, OrgAuditListQuery } from "./audit.schemas.js";
4
+ import { type AuditActors, AuditLogService, type AuditPage } from "./audit-log.service.js";
5
5
  /**
6
6
  * The platform-level audit log (`GET /api/v1/admin/audit`, admin overview spec §5.2, decision D2):
7
- * events with no org, or with `orgId` that org's, newest first, keyset paged; never an event's
8
- * `detail`. Super admins only; the read itself is not audited (D5).
7
+ * events with no org, or with `orgId` that org's, newest first, by page number on a snapshot with
8
+ * filters (table pagination spec §2.3, §3); never an event's `detail`. Super admins only; the read
9
+ * itself is not audited (D5).
9
10
  */
10
11
  export declare class AdminAuditController {
11
12
  private readonly audit;
12
13
  constructor(audit: AuditLogService);
13
- /** `next` is the `after` of the next page, null at the end. */
14
14
  list(q: z.infer<typeof AuditListQuery>): Promise<AuditPage>;
15
+ /** The accounts and tokens that acted in the log (the actor filter's options). */
16
+ actors(q: z.infer<typeof AuditActorsQuery>): Promise<AuditActors>;
15
17
  }
16
18
  /**
17
- * The org's audit log (`GET /api/v1/orgs/:orgId/audit`): the org's own events, newest first,
18
- * keyset paged, the same rows as the platform log (never `detail`). Org admins (`org.update`, a
19
- * person: service tokens are refused); a non-member gets 404. The read is not audited.
19
+ * The org's audit log (`GET /api/v1/orgs/:orgId/audit`): the org's own events, newest first, by
20
+ * page number with filters, the same rows as the platform log (never `detail`). Org admins
21
+ * (`org.update`, a person: service tokens are refused); a non-member gets 404. Not audited.
20
22
  */
21
23
  export declare class OrgAuditController {
22
24
  private readonly audit;
23
25
  constructor(audit: AuditLogService);
24
- /** `next` is the `after` of the next page, null at the end. */
25
26
  list(org: OrgContext, q: z.infer<typeof OrgAuditListQuery>): Promise<AuditPage>;
27
+ /** The accounts and service tokens that acted in the org's log (the actor filter's options). */
28
+ actors(org: OrgContext, _q: z.infer<typeof OrgAuditActorsQuery>): Promise<AuditActors>;
26
29
  }
@@ -12,32 +12,44 @@ import { SuperAdmin } from "../identity/principal.js";
12
12
  import { createZodDto } from "../infra/validation/create-zod-dto.js";
13
13
  import { ZQuery } from "../infra/validation/zod-params.js";
14
14
  import { CurrentOrg, OrgAction } from "../orgs/org.guard.js";
15
- import { AuditListQuery, OrgAuditListQuery } from "./audit.schemas.js";
15
+ import { AuditActorsQuery, AuditListQuery, OrgAuditActorsQuery, OrgAuditListQuery, } from "./audit.schemas.js";
16
16
  import { AuditLogService } from "./audit-log.service.js";
17
17
  class AuditListQueryDto extends createZodDto(AuditListQuery, "AuditListQuery") {
18
18
  }
19
19
  class OrgAuditListQueryDto extends createZodDto(OrgAuditListQuery, "OrgAuditListQuery") {
20
20
  }
21
+ class AuditActorsQueryDto extends createZodDto(AuditActorsQuery, "AuditActorsQuery") {
22
+ }
23
+ class OrgAuditActorsQueryDto extends createZodDto(OrgAuditActorsQuery, "OrgAuditActorsQuery") {
24
+ }
21
25
  /**
22
26
  * The platform-level audit log (`GET /api/v1/admin/audit`, admin overview spec §5.2, decision D2):
23
- * events with no org, or with `orgId` that org's, newest first, keyset paged; never an event's
24
- * `detail`. Super admins only; the read itself is not audited (D5).
27
+ * events with no org, or with `orgId` that org's, newest first, by page number on a snapshot with
28
+ * filters (table pagination spec §2.3, §3); never an event's `detail`. Super admins only; the read
29
+ * itself is not audited (D5).
25
30
  */
26
31
  let AdminAuditController = class AdminAuditController {
27
32
  audit;
28
33
  constructor(audit) {
29
34
  this.audit = audit;
30
35
  }
31
- /** `next` is the `after` of the next page, null at the end. */
32
36
  list(q) {
33
37
  const { orgId, ...page } = q;
34
38
  return this.audit.list(orgId === undefined ? { platform: true } : { orgId }, page);
35
39
  }
40
+ /** The accounts and tokens that acted in the log (the actor filter's options). */
41
+ actors(q) {
42
+ return this.audit.actors(q.orgId === undefined ? { platform: true } : { orgId: q.orgId });
43
+ }
36
44
  };
37
45
  __decorate([
38
46
  Get(),
39
47
  __param(0, ZQuery(AuditListQueryDto))
40
48
  ], AdminAuditController.prototype, "list", null);
49
+ __decorate([
50
+ Get("actors"),
51
+ __param(0, ZQuery(AuditActorsQueryDto))
52
+ ], AdminAuditController.prototype, "actors", null);
41
53
  AdminAuditController = __decorate([
42
54
  Controller("api/v1/admin/audit"),
43
55
  SuperAdmin(),
@@ -45,19 +57,22 @@ AdminAuditController = __decorate([
45
57
  ], AdminAuditController);
46
58
  export { AdminAuditController };
47
59
  /**
48
- * The org's audit log (`GET /api/v1/orgs/:orgId/audit`): the org's own events, newest first,
49
- * keyset paged, the same rows as the platform log (never `detail`). Org admins (`org.update`, a
50
- * person: service tokens are refused); a non-member gets 404. The read is not audited.
60
+ * The org's audit log (`GET /api/v1/orgs/:orgId/audit`): the org's own events, newest first, by
61
+ * page number with filters, the same rows as the platform log (never `detail`). Org admins
62
+ * (`org.update`, a person: service tokens are refused); a non-member gets 404. Not audited.
51
63
  */
52
64
  let OrgAuditController = class OrgAuditController {
53
65
  audit;
54
66
  constructor(audit) {
55
67
  this.audit = audit;
56
68
  }
57
- /** `next` is the `after` of the next page, null at the end. */
58
69
  list(org, q) {
59
70
  return this.audit.list({ orgId: org.orgId }, q);
60
71
  }
72
+ /** The accounts and service tokens that acted in the org's log (the actor filter's options). */
73
+ actors(org, _q) {
74
+ return this.audit.actors({ orgId: org.orgId });
75
+ }
61
76
  };
62
77
  __decorate([
63
78
  Get(),
@@ -65,6 +80,12 @@ __decorate([
65
80
  __param(0, CurrentOrg()),
66
81
  __param(1, ZQuery(OrgAuditListQueryDto))
67
82
  ], OrgAuditController.prototype, "list", null);
83
+ __decorate([
84
+ Get("actors"),
85
+ OrgAction("org.update"),
86
+ __param(0, CurrentOrg()),
87
+ __param(1, ZQuery(OrgAuditActorsQueryDto))
88
+ ], OrgAuditController.prototype, "actors", null);
68
89
  OrgAuditController = __decorate([
69
90
  Controller("api/v1/orgs/:orgId/audit"),
70
91
  __param(0, Inject(AuditLogService))
@@ -2,15 +2,31 @@ import { z } from "zod";
2
2
  import type { RouteSchemas } from "../platform/route-schemas.js";
3
3
  /** `GET /api/v1/admin/audit`: the platform's events, or with `orgId` that org's. */
4
4
  export declare const AuditListQuery: z.ZodObject<{
5
- after: z.ZodOptional<z.ZodString>;
6
- limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
5
+ page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
6
+ size: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
7
+ from: z.ZodOptional<z.ZodISODateTime>;
8
+ to: z.ZodOptional<z.ZodISODateTime>;
9
+ actor: z.ZodOptional<z.ZodString>;
7
10
  action: z.ZodOptional<z.ZodString>;
11
+ q: z.ZodOptional<z.ZodString>;
12
+ asOf: z.ZodOptional<z.ZodString>;
8
13
  orgId: z.ZodOptional<z.ZodString>;
9
14
  }, z.core.$strip>;
10
15
  /** `GET /api/v1/orgs/:orgId/audit`: the org's own events (org admins). */
11
16
  export declare const OrgAuditListQuery: z.ZodObject<{
12
- after: z.ZodOptional<z.ZodString>;
13
- limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
17
+ page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
18
+ size: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
19
+ from: z.ZodOptional<z.ZodISODateTime>;
20
+ to: z.ZodOptional<z.ZodISODateTime>;
21
+ actor: z.ZodOptional<z.ZodString>;
14
22
  action: z.ZodOptional<z.ZodString>;
23
+ q: z.ZodOptional<z.ZodString>;
24
+ asOf: z.ZodOptional<z.ZodString>;
15
25
  }, z.core.$strip>;
26
+ /** `GET /api/v1/admin/audit/actors`: who acted in the platform's log, or with `orgId` an org's. */
27
+ export declare const AuditActorsQuery: z.ZodObject<{
28
+ orgId: z.ZodOptional<z.ZodString>;
29
+ }, z.core.$strip>;
30
+ /** `GET /api/v1/orgs/:orgId/audit/actors`: who acted in the org's log. */
31
+ export declare const OrgAuditActorsQuery: z.ZodObject<{}, z.core.$strip>;
16
32
  export declare const AUDIT_ROUTES: readonly RouteSchemas[];
@@ -1,37 +1,62 @@
1
1
  import { z } from "zod";
2
- /** The largest `bigserial` id; a larger `after` would make PG refuse the comparison. */
3
- const MAX_BIGINT = 9223372036854775807n;
2
+ import { bigserialAsOf, PageQueryFields } from "../infra/paging/paged-read.js";
3
+ /** `orgId` of the platform routes: read that org's log instead of the platform's. */
4
+ const OrgIdField = z
5
+ .string()
6
+ .min(1)
7
+ .max(100)
8
+ .optional()
9
+ .describe("Read this org's events instead of the platform's.");
4
10
  /**
5
- * A page of an audit log: keyset paging by event id, newest first (admin overview spec §5.2), and
6
- * an optional action prefix.
11
+ * The filters of an audit log (table pagination spec §3), combined with AND. `from` / `to` are a
12
+ * half-open time range (`from <= at < to`).
7
13
  */
8
- const AuditPageQuery = z.object({
9
- after: z
14
+ const AuditFilterFields = {
15
+ from: z.iso
16
+ .datetime({ offset: true })
17
+ .optional()
18
+ .describe("Only events at or after this time (ISO 8601)."),
19
+ to: z.iso
20
+ .datetime({ offset: true })
21
+ .optional()
22
+ .describe("Only events before this time (ISO 8601)."),
23
+ actor: z
10
24
  .string()
11
- .regex(/^\d{1,19}$/, "after must be an event id (digits)")
12
- // checks do not abort: only digits reach BigInt
13
- .refine((v) => !/^\d{1,19}$/.test(v) || BigInt(v) <= MAX_BIGINT, "after must be an event id")
25
+ .min(1)
26
+ .max(120)
27
+ .regex(/^[A-Za-z0-9_.:-]+$/, "actor must be an account id, system or token:<token id>")
14
28
  .optional()
15
- .describe("The id of the last event of the previous page (its next); absent: the newest."),
16
- limit: z.coerce.number().int().min(1).max(100).default(20),
29
+ .describe("Only events by this actor: an account id, system (the kernel itself: no account and no token), or token:<token id> (done with that access token)."),
17
30
  action: z
18
31
  .string()
19
32
  .regex(/^[a-z][a-z0-9_.]{0,63}$/, "action must be an action name or its prefix (a-z 0-9 _ .)")
20
33
  .optional()
21
34
  .describe("Only actions starting with this, e.g. connector. or org.member.added."),
22
- });
23
- /** `GET /api/v1/admin/audit`: the platform's events, or with `orgId` that org's. */
24
- export const AuditListQuery = AuditPageQuery.extend({
25
- orgId: z
35
+ q: z
26
36
  .string()
37
+ .trim()
27
38
  .min(1)
28
- .max(100)
39
+ .max(200)
29
40
  .optional()
30
- .describe("Read this org's events instead of the platform's."),
41
+ .describe("Only events whose target is exactly this id, or whose target's name contains it (case-insensitive): accounts, orgs, plugins, extensions, connectors, agents, agent templates, automations, devices, skills, channels, eval sets, service tokens, marketplaces."),
42
+ };
43
+ /** A page of an audit log: page numbers on a snapshot of event ids (spec §2.3), and the filters. */
44
+ const AuditPageQuery = z.object({
45
+ ...PageQueryFields,
46
+ asOf: bigserialAsOf("an event id"),
47
+ ...AuditFilterFields,
31
48
  });
49
+ /** `GET /api/v1/admin/audit`: the platform's events, or with `orgId` that org's. */
50
+ export const AuditListQuery = AuditPageQuery.extend({ orgId: OrgIdField });
32
51
  /** `GET /api/v1/orgs/:orgId/audit`: the org's own events (org admins). */
33
52
  export const OrgAuditListQuery = AuditPageQuery;
53
+ /** `GET /api/v1/admin/audit/actors`: who acted in the platform's log, or with `orgId` an org's. */
54
+ export const AuditActorsQuery = z.object({ orgId: OrgIdField });
55
+ /** `GET /api/v1/orgs/:orgId/audit/actors`: who acted in the org's log. */
56
+ export const OrgAuditActorsQuery = z.object({});
34
57
  export const AUDIT_ROUTES = [
35
58
  { route: "GET /api/v1/admin/audit", query: AuditListQuery },
36
59
  { route: "GET /api/v1/orgs/:orgId/audit", query: OrgAuditListQuery },
60
+ { route: "GET /api/v1/admin/audit/actors", query: AuditActorsQuery },
61
+ { route: "GET /api/v1/orgs/:orgId/audit/actors", query: OrgAuditActorsQuery },
37
62
  ];
@@ -4,14 +4,14 @@ import { ExtensionAdmin } from "../extensions/admin-view.js";
4
4
  import { type DeploymentConfigView, ExtensionDeploymentConfigService } from "../extensions/deployment-config.js";
5
5
  import { ExtensionInstalls, type PackageReview } from "../extensions/installs.js";
6
6
  import { type OrgOverrideSummary, OrgOverrides } from "../extensions/org-overrides.js";
7
- import type { AdminExtensionView } from "../extensions/permission-view.js";
7
+ import type { AdminExtensionView, ExtensionOrgCounts } from "../extensions/permission-view.js";
8
8
  import { PluginGuides, type RenderedSetupGuide } from "../extensions/plugin-guides.js";
9
9
  import { type Principal } from "../identity/principal.js";
10
10
  import { KernelConfigService } from "../infra/config/kernel-config.service.js";
11
11
  import type { SetupCheckState } from "../setup/setup-check-registry.js";
12
12
  import { DeploymentCheckPathParams, DeploymentCheckRunBody, DeploymentGuidePathParams, DeploymentGuidesPathParams, DeploymentGuidesQuery } from "../setup/setup-checks.schemas.js";
13
13
  import { SetupChecksService } from "../setup/setup-checks.service.js";
14
- import { AdminExtensionConfigBody } from "./extensions.schemas.js";
14
+ import { AdminExtensionConfigBody, AdminExtensionOrgCountsQuery } from "./extensions.schemas.js";
15
15
  declare const ApproveSchema: z.ZodObject<{
16
16
  sha256: z.ZodNullable<z.ZodString>;
17
17
  reviewHash: z.ZodString;
@@ -52,6 +52,9 @@ export declare class AdminExtensionsController {
52
52
  extensions: AdminExtensionView[];
53
53
  drainSeconds: number;
54
54
  }>;
55
+ counts(query: z.infer<typeof AdminExtensionOrgCountsQuery>): Promise<{
56
+ counts: ExtensionOrgCounts[];
57
+ }>;
55
58
  /** A single extension; unknown -> 404 `extension.not_found`. */
56
59
  get(name: string): Promise<AdminExtensionView>;
57
60
  /**
@@ -23,7 +23,7 @@ import { createZodDto } from "../infra/validation/create-zod-dto.js";
23
23
  import { ZBody, ZParam, ZQuery } from "../infra/validation/zod-params.js";
24
24
  import { DeploymentCheckPathParams, DeploymentCheckRunBody, DeploymentGuidePathParams, DeploymentGuidesPathParams, DeploymentGuidesQuery, } from "../setup/setup-checks.schemas.js";
25
25
  import { SetupChecksService } from "../setup/setup-checks.service.js";
26
- import { AdminExtensionConfigBody } from "./extensions.schemas.js";
26
+ import { AdminExtensionConfigBody, AdminExtensionOrgCountsQuery } from "./extensions.schemas.js";
27
27
  const ApproveSchema = z.object({
28
28
  /** 安装记录的包(审阅时的 sha256);配置声明的插件为 null。 */
29
29
  sha256: z
@@ -46,6 +46,8 @@ class ExtensionInstallBody extends createZodDto(InstallSchema, "ExtensionInstall
46
46
  }
47
47
  class ExtensionConfigBody extends createZodDto(AdminExtensionConfigBody, "ExtensionConfigBody") {
48
48
  }
49
+ class ExtensionOrgCountsQuery extends createZodDto(AdminExtensionOrgCountsQuery, "ExtensionOrgCountsQuery") {
50
+ }
49
51
  class ExtensionNpmImportBody extends createZodDto(NpmSchema, "ExtensionNpmImportBody") {
50
52
  }
51
53
  /** The `:name` route parameter of the org-overrides list (decision R20). */
@@ -100,6 +102,9 @@ let AdminExtensionsController = class AdminExtensionsController {
100
102
  drainSeconds: this.kernelConfig.get().extensionHost.drainSeconds,
101
103
  };
102
104
  }
105
+ async counts(query) {
106
+ return { counts: await this.admin.orgCounts(query.names.split(",")) };
107
+ }
103
108
  /** A single extension; unknown -> 404 `extension.not_found`. */
104
109
  get(name) {
105
110
  return this.admin.get(name);
@@ -244,6 +249,10 @@ let AdminExtensionsController = class AdminExtensionsController {
244
249
  __decorate([
245
250
  Get()
246
251
  ], AdminExtensionsController.prototype, "list", null);
252
+ __decorate([
253
+ Get("counts/orgs"),
254
+ __param(0, ZQuery(ExtensionOrgCountsQuery))
255
+ ], AdminExtensionsController.prototype, "counts", null);
247
256
  __decorate([
248
257
  Get(":name"),
249
258
  __param(0, Param("name"))
@@ -25,4 +25,8 @@ export declare const AdminExtensionConfigBody: z.ZodObject<{
25
25
  renameFrom: z.ZodOptional<z.ZodString>;
26
26
  }, z.core.$strict>>>;
27
27
  }, z.core.$strip>;
28
+ export declare const EXTENSION_ORG_COUNT_PAGE_SIZE = 20;
29
+ export declare const AdminExtensionOrgCountsQuery: z.ZodObject<{
30
+ names: z.ZodString;
31
+ }, z.core.$strict>;
28
32
  export declare const ADMIN_EXTENSION_ROUTES: readonly RouteSchemas[];
@@ -31,10 +31,19 @@ export const AdminExtensionConfigBody = z.object({
31
31
  /** Single keys of hinted secret records (extension config forms spec §4.3), applied in order. */
32
32
  secretEntries: z.array(AdminExtensionSecretEntry).max(200).optional(),
33
33
  });
34
+ export const EXTENSION_ORG_COUNT_PAGE_SIZE = 20;
35
+ export const AdminExtensionOrgCountsQuery = z
36
+ .object({
37
+ names: z
38
+ .string()
39
+ .regex(/^[a-z0-9][a-z0-9_-]{0,63}(,[a-z0-9][a-z0-9_-]{0,63}){0,19}$/, "Pass one to 20 comma-separated extension names"),
40
+ })
41
+ .strict();
34
42
  export const ADMIN_EXTENSION_ROUTES = [
35
43
  // the extension package is the raw body (no schema)
36
44
  { route: "POST /api/v1/admin/extensions/packages/file" },
37
45
  { route: "GET /api/v1/admin/extensions" },
46
+ { route: "GET /api/v1/admin/extensions/counts/orgs", query: AdminExtensionOrgCountsQuery },
38
47
  { route: "GET /api/v1/admin/extensions/:name", params: AdminExtensionNamePathParams },
39
48
  { route: "POST /api/v1/admin/extensions/:name/enable", params: AdminExtensionNamePathParams },
40
49
  { route: "POST /api/v1/admin/extensions/:name/disable", params: AdminExtensionNamePathParams },
@@ -5,7 +5,7 @@ import { type LiveReplica, ReplicaPresence } from "../infra/presence/replica-pre
5
5
  import type { KernelLogger } from "../log.js";
6
6
  import { DeviceProviders } from "../sandbox/providers.js";
7
7
  /** The kernel's own queues, in the order the overview lists them (extension queues are not read). */
8
- export declare const KERNEL_QUEUE_NAMES: readonly ["cap-kernel-runs", "cap-kernel-subagent-runs", "cap-kernel-channels", "cap-kernel-maintenance", "cap-kernel-tool-watch", "cap-kernel-plugin-scope", "cap-kernel-titles", "cap-kernel-suggestions", "cap-kernel-usage-report", "cap-kernel-evals", "cap-kernel-lifecycle", "cap-push-deliver", "cap-connector-tools", "cap-template-connectors", "cap-device-service-events", "cap-external-calls"];
8
+ export declare const KERNEL_QUEUE_NAMES: readonly ["cap-kernel-runs", "cap-kernel-subagent-runs", "cap-kernel-channels", "cap-kernel-maintenance", "cap-kernel-tool-watch", "cap-kernel-plugin-effects", "cap-kernel-titles", "cap-kernel-suggestions", "cap-kernel-usage-report", "cap-kernel-evals", "cap-kernel-lifecycle", "cap-push-deliver", "cap-connector-tools", "cap-template-connectors", "cap-device-service-events", "cap-external-calls"];
9
9
  /** How long each source's reads may take before the answer marks it unavailable. */
10
10
  export declare const HEALTH_READ_TIMEOUT_MS = 3000;
11
11
  /** A live replica as the overview shows it. */
@@ -10,7 +10,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
10
10
  import { getQueueToken } from "@nestjs/bullmq";
11
11
  import { Inject, Injectable } from "@nestjs/common";
12
12
  import { sql } from "kysely";
13
- import { PLUGIN_SCOPE_QUEUE } from "../catalog/scope-sync.js";
13
+ import { PLUGIN_EFFECT_QUEUE } from "../catalog/scope-sync.js";
14
14
  import { TEMPLATE_CONNECTORS_QUEUE } from "../catalog/template-connector-jobs.js";
15
15
  import { CHANNEL_QUEUE_NAME } from "../channels/jobs.js";
16
16
  import { EXTERNAL_CALLS_QUEUE } from "../conversations/external/external-calls.js";
@@ -38,7 +38,7 @@ export const KERNEL_QUEUE_NAMES = [
38
38
  CHANNEL_QUEUE_NAME,
39
39
  MAINTENANCE_QUEUE_NAME,
40
40
  TOOL_WATCH_QUEUE,
41
- PLUGIN_SCOPE_QUEUE,
41
+ PLUGIN_EFFECT_QUEUE,
42
42
  TITLE_QUEUE,
43
43
  PROMPT_SUGGESTION_QUEUE,
44
44
  USAGE_REPORT_QUEUE,
@@ -305,7 +305,7 @@ AdminHealthService = __decorate([
305
305
  __param(7, Inject(getQueueToken(CHANNEL_QUEUE_NAME))),
306
306
  __param(8, Inject(getQueueToken(MAINTENANCE_QUEUE_NAME))),
307
307
  __param(9, Inject(getQueueToken(TOOL_WATCH_QUEUE))),
308
- __param(10, Inject(getQueueToken(PLUGIN_SCOPE_QUEUE))),
308
+ __param(10, Inject(getQueueToken(PLUGIN_EFFECT_QUEUE))),
309
309
  __param(11, Inject(getQueueToken(TITLE_QUEUE))),
310
310
  __param(12, Inject(getQueueToken(PROMPT_SUGGESTION_QUEUE))),
311
311
  __param(13, Inject(getQueueToken(USAGE_REPORT_QUEUE))),
@@ -11,7 +11,7 @@ import { randomUUID } from "node:crypto";
11
11
  import { Inject, Injectable } from "@nestjs/common";
12
12
  import { sql } from "kysely";
13
13
  import { componentOn } from "../catalog/component-state.js";
14
- import { LIVE_INSTALL_STATUSES } from "../catalog/install-status.js";
14
+ import { orgUsable } from "../catalog/org-intent.js";
15
15
  import { ownerOf, ownersOf } from "../catalog/ownership.js";
16
16
  import { KernelDb } from "../infra/database/kernel-db.js";
17
17
  import { canonicalJson } from "../tools/canonical-json.js";
@@ -88,14 +88,7 @@ async function platformRowsOn(db, orgId, ids) {
88
88
  "c.id as item_id",
89
89
  "c.disabled as item_disabled",
90
90
  "c.builtin as item_builtin",
91
- eb
92
- .exists(eb
93
- .selectFrom("plugin_installs as a")
94
- .select("a.id")
95
- .whereRef("a.item_id", "=", "p.catalog_item_id")
96
- .where("a.org_id", "=", orgId)
97
- .where("a.status", "in", [...LIVE_INSTALL_STATUSES]))
98
- .as("installed"),
91
+ orgUsable(db, orgId, eb.ref("p.catalog_item_id")).as("plugin_usable"),
99
92
  eb
100
93
  .exists(eb
101
94
  .selectFrom("component_scope_orgs as l")
@@ -126,7 +119,7 @@ async function platformRowsOn(db, orgId, ids) {
126
119
  // the plugin's own scope and list do not decide whether a component is on
127
120
  scope: "optional",
128
121
  listed: false,
129
- installed: Boolean(r.installed),
122
+ usable: r.plugin_usable,
130
123
  }, Boolean(r.listed), r.switch ?? null));
131
124
  }
132
125
  /**
package/dist/app.d.ts CHANGED
@@ -7,10 +7,12 @@ import type { KernelConfig } from "./config/schema.js";
7
7
  import type { ConfigSourceKind } from "./config/sources.js";
8
8
  import { type KernelHttp } from "./http/app.js";
9
9
  import { type ShutdownSignalOptions } from "./infra/lifecycle/shutdown-signals.js";
10
+ import type { KernelFixtureTrust } from "./lifecycle/tokens.js";
10
11
  import type { KernelLogger } from "./log.js";
11
12
  import type { KernelOverride } from "./overrides.js";
13
+ export { KERNEL_FIXTURE_TRUST } from "./lifecycle/tokens.js";
12
14
  /** What {@link createKernelApp} takes besides the config. */
13
- export interface KernelAppOptions {
15
+ export interface KernelAppOptions extends KernelFixtureTrust {
14
16
  /** Explicit startup CAS intent; never a reloadable configuration value. */
15
17
  permissionConfigActivation?: Readonly<{
16
18
  expectedActiveHash: string;
package/dist/app.js CHANGED
@@ -11,6 +11,7 @@ import { KernelModule } from "./kernel.module.js";
11
11
  import { KernelLifecycle } from "./lifecycle/kernel-lifecycle.js";
12
12
  import { createConfiguredLogger } from "./log-config.js";
13
13
  import { validatePermissionConfigActivation } from "./sandbox/permission-config-publication.js";
14
+ export { KERNEL_FIXTURE_TRUST } from "./lifecycle/tokens.js";
14
15
  /**
15
16
  * Builds the kernel application (one Nest application, root module {@link KernelModule}) and sets
16
17
  * up its HTTP side, without initializing it: nothing connects and nothing starts. A failure
@@ -15,7 +15,7 @@ import { ConversationAccess } from "../conversations/access.js";
15
15
  import { readMessageContext } from "../conversations/message-context.js";
16
16
  import { ApiError } from "../errors.js";
17
17
  import { ExtensionDisplayNames } from "../extensions/display-name.js";
18
- import { enabledExtensionsByOrg, isExtensionEnabled } from "../extensions/enabled.js";
18
+ import { enabledExtensionsQuery, isExtensionEnabled } from "../extensions/enabled.js";
19
19
  import { ExtensionPointDefaults } from "../extensions/point-defaults.js";
20
20
  import { ExtensionRegistry } from "../extensions/registry.js";
21
21
  import { loadPeople } from "../identity/account-avatar.js";
@@ -616,12 +616,10 @@ let AutomationsService = class AutomationsService {
616
616
  */
617
617
  async chatTargets(orgId, accountId) {
618
618
  await this.liveRole(orgId, accountId);
619
- const rows = await this.db.db
619
+ const db = this.db.db;
620
+ const rows = await db
620
621
  .selectFrom("channel_threads")
621
622
  .innerJoin("channel_connections", "channel_connections.id", "channel_threads.connection_id")
622
- .innerJoin(enabledExtensionsByOrg(this.db.db).as("en"), (j) => j
623
- .onRef("en.org_id", "=", "channel_connections.org_id")
624
- .onRef("en.plugin", "=", "channel_connections.plugin"))
625
623
  .select([
626
624
  "channel_connections.id as connection_id",
627
625
  "channel_connections.name",
@@ -631,6 +629,7 @@ let AutomationsService = class AutomationsService {
631
629
  "channel_threads.thread_key",
632
630
  ])
633
631
  .where("channel_connections.org_id", "=", orgId)
632
+ .where(({ exists, ref }) => exists(enabledExtensionsQuery(db, ref("channel_connections.org_id"), ref("channel_connections.plugin"))))
634
633
  .where("channel_connections.status", "=", "active")
635
634
  .where("channel_connections.deleted_at", "is", null)
636
635
  .where("channel_threads.account_id", "=", accountId)
@@ -36,11 +36,9 @@ export interface OrgCatalogItem extends Omit<CatalogItemView, "installs" | "mark
36
36
  switchable: boolean;
37
37
  /** The plugin's extension (or a template's connector extension) is not on the deployment. */
38
38
  notDeployed: boolean;
39
- /**
40
- * This org's live plugin install of the item (installing or installed);
41
- * `upgradeAvailable` is always null since plugin scope phase 2 (no per-org upgrade, ruling F2;
42
- * kept for the web until its upgrade dialog goes).
43
- */
39
+ /** Pending work or the latest failed effect, independent of whether the plugin can be used. */
40
+ setup?: "pending" | "install_failed";
41
+ /** The version of this plugin's applied org resources, when it owns any. */
44
42
  installed: {
45
43
  pluginInstallId: string;
46
44
  version: string;
@@ -179,7 +177,7 @@ export declare function catalogHasIcon(db: KernelSchemaDb, itemId: string): Prom
179
177
  * storage); no icon -> `catalog.icon_not_found`; stored content that is not a valid svg / png
180
178
  * (checked at import, this guards against tampered storage) -> `internal`.
181
179
  */
182
- export declare function readCatalogIcon(db: KernelSchemaDb, itemId: string, includeDisabled: boolean): Promise<CatalogIcon>;
180
+ export declare function readCatalogIcon(db: KernelSchemaDb, itemId: string, includeDisabled: boolean, orgId?: string): Promise<CatalogIcon>;
183
181
  export type { ConnectorInstallInput };
184
182
  /**
185
183
  * The input of `POST /orgs/:orgId/catalog/:itemId/install`: the platform version is installed
@@ -192,10 +190,10 @@ export interface OrgInstallResult {
192
190
  installed: {
193
191
  itemId: string;
194
192
  version: string;
195
- pluginInstallId: string;
193
+ pluginInstallId: string | null;
196
194
  };
197
195
  /** The install view (its components, dependency installs included). */
198
- install: PluginInstallView;
196
+ install: PluginInstallView | null;
199
197
  }
200
198
  /**
201
199
  * The org actions installing / uninstalling a plugin needs: the union over its components (an