@capybara-hq/kernel 0.1.0-rc.84 → 0.1.0-rc.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/dist/admin/admin.module.js +5 -0
  2. package/dist/admin/health.service.d.ts +2 -2
  3. package/dist/admin/health.service.js +10 -2
  4. package/dist/catalog/admin-catalog.controller.d.ts +2 -1
  5. package/dist/catalog/admin-catalog.controller.js +2 -1
  6. package/dist/catalog/catalog-content.d.ts +5 -15
  7. package/dist/catalog/catalog-content.js +5 -56
  8. package/dist/catalog/catalog-scope.service.d.ts +3 -3
  9. package/dist/catalog/catalog-scope.service.js +4 -3
  10. package/dist/catalog/catalog.module.d.ts +3 -1
  11. package/dist/catalog/catalog.module.js +14 -1
  12. package/dist/catalog/component-scope.service.d.ts +6 -1
  13. package/dist/catalog/component-scope.service.js +16 -2
  14. package/dist/catalog/job-ids.d.ts +29 -0
  15. package/dist/catalog/job-ids.js +29 -0
  16. package/dist/catalog/jobs.d.ts +12 -3
  17. package/dist/catalog/jobs.js +28 -7
  18. package/dist/catalog/marketplaces.service.d.ts +1 -1
  19. package/dist/catalog/org-catalog.controller.d.ts +2 -30
  20. package/dist/catalog/org-catalog.controller.js +3 -29
  21. package/dist/catalog/org-catalog.schemas.d.ts +9 -46
  22. package/dist/catalog/org-catalog.schemas.js +9 -23
  23. package/dist/catalog/org-catalog.service.js +14 -23
  24. package/dist/catalog/plugin-import.d.ts +21 -0
  25. package/dist/catalog/plugin-import.js +33 -3
  26. package/dist/catalog/plugin-install.d.ts +69 -76
  27. package/dist/catalog/plugin-install.js +156 -234
  28. package/dist/catalog/plugin-upgrade.d.ts +71 -11
  29. package/dist/catalog/plugin-upgrade.js +222 -43
  30. package/dist/catalog/scope-sync.d.ts +22 -20
  31. package/dist/catalog/scope-sync.js +57 -42
  32. package/dist/catalog/template-connector-ensure.d.ts +100 -0
  33. package/dist/catalog/template-connector-ensure.js +285 -0
  34. package/dist/catalog/template-connector-jobs.d.ts +28 -0
  35. package/dist/catalog/template-connector-jobs.js +54 -0
  36. package/dist/catalog/template-connector-reconcile.d.ts +44 -0
  37. package/dist/catalog/template-connector-reconcile.js +114 -0
  38. package/dist/catalog/template-connectors.processor.d.ts +32 -0
  39. package/dist/catalog/template-connectors.processor.js +101 -0
  40. package/dist/channels/cards.d.ts +7 -3
  41. package/dist/channels/cards.js +9 -4
  42. package/dist/channels/phrases.d.ts +10 -0
  43. package/dist/channels/phrases.js +10 -0
  44. package/dist/config/docs.js +1 -1
  45. package/dist/config/schema.d.ts +3 -0
  46. package/dist/config/schema.js +18 -12
  47. package/dist/ctx/create-ctx.d.ts +10 -1
  48. package/dist/ctx/create-ctx.js +42 -2
  49. package/dist/db/kernel-schema.d.ts +2 -1
  50. package/dist/device-access/device-access.module.d.ts +7 -0
  51. package/dist/device-access/device-access.module.js +41 -0
  52. package/dist/device-access/device-access.service.d.ts +142 -0
  53. package/dist/device-access/device-access.service.js +464 -0
  54. package/dist/device-access/token.d.ts +6 -0
  55. package/dist/device-access/token.js +6 -0
  56. package/dist/device-access/viewer-routes.d.ts +45 -0
  57. package/dist/device-access/viewer-routes.js +81 -0
  58. package/dist/device-access/viewer.d.ts +244 -0
  59. package/dist/device-access/viewer.js +844 -0
  60. package/dist/dial-in/access.d.ts +19 -0
  61. package/dist/dial-in/access.js +23 -0
  62. package/dist/dial-in/gateway.d.ts +48 -6
  63. package/dist/dial-in/gateway.js +145 -10
  64. package/dist/dial-in/keys.d.ts +7 -0
  65. package/dist/dial-in/keys.js +7 -0
  66. package/dist/dial-in/routes.d.ts +11 -3
  67. package/dist/dial-in/routes.js +15 -4
  68. package/dist/dial-in/streams.d.ts +58 -0
  69. package/dist/dial-in/streams.js +283 -0
  70. package/dist/errors.d.ts +2 -0
  71. package/dist/errors.js +2 -0
  72. package/dist/extensions/host.d.ts +13 -1
  73. package/dist/extensions/host.js +20 -1
  74. package/dist/extensions/org-config.d.ts +6 -1
  75. package/dist/extensions/org-config.js +15 -2
  76. package/dist/extensions/permission-set.d.ts +15 -1
  77. package/dist/extensions/permission-set.js +13 -1
  78. package/dist/extensions/permission-view.d.ts +6 -4
  79. package/dist/extensions/permission-view.js +6 -1
  80. package/dist/git/gateway.js +3 -1
  81. package/dist/http/error.filter.js +2 -0
  82. package/dist/http/gateway-routes.d.ts +8 -4
  83. package/dist/http/gateway-routes.js +4 -3
  84. package/dist/infra/lock/lock.service.d.ts +5 -1
  85. package/dist/infra/lock/lock.service.js +10 -4
  86. package/dist/infra/outbox/registry.d.ts +28 -0
  87. package/dist/infra/outbox/registry.js +33 -0
  88. package/dist/infra/queue/queue-names.d.ts +1 -1
  89. package/dist/infra/queue/queue-names.js +2 -0
  90. package/dist/infra/throttler/named-throttlers.d.ts +3 -0
  91. package/dist/infra/throttler/named-throttlers.js +16 -0
  92. package/dist/kernel.module.js +3 -0
  93. package/dist/lifecycle/kernel-lifecycle.d.ts +8 -1
  94. package/dist/lifecycle/kernel-lifecycle.js +37 -11
  95. package/dist/orgs/org-owner.d.ts +7 -0
  96. package/dist/orgs/org-owner.js +16 -0
  97. package/dist/platform/operation.d.ts +3 -4
  98. package/dist/platform/ops/connectors.ops.js +8 -1
  99. package/dist/platform/ops/org-plugins.ops.d.ts +0 -9
  100. package/dist/platform/ops/org-plugins.ops.js +18 -235
  101. package/dist/platform/ops/plugins.ops.d.ts +0 -1
  102. package/dist/platform/ops/plugins.ops.js +3 -31
  103. package/dist/roles/gateway-role.d.ts +13 -6
  104. package/dist/roles/gateway-role.js +27 -9
  105. package/dist/roles/gateway.module.d.ts +2 -1
  106. package/dist/roles/gateway.module.js +13 -3
  107. package/dist/roles/worker-role.d.ts +9 -4
  108. package/dist/roles/worker-role.js +18 -5
  109. package/dist/roles/worker.module.d.ts +1 -1
  110. package/dist/roles/worker.module.js +8 -1
  111. package/dist/sandbox/device-services.d.ts +62 -0
  112. package/dist/sandbox/device-services.js +183 -0
  113. package/dist/sandbox/leases.d.ts +18 -1
  114. package/dist/sandbox/leases.js +75 -1
  115. package/dist/sandbox/network-grants.js +5 -2
  116. package/dist/sandbox/sandbox.module.d.ts +2 -1
  117. package/dist/sandbox/sandbox.module.js +5 -2
  118. package/dist/sandbox/sandbox.service.d.ts +44 -1
  119. package/dist/sandbox/sandbox.service.js +142 -5
  120. package/dist/setup/setup-guides.service.d.ts +9 -1
  121. package/dist/setup/setup-guides.service.js +38 -8
  122. package/dist/tools/admin-connectors.d.ts +3 -2
  123. package/dist/tools/admin-connectors.js +5 -4
  124. package/dist/tools/approvals.service.d.ts +45 -20
  125. package/dist/tools/approvals.service.js +19 -9
  126. package/dist/tools/call-scope.d.ts +60 -0
  127. package/dist/tools/call-scope.js +23 -0
  128. package/dist/tools/connector-setup.d.ts +28 -0
  129. package/dist/tools/connector-setup.js +33 -0
  130. package/dist/tools/connector-tools-jobs.d.ts +35 -0
  131. package/dist/tools/connector-tools-jobs.js +40 -0
  132. package/dist/tools/connector-tools.processor.d.ts +32 -0
  133. package/dist/tools/connector-tools.processor.js +97 -0
  134. package/dist/tools/connectors.controller.d.ts +1 -0
  135. package/dist/tools/connectors.schemas.d.ts +1 -0
  136. package/dist/tools/connectors.schemas.js +5 -0
  137. package/dist/tools/connectors.service.d.ts +138 -14
  138. package/dist/tools/connectors.service.js +410 -50
  139. package/dist/tools/credentials.d.ts +35 -0
  140. package/dist/tools/credentials.js +89 -1
  141. package/dist/tools/drift.d.ts +5 -0
  142. package/dist/tools/drift.js +21 -2
  143. package/dist/tools/editable-endpoint.d.ts +23 -0
  144. package/dist/tools/editable-endpoint.js +92 -0
  145. package/dist/tools/network-asks.d.ts +13 -0
  146. package/dist/tools/network-asks.js +26 -2
  147. package/dist/tools/oauth/flow.d.ts +1 -1
  148. package/dist/tools/oauth/flow.js +3 -2
  149. package/dist/tools/pipeline.d.ts +30 -1
  150. package/dist/tools/pipeline.js +299 -59
  151. package/dist/tools/questions.service.d.ts +24 -3
  152. package/dist/tools/questions.service.js +3 -1
  153. package/dist/tools/registry.d.ts +14 -2
  154. package/dist/tools/registry.js +27 -6
  155. package/dist/tools/tools.module.js +4 -0
  156. package/package.json +3 -3
  157. package/src/migrations/0183_connectors_created_by_nullable.sql +5 -0
