@capybara-hq/kernel 0.1.0-rc.142 → 0.1.0-rc.144

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/dist/admin/admin-agents.controller.d.ts +3 -5
  2. package/dist/admin/admin-agents.controller.js +1 -1
  3. package/dist/admin/admin-connectors.controller.d.ts +3 -5
  4. package/dist/admin/admin-connectors.controller.js +1 -1
  5. package/dist/admin/admin-items.schemas.d.ts +6 -6
  6. package/dist/admin/admin-items.schemas.js +5 -9
  7. package/dist/admin/admin.controller.d.ts +18 -12
  8. package/dist/admin/admin.controller.js +29 -15
  9. package/dist/admin/admin.schemas.d.ts +12 -3
  10. package/dist/admin/admin.schemas.js +17 -6
  11. package/dist/agents/admin-agents.d.ts +10 -8
  12. package/dist/agents/admin-agents.js +13 -9
  13. package/dist/agents/agents.module.js +3 -0
  14. package/dist/agents/agents.service.js +1 -1
  15. package/dist/agents/org-templates.d.ts +3 -1
  16. package/dist/agents/org-templates.js +7 -3
  17. package/dist/agents/pending-connector-requests.d.ts +10 -4
  18. package/dist/agents/pending-connector-requests.js +29 -7
  19. package/dist/automations/automations.controller.d.ts +9 -5
  20. package/dist/automations/automations.controller.js +21 -4
  21. package/dist/automations/automations.schemas.d.ts +19 -0
  22. package/dist/automations/automations.schemas.js +9 -0
  23. package/dist/automations/automations.service.d.ts +25 -8
  24. package/dist/automations/automations.service.js +40 -34
  25. package/dist/automations/events/acceptance.d.ts +6 -1
  26. package/dist/automations/events/acceptance.js +30 -11
  27. package/dist/automations/store.d.ts +17 -0
  28. package/dist/automations/store.js +35 -0
  29. package/dist/catalog/admin-catalog.controller.d.ts +64 -2
  30. package/dist/catalog/admin-catalog.controller.js +17 -0
  31. package/dist/catalog/catalog-import.module.js +3 -0
  32. package/dist/catalog/catalog-scope.service.d.ts +3 -1
  33. package/dist/catalog/catalog-scope.service.js +11 -7
  34. package/dist/catalog/catalog.module.js +3 -0
  35. package/dist/catalog/catalog.service.d.ts +3 -1
  36. package/dist/catalog/catalog.service.js +8 -4
  37. package/dist/catalog/cli.js +2 -2
  38. package/dist/catalog/component-promotion.d.ts +3 -1
  39. package/dist/catalog/component-promotion.js +7 -3
  40. package/dist/catalog/component-scope.service.d.ts +3 -1
  41. package/dist/catalog/component-scope.service.js +7 -3
  42. package/dist/catalog/enable-requests.d.ts +10 -8
  43. package/dist/catalog/enable-requests.js +40 -21
  44. package/dist/catalog/marketplaces.service.d.ts +1 -1
  45. package/dist/catalog/owned-items.d.ts +3 -1
  46. package/dist/catalog/owned-items.js +13 -9
  47. package/dist/catalog/platform-components.d.ts +6 -1
  48. package/dist/catalog/platform-components.js +9 -3
  49. package/dist/catalog/plugin-connectors.d.ts +8 -4
  50. package/dist/catalog/plugin-connectors.js +12 -6
  51. package/dist/catalog/plugin-import.d.ts +3 -1
  52. package/dist/catalog/plugin-import.js +14 -5
  53. package/dist/catalog/plugin-install.d.ts +3 -1
  54. package/dist/catalog/plugin-install.js +8 -4
  55. package/dist/catalog/plugin-package.js +2 -1
  56. package/dist/catalog/plugin-upgrade.d.ts +3 -1
  57. package/dist/catalog/plugin-upgrade.js +8 -4
  58. package/dist/catalog/request-hints.d.ts +19 -0
  59. package/dist/catalog/request-hints.js +34 -0
  60. package/dist/catalog/request-rules.d.ts +9 -5
  61. package/dist/catalog/request-rules.js +16 -9
  62. package/dist/catalog/requests.service.d.ts +3 -1
  63. package/dist/catalog/requests.service.js +28 -9
  64. package/dist/catalog/scope-orgs.d.ts +2 -1
  65. package/dist/catalog/scope-orgs.js +2 -2
  66. package/dist/catalog/scope-sync.d.ts +3 -1
  67. package/dist/catalog/scope-sync.js +12 -2
  68. package/dist/catalog/scope-writer.d.ts +6 -3
  69. package/dist/catalog/scope-writer.js +28 -10
  70. package/dist/catalog/unshare.d.ts +3 -2
  71. package/dist/catalog/unshare.js +4 -4
  72. package/dist/client/client-access.service.js +29 -1
  73. package/dist/config/schema.d.ts +12 -0
  74. package/dist/config/schema.js +56 -0
  75. package/dist/ctx/create-ctx.d.ts +2 -19
  76. package/dist/ctx/create-ctx.js +3 -93
  77. package/dist/ctx/durable-relay.d.ts +2 -5
  78. package/dist/ctx/durable-relay.js +56 -29
  79. package/dist/db/extension-handoff-schema.js +5 -0
  80. package/dist/db/kernel-schema.d.ts +74 -0
  81. package/dist/db/migrator.js +36 -0
  82. package/dist/erasure/account-batches.js +2 -0
  83. package/dist/erasure/account-residual.js +1 -0
  84. package/dist/erasure/org-catalog.js +8 -3
  85. package/dist/erasure/org-rules.js +1 -0
  86. package/dist/evals/evals.schemas.d.ts +15 -5
  87. package/dist/evals/evals.schemas.js +17 -10
  88. package/dist/evals/runs.controller.d.ts +4 -12
  89. package/dist/evals/runs.controller.js +14 -11
  90. package/dist/evals/runs.service.d.ts +29 -25
  91. package/dist/evals/runs.service.js +73 -61
  92. package/dist/evals/trajectory.controller.d.ts +10 -6
  93. package/dist/evals/trajectory.controller.js +11 -4
  94. package/dist/evals/trajectory.service.d.ts +17 -9
  95. package/dist/evals/trajectory.service.js +52 -35
  96. package/dist/extensions/admin-ops.d.ts +6 -1
  97. package/dist/extensions/admin-ops.js +21 -7
  98. package/dist/extensions/blobs.d.ts +2 -0
  99. package/dist/extensions/blobs.js +11 -0
  100. package/dist/extensions/deployment-config.d.ts +6 -1
  101. package/dist/extensions/deployment-config.js +13 -2
  102. package/dist/extensions/enabled.d.ts +5 -0
  103. package/dist/extensions/extensions.module.js +3 -0
  104. package/dist/extensions/grant-epoch.d.ts +108 -0
  105. package/dist/extensions/grant-epoch.js +214 -0
  106. package/dist/extensions/host.d.ts +29 -9
  107. package/dist/extensions/host.js +148 -42
  108. package/dist/extensions/instance.d.ts +3 -3
  109. package/dist/extensions/instance.js +1 -1
  110. package/dist/extensions/isolated/authorization.d.ts +54 -2
  111. package/dist/extensions/isolated/authorization.js +148 -35
  112. package/dist/extensions/isolated/child-session.js +0 -1
  113. package/dist/extensions/isolated/revision.js +1 -1
  114. package/dist/extensions/org-config.d.ts +3 -1
  115. package/dist/extensions/org-config.js +13 -4
  116. package/dist/extensions/org-overrides.d.ts +6 -1
  117. package/dist/extensions/org-overrides.js +13 -2
  118. package/dist/extensions/package-digest.job.d.ts +34 -0
  119. package/dist/extensions/package-digest.job.js +121 -0
  120. package/dist/extensions/package.js +10 -6
  121. package/dist/extensions/permission-set.d.ts +14 -78
  122. package/dist/extensions/permission-set.js +17 -143
  123. package/dist/extensions/permission-view.d.ts +13 -1
  124. package/dist/extensions/permission-view.js +20 -0
  125. package/dist/extensions/registry.js +4 -1
  126. package/dist/extensions/resolve.d.ts +7 -8
  127. package/dist/extensions/resolve.js +7 -8
  128. package/dist/extensions/revision-approvals.d.ts +167 -0
  129. package/dist/extensions/revision-approvals.js +353 -0
  130. package/dist/extensions/revision-grants.d.ts +197 -0
  131. package/dist/extensions/revision-grants.js +584 -0
  132. package/dist/extensions/state.module.js +12 -1
  133. package/dist/identity/accounts.d.ts +10 -4
  134. package/dist/identity/accounts.js +18 -5
  135. package/dist/inbox/inbox-items.service.d.ts +6 -1
  136. package/dist/inbox/inbox-items.service.js +29 -10
  137. package/dist/inbox/inbox.module.js +3 -0
  138. package/dist/inbox/inbox.service.d.ts +3 -1
  139. package/dist/inbox/inbox.service.js +9 -2
  140. package/dist/inbox/org-notices.d.ts +4 -3
  141. package/dist/inbox/org-notices.js +9 -6
  142. package/dist/inbox/platform-inbox.service.d.ts +3 -1
  143. package/dist/inbox/platform-inbox.service.js +11 -3
  144. package/dist/inbox/platform-notices.d.ts +3 -2
  145. package/dist/inbox/platform-notices.js +10 -4
  146. package/dist/infra/config/kernel-config.service.js +4 -1
  147. package/dist/infra/database/extension-effect-key-lock.js +7 -0
  148. package/dist/infra/paging/paged-read.d.ts +34 -4
  149. package/dist/infra/paging/paged-read.js +38 -1
  150. package/dist/invalidation/audiences.d.ts +32 -0
  151. package/dist/invalidation/audiences.js +43 -0
  152. package/dist/invalidation/hints.d.ts +6 -0
  153. package/dist/invalidation/hints.js +7 -1
  154. package/dist/invalidation/invalidation-hints.d.ts +12 -1
  155. package/dist/invalidation/invalidation-hints.js +46 -5
  156. package/dist/invalidation/invalidation-hints.module.d.ts +2 -0
  157. package/dist/invalidation/invalidation-hints.module.js +4 -1
  158. package/dist/invalidation/me-stream.d.ts +1 -11
  159. package/dist/invalidation/me-stream.js +12 -41
  160. package/dist/invalidation/org-intent-bridge.d.ts +18 -0
  161. package/dist/invalidation/org-intent-bridge.js +46 -0
  162. package/dist/models/enablement.d.ts +3 -1
  163. package/dist/models/enablement.js +25 -5
  164. package/dist/orgs/invitations.controller.d.ts +4 -7
  165. package/dist/orgs/invitations.controller.js +8 -5
  166. package/dist/orgs/invitations.service.d.ts +17 -3
  167. package/dist/orgs/invitations.service.js +35 -13
  168. package/dist/orgs/members.service.d.ts +35 -0
  169. package/dist/orgs/members.service.js +52 -3
  170. package/dist/orgs/offboarding.d.ts +3 -1
  171. package/dist/orgs/offboarding.js +7 -3
  172. package/dist/orgs/orgs.controller.d.ts +11 -4
  173. package/dist/orgs/orgs.controller.js +25 -5
  174. package/dist/orgs/orgs.module.js +3 -0
  175. package/dist/orgs/orgs.schemas.d.ts +14 -0
  176. package/dist/orgs/orgs.schemas.js +19 -2
  177. package/dist/orgs/orgs.service.d.ts +24 -2
  178. package/dist/orgs/orgs.service.js +47 -4
  179. package/dist/orgs/security-settings.service.d.ts +14 -6
  180. package/dist/orgs/security-settings.service.js +18 -13
  181. package/dist/orgs/settings.controller.d.ts +7 -4
  182. package/dist/platform/exclusions.js +15 -0
  183. package/dist/platform/ops/accounts.ops.js +7 -16
  184. package/dist/platform/ops/admin-items.ops.js +7 -7
  185. package/dist/platform/ops/automations.ops.js +6 -4
  186. package/dist/platform/ops/evals.ops.js +30 -15
  187. package/dist/platform/ops/org-settings.ops.js +2 -2
  188. package/dist/platform/ops/orgs.ops.js +44 -27
  189. package/dist/push/delivery.d.ts +3 -1
  190. package/dist/push/delivery.js +7 -3
  191. package/dist/push/push-processor.js +8 -1
  192. package/dist/roles/worker.module.js +3 -0
  193. package/dist/runtime/step-log.d.ts +1 -1
  194. package/dist/runtime/step-log.js +5 -4
  195. package/dist/runtime/stream-limit.d.ts +13 -0
  196. package/dist/runtime/stream-limit.js +40 -0
  197. package/dist/runtime/stream.controller.d.ts +2 -0
  198. package/dist/runtime/stream.controller.js +2 -0
  199. package/dist/runtime/stream.d.ts +1 -0
  200. package/dist/runtime/stream.js +15 -6
  201. package/dist/sandbox/permission-authority.module.js +6 -1
  202. package/dist/sandbox/permission-transitions.d.ts +3 -1
  203. package/dist/sandbox/permission-transitions.js +17 -2
  204. package/dist/setup/kernel-checks.d.ts +3 -3
  205. package/dist/setup/kernel-checks.js +4 -4
  206. package/dist/setup/setup-check-registry.d.ts +16 -5
  207. package/dist/setup/setup-check-registry.js +11 -3
  208. package/dist/setup/setup-checks.service.d.ts +1 -2
  209. package/dist/setup/setup-checks.service.js +7 -6
  210. package/dist/skills/agent-skills.service.d.ts +6 -1
  211. package/dist/skills/agent-skills.service.js +12 -3
  212. package/dist/skills/changes.service.d.ts +6 -1
  213. package/dist/skills/changes.service.js +11 -3
  214. package/dist/skills/conversation-catalog.d.ts +3 -0
  215. package/dist/skills/conversation-catalog.js +2 -0
  216. package/dist/skills/skills.module.js +3 -0
  217. package/dist/skills/skills.service.d.ts +3 -1
  218. package/dist/skills/skills.service.js +8 -4
  219. package/dist/tools/admin-connectors.d.ts +10 -8
  220. package/dist/tools/admin-connectors.js +12 -10
  221. package/dist/tools/approvals.service.d.ts +12 -1
  222. package/dist/tools/approvals.service.js +36 -9
  223. package/dist/tools/builtins/automations.d.ts +1 -1
  224. package/dist/tools/builtins/automations.js +1 -1
  225. package/dist/tools/connectors.service.d.ts +3 -1
  226. package/dist/tools/connectors.service.js +29 -7
  227. package/dist/tools/tools.module.js +3 -0
  228. package/dist/ui/admin-ui.controller.d.ts +3 -1
  229. package/dist/ui/admin-ui.controller.js +3 -1
  230. package/dist/ui/ui-stream.d.ts +2 -0
  231. package/dist/ui/ui-stream.js +20 -6
  232. package/dist/ui/views.controller.d.ts +4 -2
  233. package/dist/ui/views.controller.js +4 -2
  234. package/package.json +3 -3
  235. package/src/migrations/0234_extension_grant_epoch.sql +141 -0
  236. package/src/migrations/0235_extension_revision_grants.sql +166 -0
  237. package/src/migrations/0236_paged_table_idx.sql +33 -0
  238. package/src/migrations/0237_extension_handoff_health.sql +18 -0
