@capybara-hq/kernel 0.1.0-rc.132 → 0.1.0-rc.134
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 +5 -5
- package/dist/admin/admin.module.js +3 -0
- package/dist/admin/admin.schemas.d.ts +4 -0
- package/dist/admin/health.service.d.ts +2 -2
- package/dist/admin/health.service.js +6 -2
- package/dist/admin/setup.service.js +6 -1
- package/dist/agents/agents.controller.js +3 -2
- package/dist/agents/agents.service.d.ts +2 -0
- package/dist/agents/agents.service.js +7 -0
- package/dist/automations/events/trigger-events.service.d.ts +13 -1
- package/dist/automations/events/trigger-events.service.js +27 -14
- package/dist/catalog/catalog.service.d.ts +2 -0
- package/dist/catalog/catalog.service.js +28 -5
- package/dist/catalog/marketplace-fetch.d.ts +2 -0
- package/dist/catalog/marketplace-fetch.js +15 -0
- package/dist/catalog/marketplaces.service.d.ts +4 -4
- package/dist/catalog/marketplaces.service.js +3 -2
- package/dist/catalog/owned-items.d.ts +2 -0
- package/dist/catalog/owned-items.js +30 -31
- package/dist/catalog/ownership.js +40 -38
- package/dist/catalog/plugin-import.d.ts +3 -4
- package/dist/catalog/plugin-import.js +50 -1
- package/dist/catalog/plugin-upgrade.d.ts +8 -0
- package/dist/catalog/plugin-upgrade.js +95 -7
- package/dist/catalog/publisher-policy.d.ts +9 -0
- package/dist/catalog/publisher-policy.js +12 -0
- package/dist/catalog/unshare.js +66 -58
- package/dist/client/client-access.service.js +5 -3
- package/dist/config/schema.d.ts +1 -0
- package/dist/config/schema.js +8 -1
- package/dist/conversations/conversations.controller.js +4 -14
- package/dist/conversations/conversations.service.d.ts +14 -0
- package/dist/conversations/conversations.service.js +20 -2
- package/dist/ctx/create-ctx.d.ts +15 -2
- package/dist/ctx/create-ctx.js +195 -79
- package/dist/ctx/durable-cancellation.d.ts +3 -0
- package/dist/ctx/durable-cancellation.js +8 -0
- package/dist/ctx/durable-effects.service.d.ts +81 -0
- package/dist/ctx/durable-effects.service.js +316 -0
- package/dist/ctx/durable-envelope.d.ts +24 -0
- package/dist/ctx/durable-envelope.js +80 -0
- package/dist/ctx/durable-failure.d.ts +7 -0
- package/dist/ctx/durable-failure.js +32 -0
- package/dist/ctx/durable-job.d.ts +9 -0
- package/dist/ctx/durable-job.js +2 -0
- package/dist/ctx/durable-keys.d.ts +27 -0
- package/dist/ctx/durable-keys.js +138 -0
- package/dist/ctx/durable-relay.d.ts +29 -0
- package/dist/ctx/durable-relay.js +250 -0
- package/dist/ctx/queue.d.ts +2 -0
- package/dist/ctx/queue.js +25 -15
- package/dist/db/extension-db.js +2 -0
- package/dist/db/extension-handoff-schema.d.ts +6 -0
- package/dist/db/extension-handoff-schema.js +72 -0
- package/dist/db/extension-rls-predicate.d.ts +1 -0
- package/dist/db/extension-rls-predicate.js +8 -0
- package/dist/db/extension-schema-transfer.d.ts +1 -1
- package/dist/db/extension-schema-transfer.js +18 -6
- package/dist/db/kernel-schema.d.ts +64 -0
- package/dist/db/migrator.js +6 -13
- package/dist/db/pool.d.ts +2 -2
- package/dist/db/pool.js +2 -2
- package/dist/db/sql-statements.d.ts +3 -0
- package/dist/db/sql-statements.js +15 -5
- package/dist/device-access/device-access.module.js +12 -2
- package/dist/device-access/device-access.service.d.ts +30 -2
- package/dist/device-access/device-access.service.js +38 -4
- package/dist/device-access/host-gate.d.ts +45 -0
- package/dist/device-access/host-gate.js +92 -0
- package/dist/device-access/host-service-stop-sweep.d.ts +33 -0
- package/dist/device-access/host-service-stop-sweep.js +112 -0
- package/dist/device-access/host-service-stop.d.ts +78 -0
- package/dist/device-access/host-service-stop.js +144 -0
- package/dist/device-access/host-services.d.ts +211 -0
- package/dist/device-access/host-services.js +803 -0
- package/dist/device-access/person-handles.d.ts +10 -0
- package/dist/device-access/person-handles.js +25 -0
- package/dist/device-access/service-events.d.ts +199 -0
- package/dist/device-access/service-events.js +704 -0
- package/dist/device-access/token.d.ts +5 -0
- package/dist/device-access/token.js +5 -0
- package/dist/devices/devices.service.js +3 -0
- package/dist/dial-in/access.d.ts +5 -5
- package/dist/dial-in/access.js +19 -12
- package/dist/dial-in/gateway.js +6 -2
- package/dist/dial-in/machines.d.ts +9 -2
- package/dist/dial-in/machines.js +27 -4
- package/dist/erasure/device-cleanup.js +12 -0
- package/dist/erasure/org-catalog.js +2 -2
- package/dist/erasure/org-rules.js +10 -0
- package/dist/errors.d.ts +2 -0
- package/dist/errors.js +2 -0
- package/dist/extensions/admin-ops.js +8 -2
- package/dist/extensions/deployed-snapshots.d.ts +4 -1
- package/dist/extensions/deployed-snapshots.js +7 -2
- package/dist/extensions/extensions.module.js +10 -0
- package/dist/extensions/host.d.ts +12 -2
- package/dist/extensions/host.js +44 -22
- package/dist/extensions/instance.d.ts +5 -0
- package/dist/extensions/instance.js +10 -0
- package/dist/extensions/ledger.d.ts +1 -1
- package/dist/extensions/lifecycle-hooks.js +3 -3
- package/dist/extensions/org-config.js +6 -1
- package/dist/extensions/permission-set.d.ts +7 -0
- package/dist/extensions/permission-set.js +10 -0
- package/dist/extensions/permission-view.d.ts +1 -1
- package/dist/extensions/permission-view.js +10 -1
- package/dist/extensions/sources.d.ts +1 -0
- package/dist/extensions/sources.js +9 -0
- package/dist/git/tickets.js +32 -27
- package/dist/http/app.js +5 -3
- package/dist/identity/accounts.d.ts +6 -1
- package/dist/identity/accounts.js +11 -2
- package/dist/identity/api-tokens.js +7 -6
- package/dist/identity/settings.d.ts +9 -1
- package/dist/identity/settings.js +16 -1
- package/dist/inbox/inbox-items.service.d.ts +5 -0
- package/dist/inbox/inbox-items.service.js +57 -33
- package/dist/inbox/org-notices.js +3 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/infra/database/extension-effect-key-lock.d.ts +10 -0
- package/dist/infra/database/extension-effect-key-lock.js +69 -0
- package/dist/infra/database/extension-handoff.d.ts +27 -0
- package/dist/infra/database/extension-handoff.js +113 -0
- package/dist/infra/database/scoped-dialect.d.ts +3 -2
- package/dist/infra/database/scoped-dialect.js +260 -72
- package/dist/infra/database/startup-activation-transaction.d.ts +2 -0
- package/dist/infra/database/startup-activation-transaction.js +3 -2
- package/dist/infra/outbox/outbox.dispatcher.d.ts +6 -1
- package/dist/infra/outbox/outbox.dispatcher.js +64 -4
- package/dist/infra/outbox/outbox.module.js +2 -0
- package/dist/infra/outbox/registry.d.ts +40 -0
- package/dist/infra/outbox/registry.js +42 -0
- package/dist/infra/queue/queue-names.d.ts +1 -1
- package/dist/infra/queue/queue-names.js +1 -0
- package/dist/infra/queue/run-job.d.ts +4 -1
- package/dist/infra/queue/run-job.js +10 -2
- package/dist/kernel.js +1 -0
- package/dist/kernel.module.js +3 -0
- package/dist/orgs/offboarding.js +18 -9
- package/dist/orgs/orgs.service.js +16 -0
- package/dist/orgs/settings.service.js +3 -0
- package/dist/packages/npm-publish-keys.json +27 -0
- package/dist/packages/official-publisher.d.ts +19 -0
- package/dist/packages/official-publisher.js +152 -0
- package/dist/packages/provenance.d.ts +7 -0
- package/dist/packages/provenance.js +22 -19
- package/dist/packages/sigstore-trusted-root.json +126 -0
- package/dist/platform/ops/admin.ops.js +2 -1
- package/dist/platform/ops/orgs.ops.js +1 -0
- package/dist/roles/worker-role.d.ts +6 -3
- package/dist/roles/worker-role.js +12 -4
- package/dist/roles/worker.module.js +9 -0
- package/dist/runtime/maintenance.d.ts +5 -2
- package/dist/runtime/maintenance.js +18 -4
- package/dist/sandbox/device-reports.d.ts +4 -4
- package/dist/sandbox/device-reports.js +40 -30
- package/dist/sandbox/device-services.d.ts +2 -1
- package/dist/sandbox/device-services.js +5 -1
- package/dist/sandbox/permission-ceiling-writes.d.ts +8 -0
- package/dist/sandbox/permission-ceiling-writes.js +21 -0
- package/dist/sandbox/permission-config-publication.js +5 -1
- package/dist/themes/theme-state.js +24 -13
- package/dist/tools/call-scope.d.ts +6 -0
- package/dist/tools/call-scope.js +22 -0
- package/dist/tools/registry.js +20 -2
- package/dist/ui/views.js +36 -8
- package/package.json +9 -4
- package/src/migrations/0222_device_host_services.sql +27 -0
- package/src/migrations/0223_device_service_events.sql +54 -0
- package/src/migrations/0224_cache_conversation_rls_settings.sql +33 -0
- package/src/migrations/0225_extension_effect_receipts.sql +25 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type DroppedUiContribution, type ExtensionManifest, type ExtensionPointRef, type ResolvedUiContribution, type StaticExtensionManifest } from "@capybara-hq/plugin-sdk";
|
|
2
2
|
import { type ExtensionPointAccess, type KernelDeps, type KernelExtensionContext, LiveConfig, type RegisteredSetupCheck, type RegisteredTool, type Route } from "../ctx/create-ctx.js";
|
|
3
3
|
import type { extensionDbPool } from "../db/extension-db.js";
|
|
4
|
+
import type { ServiceEventHandler } from "../device-access/service-events.js";
|
|
4
5
|
import type { UiActionHandler, UiQueryHandler, UiRender } from "../ui/registry.js";
|
|
5
6
|
import type { RegisteredHook } from "./hooks.js";
|
|
6
7
|
import { InflightTracker } from "./inflight.js";
|
|
@@ -64,6 +65,8 @@ export declare class ExtensionInstance {
|
|
|
64
65
|
/** {@link hurry}:进行中的 dispose 不再等排空时限。 */
|
|
65
66
|
private readonly hurried;
|
|
66
67
|
constructor(init: ExtensionInstanceInit);
|
|
68
|
+
hasEffectQueue(name: string): boolean;
|
|
69
|
+
enqueueEffect(queue: string, data: unknown, jobId: string, delayMs?: number): Promise<void>;
|
|
67
70
|
/** 此刻的部署配置(hot 改动后是新值)。 */
|
|
68
71
|
get config(): unknown;
|
|
69
72
|
/** 部署配置摘要(见 `deploymentConfigHash`;hot 改动后随之更新)。 */
|
|
@@ -82,6 +85,8 @@ export declare class ExtensionInstance {
|
|
|
82
85
|
get uiQueries(): ReadonlyMap<string, UiQueryHandler>;
|
|
83
86
|
/** Setup checks registered through `ctx.setup.check` (empty after revocation). */
|
|
84
87
|
get setupChecks(): ReadonlyMap<string, RegisteredSetupCheck>;
|
|
88
|
+
/** Handlers registered through `ctx.deviceAccess.onServiceEvent` (empty after revocation). */
|
|
89
|
+
get serviceEventHandlers(): ReadonlyMap<string, ServiceEventHandler>;
|
|
85
90
|
/** The instance's `ctx.signal`: aborted when it is revoked or disposed. */
|
|
86
91
|
get signal(): AbortSignal;
|
|
87
92
|
/** 账上仍在的登记(撤销后为空)。 */
|
|
@@ -95,6 +95,12 @@ export class ExtensionInstance {
|
|
|
95
95
|
this.log = init.log;
|
|
96
96
|
this.inflight = new InflightTracker(this.name);
|
|
97
97
|
}
|
|
98
|
+
hasEffectQueue(name) {
|
|
99
|
+
return this.ctx.hasEffectQueue(name);
|
|
100
|
+
}
|
|
101
|
+
async enqueueEffect(queue, data, jobId, delayMs) {
|
|
102
|
+
await this.ctx.dispatchEffectQueue(queue, data, jobId, delayMs);
|
|
103
|
+
}
|
|
98
104
|
/** 此刻的部署配置(hot 改动后是新值)。 */
|
|
99
105
|
get config() {
|
|
100
106
|
return this.live.value;
|
|
@@ -136,6 +142,10 @@ export class ExtensionInstance {
|
|
|
136
142
|
get setupChecks() {
|
|
137
143
|
return this.ctx.setupChecks;
|
|
138
144
|
}
|
|
145
|
+
/** Handlers registered through `ctx.deviceAccess.onServiceEvent` (empty after revocation). */
|
|
146
|
+
get serviceEventHandlers() {
|
|
147
|
+
return this.ctx.serviceEventHandlers;
|
|
148
|
+
}
|
|
139
149
|
/** The instance's `ctx.signal`: aborted when it is revoked or disposed. */
|
|
140
150
|
get signal() {
|
|
141
151
|
return this.ctx.signal;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** 插件经 ctx 做的一项登记的种类(C17)。 */
|
|
2
|
-
export type RegistrationKind = "tool" | "route" | "queue" | "bus" | "lease" | "ui.view" | "ui.action" | "ui.query" | "provide" | "hook" | "setup.check";
|
|
2
|
+
export type RegistrationKind = "tool" | "route" | "queue" | "bus" | "lease" | "ui.view" | "ui.action" | "ui.query" | "provide" | "hook" | "setup.check" | "service.event";
|
|
3
3
|
/** 账上的一项:撤销时调用 `dispose()`。 */
|
|
4
4
|
export interface Registration {
|
|
5
5
|
kind: RegistrationKind;
|
|
@@ -11,6 +11,7 @@ import { OnWorkerEvent, Processor, WorkerHost } from "@nestjs/bullmq";
|
|
|
11
11
|
import { Inject, Injectable, Module } from "@nestjs/common";
|
|
12
12
|
import { sql } from "kysely";
|
|
13
13
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
14
|
+
import { withOrgScope } from "../infra/database/org-scope.js";
|
|
14
15
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
15
16
|
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
16
17
|
import { OutboxService } from "../infra/outbox/outbox.service.js";
|
|
@@ -250,9 +251,8 @@ let LifecycleHooksProcessor = class LifecycleHooksProcessor extends WorkerHost {
|
|
|
250
251
|
this.log = log;
|
|
251
252
|
}
|
|
252
253
|
process(job) {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
});
|
|
254
|
+
// The original job shape already carries the organization inside the durable payload.
|
|
255
|
+
return runJob(LIFECYCLE_QUEUE, job, () => withOrgScope(job.data.payload.orgId, () => this.hooks.process(job.data, this.stopping.signal)));
|
|
256
256
|
}
|
|
257
257
|
/** Starts consuming (worker role, after the extensions loaded). */
|
|
258
258
|
start() {
|
|
@@ -11,6 +11,7 @@ import { EXTENSION_POINTS, parseExtensionPoint, } from "@capybara-hq/plugin-sdk"
|
|
|
11
11
|
import { Inject, Injectable } from "@nestjs/common";
|
|
12
12
|
import { assertItemInstallable, assertPluginSourcesInstallable, disabledPluginItems, pluginItemDisabled, } from "../catalog/request-rules.js";
|
|
13
13
|
import { oweTemplateConnectors } from "../catalog/template-connector-jobs.js";
|
|
14
|
+
import { oweHostServicesStop } from "../device-access/host-service-stop.js";
|
|
14
15
|
import { revokeSiteGrantsOfExtension } from "../device-access/site-grants.js";
|
|
15
16
|
import { ApiError } from "../errors.js";
|
|
16
17
|
import { audit } from "../identity/audit.js";
|
|
@@ -293,8 +294,11 @@ let OrgExtensionConfigs = class OrgExtensionConfigs {
|
|
|
293
294
|
updated_at: new Date(),
|
|
294
295
|
}))
|
|
295
296
|
.execute();
|
|
296
|
-
if (!enabled)
|
|
297
|
+
if (!enabled) {
|
|
297
298
|
await revokeSiteGrantsOfExtension(t, { orgId, extensionName: plugin });
|
|
299
|
+
// its host services on the org's machines stop (local agents spec, call 5)
|
|
300
|
+
await oweHostServicesStop(t, this.outbox, { orgId, extension: plugin });
|
|
301
|
+
}
|
|
298
302
|
// Switched on: it may provide the connector kind of a template whose plugin is installed in
|
|
299
303
|
// the org without its connector; a worker creates the connectors it never had, once the
|
|
300
304
|
// extension is loaded there (ruling R27)
|
|
@@ -414,6 +418,7 @@ let OrgExtensionConfigs = class OrgExtensionConfigs {
|
|
|
414
418
|
if (!r)
|
|
415
419
|
return false;
|
|
416
420
|
await revokeSiteGrantsOfExtension(t, { orgId, extensionName: plugin });
|
|
421
|
+
await oweHostServicesStop(t, this.outbox, { orgId, extension: plugin });
|
|
417
422
|
await audit(t, {
|
|
418
423
|
actorAccountId,
|
|
419
424
|
orgId,
|
|
@@ -81,6 +81,8 @@ export interface PermissionSet {
|
|
|
81
81
|
services: string[];
|
|
82
82
|
loopbackPorts?: true;
|
|
83
83
|
siteAccess?: true;
|
|
84
|
+
/** Services that may run on the owner's machine outside the sandbox: one blocking key each. */
|
|
85
|
+
hostServices?: string[];
|
|
84
86
|
};
|
|
85
87
|
/**
|
|
86
88
|
* The event types the extension may emit (`permissions.triggers.emit`, collaboration spec
|
|
@@ -188,6 +190,11 @@ export declare const DEVICE_ACCESS_KEY_PREFIX = "permissions.deviceaccess:";
|
|
|
188
190
|
* upgrade without approval again. Recorded only when declared.
|
|
189
191
|
*/
|
|
190
192
|
export declare const DEVICE_LOOPBACK_PORTS_KEY = "permissions.deviceaccess.loopbackports";
|
|
193
|
+
/**
|
|
194
|
+
* Key prefix of a host service (`permissions.deviceAccess.hostServices`): the service runs on the
|
|
195
|
+
* owner's machine outside the sandbox; sensitive and blocking like any device service key.
|
|
196
|
+
*/
|
|
197
|
+
export declare const DEVICE_HOST_KEY_PREFIX = "permissions.deviceaccess.host:";
|
|
191
198
|
/** Blocking permission for profile decisions on non-loopback site actions. */
|
|
192
199
|
export declare const DEVICE_SITE_ACCESS_KEY = "permissions.deviceaccess.siteaccess";
|
|
193
200
|
/**
|
|
@@ -124,6 +124,9 @@ export function buildPermissionSet(input) {
|
|
|
124
124
|
services: sortedUnique(p.deviceAccess.services),
|
|
125
125
|
...(p.deviceAccess.loopbackPorts === true && { loopbackPorts: true }),
|
|
126
126
|
...(p.deviceAccess.siteAccess === true && { siteAccess: true }),
|
|
127
|
+
...(p.deviceAccess.hostServices && p.deviceAccess.hostServices.length > 0
|
|
128
|
+
? { hostServices: sortedUnique(p.deviceAccess.hostServices) }
|
|
129
|
+
: {}),
|
|
127
130
|
},
|
|
128
131
|
}
|
|
129
132
|
: {}),
|
|
@@ -200,6 +203,8 @@ export function permissionKeys(set) {
|
|
|
200
203
|
keys.push(DEVICE_LOOPBACK_PORTS_KEY);
|
|
201
204
|
if (p.deviceAccess?.siteAccess === true)
|
|
202
205
|
keys.push(DEVICE_SITE_ACCESS_KEY);
|
|
206
|
+
for (const svc of p.deviceAccess?.hostServices ?? [])
|
|
207
|
+
keys.push(`${DEVICE_HOST_KEY_PREFIX}${svc}`);
|
|
203
208
|
for (const t of p.triggers?.emit ?? [])
|
|
204
209
|
keys.push(`${TRIGGERS_KEY_PREFIX}${t}`);
|
|
205
210
|
if (p.inbox === true)
|
|
@@ -241,6 +246,11 @@ export const DEVICE_ACCESS_KEY_PREFIX = "permissions.deviceaccess:";
|
|
|
241
246
|
* upgrade without approval again. Recorded only when declared.
|
|
242
247
|
*/
|
|
243
248
|
export const DEVICE_LOOPBACK_PORTS_KEY = "permissions.deviceaccess.loopbackports";
|
|
249
|
+
/**
|
|
250
|
+
* Key prefix of a host service (`permissions.deviceAccess.hostServices`): the service runs on the
|
|
251
|
+
* owner's machine outside the sandbox; sensitive and blocking like any device service key.
|
|
252
|
+
*/
|
|
253
|
+
export const DEVICE_HOST_KEY_PREFIX = "permissions.deviceaccess.host:";
|
|
244
254
|
/** Blocking permission for profile decisions on non-loopback site actions. */
|
|
245
255
|
export const DEVICE_SITE_ACCESS_KEY = "permissions.deviceaccess.siteaccess";
|
|
246
256
|
/**
|
|
@@ -34,7 +34,7 @@ export interface PermissionGroup {
|
|
|
34
34
|
* ({@link SENSITIVE_EXTENSION_POINTS}; the code is the extension point name without `@<major>`, with
|
|
35
35
|
* `-` replaced by `_`).
|
|
36
36
|
*/
|
|
37
|
-
export type SensitiveReason = "secrets" | "public_routes" | "embed_routes" | "tools" | "hooks" | "ui_embed" | "client_code" | "ui_component" | "channel" | "directory" | "identity_source" | "device_provider" | "object_store" | "context" | "push_provider" | "device_access" | "device_loopback_ports" | "device_site_access" | "migration_warnings";
|
|
37
|
+
export type SensitiveReason = "secrets" | "public_routes" | "embed_routes" | "tools" | "hooks" | "ui_embed" | "client_code" | "ui_component" | "channel" | "directory" | "identity_source" | "device_provider" | "object_store" | "context" | "push_provider" | "device_access" | "device_loopback_ports" | "device_site_access" | "device_host_service" | "migration_warnings";
|
|
38
38
|
/** 权限清单里的一项(分组里的一项,或 `added` 里的一个权限键)。 */
|
|
39
39
|
export interface PermissionItem {
|
|
40
40
|
value: string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { pluginSchemaName } from "../ctx/create-ctx.js";
|
|
3
|
+
import { EXTENSION_RLS_PREDICATE } from "../db/extension-rls-predicate.js";
|
|
3
4
|
import { isDestructiveSql, splitSqlStatements } from "../db/sql-statements.js";
|
|
4
|
-
import { AGENTS_KEY, CLIENT_KEY, CONVERSATIONS_KEY, DEVICE_ACCESS_KEY_PREFIX, DEVICE_LOOPBACK_PORTS_KEY, DEVICE_SITE_ACCESS_KEY, DIAL_IN_KEY_PREFIX, INBOX_KEY, PEOPLE_KEY, permissionKeys, TRIGGERS_KEY_PREFIX, UI_COMPONENT_KEY_PREFIX, WARNINGS_KEY_PREFIX, } from "./permission-set.js";
|
|
5
|
+
import { AGENTS_KEY, CLIENT_KEY, CONVERSATIONS_KEY, DEVICE_ACCESS_KEY_PREFIX, DEVICE_HOST_KEY_PREFIX, DEVICE_LOOPBACK_PORTS_KEY, DEVICE_SITE_ACCESS_KEY, DIAL_IN_KEY_PREFIX, INBOX_KEY, PEOPLE_KEY, permissionKeys, TRIGGERS_KEY_PREFIX, UI_COMPONENT_KEY_PREFIX, WARNINGS_KEY_PREFIX, } from "./permission-set.js";
|
|
5
6
|
/**
|
|
6
7
|
* Review digest: the first 16 hex digits of `sha256(permissionKeys(set).join("\n"))`; with migration
|
|
7
8
|
* warnings their digest (kind, file, line and statement) is folded in, without warnings it equals the
|
|
@@ -43,6 +44,8 @@ const CLIENT_ITEM = "client code";
|
|
|
43
44
|
/** The "deviceAccess" group's item of loopback port grants (`permissions.deviceAccess.loopbackPorts`). */
|
|
44
45
|
const LOOPBACK_PORTS_ITEM = "local ports on the device (loopback)";
|
|
45
46
|
const SITE_ACCESS_ITEM = "profile-approved actions on websites";
|
|
47
|
+
/** Item prefix of a host service (`permissions.deviceAccess.hostServices`): `host:<service>`. */
|
|
48
|
+
const HOST_ITEM_PREFIX = "host:";
|
|
46
49
|
/** The one item of the "inbox" group (collaboration spec §4.9). */
|
|
47
50
|
const INBOX_ITEM = "personal inbox items";
|
|
48
51
|
/** The items of the read-only org fact groups. */
|
|
@@ -92,6 +95,8 @@ function itemReason(category, item) {
|
|
|
92
95
|
return "device_loopback_ports";
|
|
93
96
|
if (category === "deviceAccess" && item === SITE_ACCESS_ITEM)
|
|
94
97
|
return "device_site_access";
|
|
98
|
+
if (category === "deviceAccess" && item.startsWith(HOST_ITEM_PREFIX))
|
|
99
|
+
return "device_host_service";
|
|
95
100
|
return ALWAYS_SENSITIVE.has(category) ? CATEGORY_REASON[category] : undefined;
|
|
96
101
|
}
|
|
97
102
|
/** Routes of the `http` group: member and admin (the kernel authenticates a person). */
|
|
@@ -134,6 +139,7 @@ function keyItem(key) {
|
|
|
134
139
|
["ui.view:", "ui", "view:"],
|
|
135
140
|
[DIAL_IN_KEY_PREFIX, "dialIn", ""],
|
|
136
141
|
[DEVICE_ACCESS_KEY_PREFIX, "deviceAccess", ""],
|
|
142
|
+
[DEVICE_HOST_KEY_PREFIX, "deviceAccess", HOST_ITEM_PREFIX],
|
|
137
143
|
[TRIGGERS_KEY_PREFIX, "triggers", ""],
|
|
138
144
|
];
|
|
139
145
|
for (const [prefix, category, itemPrefix] of table) {
|
|
@@ -220,6 +226,7 @@ export function permissionGroups(set) {
|
|
|
220
226
|
...(p.deviceAccess?.services ?? []),
|
|
221
227
|
...(p.deviceAccess?.loopbackPorts === true ? [LOOPBACK_PORTS_ITEM] : []),
|
|
222
228
|
...(p.deviceAccess?.siteAccess === true ? [SITE_ACCESS_ITEM] : []),
|
|
229
|
+
...(p.deviceAccess?.hostServices ?? []).map((s) => `${HOST_ITEM_PREFIX}${s}`),
|
|
223
230
|
],
|
|
224
231
|
},
|
|
225
232
|
// the event types it emits for the orgs' event automations (not sensitive)
|
|
@@ -287,6 +294,8 @@ export function deriveExtensionStatus(i) {
|
|
|
287
294
|
export function migrationWarnings(files, plugin) {
|
|
288
295
|
const own = pluginSchemaName(plugin);
|
|
289
296
|
return files.flatMap((m) => splitSqlStatements(m.sql).flatMap((st) => {
|
|
297
|
+
if (m.sql.slice(st.startOffset, st.endOffset) === EXTENSION_RLS_PREDICATE)
|
|
298
|
+
return [];
|
|
290
299
|
const base = { sensitive: true, file: m.file, line: st.line, statement: st.text };
|
|
291
300
|
if (/^DO\b/i.test(st.text))
|
|
292
301
|
return [{ kind: "dynamic_sql", ...base }];
|
|
@@ -66,6 +66,7 @@ export declare class ReplicaStatusStore {
|
|
|
66
66
|
* 该插件这一行属于生效的那一方(配置声明),所以只追加 detail。
|
|
67
67
|
*/
|
|
68
68
|
note(plugin: string, detail: string): Promise<void>;
|
|
69
|
+
clearNote(plugin: string, detail: string): Promise<void>;
|
|
69
70
|
/**
|
|
70
71
|
* 心跳:本副本全部行的 `heartbeat_at` 取当前时间(每次 reconcile 之后调用;读状态的一方只算心跳不超过
|
|
71
72
|
* 3 个 reconcile 周期的副本,C16)。
|
|
@@ -88,6 +88,15 @@ let ReplicaStatusStore = class ReplicaStatusStore {
|
|
|
88
88
|
.where("plugin", "=", plugin)
|
|
89
89
|
.execute();
|
|
90
90
|
}
|
|
91
|
+
async clearNote(plugin, detail) {
|
|
92
|
+
await this.db
|
|
93
|
+
.updateTable("extension_replica_status")
|
|
94
|
+
.set({ detail: null })
|
|
95
|
+
.where("replica_id", "=", this.replicaId)
|
|
96
|
+
.where("plugin", "=", plugin)
|
|
97
|
+
.where("detail", "=", this.cleanDetail(detail))
|
|
98
|
+
.execute();
|
|
99
|
+
}
|
|
91
100
|
/**
|
|
92
101
|
* 心跳:本副本全部行的 `heartbeat_at` 取当前时间(每次 reconcile 之后调用;读状态的一方只算心跳不超过
|
|
93
102
|
* 3 个 reconcile 周期的副本,C16)。
|
package/dist/git/tickets.js
CHANGED
|
@@ -12,6 +12,7 @@ import { Inject, Injectable } from "@nestjs/common";
|
|
|
12
12
|
import { z } from "zod";
|
|
13
13
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
14
14
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
15
|
+
import { withOrgScope } from "../infra/database/org-scope.js";
|
|
15
16
|
import { KERNEL_LOGGER, REDIS } from "../infra/tokens.js";
|
|
16
17
|
import { readOrgSettings } from "../orgs/settings.service.js";
|
|
17
18
|
const BindingSchema = z.object({
|
|
@@ -110,33 +111,37 @@ let GitTickets = class GitTickets {
|
|
|
110
111
|
const binding = parseBinding(stored);
|
|
111
112
|
if (binding === null)
|
|
112
113
|
return refuse("invalid binding");
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
114
|
+
// The binding is issued by the kernel. Re-check its run and membership under that org's scope.
|
|
115
|
+
return withOrgScope(binding.orgId, async () => {
|
|
116
|
+
const run = await this.db
|
|
117
|
+
.selectFrom("runs")
|
|
118
|
+
.innerJoin("conversations", "conversations.id", "runs.conversation_id")
|
|
119
|
+
.innerJoin("orgs", "orgs.id", "conversations.org_id")
|
|
120
|
+
.select("runs.status")
|
|
121
|
+
.where("runs.id", "=", binding.runId)
|
|
122
|
+
.where("conversations.org_id", "=", binding.orgId)
|
|
123
|
+
.where("orgs.deleted_at", "is", null)
|
|
124
|
+
.executeTakeFirst();
|
|
125
|
+
if (run === undefined)
|
|
126
|
+
return refuse("run not in org");
|
|
127
|
+
if (!ACTIVE_RUN_STATUSES.includes(run.status)) {
|
|
128
|
+
return refuse("run not active");
|
|
129
|
+
}
|
|
130
|
+
const member = await this.db
|
|
131
|
+
.selectFrom("memberships")
|
|
132
|
+
.innerJoin("accounts", "accounts.id", "memberships.account_id")
|
|
133
|
+
.select("memberships.account_id")
|
|
134
|
+
.where("memberships.org_id", "=", binding.orgId)
|
|
135
|
+
.where("memberships.account_id", "=", binding.accountId)
|
|
136
|
+
.where("accounts.status", "=", "active")
|
|
137
|
+
.executeTakeFirst();
|
|
138
|
+
if (member === undefined)
|
|
139
|
+
return refuse("not an active member");
|
|
140
|
+
const settings = await readOrgSettings(this.db.db, binding.orgId);
|
|
141
|
+
if (settings.gitGateway?.enabled === false)
|
|
142
|
+
return refuse("gateway off for the org");
|
|
143
|
+
return binding;
|
|
144
|
+
});
|
|
140
145
|
}
|
|
141
146
|
/**
|
|
142
147
|
* Deletes every ticket of the run (run end, abort, offboarding) in one Lua script, so a ticket
|
package/dist/http/app.js
CHANGED
|
@@ -7,7 +7,7 @@ import { ApiTokenService } from "../identity/api-tokens.js";
|
|
|
7
7
|
import { authenticateOrgUploader, authorizeSuperAdmin, } from "../identity/auth.guard.js";
|
|
8
8
|
import { SessionService } from "../identity/sessions.js";
|
|
9
9
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
10
|
-
import { withRequestScopeSlot } from "../infra/database/org-scope.js";
|
|
10
|
+
import { withOrgScope, withRequestScopeSlot } from "../infra/database/org-scope.js";
|
|
11
11
|
import { withLogContext } from "../log-context.js";
|
|
12
12
|
import { authorizeOrgAction } from "../orgs/org.guard.js";
|
|
13
13
|
import { redactPath } from "./error.filter.js";
|
|
@@ -158,8 +158,10 @@ export async function createHttpApp(opts, app) {
|
|
|
158
158
|
// the org admin role before the body (ruling P3-29): no one else makes the kernel buffer
|
|
159
159
|
// a package-sized body
|
|
160
160
|
const principal = await authenticateOrgUploader(req, services());
|
|
161
|
-
const orgId = req.params.orgId
|
|
162
|
-
|
|
161
|
+
const orgId = req.params.orgId;
|
|
162
|
+
if (!orgId)
|
|
163
|
+
throw new ApiError("org.not_found", "Organization not found");
|
|
164
|
+
await withOrgScope(orgId, () => authorizeOrgAction(app.get(KernelDb, { strict: false }).db, principal, orgId, "catalog.upload"));
|
|
163
165
|
}
|
|
164
166
|
catch (e) {
|
|
165
167
|
return sendError(reply, e, req.method, req.url);
|
|
@@ -3,6 +3,7 @@ import { SetupLock } from "../admin/setup-lock.js";
|
|
|
3
3
|
import type { AccountsTable } from "../db/kernel-schema.js";
|
|
4
4
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
5
5
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
6
|
+
import { OutboxService } from "../infra/outbox/outbox.service.js";
|
|
6
7
|
import { PermissionCeilingWrites } from "../sandbox/permission-ceiling-writes.js";
|
|
7
8
|
import { type AccountAvatar, type AccountView } from "./account-avatar.js";
|
|
8
9
|
import type { Preferences } from "./me.schemas.js";
|
|
@@ -73,7 +74,11 @@ export declare class AccountsService {
|
|
|
73
74
|
private readonly adminLock;
|
|
74
75
|
private readonly setupLock;
|
|
75
76
|
private readonly ceilings;
|
|
76
|
-
|
|
77
|
+
/** The owed stops of a disabled account's host services. */
|
|
78
|
+
private readonly outbox;
|
|
79
|
+
constructor(db: KernelDb, txHost: TransactionHost, adminLock: SuperAdminLock, setupLock: SetupLock, ceilings: PermissionCeilingWrites,
|
|
80
|
+
/** The owed stops of a disabled account's host services. */
|
|
81
|
+
outbox: Pick<OutboxService, "add">);
|
|
77
82
|
/** Checks the password length and hashes it (scrypt, slow): for callers that hash before their transaction opens. */
|
|
78
83
|
hashNewPassword(password: string): Promise<string>;
|
|
79
84
|
/**
|
|
@@ -11,11 +11,13 @@ import { randomUUID } from "node:crypto";
|
|
|
11
11
|
import { Inject, Injectable, Module } from "@nestjs/common";
|
|
12
12
|
import { sql } from "kysely";
|
|
13
13
|
import { SetupLock, SetupLockModule } from "../admin/setup-lock.js";
|
|
14
|
+
import { oweHostServicesStopOfAccount } from "../device-access/host-service-stop.js";
|
|
14
15
|
import { ApiError } from "../errors.js";
|
|
15
16
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
16
17
|
import { asPlatform } from "../infra/database/org-scope.js";
|
|
17
18
|
import { TransactionHost, withOrderedLocks } from "../infra/database/transaction-host.js";
|
|
18
19
|
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
20
|
+
import { OutboxService } from "../infra/outbox/outbox.service.js";
|
|
19
21
|
import { deletePushRegistrationsForSessions } from "../push/registration-cleanup.js";
|
|
20
22
|
import { PermissionCeilingWritesModule } from "../sandbox/permission-authority.module.js";
|
|
21
23
|
import { PermissionCeilingWrites } from "../sandbox/permission-ceiling-writes.js";
|
|
@@ -86,12 +88,16 @@ let AccountsService = class AccountsService {
|
|
|
86
88
|
adminLock;
|
|
87
89
|
setupLock;
|
|
88
90
|
ceilings;
|
|
89
|
-
|
|
91
|
+
outbox;
|
|
92
|
+
constructor(db, txHost, adminLock, setupLock, ceilings,
|
|
93
|
+
/** The owed stops of a disabled account's host services. */
|
|
94
|
+
outbox) {
|
|
90
95
|
this.db = db;
|
|
91
96
|
this.txHost = txHost;
|
|
92
97
|
this.adminLock = adminLock;
|
|
93
98
|
this.setupLock = setupLock;
|
|
94
99
|
this.ceilings = ceilings;
|
|
100
|
+
this.outbox = outbox;
|
|
95
101
|
}
|
|
96
102
|
/** Checks the password length and hashes it (scrypt, slow): for callers that hash before their transaction opens. */
|
|
97
103
|
async hashNewPassword(password) {
|
|
@@ -644,6 +650,8 @@ let AccountsService = class AccountsService {
|
|
|
644
650
|
revokedSessionIds = sessions.map((r) => r.id);
|
|
645
651
|
// a registration follows its session (push plan decision 3): a disabled account loses all
|
|
646
652
|
await deletePushRegistrationsForSessions(this.db.db, revokedSessionIds);
|
|
653
|
+
// its host services stop on every machine of theirs (local agents spec, call 5)
|
|
654
|
+
await oweHostServicesStopOfAccount(this.db.db, this.outbox, id);
|
|
647
655
|
}
|
|
648
656
|
return { account: toAccount(row), revokedSessionIds };
|
|
649
657
|
}
|
|
@@ -687,7 +695,8 @@ AccountsService = __decorate([
|
|
|
687
695
|
__param(1, Inject(TransactionHost)),
|
|
688
696
|
__param(2, Inject(SuperAdminLock)),
|
|
689
697
|
__param(3, Inject(SetupLock)),
|
|
690
|
-
__param(4, Inject(PermissionCeilingWrites))
|
|
698
|
+
__param(4, Inject(PermissionCeilingWrites)),
|
|
699
|
+
__param(5, Inject(OutboxService))
|
|
691
700
|
], AccountsService);
|
|
692
701
|
export { AccountsService };
|
|
693
702
|
/**
|
|
@@ -27,6 +27,7 @@ export const FutureIsoDate = z.iso
|
|
|
27
27
|
.refine((s) => new Date(s).getTime() > Date.now(), "must be in the future")
|
|
28
28
|
.transform((s) => new Date(s));
|
|
29
29
|
const PREFIX = { personal: "cap_pat_", service: "cap_svc_" };
|
|
30
|
+
const tokenTouchDue = sql `(last_used_at is null or last_used_at < now() - interval '5 minutes')`;
|
|
30
31
|
function toRecord(r) {
|
|
31
32
|
return {
|
|
32
33
|
id: r.id,
|
|
@@ -141,6 +142,7 @@ let ApiTokenService = class ApiTokenService {
|
|
|
141
142
|
const row = await this.db
|
|
142
143
|
.selectFrom("api_tokens")
|
|
143
144
|
.selectAll()
|
|
145
|
+
.select(tokenTouchDue.as("touch_due"))
|
|
144
146
|
.where("token_hash", "=", sha256Hex(token))
|
|
145
147
|
.where("kind", "=", kind)
|
|
146
148
|
.where("revoked_at", "is", null)
|
|
@@ -148,19 +150,18 @@ let ApiTokenService = class ApiTokenService {
|
|
|
148
150
|
.executeTakeFirst();
|
|
149
151
|
if (!row)
|
|
150
152
|
return null;
|
|
151
|
-
|
|
153
|
+
const record = toRecord(row);
|
|
154
|
+
// Skip the usual no-op write. The write also checks the deadline for concurrent callers.
|
|
155
|
+
if (!row.touch_due)
|
|
156
|
+
return record;
|
|
152
157
|
// org-filter: deployment-wide update by primary key of the token authenticated above.
|
|
153
158
|
const touched = await this.db
|
|
154
159
|
.updateTable("api_tokens")
|
|
155
160
|
.set({ last_used_at: sql `now()` })
|
|
156
161
|
.where("id", "=", row.id)
|
|
157
|
-
.where(
|
|
158
|
-
eb("last_used_at", "is", null),
|
|
159
|
-
eb("last_used_at", "<", sql `now() - interval '5 minutes'`),
|
|
160
|
-
]))
|
|
162
|
+
.where(tokenTouchDue)
|
|
161
163
|
.returning("last_used_at")
|
|
162
164
|
.executeTakeFirst();
|
|
163
|
-
const record = toRecord(row);
|
|
164
165
|
if (touched)
|
|
165
166
|
record.lastUsedAt = touched.last_used_at;
|
|
166
167
|
return record;
|
|
@@ -203,6 +203,10 @@ export declare const DEPLOYMENT_SETTINGS: z.ZodObject<{
|
|
|
203
203
|
}, z.core.$strict>>;
|
|
204
204
|
}, z.core.$strict>>;
|
|
205
205
|
}, z.core.$strict>>;
|
|
206
|
+
officialPublisherProof: z.ZodDefault<z.ZodEnum<{
|
|
207
|
+
"pin-only": "pin-only";
|
|
208
|
+
require: "require";
|
|
209
|
+
}>>;
|
|
206
210
|
priceCurrency: z.ZodDefault<z.ZodString>;
|
|
207
211
|
sandboxLimitOverrides: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
208
212
|
cpu: z.ZodOptional<z.ZodNumber>;
|
|
@@ -329,6 +333,10 @@ export declare const DEPLOYMENT_SETTINGS_PATCH: z.ZodObject<{
|
|
|
329
333
|
}, z.core.$strict>>;
|
|
330
334
|
}, z.core.$strict>>;
|
|
331
335
|
}, z.core.$strict>>>;
|
|
336
|
+
officialPublisherProof: z.ZodOptional<z.ZodEnum<{
|
|
337
|
+
"pin-only": "pin-only";
|
|
338
|
+
require: "require";
|
|
339
|
+
}>>;
|
|
332
340
|
priceCurrency: z.ZodOptional<z.ZodString>;
|
|
333
341
|
sandboxLimitOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodObject<{
|
|
334
342
|
cpu: z.ZodOptional<z.ZodNumber>;
|
|
@@ -542,7 +550,7 @@ export declare class SettingsService {
|
|
|
542
550
|
* `onlyNarrows` (an API token, the Platform tool): `devicesOutsideSandbox` may only turn it off,
|
|
543
551
|
* `devicesNetwork` may only narrow to the allowlist,
|
|
544
552
|
* `externalSharing` may only turn external sharing off, `shareMaxExpiryDays` may only decrease and
|
|
545
|
-
* `htmlRenderCdnAllowlist` may only shrink.
|
|
553
|
+
* `htmlRenderCdnAllowlist` may only shrink. Only a web session may choose pin-only publisher proof.
|
|
546
554
|
*/
|
|
547
555
|
update(patch: DeploymentSettingsPatch, actorAccountId: string, actorTokenId?: string,
|
|
548
556
|
/** Merged into the audit detail (the Platform tool's `via: "agent"`). */
|
|
@@ -11,6 +11,7 @@ import { EXTENSION_NAME_RE, narrowerProjectReach } from "@capybara-hq/plugin-sdk
|
|
|
11
11
|
import { Inject, Injectable, Optional } from "@nestjs/common";
|
|
12
12
|
import { z } from "zod";
|
|
13
13
|
import { applyPlatformAttributionPatch, PLATFORM_ATTRIBUTION_FIELDS, PLATFORM_ATTRIBUTION_PATCH, PLATFORM_ATTRIBUTION_SETTING, readStoredPlatformAttribution, resolvePlatformAttribution, } from "../attribution/platform-attribution.js";
|
|
14
|
+
import { OfficialPublisherProofMode, officialPublisherProofMode, } from "../catalog/publisher-policy.js";
|
|
14
15
|
import { productName } from "../config/product-name.js";
|
|
15
16
|
import { DEVICES_DEFAULT_PROVIDER_PATCH, DEVICES_DEFAULT_PROVIDER_SETTING, readPlatformDefaultProvider, } from "../devices/default-provider-setting.js";
|
|
16
17
|
import { ApiError } from "../errors.js";
|
|
@@ -208,6 +209,7 @@ export const DEPLOYMENT_SETTINGS = z.object({
|
|
|
208
209
|
runConcurrencyOverrides: z.record(z.string().min(1), z.number().int().positive()).default({}),
|
|
209
210
|
retention: StoredPlatformRetentionSchema.default(OFF_RETENTION),
|
|
210
211
|
modelBudgets: PlatformModelBudgetsSchema.default({}),
|
|
212
|
+
officialPublisherProof: OfficialPublisherProofMode.default("require"),
|
|
211
213
|
/** The currency of model prices used for cost estimates, without conversion. */
|
|
212
214
|
priceCurrency: PriceCurrency.default(DEFAULT_PRICE_CURRENCY),
|
|
213
215
|
/** 按组织覆盖沙箱 cpu / 内存(orgId → 覆盖,C19);只对之后新建的沙箱生效。组织管理员只读。 */
|
|
@@ -297,6 +299,7 @@ export const DEPLOYMENT_SETTINGS_PATCH = z
|
|
|
297
299
|
retention: PlatformRetentionSchema.partial().optional(),
|
|
298
300
|
confirmRetentionShortening: z.literal(true).optional(),
|
|
299
301
|
modelBudgets: PlatformModelBudgetsSchema.nullable().optional(),
|
|
302
|
+
officialPublisherProof: OfficialPublisherProofMode.optional(),
|
|
300
303
|
priceCurrency: PriceCurrency.optional(),
|
|
301
304
|
sandboxLimitOverrides: z
|
|
302
305
|
.record(z.string().min(1), SANDBOX_LIMIT_OVERRIDE.nullable())
|
|
@@ -793,7 +796,7 @@ let SettingsService = class SettingsService {
|
|
|
793
796
|
* `onlyNarrows` (an API token, the Platform tool): `devicesOutsideSandbox` may only turn it off,
|
|
794
797
|
* `devicesNetwork` may only narrow to the allowlist,
|
|
795
798
|
* `externalSharing` may only turn external sharing off, `shareMaxExpiryDays` may only decrease and
|
|
796
|
-
* `htmlRenderCdnAllowlist` may only shrink.
|
|
799
|
+
* `htmlRenderCdnAllowlist` may only shrink. Only a web session may choose pin-only publisher proof.
|
|
797
800
|
*/
|
|
798
801
|
async update(patch, actorAccountId, actorTokenId,
|
|
799
802
|
/** Merged into the audit detail (the Platform tool's `via: "agent"`). */
|
|
@@ -881,6 +884,14 @@ let SettingsService = class SettingsService {
|
|
|
881
884
|
}
|
|
882
885
|
if (patch.orgCreation !== undefined)
|
|
883
886
|
next.orgCreation = patch.orgCreation;
|
|
887
|
+
let officialPublisherProofPrevious;
|
|
888
|
+
if (patch.officialPublisherProof !== undefined) {
|
|
889
|
+
if (opts.onlyNarrows && patch.officialPublisherProof === "pin-only") {
|
|
890
|
+
throw new ApiError("deployment.publisher_policy_requires_session", "Switch to pin-only from the admin console in a super admin session");
|
|
891
|
+
}
|
|
892
|
+
officialPublisherProofPrevious = await officialPublisherProofMode(this.db.db);
|
|
893
|
+
next.officialPublisherProof = patch.officialPublisherProof;
|
|
894
|
+
}
|
|
884
895
|
if (patch.priceCurrency !== undefined)
|
|
885
896
|
next.priceCurrency = patch.priceCurrency;
|
|
886
897
|
if (patch.customConnectors !== undefined)
|
|
@@ -1006,6 +1017,9 @@ let SettingsService = class SettingsService {
|
|
|
1006
1017
|
(r.before.outsideSandbox.permission === "off" &&
|
|
1007
1018
|
r.after.outsideSandbox.permission === "allowed") ||
|
|
1008
1019
|
widened(r.before.network, r.after.network), reachTightened, r.after.allowedProfiles.value);
|
|
1020
|
+
// running outside the sandbox switched off closes the host gate on every device
|
|
1021
|
+
if (outsideOff)
|
|
1022
|
+
await this.ceilings.oweHostServiceStopsLocked({}, "platform");
|
|
1009
1023
|
if (reachChanged && !reachTightened)
|
|
1010
1024
|
await this.ceilings.invalidateProjectReachWideningLocked(r.before.projectReach.ceiling, r.after.projectReach.ceiling, r.after.allowedProfiles.value);
|
|
1011
1025
|
}
|
|
@@ -1071,6 +1085,7 @@ let SettingsService = class SettingsService {
|
|
|
1071
1085
|
detail: {
|
|
1072
1086
|
...patch,
|
|
1073
1087
|
...retentionAudit,
|
|
1088
|
+
...(officialPublisherProofPrevious !== undefined && { officialPublisherProofPrevious }),
|
|
1074
1089
|
...(deviceSandboxChange !== undefined && { deviceSandboxEffective: deviceSandboxChange }),
|
|
1075
1090
|
...auditDetail,
|
|
1076
1091
|
},
|
|
@@ -77,9 +77,14 @@ export declare class InboxItemsService {
|
|
|
77
77
|
*/
|
|
78
78
|
post(source: InboxSource, p: InboxPost, opts?: {
|
|
79
79
|
detail?: Record<string, unknown>;
|
|
80
|
+
resolved?: boolean;
|
|
80
81
|
}): Promise<{
|
|
81
82
|
itemId: string;
|
|
82
83
|
}>;
|
|
84
|
+
/** Checks the current recipient and permissions before a durable post is prepared or delivered. */
|
|
85
|
+
prepare(source: InboxSource, p: InboxPost): Promise<string | null>;
|
|
86
|
+
/** Resolves open posts of this exact plugin, recipient and post key. */
|
|
87
|
+
resolveForPostKey(plugin: string, orgId: string, accountId: string, postKey: string): Promise<void>;
|
|
83
88
|
/** The open items of (org, account, source, plugin) with `dedupe`, closed as `expired`. */
|
|
84
89
|
private sameKey;
|
|
85
90
|
/**
|