@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
|
@@ -31,6 +31,7 @@ import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
|
31
31
|
import { XactLock } from "../infra/database/xact-lock.js";
|
|
32
32
|
import { KernelEvents } from "../infra/events/kernel-events.js";
|
|
33
33
|
import { OutboxService } from "../infra/outbox/outbox.service.js";
|
|
34
|
+
import { InvalidationHints } from "../invalidation/invalidation-hints.js";
|
|
34
35
|
import { MAINTENANCE_QUEUE_NAME } from "../runtime/maintenance-queue.js";
|
|
35
36
|
import { STOP_DELETED_ORG_JOB } from "../runtime/run-deletion.js";
|
|
36
37
|
import { USAGE_REPORT_QUEUE } from "../runtime/usage-report-jobs.js";
|
|
@@ -104,6 +105,7 @@ let OrgsService = class OrgsService {
|
|
|
104
105
|
ceilings;
|
|
105
106
|
erasure;
|
|
106
107
|
storage;
|
|
108
|
+
hints;
|
|
107
109
|
constructor(db, outbox, txHost, settings, apiTokens, orgLock, events,
|
|
108
110
|
/** Cancels the deleted org's running eval runs (in the delete's transaction). */
|
|
109
111
|
evalBudget,
|
|
@@ -112,7 +114,7 @@ let OrgsService = class OrgsService {
|
|
|
112
114
|
/** What the deleted org owns is transferred or removed in the delete's transaction (P3-20). */
|
|
113
115
|
ownedItems,
|
|
114
116
|
/** Records `org.deleted` for the subscribing plugins in the delete's transaction. */
|
|
115
|
-
lifecycle, ceilings, erasure, storage) {
|
|
117
|
+
lifecycle, ceilings, erasure, storage, hints) {
|
|
116
118
|
this.db = db;
|
|
117
119
|
this.outbox = outbox;
|
|
118
120
|
this.txHost = txHost;
|
|
@@ -128,6 +130,7 @@ let OrgsService = class OrgsService {
|
|
|
128
130
|
this.ceilings = ceilings;
|
|
129
131
|
this.erasure = erasure;
|
|
130
132
|
this.storage = storage;
|
|
133
|
+
this.hints = hints;
|
|
131
134
|
}
|
|
132
135
|
/**
|
|
133
136
|
* Creates an org with the actor as owner, in the caller's transaction when there is one (the
|
|
@@ -323,7 +326,7 @@ let OrgsService = class OrgsService {
|
|
|
323
326
|
// eval runs of a deleted org stop spending: cancelled explicitly (audited with the reason)
|
|
324
327
|
await this.evalBudget.cancelRuns({ orgId }, { accountId: actor.id, ...(actorTokenId !== undefined && { tokenId: actorTokenId }) }, "org_deleted");
|
|
325
328
|
// pending catalog requests (including those passed to super admins) are cancelled too
|
|
326
|
-
await cancelPendingRequests(this.db.db, { orgId }, actor.id, "org_deleted", actorTokenId !== undefined ? { actorTokenId } : {});
|
|
329
|
+
await cancelPendingRequests(this.db.db, this.hints, { orgId }, actor.id, "org_deleted", actorTokenId !== undefined ? { actorTokenId } : {});
|
|
327
330
|
await this.db
|
|
328
331
|
.updateTable("sessions")
|
|
329
332
|
.set({ current_org_id: null })
|
|
@@ -374,6 +377,7 @@ OrgsService = __decorate([
|
|
|
374
377
|
__param(11, Inject(LifecycleHooks)),
|
|
375
378
|
__param(12, Inject(PermissionCeilingWrites)),
|
|
376
379
|
__param(13, Inject(ErasureRequests)),
|
|
377
|
-
__param(14, Inject(StorageService))
|
|
380
|
+
__param(14, Inject(StorageService)),
|
|
381
|
+
__param(15, Inject(InvalidationHints))
|
|
378
382
|
], OrgsService);
|
|
379
383
|
export { OrgsService };
|
|
@@ -799,6 +799,11 @@ export const PLATFORM_EXCLUSIONS = [
|
|
|
799
799
|
category: "transport",
|
|
800
800
|
reason: "Server-sent event stream of UI invalidations",
|
|
801
801
|
},
|
|
802
|
+
{
|
|
803
|
+
route: "GET /api/v1/orgs/:orgId/me/stream",
|
|
804
|
+
category: "transport",
|
|
805
|
+
reason: "Server-sent event stream of inbox and request invalidations",
|
|
806
|
+
},
|
|
802
807
|
{
|
|
803
808
|
route: "GET /api/v1/admin/ui/contributions",
|
|
804
809
|
category: "internal",
|
package/dist/push/delivery.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ReplicaStatusStore } from "../extensions/sources.js";
|
|
|
2
2
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
3
3
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
4
4
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
5
|
+
import type { HintPublisher } from "../invalidation/audiences.js";
|
|
5
6
|
import type { KernelLogger } from "../log.js";
|
|
6
7
|
import type { PushDeliverData } from "./jobs.js";
|
|
7
8
|
import { PushProviderHost } from "./provider-host.js";
|
|
@@ -62,9 +63,10 @@ export declare class PushDelivery {
|
|
|
62
63
|
private readonly replica;
|
|
63
64
|
private readonly log;
|
|
64
65
|
private readonly timeoutMs;
|
|
66
|
+
private readonly hints;
|
|
65
67
|
constructor(kdb: KernelDb, txHost: TransactionHost, host: Pick<PushProviderHost, "provider" | "covers">, tokens: Pick<PushTokenStore, "open">, config: Pick<KernelConfigService, "get">,
|
|
66
68
|
/** This process's replica id (its own `extension_replica_status` rows). */
|
|
67
|
-
replica: Pick<ReplicaStatusStore, "replicaId">, log: KernelLogger, timeoutMs
|
|
69
|
+
replica: Pick<ReplicaStatusStore, "replicaId">, log: KernelLogger, timeoutMs: (() => number) | undefined, hints: HintPublisher);
|
|
68
70
|
/** Delivers one job (see the class). */
|
|
69
71
|
deliver(data: PushDeliverData): Promise<PushDeliveryOutcome>;
|
|
70
72
|
/**
|
package/dist/push/delivery.js
CHANGED
|
@@ -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: [
|
|
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
|
})
|
|
@@ -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
|
*/
|
package/dist/runtime/stream.d.ts
CHANGED
|
@@ -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;
|
package/dist/runtime/stream.js
CHANGED
|
@@ -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
|
-
|
|
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: [
|
|
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
|
-
|
|
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
|
-
|
|
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 };
|
|
@@ -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.
|
|
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
|
|
@@ -18,6 +18,8 @@ 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 { publishOrgAdminsInbox } from "../invalidation/audiences.js";
|
|
22
|
+
import { InvalidationHints } from "../invalidation/invalidation-hints.js";
|
|
21
23
|
import { OrgLock } from "../orgs/org-lock.js";
|
|
22
24
|
import { StorageService } from "../storage/storage.service.js";
|
|
23
25
|
import { assertShareableName, isOrgAdmin, shareSkillIn } from "./agent-skills.service.js";
|
|
@@ -56,10 +58,13 @@ let SkillChangesService = class SkillChangesService {
|
|
|
56
58
|
txHost;
|
|
57
59
|
orgLock;
|
|
58
60
|
skills;
|
|
61
|
+
hints;
|
|
59
62
|
catalogDeps;
|
|
60
63
|
constructor(db, storage, eventLog, log, txHost, orgLock,
|
|
61
64
|
/** An approved version is an org skill version. */
|
|
62
|
-
skills
|
|
65
|
+
skills,
|
|
66
|
+
/** A decision publishes `inbox` to the org's admins after the commit. */
|
|
67
|
+
hints) {
|
|
63
68
|
this.db = db;
|
|
64
69
|
this.storage = storage;
|
|
65
70
|
this.eventLog = eventLog;
|
|
@@ -67,7 +72,8 @@ let SkillChangesService = class SkillChangesService {
|
|
|
67
72
|
this.txHost = txHost;
|
|
68
73
|
this.orgLock = orgLock;
|
|
69
74
|
this.skills = skills;
|
|
70
|
-
this.
|
|
75
|
+
this.hints = hints;
|
|
76
|
+
this.catalogDeps = { db, log, eventLog, hints };
|
|
71
77
|
}
|
|
72
78
|
/**
|
|
73
79
|
* An org admin decides a request (see the class comment): not an org admin -> 403 `forbidden`;
|
|
@@ -273,6 +279,7 @@ let SkillChangesService = class SkillChangesService {
|
|
|
273
279
|
.where("org_id", "=", orgId)
|
|
274
280
|
.returningAll()
|
|
275
281
|
.executeTakeFirstOrThrow();
|
|
282
|
+
publishOrgAdminsInbox(this.hints, [orgId]);
|
|
276
283
|
await audit(this.db.db, {
|
|
277
284
|
actorAccountId: accountId,
|
|
278
285
|
...(actorTokenId !== undefined && { actorTokenId }),
|
|
@@ -485,7 +492,8 @@ SkillChangesService = __decorate([
|
|
|
485
492
|
__param(3, Inject(KERNEL_LOGGER)),
|
|
486
493
|
__param(4, Inject(TransactionHost)),
|
|
487
494
|
__param(5, Inject(OrgLock)),
|
|
488
|
-
__param(6, Inject(SkillsService))
|
|
495
|
+
__param(6, Inject(SkillsService)),
|
|
496
|
+
__param(7, Inject(InvalidationHints))
|
|
489
497
|
], SkillChangesService);
|
|
490
498
|
export { SkillChangesService };
|
|
491
499
|
/**
|
|
@@ -2,6 +2,7 @@ import { type Selectable } from "kysely";
|
|
|
2
2
|
import type { EventLog } from "../conversations/event-log.js";
|
|
3
3
|
import type { SkillChangeRequestsTable } from "../db/kernel-schema.js";
|
|
4
4
|
import type { KernelDb } from "../infra/database/kernel-db.js";
|
|
5
|
+
import { type HintPublisher } from "../invalidation/audiences.js";
|
|
5
6
|
import type { KernelLogger } from "../log.js";
|
|
6
7
|
import { type SkillsSnapshot } from "../runtime/context/skills.js";
|
|
7
8
|
/** What appending a conversation's skills catalog snapshot needs. */
|
|
@@ -9,6 +10,8 @@ export interface ConversationCatalogDeps {
|
|
|
9
10
|
db: KernelDb;
|
|
10
11
|
log: KernelLogger;
|
|
11
12
|
eventLog: EventLog;
|
|
13
|
+
/** A cancelled change request publishes `inbox` to its org's admins after the commit. */
|
|
14
|
+
hints: HintPublisher;
|
|
12
15
|
}
|
|
13
16
|
/** Cancelled requests: draft prefixes to delete and (conversation, seq) to publish after the commit. */
|
|
14
17
|
export interface CancelledDrafts {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { sql } from "kysely";
|
|
2
2
|
import { audit } from "../identity/audit.js";
|
|
3
|
+
import { publishOrgAdminsInbox } from "../invalidation/audiences.js";
|
|
3
4
|
import { sameSnapshot } from "../runtime/context/skills.js";
|
|
4
5
|
import { invocationOf, lockLatestCatalog } from "./catalog.js";
|
|
5
6
|
const byName = (a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0;
|
|
@@ -116,6 +117,7 @@ export async function cancelRequestIn(deps, req, out, how) {
|
|
|
116
117
|
.where("id", "=", req.id)
|
|
117
118
|
.where("org_id", "=", req.org_id)
|
|
118
119
|
.execute();
|
|
120
|
+
publishOrgAdminsInbox(deps.hints, [req.org_id]);
|
|
119
121
|
await audit(deps.db.db, {
|
|
120
122
|
actorAccountId: how.actorAccountId,
|
|
121
123
|
...(how.actorTokenId !== undefined && { actorTokenId: how.actorTokenId }),
|
|
@@ -10,6 +10,7 @@ import { CatalogImportModule } from "../catalog/catalog-import.module.js";
|
|
|
10
10
|
import { AttachmentsModule } from "../conversations/attachments.module.js";
|
|
11
11
|
import { EventLogModule } from "../conversations/event-log.js";
|
|
12
12
|
import { DevicesModule } from "../devices/devices.module.js";
|
|
13
|
+
import { InvalidationHintsModule } from "../invalidation/invalidation-hints.module.js";
|
|
13
14
|
import { OrgLockModule } from "../orgs/org-lock.js";
|
|
14
15
|
import { SandboxModule } from "../sandbox/sandbox.module.js";
|
|
15
16
|
import { StorageModule } from "../storage/storage.module.js";
|
|
@@ -28,6 +29,8 @@ let SkillsModule = class SkillsModule {
|
|
|
28
29
|
SkillsModule = __decorate([
|
|
29
30
|
Module({
|
|
30
31
|
imports: [
|
|
32
|
+
// invalidation hints its writers publish after their commit
|
|
33
|
+
InvalidationHintsModule,
|
|
31
34
|
StorageModule,
|
|
32
35
|
OrgLockModule,
|
|
33
36
|
EventLogModule,
|
|
@@ -7,6 +7,7 @@ import type { KernelSchemaDb, SkillManifest, SourceFormat } from "../db/kernel-s
|
|
|
7
7
|
import { ApiError } from "../errors.js";
|
|
8
8
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
9
9
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
10
|
+
import type { HintPublisher } from "../invalidation/audiences.js";
|
|
10
11
|
import type { KernelLogger } from "../log.js";
|
|
11
12
|
import { OrgLock } from "../orgs/org-lock.js";
|
|
12
13
|
import { StorageService } from "../storage/storage.service.js";
|
|
@@ -157,9 +158,10 @@ export declare class SkillsService {
|
|
|
157
158
|
private readonly platform;
|
|
158
159
|
private readonly eventLog;
|
|
159
160
|
private readonly log;
|
|
161
|
+
private readonly hints;
|
|
160
162
|
constructor(db: KernelDb, storage: StorageService, attachments: AttachmentsService, txHost: TransactionHost, orgLock: OrgLock,
|
|
161
163
|
/** The owner's new versions of a skill it promoted go to the platform row (ruling P3-4). */
|
|
162
|
-
platform: PlatformComponents, eventLog: EventLog, log: KernelLogger);
|
|
164
|
+
platform: PlatformComponents, eventLog: EventLog, log: KernelLogger, hints: HintPublisher);
|
|
163
165
|
private readonly catalogDeps;
|
|
164
166
|
/**
|
|
165
167
|
* Writes a package's files where its version will live: for a new version of a skill the org
|