@capybara-hq/kernel 0.1.0-rc.135 → 0.1.0-rc.137
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/admin.module.js +3 -0
- package/dist/admin/audit-log.service.d.ts +96 -12
- package/dist/admin/audit-log.service.js +508 -44
- package/dist/admin/audit-targets.d.ts +17 -0
- package/dist/admin/audit-targets.js +84 -0
- package/dist/admin/audit.controller.d.ts +12 -9
- package/dist/admin/audit.controller.js +29 -8
- package/dist/admin/audit.schemas.d.ts +20 -4
- package/dist/admin/audit.schemas.js +42 -17
- package/dist/admin/health.service.d.ts +2 -2
- package/dist/admin/health.service.js +6 -2
- package/dist/agents/templates.js +3 -10
- package/dist/app.d.ts +3 -1
- package/dist/app.js +1 -0
- package/dist/automations/automations.service.js +4 -5
- package/dist/catalog/catalog-content.d.ts +1 -1
- package/dist/catalog/catalog-content.js +17 -22
- package/dist/catalog/catalog-items.d.ts +5 -10
- package/dist/catalog/catalog-items.js +27 -51
- package/dist/catalog/catalog-scope.service.d.ts +4 -2
- package/dist/catalog/catalog-scope.service.js +105 -141
- package/dist/catalog/catalog.module.js +2 -0
- package/dist/catalog/catalog.service.d.ts +3 -3
- package/dist/catalog/catalog.service.js +33 -8
- package/dist/catalog/cli.js +17 -0
- package/dist/catalog/component-promotion.js +8 -4
- package/dist/catalog/component-scope.service.d.ts +3 -1
- package/dist/catalog/component-scope.service.js +101 -140
- package/dist/catalog/component-state.d.ts +10 -8
- package/dist/catalog/component-state.js +42 -30
- package/dist/catalog/dependency-edges.d.ts +25 -0
- package/dist/catalog/dependency-edges.js +125 -0
- package/dist/catalog/install-status.d.ts +2 -3
- package/dist/catalog/install-status.js +2 -3
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/org-catalog.service.d.ts +3 -1
- package/dist/catalog/org-catalog.service.js +33 -94
- package/dist/catalog/org-intent.d.ts +43 -0
- package/dist/catalog/org-intent.js +184 -0
- package/dist/catalog/owned-items.d.ts +1 -1
- package/dist/catalog/owned-items.js +9 -29
- package/dist/catalog/ownership.d.ts +2 -3
- package/dist/catalog/ownership.js +10 -28
- package/dist/catalog/platform-components.d.ts +3 -1
- package/dist/catalog/platform-components.js +9 -1
- package/dist/catalog/plugin-import.js +12 -16
- package/dist/catalog/plugin-install.d.ts +3 -4
- package/dist/catalog/plugin-install.js +25 -49
- package/dist/catalog/plugin-upgrade.d.ts +2 -2
- package/dist/catalog/plugin-upgrade.js +18 -34
- package/dist/catalog/request-rules.js +20 -8
- package/dist/catalog/scope-orgs.js +2 -7
- package/dist/catalog/scope-state.d.ts +6 -6
- package/dist/catalog/scope-state.js +24 -43
- package/dist/catalog/scope-sync.d.ts +0 -2
- package/dist/catalog/scope-sync.js +11 -39
- package/dist/catalog/scope-writer.d.ts +78 -0
- package/dist/catalog/scope-writer.js +181 -0
- package/dist/catalog/unshare.js +8 -41
- package/dist/channels/connections.service.js +6 -6
- package/dist/channels/supervisor.js +3 -7
- package/dist/client/client-access.service.js +2 -12
- package/dist/config/schema.d.ts +6 -0
- package/dist/config/schema.js +29 -1
- package/dist/conversations/access.d.ts +15 -7
- package/dist/conversations/access.js +59 -10
- package/dist/conversations/conversation-agent.d.ts +18 -0
- package/dist/conversations/conversation-agent.js +23 -0
- package/dist/conversations/conversation-ref.d.ts +3 -2
- package/dist/conversations/conversation-ref.js +6 -1
- package/dist/conversations/conversations.controller.d.ts +28 -5
- package/dist/conversations/conversations.controller.js +99 -10
- package/dist/conversations/conversations.module.js +10 -0
- package/dist/conversations/conversations.schemas.d.ts +6 -0
- package/dist/conversations/conversations.schemas.js +15 -0
- package/dist/conversations/conversations.service.d.ts +125 -21
- package/dist/conversations/conversations.service.js +260 -90
- package/dist/conversations/event-log.d.ts +9 -1
- package/dist/conversations/event-log.js +2 -0
- package/dist/conversations/events.d.ts +57 -0
- package/dist/conversations/events.js +73 -1
- package/dist/conversations/external/external-calls.d.ts +75 -0
- package/dist/conversations/external/external-calls.js +91 -0
- package/dist/conversations/external/external-calls.processor.d.ts +45 -0
- package/dist/conversations/external/external-calls.processor.js +144 -0
- package/dist/conversations/external/external-conversations.service.d.ts +266 -0
- package/dist/conversations/external/external-conversations.service.js +1138 -0
- package/dist/conversations/external/external.schemas.d.ts +63 -0
- package/dist/conversations/external/external.schemas.js +52 -0
- package/dist/conversations/external/token.d.ts +6 -0
- package/dist/conversations/external/token.js +6 -0
- package/dist/conversations/permission-profile-store.d.ts +4 -1
- package/dist/conversations/permission-profiles.controller.d.ts +33 -9
- package/dist/conversations/permission-profiles.controller.js +86 -6
- package/dist/conversations/prompt-suggestions.js +2 -1
- package/dist/conversations/queue.js +2 -1
- package/dist/conversations/titles.js +4 -3
- package/dist/ctx/create-ctx.d.ts +9 -2
- package/dist/ctx/create-ctx.js +47 -62
- package/dist/ctx/guard-db.d.ts +6 -0
- package/dist/ctx/guard-db.js +55 -0
- package/dist/db/extension-handoff-schema.d.ts +1 -1
- package/dist/db/extension-handoff-schema.js +48 -10
- package/dist/db/extension-schema-transfer.js +5 -2
- package/dist/db/kernel-schema.d.ts +42 -5
- package/dist/device-access/host-services.d.ts +2 -2
- package/dist/device-access/host-services.js +8 -8
- package/dist/device-access/person-handles.d.ts +16 -7
- package/dist/device-access/person-handles.js +14 -9
- package/dist/devices/conversation-devices.d.ts +5 -0
- package/dist/devices/conversation-devices.js +16 -0
- package/dist/erasure/org-catalog.js +2 -2
- package/dist/erasure/org-rules.js +5 -0
- package/dist/errors.d.ts +34 -0
- package/dist/errors.js +34 -0
- package/dist/evals/snapshot.js +3 -1
- package/dist/evals/trajectory.service.d.ts +2 -2
- package/dist/evals/trajectory.service.js +11 -7
- package/dist/extensions/admin-ops.d.ts +9 -5
- package/dist/extensions/admin-ops.js +52 -8
- package/dist/extensions/admin-view.js +1 -4
- package/dist/extensions/bootstrap.js +4 -1
- package/dist/extensions/cli.js +1 -0
- package/dist/extensions/effective-config.js +1 -4
- package/dist/extensions/enabled.d.ts +23 -29
- package/dist/extensions/enabled.js +141 -62
- package/dist/extensions/extensions.module.js +3 -0
- package/dist/extensions/host.d.ts +71 -45
- package/dist/extensions/host.js +454 -128
- package/dist/extensions/installs.d.ts +9 -0
- package/dist/extensions/installs.js +23 -0
- package/dist/extensions/isolated/admission.d.ts +10 -0
- package/dist/extensions/isolated/admission.js +206 -0
- package/dist/extensions/isolated/authorization.d.ts +37 -0
- package/dist/extensions/isolated/authorization.js +146 -0
- package/dist/extensions/isolated/broker.d.ts +15 -0
- package/dist/extensions/isolated/broker.js +452 -0
- package/dist/extensions/isolated/child-protocol.d.ts +84 -0
- package/dist/extensions/isolated/child-protocol.js +21 -0
- package/dist/extensions/isolated/child-registration.d.ts +22 -0
- package/dist/extensions/isolated/child-registration.js +152 -0
- package/dist/extensions/isolated/child-session.d.ts +6 -0
- package/dist/extensions/isolated/child-session.js +343 -0
- package/dist/extensions/isolated/child-streams.d.ts +4 -0
- package/dist/extensions/isolated/child-streams.js +142 -0
- package/dist/extensions/isolated/child.d.ts +1 -0
- package/dist/extensions/isolated/child.js +10 -0
- package/dist/extensions/isolated/configured-package.d.ts +15 -0
- package/dist/extensions/isolated/configured-package.js +73 -0
- package/dist/extensions/isolated/lanes.d.ts +100 -0
- package/dist/extensions/isolated/lanes.js +699 -0
- package/dist/extensions/isolated/postgres-gate.d.ts +14 -0
- package/dist/extensions/isolated/postgres-gate.js +255 -0
- package/dist/extensions/isolated/revision.d.ts +32 -0
- package/dist/extensions/isolated/revision.js +358 -0
- package/dist/extensions/isolated/rpc-frame.d.ts +50 -0
- package/dist/extensions/isolated/rpc-frame.js +193 -0
- package/dist/extensions/isolated/rpc.d.ts +66 -0
- package/dist/extensions/isolated/rpc.js +314 -0
- package/dist/extensions/isolated/sandbox.d.ts +35 -0
- package/dist/extensions/isolated/sandbox.js +372 -0
- package/dist/extensions/isolated/tier.d.ts +6 -0
- package/dist/extensions/isolated/tier.js +45 -0
- package/dist/extensions/ledger.d.ts +1 -1
- package/dist/extensions/lifecycle-topics.d.ts +1 -0
- package/dist/extensions/lifecycle-topics.js +1 -0
- package/dist/extensions/lifecycle.d.ts +3 -1
- package/dist/extensions/lifecycle.js +32 -5
- package/dist/extensions/locks.d.ts +2 -0
- package/dist/extensions/locks.js +7 -0
- package/dist/extensions/org-config.d.ts +17 -27
- package/dist/extensions/org-config.js +114 -129
- package/dist/extensions/permission-view.d.ts +3 -1
- package/dist/extensions/permission-view.js +4 -1
- package/dist/extensions/plugin-guides.d.ts +5 -10
- package/dist/extensions/plugin-guides.js +18 -37
- package/dist/extensions/plugin-icons.d.ts +3 -21
- package/dist/extensions/plugin-icons.js +9 -44
- package/dist/extensions/plugin-items.d.ts +10 -30
- package/dist/extensions/plugin-items.js +32 -73
- package/dist/extensions/point-defaults.d.ts +13 -21
- package/dist/extensions/point-defaults.js +32 -72
- package/dist/extensions/point-serving.d.ts +56 -0
- package/dist/extensions/point-serving.js +120 -0
- package/dist/extensions/source-intent.d.ts +14 -0
- package/dist/extensions/source-intent.js +77 -0
- package/dist/inbox/inbox-items.service.d.ts +11 -0
- package/dist/inbox/inbox-items.service.js +39 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/infra/database/database.module.js +6 -1
- package/dist/infra/database/kernel-db.d.ts +3 -1
- package/dist/infra/database/kernel-db.js +4 -0
- package/dist/infra/outbox/registry.d.ts +70 -0
- package/dist/infra/outbox/registry.js +44 -0
- package/dist/infra/paging/paged-read.d.ts +56 -0
- package/dist/infra/paging/paged-read.js +78 -0
- package/dist/infra/queue/queue-names.d.ts +1 -1
- package/dist/infra/queue/queue-names.js +1 -0
- package/dist/kernel.d.ts +3 -2
- package/dist/kernel.js +21 -2
- package/dist/kernel.module.js +4 -0
- package/dist/lifecycle/kernel-lifecycle.d.ts +3 -1
- package/dist/lifecycle/kernel-lifecycle.js +22 -12
- package/dist/lifecycle/tokens.d.ts +8 -0
- package/dist/lifecycle/tokens.js +2 -0
- package/dist/orgs/directory-sync.js +1 -4
- package/dist/platform/exclusions.js +10 -0
- package/dist/platform/ops/admin.ops.js +14 -3
- package/dist/platform/ops/conversations.ops.d.ts +8 -1
- package/dist/platform/ops/conversations.ops.js +52 -14
- package/dist/platform/ops/orgs.ops.js +13 -3
- package/dist/plugin-reads/plugin-reads.service.js +4 -1
- package/dist/push/recipients.js +5 -2
- package/dist/retention/worker.js +2 -1
- package/dist/roles/worker-role.d.ts +3 -1
- package/dist/roles/worker-role.js +8 -2
- package/dist/roles/worker.module.js +3 -0
- package/dist/runtime/context/build.js +8 -0
- package/dist/runtime/context/compaction.js +7 -0
- package/dist/runtime/idle-arm.js +3 -1
- package/dist/runtime/idle-compaction.js +2 -1
- package/dist/runtime/run-finish.js +2 -1
- package/dist/runtime/run-jobs.js +2 -1
- package/dist/runtime/run-queue.js +4 -2
- package/dist/runtime/run-worker.js +5 -2
- package/dist/runtime/stream.js +10 -0
- package/dist/runtime/usage-report.js +2 -1
- package/dist/runtime/waits.js +2 -1
- package/dist/setup/setup-checks.service.js +3 -2
- package/dist/skills/usable.js +41 -30
- package/dist/themes/theme-state.js +3 -3
- package/dist/tools/approvals.service.js +6 -2
- package/dist/tools/builtins/skill-load.js +3 -2
- package/dist/tools/registry.d.ts +1 -1
- package/dist/tools/registry.js +1 -1
- package/dist/tools/tool-watch.service.js +3 -1
- package/package.json +3 -3
- package/src/migrations/0227_external_conversations.sql +33 -0
- package/src/migrations/0228_extension_org_switches.sql +56 -0
- package/src/migrations/0229_catalog_dependency_edges.sql +17 -0
- package/src/migrations/0230_audit_filter_idx.sql +18 -0
|
@@ -4,9 +4,12 @@ import type { core } from "zod";
|
|
|
4
4
|
import type { KernelAppOptions } from "../app.js";
|
|
5
5
|
import { TRIGGER_EVENTS_BACKEND } from "../automations/events/token.js";
|
|
6
6
|
import type { KernelConfig } from "../config/schema.js";
|
|
7
|
+
import type { ExternalConversationsBackend } from "../conversations/external/external-conversations.service.js";
|
|
8
|
+
import { EXTERNAL_CONVERSATIONS_BACKEND } from "../conversations/external/token.js";
|
|
7
9
|
import type { BusSubscriber } from "../ctx/bus.js";
|
|
8
10
|
import { type DeviceAccessBackend, type InboxBackend, type PluginReadsBackend, type Route, type TriggersBackend } from "../ctx/create-ctx.js";
|
|
9
11
|
import { ExtensionEffects } from "../ctx/durable-effects.service.js";
|
|
12
|
+
import { ExtensionEffectKeys } from "../ctx/durable-keys.js";
|
|
10
13
|
import { type ExtensionNetSeams } from "../ctx/net.js";
|
|
11
14
|
import type { Keyring } from "../ctx/secrets.js";
|
|
12
15
|
import { type ExtensionDbIdentity } from "../db/extension-db.js";
|
|
@@ -18,6 +21,7 @@ import { INBOX_ITEMS_BACKEND } from "../inbox/token.js";
|
|
|
18
21
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
19
22
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
20
23
|
import { LockService } from "../infra/lock/lock.service.js";
|
|
24
|
+
import { KERNEL_FIXTURE_TRUST, type KernelFixtureTrust } from "../lifecycle/tokens.js";
|
|
21
25
|
import type { KernelLogger } from "../log.js";
|
|
22
26
|
import { ModelEmbeddings } from "../models/embeddings.js";
|
|
23
27
|
import { ModelImages } from "../models/images.js";
|
|
@@ -34,6 +38,8 @@ import { HookRegistry } from "./hooks.js";
|
|
|
34
38
|
import type { InflightTracker } from "./inflight.js";
|
|
35
39
|
import { type DesiredExtension, ExtensionInstalls } from "./installs.js";
|
|
36
40
|
import { type ExtensionInstance } from "./instance.js";
|
|
41
|
+
import { type IsolatedRevocation } from "./isolated/authorization.js";
|
|
42
|
+
import type { ExtensionTier } from "./isolated/tier.js";
|
|
37
43
|
import { type PermissionSet } from "./permission-set.js";
|
|
38
44
|
import { type ExtensionPointEntry, ExtensionRegistry } from "./registry.js";
|
|
39
45
|
import { type ExtensionSource, ReplicaStatusStore } from "./sources.js";
|
|
@@ -58,6 +64,7 @@ export interface LoadedUiContribution {
|
|
|
58
64
|
export type { ExtensionPointEntry } from "./registry.js";
|
|
59
65
|
/** One item of {@link ExtensionHost.inspect}. */
|
|
60
66
|
export interface InspectedExtension {
|
|
67
|
+
isolated?: true;
|
|
61
68
|
/** Always `config`: the startup config `extensions` list. */
|
|
62
69
|
source: "config";
|
|
63
70
|
manifest: ExtensionManifest;
|
|
@@ -82,6 +89,7 @@ export declare function assertSecretsReachable(manifest: ExtensionManifest): voi
|
|
|
82
89
|
* extension must be ready).
|
|
83
90
|
*/
|
|
84
91
|
export interface InstalledExtensionLoader {
|
|
92
|
+
tier?(d: DesiredExtension, verifyBytes: boolean): Promise<ExtensionTier>;
|
|
85
93
|
desired(): Promise<DesiredExtension[]>;
|
|
86
94
|
sync(d: DesiredExtension): Promise<string>;
|
|
87
95
|
/**
|
|
@@ -116,7 +124,7 @@ export interface ExtensionLoadPlan {
|
|
|
116
124
|
/** 安装记录。 */
|
|
117
125
|
installs?: InstalledExtensionLoader;
|
|
118
126
|
}
|
|
119
|
-
/**
|
|
127
|
+
/** Resolves extensions and their configuration, runs migrations and registers capabilities. */
|
|
120
128
|
export declare class ExtensionHost {
|
|
121
129
|
/** The process's extension registry (one provider, shared with other domains). */
|
|
122
130
|
private readonly registry;
|
|
@@ -132,11 +140,27 @@ export declare class ExtensionHost {
|
|
|
132
140
|
private readonly status;
|
|
133
141
|
private readonly config;
|
|
134
142
|
private readonly log;
|
|
143
|
+
private readonly options;
|
|
135
144
|
/**
|
|
136
145
|
* Each hook call's effective config for its organization, and the providers excluded from an
|
|
137
146
|
* org's point resolution (layering spec A §6).
|
|
138
147
|
*/
|
|
139
148
|
private readonly effective;
|
|
149
|
+
/** `ctx.net`: the internal endpoints each org's extension requests may reach (read per call). */
|
|
150
|
+
private readonly allowances;
|
|
151
|
+
/**
|
|
152
|
+
* Finds `DeviceAccessService` (`ctx.deviceAccess`, {@link DEVICE_ACCESS_BACKEND}) at the time
|
|
153
|
+
* of use: its module imports the sandbox, devices and tools modules, which import this one (a
|
|
154
|
+
* module cycle otherwise).
|
|
155
|
+
* Absent (a hand-built host) or not found (the CLI): `ctx.deviceAccess` calls are refused.
|
|
156
|
+
* `TriggerEventsService` (`ctx.triggers`, {@link TRIGGER_EVENTS_BACKEND}) and
|
|
157
|
+
* `InboxItemsService` (`ctx.inbox`, {@link INBOX_ITEMS_BACKEND}) and `PluginReadsService`
|
|
158
|
+
* (`ctx.agents`, `ctx.conversations`, `ctx.people`, {@link PLUGIN_READS_BACKEND}) and
|
|
159
|
+
* `ExternalConversationsService` (`ctx.conversations`' external methods,
|
|
160
|
+
* {@link EXTERNAL_CONVERSATIONS_BACKEND}) and
|
|
161
|
+
* `ServiceEvents` (`ctx.devices.serviceEvent`, {@link SERVICE_EVENTS_BACKEND}) likewise.
|
|
162
|
+
*/
|
|
163
|
+
private readonly modules?;
|
|
140
164
|
private readonly dbIdentity;
|
|
141
165
|
/**
|
|
142
166
|
* Only resolves extensions and runs migrations in dependency order: no deployment config check, no
|
|
@@ -148,12 +172,15 @@ export declare class ExtensionHost {
|
|
|
148
172
|
* kernel migrations to have run (reads `extension_permission_snapshots`). With `autoApprove` all are
|
|
149
173
|
* migrated and no snapshot is written (`load()` writes snapshots).
|
|
150
174
|
*/
|
|
151
|
-
static migrateOnly(specifiers: string[], opts: {
|
|
175
|
+
static migrateOnly(specifiers: string[], opts: KernelFixtureTrust & {
|
|
152
176
|
dbUrl: string;
|
|
153
177
|
extensionIdentity?: ExtensionDbIdentity;
|
|
154
178
|
extensionProvisioning?: KernelConfig["db"];
|
|
155
179
|
resolveFrom?: string;
|
|
156
180
|
connectTimeoutMs?: number;
|
|
181
|
+
migrationTimeoutMs?: number;
|
|
182
|
+
packageCacheDir?: string;
|
|
183
|
+
maxPackageBytes?: number;
|
|
157
184
|
autoApprove?: boolean;
|
|
158
185
|
onPending?: (pending: PendingExtension[]) => void;
|
|
159
186
|
}): Promise<{
|
|
@@ -161,26 +188,29 @@ export declare class ExtensionHost {
|
|
|
161
188
|
schema: string;
|
|
162
189
|
applied: string[];
|
|
163
190
|
}[]>;
|
|
164
|
-
/**
|
|
165
|
-
|
|
166
|
-
* list): imports their modules only (the same modules `load()` imports next, from Node's module
|
|
167
|
-
* cache). The kernel passes them to the bootstrap step before loading, so a bootstrap entry of
|
|
168
|
-
* the same name is kept and gets no install record (config wins, C15).
|
|
169
|
-
*/
|
|
170
|
-
static declaredNames(specifiers: string[], opts?: {
|
|
191
|
+
/** Reads configured package identities for bootstrap without starting extension code. */
|
|
192
|
+
static declaredNames(specifiers: string[], opts?: KernelFixtureTrust & {
|
|
171
193
|
resolveFrom?: string;
|
|
194
|
+
maxPackageBytes?: number;
|
|
172
195
|
}): Promise<Set<string>>;
|
|
173
196
|
/**
|
|
174
197
|
* 只导入、校验并按依赖排序插件,计算各自的权限集合;不迁移、不调用 setup、不连数据库与 Redis
|
|
175
198
|
* (供 `capybara extensions review / approve`)。返回依赖拓扑序。
|
|
176
199
|
*/
|
|
177
|
-
static inspect(specifiers: string[], opts?: {
|
|
200
|
+
static inspect(specifiers: string[], opts?: KernelFixtureTrust & {
|
|
178
201
|
resolveFrom?: string;
|
|
202
|
+
maxPackageBytes?: number;
|
|
179
203
|
}): Promise<InspectedExtension[]>;
|
|
180
204
|
/**
|
|
181
205
|
* M-1: plugin → mount points where deployment state expects `policy` hooks. A per-replica copy of PG
|
|
182
206
|
* deployment state (like the registry), rebuilt on every load / converge, never written elsewhere.
|
|
183
207
|
*/
|
|
208
|
+
private readonly declaredIsolation;
|
|
209
|
+
private readonly quota;
|
|
210
|
+
private readonly isolatedAuthority;
|
|
211
|
+
private readonly isolatedLanes;
|
|
212
|
+
private readonly isolatedGrants;
|
|
213
|
+
private readonly executionTier;
|
|
184
214
|
private policyExpected;
|
|
185
215
|
/**
|
|
186
216
|
* Runs the hooks of this process's active plugin instances (resolved from the registry on every
|
|
@@ -279,7 +309,7 @@ export declare class ExtensionHost {
|
|
|
279
309
|
/** This replica's load status table (`extension_replica_status`): every load result writes a row. */
|
|
280
310
|
status: ReplicaStatusStore, config: KernelConfigService, kdb: KernelDb, redis: Redis, busSubscriber: BusSubscriber, keyring: Keyring, embedTokens: EmbedTokens,
|
|
281
311
|
/** `ctx.ui.verifyEmbedToken`: the live check of a share-scoped token (file sharing spec §7). */
|
|
282
|
-
shares: ShareLiveness, locks: LockService, log: KernelLogger, options: Pick<KernelAppOptions, "resolveFrom">,
|
|
312
|
+
shares: ShareLiveness, locks: LockService, log: KernelLogger, options: Pick<KernelAppOptions, "resolveFrom" | typeof KERNEL_FIXTURE_TRUST>,
|
|
283
313
|
/**
|
|
284
314
|
* Each hook call's effective config for its organization, and the providers excluded from an
|
|
285
315
|
* org's point resolution (layering spec A §6).
|
|
@@ -303,6 +333,8 @@ export declare class ExtensionHost {
|
|
|
303
333
|
* `TriggerEventsService` (`ctx.triggers`, {@link TRIGGER_EVENTS_BACKEND}) and
|
|
304
334
|
* `InboxItemsService` (`ctx.inbox`, {@link INBOX_ITEMS_BACKEND}) and `PluginReadsService`
|
|
305
335
|
* (`ctx.agents`, `ctx.conversations`, `ctx.people`, {@link PLUGIN_READS_BACKEND}) and
|
|
336
|
+
* `ExternalConversationsService` (`ctx.conversations`' external methods,
|
|
337
|
+
* {@link EXTERNAL_CONVERSATIONS_BACKEND}) and
|
|
306
338
|
* `ServiceEvents` (`ctx.devices.serviceEvent`, {@link SERVICE_EVENTS_BACKEND}) likewise.
|
|
307
339
|
*/
|
|
308
340
|
modules?: {
|
|
@@ -315,6 +347,9 @@ export declare class ExtensionHost {
|
|
|
315
347
|
get(token: typeof ExtensionEffects, opts: {
|
|
316
348
|
strict: false;
|
|
317
349
|
}): ExtensionEffects;
|
|
350
|
+
get(token: typeof ExtensionEffectKeys, opts: {
|
|
351
|
+
strict: false;
|
|
352
|
+
}): ExtensionEffectKeys;
|
|
318
353
|
get(token: typeof TRIGGER_EVENTS_BACKEND, opts: {
|
|
319
354
|
strict: false;
|
|
320
355
|
}): TriggersBackend;
|
|
@@ -324,7 +359,10 @@ export declare class ExtensionHost {
|
|
|
324
359
|
get(token: typeof PLUGIN_READS_BACKEND, opts: {
|
|
325
360
|
strict: false;
|
|
326
361
|
}): PluginReadsBackend;
|
|
327
|
-
|
|
362
|
+
get(token: typeof EXTERNAL_CONVERSATIONS_BACKEND, opts: {
|
|
363
|
+
strict: false;
|
|
364
|
+
}): ExternalConversationsBackend;
|
|
365
|
+
} | undefined,
|
|
328
366
|
/** Tests only: `ctx.net`'s DNS and dispatcher seams (`EXTENSION_NET_SEAMS`). */
|
|
329
367
|
netSeams?: ExtensionNetSeams, dbIdentity?: ExtensionDbIdentity);
|
|
330
368
|
/** The startup config's `extensionConfig` (file / Nacos merged with env). */
|
|
@@ -406,18 +444,13 @@ export declare class ExtensionHost {
|
|
|
406
444
|
private rawConfigOf;
|
|
407
445
|
/** 把一份已校验部署配置里的密钥值登记到日志打码。 */
|
|
408
446
|
private reportSecrets;
|
|
447
|
+
private tierOf;
|
|
409
448
|
/**
|
|
410
|
-
*
|
|
411
|
-
*
|
|
412
|
-
*
|
|
413
|
-
*
|
|
414
|
-
*
|
|
415
|
-
* 必需能力(此刻没有生效的提供方 → pending / dependency)、导入模块并核对静态清单(`import_failed` /
|
|
416
|
-
* `manifest_mismatch`;闸门放行之前不导入)、部署配置、
|
|
417
|
-
* 持锁迁移(busy → pending / migration)、setup,成功后登记新实例(先加载新、再撤销旧:旧实例在后台排空后撤销);
|
|
418
|
-
* 任何一步失败旧实例保留,记 failed(`migration_failed` / `setup_failed`)。
|
|
419
|
-
* 4. 运行中(非启动):对变了的能力做依赖方连锁(本轮刚加载的除外),此前因依赖卸下的插件随之补回。
|
|
420
|
-
* 返回启用的安装记录在静态清单里声明提供的能力(启动第 4 步据此判断待定还是缺提供方)。
|
|
449
|
+
* Reconciles enabled installs from PostgreSQL at startup and during convergence. It removes
|
|
450
|
+
* withdrawn revisions, verifies the tier, and prepares replacements in dependency order.
|
|
451
|
+
* Permission or dependency waits keep the same-tier serving revision. Import, migration and
|
|
452
|
+
* setup failures report the stage that failed. Successful replacements drain the old instance
|
|
453
|
+
* and changed providers trigger dependency reconciliation.
|
|
421
454
|
*/
|
|
422
455
|
private applyInstalls;
|
|
423
456
|
/**
|
|
@@ -450,7 +483,7 @@ export declare class ExtensionHost {
|
|
|
450
483
|
private logFailure;
|
|
451
484
|
/** 记下(替换同名的)待定插件,供 {@link pending} 列出。 */
|
|
452
485
|
private notePending;
|
|
453
|
-
/**
|
|
486
|
+
/** Removes an extension from the pending list. */
|
|
454
487
|
private dropPending;
|
|
455
488
|
/**
|
|
456
489
|
* 第 4 步:第 2 步挑出来的配置声明插件(`requires` 只能由安装记录满足)。与已加载的插件一起解析依赖:
|
|
@@ -459,6 +492,7 @@ export declare class ExtensionHost {
|
|
|
459
492
|
* 与「配置声明插件依赖待批准的配置声明插件」一致,内核照常启动;
|
|
460
493
|
* - 缺的能力没有任何提供方 → 与此前一样抛错(内核启动失败)。
|
|
461
494
|
*/
|
|
495
|
+
private declaredMigrationDirectory;
|
|
462
496
|
private loadDeferred;
|
|
463
497
|
/**
|
|
464
498
|
* Checks the config UI hints of a loaded module's deployment schema (spec §4.1). Invalid
|
|
@@ -481,10 +515,9 @@ export declare class ExtensionHost {
|
|
|
481
515
|
*/
|
|
482
516
|
private writeStatus;
|
|
483
517
|
/**
|
|
484
|
-
*
|
|
485
|
-
*
|
|
486
|
-
*
|
|
487
|
-
* 返回新登记的实例(没有加载时返回 undefined)。
|
|
518
|
+
* Admit a reviewed revision, resolve deployment config, migrate, and register it. Ineligible
|
|
519
|
+
* config leaves the extension pending. A same-tier replacement keeps the previous instance
|
|
520
|
+
* available until the new instance registers. Tier transitions drain before replacement.
|
|
488
521
|
*/
|
|
489
522
|
private activate;
|
|
490
523
|
/**
|
|
@@ -504,21 +537,14 @@ export declare class ExtensionHost {
|
|
|
504
537
|
* 与 unload / reload 串行。返回本次加载的插件名。
|
|
505
538
|
*/
|
|
506
539
|
activatePending(): Promise<string[]>;
|
|
540
|
+
revokeIsolatedInvocations(scope: IsolatedRevocation): void;
|
|
541
|
+
revalidateIsolatedInvocations(): Promise<void>;
|
|
507
542
|
/**
|
|
508
|
-
*
|
|
509
|
-
*
|
|
510
|
-
* 2. 安装记录按 PG 期望状态收敛(见 {@link applyInstalls}:停用 / 卸载的卸下,换包的先加载新再撤销旧,
|
|
511
|
-
* 失败的每次重试),之后做依赖方连锁;
|
|
512
|
-
* 3. 再试一次第 1 步(安装记录提供的能力可能放行了依赖它的配置声明插件)。
|
|
513
|
-
* 读不到安装记录时只做第 1 步并抛错(调用方记日志,下一个周期再来)。
|
|
543
|
+
* Publish approved policy expectations before doing work that might leave a handler temporarily
|
|
544
|
+
* unavailable. Re-read after activation, which may have persisted new permission approvals.
|
|
514
545
|
*/
|
|
515
546
|
converge(): Promise<void>;
|
|
516
|
-
/**
|
|
517
|
-
* Refreshes {@link policyExpected} from deployment state (M-1):
|
|
518
|
-
* config-declared plugins and enabled installs (`desired`) from their approved permission snapshot.
|
|
519
|
-
* `desired` undefined (install records unreadable) keeps the previous install entries.
|
|
520
|
-
* `shrinkOnly`: only remove entries (a plugin no longer desired or approved), never add new ones.
|
|
521
|
-
*/
|
|
547
|
+
/** Policy expectations follow approval and deployment state for every execution tier. */
|
|
522
548
|
private refreshPolicyExpectations;
|
|
523
549
|
/**
|
|
524
550
|
* Plugins that deployment state expects to run `policy` hooks on the mount point (M-1): enabled and
|
|
@@ -546,7 +572,7 @@ export declare class ExtensionHost {
|
|
|
546
572
|
/** 配置声明的插件名 → 来源(安装包不能与它们重名)。 */
|
|
547
573
|
declared(): Map<string, ExtensionSource>;
|
|
548
574
|
/**
|
|
549
|
-
* Extensions enabled in the org:
|
|
575
|
+
* Extensions enabled in the org: the org intent projection
|
|
550
576
|
* (required bootstrap plugins, builtin plugins' extensions; see `enabled.ts`); queried every
|
|
551
577
|
* time, not cached.
|
|
552
578
|
* Cost (M-4): hooks call this on every run, so one PG query per model attempt and per tool call.
|
|
@@ -557,15 +583,14 @@ export declare class ExtensionHost {
|
|
|
557
583
|
/**
|
|
558
584
|
* The access behind an extension's `ctx.extensionPoints`: only active instances in the registry
|
|
559
585
|
* (dependencies load in topological order, so the depended-on are ready first); org enablement is
|
|
560
|
-
* read from
|
|
586
|
+
* read from PostgreSQL every time, not cached. Resolved live on every call: once a
|
|
561
587
|
* provider is revoked it is no longer returned.
|
|
562
588
|
*/
|
|
563
589
|
private readonly extensionPointAccess;
|
|
564
590
|
private get loadDeps();
|
|
565
591
|
/**
|
|
566
|
-
*
|
|
567
|
-
*
|
|
568
|
-
* 配置声明的插件启动时不设时限(见 {@link load})。
|
|
592
|
+
* Build a new generation. Track its context during setup so shutdown can close it immediately.
|
|
593
|
+
* A reload deadline closes incomplete setup and any late instance that reaches registration.
|
|
569
594
|
*/
|
|
570
595
|
private setup;
|
|
571
596
|
/** Logs once per load what slot resolution left out or flagged (UI slots spec §3.2). */
|
|
@@ -712,6 +737,7 @@ export declare class ExtensionHost {
|
|
|
712
737
|
}): Promise<ExtensionInstance>;
|
|
713
738
|
/** 摘下并撤销一个实例(不做连锁);不在注册表时返回 undefined。 */
|
|
714
739
|
private doUnload;
|
|
740
|
+
private assertCurrentInstall;
|
|
715
741
|
/** 新建实例并原子替换、撤销旧实例(不做连锁)。 */
|
|
716
742
|
private doReload;
|
|
717
743
|
/** 生效实例按依赖拓扑排序(解析不了时退回注册表顺序)。 */
|