@capybara-hq/kernel 0.1.0-rc.77 → 0.1.0-rc.78
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 +6 -6
- package/dist/admin/outbox-dead.service.js +4 -1
- package/dist/agents/admin-agents.js +2 -0
- package/dist/agents/agent-lookup.js +4 -0
- package/dist/agents/agent-profile.service.js +3 -0
- package/dist/agents/agents.service.js +7 -0
- package/dist/agents/org-templates.js +1 -0
- package/dist/agents/pending-connector-requests.js +6 -0
- package/dist/agents/pending-connectors.service.js +2 -0
- package/dist/agents/readiness.service.d.ts +9 -3
- package/dist/agents/readiness.service.js +3 -3
- package/dist/agents/templates.js +1 -0
- package/dist/background/finish.js +3 -0
- package/dist/background/stop.js +2 -0
- package/dist/background/store.js +44 -0
- package/dist/background/tasks.service.js +3 -2
- package/dist/background/wake-rules.js +1 -0
- package/dist/catalog/admin-catalog.controller.d.ts +6 -0
- package/dist/catalog/admin-catalog.controller.js +13 -0
- package/dist/catalog/catalog-content.d.ts +6 -0
- package/dist/catalog/catalog-content.js +1 -0
- package/dist/catalog/catalog-items.js +4 -0
- package/dist/catalog/catalog-scope.service.js +4 -1
- package/dist/catalog/component-promotion.js +2 -0
- package/dist/catalog/component-scope.controller.d.ts +9 -15
- package/dist/catalog/component-scope.controller.js +14 -9
- package/dist/catalog/component-scope.service.js +5 -0
- package/dist/catalog/component-state.js +2 -0
- package/dist/catalog/marketplaces.service.d.ts +6 -1
- package/dist/catalog/marketplaces.service.js +8 -3
- package/dist/catalog/org-catalog.controller.d.ts +9 -0
- package/dist/catalog/org-catalog.controller.js +18 -0
- package/dist/catalog/org-catalog.schemas.d.ts +2 -4
- package/dist/catalog/org-catalog.schemas.js +2 -3
- package/dist/catalog/org-catalog.service.d.ts +10 -1
- package/dist/catalog/org-catalog.service.js +34 -23
- package/dist/catalog/org-extension-switch.d.ts +3 -10
- package/dist/catalog/org-extension-switch.js +14 -60
- package/dist/catalog/org-extension.controller.d.ts +6 -7
- package/dist/catalog/org-extension.controller.js +4 -4
- package/dist/catalog/org-extension.schemas.d.ts +1 -2
- package/dist/catalog/org-extension.schemas.js +1 -3
- package/dist/catalog/owned-items.js +10 -1
- package/dist/catalog/ownership.js +2 -0
- package/dist/catalog/plugin-import.js +8 -0
- package/dist/catalog/plugin-install.d.ts +1 -4
- package/dist/catalog/plugin-install.js +11 -12
- package/dist/catalog/plugin-upgrade.js +4 -1
- package/dist/catalog/request-rules.js +6 -0
- package/dist/catalog/requests.service.js +4 -0
- package/dist/catalog/scope-orgs.js +1 -0
- package/dist/catalog/scope-sync.d.ts +8 -5
- package/dist/catalog/scope-sync.js +21 -23
- package/dist/catalog/unshare.js +3 -0
- package/dist/channels/connections.service.js +1 -0
- package/dist/channels/inbound.js +1 -0
- package/dist/channels/jobs.js +1 -0
- package/dist/channels/outbound.js +6 -0
- package/dist/channels/supervisor.js +1 -0
- package/dist/channels/threads.js +1 -0
- package/dist/client/client-reports.service.js +1 -0
- package/dist/config/fields.js +20 -4
- package/dist/conversations/access.js +1 -0
- package/dist/conversations/attachments.service.js +16 -4
- package/dist/conversations/conversations.service.js +17 -3
- package/dist/conversations/event-log.js +2 -0
- package/dist/conversations/events.d.ts +1 -0
- package/dist/conversations/events.js +3 -1
- package/dist/conversations/files.js +3 -2
- package/dist/conversations/permission-profiles.service.js +1 -0
- package/dist/conversations/prompt-suggestions.js +2 -0
- package/dist/conversations/queue.js +8 -0
- package/dist/conversations/queue.service.js +6 -2
- package/dist/conversations/source.js +2 -0
- package/dist/conversations/titles.js +10 -2
- package/dist/conversations/tree.js +6 -0
- package/dist/db/kernel-schema.d.ts +3 -1
- package/dist/devices/conversation-devices.js +3 -0
- package/dist/devices/device-projects.service.js +2 -0
- package/dist/devices/devices.service.js +5 -0
- package/dist/devices/legacy-cleanup.job.js +5 -2
- package/dist/dial-in/handlers.js +2 -0
- package/dist/dial-in/machines.js +11 -2
- package/dist/dial-in/targets.d.ts +0 -2
- package/dist/dial-in/targets.js +0 -10
- package/dist/errors.d.ts +0 -1
- package/dist/errors.js +0 -1
- package/dist/evals/budget.js +14 -1
- package/dist/evals/run-replay.js +4 -0
- package/dist/evals/runs.service.js +13 -7
- package/dist/evals/sets.service.js +23 -8
- package/dist/evals/trajectory.service.d.ts +1 -1
- package/dist/evals/trajectory.service.js +1 -0
- package/dist/evals/worker.js +5 -1
- package/dist/extensions/admin-ops.js +1 -0
- package/dist/extensions/admin-view.js +3 -1
- package/dist/extensions/bootstrap-packages.d.ts +12 -1
- package/dist/extensions/bootstrap-packages.js +49 -9
- package/dist/extensions/bootstrap.d.ts +17 -2
- package/dist/extensions/bootstrap.js +41 -9
- package/dist/extensions/config-json-schema.d.ts +2 -2
- package/dist/extensions/config-json-schema.js +1 -3
- package/dist/extensions/deployment-config.d.ts +5 -3
- package/dist/extensions/deployment-config.js +3 -3
- package/dist/extensions/effective-config.d.ts +8 -7
- package/dist/extensions/effective-config.js +8 -7
- package/dist/extensions/enabled.js +1 -0
- package/dist/extensions/host.d.ts +4 -3
- package/dist/extensions/host.js +11 -12
- package/dist/extensions/instance.d.ts +1 -1
- package/dist/extensions/instance.js +17 -2
- package/dist/extensions/org-config.d.ts +35 -97
- package/dist/extensions/org-config.js +48 -315
- package/dist/extensions/org-levels.d.ts +22 -9
- package/dist/extensions/org-levels.js +100 -20
- package/dist/extensions/org-overrides.d.ts +14 -15
- package/dist/extensions/org-overrides.js +20 -20
- package/dist/extensions/package.js +1 -1
- package/dist/extensions/permission-set.d.ts +1 -3
- package/dist/extensions/permission-set.js +3 -7
- package/dist/extensions/permission-view.d.ts +3 -1
- package/dist/extensions/permission-view.js +5 -4
- package/dist/extensions/plugin-icons.d.ts +72 -1
- package/dist/extensions/plugin-icons.js +194 -2
- package/dist/extensions/point-defaults.d.ts +17 -18
- package/dist/extensions/point-defaults.js +25 -28
- package/dist/identity/accounts.js +6 -0
- package/dist/identity/api-tokens.js +8 -0
- package/dist/infra/outbox/outbox.dispatcher.js +4 -1
- package/dist/infra/outbox/outbox.service.js +2 -0
- package/dist/orgs/directory-sync.d.ts +9 -6
- package/dist/orgs/directory-sync.js +15 -12
- package/dist/orgs/invitations.service.js +2 -0
- package/dist/orgs/members.service.js +2 -0
- package/dist/orgs/offboarding.js +2 -0
- package/dist/packages/npm.d.ts +9 -1
- package/dist/packages/npm.js +37 -5
- package/dist/platform/exclusions.js +20 -0
- package/dist/platform/ops/admin-items.ops.js +1 -0
- package/dist/platform/ops/agents.ops.js +1 -0
- package/dist/platform/ops/extensions.ops.d.ts +6 -8
- package/dist/platform/ops/extensions.ops.js +18 -97
- package/dist/platform/ops/org-plugins.ops.d.ts +3 -6
- package/dist/platform/ops/org-plugins.ops.js +14 -65
- package/dist/platform/ops/outbox.ops.js +1 -0
- package/dist/platform/ops/person-inputs.d.ts +0 -4
- package/dist/platform/ops/person-inputs.js +0 -8
- package/dist/platform/ops/plugins.ops.d.ts +4 -1
- package/dist/platform/ops/plugins.ops.js +27 -34
- package/dist/platform/person-fields.d.ts +1 -1
- package/dist/platform/person-fields.js +1 -1
- package/dist/platform/sealed-reveals.js +2 -0
- package/dist/push/recipients.js +9 -2
- package/dist/runtime/permission-context.service.js +1 -0
- package/dist/runtime/plugin-context.service.js +1 -0
- package/dist/runtime/project/knowledge.service.js +1 -0
- package/dist/runtime/run-context.service.js +1 -0
- package/dist/runtime/run-deletion.js +4 -0
- package/dist/runtime/run-execution.js +2 -0
- package/dist/runtime/run-finish.js +3 -0
- package/dist/runtime/run-jobs.js +3 -0
- package/dist/runtime/run-orphan-check.job.js +7 -0
- package/dist/runtime/run-queue.js +21 -2
- package/dist/runtime/run-worker.js +5 -0
- package/dist/runtime/step-log.js +1 -0
- package/dist/runtime/subagents/child.js +2 -0
- package/dist/runtime/subagents/deliveries.js +3 -0
- package/dist/runtime/subagents/dispatch.js +5 -1
- package/dist/runtime/subagents/messages.js +2 -0
- package/dist/runtime/subagents/org-agents.d.ts +1 -1
- package/dist/runtime/subagents/org-agents.js +2 -1
- package/dist/runtime/usage-report-jobs.js +1 -0
- package/dist/runtime/usage-report.js +3 -0
- package/dist/runtime/waits.js +5 -0
- package/dist/sandbox/cloud-permission-snapshot.js +9 -3
- package/dist/sandbox/device-reports.js +3 -0
- package/dist/sandbox/legacy-retirement.js +5 -1
- package/dist/sandbox/managed-device-context.js +1 -0
- package/dist/sandbox/modes.d.ts +5 -2
- package/dist/sandbox/modes.js +8 -4
- package/dist/sandbox/network-grants.js +2 -0
- package/dist/sandbox/operation-intents.js +58 -0
- package/dist/sandbox/operation-reconcile.job.js +2 -0
- package/dist/sandbox/permission-authority-lock.js +12 -6
- package/dist/sandbox/permission-call-grants.js +6 -0
- package/dist/sandbox/permission-ceiling-writes.js +5 -0
- package/dist/sandbox/permission-config-publication.js +5 -0
- package/dist/sandbox/permission-instance-writes.js +4 -0
- package/dist/sandbox/permission-runtime-reports.js +10 -1
- package/dist/sandbox/permission-transitions.js +3 -0
- package/dist/sandbox/review/review.service.js +8 -5
- package/dist/sandbox/sandbox.service.d.ts +14 -0
- package/dist/sandbox/sandbox.service.js +195 -29
- package/dist/sandbox/unreachable.js +4 -1
- package/dist/schedules/fire.js +9 -3
- package/dist/schedules/pause.js +2 -0
- package/dist/schedules/run-tracker.js +16 -1
- package/dist/schedules/scheduled-tasks.service.js +4 -2
- package/dist/schedules/store.js +8 -0
- package/dist/schedules/unattended.js +4 -0
- package/dist/setup/setup-checks.service.d.ts +1 -10
- package/dist/setup/setup-checks.service.js +19 -29
- package/dist/shares/share-open.service.js +1 -0
- package/dist/shares/shares.service.js +2 -0
- package/dist/skills/agent-skills.service.d.ts +1 -1
- package/dist/skills/agent-skills.service.js +13 -2
- package/dist/skills/catalog.js +3 -0
- package/dist/skills/changes.service.js +10 -2
- package/dist/skills/conversation-catalog.js +1 -0
- package/dist/skills/skills.service.js +4 -0
- package/dist/tools/approvals.service.js +40 -0
- package/dist/tools/builtins/schedules.js +11 -6
- package/dist/tools/builtins/web/fetch.js +1 -1
- package/dist/tools/builtins/web/search.js +1 -1
- package/dist/tools/connector-account-policies.js +3 -0
- package/dist/tools/connectors.controller.d.ts +20 -8
- package/dist/tools/connectors.controller.js +30 -12
- package/dist/tools/connectors.service.d.ts +8 -0
- package/dist/tools/connectors.service.js +21 -1
- package/dist/tools/drift.js +5 -0
- package/dist/tools/git-push-policy.js +3 -0
- package/dist/tools/oauth/flow.js +1 -0
- package/dist/tools/outputs.js +2 -0
- package/dist/tools/permission-approval-jobs.js +3 -0
- package/dist/tools/pipeline.js +2 -0
- package/dist/tools/policy.js +3 -0
- package/dist/tools/questions.service.js +13 -0
- package/package.json +3 -3
|
@@ -89,8 +89,11 @@ class OrgGone extends Error {
|
|
|
89
89
|
/**
|
|
90
90
|
* 通讯录同步(`directory@1`):把企业通讯录同步为组织成员。框架无关。
|
|
91
91
|
*
|
|
92
|
-
* -
|
|
93
|
-
*
|
|
92
|
+
* - The maintenance queue's hourly `directory-scan` enqueues one sync per (org, extension) whose
|
|
93
|
+
* extension provides `directory@1`, is enabled in the org and has a valid effective config there
|
|
94
|
+
* (job ids deduplicated by hour bucket, so repeated scans on several replicas run once); manual
|
|
95
|
+
* triggers and `directory_changed` enqueue syncs too. Each call gets the org's own effective
|
|
96
|
+
* config (its copy of the overridable fields, or the platform's), never another org's.
|
|
94
97
|
* - One sync at a time per (org, extension): the `LockService` lock
|
|
95
98
|
* `lock:directory-sync:<org>:<plugin>`, renewed while held. A sync that finds the lock taken sets
|
|
96
99
|
* the dirty flag `capk:directory-sync-dirty:<org>:<plugin>` (1 hour) and ends; after releasing
|
|
@@ -165,9 +168,9 @@ let DirectorySync = class DirectorySync {
|
|
|
165
168
|
.find((e) => e.plugin === plugin && e.capability === DIRECTORY_EXTENSION_POINT)?.impl;
|
|
166
169
|
}
|
|
167
170
|
/**
|
|
168
|
-
* The org exists, the extension provides a directory
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
+
* The org exists, the extension provides a directory and is enabled in the org, and its effective
|
|
172
|
+
* deployment config for the org (the platform's, or this org's copy of the overridable fields;
|
|
173
|
+
* never another org's) is valid (layering spec A §6).
|
|
171
174
|
*/
|
|
172
175
|
async eligible(orgId, plugin) {
|
|
173
176
|
const directory = this.provider(plugin);
|
|
@@ -186,7 +189,7 @@ let DirectorySync = class DirectorySync {
|
|
|
186
189
|
cfg = await this.orgConfigs.get(orgId, plugin);
|
|
187
190
|
}
|
|
188
191
|
catch (err) {
|
|
189
|
-
this.log.warn("directory sync:
|
|
192
|
+
this.log.warn("directory sync: cannot read whether the extension is enabled", {
|
|
190
193
|
orgId,
|
|
191
194
|
plugin,
|
|
192
195
|
err,
|
|
@@ -209,7 +212,7 @@ let DirectorySync = class DirectorySync {
|
|
|
209
212
|
if (directory.configured !== undefined) {
|
|
210
213
|
let configured = false;
|
|
211
214
|
try {
|
|
212
|
-
configured = directory.configured(
|
|
215
|
+
configured = directory.configured(effective.config) === true;
|
|
213
216
|
}
|
|
214
217
|
catch {
|
|
215
218
|
configured = false;
|
|
@@ -217,7 +220,7 @@ let DirectorySync = class DirectorySync {
|
|
|
217
220
|
if (!configured)
|
|
218
221
|
return { ok: false, reason: "not_configured" };
|
|
219
222
|
}
|
|
220
|
-
return { ok: true, directory,
|
|
223
|
+
return { ok: true, directory, config: effective.config };
|
|
221
224
|
}
|
|
222
225
|
/**
|
|
223
226
|
* 投递一次 `directory_changed` 同步(按分钟桶去重);返回 job id。入站 `directory_changed` 经
|
|
@@ -252,7 +255,7 @@ let DirectorySync = class DirectorySync {
|
|
|
252
255
|
/**
|
|
253
256
|
* Manual trigger by an admin: re-checks `org.members.manage` live under the org row lock, then that
|
|
254
257
|
* the extension can sync (does not provide a directory -> `extension.not_found`, not enabled ->
|
|
255
|
-
* `extension.not_enabled`,
|
|
258
|
+
* `extension.not_enabled`, its state cannot be read -> `extension.config_invalid`, the extension says
|
|
256
259
|
* the directory is not configured -> `directory.not_configured`, Ruling A28; the effective config
|
|
257
260
|
* is not valid in the org -> `extension.needs_config`, layering spec A §6), and enqueues a sync
|
|
258
261
|
* job with a unique id.
|
|
@@ -346,7 +349,7 @@ let DirectorySync = class DirectorySync {
|
|
|
346
349
|
// 锁丢了(续租失败、过期后被他人取得):停止本轮,不再移除任何人
|
|
347
350
|
const signal = lease.lost;
|
|
348
351
|
try {
|
|
349
|
-
return await this.run(orgId, plugin, e.directory, e.
|
|
352
|
+
return await this.run(orgId, plugin, e.directory, e.config, signal, opts);
|
|
350
353
|
}
|
|
351
354
|
finally {
|
|
352
355
|
await lease.release().catch(() => { });
|
|
@@ -368,7 +371,7 @@ let DirectorySync = class DirectorySync {
|
|
|
368
371
|
this.log.warn("directory sync: cannot enqueue follow-up sync", { orgId, plugin, err });
|
|
369
372
|
}
|
|
370
373
|
}
|
|
371
|
-
async run(orgId, plugin, directory,
|
|
374
|
+
async run(orgId, plugin, directory, config, signal, opts) {
|
|
372
375
|
const source = `directory:${plugin}`;
|
|
373
376
|
const counts = { added: 0, removed: 0, skippedLastOwner: 0, failed: 0, total: 0 };
|
|
374
377
|
/** 本轮仍在职的账号(只在本次任务内使用)。 */
|
|
@@ -384,8 +387,8 @@ let DirectorySync = class DirectorySync {
|
|
|
384
387
|
}
|
|
385
388
|
signal.throwIfAborted();
|
|
386
389
|
const r = await directory.listMembers({
|
|
387
|
-
orgConfig,
|
|
388
390
|
config,
|
|
391
|
+
orgId,
|
|
389
392
|
...(cursor !== undefined && { cursor }),
|
|
390
393
|
signal: AbortSignal.any([signal, AbortSignal.timeout(DIRECTORY_PAGE_TIMEOUT_MS)]),
|
|
391
394
|
});
|
|
@@ -142,6 +142,7 @@ let InvitationsService = class InvitationsService {
|
|
|
142
142
|
.updateTable("invitations")
|
|
143
143
|
.set({ revoked_at: sql `now()` })
|
|
144
144
|
.where("id", "=", id)
|
|
145
|
+
.where("org_id", "=", orgId)
|
|
145
146
|
.execute();
|
|
146
147
|
await audit(this.db.db, {
|
|
147
148
|
actorAccountId,
|
|
@@ -186,6 +187,7 @@ let InvitationsService = class InvitationsService {
|
|
|
186
187
|
.updateTable("invitations")
|
|
187
188
|
.set({ accepted_at: sql `now()`, accepted_by: account.id })
|
|
188
189
|
.where("id", "=", inv.id)
|
|
190
|
+
.where("org_id", "=", inv.org_id)
|
|
189
191
|
.where("accepted_at", "is", null)
|
|
190
192
|
.where("revoked_at", "is", null)
|
|
191
193
|
.where(sql `expires_at > now()`)
|
|
@@ -21,6 +21,8 @@ import { OrgLock } from "./org-lock.js";
|
|
|
21
21
|
* 账号是不是某个组织的匿名访客(`org_anonymous_accounts`)。匿名访客没有登录方式,只能以 guest 身份
|
|
22
22
|
* 代表 IM 里未绑定的人:不能被授予别的角色、成为 owner、指派为 agent 负责人、加入别的组织或被移出。
|
|
23
23
|
*/
|
|
24
|
+
// org-filter: an anonymous guest account is one org's guest and can join no other org, so the
|
|
25
|
+
// question "is this account any org's anonymous guest" is account-wide by design
|
|
24
26
|
export async function isAnonymousGuest(db, accountId) {
|
|
25
27
|
const row = await db
|
|
26
28
|
.selectFrom("org_anonymous_accounts")
|
package/dist/orgs/offboarding.js
CHANGED
|
@@ -199,6 +199,7 @@ let Offboarding = class Offboarding {
|
|
|
199
199
|
.returning("id")
|
|
200
200
|
.execute()
|
|
201
201
|
: [];
|
|
202
|
+
// org-filter: removal revokes the person's personal tokens account-wide on purpose (comment above)
|
|
202
203
|
const tokens = revoke
|
|
203
204
|
? await this.db
|
|
204
205
|
.updateTable("api_tokens")
|
|
@@ -301,6 +302,7 @@ let Offboarding = class Offboarding {
|
|
|
301
302
|
.updateTable("conversations")
|
|
302
303
|
.set({ queue_paused: false, queue_pause_reason: null })
|
|
303
304
|
.where("id", "in", queueConversations)
|
|
305
|
+
.where("org_id", "=", orgId)
|
|
304
306
|
.execute();
|
|
305
307
|
}
|
|
306
308
|
const devices = await this.db
|
package/dist/packages/npm.d.ts
CHANGED
|
@@ -16,10 +16,18 @@ import { type LookupFn, type NetPolicy } from "../net/public-address.js";
|
|
|
16
16
|
* under `net.allowInsecureLoopback`), needs `expectedIntegrity`, and never gets the registry
|
|
17
17
|
* token unless it is on the registry's origin.
|
|
18
18
|
*/
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* A download or verification failed (the HTTP layer maps it to `packages.npm_failed`, 502). The
|
|
21
|
+
* message is English and never carries the token. `transient`: the failure may go away on its own
|
|
22
|
+
* (a network error such as a reset, a DNS failure, a timeout, HTTP 408 / 429 / 5xx, a body cut off
|
|
23
|
+
* while read), so a caller may retry; never set for a refused connection (nothing listens), a
|
|
24
|
+
* refusal by the network rules, another 4xx such as 404, bad metadata or a mismatch.
|
|
25
|
+
*/
|
|
20
26
|
export declare class NpmFetchError extends Error {
|
|
27
|
+
readonly transient: boolean;
|
|
21
28
|
constructor(message: string, options?: {
|
|
22
29
|
cause?: unknown;
|
|
30
|
+
transient?: boolean;
|
|
23
31
|
});
|
|
24
32
|
}
|
|
25
33
|
/** 下载内容与期望的 integrity 不符(`expected` / `actual` 为 `sha512-<base64>`)。 */
|
package/dist/packages/npm.js
CHANGED
|
@@ -20,11 +20,19 @@ import { safeFetch } from "../net/safe-fetch.js";
|
|
|
20
20
|
* under `net.allowInsecureLoopback`), needs `expectedIntegrity`, and never gets the registry
|
|
21
21
|
* token unless it is on the registry's origin.
|
|
22
22
|
*/
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* A download or verification failed (the HTTP layer maps it to `packages.npm_failed`, 502). The
|
|
25
|
+
* message is English and never carries the token. `transient`: the failure may go away on its own
|
|
26
|
+
* (a network error such as a reset, a DNS failure, a timeout, HTTP 408 / 429 / 5xx, a body cut off
|
|
27
|
+
* while read), so a caller may retry; never set for a refused connection (nothing listens), a
|
|
28
|
+
* refusal by the network rules, another 4xx such as 404, bad metadata or a mismatch.
|
|
29
|
+
*/
|
|
24
30
|
export class NpmFetchError extends Error {
|
|
31
|
+
transient;
|
|
25
32
|
constructor(message, options) {
|
|
26
33
|
super(message, options);
|
|
27
34
|
this.name = "NpmFetchError";
|
|
35
|
+
this.transient = options?.transient === true;
|
|
28
36
|
}
|
|
29
37
|
}
|
|
30
38
|
/** 下载内容与期望的 integrity 不符(`expected` / `actual` 为 `sha512-<base64>`)。 */
|
|
@@ -100,14 +108,38 @@ export async function npmGet(cfg, url, headers, signal, what) {
|
|
|
100
108
|
if (e instanceof NetDeniedError && e.code === "net.redirect") {
|
|
101
109
|
throw new NpmFetchError(`the ${what} responded with a redirect (${e.status}); redirects are not followed`, { cause: e });
|
|
102
110
|
}
|
|
103
|
-
|
|
111
|
+
// A refusal by the network rules stays a refusal (a DNS failure may be a passing one), and so
|
|
112
|
+
// does a refused connection: nothing listens there, a wrong URL or a registry that is down
|
|
113
|
+
const transient = e instanceof NetDeniedError ? e.code === "net.dns_failed" : !hasErrorCode(e, "ECONNREFUSED");
|
|
114
|
+
throw new NpmFetchError(`cannot fetch the ${what}: ${errMsg(e)}`, { cause: e, transient });
|
|
104
115
|
}
|
|
105
116
|
if (!res.ok) {
|
|
106
117
|
await res.body?.cancel().catch(() => { });
|
|
107
|
-
|
|
118
|
+
const transient = res.status === 408 || res.status === 429 || res.status >= 500;
|
|
119
|
+
throw new NpmFetchError(`the ${what} responded with HTTP ${res.status}`, { transient });
|
|
108
120
|
}
|
|
109
121
|
return res;
|
|
110
122
|
}
|
|
123
|
+
/** Whether `e`, its `cause` chain or an `AggregateError`'s errors carry the system error `code`. */
|
|
124
|
+
function hasErrorCode(e, code, depth = 0) {
|
|
125
|
+
if (depth > 8 || typeof e !== "object" || e === null)
|
|
126
|
+
return false;
|
|
127
|
+
if (e.code === code)
|
|
128
|
+
return true;
|
|
129
|
+
const errors = e instanceof AggregateError ? e.errors : [];
|
|
130
|
+
return [e.cause, ...errors].some((x) => hasErrorCode(x, code, depth + 1));
|
|
131
|
+
}
|
|
132
|
+
/** {@link readCapped}, with a body cut off while read as a transient {@link NpmFetchError}. */
|
|
133
|
+
async function readBody(res, max, onTooLarge, what) {
|
|
134
|
+
try {
|
|
135
|
+
return await readCapped(res, max, onTooLarge);
|
|
136
|
+
}
|
|
137
|
+
catch (e) {
|
|
138
|
+
if (e instanceof NpmFetchError || e instanceof PackageTooLargeError)
|
|
139
|
+
throw e;
|
|
140
|
+
throw new NpmFetchError(`cannot read the ${what}: ${errMsg(e)}`, { cause: e, transient: true });
|
|
141
|
+
}
|
|
142
|
+
}
|
|
111
143
|
/** `sha512-<base64>` 形式的 SRI;可能有空格分隔的多个,取其中的 sha512。 */
|
|
112
144
|
function sha512Of(integrity) {
|
|
113
145
|
for (const part of integrity.trim().split(/\s+/)) {
|
|
@@ -172,7 +204,7 @@ export async function fetchNpmPackage(cfg, name, version, signal, opts = {}) {
|
|
|
172
204
|
// scope 包名里的 `/` 按 npm 客户端的写法编码为 %2f
|
|
173
205
|
const docUrl = new URL(name.replace("/", "%2f"), registry);
|
|
174
206
|
const res = await npmGet(cfg, docUrl, { ...authHeaders, accept: "application/json" }, signal, "npm registry");
|
|
175
|
-
const raw = await
|
|
207
|
+
const raw = await readBody(res, MAX_METADATA_BYTES, () => new NpmFetchError("the npm package metadata is too large"), "npm package metadata");
|
|
176
208
|
let doc;
|
|
177
209
|
try {
|
|
178
210
|
doc = JSON.parse(raw.toString("utf8"));
|
|
@@ -219,7 +251,7 @@ export async function fetchNpmPackage(cfg, name, version, signal, opts = {}) {
|
|
|
219
251
|
resolved = picked;
|
|
220
252
|
}
|
|
221
253
|
const res = await npmGet(cfg, tarball, tarballHeaders, signal, "package tarball");
|
|
222
|
-
const bytes = await
|
|
254
|
+
const bytes = await readBody(res, cfg.maxBytes, tooLarge, "package tarball");
|
|
223
255
|
verify(bytes, integrity, opts.expectedIntegrity !== undefined ? "the expected integrity" : "the npm dist.integrity");
|
|
224
256
|
return {
|
|
225
257
|
bytes: new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength),
|
|
@@ -118,6 +118,11 @@ export const PLATFORM_EXCLUSIONS = [
|
|
|
118
118
|
category: "transport",
|
|
119
119
|
reason: "Serves icon image bytes",
|
|
120
120
|
},
|
|
121
|
+
{
|
|
122
|
+
route: "GET /api/v1/admin/catalog/connector-templates/:templateId/icon",
|
|
123
|
+
category: "transport",
|
|
124
|
+
reason: "Serves icon image bytes",
|
|
125
|
+
},
|
|
121
126
|
{
|
|
122
127
|
route: "GET /api/v1/admin/catalog/:itemId/guides/:guideId",
|
|
123
128
|
category: "internal",
|
|
@@ -151,6 +156,16 @@ export const PLATFORM_EXCLUSIONS = [
|
|
|
151
156
|
category: "transport",
|
|
152
157
|
reason: "Serves icon image bytes",
|
|
153
158
|
},
|
|
159
|
+
{
|
|
160
|
+
route: "GET /api/v1/orgs/:orgId/connector-templates/:templateId/icon",
|
|
161
|
+
category: "transport",
|
|
162
|
+
reason: "Serves icon image bytes",
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
route: "GET /api/v1/orgs/:orgId/connectors/:connectorId/icon",
|
|
166
|
+
category: "transport",
|
|
167
|
+
reason: "Serves icon image bytes",
|
|
168
|
+
},
|
|
154
169
|
{
|
|
155
170
|
route: "POST /api/v1/orgs/:orgId/catalog-requests/network",
|
|
156
171
|
category: "human-only",
|
|
@@ -497,6 +512,11 @@ export const PLATFORM_EXCLUSIONS = [
|
|
|
497
512
|
{ route: "GET /readyz", category: "transport", reason: "Readiness probe for the orchestrator" },
|
|
498
513
|
// models
|
|
499
514
|
// orgs
|
|
515
|
+
{
|
|
516
|
+
route: "PUT /api/v1/orgs/:orgId/extensions/:extension",
|
|
517
|
+
category: "internal",
|
|
518
|
+
reason: "The web's switch of an extension. For an extension shipped in one catalog plugin it is that plugin's switch, which plugins.set-enabled covers through the catalog switch route (with its uninstall preview). A direct-path extension (config-declared, or sourced from several catalog items) has no operation: an agent cannot switch it, a known gap (a required bootstrap plugin is on everywhere and has no switch); the org's config of any extension is its copy of the overridable fields (extensions.save-org-config)",
|
|
519
|
+
},
|
|
500
520
|
{
|
|
501
521
|
route: "POST /api/v1/orgs/:orgId/extensions/:extension/directory/sync",
|
|
502
522
|
category: "human-only",
|
|
@@ -127,6 +127,7 @@ let AdminItemsOperations = class AdminItemsOperations {
|
|
|
127
127
|
.selectFrom("conversations")
|
|
128
128
|
.select("agent_id")
|
|
129
129
|
.where("id", "=", rootId)
|
|
130
|
+
.where("org_id", "=", ctx.orgId)
|
|
130
131
|
.executeTakeFirst();
|
|
131
132
|
if (i.agentId === ctx.agentId || i.agentId === root?.agent_id) {
|
|
132
133
|
return {
|
|
@@ -609,6 +609,7 @@ let AgentsOperations = class AgentsOperations {
|
|
|
609
609
|
.selectFrom("conversations")
|
|
610
610
|
.select("agent_id")
|
|
611
611
|
.where("id", "=", rootId)
|
|
612
|
+
.where("org_id", "=", ctx.orgId)
|
|
612
613
|
.executeTakeFirst();
|
|
613
614
|
if (i.agentId === ctx.agentId || i.agentId === root?.agent_id) {
|
|
614
615
|
return {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type OnModuleInit } from "@nestjs/common";
|
|
2
|
-
import { OrgExtensionSwitch } from "../../catalog/org-extension-switch.js";
|
|
3
2
|
import { ExtensionDisplayNames } from "../../extensions/display-name.js";
|
|
4
3
|
import { OrgExtensionConfigs } from "../../extensions/org-config.js";
|
|
5
4
|
import { OrgOverrides, type OrgOverrideView } from "../../extensions/org-overrides.js";
|
|
@@ -9,16 +8,16 @@ import { OrgToolSwitches } from "../../tools/org-tool-switches.js";
|
|
|
9
8
|
import { type PersonFieldTarget } from "../person-fields.js";
|
|
10
9
|
import { PlatformOperations } from "../registry.js";
|
|
11
10
|
/**
|
|
12
|
-
* The person fields of the org's copy: the copy's own secrets (under
|
|
13
|
-
* set or not. A secret under
|
|
14
|
-
* for it in `values` is refused as well.
|
|
11
|
+
* The person fields of the org's copy: the copy's own secrets (under the listed overridable
|
|
12
|
+
* top-level fields), set or not. A secret under any other field is not the org's to set: never
|
|
13
|
+
* asked, and a value for it in `values` is refused as well.
|
|
15
14
|
*/
|
|
16
15
|
export declare function copyPersonFields(v: OrgOverrideView): Pick<PersonFieldTarget, "fields" | "recordOnly">;
|
|
17
16
|
/**
|
|
18
17
|
* Extension operations of the `Platform` tool (spec §7): the org's extensions (the member projection
|
|
19
18
|
* of `GET /orgs/:orgId/extensions`, whatever the actor's role), their tool switches and point
|
|
20
|
-
* defaults, and for org admins the org
|
|
21
|
-
*
|
|
19
|
+
* defaults, and for org admins the org's copy of overridable platform fields (read, take, save,
|
|
20
|
+
* drop; platform web parity spec §7.2). Secrets are never returned (only
|
|
22
21
|
* whether each is set) and never taken as params: the person enters them in a secure input request.
|
|
23
22
|
*/
|
|
24
23
|
export declare class ExtensionsOperations implements OnModuleInit {
|
|
@@ -29,8 +28,7 @@ export declare class ExtensionsOperations implements OnModuleInit {
|
|
|
29
28
|
private readonly switches;
|
|
30
29
|
private readonly pointDefaults;
|
|
31
30
|
private readonly overrides;
|
|
32
|
-
|
|
33
|
-
constructor(registry: PlatformOperations, configs: OrgExtensionConfigs, displayNames: ExtensionDisplayNames, kdb: KernelDb, switches: OrgToolSwitches, pointDefaults: ExtensionPointDefaults, overrides: OrgOverrides, extSwitch: OrgExtensionSwitch);
|
|
31
|
+
constructor(registry: PlatformOperations, configs: OrgExtensionConfigs, displayNames: ExtensionDisplayNames, kdb: KernelDb, switches: OrgToolSwitches, pointDefaults: ExtensionPointDefaults, overrides: OrgOverrides);
|
|
34
32
|
/** The org view of one extension, or `extension.not_found` (not installed or not offered). */
|
|
35
33
|
private viewOf;
|
|
36
34
|
/** An extension's display name for a card (its plugin's), else the name, clipped. */
|
|
@@ -10,8 +10,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
10
10
|
import { EXTENSION_POINTS, parseExtensionPoint } from "@capybara-hq/plugin-sdk";
|
|
11
11
|
import { Inject, Injectable } from "@nestjs/common";
|
|
12
12
|
import { z } from "zod";
|
|
13
|
-
import { OrgExtensionParams,
|
|
14
|
-
import { OrgExtensionSwitch } from "../../catalog/org-extension-switch.js";
|
|
13
|
+
import { OrgExtensionParams, OrgExtensionToolParams, OrgOverridesPut, OrgOverridesTake, OrgToolSwitchPut, } from "../../catalog/org-extension.schemas.js";
|
|
15
14
|
import { ApiError } from "../../errors.js";
|
|
16
15
|
import { ExtensionDisplayNames } from "../../extensions/display-name.js";
|
|
17
16
|
import { OrgExtensionConfigs, providesOf, } from "../../extensions/org-config.js";
|
|
@@ -27,7 +26,7 @@ import { personFieldParams, secretFieldsOf } from "../person-fields.js";
|
|
|
27
26
|
import { PlatformOperations } from "../registry.js";
|
|
28
27
|
import { precheckBy, viaAgent } from "./errors.js";
|
|
29
28
|
import { Cursor, pageOf, startOf } from "./paging.js";
|
|
30
|
-
import { configChanges, flatValues,
|
|
29
|
+
import { configChanges, flatValues, withPersonInputs } from "./person-inputs.js";
|
|
31
30
|
import { roleOf } from "./role.js";
|
|
32
31
|
import { localized, named, orElse } from "./summary.js";
|
|
33
32
|
import { roleFor, unavailableFields } from "./unavailable.js";
|
|
@@ -37,11 +36,9 @@ const Tool = OrgExtensionToolParams.shape.tool;
|
|
|
37
36
|
const SwitchConfirm = OrgToolSwitchPut.shape.confirm.unwrap();
|
|
38
37
|
/** The next step of an extension that needs its org config. */
|
|
39
38
|
const NEEDS_ORG_CONFIG = {
|
|
40
|
-
orgAdmin: "Read what is missing with extensions.org-config, then fill
|
|
39
|
+
orgAdmin: "Read what is missing with extensions.org-config, then fill in the org's own copy of the overridable fields with extensions.save-org-config; the person enters secrets in a secure input request.",
|
|
41
40
|
member: "Ask an org admin to fill in its org config on the Extensions page.",
|
|
42
41
|
};
|
|
43
|
-
/** The org config a write replaces (the whole non-secret config; secrets left out keep). */
|
|
44
|
-
const OrgConfigValues = OrgExtensionPut.shape.config.unwrap();
|
|
45
42
|
/**
|
|
46
43
|
* Secret fields of a target the schema walk cannot address (no form schema, a record): web only,
|
|
47
44
|
* so a value for one in `values` is refused as well.
|
|
@@ -54,16 +51,17 @@ function withUnaddressed(found, secretPaths) {
|
|
|
54
51
|
};
|
|
55
52
|
}
|
|
56
53
|
/**
|
|
57
|
-
* The person fields of the org's copy: the copy's own secrets (under
|
|
58
|
-
* set or not. A secret under
|
|
59
|
-
* for it in `values` is refused as well.
|
|
54
|
+
* The person fields of the org's copy: the copy's own secrets (under the listed overridable
|
|
55
|
+
* top-level fields), set or not. A secret under any other field is not the org's to set: never
|
|
56
|
+
* asked, and a value for it in `values` is refused as well.
|
|
60
57
|
*/
|
|
61
58
|
export function copyPersonFields(v) {
|
|
62
59
|
const secrets = v.fields.filter((f) => f.secret);
|
|
63
60
|
const stored = new Set(secrets.filter((f) => f.org?.set === true).map((f) => f.path));
|
|
64
61
|
// levels are per top-level property (org-levels.ts)
|
|
65
62
|
const top = (path) => path.split(/[.[]/)[0];
|
|
66
|
-
|
|
63
|
+
// the view lists overridable fields only
|
|
64
|
+
const overridable = new Set(v.fields.map((f) => top(f.path)));
|
|
67
65
|
const found = secretFieldsOf(v.schema, stored);
|
|
68
66
|
const fields = found.fields.filter((f) => overridable.has(top(f.path)));
|
|
69
67
|
const notOurs = found.fields.filter((f) => !overridable.has(top(f.path))).map((f) => f.path);
|
|
@@ -80,8 +78,8 @@ function stateOf(v) {
|
|
|
80
78
|
/**
|
|
81
79
|
* Extension operations of the `Platform` tool (spec §7): the org's extensions (the member projection
|
|
82
80
|
* of `GET /orgs/:orgId/extensions`, whatever the actor's role), their tool switches and point
|
|
83
|
-
* defaults, and for org admins the org
|
|
84
|
-
*
|
|
81
|
+
* defaults, and for org admins the org's copy of overridable platform fields (read, take, save,
|
|
82
|
+
* drop; platform web parity spec §7.2). Secrets are never returned (only
|
|
85
83
|
* whether each is set) and never taken as params: the person enters them in a secure input request.
|
|
86
84
|
*/
|
|
87
85
|
let ExtensionsOperations = class ExtensionsOperations {
|
|
@@ -92,8 +90,7 @@ let ExtensionsOperations = class ExtensionsOperations {
|
|
|
92
90
|
switches;
|
|
93
91
|
pointDefaults;
|
|
94
92
|
overrides;
|
|
95
|
-
|
|
96
|
-
constructor(registry, configs, displayNames, kdb, switches, pointDefaults, overrides, extSwitch) {
|
|
93
|
+
constructor(registry, configs, displayNames, kdb, switches, pointDefaults, overrides) {
|
|
97
94
|
this.registry = registry;
|
|
98
95
|
this.configs = configs;
|
|
99
96
|
this.displayNames = displayNames;
|
|
@@ -101,7 +98,6 @@ let ExtensionsOperations = class ExtensionsOperations {
|
|
|
101
98
|
this.switches = switches;
|
|
102
99
|
this.pointDefaults = pointDefaults;
|
|
103
100
|
this.overrides = overrides;
|
|
104
|
-
this.extSwitch = extSwitch;
|
|
105
101
|
}
|
|
106
102
|
/** The org view of one extension, or `extension.not_found` (not installed or not offered). */
|
|
107
103
|
async viewOf(orgId, name) {
|
|
@@ -119,7 +115,7 @@ let ExtensionsOperations = class ExtensionsOperations {
|
|
|
119
115
|
this.registry.register([
|
|
120
116
|
defineOperation({
|
|
121
117
|
id: "extensions.list",
|
|
122
|
-
description: "List the extensions installed on the platform as this org sees them, one compact row each: the state here (on, off, needs_config:
|
|
118
|
+
description: "List the extensions installed on the platform as this org sees them, one compact row each: the state here (on, off, needs_config: its config for this org is not valid, unavailable: it cannot run on the platform), why an unavailable one cannot be used (reason) and your next step (next), whether it is available on the platform, the extension points it provides and the plugin that brings it. State only: an org admin reads the config with extensions.org-config and sets the org's copy with extensions.save-org-config. Pages by 50: pass the returned next as params.cursor.",
|
|
123
119
|
input: z.object({ cursor: Cursor.optional() }).strict(),
|
|
124
120
|
example: {},
|
|
125
121
|
authz: { orgAction: "org.extensions.read" },
|
|
@@ -273,7 +269,7 @@ let ExtensionsOperations = class ExtensionsOperations {
|
|
|
273
269
|
}),
|
|
274
270
|
defineOperation({
|
|
275
271
|
id: "extensions.org-config",
|
|
276
|
-
description: "Read an extension's config in this org (org admins):
|
|
272
|
+
description: "Read an extension's config in this org (org admins): configurable (it has fields the org can override) and needsConfig (its config for this org is not valid); deploymentCopy is the org's side of the platform's deployment config: following the platform or a copy, the overridable fields (platform values, the copy's values, secrets as set or not, never a value) and whether the effective config is valid. deploymentCopy is null when the extension does not run on the platform.",
|
|
277
273
|
input: z.object({ extension: Extension }).strict(),
|
|
278
274
|
example: { extension: "model-anthropic" },
|
|
279
275
|
authz: { orgAction: "org.extensions.manage" },
|
|
@@ -286,94 +282,20 @@ let ExtensionsOperations = class ExtensionsOperations {
|
|
|
286
282
|
},
|
|
287
283
|
],
|
|
288
284
|
run: async (input, ctx) => {
|
|
289
|
-
// the
|
|
290
|
-
//
|
|
285
|
+
// the state comes with the org extension list, the copy of the platform's overridable
|
|
286
|
+
// fields from the overrides route
|
|
291
287
|
const v = await this.viewOf(ctx.orgId, input.extension);
|
|
292
288
|
return {
|
|
293
289
|
extension: v.plugin,
|
|
294
290
|
state: stateOf(v),
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
config: v.config,
|
|
298
|
-
secrets: v.secrets,
|
|
299
|
-
schema: v.orgConfigSchema,
|
|
300
|
-
needsConfig: v.needsConfig,
|
|
301
|
-
},
|
|
291
|
+
configurable: v.configurable,
|
|
292
|
+
needsConfig: v.needsConfig,
|
|
302
293
|
deploymentCopy: v.available
|
|
303
294
|
? await this.overrides.view(ctx.orgId, input.extension)
|
|
304
295
|
: null,
|
|
305
296
|
};
|
|
306
297
|
},
|
|
307
298
|
}),
|
|
308
|
-
defineOperation({
|
|
309
|
-
id: "extensions.set-org-config",
|
|
310
|
-
description: "Save an extension's org config (org admins): values is the whole non-secret config and replaces the stored one (read it first with extensions.org-config and keep the fields you do not change). Secret fields are never in values: list them in askPerson and the person types them in a secure input request (on the web); a secret not listed keeps its stored value; list stored secrets to empty in clearSecrets. Required secrets without a stored value are asked even when not listed. For overridable fields of the platform's deployment config (an org's own API key for a model provider, say) use extensions.save-org-config. Switching the extension on is plugins.set-enabled.",
|
|
311
|
-
input: z
|
|
312
|
-
.object({
|
|
313
|
-
extension: Extension,
|
|
314
|
-
values: OrgConfigValues,
|
|
315
|
-
askPerson: personFieldParams.askPerson,
|
|
316
|
-
clearSecrets: personFieldParams.clearSecrets,
|
|
317
|
-
})
|
|
318
|
-
.strict(),
|
|
319
|
-
example: {
|
|
320
|
-
extension: "lark",
|
|
321
|
-
values: { appId: "cli_a1b2c3" },
|
|
322
|
-
askPerson: ["appSecret"],
|
|
323
|
-
clearSecrets: [],
|
|
324
|
-
},
|
|
325
|
-
authz: { orgAction: "org.extensions.manage" },
|
|
326
|
-
mirrors: ["PUT /api/v1/orgs/:orgId/extensions/:extension"],
|
|
327
|
-
renames: { values: "config" },
|
|
328
|
-
// switching on and off is plugins.set-enabled (its preview and confirm)
|
|
329
|
-
omits: ["enabled", "force", "confirm"],
|
|
330
|
-
extras: ["askPerson", "clearSecrets"],
|
|
331
|
-
confirm: "org",
|
|
332
|
-
errors: [
|
|
333
|
-
{
|
|
334
|
-
code: "extension.not_found",
|
|
335
|
-
next: "The extension is not running or not visible to this org; check the name with extensions.list.",
|
|
336
|
-
},
|
|
337
|
-
{
|
|
338
|
-
code: "extension.no_org_config",
|
|
339
|
-
next: "This extension has no org config. Its overridable platform fields, if any, are set with extensions.save-org-config.",
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
code: "extension.config_invalid",
|
|
343
|
-
next: "Read the form schema with extensions.org-config, correct the values (the error's details name the fields), then call again.",
|
|
344
|
-
},
|
|
345
|
-
],
|
|
346
|
-
personFields: async (i, ctx) => {
|
|
347
|
-
const v = await this.viewOf(ctx.orgId, i.extension);
|
|
348
|
-
const n = await this.nameOf(i.extension);
|
|
349
|
-
const stored = new Set(v.secrets.filter((x) => x.set).map((x) => x.path));
|
|
350
|
-
return {
|
|
351
|
-
target: { zh: `扩展「${n.zh}」的组织配置`, en: `${n.en}: org config` },
|
|
352
|
-
...withUnaddressed(secretFieldsOf(v.orgConfigSchema, stored), v.secrets.map((x) => x.path)),
|
|
353
|
-
};
|
|
354
|
-
},
|
|
355
|
-
summary: async (i, ctx) => {
|
|
356
|
-
const n = await this.nameOf(i.extension);
|
|
357
|
-
const c = configChanges(i, ctx);
|
|
358
|
-
return {
|
|
359
|
-
zh: `保存扩展「${n.zh}」的组织配置:${c.zh}`,
|
|
360
|
-
en: `Save the org config of extension "${n.en}": ${c.en}`,
|
|
361
|
-
};
|
|
362
|
-
},
|
|
363
|
-
run: async (input, ctx) => {
|
|
364
|
-
const r = await withPersonInputs("extensions.set-org-config", ctx, (entered, detail) => this.extSwitch.put(ctx.orgId, ctx.actorAccountId, input.extension, { config: nestedConfig(input.values, entered, input.clearSecrets) }, undefined, detail));
|
|
365
|
-
// a config-only write never previews (only switching off does)
|
|
366
|
-
if (r.kind !== "done")
|
|
367
|
-
throw new Error("a config-only org extension write previewed");
|
|
368
|
-
const v = r.view;
|
|
369
|
-
return {
|
|
370
|
-
extension: v.plugin,
|
|
371
|
-
state: stateOf(v),
|
|
372
|
-
config: v.config,
|
|
373
|
-
secrets: v.secrets,
|
|
374
|
-
};
|
|
375
|
-
},
|
|
376
|
-
}),
|
|
377
299
|
defineOperation({
|
|
378
300
|
id: "extensions.save-org-config",
|
|
379
301
|
description: "Save fields of the org's own copy of an extension's platform deployment config (org admins): only overridable fields (extensions.org-config lists them under deploymentCopy). values maps field dot paths to values (null clears; a field left out keeps). Secret fields are never in values: list them in askPerson and the person types them in a secure input request (on the web); list stored secrets to empty in clearSecrets. The first save makes the copy from the platform's non-secret values and must be valid on its own (its required secrets are asked).",
|
|
@@ -616,7 +538,6 @@ ExtensionsOperations = __decorate([
|
|
|
616
538
|
__param(3, Inject(KernelDb)),
|
|
617
539
|
__param(4, Inject(OrgToolSwitches)),
|
|
618
540
|
__param(5, Inject(ExtensionPointDefaults)),
|
|
619
|
-
__param(6, Inject(OrgOverrides))
|
|
620
|
-
__param(7, Inject(OrgExtensionSwitch))
|
|
541
|
+
__param(6, Inject(OrgOverrides))
|
|
621
542
|
], ExtensionsOperations);
|
|
622
543
|
export { ExtensionsOperations };
|
|
@@ -5,7 +5,6 @@ import { OrgCatalogService } from "../../catalog/org-catalog.service.js";
|
|
|
5
5
|
import { OrgPluginUploads } from "../../catalog/org-plugin-uploads.js";
|
|
6
6
|
import { OwnedItems } from "../../catalog/owned-items.js";
|
|
7
7
|
import { PluginInstaller } from "../../catalog/plugin-install.js";
|
|
8
|
-
import { OrgExtensionConfigs } from "../../extensions/org-config.js";
|
|
9
8
|
import { KernelConfigService } from "../../infra/config/kernel-config.service.js";
|
|
10
9
|
import { KernelDb } from "../../infra/database/kernel-db.js";
|
|
11
10
|
import { ThemesService } from "../../themes/themes.service.js";
|
|
@@ -34,15 +33,13 @@ export declare class OrgPluginsOperations implements OnModuleInit {
|
|
|
34
33
|
private readonly kdb;
|
|
35
34
|
private readonly appearance;
|
|
36
35
|
private readonly themes;
|
|
37
|
-
private readonly extensions;
|
|
38
36
|
private readonly config;
|
|
39
|
-
constructor(registry: PlatformOperations, installer: PluginInstaller, orgCatalog: OrgCatalogService, uploads: OrgPluginUploads, owned: OwnedItems, scope: CatalogScopeService, kdb: KernelDb, appearance: AppearanceService, themes: ThemesService,
|
|
37
|
+
constructor(registry: PlatformOperations, installer: PluginInstaller, orgCatalog: OrgCatalogService, uploads: OrgPluginUploads, owned: OwnedItems, scope: CatalogScopeService, kdb: KernelDb, appearance: AppearanceService, themes: ThemesService, config: KernelConfigService);
|
|
40
38
|
/**
|
|
41
39
|
* What installing a plugin asks the person for (platform web parity spec §7.2): the connector
|
|
42
40
|
* templates whose connector the install creates (on in the org, none kept from an earlier
|
|
43
|
-
* switch-off, as the install wizard asks)
|
|
44
|
-
*
|
|
45
|
-
* only). An extension whose org view cannot be read refuses the call: its secrets are unknown.
|
|
41
|
+
* switch-off, as the install wizard asks). The extension's config for the org is its copy of the
|
|
42
|
+
* overridable fields, saved apart (`extensions.save-org-config`).
|
|
46
43
|
*/
|
|
47
44
|
private installTargets;
|
|
48
45
|
/** The missing connectors of an installed plugin that a configure call names. */
|