@capybara-hq/kernel 0.1.0-rc.141 → 0.1.0-rc.143
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.
- package/dist/agents/agents.module.js +3 -0
- package/dist/agents/agents.service.js +1 -1
- package/dist/agents/org-templates.d.ts +3 -1
- package/dist/agents/org-templates.js +7 -3
- package/dist/agents/pending-connector-requests.d.ts +10 -4
- package/dist/agents/pending-connector-requests.js +29 -7
- package/dist/automations/events/acceptance.d.ts +6 -1
- package/dist/automations/events/acceptance.js +30 -11
- package/dist/catalog/catalog-import.module.js +3 -0
- package/dist/catalog/catalog-scope.service.d.ts +3 -1
- package/dist/catalog/catalog-scope.service.js +11 -7
- package/dist/catalog/catalog.module.js +3 -0
- package/dist/catalog/catalog.service.d.ts +3 -1
- package/dist/catalog/catalog.service.js +8 -4
- package/dist/catalog/component-promotion.d.ts +3 -1
- package/dist/catalog/component-promotion.js +7 -3
- package/dist/catalog/component-scope.service.d.ts +3 -1
- package/dist/catalog/component-scope.service.js +7 -3
- package/dist/catalog/enable-requests.d.ts +10 -8
- package/dist/catalog/enable-requests.js +40 -21
- package/dist/catalog/owned-items.d.ts +3 -1
- package/dist/catalog/owned-items.js +13 -9
- package/dist/catalog/platform-components.d.ts +6 -1
- package/dist/catalog/platform-components.js +9 -3
- package/dist/catalog/plugin-connectors.d.ts +8 -4
- package/dist/catalog/plugin-connectors.js +12 -6
- package/dist/catalog/plugin-import.d.ts +3 -1
- package/dist/catalog/plugin-import.js +14 -5
- package/dist/catalog/plugin-install.d.ts +3 -1
- package/dist/catalog/plugin-install.js +8 -4
- package/dist/catalog/plugin-upgrade.d.ts +3 -1
- package/dist/catalog/plugin-upgrade.js +8 -4
- package/dist/catalog/request-hints.d.ts +19 -0
- package/dist/catalog/request-hints.js +34 -0
- package/dist/catalog/request-rules.d.ts +9 -5
- package/dist/catalog/request-rules.js +16 -9
- package/dist/catalog/requests.service.d.ts +3 -1
- package/dist/catalog/requests.service.js +28 -9
- package/dist/catalog/scope-orgs.d.ts +2 -1
- package/dist/catalog/scope-orgs.js +2 -2
- package/dist/catalog/scope-sync.d.ts +3 -1
- package/dist/catalog/scope-sync.js +12 -2
- package/dist/catalog/scope-writer.d.ts +6 -3
- package/dist/catalog/scope-writer.js +28 -10
- package/dist/catalog/unshare.d.ts +3 -2
- package/dist/catalog/unshare.js +4 -4
- package/dist/config/schema.d.ts +4 -0
- package/dist/config/schema.js +40 -0
- package/dist/db/migrator.js +36 -0
- package/dist/extensions/admin-ops.d.ts +6 -1
- package/dist/extensions/admin-ops.js +17 -4
- package/dist/extensions/deployment-config.d.ts +6 -1
- package/dist/extensions/deployment-config.js +13 -2
- package/dist/extensions/extensions.module.js +3 -0
- package/dist/extensions/org-config.d.ts +3 -1
- package/dist/extensions/org-config.js +13 -4
- package/dist/extensions/org-overrides.d.ts +6 -1
- package/dist/extensions/org-overrides.js +13 -2
- package/dist/http/api.module.js +6 -0
- package/dist/inbox/inbox-items.service.d.ts +6 -1
- package/dist/inbox/inbox-items.service.js +29 -10
- package/dist/inbox/inbox.module.js +3 -0
- package/dist/inbox/inbox.service.d.ts +3 -1
- package/dist/inbox/inbox.service.js +9 -2
- package/dist/inbox/org-notices.d.ts +4 -3
- package/dist/inbox/org-notices.js +9 -6
- package/dist/inbox/platform-inbox.service.d.ts +3 -1
- package/dist/inbox/platform-inbox.service.js +11 -3
- package/dist/inbox/platform-notices.d.ts +3 -2
- package/dist/inbox/platform-notices.js +10 -4
- package/dist/infra/config/kernel-config.service.js +5 -0
- package/dist/invalidation/audiences.d.ts +32 -0
- package/dist/invalidation/audiences.js +43 -0
- package/dist/invalidation/hints.d.ts +62 -0
- package/dist/invalidation/hints.js +73 -0
- package/dist/invalidation/invalidation-hints.d.ts +35 -0
- package/dist/invalidation/invalidation-hints.js +100 -0
- package/dist/invalidation/invalidation-hints.module.d.ts +10 -0
- package/dist/invalidation/invalidation-hints.module.js +26 -0
- package/dist/invalidation/me-stream.controller.d.ts +30 -0
- package/dist/invalidation/me-stream.controller.js +100 -0
- package/dist/invalidation/me-stream.d.ts +57 -0
- package/dist/invalidation/me-stream.js +322 -0
- package/dist/invalidation/me-stream.module.d.ts +7 -0
- package/dist/invalidation/me-stream.module.js +22 -0
- package/dist/invalidation/org-intent-bridge.d.ts +18 -0
- package/dist/invalidation/org-intent-bridge.js +46 -0
- package/dist/kernel.module.js +4 -0
- package/dist/models/enablement.d.ts +3 -1
- package/dist/models/enablement.js +25 -5
- package/dist/orgs/offboarding.d.ts +3 -1
- package/dist/orgs/offboarding.js +7 -3
- package/dist/orgs/orgs.module.js +3 -0
- package/dist/orgs/orgs.service.d.ts +3 -1
- package/dist/orgs/orgs.service.js +7 -3
- package/dist/platform/exclusions.js +5 -0
- package/dist/push/delivery.d.ts +3 -1
- package/dist/push/delivery.js +7 -3
- package/dist/push/push-processor.js +8 -1
- package/dist/runtime/stream-limit.d.ts +13 -0
- package/dist/runtime/stream-limit.js +40 -0
- package/dist/runtime/stream.controller.d.ts +2 -0
- package/dist/runtime/stream.controller.js +2 -0
- package/dist/runtime/stream.d.ts +1 -0
- package/dist/runtime/stream.js +15 -6
- package/dist/sandbox/permission-authority.module.js +6 -1
- package/dist/sandbox/permission-transitions.d.ts +3 -1
- package/dist/sandbox/permission-transitions.js +17 -2
- package/dist/skills/agent-skills.service.d.ts +6 -1
- package/dist/skills/agent-skills.service.js +12 -3
- package/dist/skills/changes.service.d.ts +6 -1
- package/dist/skills/changes.service.js +11 -3
- package/dist/skills/conversation-catalog.d.ts +3 -0
- package/dist/skills/conversation-catalog.js +2 -0
- package/dist/skills/skills.module.js +3 -0
- package/dist/skills/skills.service.d.ts +3 -1
- package/dist/skills/skills.service.js +8 -4
- package/dist/tools/approvals.service.d.ts +12 -1
- package/dist/tools/approvals.service.js +36 -9
- package/dist/tools/connectors.service.d.ts +3 -1
- package/dist/tools/connectors.service.js +29 -7
- package/dist/tools/tools.module.js +3 -0
- package/dist/ui/admin-ui.controller.d.ts +3 -1
- package/dist/ui/admin-ui.controller.js +3 -1
- package/dist/ui/ui-stream.d.ts +2 -0
- package/dist/ui/ui-stream.js +20 -6
- package/dist/ui/views.controller.d.ts +4 -2
- package/dist/ui/views.controller.js +4 -2
- package/package.json +1 -1
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
};
|
|
10
|
+
import { Inject, Injectable, Optional } from "@nestjs/common";
|
|
11
|
+
import { ApiError } from "../errors.js";
|
|
12
|
+
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
13
|
+
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
14
|
+
import { withOrgScope } from "../infra/database/org-scope.js";
|
|
15
|
+
import { GracefulShutdown } from "../infra/lifecycle/graceful-shutdown.service.js";
|
|
16
|
+
import { KERNEL_BUS, KERNEL_LOGGER } from "../infra/tokens.js";
|
|
17
|
+
import { ORG_ROLES } from "../orgs/roles.js";
|
|
18
|
+
import { endedStream, } from "../runtime/stream.js";
|
|
19
|
+
import { PerAccountStreamLimit, SUPERSEDED_FRAME } from "../runtime/stream-limit.js";
|
|
20
|
+
import { hintFrame, parseHint, streamTopics } from "./hints.js";
|
|
21
|
+
/** Reads the membership, role, account status and super admin flag in one query. */
|
|
22
|
+
let MeStreamAccess = class MeStreamAccess {
|
|
23
|
+
db;
|
|
24
|
+
constructor(db) {
|
|
25
|
+
this.db = db;
|
|
26
|
+
}
|
|
27
|
+
async state(orgId, accountId) {
|
|
28
|
+
const row = await this.db
|
|
29
|
+
.selectFrom("accounts")
|
|
30
|
+
.leftJoin("memberships", (j) => j.onRef("memberships.account_id", "=", "accounts.id").on("memberships.org_id", "=", orgId))
|
|
31
|
+
.leftJoin("orgs", (j) => j.onRef("orgs.id", "=", "memberships.org_id").on("orgs.deleted_at", "is", null))
|
|
32
|
+
.select([
|
|
33
|
+
"accounts.status",
|
|
34
|
+
"accounts.is_super_admin",
|
|
35
|
+
"memberships.role",
|
|
36
|
+
"orgs.id as live_org_id",
|
|
37
|
+
])
|
|
38
|
+
.where("accounts.id", "=", accountId)
|
|
39
|
+
.executeTakeFirst();
|
|
40
|
+
if (!row)
|
|
41
|
+
return { status: undefined, superAdmin: false, role: undefined };
|
|
42
|
+
return {
|
|
43
|
+
status: row.status,
|
|
44
|
+
superAdmin: row.is_super_admin === true,
|
|
45
|
+
role: row.live_org_id !== null && row.role !== null ? row.role : undefined,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
MeStreamAccess = __decorate([
|
|
50
|
+
Injectable(),
|
|
51
|
+
__param(0, Inject(KernelDb))
|
|
52
|
+
], MeStreamAccess);
|
|
53
|
+
export { MeStreamAccess };
|
|
54
|
+
/** The slow client cap: hints are tiny, so a client this far behind has stopped reading. */
|
|
55
|
+
export const ME_STREAM_MAX_BACKLOG_BYTES = 64 * 1024;
|
|
56
|
+
const roleRank = (r) => ORG_ROLES.indexOf(r);
|
|
57
|
+
async function verdict(d, p) {
|
|
58
|
+
const denied = await p.credential();
|
|
59
|
+
if (denied !== null)
|
|
60
|
+
return { code: denied };
|
|
61
|
+
const s = await withOrgScope(p.orgId, () => d.access.state(p.orgId, p.accountId));
|
|
62
|
+
if (s.status === undefined)
|
|
63
|
+
return { code: "auth.required" };
|
|
64
|
+
if (s.status !== "active")
|
|
65
|
+
return { code: "auth.account_disabled" };
|
|
66
|
+
if (s.role === undefined)
|
|
67
|
+
return { code: "org.not_found" };
|
|
68
|
+
return { role: s.role, superAdmin: s.superAdmin };
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The account invalidation streams of this replica (`GET /api/v1/orgs/:orgId/me/stream`, account
|
|
72
|
+
* invalidation stream spec §5): each forwards the hints of its topics as `event: hint` frames.
|
|
73
|
+
* Topics are recomputed on every `runtime.sseRecheckMs` recheck (credential first, then the
|
|
74
|
+
* membership, role, account status and super admin flag); a lost membership, a disabled account or
|
|
75
|
+
* a revoked credential ends the stream with `event: error` (`data: {"code"}`). At most
|
|
76
|
+
* `runtime.meStreamMaxPerAccount` streams per account on this replica: a new one over the cap
|
|
77
|
+
* supersedes the account's oldest (`event: closed`, `data: {"reason":"superseded"}`). No replay:
|
|
78
|
+
* the client refetches on open. Across replicas only through the Redis bus; this process holds
|
|
79
|
+
* only its connections' subscriptions and timers, closed at shutdown.
|
|
80
|
+
*/
|
|
81
|
+
let MeStreams = class MeStreams {
|
|
82
|
+
active = new Set();
|
|
83
|
+
limit = new PerAccountStreamLimit();
|
|
84
|
+
closing = false;
|
|
85
|
+
d;
|
|
86
|
+
constructor(bus, access, config, log, shutdown) {
|
|
87
|
+
this.d = { bus, access, config, log };
|
|
88
|
+
if (shutdown?.signal.aborted)
|
|
89
|
+
this.closeAll();
|
|
90
|
+
else
|
|
91
|
+
shutdown?.signal.addEventListener("abort", () => this.closeAll(), { once: true });
|
|
92
|
+
}
|
|
93
|
+
/** Checks access and subscribes; a refusal throws before anything was written. */
|
|
94
|
+
async open(p, out) {
|
|
95
|
+
const v = await verdict(this.d, p);
|
|
96
|
+
if ("code" in v)
|
|
97
|
+
throw new ApiError(v.code, "Access denied");
|
|
98
|
+
if (this.closing)
|
|
99
|
+
return endedStream(out);
|
|
100
|
+
const conn = new MeConnection(this.d, p, out, this.limit, () => this.active.delete(conn));
|
|
101
|
+
this.active.add(conn);
|
|
102
|
+
try {
|
|
103
|
+
await conn.apply(v.role, v.superAdmin, false);
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
conn.close();
|
|
107
|
+
throw e;
|
|
108
|
+
}
|
|
109
|
+
if (this.closing || conn.isClosed) {
|
|
110
|
+
conn.close();
|
|
111
|
+
return endedStream(out);
|
|
112
|
+
}
|
|
113
|
+
// counted against the cap only at begin(), once its subscriptions work and its headers go out:
|
|
114
|
+
// a failed open, or a client already gone (never begun), supersedes nothing
|
|
115
|
+
return conn;
|
|
116
|
+
}
|
|
117
|
+
/** Closes every stream of this process (at shutdown) and latches. */
|
|
118
|
+
closeAll() {
|
|
119
|
+
this.closing = true;
|
|
120
|
+
for (const c of [...this.active])
|
|
121
|
+
c.close();
|
|
122
|
+
}
|
|
123
|
+
get size() {
|
|
124
|
+
return this.active.size;
|
|
125
|
+
}
|
|
126
|
+
/** How many streams `accountId` holds on this replica. */
|
|
127
|
+
countOf(accountId) {
|
|
128
|
+
return this.limit.countOf(accountId);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
MeStreams = __decorate([
|
|
132
|
+
Injectable(),
|
|
133
|
+
__param(0, Inject(KERNEL_BUS)),
|
|
134
|
+
__param(1, Inject(MeStreamAccess)),
|
|
135
|
+
__param(2, Inject(KernelConfigService)),
|
|
136
|
+
__param(3, Inject(KERNEL_LOGGER)),
|
|
137
|
+
__param(4, Optional()),
|
|
138
|
+
__param(4, Inject(GracefulShutdown))
|
|
139
|
+
], MeStreams);
|
|
140
|
+
export { MeStreams };
|
|
141
|
+
class MeConnection {
|
|
142
|
+
d;
|
|
143
|
+
p;
|
|
144
|
+
out;
|
|
145
|
+
onClosed;
|
|
146
|
+
closed = false;
|
|
147
|
+
begun = false;
|
|
148
|
+
rechecking = false;
|
|
149
|
+
role;
|
|
150
|
+
superAdmin = false;
|
|
151
|
+
/**
|
|
152
|
+
* The topics subscribed now, each with its own subscription: a topic leaves this map before its
|
|
153
|
+
* unsubscribe is awaited, and a handler delivers only while its own subscription is the current
|
|
154
|
+
* one (a topic dropped and re-added never delivers twice).
|
|
155
|
+
*/
|
|
156
|
+
subs = new Map();
|
|
157
|
+
timers = [];
|
|
158
|
+
slot;
|
|
159
|
+
constructor(d, p, out, limit, onClosed) {
|
|
160
|
+
this.d = d;
|
|
161
|
+
this.p = p;
|
|
162
|
+
this.out = out;
|
|
163
|
+
this.onClosed = onClosed;
|
|
164
|
+
this.slot = limit.register(p.accountId, () => this.close("end", SUPERSEDED_FRAME));
|
|
165
|
+
}
|
|
166
|
+
get isClosed() {
|
|
167
|
+
return this.closed;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Moves the subscriptions to the topics of (`role`, `superAdmin`): dropped topics stop
|
|
171
|
+
* delivering at once, new ones are subscribed. On an upgrade (`notify`) the client is told to
|
|
172
|
+
* refetch what the new role sees.
|
|
173
|
+
*/
|
|
174
|
+
async apply(role, superAdmin, notify) {
|
|
175
|
+
const before = this.role;
|
|
176
|
+
const wasSuperAdmin = this.superAdmin;
|
|
177
|
+
this.role = role;
|
|
178
|
+
this.superAdmin = superAdmin;
|
|
179
|
+
const want = new Set(streamTopics({ accountId: this.p.accountId, orgId: this.p.orgId, role, superAdmin }));
|
|
180
|
+
for (const [topic, sub] of [...this.subs]) {
|
|
181
|
+
if (want.has(topic))
|
|
182
|
+
continue;
|
|
183
|
+
this.subs.delete(topic);
|
|
184
|
+
void this.release(topic, sub);
|
|
185
|
+
}
|
|
186
|
+
const added = [...want].filter((t) => !this.subs.has(t));
|
|
187
|
+
const fresh = added.map((topic) => {
|
|
188
|
+
const sub = { un: Promise.resolve(undefined) };
|
|
189
|
+
sub.un = this.subscribe(topic, sub);
|
|
190
|
+
this.subs.set(topic, sub);
|
|
191
|
+
return sub.un;
|
|
192
|
+
});
|
|
193
|
+
await Promise.all(fresh);
|
|
194
|
+
if (!notify || this.closed)
|
|
195
|
+
return;
|
|
196
|
+
if (before !== undefined && roleRank(role) > roleRank(before)) {
|
|
197
|
+
this.send({ kind: "capabilities" });
|
|
198
|
+
this.send({ kind: "inbox" });
|
|
199
|
+
}
|
|
200
|
+
if (superAdmin && !wasSuperAdmin)
|
|
201
|
+
this.send({ kind: "platform-inbox" });
|
|
202
|
+
}
|
|
203
|
+
async subscribe(topic, sub) {
|
|
204
|
+
const current = () => this.subs.get(topic) === sub;
|
|
205
|
+
const un = await this.d.bus.subscribe(topic, (m) => {
|
|
206
|
+
// only while this subscription is the topic's current one (a downgrade drops it at once)
|
|
207
|
+
if (!current())
|
|
208
|
+
return;
|
|
209
|
+
const h = parseHint(m);
|
|
210
|
+
if (h === undefined) {
|
|
211
|
+
this.d.log.warn("me stream dropped a malformed hint", { topic });
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
this.send(h);
|
|
215
|
+
});
|
|
216
|
+
if (this.closed || !current()) {
|
|
217
|
+
await un();
|
|
218
|
+
return undefined;
|
|
219
|
+
}
|
|
220
|
+
return un;
|
|
221
|
+
}
|
|
222
|
+
async release(topic, sub) {
|
|
223
|
+
try {
|
|
224
|
+
const un = await sub.un;
|
|
225
|
+
await un?.();
|
|
226
|
+
}
|
|
227
|
+
catch (err) {
|
|
228
|
+
this.d.log.warn("me stream unsubscribe failed", { orgId: this.p.orgId, topic, err });
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
begin() {
|
|
232
|
+
if (this.begun)
|
|
233
|
+
return;
|
|
234
|
+
if (this.closed) {
|
|
235
|
+
// closed before the headers went out (shutdown): end the empty stream
|
|
236
|
+
try {
|
|
237
|
+
this.out.end();
|
|
238
|
+
}
|
|
239
|
+
catch {
|
|
240
|
+
// the connection is already gone
|
|
241
|
+
}
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
this.begun = true;
|
|
245
|
+
const { sseHeartbeatMs, sseRecheckMs, meStreamMaxPerAccount } = this.d.config.get().runtime;
|
|
246
|
+
this.slot.begin(meStreamMaxPerAccount);
|
|
247
|
+
this.timers.push(setInterval(() => this.write(": ping\n\n"), sseHeartbeatMs), setInterval(() => void this.recheck(), sseRecheckMs));
|
|
248
|
+
}
|
|
249
|
+
close(mode = "end", finalFrame) {
|
|
250
|
+
if (this.closed)
|
|
251
|
+
return;
|
|
252
|
+
this.closed = true;
|
|
253
|
+
this.slot.close();
|
|
254
|
+
for (const t of this.timers)
|
|
255
|
+
clearInterval(t);
|
|
256
|
+
this.timers = [];
|
|
257
|
+
for (const [topic, sub] of [...this.subs])
|
|
258
|
+
void this.release(topic, sub);
|
|
259
|
+
this.subs.clear();
|
|
260
|
+
if (this.begun) {
|
|
261
|
+
try {
|
|
262
|
+
if (finalFrame !== undefined && mode === "end")
|
|
263
|
+
this.out.write(finalFrame);
|
|
264
|
+
if (mode === "abort")
|
|
265
|
+
this.out.abort();
|
|
266
|
+
else
|
|
267
|
+
this.out.end();
|
|
268
|
+
}
|
|
269
|
+
catch {
|
|
270
|
+
// the connection is already gone
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
this.onClosed();
|
|
274
|
+
}
|
|
275
|
+
send(h) {
|
|
276
|
+
// hints before begin() (headers not written yet) are dropped: the client refetches on open
|
|
277
|
+
if (!this.begun)
|
|
278
|
+
return;
|
|
279
|
+
this.write(hintFrame(h));
|
|
280
|
+
}
|
|
281
|
+
write(chunk) {
|
|
282
|
+
if (this.closed || !this.begun)
|
|
283
|
+
return;
|
|
284
|
+
try {
|
|
285
|
+
this.out.write(chunk);
|
|
286
|
+
}
|
|
287
|
+
catch {
|
|
288
|
+
this.close("abort");
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
if (this.out.backlog() > ME_STREAM_MAX_BACKLOG_BYTES) {
|
|
292
|
+
this.d.log.warn("me stream client too slow; closing", { orgId: this.p.orgId });
|
|
293
|
+
this.close("abort");
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
/** Re-checks access and recomputes the topics; a refusal sends `event: error` and closes. */
|
|
297
|
+
async recheck() {
|
|
298
|
+
if (this.closed || this.rechecking)
|
|
299
|
+
return;
|
|
300
|
+
this.rechecking = true;
|
|
301
|
+
try {
|
|
302
|
+
const v = await verdict(this.d, this.p);
|
|
303
|
+
if (this.closed)
|
|
304
|
+
return;
|
|
305
|
+
if ("code" in v) {
|
|
306
|
+
this.fail(v.code);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
await this.apply(v.role, v.superAdmin, true);
|
|
310
|
+
}
|
|
311
|
+
catch (err) {
|
|
312
|
+
this.d.log.warn("me stream access re-check failed; closing", { orgId: this.p.orgId, err });
|
|
313
|
+
this.fail("internal");
|
|
314
|
+
}
|
|
315
|
+
finally {
|
|
316
|
+
this.rechecking = false;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
fail(code) {
|
|
320
|
+
this.close("end", `event: error\ndata: ${JSON.stringify({ code })}\n\n`);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This replica's account invalidation streams ({@link MeStreams}, served by `MeStreamController`,
|
|
3
|
+
* listed in `ApiModule`'s controllers). Imported only by `ApiModule`, so a process without the api
|
|
4
|
+
* role holds no stream machinery.
|
|
5
|
+
*/
|
|
6
|
+
export declare class MeStreamModule {
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Module } from "@nestjs/common";
|
|
8
|
+
import { MeStreamAccess, MeStreams } from "./me-stream.js";
|
|
9
|
+
/**
|
|
10
|
+
* This replica's account invalidation streams ({@link MeStreams}, served by `MeStreamController`,
|
|
11
|
+
* listed in `ApiModule`'s controllers). Imported only by `ApiModule`, so a process without the api
|
|
12
|
+
* role holds no stream machinery.
|
|
13
|
+
*/
|
|
14
|
+
let MeStreamModule = class MeStreamModule {
|
|
15
|
+
};
|
|
16
|
+
MeStreamModule = __decorate([
|
|
17
|
+
Module({
|
|
18
|
+
providers: [MeStreamAccess, MeStreams],
|
|
19
|
+
exports: [MeStreams],
|
|
20
|
+
})
|
|
21
|
+
], MeStreamModule);
|
|
22
|
+
export { MeStreamModule };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type OnModuleDestroy, type OnModuleInit } from "@nestjs/common";
|
|
2
|
+
import { KernelEvents } from "../infra/events/kernel-events.js";
|
|
3
|
+
import { InvalidationHints } from "./invalidation-hints.js";
|
|
4
|
+
/**
|
|
5
|
+
* Bridges the in-process `catalog.org-intent-changed` event (emitted after the commit of a catalog
|
|
6
|
+
* write) to the account invalidation stream (spec §4 "Org intent"): an event naming an org
|
|
7
|
+
* publishes `capabilities` on that org's caps topic. A deployment-wide event (no org) publishes
|
|
8
|
+
* nothing here: its orgs are the plugin effect pairs the writer owed, and each pair's job
|
|
9
|
+
* publishes for its org when it settles (`PluginScopeSync`), so no writer reads every org.
|
|
10
|
+
*/
|
|
11
|
+
export declare class OrgIntentHintsBridge implements OnModuleInit, OnModuleDestroy {
|
|
12
|
+
private readonly events;
|
|
13
|
+
private readonly hints;
|
|
14
|
+
private off;
|
|
15
|
+
constructor(events: Pick<KernelEvents, "on">, hints: Pick<InvalidationHints, "publish">);
|
|
16
|
+
onModuleInit(): void;
|
|
17
|
+
onModuleDestroy(): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
};
|
|
10
|
+
import { Inject, Injectable } from "@nestjs/common";
|
|
11
|
+
import { KernelEvents } from "../infra/events/kernel-events.js";
|
|
12
|
+
import { orgCapsTopic } from "./hints.js";
|
|
13
|
+
import { InvalidationHints } from "./invalidation-hints.js";
|
|
14
|
+
/**
|
|
15
|
+
* Bridges the in-process `catalog.org-intent-changed` event (emitted after the commit of a catalog
|
|
16
|
+
* write) to the account invalidation stream (spec §4 "Org intent"): an event naming an org
|
|
17
|
+
* publishes `capabilities` on that org's caps topic. A deployment-wide event (no org) publishes
|
|
18
|
+
* nothing here: its orgs are the plugin effect pairs the writer owed, and each pair's job
|
|
19
|
+
* publishes for its org when it settles (`PluginScopeSync`), so no writer reads every org.
|
|
20
|
+
*/
|
|
21
|
+
let OrgIntentHintsBridge = class OrgIntentHintsBridge {
|
|
22
|
+
events;
|
|
23
|
+
hints;
|
|
24
|
+
off;
|
|
25
|
+
constructor(events, hints) {
|
|
26
|
+
this.events = events;
|
|
27
|
+
this.hints = hints;
|
|
28
|
+
}
|
|
29
|
+
onModuleInit() {
|
|
30
|
+
this.off = this.events.on("catalog.org-intent-changed", async ({ orgId }) => {
|
|
31
|
+
// already after the commit (the emitter's afterCommit)
|
|
32
|
+
if (typeof orgId === "string") {
|
|
33
|
+
await this.hints.publish([orgCapsTopic(orgId)], { kind: "capabilities" });
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
onModuleDestroy() {
|
|
38
|
+
this.off?.();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
OrgIntentHintsBridge = __decorate([
|
|
42
|
+
Injectable(),
|
|
43
|
+
__param(0, Inject(KernelEvents)),
|
|
44
|
+
__param(1, Inject(InvalidationHints))
|
|
45
|
+
], OrgIntentHintsBridge);
|
|
46
|
+
export { OrgIntentHintsBridge };
|
package/dist/kernel.module.js
CHANGED
|
@@ -40,6 +40,7 @@ import { RedisModule } from "./infra/redis/redis.module.js";
|
|
|
40
40
|
import { KernelThrottlerModule } from "./infra/throttler/throttler.module.js";
|
|
41
41
|
import { KERNEL_POOL, REDIS } from "./infra/tokens.js";
|
|
42
42
|
import { ValidationModule } from "./infra/validation/validation.module.js";
|
|
43
|
+
import { InvalidationHintsModule } from "./invalidation/invalidation-hints.module.js";
|
|
43
44
|
import { KernelLifecycle } from "./lifecycle/kernel-lifecycle.js";
|
|
44
45
|
import { KERNEL_APP_OPTIONS } from "./lifecycle/tokens.js";
|
|
45
46
|
import { createConfiguredLogger } from "./log-config.js";
|
|
@@ -142,6 +143,9 @@ let KernelModule = KernelModule_1 = class KernelModule {
|
|
|
142
143
|
TriggerEventsModule,
|
|
143
144
|
// ctx.inbox: personal inbox items extensions post (the host finds it at the time of use)
|
|
144
145
|
InboxItemsModule,
|
|
146
|
+
// account invalidation hints: writers on every role (api requests, worker jobs, gateway
|
|
147
|
+
// events) publish them; the streams that deliver them are the api role's (MeStreamModule)
|
|
148
|
+
InvalidationHintsModule,
|
|
145
149
|
// ctx.agents / ctx.conversations / ctx.people: read-only org facts (found at the time of use)
|
|
146
150
|
PluginReadsModule,
|
|
147
151
|
// ctx.conversations' external methods and the external conversation calls' queue (found at
|
|
@@ -4,6 +4,7 @@ import { SuperAdminLock } from "../identity/super-admin.js";
|
|
|
4
4
|
import { CacheService } from "../infra/cache/cache.service.js";
|
|
5
5
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
6
6
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
7
|
+
import { type HintPublisher } from "../invalidation/audiences.js";
|
|
7
8
|
import { OrgLock } from "../orgs/org-lock.js";
|
|
8
9
|
import type { OrgRole } from "../orgs/roles.js";
|
|
9
10
|
/** The key of a model in a disabled set: `provider\u0000model`. */
|
|
@@ -59,7 +60,8 @@ export declare class ModelEnablement {
|
|
|
59
60
|
private readonly extensions;
|
|
60
61
|
private readonly adminLock;
|
|
61
62
|
private readonly orgLock;
|
|
62
|
-
|
|
63
|
+
private readonly hints;
|
|
64
|
+
constructor(kdb: KernelDb, txHost: TransactionHost, cacheService: CacheService, extensions: Pick<ExtensionRegistry, "list">, adminLock: Pick<SuperAdminLock, "lockAndAuthorize">, orgLock: Pick<OrgLock, "lockAndAuthorize">, hints: HintPublisher);
|
|
63
65
|
private get db();
|
|
64
66
|
/** One layer's disabled models (keys {@link modelKey}): the platform's (`null`) or the org's own. */
|
|
65
67
|
disabled(orgId: string | null): Promise<Set<string>>;
|
|
@@ -20,6 +20,9 @@ import { Cacheable, CacheEvict } from "../infra/cache/cacheable.decorator.js";
|
|
|
20
20
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
21
21
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
22
22
|
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
23
|
+
import { publishCapabilities, publishPlatformCapabilities, } from "../invalidation/audiences.js";
|
|
24
|
+
import { InvalidationHints } from "../invalidation/invalidation-hints.js";
|
|
25
|
+
import { InvalidationHintsModule } from "../invalidation/invalidation-hints.module.js";
|
|
23
26
|
import { OrgLock, OrgLockModule } from "../orgs/org-lock.js";
|
|
24
27
|
/** The key of a model in a disabled set: `provider\u0000model`. */
|
|
25
28
|
export const modelKey = (provider, model) => `${provider}\u0000${model}`;
|
|
@@ -46,13 +49,15 @@ let ModelEnablement = class ModelEnablement {
|
|
|
46
49
|
extensions;
|
|
47
50
|
adminLock;
|
|
48
51
|
orgLock;
|
|
49
|
-
|
|
52
|
+
hints;
|
|
53
|
+
constructor(kdb, txHost, cacheService, extensions, adminLock, orgLock, hints) {
|
|
50
54
|
this.kdb = kdb;
|
|
51
55
|
this.txHost = txHost;
|
|
52
56
|
this.cacheService = cacheService;
|
|
53
57
|
this.extensions = extensions;
|
|
54
58
|
this.adminLock = adminLock;
|
|
55
59
|
this.orgLock = orgLock;
|
|
60
|
+
this.hints = hints;
|
|
56
61
|
}
|
|
57
62
|
get db() {
|
|
58
63
|
return this.kdb.db;
|
|
@@ -163,14 +168,22 @@ let ModelEnablement = class ModelEnablement {
|
|
|
163
168
|
}
|
|
164
169
|
// models the platform disabled: every org's pending requests for them are cancelled
|
|
165
170
|
if (orgId === null) {
|
|
166
|
-
await cancelEnableRequestsOfPlatformModels(this.db, provider, added, actor.accountId);
|
|
171
|
+
await cancelEnableRequestsOfPlatformModels(this.db, this.hints, provider, added, actor.accountId);
|
|
167
172
|
}
|
|
168
173
|
// models an org admin switched back on settle the org's pending enable requests for them
|
|
169
174
|
if (orgId !== null) {
|
|
170
175
|
for (const model of removed) {
|
|
171
|
-
await settleEnableRequests(this.db, orgId, { kind: "model", id: encodeModelId(provider, model) }, actor.accountId, { ...(actor.tokenId !== undefined && { actorTokenId: actor.tokenId }) });
|
|
176
|
+
await settleEnableRequests(this.db, this.hints, orgId, { kind: "model", id: encodeModelId(provider, model) }, actor.accountId, { ...(actor.tokenId !== undefined && { actorTokenId: actor.tokenId }) });
|
|
172
177
|
}
|
|
173
178
|
}
|
|
179
|
+
// a model list changed: the org's members refetch, or every org's for the platform's list
|
|
180
|
+
// (`platform-caps`: the writer holds no org set and never reads every org)
|
|
181
|
+
if (added.length > 0 || removed.length > 0) {
|
|
182
|
+
if (orgId !== null)
|
|
183
|
+
publishCapabilities(this.hints, [orgId]);
|
|
184
|
+
else
|
|
185
|
+
publishPlatformCapabilities(this.hints);
|
|
186
|
+
}
|
|
174
187
|
if (added.length > 0 || removed.length > 0) {
|
|
175
188
|
await audit(this.db, {
|
|
176
189
|
actorAccountId: actor.accountId,
|
|
@@ -273,7 +286,8 @@ ModelEnablement = __decorate([
|
|
|
273
286
|
__param(2, Inject(CacheService)),
|
|
274
287
|
__param(3, Inject(ExtensionRegistry)),
|
|
275
288
|
__param(4, Inject(SuperAdminLock)),
|
|
276
|
-
__param(5, Inject(OrgLock))
|
|
289
|
+
__param(5, Inject(OrgLock)),
|
|
290
|
+
__param(6, Inject(InvalidationHints))
|
|
277
291
|
], ModelEnablement);
|
|
278
292
|
export { ModelEnablement };
|
|
279
293
|
/** The one {@link ModelEnablement}: the provider registry, purposes and the controllers read it. */
|
|
@@ -281,7 +295,13 @@ let ModelEnablementModule = class ModelEnablementModule {
|
|
|
281
295
|
};
|
|
282
296
|
ModelEnablementModule = __decorate([
|
|
283
297
|
Module({
|
|
284
|
-
imports: [
|
|
298
|
+
imports: [
|
|
299
|
+
// invalidation hints its writers publish after their commit
|
|
300
|
+
InvalidationHintsModule,
|
|
301
|
+
ExtensionRegistryModule,
|
|
302
|
+
SuperAdminLockModule,
|
|
303
|
+
OrgLockModule,
|
|
304
|
+
],
|
|
285
305
|
providers: [ModelEnablement],
|
|
286
306
|
exports: [ModelEnablement],
|
|
287
307
|
})
|
|
@@ -5,6 +5,7 @@ import { SessionService } from "../identity/sessions.js";
|
|
|
5
5
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
6
6
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
7
7
|
import { OutboxService } from "../infra/outbox/outbox.service.js";
|
|
8
|
+
import type { HintPublisher } from "../invalidation/audiences.js";
|
|
8
9
|
import type { KernelLogger } from "../log.js";
|
|
9
10
|
import { PermissionCeilingWrites } from "../sandbox/permission-ceiling-writes.js";
|
|
10
11
|
import { ApprovalsService } from "../tools/approvals.service.js";
|
|
@@ -87,13 +88,14 @@ export declare class Offboarding {
|
|
|
87
88
|
readonly log: KernelLogger;
|
|
88
89
|
private readonly ceilings;
|
|
89
90
|
private readonly orgLock;
|
|
91
|
+
private readonly hints;
|
|
90
92
|
constructor(db: KernelDb, txHost: TransactionHost, sessions: Pick<SessionService, "markRevoked">, registry: Pick<ExtensionRegistry, "list">, eventLog: Pick<EventLog, "notify" | "publishChanged">,
|
|
91
93
|
/** Owes the run stops and device destroys in the offboard transaction. */
|
|
92
94
|
outbox: Pick<OutboxService, "add">,
|
|
93
95
|
/** Stops the departed member's runs (`by: null`, a system action) in the `run-stop` job. */
|
|
94
96
|
runs: OffboardingRunControl, credentials: Pick<Credentials, "clearAccount">, approvals: Pick<ApprovalsService, "pendingConversationsFor" | "cancelPendingFor">, questions: Pick<QuestionsService, "pendingConversationsFor" | "cancelPendingFor">,
|
|
95
97
|
/** Owes `org.member_removed` to the subscribing plugins, in the offboard transaction. */
|
|
96
|
-
lifecycle: Pick<LifecycleHooks, "recordIn">, log: KernelLogger, ceilings: PermissionCeilingWrites, orgLock: Pick<OrgLock, "lockForRemoval"
|
|
98
|
+
lifecycle: Pick<LifecycleHooks, "recordIn">, log: KernelLogger, ceilings: PermissionCeilingWrites, orgLock: Pick<OrgLock, "lockForRemoval">, hints: HintPublisher);
|
|
97
99
|
/**
|
|
98
100
|
* In the caller's transaction (`mandatory`: the caller holds the org row lock, order org row →
|
|
99
101
|
* membership, and did the "last owner" checks):
|
package/dist/orgs/offboarding.js
CHANGED
|
@@ -27,6 +27,7 @@ import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
|
27
27
|
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
28
28
|
import { OutboxService } from "../infra/outbox/outbox.service.js";
|
|
29
29
|
import { KERNEL_LOGGER } from "../infra/tokens.js";
|
|
30
|
+
import { InvalidationHints } from "../invalidation/invalidation-hints.js";
|
|
30
31
|
import { deletePushRegistrationsForSessions } from "../push/registration-cleanup.js";
|
|
31
32
|
import { MAINTENANCE_QUEUE_NAME } from "../runtime/maintenance-queue.js";
|
|
32
33
|
import { RunControl } from "../runtime/run-control.js";
|
|
@@ -76,13 +77,14 @@ let Offboarding = class Offboarding {
|
|
|
76
77
|
log;
|
|
77
78
|
ceilings;
|
|
78
79
|
orgLock;
|
|
80
|
+
hints;
|
|
79
81
|
constructor(db, txHost, sessions, registry, eventLog,
|
|
80
82
|
/** Owes the run stops and device destroys in the offboard transaction. */
|
|
81
83
|
outbox,
|
|
82
84
|
/** Stops the departed member's runs (`by: null`, a system action) in the `run-stop` job. */
|
|
83
85
|
runs, credentials, approvals, questions,
|
|
84
86
|
/** Owes `org.member_removed` to the subscribing plugins, in the offboard transaction. */
|
|
85
|
-
lifecycle, log, ceilings, orgLock) {
|
|
87
|
+
lifecycle, log, ceilings, orgLock, hints) {
|
|
86
88
|
this.db = db;
|
|
87
89
|
this.txHost = txHost;
|
|
88
90
|
this.sessions = sessions;
|
|
@@ -97,6 +99,7 @@ let Offboarding = class Offboarding {
|
|
|
97
99
|
this.log = log;
|
|
98
100
|
this.ceilings = ceilings;
|
|
99
101
|
this.orgLock = orgLock;
|
|
102
|
+
this.hints = hints;
|
|
100
103
|
}
|
|
101
104
|
/**
|
|
102
105
|
* In the caller's transaction (`mandatory`: the caller holds the org row lock, order org row →
|
|
@@ -263,7 +266,7 @@ let Offboarding = class Offboarding {
|
|
|
263
266
|
.returning("id")
|
|
264
267
|
.execute();
|
|
265
268
|
// their connector setup requests follow them to the org owner (ruling P4-T6-4)
|
|
266
|
-
await retargetSetupRequests(this.db.db, agents.map((a) => a.id), owner.account_id);
|
|
269
|
+
await retargetSetupRequests(this.db.db, this.hints, agents.map((a) => a.id), owner.account_id);
|
|
267
270
|
const threads = await this.db
|
|
268
271
|
.updateTable("channel_threads")
|
|
269
272
|
.set({ archived_at: sql `now()` })
|
|
@@ -509,6 +512,7 @@ Offboarding = __decorate([
|
|
|
509
512
|
__param(10, Inject(LifecycleHooks)),
|
|
510
513
|
__param(11, Inject(KERNEL_LOGGER)),
|
|
511
514
|
__param(12, Inject(PermissionCeilingWrites)),
|
|
512
|
-
__param(13, Inject(OrgLock))
|
|
515
|
+
__param(13, Inject(OrgLock)),
|
|
516
|
+
__param(14, Inject(InvalidationHints))
|
|
513
517
|
], Offboarding);
|
|
514
518
|
export { Offboarding };
|
package/dist/orgs/orgs.module.js
CHANGED
|
@@ -13,6 +13,7 @@ import { ExtensionsModule } from "../extensions/extensions.module.js";
|
|
|
13
13
|
import { LifecycleHooksModule } from "../extensions/lifecycle-hooks.js";
|
|
14
14
|
import { IdentityModule } from "../identity/identity.module.js";
|
|
15
15
|
import { QueueModule } from "../infra/queue/queue.module.js";
|
|
16
|
+
import { InvalidationHintsModule } from "../invalidation/invalidation-hints.module.js";
|
|
16
17
|
import { PlatformModule } from "../platform/platform.module.js";
|
|
17
18
|
import { MAINTENANCE_QUEUE_NAME } from "../runtime/maintenance-queue.js";
|
|
18
19
|
import { RuntimeModule } from "../runtime/runtime.module.js";
|
|
@@ -38,6 +39,8 @@ let OrgsModule = class OrgsModule {
|
|
|
38
39
|
OrgsModule = __decorate([
|
|
39
40
|
Module({
|
|
40
41
|
imports: [
|
|
42
|
+
// invalidation hints its writers publish after their commit
|
|
43
|
+
InvalidationHintsModule,
|
|
41
44
|
IdentityModule,
|
|
42
45
|
ErasureModule,
|
|
43
46
|
StorageModule,
|
|
@@ -11,6 +11,7 @@ import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
|
11
11
|
import { XactLock } from "../infra/database/xact-lock.js";
|
|
12
12
|
import { KernelEvents } from "../infra/events/kernel-events.js";
|
|
13
13
|
import { OutboxService } from "../infra/outbox/outbox.service.js";
|
|
14
|
+
import type { HintPublisher } from "../invalidation/audiences.js";
|
|
14
15
|
import { PermissionCeilingWrites } from "../sandbox/permission-ceiling-writes.js";
|
|
15
16
|
import { StorageService } from "../storage/storage.service.js";
|
|
16
17
|
import { OrgLock } from "./org-lock.js";
|
|
@@ -49,6 +50,7 @@ export declare class OrgsService {
|
|
|
49
50
|
private readonly ceilings;
|
|
50
51
|
private readonly erasure;
|
|
51
52
|
private readonly storage;
|
|
53
|
+
private readonly hints;
|
|
52
54
|
constructor(db: KernelDb, outbox: Pick<OutboxService, "add">, txHost: TransactionHost, settings: SettingsService, apiTokens: ApiTokenService, orgLock: OrgLock, events: KernelEvents,
|
|
53
55
|
/** Cancels the deleted org's running eval runs (in the delete's transaction). */
|
|
54
56
|
evalBudget: Pick<EvalBudget, "cancelRuns">,
|
|
@@ -57,7 +59,7 @@ export declare class OrgsService {
|
|
|
57
59
|
/** What the deleted org owns is transferred or removed in the delete's transaction (P3-20). */
|
|
58
60
|
ownedItems: Pick<OwnedItems, "onOrgDeleted">,
|
|
59
61
|
/** Records `org.deleted` for the subscribing plugins in the delete's transaction. */
|
|
60
|
-
lifecycle: Pick<LifecycleHooks, "recordIn">, ceilings: PermissionCeilingWrites, erasure: Pick<ErasureRequests, "enqueue">, storage: Pick<StorageService, "erasureIdentity"
|
|
62
|
+
lifecycle: Pick<LifecycleHooks, "recordIn">, ceilings: PermissionCeilingWrites, erasure: Pick<ErasureRequests, "enqueue">, storage: Pick<StorageService, "erasureIdentity">, hints: HintPublisher);
|
|
61
63
|
/**
|
|
62
64
|
* Creates an org with the actor as owner, in the caller's transaction when there is one (the
|
|
63
65
|
* setup wizard creates it with the account); a slug conflict is `org.slug_taken` either way, but
|