@capybara-hq/kernel 0.1.0-rc.122 → 0.1.0-rc.124
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/bootstrap.json +31 -31
- package/dist/admin/admin.controller.d.ts +2 -2
- package/dist/admin/admin.controller.js +1 -1
- package/dist/admin/health.service.js +5 -5
- package/dist/admin/overview.service.d.ts +2 -2
- package/dist/admin/overview.service.js +1 -1
- package/dist/agents/agents.module.js +4 -0
- package/dist/agents/agents.schemas.js +1 -0
- package/dist/agents/models.controller.d.ts +2 -2
- package/dist/agents/onboarding-checklist.d.ts +30 -0
- package/dist/agents/onboarding-checklist.js +176 -0
- package/dist/agents/readiness.controller.d.ts +1 -0
- package/dist/agents/readiness.controller.js +12 -2
- package/dist/agents/readiness.service.d.ts +5 -2
- package/dist/agents/readiness.service.js +14 -3
- package/dist/automations/automations.service.js +7 -21
- package/dist/automations/events/acceptance.d.ts +2 -0
- package/dist/automations/events/acceptance.js +14 -3
- package/dist/automations/events/sweep.job.d.ts +3 -36
- package/dist/automations/events/sweep.job.js +5 -127
- package/dist/automations/fire.d.ts +3 -0
- package/dist/automations/fire.js +18 -1
- package/dist/automations/grant-rules.d.ts +0 -14
- package/dist/automations/grant-rules.js +0 -18
- package/dist/automations/scan.job.js +22 -16
- package/dist/catalog/catalog.module.d.ts +4 -7
- package/dist/catalog/catalog.module.js +4 -10
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/plugin-import.js +2 -1
- package/dist/catalog/plugin-install.d.ts +2 -2
- package/dist/catalog/plugin-install.js +2 -2
- package/dist/catalog/template-connector-ensure.d.ts +4 -7
- package/dist/catalog/template-connector-ensure.js +11 -15
- package/dist/channels/supervisor.js +34 -23
- package/dist/channels/webhook.d.ts +1 -0
- package/dist/channels/webhook.js +10 -5
- package/dist/conversations/job-org.d.ts +2 -0
- package/dist/conversations/job-org.js +12 -0
- package/dist/ctx/create-ctx.js +2 -1
- package/dist/db/kernel-schema.d.ts +1 -0
- package/dist/dial-in/auth.controller.js +3 -2
- package/dist/dial-in/auth.service.js +3 -2
- package/dist/dial-in/gateway.d.ts +0 -1
- package/dist/dial-in/gateway.js +6 -9
- package/dist/extensions/host.d.ts +2 -2
- package/dist/extensions/host.js +22 -13
- package/dist/extensions/installs.d.ts +1 -0
- package/dist/extensions/installs.js +2 -0
- package/dist/html/html-document.controller.js +3 -0
- package/dist/html/html-document.service.js +2 -0
- package/dist/http/plugin-route-access.js +7 -2
- package/dist/identity/account-avatar.controller.js +4 -2
- package/dist/identity/accounts.js +19 -32
- package/dist/identity/api-tokens.d.ts +2 -0
- package/dist/identity/api-tokens.js +14 -10
- package/dist/identity/audit.js +10 -5
- package/dist/identity/binding.d.ts +1 -1
- package/dist/identity/binding.js +19 -10
- package/dist/lifecycle/kernel-lifecycle.d.ts +1 -8
- package/dist/lifecycle/kernel-lifecycle.js +11 -37
- package/dist/models/purposes.d.ts +24 -3
- package/dist/models/purposes.js +131 -14
- package/dist/orgs/directory-sync.js +6 -4
- package/dist/orgs/roles.d.ts +1 -1
- package/dist/orgs/roles.js +1 -0
- package/dist/platform/exclusions.js +5 -0
- package/dist/platform/ops/admin.ops.js +1 -1
- package/dist/platform/ops/agents.ops.js +1 -1
- package/dist/platform/ops/models.ops.js +3 -3
- package/dist/push/fanout.d.ts +1 -0
- package/dist/push/fanout.js +11 -4
- package/dist/push/recipients.d.ts +3 -1
- package/dist/push/recipients.js +29 -22
- package/dist/runtime/maintenance.d.ts +5 -1
- package/dist/runtime/maintenance.js +50 -11
- package/dist/runtime/providers.d.ts +12 -9
- package/dist/runtime/providers.js +2 -23
- package/dist/runtime/run-orphan-check.job.d.ts +1 -0
- package/dist/runtime/run-orphan-check.job.js +23 -21
- package/dist/runtime/usage-report.d.ts +2 -1
- package/dist/runtime/usage-report.js +26 -4
- package/dist/sandbox/providers.d.ts +2 -0
- package/dist/sandbox/providers.js +2 -0
- package/dist/shares/liveness.d.ts +3 -2
- package/dist/shares/liveness.js +26 -11
- package/dist/shares/share-open.service.js +2 -0
- package/dist/skills/usable.d.ts +2 -0
- package/dist/skills/usable.js +56 -0
- package/dist/tools/builtins/platform.js +17 -12
- package/dist/tools/connector-setup.d.ts +5 -1
- package/dist/tools/connector-setup.js +14 -0
- package/dist/tools/credentials.d.ts +5 -0
- package/dist/tools/credentials.js +10 -0
- package/dist/tools/oauth/flow.d.ts +1 -0
- package/dist/tools/oauth/flow.js +8 -3
- package/dist/tools/registry.d.ts +2 -0
- package/dist/tools/registry.js +6 -0
- package/package.json +3 -3
- package/src/migrations/0209_onboarding_checklist.sql +5 -0
- package/dist/catalog/template-connector-reconcile.d.ts +0 -44
- package/dist/catalog/template-connector-reconcile.js +0 -114
package/dist/models/purposes.js
CHANGED
|
@@ -27,47 +27,112 @@ import { consumeModelStream, deltaChars } from "../runtime/model-call.js";
|
|
|
27
27
|
import { ModelRequestDenied, ProviderListError, ProviderRegistry, prepareModelStream, } from "../runtime/providers.js";
|
|
28
28
|
import { StorageService } from "../storage/storage.service.js";
|
|
29
29
|
import { IMAGE_PURPOSE, imagePurposeState } from "./image-usable.js";
|
|
30
|
+
const SUBAGENT_DESCRIPTION = {
|
|
31
|
+
zh: "按这一档派发的子智能体使用它。未设置时,沿用派发它的智能体的模型。",
|
|
32
|
+
en: "Sub-agents dispatched on this tier use this model. If unset, they use the dispatching agent's model.",
|
|
33
|
+
};
|
|
30
34
|
/**
|
|
31
35
|
* Purposes the kernel declares: the eval judge, and the three sub-agent model tiers (phase C,
|
|
32
36
|
* spec §5.4: `fast` / `standard` / `capable` → `subagent_<tier>`; an unmapped tier runs on the
|
|
33
37
|
* parent's model).
|
|
34
38
|
*/
|
|
35
39
|
export const KERNEL_PURPOSES = [
|
|
36
|
-
{
|
|
40
|
+
{
|
|
41
|
+
purpose: "eval",
|
|
42
|
+
kind: "chat",
|
|
43
|
+
fallback: "none",
|
|
44
|
+
unsetWarning: {
|
|
45
|
+
zh: "还没有设置评测评委:评测不能使用评委。",
|
|
46
|
+
en: "No eval judge is set: evals cannot use a judge.",
|
|
47
|
+
},
|
|
48
|
+
label: { zh: "评测评委", en: "Eval judge" },
|
|
49
|
+
description: {
|
|
50
|
+
zh: "比较基线与候选的回复,判定是否通过。未设置时,评测不能使用评委。",
|
|
51
|
+
en: "Compares the baseline and candidate replies to decide whether the evaluation passes. If unset, evaluations cannot use a judge.",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
37
54
|
/** Conversation titles (UI refresh B); unmapped → the conversation's current chat model. */
|
|
38
|
-
{
|
|
55
|
+
{
|
|
56
|
+
purpose: "title",
|
|
57
|
+
kind: "chat",
|
|
58
|
+
label: { zh: "会话标题", en: "Conversation titles" },
|
|
59
|
+
description: {
|
|
60
|
+
zh: "为新会话起标题。未设置时,使用会话当前的模型。",
|
|
61
|
+
en: "Generates titles for new conversations. If unset, the conversation's current model is used.",
|
|
62
|
+
},
|
|
63
|
+
},
|
|
39
64
|
/**
|
|
40
65
|
* The command-review classifier (auto mode spec §5.3); unmapped → no classifier runs and an
|
|
41
66
|
* `unsure` command is asked about.
|
|
42
67
|
*/
|
|
43
|
-
{
|
|
68
|
+
{
|
|
69
|
+
purpose: "review",
|
|
70
|
+
kind: "chat",
|
|
71
|
+
label: { zh: "命令审查", en: "Command review" },
|
|
72
|
+
description: {
|
|
73
|
+
zh: "判断规则拿不准的命令能否执行。未设置时,这类命令改为询问。",
|
|
74
|
+
en: "Decides whether to run commands when the rules are inconclusive. If unset, those commands require confirmation.",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
44
77
|
/**
|
|
45
78
|
* The `WebFetch` extraction call (web tools spec §5); unmapped → the calling conversation's
|
|
46
79
|
* current chat model (a sub-agent's call: the sub-agent's).
|
|
47
80
|
*/
|
|
48
|
-
{
|
|
81
|
+
{
|
|
82
|
+
purpose: "web_fetch",
|
|
83
|
+
kind: "chat",
|
|
84
|
+
label: { zh: "网页提取", en: "Web page extraction" },
|
|
85
|
+
description: {
|
|
86
|
+
zh: "从抓取到的网页里提取需要的内容。未设置时,使用调用它的会话(或子智能体)的模型。",
|
|
87
|
+
en: "Extracts the requested content from fetched web pages. If unset, the calling conversation's or sub-agent's model is used.",
|
|
88
|
+
},
|
|
89
|
+
},
|
|
49
90
|
/**
|
|
50
91
|
* The compaction summarizer (compaction model spec); unmapped → the model whose next request the
|
|
51
92
|
* summary serves (the conversation's model, or the overflowed rung on the reactive path).
|
|
52
93
|
*/
|
|
53
|
-
{
|
|
94
|
+
{
|
|
95
|
+
purpose: "compaction",
|
|
96
|
+
kind: "chat",
|
|
97
|
+
label: { zh: "摘要压缩", en: "Compaction" },
|
|
98
|
+
description: {
|
|
99
|
+
zh: "为长对话写摘要。未设置时,使用会话自己的模型;设置后,对话记录会发给这个模型的服务商。建议选上下文窗口大、价格低的模型。",
|
|
100
|
+
en: "Summarizes long conversations. If unset, the conversation's own model is used. If set, the conversation transcript is sent to this model's provider. Choose an inexpensive model with a large context window.",
|
|
101
|
+
},
|
|
102
|
+
},
|
|
54
103
|
{
|
|
55
104
|
purpose: "subagent_fast",
|
|
56
105
|
kind: "chat",
|
|
57
106
|
label: { zh: "子智能体:快速", en: "Sub-agent: fast" },
|
|
107
|
+
description: SUBAGENT_DESCRIPTION,
|
|
58
108
|
},
|
|
59
109
|
{
|
|
60
110
|
purpose: "subagent_standard",
|
|
61
111
|
kind: "chat",
|
|
62
112
|
label: { zh: "子智能体:标准", en: "Sub-agent: standard" },
|
|
113
|
+
description: SUBAGENT_DESCRIPTION,
|
|
63
114
|
},
|
|
64
115
|
{
|
|
65
116
|
purpose: "subagent_capable",
|
|
66
117
|
kind: "chat",
|
|
67
118
|
label: { zh: "子智能体:最强", en: "Sub-agent: capable" },
|
|
119
|
+
description: SUBAGENT_DESCRIPTION,
|
|
68
120
|
},
|
|
69
121
|
/** The `GenerateImage` tool's model; no fallback: unmapped → `model.unconfigured`. */
|
|
70
|
-
{
|
|
122
|
+
{
|
|
123
|
+
purpose: "image",
|
|
124
|
+
kind: "image_generation",
|
|
125
|
+
fallback: "none",
|
|
126
|
+
unsetWarning: {
|
|
127
|
+
zh: "有可用的图片生成模型,但还没设置:智能体不能生成图片。",
|
|
128
|
+
en: "Image generation models are available, but no model is set: agents cannot generate images.",
|
|
129
|
+
},
|
|
130
|
+
label: { zh: "图片生成", en: "Image generation" },
|
|
131
|
+
description: {
|
|
132
|
+
zh: "智能体生成图片时使用。未设置时,智能体不能生成图片。",
|
|
133
|
+
en: "Used when agents generate images. If unset, agents cannot generate images.",
|
|
134
|
+
},
|
|
135
|
+
},
|
|
71
136
|
/**
|
|
72
137
|
* The model that reads an image for a model without vision; no fallback: unmapped, or a target
|
|
73
138
|
* without `capabilities.vision` → `model.unconfigured`.
|
|
@@ -76,7 +141,16 @@ export const KERNEL_PURPOSES = [
|
|
|
76
141
|
purpose: "vision",
|
|
77
142
|
kind: "chat",
|
|
78
143
|
requires: { vision: true },
|
|
144
|
+
fallback: "none",
|
|
145
|
+
unsetWarning: {
|
|
146
|
+
zh: "有模型看不了图片,还没设置识图:这些模型无法读取图片。",
|
|
147
|
+
en: "Some models cannot view images, and no vision model is set: those models cannot read images.",
|
|
148
|
+
},
|
|
79
149
|
label: { zh: "识图", en: "Vision" },
|
|
150
|
+
description: {
|
|
151
|
+
zh: "替看不了图片的模型读取图片,只列出能看图片的模型。未设置时,这些模型无法读取图片。",
|
|
152
|
+
en: "Reads images for models without vision. Only models with vision are listed. If unset, models without vision cannot read images.",
|
|
153
|
+
},
|
|
80
154
|
},
|
|
81
155
|
];
|
|
82
156
|
/** {@link PurposeListing}s of `views`, the display names read in one call. */
|
|
@@ -121,6 +195,15 @@ export class PurposeAttemptError extends Error {
|
|
|
121
195
|
this.name = "PurposeAttemptError";
|
|
122
196
|
}
|
|
123
197
|
}
|
|
198
|
+
/** Whether enabled models exist that warrant warning about an unset no-fallback purpose. */
|
|
199
|
+
function hasUnsetWarningCandidates(decl, enabledModels) {
|
|
200
|
+
if (decl.requires?.vision === true) {
|
|
201
|
+
const hasVision = enabledModels.some((m) => m.kind === decl.kind && m.capabilities.vision === true);
|
|
202
|
+
const hasNonVision = enabledModels.some((m) => m.kind === decl.kind && m.capabilities.vision !== true);
|
|
203
|
+
return hasVision && hasNonVision;
|
|
204
|
+
}
|
|
205
|
+
return enabledModels.some((m) => m.kind === decl.kind);
|
|
206
|
+
}
|
|
124
207
|
const unknownPurpose = (purpose) => new ApiError("model.purpose_unknown", `Unknown model purpose "${purpose}"`);
|
|
125
208
|
const invalid = (details) => new ApiError("validation_failed", "Invalid purpose target", details);
|
|
126
209
|
const targetOf = (r) => r === undefined
|
|
@@ -156,13 +239,16 @@ let ModelPurposesService = class ModelPurposesService {
|
|
|
156
239
|
this.storage = storage;
|
|
157
240
|
this.log = log;
|
|
158
241
|
}
|
|
159
|
-
/**
|
|
242
|
+
/** All declared purposes: kernel purposes first, then extensions in load order. */
|
|
160
243
|
declared() {
|
|
161
244
|
const out = KERNEL_PURPOSES.map((p) => ({
|
|
162
245
|
purpose: p.purpose,
|
|
163
246
|
kind: p.kind,
|
|
164
247
|
label: { ...p.label },
|
|
248
|
+
description: { ...p.description },
|
|
165
249
|
...(p.requires !== undefined && { requires: { ...p.requires } }),
|
|
250
|
+
...(p.fallback !== undefined && { fallback: p.fallback }),
|
|
251
|
+
...(p.unsetWarning !== undefined && { unsetWarning: { ...p.unsetWarning } }),
|
|
166
252
|
declaredBy: "kernel",
|
|
167
253
|
}));
|
|
168
254
|
const seen = new Set(out.map((p) => p.purpose));
|
|
@@ -175,6 +261,7 @@ let ModelPurposesService = class ModelPurposesService {
|
|
|
175
261
|
purpose: p.purpose,
|
|
176
262
|
kind: p.kind,
|
|
177
263
|
label: { zh: p.label.zh, en: p.label.en },
|
|
264
|
+
description: p.description === undefined ? null : { zh: p.description.zh, en: p.description.en },
|
|
178
265
|
declaredBy: m.name,
|
|
179
266
|
});
|
|
180
267
|
}
|
|
@@ -199,15 +286,42 @@ let ModelPurposesService = class ModelPurposesService {
|
|
|
199
286
|
: eb.or([eb("org_id", "is", null), eb("org_id", "=", orgId)]))
|
|
200
287
|
.execute();
|
|
201
288
|
}
|
|
289
|
+
async enabledModels(orgId) {
|
|
290
|
+
const statuses = orgId === undefined
|
|
291
|
+
? await this.providers.listWithStatus()
|
|
292
|
+
: await this.providers.listWithStatus(orgId);
|
|
293
|
+
return statuses.flatMap((p) => p.status === "ok" ? p.models.filter((m) => m.disabled !== true) : []);
|
|
294
|
+
}
|
|
202
295
|
async views(decl, orgId) {
|
|
203
296
|
const rows = await this.rows(decl.map((p) => p.purpose), orgId);
|
|
204
|
-
|
|
297
|
+
const entries = decl.map((p) => {
|
|
205
298
|
const def = targetOf(rows.find((r) => r.purpose === p.purpose && r.org_id === null));
|
|
206
299
|
const ovr = orgId === undefined
|
|
207
300
|
? null
|
|
208
301
|
: targetOf(rows.find((r) => r.purpose === p.purpose && r.org_id === orgId));
|
|
209
|
-
|
|
302
|
+
const effective = ovr ?? def;
|
|
303
|
+
const unset = (orgId === undefined ? def : effective) === null;
|
|
304
|
+
return { p, def, ovr, effective, needsWarningCheck: p.fallback === "none" && unset };
|
|
210
305
|
});
|
|
306
|
+
const enabledModels = entries.some((e) => e.needsWarningCheck)
|
|
307
|
+
? await this.enabledModels(orgId)
|
|
308
|
+
: [];
|
|
309
|
+
return entries.map(({ p, def, ovr, effective, needsWarningCheck }) => ({
|
|
310
|
+
purpose: p.purpose,
|
|
311
|
+
kind: p.kind,
|
|
312
|
+
label: p.label,
|
|
313
|
+
description: p.description,
|
|
314
|
+
...(p.requires !== undefined && { requires: p.requires }),
|
|
315
|
+
declaredBy: p.declaredBy,
|
|
316
|
+
default: def,
|
|
317
|
+
override: ovr,
|
|
318
|
+
effective,
|
|
319
|
+
unsetWarning: needsWarningCheck &&
|
|
320
|
+
p.unsetWarning !== undefined &&
|
|
321
|
+
hasUnsetWarningCandidates(p, enabledModels)
|
|
322
|
+
? { ...p.unsetWarning }
|
|
323
|
+
: null,
|
|
324
|
+
}));
|
|
211
325
|
}
|
|
212
326
|
/** 全部用途与映射;不给 `orgId` = 部署级视图(`override` 一律为 null)。 */
|
|
213
327
|
async list(orgId) {
|
|
@@ -359,12 +473,15 @@ let ModelPurposesService = class ModelPurposesService {
|
|
|
359
473
|
*/
|
|
360
474
|
async resolve(orgId, purpose) {
|
|
361
475
|
const decl = this.find(purpose);
|
|
362
|
-
const
|
|
363
|
-
|
|
476
|
+
const rows = await this.rows([purpose], orgId);
|
|
477
|
+
const def = targetOf(rows.find((r) => r.purpose === purpose && r.org_id === null));
|
|
478
|
+
const ovr = targetOf(rows.find((r) => r.purpose === purpose && r.org_id === orgId));
|
|
479
|
+
const effective = ovr ?? def;
|
|
480
|
+
if (!effective) {
|
|
364
481
|
throw new ApiError("model.unconfigured", `No model is configured for the "${purpose}" purpose`);
|
|
365
482
|
}
|
|
366
483
|
try {
|
|
367
|
-
const { info } = await this.providers.resolve(orgId,
|
|
484
|
+
const { info } = await this.providers.resolve(orgId, effective.model, {
|
|
368
485
|
kind: decl.kind,
|
|
369
486
|
});
|
|
370
487
|
if (decl.requires?.vision === true && !info.capabilities.vision) {
|
|
@@ -373,13 +490,13 @@ let ModelPurposesService = class ModelPurposesService {
|
|
|
373
490
|
}
|
|
374
491
|
catch (e) {
|
|
375
492
|
if (e instanceof ProviderListError)
|
|
376
|
-
return
|
|
493
|
+
return effective;
|
|
377
494
|
if (e instanceof ApiError && e.code === "agent.model_unavailable") {
|
|
378
495
|
throw new ApiError("model.unconfigured", `The model configured for the "${purpose}" purpose is not available in this organization`);
|
|
379
496
|
}
|
|
380
497
|
throw e;
|
|
381
498
|
}
|
|
382
|
-
return
|
|
499
|
+
return effective;
|
|
383
500
|
}
|
|
384
501
|
/** The target a {@link chat} call on `purpose` uses: the mapping, else `fallback` when unmapped. */
|
|
385
502
|
async chatTarget(orgId, purpose, fallback) {
|
|
@@ -20,6 +20,7 @@ import { audit } from "../identity/audit.js";
|
|
|
20
20
|
import { ExternalIdentities } from "../identity/external.js";
|
|
21
21
|
import { afterCommit } from "../infra/database/after-commit.js";
|
|
22
22
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
23
|
+
import { asPlatform, withOrgScope } from "../infra/database/org-scope.js";
|
|
23
24
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
24
25
|
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
25
26
|
import { LockService } from "../infra/lock/lock.service.js";
|
|
@@ -151,7 +152,7 @@ let DirectorySync = class DirectorySync {
|
|
|
151
152
|
}
|
|
152
153
|
/** A `directory-sync` job (dispatched by `MaintenanceProcessor`). */
|
|
153
154
|
async runSyncJob(data) {
|
|
154
|
-
const r = await this.sync(data.orgId, data.plugin, data);
|
|
155
|
+
const r = await withOrgScope(data.orgId, () => this.sync(data.orgId, data.plugin, data));
|
|
155
156
|
// 通讯录未配置(Ruling A28)and an org needing configuration (spec A §6) are skipped silently
|
|
156
157
|
if (r.status === "skipped" && !silentSkip(r.reason)) {
|
|
157
158
|
this.log.info("directory sync skipped", {
|
|
@@ -296,7 +297,8 @@ let DirectorySync = class DirectorySync {
|
|
|
296
297
|
.map((e) => e.plugin);
|
|
297
298
|
if (plugins.length === 0)
|
|
298
299
|
return [];
|
|
299
|
-
|
|
300
|
+
// org-filter: deployment-wide discovery of enabled directories, with each target checked in its org
|
|
301
|
+
const rows = await asPlatform("find the orgs with an enabled directory", () => this.db
|
|
300
302
|
.selectFrom(enabledExtensionsByOrg(this.db.db).as("en"))
|
|
301
303
|
.innerJoin("orgs", "orgs.id", "en.org_id")
|
|
302
304
|
.select(["en.org_id", "en.plugin"])
|
|
@@ -304,10 +306,10 @@ let DirectorySync = class DirectorySync {
|
|
|
304
306
|
.where("en.plugin", "in", plugins)
|
|
305
307
|
.orderBy("en.org_id")
|
|
306
308
|
.orderBy("en.plugin")
|
|
307
|
-
.execute();
|
|
309
|
+
.execute());
|
|
308
310
|
const out = [];
|
|
309
311
|
for (const r of rows) {
|
|
310
|
-
const e = await this.eligible(r.org_id, r.plugin);
|
|
312
|
+
const e = await withOrgScope(r.org_id, () => this.eligible(r.org_id, r.plugin));
|
|
311
313
|
if (!e.ok)
|
|
312
314
|
continue;
|
|
313
315
|
try {
|
package/dist/orgs/roles.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type OrgRole = (typeof ORG_ROLES)[number];
|
|
|
4
4
|
/** `role` 是否不低于 `min`。 */
|
|
5
5
|
export declare function roleAtLeast(role: OrgRole, min: OrgRole): boolean;
|
|
6
6
|
/** 组织级动作;路由用 `@OrgAction(action)` 声明所需动作。 */
|
|
7
|
-
export type OrgAction = "org.read" | "org.update" | "org.delete" | "org.transfer" | "org.members.read" | "org.members.manage" | "org.invitations.manage" | "org.tokens.manage" | "org.extensions.read" | "org.extensions.manage" | "agents.create" | "agents.use" | "agents.manage" | "conversations.compact" | "connectors.manage" | "connectors.use" | "approvals.decide" | "channels.manage" | "skills.read" | "skills.manage" | "ui.use" | "trajectories.read" | "evals.manage" | "org.models.manage" | "catalog.read" | "catalog.request" | "catalog.decide" | "catalog.upload" | "automations.use" | "automations.manage";
|
|
7
|
+
export type OrgAction = "org.read" | "org.onboarding.dismiss" | "org.update" | "org.delete" | "org.transfer" | "org.members.read" | "org.members.manage" | "org.invitations.manage" | "org.tokens.manage" | "org.extensions.read" | "org.extensions.manage" | "agents.create" | "agents.use" | "agents.manage" | "conversations.compact" | "connectors.manage" | "connectors.use" | "approvals.decide" | "channels.manage" | "skills.read" | "skills.manage" | "ui.use" | "trajectories.read" | "evals.manage" | "org.models.manage" | "catalog.read" | "catalog.request" | "catalog.decide" | "catalog.upload" | "automations.use" | "automations.manage";
|
|
8
8
|
/** 每个动作所需的最低角色。 */
|
|
9
9
|
export declare const ACTION_MIN_ROLE: Record<OrgAction, OrgRole>;
|
|
10
10
|
/** 只允许 user principal 执行的动作:服务令牌即使角色足够也拒绝(除 SERVICE_ALLOWED 外全部)。 */
|
package/dist/orgs/roles.js
CHANGED
|
@@ -75,6 +75,11 @@ export const PLATFORM_EXCLUSIONS = [
|
|
|
75
75
|
reason: "Creates the first super admin account and password",
|
|
76
76
|
},
|
|
77
77
|
// agents
|
|
78
|
+
{
|
|
79
|
+
route: "POST /api/v1/orgs/:orgId/readiness/dismiss",
|
|
80
|
+
category: "human-only",
|
|
81
|
+
reason: "A person hides the onboarding checklist in their own workspace",
|
|
82
|
+
},
|
|
78
83
|
{
|
|
79
84
|
route: "GET /api/v1/orgs/:orgId/agents/:agentId/avatar",
|
|
80
85
|
category: "transport",
|
|
@@ -446,7 +446,7 @@ let AdminOperations = class AdminOperations {
|
|
|
446
446
|
}),
|
|
447
447
|
defineOperation({
|
|
448
448
|
id: "models.platform-list",
|
|
449
|
-
description: "The platform's model catalog (super admin). Without provider: one row per model provider with its state (ok, error with the reason, org_configured: each org configures it), its plugin and how many models it lists and how many the platform disabled. With provider: that provider's models, one row each (id, name, kind, disabled), paged by 50 (pass the returned next as params.cursor).",
|
|
449
|
+
description: "The platform's model catalog (super admin). Without provider: one row per model provider with its state (ok, error with the reason, org_configured: each org configures it; check that org's status with models.catalog), its plugin and how many models it lists and how many the platform disabled. With provider: that provider's models, one row each (id, name, kind, disabled), paged by 50 (pass the returned next as params.cursor).",
|
|
450
450
|
input: z.object({ provider: ProviderId.optional(), cursor: Cursor.optional() }).strict(),
|
|
451
451
|
example: {},
|
|
452
452
|
authz: { superAdmin: true },
|
|
@@ -780,7 +780,7 @@ let AgentsOperations = class AgentsOperations {
|
|
|
780
780
|
}),
|
|
781
781
|
defineOperation({
|
|
782
782
|
id: "agents.readiness",
|
|
783
|
-
description: "Whether the org can run agents: modelProvider is ready when the org has a chat model an agent can pick (the list agents.create chooses from); no_models when model providers are on but none gives one (unusableProviders names each provider and its reason: list_failed with errorKind, e.g. auth for a rejected key, or no_chat_models; orgCanFix says whether an org admin can fix it on Settings > Models, else only the super admin can on the admin Models page); org_fixable when no provider is on but an org admin can make one available on Settings > Models (orgFixableProviders names each provider and its reason: not_enabled, switch it on; needs_config, fill the org's config); none when only the super admin can help;
|
|
783
|
+
description: "Whether the org can run agents: modelProvider is ready when the org has a chat model an agent can pick (the list agents.create chooses from); no_models when model providers are on but none gives one (unusableProviders names each provider and its reason: list_failed with errorKind, e.g. auth for a rejected key, or no_chat_models; orgCanFix says whether an org admin can fix it on Settings > Models, else only the super admin can on the admin Models page); org_fixable when no provider is on but an org admin can make one available on Settings > Models (orgFixableProviders names each provider and its reason: not_enabled, switch it on; needs_config, fill the org's config); none when only the super admin can help; how many agents you can see, and the optional setup steps visible to your role. checklistDismissed is your own preference in this org.",
|
|
784
784
|
input: z.object({}).strict(),
|
|
785
785
|
example: {},
|
|
786
786
|
authz: { orgAction: "org.read" },
|
|
@@ -197,7 +197,7 @@ let ModelsOperations = class ModelsOperations {
|
|
|
197
197
|
}),
|
|
198
198
|
defineOperation({
|
|
199
199
|
id: "models.catalog",
|
|
200
|
-
description: "Read the org's model catalog (org admins):
|
|
200
|
+
description: "Read the org's model catalog (org admins): each enabled provider's status (ok, needs_config for an incomplete org connection, or error for a failed list) and the models the platform left on, each marked enabled or disabled by the org's own list. Use it before models.set-disabled. Optionally one provider. Pages by 50 providers: pass the returned next as params.cursor.",
|
|
201
201
|
input: z.object({ provider: Provider.optional(), cursor: Cursor.optional() }).strict(),
|
|
202
202
|
example: {},
|
|
203
203
|
authz: { orgAction: "org.models.manage" },
|
|
@@ -214,8 +214,8 @@ let ModelsOperations = class ModelsOperations {
|
|
|
214
214
|
name: names.get(p.plugin)?.en ?? p.plugin,
|
|
215
215
|
state: p.status,
|
|
216
216
|
...(p.error !== undefined && { reason: p.error.slice(0, 300) }),
|
|
217
|
-
...(p.status === "
|
|
218
|
-
next: "
|
|
217
|
+
...(p.status === "needs_config" && {
|
|
218
|
+
next: "Complete this organization's connection settings on the model provider's detail page in the web app.",
|
|
219
219
|
}),
|
|
220
220
|
models: p.models.map((m) => ({
|
|
221
221
|
id: m.id,
|
package/dist/push/fanout.d.ts
CHANGED
|
@@ -26,4 +26,5 @@ export declare class PushFanout {
|
|
|
26
26
|
constructor(kdb: KernelDb, txHost: TransactionHost, outbox: Pick<OutboxService, "addMany">, registrations: Pick<PushRegistrationsService, "forAccounts">, preferences: Pick<PushPreferencesService, "enabledFor">, config: Pick<KernelConfigService, "get">, log: KernelLogger);
|
|
27
27
|
/** Owes the deliveries of one event; returns how many outbox rows it wrote. */
|
|
28
28
|
run(data: PushFanoutData): Promise<number>;
|
|
29
|
+
private oweDeliveries;
|
|
29
30
|
}
|
package/dist/push/fanout.js
CHANGED
|
@@ -10,13 +10,14 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
10
10
|
import { Inject, Injectable } from "@nestjs/common";
|
|
11
11
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
12
12
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
13
|
+
import { withOrgScope } from "../infra/database/org-scope.js";
|
|
13
14
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
14
15
|
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
15
16
|
import { OutboxService } from "../infra/outbox/outbox.service.js";
|
|
16
17
|
import { KERNEL_LOGGER } from "../infra/tokens.js";
|
|
17
18
|
import { PUSH_DELIVER_JOB, PUSH_QUEUE, pushDeliverJobId, } from "./jobs.js";
|
|
18
19
|
import { PushPreferencesService } from "./preferences.service.js";
|
|
19
|
-
import { resolveRecipients } from "./recipients.js";
|
|
20
|
+
import { resolvePushOrg, resolveRecipients } from "./recipients.js";
|
|
20
21
|
import { PushRegistrationsService } from "./registrations.service.js";
|
|
21
22
|
import { renderPushMessage } from "./texts.js";
|
|
22
23
|
/**
|
|
@@ -53,8 +54,14 @@ let PushFanout = class PushFanout {
|
|
|
53
54
|
this.log.warn("push fanout skipped: http.publicUrl is not set", { eventId: data.eventId });
|
|
54
55
|
return 0;
|
|
55
56
|
}
|
|
57
|
+
const orgId = await resolvePushOrg(this.kdb.db, data.source);
|
|
58
|
+
if (orgId === undefined)
|
|
59
|
+
return 0;
|
|
60
|
+
return withOrgScope(orgId, () => this.oweDeliveries(data, orgId, publicUrl, cfg.push.previews));
|
|
61
|
+
}
|
|
62
|
+
async oweDeliveries(data, orgId, publicUrl, previews) {
|
|
56
63
|
const origin = new URL(publicUrl).origin;
|
|
57
|
-
const resolved = await resolveRecipients(this.kdb.db, data.source);
|
|
64
|
+
const resolved = await resolveRecipients(this.kdb.db, orgId, data.source);
|
|
58
65
|
if (resolved === null)
|
|
59
66
|
return 0;
|
|
60
67
|
const enabled = await this.preferences.enabledFor(resolved.accountIds, resolved.category);
|
|
@@ -70,7 +77,7 @@ let PushFanout = class PushFanout {
|
|
|
70
77
|
eventId: data.eventId,
|
|
71
78
|
registrationId: reg.id,
|
|
72
79
|
accountId: reg.account_id,
|
|
73
|
-
message: renderPushMessage(push, reg.locale,
|
|
80
|
+
message: renderPushMessage(push, reg.locale, previews, origin),
|
|
74
81
|
},
|
|
75
82
|
orgId: resolved.orgId,
|
|
76
83
|
}));
|
|
@@ -81,7 +88,7 @@ let PushFanout = class PushFanout {
|
|
|
81
88
|
};
|
|
82
89
|
__decorate([
|
|
83
90
|
Transactional()
|
|
84
|
-
], PushFanout.prototype, "
|
|
91
|
+
], PushFanout.prototype, "oweDeliveries", null);
|
|
85
92
|
PushFanout = __decorate([
|
|
86
93
|
Injectable(),
|
|
87
94
|
__param(0, Inject(KernelDb)),
|
|
@@ -3,6 +3,8 @@ import type { PushFanoutData } from "./jobs.js";
|
|
|
3
3
|
import type { ResolvedPush } from "./texts.js";
|
|
4
4
|
/** An event's push before the event id is attached: who receives it and what it says. */
|
|
5
5
|
export type ResolvedRecipients = Omit<ResolvedPush, "eventId">;
|
|
6
|
+
/** Resolves the tenant of a queued event from its persisted source identifier. */
|
|
7
|
+
export declare function resolvePushOrg(db: KernelSchemaDb, source: PushFanoutData["source"]): Promise<string | undefined>;
|
|
6
8
|
/**
|
|
7
9
|
* Who an event's push reaches, read when the fanout runs (mobile app spec §9.4, the plan's
|
|
8
10
|
* Triggers table), or null when nothing is pushed. Every check is made now, not when the event was
|
|
@@ -28,4 +30,4 @@ export type ResolvedRecipients = Omit<ResolvedPush, "eventId">;
|
|
|
28
30
|
* is the root conversation (`automation-<taskId>` for an automation), the title the root's agent name
|
|
29
31
|
* (the task's name).
|
|
30
32
|
*/
|
|
31
|
-
export declare function resolveRecipients(db: KernelSchemaDb, source: PushFanoutData["source"]): Promise<ResolvedRecipients | null>;
|
|
33
|
+
export declare function resolveRecipients(db: KernelSchemaDb, orgId: string, source: PushFanoutData["source"]): Promise<ResolvedRecipients | null>;
|
package/dist/push/recipients.js
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
|
+
import { resolveConversationOrg } from "../conversations/job-org.js";
|
|
1
2
|
import { isExtensionEnabled } from "../extensions/enabled.js";
|
|
3
|
+
import { asPlatform } from "../infra/database/org-scope.js";
|
|
2
4
|
import { ORG_ROLES, roleAtLeast } from "../orgs/roles.js";
|
|
3
5
|
import { rootConversationOf } from "../runtime/subagents/child.js";
|
|
4
6
|
import { pluginDisplayNames } from "../tools/display-names.js";
|
|
5
7
|
import { pushTriggerOf } from "./triggers.js";
|
|
8
|
+
/** Resolves the tenant of a queued event from its persisted source identifier. */
|
|
9
|
+
export async function resolvePushOrg(db, source) {
|
|
10
|
+
if (source.kind === "conversation")
|
|
11
|
+
return resolveConversationOrg(db, source.conversationId);
|
|
12
|
+
// org-filter: deployment-wide lookup of the owning org for a queued inbox item or automation run
|
|
13
|
+
const row = await asPlatform("resolve the org of a queued push event", () => db
|
|
14
|
+
.selectFrom(source.kind === "inbox" ? "inbox_items" : "automation_runs")
|
|
15
|
+
.select("org_id")
|
|
16
|
+
.where("id", "=", source.kind === "inbox" ? source.itemId : source.taskRunId)
|
|
17
|
+
.executeTakeFirst());
|
|
18
|
+
return row?.org_id;
|
|
19
|
+
}
|
|
6
20
|
/**
|
|
7
21
|
* Who an event's push reaches, read when the fanout runs (mobile app spec §9.4, the plan's
|
|
8
22
|
* Triggers table), or null when nothing is pushed. Every check is made now, not when the event was
|
|
@@ -28,27 +42,25 @@ import { pushTriggerOf } from "./triggers.js";
|
|
|
28
42
|
* is the root conversation (`automation-<taskId>` for an automation), the title the root's agent name
|
|
29
43
|
* (the task's name).
|
|
30
44
|
*/
|
|
31
|
-
export async function resolveRecipients(db, source) {
|
|
45
|
+
export async function resolveRecipients(db, orgId, source) {
|
|
32
46
|
switch (source.kind) {
|
|
33
47
|
case "automation":
|
|
34
|
-
return resolveAutomation(db, source.taskRunId);
|
|
48
|
+
return resolveAutomation(db, orgId, source.taskRunId);
|
|
35
49
|
case "inbox":
|
|
36
|
-
return resolveInboxItem(db, source.itemId);
|
|
50
|
+
return resolveInboxItem(db, orgId, source.itemId);
|
|
37
51
|
default:
|
|
38
|
-
return resolveConversation(db, source.conversationId, source.seq);
|
|
52
|
+
return resolveConversation(db, orgId, source.conversationId, source.seq);
|
|
39
53
|
}
|
|
40
54
|
}
|
|
41
|
-
async function resolveInboxItem(db, itemId) {
|
|
42
|
-
// org-filter: itemId comes from the kernel-written push fan-out job; this read learns the item's
|
|
43
|
-
// org, which every later read filters by
|
|
55
|
+
async function resolveInboxItem(db, orgId, itemId) {
|
|
44
56
|
const item = await db
|
|
45
57
|
.selectFrom("inbox_items")
|
|
46
|
-
.select(["
|
|
58
|
+
.select(["account_id", "plugin", "title", "title_localized", "state", "expires_at"])
|
|
47
59
|
.where("id", "=", itemId)
|
|
60
|
+
.where("org_id", "=", orgId)
|
|
48
61
|
.executeTakeFirst();
|
|
49
|
-
if (
|
|
62
|
+
if (item?.state !== "open" || item.expires_at.getTime() <= Date.now())
|
|
50
63
|
return null;
|
|
51
|
-
const orgId = item.org_id;
|
|
52
64
|
if (!(await orgLive(db, orgId)))
|
|
53
65
|
return null;
|
|
54
66
|
if (item.plugin !== null && !(await isExtensionEnabled(db, orgId, item.plugin)))
|
|
@@ -70,7 +82,7 @@ async function resolveInboxItem(db, itemId) {
|
|
|
70
82
|
text: "inboxItem",
|
|
71
83
|
};
|
|
72
84
|
}
|
|
73
|
-
async function resolveConversation(db, conversationId, seq) {
|
|
85
|
+
async function resolveConversation(db, orgId, conversationId, seq) {
|
|
74
86
|
const event = await db
|
|
75
87
|
.selectFrom("conversation_events")
|
|
76
88
|
.select(["type", "payload", "run_id"])
|
|
@@ -82,18 +94,16 @@ async function resolveConversation(db, conversationId, seq) {
|
|
|
82
94
|
const trigger = pushTriggerOf({ type: event.type, payload: event.payload });
|
|
83
95
|
if (trigger === null)
|
|
84
96
|
return null;
|
|
85
|
-
// org-filter: conversationId comes from the kernel-written push fan-out job; this read learns
|
|
86
|
-
// the conversation's org, which every later read filters by
|
|
87
97
|
const conv = await db
|
|
88
98
|
.selectFrom("conversations")
|
|
89
|
-
.select(["
|
|
99
|
+
.select(["kind", "account_id", "deleted_at"])
|
|
90
100
|
.where("id", "=", conversationId)
|
|
101
|
+
.where("org_id", "=", orgId)
|
|
91
102
|
.executeTakeFirst();
|
|
92
103
|
if (!conv || conv.kind === "eval" || conv.deleted_at !== null)
|
|
93
104
|
return null;
|
|
94
105
|
if (trigger.category === "replies" && conv.kind !== "chat")
|
|
95
106
|
return null;
|
|
96
|
-
const orgId = conv.org_id;
|
|
97
107
|
if (!(await orgLive(db, orgId)))
|
|
98
108
|
return null;
|
|
99
109
|
const rootId = conv.kind === "subagent" ? await rootConversationOf(db, conversationId) : conversationId;
|
|
@@ -211,30 +221,27 @@ async function resolveConversation(db, conversationId, seq) {
|
|
|
211
221
|
text: trigger.text,
|
|
212
222
|
};
|
|
213
223
|
}
|
|
214
|
-
async function resolveAutomation(db, taskRunId) {
|
|
215
|
-
// org-filter: taskRunId comes from the kernel-written push fan-out job; this read learns the
|
|
216
|
-
// run's org (checked against its task's below), which every later read filters by
|
|
224
|
+
async function resolveAutomation(db, orgId, taskRunId) {
|
|
217
225
|
const row = await db
|
|
218
226
|
.selectFrom("automation_runs")
|
|
219
227
|
.innerJoin("automations", "automations.id", "automation_runs.automation_id")
|
|
220
228
|
.select([
|
|
221
|
-
"automation_runs.org_id",
|
|
222
229
|
"automation_runs.status",
|
|
223
230
|
"automation_runs.conversation_id",
|
|
224
231
|
"automations.id as automation_id",
|
|
225
|
-
"automations.org_id as task_org_id",
|
|
226
232
|
"automations.account_id",
|
|
227
233
|
"automations.name",
|
|
228
234
|
])
|
|
229
235
|
.where("automation_runs.id", "=", taskRunId)
|
|
236
|
+
.where("automation_runs.org_id", "=", orgId)
|
|
237
|
+
.where("automations.org_id", "=", orgId)
|
|
230
238
|
// a deleted task pushes nothing
|
|
231
239
|
.where("automations.deleted_at", "is", null)
|
|
232
240
|
.executeTakeFirst();
|
|
233
|
-
if (!row
|
|
241
|
+
if (!row)
|
|
234
242
|
return null;
|
|
235
243
|
if (row.status !== "completed" && row.status !== "failed")
|
|
236
244
|
return null;
|
|
237
|
-
const orgId = row.org_id;
|
|
238
245
|
if (!(await orgLive(db, orgId)))
|
|
239
246
|
return null;
|
|
240
247
|
const accountIds = await activeMembers(db, orgId, [row.account_id]);
|
|
@@ -6,6 +6,7 @@ import { AutomationFirer } from "../automations/fire.js";
|
|
|
6
6
|
import { ConversationNoticeDelivery } from "../device-access/conversation-notice-delivery.js";
|
|
7
7
|
import { BlobObjects } from "../files/blob-objects.js";
|
|
8
8
|
import { FileLibraryHashJob } from "../files/hash-job.js";
|
|
9
|
+
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
9
10
|
import { ScheduledRuns } from "../infra/schedule/scheduled-runs.js";
|
|
10
11
|
import type { KernelLogger } from "../log.js";
|
|
11
12
|
import { DirectorySync } from "../orgs/directory-sync.js";
|
|
@@ -59,11 +60,14 @@ export declare class MaintenanceProcessor extends WorkerHost<Worker> {
|
|
|
59
60
|
private readonly triggers;
|
|
60
61
|
private readonly coalescer;
|
|
61
62
|
private readonly idleCompaction;
|
|
63
|
+
private readonly db;
|
|
62
64
|
private readonly loopback;
|
|
63
|
-
constructor(permissionApprovals: Pick<PermissionApprovalJobs, "recheck">, waits: Pick<Waits, "processTimeout" | "childFinished" | "stopChildren" | "stopDescendantsOfStopped" | "stopTree">, sandbox: Pick<SandboxService, "destroyDevice" | "resetFileSystem" | "revokeDeadHolder">, drift: Pick<ToolDrift, "check">, directory: Pick<DirectorySync, "runSyncJob">, deletion: Pick<RunDeletion, "stopOrg" | "stopTree">, offboarding: Pick<Offboarding, "stopRun">, runs: Pick<RunQueue, "ensureRun">, automations: Pick<AutomationFirer, "fire" | "settle">, scheduled: Pick<ScheduledRuns, "runNow">, log: Pick<KernelLogger, "error" | "warn">, operations: Pick<SandboxOperationReconcileJob, "reconcile" | "revoke" | "settleResumeProof">, blobObjects: Pick<BlobObjects, "deleteBlob" | "deleteStaging" | "releaseFile">, hashing: Pick<FileLibraryHashJob, "dispatch" | "runOrgBatch">, platformIcons: Pick<PlatformIconObjects, "deleteObject">, notices: Pick<ConversationNoticeDelivery, "attempt">, triggers: Pick<TriggerDispatcher, "dispatch">, coalescer: Pick<EventCoalescer, "flush">, idleCompaction: Pick<IdleCompactionJob, "fire">, loopback: Pick<LoopbackGrants, "refresh">);
|
|
65
|
+
constructor(permissionApprovals: Pick<PermissionApprovalJobs, "recheck">, waits: Pick<Waits, "processTimeout" | "childFinished" | "stopChildren" | "stopDescendantsOfStopped" | "stopTree">, sandbox: Pick<SandboxService, "destroyDevice" | "resetFileSystem" | "revokeDeadHolder">, drift: Pick<ToolDrift, "check">, directory: Pick<DirectorySync, "runSyncJob">, deletion: Pick<RunDeletion, "stopOrg" | "stopTree">, offboarding: Pick<Offboarding, "stopRun">, runs: Pick<RunQueue, "ensureRun">, automations: Pick<AutomationFirer, "fire" | "settle">, scheduled: Pick<ScheduledRuns, "runNow">, log: Pick<KernelLogger, "error" | "warn">, operations: Pick<SandboxOperationReconcileJob, "reconcile" | "revoke" | "settleResumeProof">, blobObjects: Pick<BlobObjects, "deleteBlob" | "deleteStaging" | "releaseFile">, hashing: Pick<FileLibraryHashJob, "dispatch" | "runOrgBatch">, platformIcons: Pick<PlatformIconObjects, "deleteObject">, notices: Pick<ConversationNoticeDelivery, "attempt">, triggers: Pick<TriggerDispatcher, "dispatch">, coalescer: Pick<EventCoalescer, "flush">, idleCompaction: Pick<IdleCompactionJob, "fire">, db: KernelDb, loopback: Pick<LoopbackGrants, "refresh">);
|
|
64
66
|
process(job: Job, token?: string): Promise<void>;
|
|
65
67
|
/** Starts consuming (worker role, after the extensions loaded; built with `autorun: false`). */
|
|
66
68
|
start(): void;
|
|
69
|
+
private inOwnerScope;
|
|
70
|
+
private waitOwner;
|
|
67
71
|
private dispatch;
|
|
68
72
|
failed(job: Job | undefined, err: Error): void;
|
|
69
73
|
error(err: Error): void;
|