@@ -18,6 +18,7 @@ import { KernelDb } from "../infra/database/kernel-db.js";
18
18
  import { TransactionHost } from "../infra/database/transaction-host.js";
19
19
  import { Transactional } from "../infra/database/transactional.decorator.js";
20
20
  import { KERNEL_LOGGER } from "../infra/tokens.js";
21
+ import { InvalidationHints } from "../invalidation/invalidation-hints.js";
21
22
  import { PushProviderHost } from "./provider-host.js";
22
23
  import { PushTokenStore } from "./token-store.js";
23
24
  /**
@@ -76,9 +77,10 @@ let PushDelivery = class PushDelivery {
76
77
  replica;
77
78
  log;
78
79
  timeoutMs;
80
+ hints;
79
81
  constructor(kdb, txHost, host, tokens, config,
80
82
  /** This process's replica id (its own `extension_replica_status` rows). */
81
- replica, log, timeoutMs = () => PUSH_LIMITS.sendTimeoutMs) {
83
+ replica, log, timeoutMs = () => PUSH_LIMITS.sendTimeoutMs, hints) {
82
84
  this.kdb = kdb;
83
85
  this.txHost = txHost;
84
86
  this.host = host;
@@ -87,6 +89,7 @@ let PushDelivery = class PushDelivery {
87
89
  this.replica = replica;
88
90
  this.log = log;
89
91
  this.timeoutMs = timeoutMs;
92
+ this.hints = hints;
90
93
  }
91
94
  /** Delivers one job (see the class). */
92
95
  async deliver(data) {
@@ -218,7 +221,7 @@ let PushDelivery = class PushDelivery {
218
221
  }
219
222
  /** The platform notice `push_auth_failed` for `plugin`, unless one is open. */
220
223
  async recordAuthFailure(plugin) {
221
- await addPushAuthNotice(this.kdb.db, plugin);
224
+ await addPushAuthNotice(this.kdb.db, this.hints, plugin);
222
225
  }
223
226
  /**
224
227
  * Whether another live replica (heartbeat within the stale window) reports `plugin` loaded: then
@@ -255,7 +258,8 @@ PushDelivery = __decorate([
255
258
  __param(5, Inject(ReplicaStatusStore)),
256
259
  __param(6, Inject(KERNEL_LOGGER)),
257
260
  __param(7, Optional()),
258
- __param(7, Inject(PUSH_SEND_TIMEOUT_MS))
261
+ __param(7, Inject(PUSH_SEND_TIMEOUT_MS)),
262
+ __param(8, Inject(InvalidationHints))
259
263
  ], PushDelivery);
260
264
  export { PushDelivery };
261
265
  /** Whether `m` passes `validatePushMessage` (a malformed shape, e.g. a missing field, does not). */
@@ -13,6 +13,7 @@ import { UnrecoverableError } from "bullmq";
13
13
  import { ExtensionsModule } from "../extensions/extensions.module.js";
14
14
  import { runJob } from "../infra/queue/run-job.js";
15
15
  import { KERNEL_LOGGER } from "../infra/tokens.js";
16
+ import { InvalidationHintsModule } from "../invalidation/invalidation-hints.module.js";
16
17
  import { PushDelivery } from "./delivery.js";
17
18
  import { PushFanout } from "./fanout.js";
18
19
  import { PUSH_DELIVER_JOB, PUSH_FANOUT_JOB, PUSH_QUEUE, } from "./jobs.js";
@@ -106,7 +107,13 @@ let PushWorkersModule = class PushWorkersModule {
106
107
  };
107
108
  PushWorkersModule = __decorate([
108
109
  Module({
109
- imports: [PushModule, PushHostModule, ExtensionsModule],
110
+ imports: [
111
+ // invalidation hints its writers publish after their commit
112
+ InvalidationHintsModule,
113
+ PushModule,
114
+ PushHostModule,
115
+ ExtensionsModule,
116
+ ],
110
117
  providers: [PushDelivery, PushFanout, PushProcessor, PushStaleJob],
111
118
  exports: [PushProcessor],
112
119
  })
@@ -35,6 +35,7 @@ import { EvalWorkersModule } from "../evals/evals.module.js";
35
35
  import { ExtensionsModule } from "../extensions/extensions.module.js";
36
36
  import { PluginsReconcileJob } from "../extensions/lifecycle.js";
37
37
  import { LifecycleHookWorkersModule } from "../extensions/lifecycle-hooks.js";
38
+ import { PackageDigestBackfillJob } from "../extensions/package-digest.job.js";
38
39
  import { BlobSweepModule } from "../files/blob-sweep.job.js";
39
40
  import { FileDraftCleanupJob } from "../files/draft-cleanup.job.js";
40
41
  import { FileLibraryKickoffJob } from "../files/hash-job.js";
@@ -165,6 +166,8 @@ let WorkerModule = WorkerModule_1 = class WorkerModule {
165
166
  AccountAvatarCleanupJob,
166
167
  ClientReportsCron,
167
168
  CatalogJobs,
169
+ // sha512 of packages stored before migration 0235 (extension permission model plan 1.2b)
170
+ PackageDigestBackfillJob,
168
171
  DirectoryScanJob,
169
172
  PluginsReconcileJob,
170
173
  GatewayCheckJob,
@@ -50,7 +50,7 @@ export declare class StepLog {
50
50
  written: ConversationEvent[];
51
51
  toSeq: number | null;
52
52
  }>;
53
- /** Appends events with their audit row (a hook denial). */
53
+ /** Appends events with an audit row for a newly recorded denial. */
54
54
  appendAudited(conversationId: string, events: AppendEvent[], entry: StepAuditEntry): Promise<ConversationEvent[]>;
55
55
  /**
56
56
  * Appends a `model_call` with the tool definitions its request sent, stored by fingerprint in
@@ -87,11 +87,12 @@ let StepLog = class StepLog {
87
87
  }
88
88
  return { written, toSeq: fresh.length > 0 ? Math.max(...fresh.map((e) => e.seq)) : null };
89
89
  }
90
- /** Appends events with their audit row (a hook denial). */
90
+ /** Appends events with an audit row for a newly recorded denial. */
91
91
  async appendAudited(conversationId, events, entry) {
92
- const out = await this.eventLog.appendIn(conversationId, events);
93
- await audit(this.kdb.db, entry);
94
- return out;
92
+ const result = await this.eventLog.appendInReport(conversationId, events);
93
+ if (result.fresh.some(Boolean))
94
+ await audit(this.kdb.db, entry);
95
+ return result.events;
95
96
  }
96
97
  /**
97
98
  * Appends a `model_call` with the tool definitions its request sent, stored by fingerprint in
@@ -0,0 +1,13 @@
1
+ /** A transport close, with no event ID or change to the replay cursor. */
2
+ export declare const SUPERSEDED_FRAME = "event: closed\ndata: {\"reason\":\"superseded\"}\n\n";
3
+ interface StreamSlot {
4
+ begin(max: number): void;
5
+ close(): void;
6
+ }
7
+ /** One instance per SSE family and replica. Only connections whose response has begun use a slot. */
8
+ export declare class PerAccountStreamLimit {
9
+ private readonly byAccount;
10
+ register(accountId: string, supersede: () => void): StreamSlot;
11
+ countOf(accountId: string): number;
12
+ }
13
+ export {};
@@ -0,0 +1,40 @@
1
+ /** A transport close, with no event ID or change to the replay cursor. */
2
+ export const SUPERSEDED_FRAME = 'event: closed\ndata: {"reason":"superseded"}\n\n';
3
+ /** One instance per SSE family and replica. Only connections whose response has begun use a slot. */
4
+ export class PerAccountStreamLimit {
5
+ byAccount = new Map();
6
+ register(accountId, supersede) {
7
+ let state = "waiting";
8
+ // Each registration has its own identity, even if two slots share a callback.
9
+ const evict = () => supersede();
10
+ return {
11
+ begin: (max) => {
12
+ if (state !== "waiting")
13
+ return;
14
+ state = "open";
15
+ const streams = this.byAccount.get(accountId) ?? [];
16
+ const victims = streams.splice(0, Math.max(0, streams.length - max + 1));
17
+ streams.push(evict);
18
+ this.byAccount.set(accountId, streams);
19
+ // An evicted connection cleans itself up synchronously. Publish the new list first.
20
+ for (const victim of victims)
21
+ victim();
22
+ },
23
+ close: () => {
24
+ if (state === "open") {
25
+ const streams = this.byAccount.get(accountId);
26
+ const index = streams?.indexOf(evict) ?? -1;
27
+ if (index >= 0 && streams !== undefined) {
28
+ streams.splice(index, 1);
29
+ if (streams.length === 0)
30
+ this.byAccount.delete(accountId);
31
+ }
32
+ }
33
+ state = "closed";
34
+ },
35
+ };
36
+ }
37
+ countOf(accountId) {
38
+ return this.byAccount.get(accountId)?.length ?? 0;
39
+ }
40
+ }
@@ -26,6 +26,8 @@ declare const DraftParams: z.ZodObject<{
26
26
  * (插件 `ctx.ui.invalidate`)就发 `event: ui`(`data: {"plugin","contribution"}`);
27
27
  * - 每 `runtime.sseHeartbeatMs` 发 `: ping` 注释;每 `runtime.sseRecheckMs` 复核凭据(会话未吊销 / 令牌仍有效,
28
28
  * access token 到期本身不算失效)与可见性,失败时发 `event: error`(`data: {"code"}`)后关闭流;
29
+ * - over `runtime.conversationStreamMaxPerAccount`, the oldest of the account's streams on
30
+ * this replica ends with `event: closed` and `data: {"reason":"superseded"}` (no event ID);
29
31
  * - 用 `@Res()` + `reply.hijack()` 直接写原始响应,绕开 Nest / Fastify 的响应处理与缓冲。
30
32
  * 代理(Web 层)需透传 `x-accel-buffering: no`、`cache-control: no-cache`。
31
33
  */
@@ -53,6 +53,8 @@ class RunDraftParamsDto extends createZodDto(DraftParams, "RunDraftParams") {
53
53
  * (插件 `ctx.ui.invalidate`)就发 `event: ui`(`data: {"plugin","contribution"}`);
54
54
  * - 每 `runtime.sseHeartbeatMs` 发 `: ping` 注释;每 `runtime.sseRecheckMs` 复核凭据(会话未吊销 / 令牌仍有效,
55
55
  * access token 到期本身不算失效)与可见性,失败时发 `event: error`(`data: {"code"}`)后关闭流;
56
+ * - over `runtime.conversationStreamMaxPerAccount`, the oldest of the account's streams on
57
+ * this replica ends with `event: closed` and `data: {"reason":"superseded"}` (no event ID);
56
58
  * - 用 `@Res()` + `reply.hijack()` 直接写原始响应,绕开 Nest / Fastify 的响应处理与缓冲。
57
59
  * 代理(Web 层)需透传 `x-accel-buffering: no`、`cache-control: no-cache`。
58
60
  */
@@ -60,6 +60,7 @@ export interface StreamHandle {
60
60
  */
61
61
  export declare class ConversationStreams {
62
62
  private readonly active;
63
+ private readonly limit;
63
64
  /** Set by {@link closeAll}: streams opened afterwards end as soon as they begin. */
64
65
  private closing;
65
66
  private readonly d;
@@ -19,6 +19,7 @@ import { KERNEL_BUS, KERNEL_LOGGER } from "../infra/tokens.js";
19
19
  import { OrgSettingsService } from "../orgs/settings.service.js";
20
20
  import { isUiBusMessage, uiFrame } from "../ui/registry.js";
21
21
  import { RunDrafts } from "./run-drafts.js";
22
+ import { PerAccountStreamLimit, SUPERSEDED_FRAME } from "./stream-limit.js";
22
23
  /** 补读事件的分页大小。 */
23
24
  const PAGE = 500;
24
25
  /** 慢客户端的积压上限:超过即关闭流,客户端带 Last-Event-ID 重连补读。 */
@@ -96,6 +97,7 @@ const suggestionFrame = (s) => `event: suggestion\ndata: ${JSON.stringify({ runI
96
97
  */
97
98
  let ConversationStreams = class ConversationStreams {
98
99
  active = new Set();
100
+ limit = new PerAccountStreamLimit();
99
101
  /** Set by {@link closeAll}: streams opened afterwards end as soon as they begin. */
100
102
  closing = false;
101
103
  d;
@@ -131,7 +133,7 @@ let ConversationStreams = class ConversationStreams {
131
133
  throw new ApiError(denied, DENIAL_MESSAGES[denied] ?? "Access denied");
132
134
  if (this.closing)
133
135
  return endedStream(out);
134
- const conn = new Connection(this.d, p, out, () => this.active.delete(conn));
136
+ const conn = new Connection(this.d, p, out, this.limit, () => this.active.delete(conn));
135
137
  this.active.add(conn);
136
138
  try {
137
139
  await conn.subscribe();
@@ -205,11 +207,13 @@ class Connection {
205
207
  timers = [];
206
208
  rechecking = false;
207
209
  begun = false;
208
- constructor(d, p, out, onClosed) {
210
+ slot;
211
+ constructor(d, p, out, limit, onClosed) {
209
212
  this.d = d;
210
213
  this.p = p;
211
214
  this.out = out;
212
215
  this.onClosed = onClosed;
216
+ this.slot = limit.register(p.viewerAccountId, () => this.close("end", SUPERSEDED_FRAME));
213
217
  this.lastSeq = p.afterSeq;
214
218
  // 所有输出串行:先回放,之后按到达顺序处理频道消息;begin() 之前闸门关着。
215
219
  this.chain = new Promise((resolve) => {
@@ -230,17 +234,19 @@ class Connection {
230
234
  this.unsubscribe = un;
231
235
  }
232
236
  begin() {
233
- if (this.closed)
237
+ if (this.closed || this.begun)
234
238
  return;
235
239
  this.begun = true;
236
- const { sseHeartbeatMs, sseRecheckMs } = this.d.config.get().runtime;
240
+ const { sseHeartbeatMs, sseRecheckMs, conversationStreamMaxPerAccount } = this.d.config.get().runtime;
241
+ this.slot.begin(conversationStreamMaxPerAccount);
237
242
  this.timers.push(setInterval(() => this.write(": ping\n\n"), sseHeartbeatMs), setInterval(() => void this.recheck(), sseRecheckMs));
238
243
  this.openGate();
239
244
  }
240
- close(mode = "end") {
245
+ close(mode = "end", finalFrame) {
241
246
  if (this.closed)
242
247
  return;
243
248
  this.closed = true;
249
+ this.slot.close();
244
250
  for (const t of this.timers)
245
251
  clearInterval(t);
246
252
  this.timers = [];
@@ -255,8 +261,11 @@ class Connection {
255
261
  try {
256
262
  if (mode === "abort")
257
263
  this.out.abort();
258
- else
264
+ else {
265
+ if (finalFrame !== undefined)
266
+ this.out.write(finalFrame);
259
267
  this.out.end();
268
+ }
260
269
  }
261
270
  catch {
262
271
  // 连接已断开
@@ -6,6 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { Module } from "@nestjs/common";
8
8
  import { EventLogModule } from "../conversations/event-log.js";
9
+ import { InvalidationHintsModule } from "../invalidation/invalidation-hints.module.js";
9
10
  import { PermissionAuthorityEpochStore } from "./permission-authority-epochs.js";
10
11
  import { PermissionAuthorityLock } from "./permission-authority-lock.js";
11
12
  import { PermissionCeilingWrites } from "./permission-ceiling-writes.js";
@@ -22,7 +23,11 @@ let PermissionCeilingWritesModule = class PermissionCeilingWritesModule {
22
23
  };
23
24
  PermissionCeilingWritesModule = __decorate([
24
25
  Module({
25
- imports: [EventLogModule],
26
+ imports: [
27
+ // invalidation hints its writers publish after their commit
28
+ InvalidationHintsModule,
29
+ EventLogModule,
30
+ ],
26
31
  providers: [
27
32
  PermissionTransitions,
28
33
  PermissionCeilingWrites,
@@ -3,6 +3,7 @@ import { EventLog } from "../conversations/event-log.js";
3
3
  import { KernelDb } from "../infra/database/kernel-db.js";
4
4
  import { TransactionHost } from "../infra/database/transaction-host.js";
5
5
  import { OutboxService } from "../infra/outbox/outbox.service.js";
6
+ import { type HintPublisher } from "../invalidation/audiences.js";
6
7
  import { type AuthorityLevel, type AuthoritySubject, PermissionAuthorityLock } from "./permission-authority-lock.js";
7
8
  export declare const PERMISSION_APPROVAL_RECHECK = "permission-approval-recheck";
8
9
  export type PermissionTransition = {
@@ -23,7 +24,8 @@ export declare class PermissionTransitions {
23
24
  private readonly locks;
24
25
  private readonly events;
25
26
  private readonly outbox;
26
- constructor(db: KernelDb, txHost: TransactionHost, locks: PermissionAuthorityLock, events: EventLog, outbox: OutboxService);
27
+ private readonly hints;
28
+ constructor(db: KernelDb, txHost: TransactionHost, locks: PermissionAuthorityLock, events: EventLog, outbox: OutboxService, hints: HintPublisher);
27
29
  recordLocked(change: PermissionTransition, writer: {
28
30
  subject: AuthoritySubject;
29
31
  level: AuthorityLevel;
@@ -15,7 +15,11 @@ import { KernelDb } from "../infra/database/kernel-db.js";
15
15
  import { TransactionHost } from "../infra/database/transaction-host.js";
16
16
  import { Transactional } from "../infra/database/transactional.decorator.js";
17
17
  import { OutboxService } from "../infra/outbox/outbox.service.js";
18
+ import { approvalTopics } from "../invalidation/audiences.js";
19
+ import { InvalidationHints } from "../invalidation/invalidation-hints.js";
20
+ import { ORG_ROLES } from "../orgs/roles.js";
18
21
  import { PermissionAuthorityLock, } from "./permission-authority-lock.js";
22
+ const isOrgRole = (v) => v !== null && ORG_ROLES.includes(v);
19
23
  export const PERMISSION_APPROVAL_RECHECK = "permission-approval-recheck";
20
24
  /** Canonical lower write: never takes descendant authority or imports the tools domain. */
21
25
  let PermissionTransitions = class PermissionTransitions {
@@ -24,12 +28,14 @@ let PermissionTransitions = class PermissionTransitions {
24
28
  locks;
25
29
  events;
26
30
  outbox;
27
- constructor(db, txHost, locks, events, outbox) {
31
+ hints;
32
+ constructor(db, txHost, locks, events, outbox, hints) {
28
33
  this.db = db;
29
34
  this.txHost = txHost;
30
35
  this.locks = locks;
31
36
  this.events = events;
32
37
  this.outbox = outbox;
38
+ this.hints = hints;
33
39
  }
34
40
  async recordLocked(change, writer) {
35
41
  const id = writer.level === "platform"
@@ -104,6 +110,14 @@ let PermissionTransitions = class PermissionTransitions {
104
110
  .orderBy("id")
105
111
  .forUpdate()
106
112
  .execute();
113
+ // the superseded cards leave their deciders' inboxes (one publish for all of them)
114
+ const asked = cards.flatMap((card) => approvalTopics({
115
+ orgId,
116
+ requestedFor: card.requested_for,
117
+ approverRole: isOrgRole(card.approver_role) ? card.approver_role : null,
118
+ }));
119
+ if (asked.length > 0)
120
+ this.hints.publishAfterCommit(asked, { kind: "inbox" });
107
121
  for (const card of cards) {
108
122
  await this.db
109
123
  .updateTable("approvals")
@@ -153,6 +167,7 @@ PermissionTransitions = __decorate([
153
167
  __param(1, Inject(TransactionHost)),
154
168
  __param(2, Inject(PermissionAuthorityLock)),
155
169
  __param(3, Inject(EventLog)),
156
- __param(4, Inject(OutboxService))
170
+ __param(4, Inject(OutboxService)),
171
+ __param(5, Inject(InvalidationHints))
157
172
  ], PermissionTransitions);
158
173
  export { PermissionTransitions };
@@ -60,9 +60,9 @@ export declare function connectionActiveResult(row: {
60
60
  lastError: string | null;
61
61
  } | undefined, secrets: readonly string[]): SetupCheckResult;
62
62
  /**
63
- * Registers the kernel checks on module init (static code, the same on every replica). Each reads
64
- * only the target the service resolved (ids of the caller's org, after authorization) and never
65
- * writes; `capybara:oauth-token-endpoint` is the only one that leaves the kernel (§10.6).
63
+ * Registers read-only kernel checks on every replica. Deployment checks need no org target.
64
+ * Org checks receive the authorized target resolved by the service.
65
+ * `capybara:oauth-token-endpoint` is the only one that leaves the kernel (§10.6).
66
66
  */
67
67
  export declare class KernelChecks implements OnModuleInit {
68
68
  private readonly registry;
@@ -144,9 +144,9 @@ export function connectionActiveResult(row, secrets) {
144
144
  return { status: "ok", reason: KERNEL_CHECK_TEXTS.connectionActive };
145
145
  }
146
146
  /**
147
- * Registers the kernel checks on module init (static code, the same on every replica). Each reads
148
- * only the target the service resolved (ids of the caller's org, after authorization) and never
149
- * writes; `capybara:oauth-token-endpoint` is the only one that leaves the kernel (§10.6).
147
+ * Registers read-only kernel checks on every replica. Deployment checks need no org target.
148
+ * Org checks receive the authorized target resolved by the service.
149
+ * `capybara:oauth-token-endpoint` is the only one that leaves the kernel (§10.6).
150
150
  */
151
151
  let KernelChecks = class KernelChecks {
152
152
  registry;
@@ -163,7 +163,7 @@ let KernelChecks = class KernelChecks {
163
163
  }
164
164
  onModuleInit() {
165
165
  const r = this.registry;
166
- r.registerKernel("capybara:public-url", "any", async () => publicUrlCheck(this.config.get()));
166
+ r.registerDeploymentKernel("capybara:public-url", async () => publicUrlCheck(this.config.get()));
167
167
  r.registerKernel("capybara:webhook-public", "channel-connection", async () => webhookPublicCheck(this.config.get()));
168
168
  r.registerKernel("capybara:webhook-received", "channel-connection", (a) => this.webhookReceived(a));
169
169
  r.registerKernel("capybara:connection-active", "channel-connection", (a) => this.connectionActive(a));
@@ -44,13 +44,20 @@ export interface KernelCheckArgs {
44
44
  }
45
45
  /** A kernel check's implementation. */
46
46
  export type KernelCheckRun = (args: KernelCheckArgs) => Promise<SetupCheckResult>;
47
- /** A check found for a guide's `::check` line. */
48
- export type ResolvedSetupCheck = {
49
- source: "kernel";
50
- id: string;
47
+ type KernelCheck = {
48
+ scope: "org";
51
49
  place: SetupGuidePlace | "any";
52
50
  run: KernelCheckRun;
53
51
  } | {
52
+ scope: "deployment";
53
+ place: "any";
54
+ run: () => Promise<SetupCheckResult>;
55
+ };
56
+ /** A check found for a guide's `::check` line. */
57
+ export type ResolvedSetupCheck = ({
58
+ source: "kernel";
59
+ id: string;
60
+ } & KernelCheck) | {
54
61
  source: "plugin";
55
62
  id: string;
56
63
  place: SetupGuidePlace;
@@ -73,8 +80,11 @@ export declare class SetupCheckRegistry {
73
80
  private readonly extensions;
74
81
  private readonly kernel;
75
82
  constructor(extensions: Pick<ExtensionRegistry, "current">);
76
- /** Registers a kernel check; an id twice, a malformed id or an unknown place throws. */
83
+ /** Registers a kernel check that needs an org target. */
77
84
  registerKernel(id: `capybara:${string}`, place: SetupGuidePlace | "any", run: KernelCheckRun): void;
85
+ /** Registers a target-independent kernel check available on platform and org guides. */
86
+ registerDeploymentKernel(id: `capybara:${string}`, run: () => Promise<SetupCheckResult>): void;
87
+ private addKernelCheck;
78
88
  /**
79
89
  * The check behind a guide's `::check <id>` line of `plugin`'s guide: a kernel check for
80
90
  * `capybara:*`, else the plugin's own (null when this replica does not run the extension or the
@@ -84,3 +94,4 @@ export declare class SetupCheckRegistry {
84
94
  /** Whether `plugin` runs on this replica. */
85
95
  running(plugin: string): boolean;
86
96
  }
97
+ export {};
@@ -25,8 +25,16 @@ let SetupCheckRegistry = class SetupCheckRegistry {
25
25
  constructor(extensions) {
26
26
  this.extensions = extensions;
27
27
  }
28
- /** Registers a kernel check; an id twice, a malformed id or an unknown place throws. */
28
+ /** Registers a kernel check that needs an org target. */
29
29
  registerKernel(id, place, run) {
30
+ this.addKernelCheck(id, { scope: "org", place, run });
31
+ }
32
+ /** Registers a target-independent kernel check available on platform and org guides. */
33
+ registerDeploymentKernel(id, run) {
34
+ this.addKernelCheck(id, { scope: "deployment", place: "any", run });
35
+ }
36
+ addKernelCheck(id, check) {
37
+ const { place, run } = check;
30
38
  if (!KERNEL_ID_RE.test(id))
31
39
  throw new Error(`setup check id "${id}" is not capybara:<id>`);
32
40
  if (place !== "any" && !SETUP_GUIDE_PLACES.includes(place)) {
@@ -36,7 +44,7 @@ let SetupCheckRegistry = class SetupCheckRegistry {
36
44
  throw new Error(`setup check "${id}": run must be a function`);
37
45
  if (this.kernel.has(id))
38
46
  throw new Error(`duplicate kernel setup check "${id}"`);
39
- this.kernel.set(id, Object.freeze({ place, run }));
47
+ this.kernel.set(id, Object.freeze(check));
40
48
  }
41
49
  /**
42
50
  * The check behind a guide's `::check <id>` line of `plugin`'s guide: a kernel check for
@@ -46,7 +54,7 @@ let SetupCheckRegistry = class SetupCheckRegistry {
46
54
  resolve(plugin, id) {
47
55
  if (id.startsWith("capybara:")) {
48
56
  const k = this.kernel.get(id);
49
- return k ? { source: "kernel", id, place: k.place, run: k.run } : null;
57
+ return k ? { source: "kernel", id, ...k } : null;
50
58
  }
51
59
  const inst = this.extensions.current(plugin);
52
60
  const c = inst?.setupChecks.get(id);
@@ -78,8 +78,7 @@ export declare class SetupChecksService {
78
78
  * /admin/extensions/:name/guides/:guideId/checks/:checkId/run`, super admins: the route's
79
79
  * guard) with the extension's platform deployment config, `orgId: null`. The cache, single
80
80
  * flight, cooldown and concurrency cap are the org places', keyed by the deployment; the
81
- * per-account limit is shared with every other run. A kernel check (`capybara:*`) does not apply
82
- * here.
81
+ * per-account limit is shared with every other run. Deployment-scoped kernel checks also apply.
83
82
  */
84
83
  deploymentRun(accountId: string, plugin: string, guideId: string, checkId: string, body: {
85
84
  force?: boolean | undefined;
@@ -157,8 +157,7 @@ let SetupChecksService = class SetupChecksService {
157
157
  * /admin/extensions/:name/guides/:guideId/checks/:checkId/run`, super admins: the route's
158
158
  * guard) with the extension's platform deployment config, `orgId: null`. The cache, single
159
159
  * flight, cooldown and concurrency cap are the org places', keyed by the deployment; the
160
- * per-account limit is shared with every other run. A kernel check (`capybara:*`) does not apply
161
- * here.
160
+ * per-account limit is shared with every other run. Deployment-scoped kernel checks also apply.
162
161
  */
163
162
  async deploymentRun(accountId, plugin, guideId, checkId, body) {
164
163
  const p = await this.prepareDeployment(accountId, plugin, guideId, checkId);
@@ -249,9 +248,9 @@ let SetupChecksService = class SetupChecksService {
249
248
  return unknownState(REASONS.unregistered);
250
249
  if (check.place !== "any" && check.place !== p.place)
251
250
  return unknownState(REASONS.otherPlace);
252
- // kernel checks are about an org's targets; the deployment has none
253
- if (check.source === "kernel" && p.orgId === null)
251
+ if (check.source === "kernel" && check.scope === "org" && p.orgId === null) {
254
252
  return unknownState(REASONS.otherPlace);
253
+ }
255
254
  const keys = this.keys(p, checkId);
256
255
  const revision = await this.revision(p, accountScoped(p, checkId));
257
256
  const fingerprint = this.fingerprint(p, revision);
@@ -548,10 +547,12 @@ let SetupChecksService = class SetupChecksService {
548
547
  // the in-flight tracker merges the instance's abort into the signal the check gets
549
548
  () => check.inflight.run(signal, (s) => check.run(this.pluginArgs(p, material, config, locale, s))), () => (check.signal.aborted ? "unloaded" : "timeout"));
550
549
  }
550
+ else if (check.scope === "deployment") {
551
+ answer = await raceSignal(timeout, check.run, () => "timeout");
552
+ }
551
553
  else {
552
- // refused for the deployment before the lock (`runPrepared`)
553
554
  if (p.orgId === null)
554
- throw new Error("a kernel check has no deployment target");
555
+ throw new Error("an org kernel check requires an org target");
555
556
  const signal = timeout;
556
557
  const args = Object.freeze({
557
558
  orgId: p.orgId,
@@ -3,6 +3,7 @@ import { EventLog } from "../conversations/event-log.js";
3
3
  import type { KernelSchemaDb, SkillManifest } from "../db/kernel-schema.js";
4
4
  import { KernelDb } from "../infra/database/kernel-db.js";
5
5
  import { TransactionHost } from "../infra/database/transaction-host.js";
6
+ import { type HintPublisher } from "../invalidation/audiences.js";
6
7
  import type { KernelLogger } from "../log.js";
7
8
  import { OrgLock } from "../orgs/org-lock.js";
8
9
  import { StorageService } from "../storage/storage.service.js";
@@ -120,10 +121,14 @@ export declare class AgentSkillsService {
120
121
  private readonly skills;
121
122
  private readonly attachments;
122
123
  private readonly orgLock;
124
+ /** A new change request publishes `inbox` to the org's admins after the commit. */
125
+ private readonly hints;
123
126
  private readonly catalogDeps;
124
127
  constructor(db: KernelDb, storage: StorageService, eventLog: EventLog, log: KernelLogger, txHost: TransactionHost,
125
128
  /** An org admin maintainer's version of a shared skill is an org skill version. */
126
- skills: SkillsService, attachments: AttachmentsService, orgLock: OrgLock);
129
+ skills: SkillsService, attachments: AttachmentsService, orgLock: OrgLock,
130
+ /** A new change request publishes `inbox` to the org's admins after the commit. */
131
+ hints: HintPublisher);
127
132
  /**
128
133
  * Registers a skill package upload onto an agent (presigned, `application/zip`, <= 50 MB): only
129
134
  * the agent's current owner (403 `forbidden`, 404 `agent.not_found` when not visible). Agent
@@ -22,6 +22,8 @@ import { KernelDb } from "../infra/database/kernel-db.js";
22
22
  import { TransactionHost } from "../infra/database/transaction-host.js";
23
23
  import { Transactional } from "../infra/database/transactional.decorator.js";
24
24
  import { KERNEL_LOGGER } from "../infra/tokens.js";
25
+ import { publishOrgAdminsInbox } from "../invalidation/audiences.js";
26
+ import { InvalidationHints } from "../invalidation/invalidation-hints.js";
25
27
  import { OrgLock } from "../orgs/org-lock.js";
26
28
  import { roleAtLeast } from "../orgs/roles.js";
27
29
  import { StorageService } from "../storage/storage.service.js";
@@ -205,10 +207,13 @@ let AgentSkillsService = class AgentSkillsService {
205
207
  skills;
206
208
  attachments;
207
209
  orgLock;
210
+ hints;
208
211
  catalogDeps;
209
212
  constructor(db, storage, eventLog, log, txHost,
210
213
  /** An org admin maintainer's version of a shared skill is an org skill version. */
211
- skills, attachments, orgLock) {
214
+ skills, attachments, orgLock,
215
+ /** A new change request publishes `inbox` to the org's admins after the commit. */
216
+ hints) {
212
217
  this.db = db;
213
218
  this.storage = storage;
214
219
  this.eventLog = eventLog;
@@ -217,7 +222,8 @@ let AgentSkillsService = class AgentSkillsService {
217
222
  this.skills = skills;
218
223
  this.attachments = attachments;
219
224
  this.orgLock = orgLock;
220
- this.catalogDeps = { db, log, eventLog };
225
+ this.hints = hints;
226
+ this.catalogDeps = { db, log, eventLog, hints };
221
227
  }
222
228
  /**
223
229
  * Registers a skill package upload onto an agent (presigned, `application/zip`, <= 50 MB): only
@@ -735,6 +741,7 @@ let AgentSkillsService = class AgentSkillsService {
735
741
  requested_in_conversation: here,
736
742
  })
737
743
  .execute();
744
+ publishOrgAdminsInbox(this.hints, [actor.orgId]);
738
745
  await audit(this.db.db, {
739
746
  actorAccountId: actor.accountId,
740
747
  ...(actor.actorTokenId !== undefined && { actorTokenId: actor.actorTokenId }),
@@ -862,6 +869,7 @@ let AgentSkillsService = class AgentSkillsService {
862
869
  requested_in_conversation: null,
863
870
  })
864
871
  .execute();
872
+ publishOrgAdminsInbox(this.hints, [actor.orgId]);
865
873
  await audit(this.db.db, {
866
874
  ...who,
867
875
  action: "skill.share_requested",
@@ -966,6 +974,7 @@ AgentSkillsService = __decorate([
966
974
  __param(4, Inject(TransactionHost)),
967
975
  __param(5, Inject(SkillsService)),
968
976
  __param(6, Inject(AttachmentsService)),
969
- __param(7, Inject(OrgLock))
977
+ __param(7, Inject(OrgLock)),
978
+ __param(8, Inject(InvalidationHints))
970
979
  ], AgentSkillsService);
971
980
  export { AgentSkillsService };
@@ -1,6 +1,7 @@
1
1
  import { EventLog } from "../conversations/event-log.js";
2
2
  import { KernelDb } from "../infra/database/kernel-db.js";
3
3
  import { TransactionHost } from "../infra/database/transaction-host.js";
4
+ import { type HintPublisher } from "../invalidation/audiences.js";
4
5
  import type { KernelLogger } from "../log.js";
5
6
  import { OrgLock } from "../orgs/org-lock.js";
6
7
  import { StorageService } from "../storage/storage.service.js";
@@ -86,10 +87,14 @@ export declare class SkillChangesService {
86
87
  private readonly orgLock;
87
88
  /** An approved version is an org skill version. */
88
89
  private readonly skills;
90
+ /** A decision publishes `inbox` to the org's admins after the commit. */
91
+ private readonly hints;
89
92
  private readonly catalogDeps;
90
93
  constructor(db: KernelDb, storage: StorageService, eventLog: EventLog, log: KernelLogger, txHost: TransactionHost, orgLock: OrgLock,
91
94
  /** An approved version is an org skill version. */
92
- skills: SkillsService);
95
+ skills: SkillsService,
96
+ /** A decision publishes `inbox` to the org's admins after the commit. */
97
+ hints: HintPublisher);
93
98
  /**
94
99
  * An org admin decides a request (see the class comment): not an org admin -> 403 `forbidden`;
95
100
  * already decided -> 409 `skill_change.already_decided`; not in this org -> 404. Approving