@capybara-hq/kernel 0.1.0-rc.142 → 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 +3 -0
- package/dist/config/schema.js +30 -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/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 +4 -1
- package/dist/invalidation/audiences.d.ts +32 -0
- package/dist/invalidation/audiences.js +43 -0
- package/dist/invalidation/hints.d.ts +6 -0
- package/dist/invalidation/hints.js +7 -1
- package/dist/invalidation/invalidation-hints.d.ts +12 -1
- package/dist/invalidation/invalidation-hints.js +46 -5
- package/dist/invalidation/invalidation-hints.module.d.ts +2 -0
- package/dist/invalidation/invalidation-hints.module.js +4 -1
- package/dist/invalidation/me-stream.d.ts +1 -11
- package/dist/invalidation/me-stream.js +12 -41
- package/dist/invalidation/org-intent-bridge.d.ts +18 -0
- package/dist/invalidation/org-intent-bridge.js +46 -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/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
|
@@ -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
|
|
@@ -27,6 +27,7 @@ import { KernelDb } from "../infra/database/kernel-db.js";
|
|
|
27
27
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
28
28
|
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
29
29
|
import { KERNEL_LOGGER } from "../infra/tokens.js";
|
|
30
|
+
import { InvalidationHints } from "../invalidation/invalidation-hints.js";
|
|
30
31
|
import { OrgLock } from "../orgs/org-lock.js";
|
|
31
32
|
import { StorageService } from "../storage/storage.service.js";
|
|
32
33
|
import { invocationOf } from "./catalog.js";
|
|
@@ -335,9 +336,10 @@ let SkillsService = class SkillsService {
|
|
|
335
336
|
platform;
|
|
336
337
|
eventLog;
|
|
337
338
|
log;
|
|
339
|
+
hints;
|
|
338
340
|
constructor(db, storage, attachments, txHost, orgLock,
|
|
339
341
|
/** The owner's new versions of a skill it promoted go to the platform row (ruling P3-4). */
|
|
340
|
-
platform, eventLog, log) {
|
|
342
|
+
platform, eventLog, log, hints) {
|
|
341
343
|
this.db = db;
|
|
342
344
|
this.storage = storage;
|
|
343
345
|
this.attachments = attachments;
|
|
@@ -346,7 +348,8 @@ let SkillsService = class SkillsService {
|
|
|
346
348
|
this.platform = platform;
|
|
347
349
|
this.eventLog = eventLog;
|
|
348
350
|
this.log = log;
|
|
349
|
-
this.
|
|
351
|
+
this.hints = hints;
|
|
352
|
+
this.catalogDeps = { db, log, eventLog, hints };
|
|
350
353
|
}
|
|
351
354
|
catalogDeps;
|
|
352
355
|
/**
|
|
@@ -560,7 +563,7 @@ let SkillsService = class SkillsService {
|
|
|
560
563
|
...opts.auditDetail,
|
|
561
564
|
},
|
|
562
565
|
});
|
|
563
|
-
await notifySharedUpdate(this.db.db, { kind: "skill", id: promoted }, { name: pkg.name, from: String(version - 1), to: String(version) });
|
|
566
|
+
await notifySharedUpdate(this.db.db, this.hints, { kind: "skill", id: promoted }, { name: pkg.name, from: String(version - 1), to: String(version) });
|
|
564
567
|
return {
|
|
565
568
|
skill: await this.promotedSummary(existing.id, promoted),
|
|
566
569
|
version,
|
|
@@ -1100,7 +1103,8 @@ SkillsService = __decorate([
|
|
|
1100
1103
|
__param(4, Inject(OrgLock)),
|
|
1101
1104
|
__param(5, Inject(PlatformComponents)),
|
|
1102
1105
|
__param(6, Inject(EventLog)),
|
|
1103
|
-
__param(7, Inject(KERNEL_LOGGER))
|
|
1106
|
+
__param(7, Inject(KERNEL_LOGGER)),
|
|
1107
|
+
__param(8, Inject(InvalidationHints))
|
|
1104
1108
|
], SkillsService);
|
|
1105
1109
|
export { SkillsService };
|
|
1106
1110
|
/**
|
|
@@ -12,6 +12,7 @@ import { KernelDb } from "../infra/database/kernel-db.js";
|
|
|
12
12
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
13
13
|
import { KernelEvents } from "../infra/events/kernel-events.js";
|
|
14
14
|
import { LockService } from "../infra/lock/lock.service.js";
|
|
15
|
+
import { type HintPublisher } from "../invalidation/audiences.js";
|
|
15
16
|
import { OrgLock } from "../orgs/org-lock.js";
|
|
16
17
|
import { type OrgRole } from "../orgs/roles.js";
|
|
17
18
|
import type { FileCardDetail } from "../platform/file-ref.js";
|
|
@@ -539,6 +540,8 @@ export declare class ApprovalsService {
|
|
|
539
540
|
private readonly sealed;
|
|
540
541
|
/** A network ask's "add to this device's list" writes the device's own network list. */
|
|
541
542
|
private readonly devices;
|
|
543
|
+
/** Every insert and status change publishes `inbox` to whoever the approval asks. */
|
|
544
|
+
private readonly hints;
|
|
542
545
|
private readonly permissionLocks?;
|
|
543
546
|
private readonly permissionGrants?;
|
|
544
547
|
/** A loopback port ask's approval writes the root conversation's grant (absent: refused). */
|
|
@@ -560,7 +563,9 @@ export declare class ApprovalsService {
|
|
|
560
563
|
/** A person's entered values are sealed in the decision's transaction (§4.3). */
|
|
561
564
|
sealed: Pick<SealedInputs, "sealIn">,
|
|
562
565
|
/** A network ask's "add to this device's list" writes the device's own network list. */
|
|
563
|
-
devices: Pick<DevicesService, "lockNetworkAddSubject" | "addNetworkHostsIn">,
|
|
566
|
+
devices: Pick<DevicesService, "lockNetworkAddSubject" | "addNetworkHostsIn">,
|
|
567
|
+
/** Every insert and status change publishes `inbox` to whoever the approval asks. */
|
|
568
|
+
hints: HintPublisher, permissionLocks?: PermissionAuthorityLock | undefined, permissionGrants?: PermissionCallGrants | undefined,
|
|
564
569
|
/** A loopback port ask's approval writes the root conversation's grant (absent: refused). */
|
|
565
570
|
loopback?: Pick<LoopbackGrants, "grantIn" | "refusalNow" | "liveLockedIn"> | undefined, site?: DeviceSiteGrants | undefined, orgLock?: OrgLock | undefined, extensions?: Pick<ExtensionRegistry, "current"> | undefined);
|
|
566
571
|
/**
|
|
@@ -831,6 +836,12 @@ export declare class ApprovalsService {
|
|
|
831
836
|
private lockConversations;
|
|
832
837
|
/** `conversationId` and its sub-agents' conversations at any depth (at most 16 levels). */
|
|
833
838
|
private subtreeOf;
|
|
839
|
+
/**
|
|
840
|
+
* Publishes `inbox` after the commit to whoever the approval asks (account invalidation stream
|
|
841
|
+
* spec §4): its `requested_for` person, else the role topic of its `approver_role`. Called for
|
|
842
|
+
* every insert and every status change (decision, expiry, cancel, skip, supersede).
|
|
843
|
+
*/
|
|
844
|
+
private hintApproval;
|
|
834
845
|
/**
|
|
835
846
|
* 系统写的 `approval_decided`(超时 / 取消,处理人为 null;跳过,处理人为消息作者),在当前事务内;返回事件 seq。
|
|
836
847
|
*/
|
|
@@ -37,6 +37,8 @@ import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
|
37
37
|
import { KernelEvents } from "../infra/events/kernel-events.js";
|
|
38
38
|
import { LockService } from "../infra/lock/lock.service.js";
|
|
39
39
|
import { WithLock } from "../infra/lock/with-lock.decorator.js";
|
|
40
|
+
import { approvalTopics } from "../invalidation/audiences.js";
|
|
41
|
+
import { InvalidationHints } from "../invalidation/invalidation-hints.js";
|
|
40
42
|
import { OrgLock } from "../orgs/org-lock.js";
|
|
41
43
|
import { ORG_ROLES, roleAtLeast } from "../orgs/roles.js";
|
|
42
44
|
import { checkPersonValue } from "../platform/person-fields.js";
|
|
@@ -252,6 +254,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
252
254
|
leakCheck;
|
|
253
255
|
sealed;
|
|
254
256
|
devices;
|
|
257
|
+
hints;
|
|
255
258
|
permissionLocks;
|
|
256
259
|
permissionGrants;
|
|
257
260
|
loopback;
|
|
@@ -272,7 +275,9 @@ let ApprovalsService = class ApprovalsService {
|
|
|
272
275
|
/** A person's entered values are sealed in the decision's transaction (§4.3). */
|
|
273
276
|
sealed,
|
|
274
277
|
/** A network ask's "add to this device's list" writes the device's own network list. */
|
|
275
|
-
devices,
|
|
278
|
+
devices,
|
|
279
|
+
/** Every insert and status change publishes `inbox` to whoever the approval asks. */
|
|
280
|
+
hints, permissionLocks, permissionGrants,
|
|
276
281
|
/** A loopback port ask's approval writes the root conversation's grant (absent: refused). */
|
|
277
282
|
loopback, site, orgLock, extensions) {
|
|
278
283
|
this.db = db;
|
|
@@ -288,6 +293,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
288
293
|
this.leakCheck = leakCheck;
|
|
289
294
|
this.sealed = sealed;
|
|
290
295
|
this.devices = devices;
|
|
296
|
+
this.hints = hints;
|
|
291
297
|
this.permissionLocks = permissionLocks;
|
|
292
298
|
this.permissionGrants = permissionGrants;
|
|
293
299
|
this.loopback = loopback;
|
|
@@ -321,7 +327,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
321
327
|
.forUpdate()
|
|
322
328
|
.execute();
|
|
323
329
|
if (input.supersedesOrgAsk !== undefined) {
|
|
324
|
-
await t
|
|
330
|
+
const superseded = await t
|
|
325
331
|
.updateTable("approvals")
|
|
326
332
|
.set({ status: "superseded", superseded_reason: "The organization’s tool policy changed" })
|
|
327
333
|
.where("org_id", "=", input.orgId)
|
|
@@ -330,7 +336,10 @@ let ApprovalsService = class ApprovalsService {
|
|
|
330
336
|
.where("kind", "=", "tool")
|
|
331
337
|
.where("id", "=", input.supersedesOrgAsk)
|
|
332
338
|
.where("status", "in", ["pending", "approved"])
|
|
339
|
+
.returningAll()
|
|
333
340
|
.execute();
|
|
341
|
+
for (const r of superseded)
|
|
342
|
+
this.hintApproval(toRecord(r));
|
|
334
343
|
}
|
|
335
344
|
await t
|
|
336
345
|
.insertInto("approvals")
|
|
@@ -365,6 +374,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
365
374
|
.where("attempt", "=", input.attempt ?? 1)
|
|
366
375
|
.executeTakeFirstOrThrow();
|
|
367
376
|
const rec = toRecord(row);
|
|
377
|
+
this.hintApproval(rec);
|
|
368
378
|
const written = await this.eventLog.appendIn(rec.conversationId, [
|
|
369
379
|
{
|
|
370
380
|
type: "approval_requested",
|
|
@@ -457,6 +467,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
457
467
|
return { record: toRecord(row), toSeq: null };
|
|
458
468
|
}
|
|
459
469
|
const rec = toRecord(inserted);
|
|
470
|
+
this.hintApproval(rec);
|
|
460
471
|
const written = await this.eventLog.appendIn(rec.conversationId, [
|
|
461
472
|
{
|
|
462
473
|
type: "approval_requested",
|
|
@@ -591,6 +602,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
591
602
|
.returningAll()
|
|
592
603
|
.executeTakeFirstOrThrow();
|
|
593
604
|
const rec = toRecord(row);
|
|
605
|
+
this.hintApproval(rec);
|
|
594
606
|
const written = await this.eventLog.appendIn(rec.conversationId, [
|
|
595
607
|
{
|
|
596
608
|
type: "approval_requested",
|
|
@@ -712,6 +724,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
712
724
|
.returningAll()
|
|
713
725
|
.executeTakeFirstOrThrow();
|
|
714
726
|
const rec = toRecord(row);
|
|
727
|
+
this.hintApproval(rec);
|
|
715
728
|
const written = await this.eventLog.appendIn(rec.conversationId, [
|
|
716
729
|
{
|
|
717
730
|
type: "approval_requested",
|
|
@@ -840,6 +853,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
840
853
|
.returningAll()
|
|
841
854
|
.executeTakeFirstOrThrow();
|
|
842
855
|
const rec = toRecord(row);
|
|
856
|
+
this.hintApproval(rec);
|
|
843
857
|
const written = await this.eventLog.appendIn(rec.conversationId, [
|
|
844
858
|
{
|
|
845
859
|
type: "approval_requested",
|
|
@@ -1627,6 +1641,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
1627
1641
|
.where("org_id", "=", orgId)
|
|
1628
1642
|
.returningAll()
|
|
1629
1643
|
.executeTakeFirstOrThrow();
|
|
1644
|
+
this.hintApproval(before);
|
|
1630
1645
|
if (approved && before.command?.permissionCandidate) {
|
|
1631
1646
|
if (!this.permissionGrants)
|
|
1632
1647
|
throw new Error("Permission grants are unavailable");
|
|
@@ -2334,10 +2349,21 @@ let ApprovalsService = class ApprovalsService {
|
|
|
2334
2349
|
}
|
|
2335
2350
|
return all;
|
|
2336
2351
|
}
|
|
2352
|
+
/**
|
|
2353
|
+
* Publishes `inbox` after the commit to whoever the approval asks (account invalidation stream
|
|
2354
|
+
* spec §4): its `requested_for` person, else the role topic of its `approver_role`. Called for
|
|
2355
|
+
* every insert and every status change (decision, expiry, cancel, skip, supersede).
|
|
2356
|
+
*/
|
|
2357
|
+
hintApproval(a) {
|
|
2358
|
+
const topics = approvalTopics(a);
|
|
2359
|
+
if (topics.length > 0)
|
|
2360
|
+
this.hints.publishAfterCommit(topics, { kind: "inbox" });
|
|
2361
|
+
}
|
|
2337
2362
|
/**
|
|
2338
2363
|
* 系统写的 `approval_decided`(超时 / 取消,处理人为 null;跳过,处理人为消息作者),在当前事务内;返回事件 seq。
|
|
2339
2364
|
*/
|
|
2340
2365
|
async decidedEvent(a, decision, byAccountId = null) {
|
|
2366
|
+
this.hintApproval(a);
|
|
2341
2367
|
const written = await this.eventLog.appendIn(a.conversationId, [
|
|
2342
2368
|
{
|
|
2343
2369
|
type: "approval_decided",
|
|
@@ -2578,17 +2604,18 @@ ApprovalsService = __decorate([
|
|
|
2578
2604
|
__param(10, Inject(ConversationLeakCheck)),
|
|
2579
2605
|
__param(11, Inject(SealedInputs)),
|
|
2580
2606
|
__param(12, Inject(DevicesService)),
|
|
2581
|
-
__param(13,
|
|
2582
|
-
__param(13, Inject(PermissionAuthorityLock)),
|
|
2607
|
+
__param(13, Inject(InvalidationHints)),
|
|
2583
2608
|
__param(14, Optional()),
|
|
2584
|
-
__param(14, Inject(
|
|
2609
|
+
__param(14, Inject(PermissionAuthorityLock)),
|
|
2585
2610
|
__param(15, Optional()),
|
|
2586
|
-
__param(15, Inject(
|
|
2611
|
+
__param(15, Inject(PermissionCallGrants)),
|
|
2587
2612
|
__param(16, Optional()),
|
|
2588
|
-
__param(16, Inject(
|
|
2613
|
+
__param(16, Inject(LoopbackGrants)),
|
|
2589
2614
|
__param(17, Optional()),
|
|
2590
|
-
__param(17, Inject(
|
|
2615
|
+
__param(17, Inject(DeviceSiteGrants)),
|
|
2591
2616
|
__param(18, Optional()),
|
|
2592
|
-
__param(18, Inject(
|
|
2617
|
+
__param(18, Inject(OrgLock)),
|
|
2618
|
+
__param(19, Optional()),
|
|
2619
|
+
__param(19, Inject(ExtensionRegistry))
|
|
2593
2620
|
], ApprovalsService);
|
|
2594
2621
|
export { ApprovalsService };
|
|
@@ -7,6 +7,7 @@ import { KernelDb } from "../infra/database/kernel-db.js";
|
|
|
7
7
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
8
8
|
import { LockService } from "../infra/lock/lock.service.js";
|
|
9
9
|
import { OutboxService } from "../infra/outbox/outbox.service.js";
|
|
10
|
+
import { type HintPublisher } from "../invalidation/audiences.js";
|
|
10
11
|
import { OrgLock } from "../orgs/org-lock.js";
|
|
11
12
|
import type { OrgRole } from "../orgs/roles.js";
|
|
12
13
|
import { type ConnectorSetup } from "./connector-setup.js";
|
|
@@ -268,6 +269,7 @@ export declare class ConnectorsService {
|
|
|
268
269
|
readonly txHost: TransactionHost;
|
|
269
270
|
/** Setup guides of connector templates (spec 2026-11-09-setup-guides-v2-design.md §11). */
|
|
270
271
|
private readonly guides;
|
|
272
|
+
private readonly hints;
|
|
271
273
|
constructor(kdb: KernelDb, registry: ToolRegistry, credentials: Credentials, config: Pick<KernelConfigService, "get">, drift: ToolDrift,
|
|
272
274
|
/** The org row lock (orgs/org-lock.ts): joins the caller's transaction. */
|
|
273
275
|
orgLock: Pick<OrgLock, "lock" | "tryLock" | "lockAndAuthorize">,
|
|
@@ -276,7 +278,7 @@ export declare class ConnectorsService {
|
|
|
276
278
|
/** The cross-replica lock of a deferred connector's lazy client registration (R16). */
|
|
277
279
|
locks: Pick<LockService, "run">, txHost: TransactionHost,
|
|
278
280
|
/** Setup guides of connector templates (spec 2026-11-09-setup-guides-v2-design.md §11). */
|
|
279
|
-
guides: Pick<PluginGuides, "templateAck" | "connectorStates"
|
|
281
|
+
guides: Pick<PluginGuides, "templateAck" | "connectorStates">, hints: HintPublisher);
|
|
280
282
|
/** The kernel-schema handle of the current context (its transaction, else the pool). */
|
|
281
283
|
private get db();
|
|
282
284
|
/**
|
|
@@ -28,6 +28,8 @@ import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
|
28
28
|
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
29
29
|
import { LockService } from "../infra/lock/lock.service.js";
|
|
30
30
|
import { OutboxService } from "../infra/outbox/outbox.service.js";
|
|
31
|
+
import { publishCapabilities } from "../invalidation/audiences.js";
|
|
32
|
+
import { InvalidationHints } from "../invalidation/invalidation-hints.js";
|
|
31
33
|
import { OrgLock } from "../orgs/org-lock.js";
|
|
32
34
|
import { firstOrgOwner } from "../orgs/org-owner.js";
|
|
33
35
|
import { UUID_RE } from "../ui/registry.js";
|
|
@@ -125,6 +127,7 @@ let ConnectorsService = class ConnectorsService {
|
|
|
125
127
|
locks;
|
|
126
128
|
txHost;
|
|
127
129
|
guides;
|
|
130
|
+
hints;
|
|
128
131
|
constructor(kdb, registry, credentials, config, drift,
|
|
129
132
|
/** The org row lock (orgs/org-lock.ts): joins the caller's transaction. */
|
|
130
133
|
orgLock,
|
|
@@ -133,7 +136,7 @@ let ConnectorsService = class ConnectorsService {
|
|
|
133
136
|
/** The cross-replica lock of a deferred connector's lazy client registration (R16). */
|
|
134
137
|
locks, txHost,
|
|
135
138
|
/** Setup guides of connector templates (spec 2026-11-09-setup-guides-v2-design.md §11). */
|
|
136
|
-
guides) {
|
|
139
|
+
guides, hints) {
|
|
137
140
|
this.kdb = kdb;
|
|
138
141
|
this.registry = registry;
|
|
139
142
|
this.credentials = credentials;
|
|
@@ -144,6 +147,7 @@ let ConnectorsService = class ConnectorsService {
|
|
|
144
147
|
this.locks = locks;
|
|
145
148
|
this.txHost = txHost;
|
|
146
149
|
this.guides = guides;
|
|
150
|
+
this.hints = hints;
|
|
147
151
|
}
|
|
148
152
|
/** The kernel-schema handle of the current context (its transaction, else the pool). */
|
|
149
153
|
get db() {
|
|
@@ -584,6 +588,8 @@ let ConnectorsService = class ConnectorsService {
|
|
|
584
588
|
}),
|
|
585
589
|
},
|
|
586
590
|
});
|
|
591
|
+
// a new connector in the org: its members' pickers refetch
|
|
592
|
+
publishCapabilities(this.hints, [orgId]);
|
|
587
593
|
return issues;
|
|
588
594
|
}
|
|
589
595
|
/**
|
|
@@ -702,6 +708,8 @@ let ConnectorsService = class ConnectorsService {
|
|
|
702
708
|
policyChanges[tool.name] = { from: previous, to: next };
|
|
703
709
|
}
|
|
704
710
|
}
|
|
711
|
+
// its auth, endpoint or credentials may move its derived setup (needs_config / ready)
|
|
712
|
+
publishCapabilities(this.hints, [orgId]);
|
|
705
713
|
if (input.resetCredentials) {
|
|
706
714
|
await this.credentials.clearConnector(orgId, connectorId);
|
|
707
715
|
if (p.secret && p.owner) {
|
|
@@ -1240,9 +1248,12 @@ let ConnectorsService = class ConnectorsService {
|
|
|
1240
1248
|
.where("org_id", "=", orgId)
|
|
1241
1249
|
.execute();
|
|
1242
1250
|
}
|
|
1251
|
+
if (patch.status !== undefined && patch.status !== app.status) {
|
|
1252
|
+
publishCapabilities(this.hints, [orgId]);
|
|
1253
|
+
}
|
|
1243
1254
|
// switched back on: the org's pending enable requests for the connector are settled
|
|
1244
1255
|
if (patch.status === "active" && app.status === "disabled") {
|
|
1245
|
-
await settleEnableRequests(t, orgId, { kind: "connector", id: connectorId }, actorAccountId, {
|
|
1256
|
+
await settleEnableRequests(t, this.hints, orgId, { kind: "connector", id: connectorId }, actorAccountId, {
|
|
1246
1257
|
...(actorTokenId !== undefined && { actorTokenId }),
|
|
1247
1258
|
});
|
|
1248
1259
|
}
|
|
@@ -1413,8 +1424,9 @@ let ConnectorsService = class ConnectorsService {
|
|
|
1413
1424
|
.where("org_id", "=", orgId)
|
|
1414
1425
|
.where("deleted_at", "is", null)
|
|
1415
1426
|
.execute();
|
|
1427
|
+
publishCapabilities(this.hints, [orgId]);
|
|
1416
1428
|
// its plugin is its owning switch now: a pending request for the connector is stale
|
|
1417
|
-
await cancelEnableRequestsOfConnector(this.db, orgId, connectorId, null, "target_changed");
|
|
1429
|
+
await cancelEnableRequestsOfConnector(this.db, this.hints, orgId, connectorId, null, "target_changed");
|
|
1418
1430
|
}
|
|
1419
1431
|
/** Owe a listing before changing the row's status and legacy last-update timestamp. */
|
|
1420
1432
|
async oweStaleEndpointList(orgId, app) {
|
|
@@ -1464,7 +1476,8 @@ let ConnectorsService = class ConnectorsService {
|
|
|
1464
1476
|
.where("id", "=", connectorId)
|
|
1465
1477
|
.where("org_id", "=", orgId)
|
|
1466
1478
|
.execute();
|
|
1467
|
-
|
|
1479
|
+
publishCapabilities(this.hints, [orgId]);
|
|
1480
|
+
await settleEnableRequests(this.db, this.hints, orgId, { kind: "connector", id: connectorId }, null);
|
|
1468
1481
|
return true;
|
|
1469
1482
|
}
|
|
1470
1483
|
/**
|
|
@@ -1489,8 +1502,10 @@ let ConnectorsService = class ConnectorsService {
|
|
|
1489
1502
|
.where("id", "=", connectorId)
|
|
1490
1503
|
.where("org_id", "=", orgId)
|
|
1491
1504
|
.execute();
|
|
1505
|
+
if (status !== app.status)
|
|
1506
|
+
publishCapabilities(this.hints, [orgId]);
|
|
1492
1507
|
if (status === "active" && app.status === "disabled") {
|
|
1493
|
-
await settleEnableRequests(t, orgId, { kind: "connector", id: connectorId }, actor.accountId, { ...(actor.tokenId !== undefined && { actorTokenId: actor.tokenId }) });
|
|
1508
|
+
await settleEnableRequests(t, this.hints, orgId, { kind: "connector", id: connectorId }, actor.accountId, { ...(actor.tokenId !== undefined && { actorTokenId: actor.tokenId }) });
|
|
1494
1509
|
}
|
|
1495
1510
|
await audit(t, {
|
|
1496
1511
|
actorAccountId: actor.accountId,
|
|
@@ -1536,7 +1551,8 @@ let ConnectorsService = class ConnectorsService {
|
|
|
1536
1551
|
.where("id", "=", connectorId)
|
|
1537
1552
|
.where("org_id", "=", orgId)
|
|
1538
1553
|
.execute();
|
|
1539
|
-
|
|
1554
|
+
publishCapabilities(this.hints, [orgId]);
|
|
1555
|
+
await cancelEnableRequestsOfConnector(t, this.hints, orgId, connectorId, actorAccountId, "connector_removed");
|
|
1540
1556
|
await this.credentials.clearConnector(orgId, connectorId);
|
|
1541
1557
|
// 授权绑定连接器 id(软删除不触发外键级联):一并删掉,不留给任何后来的连接器
|
|
1542
1558
|
await t
|
|
@@ -1788,6 +1804,9 @@ let ConnectorsService = class ConnectorsService {
|
|
|
1788
1804
|
this.credentials.validate(auth, owner, value);
|
|
1789
1805
|
const before = await this.setupOf(orgId, app);
|
|
1790
1806
|
await this.credentials.setStatic(orgId, connectorId, auth, owner, value);
|
|
1807
|
+
// an org credential may move the derived setup (needs_config -> ready) every member sees
|
|
1808
|
+
if (ownership === "org")
|
|
1809
|
+
publishCapabilities(this.hints, [orgId]);
|
|
1791
1810
|
if (ownership === "org" && before === "needs_config") {
|
|
1792
1811
|
// the org credential it lacked: now ready, its tools follow (§5.2.1)
|
|
1793
1812
|
await this.oweToolList(orgId, connectorId, "configured");
|
|
@@ -1859,6 +1878,8 @@ let ConnectorsService = class ConnectorsService {
|
|
|
1859
1878
|
await this.credentials.setOAuthClient(orgId, connectorId, client);
|
|
1860
1879
|
if (tokens)
|
|
1861
1880
|
await this.credentials.setOAuthTokens(orgId, connectorId, { kind: "org" }, tokens);
|
|
1881
|
+
// the org's client may move the derived setup (needs_config -> ready) every member sees
|
|
1882
|
+
publishCapabilities(this.hints, [orgId]);
|
|
1862
1883
|
// the client it lacked: now ready; a client credentials connector lists its tools with the
|
|
1863
1884
|
// org token (an authorization-code one waits for a member's first connection, A16)
|
|
1864
1885
|
if (before === "needs_config" && auth.ownership === "org") {
|
|
@@ -2027,6 +2048,7 @@ ConnectorsService = __decorate([
|
|
|
2027
2048
|
__param(6, Inject(OutboxService)),
|
|
2028
2049
|
__param(7, Inject(LockService)),
|
|
2029
2050
|
__param(8, Inject(TransactionHost)),
|
|
2030
|
-
__param(9, Inject(PluginGuides))
|
|
2051
|
+
__param(9, Inject(PluginGuides)),
|
|
2052
|
+
__param(10, Inject(InvalidationHints))
|
|
2031
2053
|
], ConnectorsService);
|
|
2032
2054
|
export { ConnectorsService };
|
|
@@ -19,6 +19,7 @@ import { ExtensionsModule } from "../extensions/extensions.module.js";
|
|
|
19
19
|
import { FileDeliveriesModule } from "../files/deliveries.module.js";
|
|
20
20
|
import { LibraryReadModule } from "../files/library-read.module.js";
|
|
21
21
|
import { QueueModule } from "../infra/queue/queue.module.js";
|
|
22
|
+
import { InvalidationHintsModule } from "../invalidation/invalidation-hints.module.js";
|
|
22
23
|
import { ModelsModule } from "../models/models.module.js";
|
|
23
24
|
import { OrgLockModule } from "../orgs/org-lock.js";
|
|
24
25
|
import { FileRefs } from "../platform/file-ref.js";
|
|
@@ -74,6 +75,8 @@ let ToolsModule = class ToolsModule {
|
|
|
74
75
|
ToolsModule = __decorate([
|
|
75
76
|
Module({
|
|
76
77
|
imports: [
|
|
78
|
+
// invalidation hints its writers publish after their commit
|
|
79
|
+
InvalidationHintsModule,
|
|
77
80
|
PermissionCallGrantsModule,
|
|
78
81
|
PermissionAuthorityModule,
|
|
79
82
|
OperationAuthorityModule,
|
|
@@ -25,7 +25,9 @@ import { type UiArrangementSlot, type UiContributionItem, UiViews } from "./view
|
|
|
25
25
|
* `ctx.ui.verifyEmbedToken` accepts only for a `platform.page` contribution while the account is
|
|
26
26
|
* still an active super admin;
|
|
27
27
|
* - `GET /api/v1/admin/ui/stream`: the platform refresh SSE (`event: ui`, topic `platform-ui`),
|
|
28
|
-
* super admin re-checked on the `runtime.sseRecheckMs` interval.
|
|
28
|
+
* super admin re-checked on the `runtime.sseRecheckMs` interval. Over
|
|
29
|
+
* `runtime.platformUiStreamMaxPerAccount`, the oldest of the account's platform UI streams on
|
|
30
|
+
* this replica ends with `event: closed` and `data: {"reason":"superseded"}`.
|
|
29
31
|
* A contribution in any other slot is 404 `ui.not_found`, the same as one that does not exist.
|
|
30
32
|
*/
|
|
31
33
|
export declare class AdminUiController {
|
|
@@ -44,7 +44,9 @@ class AdminUiQueryBodyDto extends createZodDto(PlatformQueryBody, "AdminUiQueryB
|
|
|
44
44
|
* `ctx.ui.verifyEmbedToken` accepts only for a `platform.page` contribution while the account is
|
|
45
45
|
* still an active super admin;
|
|
46
46
|
* - `GET /api/v1/admin/ui/stream`: the platform refresh SSE (`event: ui`, topic `platform-ui`),
|
|
47
|
-
* super admin re-checked on the `runtime.sseRecheckMs` interval.
|
|
47
|
+
* super admin re-checked on the `runtime.sseRecheckMs` interval. Over
|
|
48
|
+
* `runtime.platformUiStreamMaxPerAccount`, the oldest of the account's platform UI streams on
|
|
49
|
+
* this replica ends with `event: closed` and `data: {"reason":"superseded"}`.
|
|
48
50
|
* A contribution in any other slot is 404 `ui.not_found`, the same as one that does not exist.
|
|
49
51
|
*/
|
|
50
52
|
let AdminUiController = class AdminUiController {
|
package/dist/ui/ui-stream.d.ts
CHANGED
|
@@ -41,6 +41,8 @@ export declare const ORG_STREAM_MIN_ROLE: OrgRole;
|
|
|
41
41
|
*/
|
|
42
42
|
export declare class OrgUiStreams {
|
|
43
43
|
private readonly active;
|
|
44
|
+
private readonly orgLimit;
|
|
45
|
+
private readonly platformLimit;
|
|
44
46
|
/** Set by {@link closeAll}: streams opened afterwards end as soon as they begin. */
|
|
45
47
|
private closing;
|
|
46
48
|
private readonly d;
|
package/dist/ui/ui-stream.js
CHANGED
|
@@ -16,6 +16,7 @@ import { GracefulShutdown } from "../infra/lifecycle/graceful-shutdown.service.j
|
|
|
16
16
|
import { KERNEL_BUS, KERNEL_LOGGER } from "../infra/tokens.js";
|
|
17
17
|
import { roleAtLeast } from "../orgs/roles.js";
|
|
18
18
|
import { endedStream, } from "../runtime/stream.js";
|
|
19
|
+
import { PerAccountStreamLimit, SUPERSEDED_FRAME } from "../runtime/stream-limit.js";
|
|
19
20
|
import { isUiBusMessage, orgUiTopic, PLATFORM_UI_TOPIC, uiFrame } from "./registry.js";
|
|
20
21
|
/** The log field naming the stream: its org, or the platform scope. */
|
|
21
22
|
const whereOf = (p) => p.scope === "platform" ? { scope: "platform" } : { orgId: p.orgId };
|
|
@@ -76,6 +77,8 @@ const MAX_BACKLOG_BYTES = 1024 * 1024;
|
|
|
76
77
|
*/
|
|
77
78
|
let OrgUiStreams = class OrgUiStreams {
|
|
78
79
|
active = new Set();
|
|
80
|
+
orgLimit = new PerAccountStreamLimit();
|
|
81
|
+
platformLimit = new PerAccountStreamLimit();
|
|
79
82
|
/** Set by {@link closeAll}: streams opened afterwards end as soon as they begin. */
|
|
80
83
|
closing = false;
|
|
81
84
|
d;
|
|
@@ -105,7 +108,8 @@ let OrgUiStreams = class OrgUiStreams {
|
|
|
105
108
|
throw new ApiError(denied, "Access denied");
|
|
106
109
|
if (this.closing)
|
|
107
110
|
return endedStream(out);
|
|
108
|
-
const
|
|
111
|
+
const limit = p.scope === "platform" ? this.platformLimit : this.orgLimit;
|
|
112
|
+
const conn = new OrgUiConnection(this.d, p, out, limit, () => this.active.delete(conn));
|
|
109
113
|
this.active.add(conn);
|
|
110
114
|
try {
|
|
111
115
|
await conn.subscribe();
|
|
@@ -150,11 +154,13 @@ class OrgUiConnection {
|
|
|
150
154
|
rechecking = false;
|
|
151
155
|
unsubscribe;
|
|
152
156
|
timers = [];
|
|
153
|
-
|
|
157
|
+
slot;
|
|
158
|
+
constructor(d, p, out, limit, onClosed) {
|
|
154
159
|
this.d = d;
|
|
155
160
|
this.p = p;
|
|
156
161
|
this.out = out;
|
|
157
162
|
this.onClosed = onClosed;
|
|
163
|
+
this.slot = limit.register(p.viewerAccountId, () => this.close("end", SUPERSEDED_FRAME));
|
|
158
164
|
}
|
|
159
165
|
async subscribe() {
|
|
160
166
|
const topic = this.p.scope === "platform" ? PLATFORM_UI_TOPIC : orgUiTopic(this.p.orgId);
|
|
@@ -169,16 +175,21 @@ class OrgUiConnection {
|
|
|
169
175
|
this.unsubscribe = un;
|
|
170
176
|
}
|
|
171
177
|
begin() {
|
|
172
|
-
if (this.closed)
|
|
178
|
+
if (this.closed || this.begun)
|
|
173
179
|
return;
|
|
174
180
|
this.begun = true;
|
|
175
|
-
const
|
|
181
|
+
const runtime = this.d.config.get().runtime;
|
|
182
|
+
const { sseHeartbeatMs, sseRecheckMs } = runtime;
|
|
183
|
+
this.slot.begin(this.p.scope === "platform"
|
|
184
|
+
? runtime.platformUiStreamMaxPerAccount
|
|
185
|
+
: runtime.orgUiStreamMaxPerAccount);
|
|
176
186
|
this.timers.push(setInterval(() => this.write(": ping\n\n"), sseHeartbeatMs), setInterval(() => void this.recheck(), sseRecheckMs));
|
|
177
187
|
}
|
|
178
|
-
close(mode = "end") {
|
|
188
|
+
close(mode = "end", finalFrame) {
|
|
179
189
|
if (this.closed)
|
|
180
190
|
return;
|
|
181
191
|
this.closed = true;
|
|
192
|
+
this.slot.close();
|
|
182
193
|
for (const t of this.timers)
|
|
183
194
|
clearInterval(t);
|
|
184
195
|
this.timers = [];
|
|
@@ -189,8 +200,11 @@ class OrgUiConnection {
|
|
|
189
200
|
try {
|
|
190
201
|
if (mode === "abort")
|
|
191
202
|
this.out.abort();
|
|
192
|
-
else
|
|
203
|
+
else {
|
|
204
|
+
if (finalFrame !== undefined)
|
|
205
|
+
this.out.write(finalFrame);
|
|
193
206
|
this.out.end();
|
|
207
|
+
}
|
|
194
208
|
}
|
|
195
209
|
catch {
|
|
196
210
|
// 连接已断开
|
|
@@ -33,8 +33,10 @@ export declare const embedSrc: (plugin: string, path: string) => string;
|
|
|
33
33
|
* §4.1), gated like the component's view; 404 `ui.query_not_found`, 413
|
|
34
34
|
* `ui.query_params_too_large`, 502 `ui.query_failed` / `ui.query_result_too_large`, 504
|
|
35
35
|
* `ui.query_timeout` (10 s);
|
|
36
|
-
* - `GET
|
|
37
|
-
* member and above
|
|
36
|
+
* - `GET /api/v1/orgs/:orgId/ui/stream`: org refresh SSE (`event: ui`,
|
|
37
|
+
* `data: {"plugin","contribution"}`), member and above. Over `runtime.orgUiStreamMaxPerAccount`,
|
|
38
|
+
* the oldest of the account's org UI streams on this replica ends with `event: closed` and
|
|
39
|
+
* `data: {"reason":"superseded"}`;
|
|
38
40
|
* - `POST /api/v1/orgs/:orgId/ui/embeds/:plugin/:id/token` (`{ conversationId?, agentId?, fileId? }`,
|
|
39
41
|
* `{ fileId }` alone for a library file's previewer, or for a skill file's previewer
|
|
40
42
|
* `{ skillId, version?, path }`)
|
|
@@ -56,8 +56,10 @@ class UiEmbedTokenBodyDto extends createZodDto(EmbedTokenBody, "UiEmbedTokenBody
|
|
|
56
56
|
* §4.1), gated like the component's view; 404 `ui.query_not_found`, 413
|
|
57
57
|
* `ui.query_params_too_large`, 502 `ui.query_failed` / `ui.query_result_too_large`, 504
|
|
58
58
|
* `ui.query_timeout` (10 s);
|
|
59
|
-
* - `GET
|
|
60
|
-
* member and above
|
|
59
|
+
* - `GET /api/v1/orgs/:orgId/ui/stream`: org refresh SSE (`event: ui`,
|
|
60
|
+
* `data: {"plugin","contribution"}`), member and above. Over `runtime.orgUiStreamMaxPerAccount`,
|
|
61
|
+
* the oldest of the account's org UI streams on this replica ends with `event: closed` and
|
|
62
|
+
* `data: {"reason":"superseded"}`;
|
|
61
63
|
* - `POST /api/v1/orgs/:orgId/ui/embeds/:plugin/:id/token` (`{ conversationId?, agentId?, fileId? }`,
|
|
62
64
|
* `{ fileId }` alone for a library file's previewer, or for a skill file's previewer
|
|
63
65
|
* `{ skillId, version?, path }`)
|
package/package.json
CHANGED