@@ -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 { CatalogModule } from "../catalog/catalog.module.js";
9
+ import { TemplateConnectorsQueueModule } from "../catalog/template-connector-jobs.js";
9
10
  import { ChannelsModule } from "../channels/channels.module.js";
10
11
  import { PromptSuggestionsModule } from "../conversations/prompt-suggestions.js";
11
12
  import { TitlesModule } from "../conversations/titles.js";
@@ -21,6 +22,7 @@ import { ProvidersModule } from "../runtime/providers.js";
21
22
  import { RunJobsModule } from "../runtime/run-jobs.js";
22
23
  import { UsageReportModule } from "../runtime/usage-report.js";
23
24
  import { SandboxProviderRegistryModule } from "../sandbox/providers.module.js";
25
+ import { ConnectorToolsQueueModule } from "../tools/connector-tools-jobs.js";
24
26
  import { AuditLogService } from "./audit-log.service.js";
25
27
  import { AdminHealthService } from "./health.service.js";
26
28
  import { OrgNetworkAdmin } from "./org-network.service.js";
@@ -59,6 +61,9 @@ AdminModule = __decorate([
59
61
  LifecycleHooksModule,
60
62
  // the push queue the overview counts
61
63
  PushModule,
64
+ // the connector tools and template connectors queues the overview counts
65
+ ConnectorToolsQueueModule,
66
+ TemplateConnectorsQueueModule,
62
67
  // the price table of the usage aggregate
63
68
  ModelsModule,
64
69
  ],
@@ -5,7 +5,7 @@ import { type LiveReplica, ReplicaPresence } from "../infra/presence/replica-pre
5
5
  import type { KernelLogger } from "../log.js";
6
6
  import { DeviceProviders } from "../sandbox/providers.js";
7
7
  /** The kernel's own queues, in the order the overview lists them (extension queues are not read). */
8
- export declare const KERNEL_QUEUE_NAMES: readonly ["cap-kernel-runs", "cap-kernel-subagent-runs", "cap-kernel-channels", "cap-kernel-maintenance", "cap-kernel-plugin-scope", "cap-kernel-titles", "cap-kernel-suggestions", "cap-kernel-usage-report", "cap-kernel-evals", "cap-kernel-lifecycle", "cap-push-deliver"];
8
+ export declare const KERNEL_QUEUE_NAMES: readonly ["cap-kernel-runs", "cap-kernel-subagent-runs", "cap-kernel-channels", "cap-kernel-maintenance", "cap-kernel-plugin-scope", "cap-kernel-titles", "cap-kernel-suggestions", "cap-kernel-usage-report", "cap-kernel-evals", "cap-kernel-lifecycle", "cap-push-deliver", "cap-connector-tools", "cap-template-connectors"];
9
9
  /** How long each source's reads may take before the answer marks it unavailable. */
10
10
  export declare const HEALTH_READ_TIMEOUT_MS = 3000;
11
11
  /** A live replica as the overview shows it. */
@@ -104,7 +104,7 @@ export declare class AdminHealthService {
104
104
  private readonly log;
105
105
  private readonly providers;
106
106
  private readonly queues;
107
- constructor(presence: Pick<ReplicaPresence, "live">, db: KernelDb, redis: Pick<Redis, "zcount" | "status">, log: Pick<KernelLogger, "warn">, providers: Pick<DeviceProviders, "forDevice">, runs: Queue, subagentRuns: Queue, channels: Queue, maintenance: Queue, pluginScope: Queue, titles: Queue, suggestions: Queue, usageReport: Queue, evals: Queue, lifecycle: Queue, push: Queue);
107
+ constructor(presence: Pick<ReplicaPresence, "live">, db: KernelDb, redis: Pick<Redis, "zcount" | "status">, log: Pick<KernelLogger, "warn">, providers: Pick<DeviceProviders, "forDevice">, runs: Queue, subagentRuns: Queue, channels: Queue, maintenance: Queue, pluginScope: Queue, titles: Queue, suggestions: Queue, usageReport: Queue, evals: Queue, lifecycle: Queue, push: Queue, connectorTools: Queue, templateConnectors: Queue);
108
108
  read(): Promise<AdminHealth>;
109
109
  private readRedis;
110
110
  private readDb;
@@ -11,6 +11,7 @@ import { getQueueToken } from "@nestjs/bullmq";
11
11
  import { Inject, Injectable } from "@nestjs/common";
12
12
  import { sql } from "kysely";
13
13
  import { PLUGIN_SCOPE_QUEUE } from "../catalog/scope-sync.js";
14
+ import { TEMPLATE_CONNECTORS_QUEUE } from "../catalog/template-connector-jobs.js";
14
15
  import { CHANNEL_QUEUE_NAME } from "../channels/jobs.js";
15
16
  import { PROMPT_SUGGESTION_QUEUE } from "../conversations/prompt-suggestions.js";
16
17
  import { TITLE_QUEUE } from "../conversations/titles.js";
@@ -24,6 +25,7 @@ import { MAINTENANCE_QUEUE_NAME } from "../runtime/maintenance-queue.js";
24
25
  import { RUN_QUEUE_NAME, SUBAGENT_RUN_QUEUE_NAME } from "../runtime/run-jobs.js";
25
26
  import { USAGE_REPORT_QUEUE } from "../runtime/usage-report-jobs.js";
26
27
  import { DeviceProviders, servesDialIn } from "../sandbox/providers.js";
28
+ import { CONNECTOR_TOOLS_QUEUE } from "../tools/connector-tools-jobs.js";
27
29
  import { KERNEL_VERSION } from "../version.js";
28
30
  /** The kernel's own queues, in the order the overview lists them (extension queues are not read). */
29
31
  export const KERNEL_QUEUE_NAMES = [
@@ -38,6 +40,8 @@ export const KERNEL_QUEUE_NAMES = [
38
40
  EVAL_QUEUE_NAME,
39
41
  LIFECYCLE_QUEUE,
40
42
  PUSH_QUEUE,
43
+ CONNECTOR_TOOLS_QUEUE,
44
+ TEMPLATE_CONNECTORS_QUEUE,
41
45
  ];
42
46
  /** How long each source's reads may take before the answer marks it unavailable. */
43
47
  export const HEALTH_READ_TIMEOUT_MS = 3_000;
@@ -66,7 +70,7 @@ let AdminHealthService = class AdminHealthService {
66
70
  log;
67
71
  providers;
68
72
  queues;
69
- constructor(presence, db, redis, log, providers, runs, subagentRuns, channels, maintenance, pluginScope, titles, suggestions, usageReport, evals, lifecycle, push) {
73
+ constructor(presence, db, redis, log, providers, runs, subagentRuns, channels, maintenance, pluginScope, titles, suggestions, usageReport, evals, lifecycle, push, connectorTools, templateConnectors) {
70
74
  this.presence = presence;
71
75
  this.db = db;
72
76
  this.redis = redis;
@@ -85,6 +89,8 @@ let AdminHealthService = class AdminHealthService {
85
89
  evals,
86
90
  lifecycle,
87
91
  push,
92
+ connectorTools,
93
+ templateConnectors,
88
94
  ];
89
95
  }
90
96
  async read() {
@@ -269,6 +275,8 @@ AdminHealthService = __decorate([
269
275
  __param(12, Inject(getQueueToken(USAGE_REPORT_QUEUE))),
270
276
  __param(13, Inject(getQueueToken(EVAL_QUEUE_NAME))),
271
277
  __param(14, Inject(getQueueToken(LIFECYCLE_QUEUE))),
272
- __param(15, Inject(getQueueToken(PUSH_QUEUE)))
278
+ __param(15, Inject(getQueueToken(PUSH_QUEUE))),
279
+ __param(16, Inject(getQueueToken(CONNECTOR_TOOLS_QUEUE))),
280
+ __param(17, Inject(getQueueToken(TEMPLATE_CONNECTORS_QUEUE)))
273
281
  ], AdminHealthService);
274
282
  export { AdminHealthService };
@@ -228,7 +228,8 @@ export declare class AdminCatalogController {
228
228
  * What updating the platform plugin to `version` would do (spec §7.1, `PlatformPluginUpdater`):
229
229
  * `{ itemId, name, from, to, components: [{ kind, id, name, change: added | removed | upgrade |
230
230
  * downgrade | same, from, to, updatedOnOwn, ownScope, pinnedOrgs, kept? }], extension,
231
- * connectorOrgs: [{ orgId, connectors, needsConfig }], diffHash }`. Nothing written. The same
231
+ * connectorOrgs: [{ orgId, connectors, created, turnedOff? }], scopeInstalls, diffHash }`.
232
+ * Nothing written. The same
232
233
  * version, a target the deployment's extension or a dependent plugin cannot take -> 409
233
234
  * `plugin.upgrade_target_invalid`; an added skill named like one in use where the plugin is on
234
235
  * -> 409 `plugin.skill_conflict`; disabled -> 403 `catalog.item_disabled`.
@@ -346,7 +346,8 @@ let AdminCatalogController = class AdminCatalogController {
346
346
  * What updating the platform plugin to `version` would do (spec §7.1, `PlatformPluginUpdater`):
347
347
  * `{ itemId, name, from, to, components: [{ kind, id, name, change: added | removed | upgrade |
348
348
  * downgrade | same, from, to, updatedOnOwn, ownScope, pinnedOrgs, kept? }], extension,
349
- * connectorOrgs: [{ orgId, connectors, needsConfig }], diffHash }`. Nothing written. The same
349
+ * connectorOrgs: [{ orgId, connectors, created, turnedOff? }], scopeInstalls, diffHash }`.
350
+ * Nothing written. The same
350
351
  * version, a target the deployment's extension or a dependent plugin cannot take -> 409
351
352
  * `plugin.upgrade_target_invalid`; an added skill named like one in use where the plugin is on
352
353
  * -> 409 `plugin.skill_conflict`; disabled -> 403 `catalog.item_disabled`.
@@ -23,9 +23,9 @@ export interface OrgCatalogItem extends Omit<CatalogItemView, "installs" | "mark
23
23
  /** Shipped with the deployment (a required bootstrap plugin): on in every org, never switchable. */
24
24
  builtin: boolean;
25
25
  /**
26
- * The effective state in this org: `on`, `off`, `needs_config` (installed with an on connector
27
- * template that has no connector here, ruling P2-10; or wanted but not installed, and the
28
- * install needs inputs), `unavailable` (disabled by the super admin, members don't see it; or
26
+ * The effective state in this org: `on`, `off`, `needs_config` (the plugin's extension has no
27
+ * valid effective config for the org, installed or wanted; connector setup shows on the
28
+ * connectors, plugin pages spec §5.2.3), `unavailable` (disabled by the super admin, members don't see it; or
29
29
  * not installed here and its extension cannot run on the deployment, see `reason`) or
30
30
  * `not_offered` (a `named` item shown to orgs outside its list: requestable, not usable).
31
31
  */
@@ -89,8 +89,7 @@ export interface OrgCatalogTemplate {
89
89
  on: boolean;
90
90
  /**
91
91
  * The org already has a live connector made from this template (a switch-off kept it because an
92
- * agent uses it): the install takes that connector back instead of creating one, so it does not
93
- * ask for the template's input.
92
+ * agent uses it): the install takes that connector back instead of creating one.
94
93
  */
95
94
  connected: boolean;
96
95
  /**
@@ -128,12 +127,6 @@ export interface OrgCatalogDetail {
128
127
  skills: string[];
129
128
  /** The agent template files (`agents/<name>.md`, sub-agents spec §16). */
130
129
  agents: string[];
131
- /**
132
- * An installed plugin whose connector templates on in the org miss a connector there
133
- * (`needs_config`, ruling P2-10): those templates, for `POST …/catalog/:itemId/connectors`;
134
- * empty otherwise (Task 10).
135
- */
136
- missingTemplates: OrgCatalogTemplate[];
137
130
  }
138
131
  /**
139
132
  * A connector template as an org sees it (the install wizard and the upgrade preview's inputs):
@@ -209,10 +202,7 @@ export declare function requiredActions(m: PluginManifest): OrgAction[];
209
202
  * lock only.
210
203
  */
211
204
  export declare function lockOrgForActions(orgLock: Pick<OrgLock, "lock" | "lockAndAuthorize">, orgId: string, actor: string | null, actions: OrgAction[]): Promise<void>;
212
- /** The value at a dot path of `v` (own keys only), undefined when absent. */
213
- export declare function getPath(v: unknown, path: string): unknown;
214
- /** Sets the value at a dot path of `obj`, creating the objects on the way. */
215
- export declare function setPath(obj: Record<string, unknown>, path: string, value: unknown): void;
205
+ export { getPath, setPath } from "../tools/editable-endpoint.js";
216
206
  /** The connector `kind` provided by extension `plugin` loaded on this replica (from the registry). */
217
207
  export declare function findConnectorIn(registry: Pick<ExtensionRegistry, "list">, plugin: string, kind: string): Connector | undefined;
218
208
  /** What checking a template's connector extension needs. */
@@ -8,6 +8,7 @@ import { ApiError } from "../errors.js";
8
8
  import { can } from "../orgs/roles.js";
9
9
  import { packagePath } from "../packages/tgz.js";
10
10
  import { checkSkillFiles, SkillArchiveError } from "../skills/package.js";
11
+ import { mergeEditableEndpoint } from "../tools/editable-endpoint.js";
11
12
  import { readDisplayFiles } from "./catalog-files.js";
12
13
  import { iconProblem, pluginThemeError, themeApiError } from "./plugin-package.js";
13
14
  import { templateDescriptionText } from "./template-description.js";
@@ -160,41 +161,7 @@ export async function lockOrgForActions(orgLock, orgId, actor, actions) {
160
161
  throw new ApiError("forbidden", "Insufficient organization role");
161
162
  }
162
163
  }
163
- const isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
164
- const UNSAFE_KEYS = new Set(["__proto__", "prototype", "constructor"]);
165
- /** 对象的全部叶子点路径(数组与非对象值算叶子)。 */
166
- function leafPaths(v, base = "") {
167
- const out = [];
168
- for (const [k, x] of Object.entries(v)) {
169
- const p = base ? `${base}.${k}` : k;
170
- if (isObj(x) && Object.keys(x).length > 0)
171
- out.push(...leafPaths(x, p));
172
- else
173
- out.push(p);
174
- }
175
- return out;
176
- }
177
- /** The value at a dot path of `v` (own keys only), undefined when absent. */
178
- export function getPath(v, path) {
179
- let node = v;
180
- for (const seg of path.split(".")) {
181
- if (!isObj(node) || !Object.hasOwn(node, seg))
182
- return undefined;
183
- node = node[seg];
184
- }
185
- return node;
186
- }
187
- /** Sets the value at a dot path of `obj`, creating the objects on the way. */
188
- export function setPath(obj, path, value) {
189
- const segs = path.split(".");
190
- let node = obj;
191
- for (const seg of segs.slice(0, -1)) {
192
- if (!isObj(node[seg]))
193
- node[seg] = {};
194
- node = node[seg];
195
- }
196
- node[segs[segs.length - 1]] = value;
197
- }
164
+ export { getPath, setPath } from "../tools/editable-endpoint.js";
198
165
  /** The connector `kind` provided by extension `plugin` loaded on this replica (from the registry). */
199
166
  export function findConnectorIn(registry, plugin, kind) {
200
167
  return registry
@@ -231,27 +198,9 @@ export function templateConnectorInput(deps, template, ref, input, defaultName,
231
198
  if (problem !== undefined)
232
199
  throw new ApiError("catalog.not_deployed", problem);
233
200
  const given = input ?? {};
234
- const editable = template.editableEndpoint ?? [];
235
- const endpoint = structuredClone(template.endpoint);
236
- if (given.endpoint !== undefined) {
237
- if (!isObj(given.endpoint))
238
- throw fail(`${at}.endpoint`, "Expected an object");
239
- for (const p of leafPaths(given.endpoint)) {
240
- const segs = p.split(".");
241
- if (segs.some((s) => UNSAFE_KEYS.has(s))) {
242
- throw fail(`${at}.endpoint.${p}`, "Invalid key");
243
- }
244
- const allowed = editable.some((e) => p === e || p.startsWith(`${e}.`));
245
- if (!allowed) {
246
- throw fail(`${at}.endpoint.${p}`, "This endpoint field is set by the template and cannot be changed");
247
- }
248
- }
249
- for (const e of editable) {
250
- const v = getPath(given.endpoint, e);
251
- if (v !== undefined)
252
- setPath(endpoint, e, v);
253
- }
254
- }
201
+ const endpoint = given.endpoint === undefined
202
+ ? structuredClone(template.endpoint)
203
+ : mergeEditableEndpoint(template.endpoint, template.editableEndpoint ?? [], given.endpoint, at).endpoint;
255
204
  const auth = template.auth;
256
205
  const oauth = auth.type === "oauth_code" || auth.type === "oauth_client";
257
206
  if (oauth && given.credential !== undefined) {
@@ -22,9 +22,9 @@ import { PluginScopeSync } from "./scope-sync.js";
22
22
  * What a scope change or a deployment-level disable would take away (spec §5 rule 8): the orgs
23
23
  * that have the plugin on now (a live install) and would no longer want it, each with its agents
24
24
  * that use the plugin's skills, connectors or agent templates and the number of connectors it
25
- * created there, which stay as the org's own; and the orgs that would newly want
26
- * it but need inputs first (connector templates, a required org config), which the sync leaves as
27
- * `needs_config`. `scopeHash` is confirmed with the change.
25
+ * created there, which stay as the org's own; and the orgs that would newly want it where its
26
+ * extension has no valid config for the org: the sync installs it there too and it shows
27
+ * `needs_config` until the org's config is set. `scopeHash` is confirmed with the change.
28
28
  */
29
29
  export interface ScopePreview {
30
30
  affected: {
@@ -1034,7 +1034,7 @@ let CatalogScopeService = class CatalogScopeService {
1034
1034
  continue;
1035
1035
  let needs = false;
1036
1036
  try {
1037
- needs = await this.sync.needsInput(org.id, item.id, item.latest_version);
1037
+ needs = await this.sync.needsConfig(org.id, item.id, item.latest_version);
1038
1038
  }
1039
1039
  catch (e) {
1040
1040
  // Not installable as it is (a dependency unresolved): the sync reports it. Anything else
@@ -1042,10 +1042,11 @@ let CatalogScopeService = class CatalogScopeService {
1042
1042
  if (!(e instanceof ApiError))
1043
1043
  throw e;
1044
1044
  }
1045
+ // the sync installs it either way (no install asks for input, plugin pages spec §5.2.2);
1046
+ // `needsConfig` names the orgs where its extension waits for the org's config
1045
1047
  if (needs)
1046
1048
  needsConfig.push(org.id);
1047
- else
1048
- onAfter.add(org.id);
1049
+ onAfter.add(org.id);
1049
1050
  }
1050
1051
  const { replaced, conflicts, themesLost } = await this.componentChanges(item, target, orgs, onAfter, affected);
1051
1052
  const themes = await themesPreview(db, themesLost);
@@ -5,7 +5,9 @@ export { CatalogImportModule };
5
5
  * with their dependencies, the platform plugin update (`PlatformPluginUpdater`) and the update to a
6
6
  * staged version (`PlatformImportUpdate`), the admin's scope
7
7
  * and disable
8
- * (`CatalogScopeService`), org admins' plugin uploads (`OrgPluginUploads`) and their own plugins (`OwnedItems`), and the producer of the plugin scope sync
8
+ * (`CatalogScopeService`), org admins' plugin uploads (`OrgPluginUploads`) and their own plugins (`OwnedItems`), the startup
9
+ * reconciliation of template connectors (`TemplateConnectorReconciler`) and the ensure it shares
10
+ * with the queued job (`TemplateConnectorEnsurer`), and the producer of the plugin scope sync
9
11
  * (`PluginScopeSync`; its consumer is the worker role's `PluginScopeWorkersModule`). The catalog's periodic jobs (`CatalogJobs`) are
10
12
  * the worker role's (`WorkerModule`).
11
13
  */
@@ -26,6 +26,9 @@ import { PluginInstaller } from "./plugin-install.js";
26
26
  import { PlatformPluginUpdater } from "./plugin-upgrade.js";
27
27
  import { CatalogRequestsService } from "./requests.service.js";
28
28
  import { PLUGIN_SCOPE_QUEUE, PluginScopeSync } from "./scope-sync.js";
29
+ import { TemplateConnectorEnsurer } from "./template-connector-ensure.js";
30
+ import { TemplateConnectorsQueueModule } from "./template-connector-jobs.js";
31
+ import { TemplateConnectorReconciler } from "./template-connector-reconcile.js";
29
32
  export { CatalogImportModule };
30
33
  /** The plugin scope sync's queue registration (re-exported: the admin health reads its counts). */
31
34
  const PLUGIN_SCOPE_QUEUE_MODULE = QueueModule.registerQueue(PLUGIN_SCOPE_QUEUE);
@@ -36,7 +39,9 @@ const MAINTENANCE_QUEUE_MODULE = QueueModule.registerQueue(MAINTENANCE_QUEUE_NAM
36
39
  * with their dependencies, the platform plugin update (`PlatformPluginUpdater`) and the update to a
37
40
  * staged version (`PlatformImportUpdate`), the admin's scope
38
41
  * and disable
39
- * (`CatalogScopeService`), org admins' plugin uploads (`OrgPluginUploads`) and their own plugins (`OwnedItems`), and the producer of the plugin scope sync
42
+ * (`CatalogScopeService`), org admins' plugin uploads (`OrgPluginUploads`) and their own plugins (`OwnedItems`), the startup
43
+ * reconciliation of template connectors (`TemplateConnectorReconciler`) and the ensure it shares
44
+ * with the queued job (`TemplateConnectorEnsurer`), and the producer of the plugin scope sync
40
45
  * (`PluginScopeSync`; its consumer is the worker role's `PluginScopeWorkersModule`). The catalog's periodic jobs (`CatalogJobs`) are
41
46
  * the worker role's (`WorkerModule`).
42
47
  */
@@ -60,6 +65,9 @@ CatalogModule = __decorate([
60
65
  // the queue of a removed org plugin's owed cleanup job (`OwnedItems`, `CatalogScopeService`;
61
66
  // consumed by the worker role's `MaintenanceProcessor`)
62
67
  MAINTENANCE_QUEUE_MODULE,
68
+ // the template connector ensures owed by installs (`markInstalled`); consumed by the worker
69
+ // role's `TemplateConnectorsWorkersModule`
70
+ TemplateConnectorsQueueModule,
63
71
  ],
64
72
  providers: [
65
73
  CatalogRequestsService,
@@ -73,9 +81,12 @@ CatalogModule = __decorate([
73
81
  OrgPluginUploads,
74
82
  OwnedItems,
75
83
  PlatformImportUpdate,
84
+ TemplateConnectorEnsurer,
85
+ TemplateConnectorReconciler,
76
86
  ],
77
87
  exports: [
78
88
  PLUGIN_SCOPE_QUEUE_MODULE,
89
+ TemplateConnectorsQueueModule,
79
90
  MAINTENANCE_QUEUE_MODULE,
80
91
  CatalogImportModule,
81
92
  CatalogRequestsService,
@@ -89,6 +100,8 @@ CatalogModule = __decorate([
89
100
  OrgPluginUploads,
90
101
  OwnedItems,
91
102
  PlatformImportUpdate,
103
+ TemplateConnectorEnsurer,
104
+ TemplateConnectorReconciler,
92
105
  ],
93
106
  })
94
107
  ], CatalogModule);
@@ -11,6 +11,7 @@ import type { ActorOpts } from "./catalog.service.js";
11
11
  import { ComponentPromotion } from "./component-promotion.js";
12
12
  import { type ComponentKind } from "./component-state.js";
13
13
  import { type Owner } from "./ownership.js";
14
+ import { PluginInstaller } from "./plugin-install.js";
14
15
  import type { PluginScope } from "./scope.js";
15
16
  /**
16
17
  * What a component scope change, a component disable or a switch back to its plugin's scope would
@@ -246,13 +247,17 @@ export declare class ComponentScopeService {
246
247
  readonly txHost: TransactionHost;
247
248
  /** The connector templates' setup guides (the org list's `guide`). */
248
249
  private readonly guides;
250
+ /** A connector template switched on where its plugin is installed gets its connector. */
251
+ private readonly installer;
249
252
  constructor(kdb: KernelDb, adminLock: SuperAdminLock,
250
253
  /** The org row lock (orgs/org-lock.ts): joins the caller's transaction. */
251
254
  orgLock: OrgLock,
252
255
  /** Promote on share (ruling P3-3): an org row shown or associated becomes a platform row. */
253
256
  promotion: ComponentPromotion, txHost: TransactionHost,
254
257
  /** The connector templates' setup guides (the org list's `guide`). */
255
- guides: Pick<PluginGuides, "templateGuides">);
258
+ guides: Pick<PluginGuides, "templateGuides">,
259
+ /** A connector template switched on where its plugin is installed gets its connector. */
260
+ installer: PluginInstaller);
256
261
  private get db();
257
262
  /**
258
263
  * What the admin routes act on (ruling P3-23): the platform component `id`, an org row the org
@@ -26,6 +26,7 @@ import { assertOrgsExist } from "./catalog-items.js";
26
26
  import { ComponentPromotion, notOwnedError, PROMOTION_ATTEMPTS, PromotionStale, promotionStaleError, } from "./component-promotion.js";
27
27
  import { agentsUsing, COMPONENT_KINDS, componentLocked, componentOffered, componentOn, componentPluginOn, connectorsMadeFrom, listedIn, loadComponents, loadScopeState, pluginFactsOf, skillNameClashes, switchOf, themeIdClashes, } from "./component-state.js";
28
28
  import { assertOwnerListed, assertShareable, assertShareableTarget, newlySharedWith, ownerOf, ownersOf, } from "./ownership.js";
29
+ import { PluginInstaller } from "./plugin-install.js";
29
30
  const notFound = () => new ApiError("component.not_found", "Component not found");
30
31
  const staleError = () => new ApiError("plugin.scope_stale", "What this change affects has changed since the preview; preview it again and confirm the new hash");
31
32
  const builtinError = () => new ApiError("plugin.builtin", "This component belongs to a built-in plugin: it is on in every organization and its scope cannot be changed or disabled");
@@ -126,19 +127,23 @@ let ComponentScopeService = class ComponentScopeService {
126
127
  promotion;
127
128
  txHost;
128
129
  guides;
130
+ installer;
129
131
  constructor(kdb, adminLock,
130
132
  /** The org row lock (orgs/org-lock.ts): joins the caller's transaction. */
131
133
  orgLock,
132
134
  /** Promote on share (ruling P3-3): an org row shown or associated becomes a platform row. */
133
135
  promotion, txHost,
134
136
  /** The connector templates' setup guides (the org list's `guide`). */
135
- guides) {
137
+ guides,
138
+ /** A connector template switched on where its plugin is installed gets its connector. */
139
+ installer) {
136
140
  this.kdb = kdb;
137
141
  this.adminLock = adminLock;
138
142
  this.orgLock = orgLock;
139
143
  this.promotion = promotion;
140
144
  this.txHost = txHost;
141
145
  this.guides = guides;
146
+ this.installer = installer;
142
147
  }
143
148
  get db() {
144
149
  return this.kdb.db;
@@ -591,6 +596,14 @@ let ComponentScopeService = class ComponentScopeService {
591
596
  },
592
597
  });
593
598
  }
599
+ // A connector template switched on where its plugin is installed: its connector now, as an
600
+ // install would make it (plugin pages spec §5.2.2), in this transaction
601
+ if (kind === "connector_template" && body.enabled && componentOn(c, p, listed, true)) {
602
+ await this.installer.createSwitchedOnTemplateConnectorIn(orgId, actor, c.id, {
603
+ ...(actorTokenId !== undefined && { actorTokenId }),
604
+ ...(auditDetail !== undefined && { auditDetail }),
605
+ });
606
+ }
594
607
  return {
595
608
  kind: "done",
596
609
  component: {
@@ -1083,7 +1096,8 @@ ComponentScopeService = __decorate([
1083
1096
  __param(2, Inject(OrgLock)),
1084
1097
  __param(3, Inject(ComponentPromotion)),
1085
1098
  __param(4, Inject(TransactionHost)),
1086
- __param(5, Inject(PluginGuides))
1099
+ __param(5, Inject(PluginGuides)),
1100
+ __param(6, Inject(PluginInstaller))
1087
1101
  ], ComponentScopeService);
1088
1102
  export { ComponentScopeService };
1089
1103
  /** Whether `c` is the platform default theme `uiTheme` (locked on in every org, themes spec §7). */
@@ -10,6 +10,35 @@ export declare const MARKETPLACES_REFRESH_JOB = "catalogs-refresh";
10
10
  * staging rows and their object storage prefixes (`PluginImport.cleanupExpired`).
11
11
  */
12
12
  export declare const PLUGIN_STAGING_CLEANUP_JOB = "app-staging-cleanup";
13
+ /**
14
+ * The backstop sweep of template connectors (ruling R30; a `@LockedInterval`, once per tick across
15
+ * replicas, every {@link TEMPLATE_CONNECTORS_SWEEP_PERIOD_MS}): orgs with a template connector they
16
+ * never had whose connector kind is available now get the ensure (`TemplateConnectorEnsurer.sweep`).
17
+ */
18
+ export declare const TEMPLATE_CONNECTORS_SWEEP_JOB = "template-connectors-sweep";
19
+ /**
20
+ * Five minutes: the queued ensure retries for about ten minutes after an install or a switch-on,
21
+ * so the sweep only catches what outlives that (a kind loaded later, an always-on extension); a
22
+ * connector that waited that long can wait one more period, and the candidates query runs only
23
+ * twelve times an hour.
24
+ */
25
+ export declare const TEMPLATE_CONNECTORS_SWEEP_PERIOD_MS: number;
26
+ /** Orgs one sweep tick ensures at most (the rest follow on the next ticks). */
27
+ export declare const TEMPLATE_CONNECTORS_SWEEP_BATCH = 50;
28
+ /**
29
+ * The `deployment_settings` key holding the last org a sweep tick ensured: the next tick starts
30
+ * after it and wraps to the first candidate, so orgs where the ensure keeps creating nothing never
31
+ * starve the later ones (missing: it starts at the first org).
32
+ */
33
+ export declare const TEMPLATE_CONNECTORS_SWEEP_CURSOR_KEY = "templateConnectorsSweepCursor";
34
+ /**
35
+ * The lease key prefix marking a refusal already warned about (`<prefix><orgId>-<templateId>`,
36
+ * `LockService.lease`): a refusal repeated by later ensures (each sweep tick) is logged at debug,
37
+ * the first at warn.
38
+ */
39
+ export declare const TEMPLATE_CONNECTOR_REFUSAL_WARNED_PREFIX = "cap:kernel:template-connector-warned:";
40
+ /** How long a refusal stays warned about: a day, then it is warned about once more. */
41
+ export declare const TEMPLATE_CONNECTOR_REFUSAL_WARNED_TTL_MS = 86400000;
13
42
  /**
14
43
  * The one-off job that takes out the extension of a removed org-owned plugin (spec §14, P3-20,
15
44
  * P3-21; `OwnedPluginCleanup.run`), on `cap-kernel-maintenance`.
@@ -9,6 +9,35 @@ export const MARKETPLACES_REFRESH_JOB = "catalogs-refresh";
9
9
  * staging rows and their object storage prefixes (`PluginImport.cleanupExpired`).
10
10
  */
11
11
  export const PLUGIN_STAGING_CLEANUP_JOB = "app-staging-cleanup";
12
+ /**
13
+ * The backstop sweep of template connectors (ruling R30; a `@LockedInterval`, once per tick across
14
+ * replicas, every {@link TEMPLATE_CONNECTORS_SWEEP_PERIOD_MS}): orgs with a template connector they
15
+ * never had whose connector kind is available now get the ensure (`TemplateConnectorEnsurer.sweep`).
16
+ */
17
+ export const TEMPLATE_CONNECTORS_SWEEP_JOB = "template-connectors-sweep";
18
+ /**
19
+ * Five minutes: the queued ensure retries for about ten minutes after an install or a switch-on,
20
+ * so the sweep only catches what outlives that (a kind loaded later, an always-on extension); a
21
+ * connector that waited that long can wait one more period, and the candidates query runs only
22
+ * twelve times an hour.
23
+ */
24
+ export const TEMPLATE_CONNECTORS_SWEEP_PERIOD_MS = 5 * 60_000;
25
+ /** Orgs one sweep tick ensures at most (the rest follow on the next ticks). */
26
+ export const TEMPLATE_CONNECTORS_SWEEP_BATCH = 50;
27
+ /**
28
+ * The `deployment_settings` key holding the last org a sweep tick ensured: the next tick starts
29
+ * after it and wraps to the first candidate, so orgs where the ensure keeps creating nothing never
30
+ * starve the later ones (missing: it starts at the first org).
31
+ */
32
+ export const TEMPLATE_CONNECTORS_SWEEP_CURSOR_KEY = "templateConnectorsSweepCursor";
33
+ /**
34
+ * The lease key prefix marking a refusal already warned about (`<prefix><orgId>-<templateId>`,
35
+ * `LockService.lease`): a refusal repeated by later ensures (each sweep tick) is logged at debug,
36
+ * the first at warn.
37
+ */
38
+ export const TEMPLATE_CONNECTOR_REFUSAL_WARNED_PREFIX = "cap:kernel:template-connector-warned:";
39
+ /** How long a refusal stays warned about: a day, then it is warned about once more. */
40
+ export const TEMPLATE_CONNECTOR_REFUSAL_WARNED_TTL_MS = 86_400_000;
12
41
  /**
13
42
  * The one-off job that takes out the extension of a removed org-owned plugin (spec §14, P3-20,
14
43
  * P3-21; `OwnedPluginCleanup.run`), on `cap-kernel-maintenance`.
@@ -3,25 +3,34 @@ import { LockService } from "../infra/lock/lock.service.js";
3
3
  import type { KernelLogger } from "../log.js";
4
4
  import { MarketplacesService } from "./marketplaces.service.js";
5
5
  import { PluginImport } from "./plugin-import.js";
6
+ import { TemplateConnectorEnsurer } from "./template-connector-ensure.js";
6
7
  /**
7
8
  * The catalog's periodic jobs, each run once per tick across replicas: the marketplace refresh
8
9
  * (`catalogs-refresh`, every `marketplaces.refreshIntervalMinutes` and once after the start:
9
- * `@LockedInterval` with `runOnStart`) and the
10
- * hourly cleanup of expired plugin import staging (`app-staging-cleanup`: `@LockedCron`).
10
+ * `@LockedInterval` with `runOnStart`), the
11
+ * hourly cleanup of expired plugin import staging (`app-staging-cleanup`: `@LockedCron`) and the
12
+ * template connector sweep (`template-connectors-sweep`, every five minutes: `@LockedInterval`).
11
13
  */
12
14
  export declare class CatalogJobs {
13
15
  private readonly marketplaces;
14
16
  private readonly imports;
17
+ private readonly templateConnectors;
15
18
  readonly config: KernelConfigService;
16
19
  readonly lockService: LockService;
17
20
  readonly log: KernelLogger;
18
- constructor(marketplaces: MarketplacesService, imports: PluginImport, config: KernelConfigService, lockService: LockService, log: KernelLogger);
21
+ constructor(marketplaces: MarketplacesService, imports: PluginImport, templateConnectors: TemplateConnectorEnsurer, config: KernelConfigService, lockService: LockService, log: KernelLogger);
19
22
  /**
20
23
  * Refreshes every enabled marketplace in turn (overall deadline
21
24
  * {@link MARKETPLACES_REFRESH_DEADLINE_MS}; the job's signal aborts it: the stop, or the run
22
25
  * lock lost).
23
26
  */
24
27
  refreshMarketplaces(stop?: AbortSignal): Promise<void>;
28
+ /**
29
+ * The backstop for template connectors no event re-triggers (ruling R30): a bounded batch of
30
+ * orgs whose missing template connector's kind is available now. Runs outside any transaction;
31
+ * each connector is created in its own (`TemplateConnectorEnsurer`).
32
+ */
33
+ sweepTemplateConnectors(stop?: AbortSignal): Promise<void>;
25
34
  /** Deletes expired staging rows and their objects. */
26
35
  cleanupStaging(): Promise<void>;
27
36
  }
@@ -13,24 +13,28 @@ import { LockService } from "../infra/lock/lock.service.js";
13
13
  import { LockedCron } from "../infra/schedule/locked-cron.decorator.js";
14
14
  import { LockedInterval } from "../infra/schedule/locked-interval.js";
15
15
  import { KERNEL_LOGGER } from "../infra/tokens.js";
16
- import { MARKETPLACES_REFRESH_JOB, PLUGIN_STAGING_CLEANUP_JOB } from "./job-ids.js";
16
+ import { MARKETPLACES_REFRESH_JOB, PLUGIN_STAGING_CLEANUP_JOB, TEMPLATE_CONNECTORS_SWEEP_BATCH, TEMPLATE_CONNECTORS_SWEEP_JOB, TEMPLATE_CONNECTORS_SWEEP_PERIOD_MS, } from "./job-ids.js";
17
17
  import { MARKETPLACES_REFRESH_DEADLINE_MS, MarketplacesService } from "./marketplaces.service.js";
18
18
  import { PluginImport } from "./plugin-import.js";
19
+ import { TemplateConnectorEnsurer } from "./template-connector-ensure.js";
19
20
  /**
20
21
  * The catalog's periodic jobs, each run once per tick across replicas: the marketplace refresh
21
22
  * (`catalogs-refresh`, every `marketplaces.refreshIntervalMinutes` and once after the start:
22
- * `@LockedInterval` with `runOnStart`) and the
23
- * hourly cleanup of expired plugin import staging (`app-staging-cleanup`: `@LockedCron`).
23
+ * `@LockedInterval` with `runOnStart`), the
24
+ * hourly cleanup of expired plugin import staging (`app-staging-cleanup`: `@LockedCron`) and the
25
+ * template connector sweep (`template-connectors-sweep`, every five minutes: `@LockedInterval`).
24
26
  */
25
27
  let CatalogJobs = class CatalogJobs {
26
28
  marketplaces;
27
29
  imports;
30
+ templateConnectors;
28
31
  config;
29
32
  lockService;
30
33
  log;
31
- constructor(marketplaces, imports, config, lockService, log) {
34
+ constructor(marketplaces, imports, templateConnectors, config, lockService, log) {
32
35
  this.marketplaces = marketplaces;
33
36
  this.imports = imports;
37
+ this.templateConnectors = templateConnectors;
34
38
  this.config = config;
35
39
  this.lockService = lockService;
36
40
  this.log = log;
@@ -44,6 +48,19 @@ let CatalogJobs = class CatalogJobs {
44
48
  const deadline = AbortSignal.timeout(MARKETPLACES_REFRESH_DEADLINE_MS);
45
49
  await this.marketplaces.refreshAll(stop ? AbortSignal.any([deadline, stop]) : deadline);
46
50
  }
51
+ /**
52
+ * The backstop for template connectors no event re-triggers (ruling R30): a bounded batch of
53
+ * orgs whose missing template connector's kind is available now. Runs outside any transaction;
54
+ * each connector is created in its own (`TemplateConnectorEnsurer`).
55
+ */
56
+ async sweepTemplateConnectors(stop) {
57
+ const r = await this.templateConnectors.sweep({
58
+ limit: TEMPLATE_CONNECTORS_SWEEP_BATCH,
59
+ ...(stop !== undefined && { signal: stop }),
60
+ });
61
+ if (r.created > 0)
62
+ this.log.info("template connector sweep created connectors", r);
63
+ }
47
64
  /** Deletes expired staging rows and their objects. */
48
65
  async cleanupStaging() {
49
66
  const n = await this.imports.cleanupExpired();
@@ -56,6 +73,9 @@ __decorate([
56
73
  // a fresh deployment's marketplaces are refreshed right after the start
57
74
  { runOnStart: true })
58
75
  ], CatalogJobs.prototype, "refreshMarketplaces", null);
76
+ __decorate([
77
+ LockedInterval(TEMPLATE_CONNECTORS_SWEEP_JOB, () => TEMPLATE_CONNECTORS_SWEEP_PERIOD_MS)
78
+ ], CatalogJobs.prototype, "sweepTemplateConnectors", null);
59
79
  __decorate([
60
80
  LockedCron("0 * * * *", { name: PLUGIN_STAGING_CLEANUP_JOB })
61
81
  ], CatalogJobs.prototype, "cleanupStaging", null);
@@ -63,8 +83,9 @@ CatalogJobs = __decorate([
63
83
  Injectable(),
64
84
  __param(0, Inject(MarketplacesService)),
65
85
  __param(1, Inject(PluginImport)),
66
- __param(2, Inject(KernelConfigService)),
67
- __param(3, Inject(LockService)),
68
- __param(4, Inject(KERNEL_LOGGER))
86
+ __param(2, Inject(TemplateConnectorEnsurer)),
87
+ __param(3, Inject(KernelConfigService)),
88
+ __param(4, Inject(LockService)),
89
+ __param(5, Inject(KERNEL_LOGGER))
69
90
  ], CatalogJobs);
70
91
  export { CatalogJobs };
@@ -208,7 +208,7 @@ export declare function headsToResolve(entries: readonly MarketplaceEntry[], imp
208
208
  /** The host versions (an entry's `minKernel` is judged against them). */
209
209
  export declare const HOST_VERSIONS: {
210
210
  readonly kernel: string;
211
- readonly sdk: "0.1.0-rc.69";
211
+ readonly sdk: "0.1.0-rc.70";
212
212
  };
213
213
  /** Whether this deployment satisfies the entry's `minKernel`. */
214
214
  export declare const entryCompatible: (e: Pick<MarketplaceEntry, "minKernel">) => boolean;