@capybara-hq/kernel 0.1.0-rc.121 → 0.1.0-rc.122
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/background/finish.d.ts +5 -1
- package/dist/background/finish.js +29 -18
- package/dist/background/launch.d.ts +0 -5
- package/dist/background/launch.js +1 -6
- package/dist/background/managed.js +1 -4
- package/dist/background/poll.job.d.ts +3 -25
- package/dist/background/poll.job.js +20 -112
- package/dist/background/render.d.ts +2 -8
- package/dist/background/render.js +3 -17
- package/dist/background/stop.d.ts +15 -16
- package/dist/background/stop.js +39 -76
- package/dist/background/store.d.ts +17 -45
- package/dist/background/store.js +60 -94
- package/dist/background/tasks.service.d.ts +2 -5
- package/dist/background/tasks.service.js +9 -20
- package/dist/background/wake.js +3 -2
- package/dist/catalog/admin-catalog.controller.d.ts +2 -18
- package/dist/catalog/admin-catalog.controller.js +2 -28
- package/dist/catalog/catalog-content.d.ts +1 -5
- package/dist/catalog/catalog-items.d.ts +2 -6
- package/dist/catalog/catalog-items.js +5 -26
- package/dist/catalog/catalog-scope.service.d.ts +1 -121
- package/dist/catalog/catalog-scope.service.js +12 -552
- package/dist/catalog/catalog.service.d.ts +4 -15
- package/dist/catalog/catalog.service.js +7 -35
- package/dist/catalog/job-ids.d.ts +0 -18
- package/dist/catalog/job-ids.js +0 -20
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/org-catalog.service.js +6 -20
- package/dist/catalog/org-plugin-uploads.controller.d.ts +4 -19
- package/dist/catalog/org-plugin-uploads.controller.js +6 -34
- package/dist/catalog/org-plugin-uploads.d.ts +3 -10
- package/dist/catalog/org-plugin-uploads.js +4 -18
- package/dist/catalog/org-plugin-uploads.schemas.js +0 -1
- package/dist/catalog/owned-items.d.ts +6 -11
- package/dist/catalog/owned-items.js +10 -20
- package/dist/catalog/ownership.d.ts +3 -29
- package/dist/catalog/ownership.js +4 -54
- package/dist/catalog/platform-components.d.ts +5 -11
- package/dist/catalog/platform-components.js +8 -15
- package/dist/catalog/plugin-import.d.ts +3 -42
- package/dist/catalog/plugin-import.js +26 -195
- package/dist/catalog/plugin-install.js +1 -6
- package/dist/catalog/plugin-package.d.ts +1 -0
- package/dist/catalog/plugin-package.js +5 -0
- package/dist/catalog/plugin-upgrade.d.ts +3 -26
- package/dist/catalog/plugin-upgrade.js +20 -103
- package/dist/catalog/request-rules.js +4 -6
- package/dist/catalog/scope-sync.js +2 -4
- package/dist/catalog/scope.d.ts +2 -5
- package/dist/channels/jobs.d.ts +3 -3
- package/dist/channels/jobs.js +4 -3
- package/dist/channels/outbound.d.ts +1 -0
- package/dist/channels/outbound.js +32 -8
- package/dist/config/load.d.ts +0 -25
- package/dist/config/load.js +0 -57
- package/dist/config/schema.js +2 -3
- package/dist/conversations/attachments.service.js +3 -5
- package/dist/conversations/conversations.service.d.ts +3 -3
- package/dist/conversations/conversations.service.js +3 -3
- package/dist/conversations/job-org.d.ts +3 -0
- package/dist/conversations/job-org.js +11 -0
- package/dist/conversations/prompt-suggestions.d.ts +2 -7
- package/dist/conversations/prompt-suggestions.js +29 -27
- package/dist/conversations/titles.d.ts +3 -4
- package/dist/conversations/titles.js +19 -30
- package/dist/db/kernel-schema.d.ts +6 -16
- package/dist/db/pool.js +7 -2
- package/dist/devices/devices.controller.d.ts +0 -5
- package/dist/devices/devices.controller.js +2 -20
- package/dist/devices/devices.service.d.ts +1 -17
- package/dist/devices/devices.service.js +0 -22
- package/dist/errors.d.ts +1 -5
- package/dist/errors.js +1 -5
- package/dist/evals/judge.d.ts +3 -0
- package/dist/evals/judge.js +1 -1
- package/dist/evals/run-replay.d.ts +1 -1
- package/dist/evals/run-replay.js +26 -29
- package/dist/evals/step-replay.d.ts +3 -1
- package/dist/evals/step-replay.js +10 -1
- package/dist/evals/worker.d.ts +3 -1
- package/dist/evals/worker.js +53 -21
- package/dist/extensions/deployment-config-store.js +18 -14
- package/dist/extensions/effective-config.d.ts +1 -5
- package/dist/extensions/effective-config.js +1 -5
- package/dist/extensions/hooks.d.ts +3 -1
- package/dist/extensions/hooks.js +7 -2
- package/dist/extensions/installs.d.ts +2 -14
- package/dist/extensions/installs.js +10 -32
- package/dist/extensions/org-config.d.ts +3 -4
- package/dist/extensions/org-config.js +3 -4
- package/dist/extensions/plugin-guides.d.ts +0 -1
- package/dist/extensions/plugin-guides.js +0 -1
- package/dist/extensions/plugin-icons.d.ts +0 -1
- package/dist/extensions/plugin-icons.js +0 -3
- package/dist/files/blob-sweep.job.d.ts +2 -11
- package/dist/files/blob-sweep.job.js +7 -21
- package/dist/files/hash-job.d.ts +5 -15
- package/dist/files/hash-job.js +14 -33
- package/dist/files/library-jobs.module.d.ts +1 -6
- package/dist/files/library-jobs.module.js +3 -9
- package/dist/identity/api-tokens.js +54 -40
- package/dist/identity/auth.guard.js +2 -2
- package/dist/identity/sessions.js +7 -3
- package/dist/identity/settings.js +5 -21
- package/dist/inbox/inbox.service.d.ts +2 -3
- package/dist/inbox/org-notices.d.ts +0 -14
- package/dist/inbox/platform-inbox.service.d.ts +1 -8
- package/dist/inbox/platform-inbox.service.js +2 -6
- package/dist/inbox/platform-notices.d.ts +3 -3
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -3
- package/dist/infra/database/database.module.js +2 -1
- package/dist/infra/database/org-scope.d.ts +5 -3
- package/dist/infra/database/org-scope.js +7 -1
- package/dist/infra/database/scoped-dialect.d.ts +3 -1
- package/dist/infra/database/scoped-dialect.js +17 -5
- package/dist/infra/events/kernel-events.d.ts +2 -0
- package/dist/infra/outbox/outbox.service.d.ts +2 -0
- package/dist/infra/outbox/outbox.service.js +10 -0
- package/dist/infra/outbox/registry.d.ts +0 -41
- package/dist/infra/outbox/registry.js +0 -37
- package/dist/models/embeddings.d.ts +0 -5
- package/dist/models/embeddings.js +28 -35
- package/dist/models/images.d.ts +3 -8
- package/dist/models/images.js +19 -37
- package/dist/models/purposes.d.ts +7 -2
- package/dist/models/purposes.js +16 -3
- package/dist/orgs/device-network-setting.d.ts +0 -44
- package/dist/orgs/device-network-setting.js +0 -83
- package/dist/orgs/invitations.service.js +34 -30
- package/dist/orgs/offboarding.d.ts +2 -2
- package/dist/orgs/offboarding.js +2 -2
- package/dist/orgs/orgs.service.d.ts +1 -1
- package/dist/orgs/orgs.service.js +19 -15
- package/dist/orgs/settings.service.d.ts +19 -14
- package/dist/orgs/settings.service.js +12 -37
- package/dist/platform/exclusions.js +0 -11
- package/dist/platform/ops/catalog-admin.ops.js +0 -8
- package/dist/platform/ops/devices.ops.js +0 -28
- package/dist/platform/ops/extensions-admin.ops.js +3 -3
- package/dist/platform/ops/inbox.ops.js +5 -22
- package/dist/platform/ops/org-plugins.ops.d.ts +1 -3
- package/dist/platform/ops/org-plugins.ops.js +11 -67
- package/dist/roles/worker.module.js +0 -9
- package/dist/runtime/hook-calls.d.ts +13 -6
- package/dist/runtime/hook-calls.js +26 -4
- package/dist/runtime/maintenance.d.ts +3 -12
- package/dist/runtime/maintenance.js +25 -55
- package/dist/runtime/model-call.d.ts +4 -2
- package/dist/runtime/model-call.js +59 -58
- package/dist/runtime/providers.d.ts +27 -1
- package/dist/runtime/providers.js +57 -0
- package/dist/runtime/run-jobs.d.ts +1 -1
- package/dist/runtime/run-processors.d.ts +3 -9
- package/dist/runtime/run-worker.d.ts +2 -0
- package/dist/runtime/run-worker.js +23 -8
- package/dist/runtime/subagents/deliveries.js +6 -1
- package/dist/runtime/subagents/dispatch.d.ts +3 -3
- package/dist/runtime/write-base.service.d.ts +2 -3
- package/dist/runtime/write-base.service.js +3 -5
- package/dist/sandbox/device-sandbox-settings.d.ts +38 -92
- package/dist/sandbox/device-sandbox-settings.js +19 -325
- package/dist/sandbox/jobs.d.ts +3 -14
- package/dist/sandbox/jobs.js +2 -20
- package/dist/sandbox/modes.d.ts +5 -45
- package/dist/sandbox/modes.js +3 -60
- package/dist/sandbox/operation-authority.js +0 -11
- package/dist/sandbox/operation-intents.d.ts +32 -9
- package/dist/sandbox/operation-intents.js +241 -32
- package/dist/sandbox/operation-intents.module.js +2 -1
- package/dist/sandbox/operation-reconcile.job.d.ts +9 -11
- package/dist/sandbox/operation-reconcile.job.js +119 -33
- package/dist/sandbox/operation-revoke.d.ts +20 -0
- package/dist/sandbox/operation-revoke.js +3 -0
- package/dist/sandbox/permission-ceiling-writes.d.ts +1 -2
- package/dist/sandbox/permission-ceiling-writes.js +3 -6
- package/dist/sandbox/permission-config-publication.d.ts +1 -28
- package/dist/sandbox/permission-config-publication.js +14 -211
- package/dist/sandbox/permission-facts.d.ts +4 -15
- package/dist/sandbox/permission-facts.js +7 -29
- package/dist/sandbox/permission-instance-writes.d.ts +1 -4
- package/dist/sandbox/permission-instance-writes.js +1 -55
- package/dist/sandbox/providers.d.ts +1 -6
- package/dist/sandbox/providers.js +1 -15
- package/dist/sandbox/review/classifier.js +12 -13
- package/dist/sandbox/sandbox.module.js +3 -6
- package/dist/sandbox/sandbox.service.d.ts +17 -123
- package/dist/sandbox/sandbox.service.js +239 -998
- package/dist/shares/liveness.d.ts +1 -2
- package/dist/shares/liveness.js +1 -2
- package/dist/shares/shares.module.d.ts +1 -2
- package/dist/shares/shares.module.js +2 -5
- package/dist/shares/shares.service.js +1 -2
- package/dist/tools/builtins/image/generate.js +7 -15
- package/dist/tools/builtins/sandbox/common.d.ts +0 -2
- package/dist/tools/builtins/sandbox/common.js +1 -27
- package/dist/tools/builtins/sandbox/task-list.js +10 -10
- package/dist/tools/builtins/sandbox/task-output.d.ts +3 -10
- package/dist/tools/builtins/sandbox/task-output.js +13 -83
- package/dist/tools/builtins/sandbox/task-stop.js +18 -22
- package/dist/tools/builtins/vision/read-image.js +9 -10
- package/dist/tools/builtins/web/extract.js +9 -10
- package/package.json +3 -3
- package/src/migrations/0206_retire_org_extension_uploads.sql +125 -0
- package/src/migrations/0207_confirm_device_instance_destruction.sql +25 -0
- package/src/migrations/0208_convert_stored_permission_settings.sql +189 -0
- package/dist/background/retire-legacy-tasks.job.d.ts +0 -57
- package/dist/background/retire-legacy-tasks.job.js +0 -149
- package/dist/catalog/owned-plugin-cleanup.d.ts +0 -47
- package/dist/catalog/owned-plugin-cleanup.js +0 -140
- package/dist/config/permission-migration.d.ts +0 -34
- package/dist/config/permission-migration.js +0 -115
- package/dist/devices/legacy-cleanup.job.d.ts +0 -34
- package/dist/devices/legacy-cleanup.job.js +0 -147
- package/dist/files/library-backfill.d.ts +0 -63
- package/dist/files/library-backfill.js +0 -143
- package/dist/infra/cli/permission-cutover.d.ts +0 -59
- package/dist/infra/cli/permission-cutover.js +0 -107
- package/dist/sandbox/cloud-permission-snapshot.d.ts +0 -159
- package/dist/sandbox/cloud-permission-snapshot.js +0 -430
- package/dist/sandbox/cloud-permission-snapshot.module.d.ts +0 -8
- package/dist/sandbox/cloud-permission-snapshot.module.js +0 -34
- package/dist/sandbox/legacy-retirement.d.ts +0 -284
- package/dist/sandbox/legacy-retirement.js +0 -1165
- package/dist/sandbox/legacy-retirement.module.d.ts +0 -8
- package/dist/sandbox/legacy-retirement.module.js +0 -25
- package/dist/shares/share-objects.d.ts +0 -47
- package/dist/shares/share-objects.js +0 -93
|
@@ -10,7 +10,6 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
10
10
|
import { Inject, Injectable } from "@nestjs/common";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import { AppearanceService } from "../../catalog/appearance.service.js";
|
|
13
|
-
import { CatalogScopeService } from "../../catalog/catalog-scope.service.js";
|
|
14
13
|
import { CatalogItemPathParams, OrgPluginInstallBody, PluginInstallPathParams, } from "../../catalog/org-catalog.schemas.js";
|
|
15
14
|
import { OrgCatalogService } from "../../catalog/org-catalog.service.js";
|
|
16
15
|
import { OrgExtensionParams } from "../../catalog/org-extension.schemas.js";
|
|
@@ -81,18 +80,16 @@ let OrgPluginsOperations = class OrgPluginsOperations {
|
|
|
81
80
|
orgCatalog;
|
|
82
81
|
uploads;
|
|
83
82
|
owned;
|
|
84
|
-
scope;
|
|
85
83
|
kdb;
|
|
86
84
|
appearance;
|
|
87
85
|
themes;
|
|
88
86
|
config;
|
|
89
|
-
constructor(registry, installer, orgCatalog, uploads, owned,
|
|
87
|
+
constructor(registry, installer, orgCatalog, uploads, owned, kdb, appearance, themes, config) {
|
|
90
88
|
this.registry = registry;
|
|
91
89
|
this.installer = installer;
|
|
92
90
|
this.orgCatalog = orgCatalog;
|
|
93
91
|
this.uploads = uploads;
|
|
94
92
|
this.owned = owned;
|
|
95
|
-
this.scope = scope;
|
|
96
93
|
this.kdb = kdb;
|
|
97
94
|
this.appearance = appearance;
|
|
98
95
|
this.themes = themes;
|
|
@@ -114,7 +111,7 @@ let OrgPluginsOperations = class OrgPluginsOperations {
|
|
|
114
111
|
async ownedItem(orgId, id) {
|
|
115
112
|
const row = await this.kdb.db
|
|
116
113
|
.selectFrom("catalog_items")
|
|
117
|
-
.select(["id", "name", "shareable"
|
|
114
|
+
.select(["id", "name", "shareable"])
|
|
118
115
|
.where("id", "=", id)
|
|
119
116
|
.where("owner_org_id", "=", orgId)
|
|
120
117
|
.where("deleted_at", "is", null)
|
|
@@ -169,7 +166,7 @@ let OrgPluginsOperations = class OrgPluginsOperations {
|
|
|
169
166
|
}),
|
|
170
167
|
defineOperation({
|
|
171
168
|
id: "plugins.upload",
|
|
172
|
-
description: "Stage a plugin package as this org's own upload (org admins): a .tgz plugin package of this conversation, e.g. one you packed in the sandbox and delivered with Deliver, passed as file: { fileId }; at most the deployment's package limit. Checks the whole plugin and stages it for 24 hours; returns what it brings and, for a new version of the org's own plugin, the update it applies. Nothing is added until the person confirms the upload on the web (Plugins page);
|
|
169
|
+
description: "Stage a plugin package as this org's own upload (org admins): a .tgz plugin package of this conversation, e.g. one you packed in the sandbox and delivered with Deliver, passed as file: { fileId }; at most the deployment's package limit. Checks the whole plugin and stages it for 24 hours; returns what it brings and, for a new version of the org's own plugin, the update it applies. Nothing is added until the person confirms the upload on the web (Plugins page); the upload accepts skills, templates and themes and refuses packages with extension and browser client code.",
|
|
173
170
|
input: z.object({ file: FileRefSchema }).strict(),
|
|
174
171
|
example: { file: { fileId: EXAMPLE_ID } },
|
|
175
172
|
authz: { orgAction: "catalog.upload" },
|
|
@@ -182,6 +179,10 @@ let OrgPluginsOperations = class OrgPluginsOperations {
|
|
|
182
179
|
code: "catalog.invalid_manifest",
|
|
183
180
|
next: "The package is not a valid plugin (the details list each problem); fix it, pack and deliver it again.",
|
|
184
181
|
},
|
|
182
|
+
{
|
|
183
|
+
code: "catalog.org_upload_code",
|
|
184
|
+
next: "Remove the extension and its browser client code before uploading, or ask a super admin to import the package on the platform.",
|
|
185
|
+
},
|
|
185
186
|
{
|
|
186
187
|
code: "catalog.custom_disabled",
|
|
187
188
|
next: "This deployment does not allow the org's own skills, agent templates or connector templates that the plugin brings; tell the person.",
|
|
@@ -279,10 +280,6 @@ let OrgPluginsOperations = class OrgPluginsOperations {
|
|
|
279
280
|
code: "catalog.item_not_found",
|
|
280
281
|
next: "Only the org's own uploaded plugins qualify; check the id with plugins.list (owner: this org).",
|
|
281
282
|
},
|
|
282
|
-
{
|
|
283
|
-
code: "catalog.item_pending",
|
|
284
|
-
next: "The plugin's first version waits for the super admin's confirmation; share it once it is confirmed.",
|
|
285
|
-
},
|
|
286
283
|
],
|
|
287
284
|
precheck: (i, ctx) => this.ownedPrecheck(ctx.orgId, i.itemId),
|
|
288
285
|
summary: async (i, ctx) => {
|
|
@@ -379,58 +376,6 @@ let OrgPluginsOperations = class OrgPluginsOperations {
|
|
|
379
376
|
return { deleted: input.itemId };
|
|
380
377
|
},
|
|
381
378
|
}),
|
|
382
|
-
defineOperation({
|
|
383
|
-
id: "plugins.withdraw-upload",
|
|
384
|
-
description: "Withdraw this org's upload of one of its plugins that waits for the super admin (org admins): a first version is removed (its name is free again); a new version's pending state is cleared and the current version keeps running.",
|
|
385
|
-
input: z.object({ itemId: OwnedId }).strict(),
|
|
386
|
-
example: { itemId: EXAMPLE_ID },
|
|
387
|
-
authz: { orgAction: "catalog.upload" },
|
|
388
|
-
mirrors: ["DELETE /api/v1/orgs/:orgId/owned-plugins/:id/pending"],
|
|
389
|
-
renames: { itemId: "id" },
|
|
390
|
-
confirm: "org",
|
|
391
|
-
errors: [
|
|
392
|
-
{
|
|
393
|
-
code: "catalog.item_not_found",
|
|
394
|
-
next: "Only the org's own uploaded plugins qualify; check the id with plugins.list (owner: this org).",
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
code: "extension.not_pending",
|
|
398
|
-
next: "Nothing of this plugin waits for the super admin; there is nothing to withdraw.",
|
|
399
|
-
},
|
|
400
|
-
],
|
|
401
|
-
precheck: async (i, ctx) => {
|
|
402
|
-
const row = await this.ownedItem(ctx.orgId, i.itemId);
|
|
403
|
-
if (row === null) {
|
|
404
|
-
return { ok: false, code: "catalog.item_not_found", message: "Catalog item not found" };
|
|
405
|
-
}
|
|
406
|
-
return row.awaiting_confirmation || row.pending_version !== null
|
|
407
|
-
? { ok: true }
|
|
408
|
-
: {
|
|
409
|
-
ok: false,
|
|
410
|
-
code: "extension.not_pending",
|
|
411
|
-
message: `Plugin ${row.name} has no upload waiting for the super admin`,
|
|
412
|
-
};
|
|
413
|
-
},
|
|
414
|
-
summary: async (i, ctx) => {
|
|
415
|
-
const row = await this.ownedItem(ctx.orgId, i.itemId);
|
|
416
|
-
const name = named(row?.name ?? i.itemId);
|
|
417
|
-
return row?.awaiting_confirmation
|
|
418
|
-
? {
|
|
419
|
-
zh: `撤回本组织插件「${name}」待确认的首个版本(插件随之移除)`,
|
|
420
|
-
en: `Withdraw the pending first version of the org's plugin "${name}" (the plugin is removed)`,
|
|
421
|
-
}
|
|
422
|
-
: {
|
|
423
|
-
zh: `撤回本组织插件「${name}」待确认的新版本 ${row?.pending_version ?? ""}`,
|
|
424
|
-
en: `Withdraw the pending new version ${row?.pending_version ?? ""} of the org's plugin "${name}"`,
|
|
425
|
-
};
|
|
426
|
-
},
|
|
427
|
-
run: async (input, ctx) => {
|
|
428
|
-
await this.scope.withdraw(ctx.orgId, ctx.actorAccountId, input.itemId, {
|
|
429
|
-
auditDetail: viaAgent("plugins.withdraw-upload", ctx),
|
|
430
|
-
});
|
|
431
|
-
return { withdrawn: input.itemId };
|
|
432
|
-
},
|
|
433
|
-
}),
|
|
434
379
|
defineOperation({
|
|
435
380
|
id: "plugins.apply-appearance",
|
|
436
381
|
description: "Apply a plugin's suggested appearance in this org (org admins; the Extensions page's \"Apply this plugin's appearance\" action), for a plugin whose extension is on here: in one step, its theme becomes the org's default theme (whether members may pick their own stays as it is) and each component it suggests replaces the built-in block of its slot (shell.brand, conversation.empty, conversation.composer.frame) in the org's arrangement. The card shows exactly what changes; a theme that is not on in the org refuses the whole call, a component that is not available is skipped.",
|
|
@@ -528,10 +473,9 @@ OrgPluginsOperations = __decorate([
|
|
|
528
473
|
__param(2, Inject(OrgCatalogService)),
|
|
529
474
|
__param(3, Inject(OrgPluginUploads)),
|
|
530
475
|
__param(4, Inject(OwnedItems)),
|
|
531
|
-
__param(5, Inject(
|
|
532
|
-
__param(6, Inject(
|
|
533
|
-
__param(7, Inject(
|
|
534
|
-
__param(8, Inject(
|
|
535
|
-
__param(9, Inject(KernelConfigService))
|
|
476
|
+
__param(5, Inject(KernelDb)),
|
|
477
|
+
__param(6, Inject(AppearanceService)),
|
|
478
|
+
__param(7, Inject(ThemesService)),
|
|
479
|
+
__param(8, Inject(KernelConfigService))
|
|
536
480
|
], OrgPluginsOperations);
|
|
537
481
|
export { OrgPluginsOperations };
|
|
@@ -9,7 +9,6 @@ import { Module } from "@nestjs/common";
|
|
|
9
9
|
import { AutomationFireModule } from "../automations/fire.js";
|
|
10
10
|
import { BackgroundModule } from "../background/background.module.js";
|
|
11
11
|
import { BackgroundTaskPollJob } from "../background/poll.job.js";
|
|
12
|
-
import { RetireLegacyTasksJob } from "../background/retire-legacy-tasks.job.js";
|
|
13
12
|
import { CatalogModule } from "../catalog/catalog.module.js";
|
|
14
13
|
import { CatalogJobs } from "../catalog/jobs.js";
|
|
15
14
|
import { PluginScopeWorkersModule } from "../catalog/scope-sync-workers.js";
|
|
@@ -25,7 +24,6 @@ import { PromptSuggestionsModule } from "../conversations/prompt-suggestions.js"
|
|
|
25
24
|
import { TitlesModule } from "../conversations/titles.js";
|
|
26
25
|
import { ConversationNoticeSweepJob, ConversationNoticesModule, } from "../device-access/conversation-notice-delivery.js";
|
|
27
26
|
import { DeviceSiteGrantsModule } from "../device-access/site-grants.module.js";
|
|
28
|
-
import { LegacySandboxCleanupJob } from "../devices/legacy-cleanup.job.js";
|
|
29
27
|
import { EvalWorkersModule } from "../evals/evals.module.js";
|
|
30
28
|
import { ExtensionsModule } from "../extensions/extensions.module.js";
|
|
31
29
|
import { PluginsReconcileJob } from "../extensions/lifecycle.js";
|
|
@@ -53,7 +51,6 @@ import { UsageReportModule } from "../runtime/usage-report.js";
|
|
|
53
51
|
import { SandboxSweepJobs } from "../sandbox/jobs.js";
|
|
54
52
|
import { LoopbackExpiryJob } from "../sandbox/loopback-expiry.job.js";
|
|
55
53
|
import { SandboxModule } from "../sandbox/sandbox.module.js";
|
|
56
|
-
import { ShareObjectsModule } from "../shares/share-objects.js";
|
|
57
54
|
import { ShareSweepJob } from "../shares/sweep.job.js";
|
|
58
55
|
import { StoragePurgeJob } from "../storage/purge.js";
|
|
59
56
|
import { StorageModule } from "../storage/storage.module.js";
|
|
@@ -121,8 +118,6 @@ let WorkerModule = WorkerModule_1 = class WorkerModule {
|
|
|
121
118
|
ChannelsModule,
|
|
122
119
|
// the automation scanner (`@LockedCron`) and the fire job's body
|
|
123
120
|
AutomationFireModule,
|
|
124
|
-
// the legacy share snapshot deletions the maintenance processor still runs
|
|
125
|
-
ShareObjectsModule,
|
|
126
121
|
// the owed conversation notices the sweep delivers
|
|
127
122
|
ConversationNoticesModule,
|
|
128
123
|
],
|
|
@@ -137,15 +132,11 @@ let WorkerModule = WorkerModule_1 = class WorkerModule {
|
|
|
137
132
|
FileLibraryKickoffJob,
|
|
138
133
|
StoragePurgeJob,
|
|
139
134
|
SandboxSweepJobs,
|
|
140
|
-
LegacySandboxCleanupJob,
|
|
141
135
|
BackgroundTaskPollJob,
|
|
142
136
|
// owed conversation notices to devices' services (close tabs on delete design §4.3)
|
|
143
137
|
ConversationNoticeSweepJob,
|
|
144
138
|
// loopback port grants past their 24 hours (browser loopback port grants design §4)
|
|
145
139
|
LoopbackExpiryJob,
|
|
146
|
-
// legacy retirement (permission runtime cutover 8.5): bounded, retryable; the sandbox
|
|
147
|
-
// service's inline gate holds without it
|
|
148
|
-
RetireLegacyTasksJob,
|
|
149
140
|
ToolJobs,
|
|
150
141
|
InitialPasswordCleanupJob,
|
|
151
142
|
// expired, unbound avatar uploads of accounts (account profile spec §5.3)
|
|
@@ -4,11 +4,10 @@ import type { EventPayload } from "../conversations/events.js";
|
|
|
4
4
|
import type { HookOutcome, HookRegistry } from "../extensions/hooks.js";
|
|
5
5
|
import type { audit } from "../identity/audit.js";
|
|
6
6
|
import type { StepLog } from "./step-log.js";
|
|
7
|
-
/** What the runtime needs from the host's hook registry
|
|
7
|
+
/** What the runtime needs from the host's hook registry. */
|
|
8
8
|
export type HookRunner = Pick<HookRegistry, "run" | "has">;
|
|
9
9
|
/**
|
|
10
|
-
* Kind of the conversation a run belongs to
|
|
11
|
-
* sub-agents spec §11), never for `eval`.
|
|
10
|
+
* Kind of the conversation a run belongs to. Eval requests carry organization scope.
|
|
12
11
|
*/
|
|
13
12
|
export type ConversationKindForHooks = "chat" | "eval" | "subagent";
|
|
14
13
|
/** A denial as `run()` returns it. */
|
|
@@ -16,9 +15,8 @@ export type HookDenial = Extract<HookOutcome, {
|
|
|
16
15
|
allowed: false;
|
|
17
16
|
}>;
|
|
18
17
|
/**
|
|
19
|
-
*
|
|
20
|
-
* a conversation
|
|
21
|
-
* scope carries `parent` (where it was dispatched from).
|
|
18
|
+
* Conversation identity for hooks. A sub-agent carries its dispatch site. Model requests outside
|
|
19
|
+
* a conversation use organization scope.
|
|
22
20
|
*/
|
|
23
21
|
export declare function hookScope(hooks: HookRunner | undefined, s: {
|
|
24
22
|
conversationKind?: ConversationKindForHooks;
|
|
@@ -85,6 +83,14 @@ export declare function imageDeniedAudit(call: Pick<ImageRequestHookPayload, "or
|
|
|
85
83
|
extension: string;
|
|
86
84
|
imagePurpose: string;
|
|
87
85
|
}, denial: HookDenial): AuditEntry;
|
|
86
|
+
/** The audit entry for an eval denial that has no replay conversation. */
|
|
87
|
+
export declare function evalDeniedAudit(at: {
|
|
88
|
+
orgId: string;
|
|
89
|
+
runId: string;
|
|
90
|
+
caseId: string;
|
|
91
|
+
resultId: string;
|
|
92
|
+
evaluation: "step" | "judge";
|
|
93
|
+
}, denial: HookDenial): AuditEntry;
|
|
88
94
|
/** Audit entry shape (the argument of `audit()`). */
|
|
89
95
|
export type AuditEntry = Parameters<typeof audit>[1];
|
|
90
96
|
/**
|
|
@@ -99,4 +105,5 @@ export declare function recordHookDenial(d: {
|
|
|
99
105
|
step: number;
|
|
100
106
|
attempt?: number;
|
|
101
107
|
callId?: string;
|
|
108
|
+
purpose?: "eval";
|
|
102
109
|
}): Promise<void>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* a conversation
|
|
4
|
-
* scope carries `parent` (where it was dispatched from).
|
|
2
|
+
* Conversation identity for hooks. A sub-agent carries its dispatch site. Model requests outside
|
|
3
|
+
* a conversation use organization scope.
|
|
5
4
|
*/
|
|
6
5
|
export function hookScope(hooks, s) {
|
|
7
6
|
if (!hooks || (s.conversationKind !== "chat" && s.conversationKind !== "subagent"))
|
|
@@ -174,6 +173,26 @@ export function imageDeniedAudit(call, denial) {
|
|
|
174
173
|
},
|
|
175
174
|
};
|
|
176
175
|
}
|
|
176
|
+
/** The audit entry for an eval denial that has no replay conversation. */
|
|
177
|
+
export function evalDeniedAudit(at, denial) {
|
|
178
|
+
const { orgId, resultId, runId, caseId, evaluation } = at;
|
|
179
|
+
return {
|
|
180
|
+
orgId,
|
|
181
|
+
action: "hook.denied",
|
|
182
|
+
target: resultId,
|
|
183
|
+
detail: {
|
|
184
|
+
runId,
|
|
185
|
+
caseId,
|
|
186
|
+
evaluation,
|
|
187
|
+
mount: "model.request",
|
|
188
|
+
purpose: "eval",
|
|
189
|
+
plugin: denial.plugin,
|
|
190
|
+
reason: denial.reason,
|
|
191
|
+
cause: denial.cause,
|
|
192
|
+
...denialAuditDetail(denial),
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
}
|
|
177
196
|
/**
|
|
178
197
|
* Writes a model request's `hook_denied` event and its audit entry in one transaction (the tool path
|
|
179
198
|
* writes them with the `tool_result` instead). Idempotent by idem key: a resumed run that finds the
|
|
@@ -183,7 +202,10 @@ export async function recordHookDenial(d, at, mount, denial, where) {
|
|
|
183
202
|
if (await d.eventLog.findByIdem(at.conversationId, at.idemKey))
|
|
184
203
|
return;
|
|
185
204
|
const event = hookDeniedEvent(at, mount, denial, where);
|
|
186
|
-
const
|
|
205
|
+
const entry = hookDeniedAudit(at, event.payload, denial);
|
|
206
|
+
if (where.purpose)
|
|
207
|
+
entry.detail = { ...entry.detail, purpose: where.purpose };
|
|
208
|
+
const written = await d.stepLog.appendAudited(at.conversationId, [event], entry);
|
|
187
209
|
if (written.length > 0) {
|
|
188
210
|
await d.eventLog.notify(at.conversationId, Math.max(...written.map((e) => e.seq)));
|
|
189
211
|
}
|
|
@@ -3,20 +3,16 @@ import type { Job, Worker } from "bullmq";
|
|
|
3
3
|
import { EventCoalescer } from "../automations/events/coalesce.js";
|
|
4
4
|
import { TriggerDispatcher } from "../automations/events/dispatcher.js";
|
|
5
5
|
import { AutomationFirer } from "../automations/fire.js";
|
|
6
|
-
import { OwnedPluginCleanup } from "../catalog/owned-plugin-cleanup.js";
|
|
7
6
|
import { ConversationNoticeDelivery } from "../device-access/conversation-notice-delivery.js";
|
|
8
7
|
import { BlobObjects } from "../files/blob-objects.js";
|
|
9
8
|
import { FileLibraryHashJob } from "../files/hash-job.js";
|
|
10
|
-
import { FileLibraryBackfill } from "../files/library-backfill.js";
|
|
11
9
|
import { ScheduledRuns } from "../infra/schedule/scheduled-runs.js";
|
|
12
10
|
import type { KernelLogger } from "../log.js";
|
|
13
11
|
import { DirectorySync } from "../orgs/directory-sync.js";
|
|
14
12
|
import { Offboarding } from "../orgs/offboarding.js";
|
|
15
|
-
import { CloudPermissionSnapshots } from "../sandbox/cloud-permission-snapshot.js";
|
|
16
13
|
import { LoopbackGrants } from "../sandbox/loopback-grants.js";
|
|
17
14
|
import { SandboxOperationReconcileJob } from "../sandbox/operation-reconcile.job.js";
|
|
18
15
|
import { SandboxService } from "../sandbox/sandbox.service.js";
|
|
19
|
-
import { ShareObjects } from "../shares/share-objects.js";
|
|
20
16
|
import { PlatformIconObjects } from "../themes/platform-icon-objects.js";
|
|
21
17
|
import { ToolDrift } from "../tools/drift.js";
|
|
22
18
|
import { PermissionApprovalJobs } from "../tools/permission-approval-jobs.js";
|
|
@@ -33,10 +29,9 @@ export declare const MAINTENANCE_CONCURRENCY = 5;
|
|
|
33
29
|
* `sandbox-reset-files` → {@link SandboxService}, `drift-connector` → {@link ToolDrift}, `directory-sync` →
|
|
34
30
|
* {@link DirectorySync}, `run-stop` → {@link Offboarding.stopRun}, `bg-wake` and `ensure-run` → {@link RunQueue.ensureRun}, `stop-tree` →
|
|
35
31
|
* {@link processStopTree} and `deliver-to-parent` → {@link processDeliverToParent} (both in
|
|
36
|
-
* runtime/subagents/tree-jobs.ts, over {@link Waits}), `
|
|
37
|
-
* {@link OwnedPluginCleanup}, `automation-fire` and `automation-settle` → {@link AutomationFirer}, `automation-coalesce` → {@link EventCoalescer}, `share-object-delete` → {@link ShareObjects}, `blob-delete`, `file-staging-delete` and `file-release` →
|
|
32
|
+
* runtime/subagents/tree-jobs.ts, over {@link Waits}), `automation-fire` and `automation-settle` → {@link AutomationFirer}, `automation-coalesce` → {@link EventCoalescer}, `blob-delete`, `file-staging-delete` and `file-release` →
|
|
38
33
|
* {@link BlobObjects}, `file-library-hash`, `file-library-hash-org` → {@link FileLibraryHashJob},
|
|
39
|
-
* `
|
|
34
|
+
* `platform-icon-delete` →
|
|
40
35
|
* {@link PlatformIconObjects}, `device-conversation-notice` → {@link ConversationNoticeDelivery},
|
|
41
36
|
* `idle-compaction` → {@link IdleCompactionJob}, `device-loopback-refresh` → {@link LoopbackGrants}). The name of a periodic job (a `@LockedCron` / `@LockedInterval` job,
|
|
42
37
|
* such as `sandbox-suspend-idle`) runs that job's body once ({@link ScheduledRuns.runNow}), as the
|
|
@@ -53,23 +48,19 @@ export declare class MaintenanceProcessor extends WorkerHost<Worker> {
|
|
|
53
48
|
private readonly deletion;
|
|
54
49
|
private readonly offboarding;
|
|
55
50
|
private readonly runs;
|
|
56
|
-
private readonly ownedCleanup;
|
|
57
51
|
private readonly automations;
|
|
58
52
|
private readonly scheduled;
|
|
59
53
|
private readonly log;
|
|
60
54
|
private readonly operations;
|
|
61
|
-
private readonly shareObjects;
|
|
62
55
|
private readonly blobObjects;
|
|
63
56
|
private readonly hashing;
|
|
64
|
-
private readonly backfill;
|
|
65
57
|
private readonly platformIcons;
|
|
66
58
|
private readonly notices;
|
|
67
59
|
private readonly triggers;
|
|
68
60
|
private readonly coalescer;
|
|
69
61
|
private readonly idleCompaction;
|
|
70
62
|
private readonly loopback;
|
|
71
|
-
|
|
72
|
-
constructor(permissionApprovals: Pick<PermissionApprovalJobs, "recheck">, waits: Pick<Waits, "processTimeout" | "childFinished" | "stopChildren" | "stopDescendantsOfStopped" | "stopTree">, sandbox: Pick<SandboxService, "destroyDevice" | "resetFileSystem" | "revokeDeadHolder">, drift: Pick<ToolDrift, "check">, directory: Pick<DirectorySync, "runSyncJob">, deletion: Pick<RunDeletion, "stopOrg" | "stopTree">, offboarding: Pick<Offboarding, "stopRun">, runs: Pick<RunQueue, "ensureRun">, ownedCleanup: Pick<OwnedPluginCleanup, "run">, automations: Pick<AutomationFirer, "fire" | "settle">, scheduled: Pick<ScheduledRuns, "runNow">, log: Pick<KernelLogger, "error" | "warn">, operations: Pick<SandboxOperationReconcileJob, "reconcile" | "revoke">, shareObjects: Pick<ShareObjects, "deleteObject">, blobObjects: Pick<BlobObjects, "deleteBlob" | "deleteStaging" | "releaseFile">, hashing: Pick<FileLibraryHashJob, "dispatch" | "runOrgBatch">, backfill: Pick<FileLibraryBackfill, "run">, platformIcons: Pick<PlatformIconObjects, "deleteObject">, notices: Pick<ConversationNoticeDelivery, "attempt">, triggers: Pick<TriggerDispatcher, "dispatch">, coalescer: Pick<EventCoalescer, "flush">, idleCompaction: Pick<IdleCompactionJob, "fire">, loopback: Pick<LoopbackGrants, "refresh">, snapshots?: Pick<CloudPermissionSnapshots, "reconcileDevice"> | undefined);
|
|
63
|
+
constructor(permissionApprovals: Pick<PermissionApprovalJobs, "recheck">, waits: Pick<Waits, "processTimeout" | "childFinished" | "stopChildren" | "stopDescendantsOfStopped" | "stopTree">, sandbox: Pick<SandboxService, "destroyDevice" | "resetFileSystem" | "revokeDeadHolder">, drift: Pick<ToolDrift, "check">, directory: Pick<DirectorySync, "runSyncJob">, deletion: Pick<RunDeletion, "stopOrg" | "stopTree">, offboarding: Pick<Offboarding, "stopRun">, runs: Pick<RunQueue, "ensureRun">, automations: Pick<AutomationFirer, "fire" | "settle">, scheduled: Pick<ScheduledRuns, "runNow">, log: Pick<KernelLogger, "error" | "warn">, operations: Pick<SandboxOperationReconcileJob, "reconcile" | "revoke" | "settleResumeProof">, blobObjects: Pick<BlobObjects, "deleteBlob" | "deleteStaging" | "releaseFile">, hashing: Pick<FileLibraryHashJob, "dispatch" | "runOrgBatch">, platformIcons: Pick<PlatformIconObjects, "deleteObject">, notices: Pick<ConversationNoticeDelivery, "attempt">, triggers: Pick<TriggerDispatcher, "dispatch">, coalescer: Pick<EventCoalescer, "flush">, idleCompaction: Pick<IdleCompactionJob, "fire">, loopback: Pick<LoopbackGrants, "refresh">);
|
|
73
64
|
process(job: Job, token?: string): Promise<void>;
|
|
74
65
|
/** Starts consuming (worker role, after the extensions loaded; built with `autorun: false`). */
|
|
75
66
|
start(): void;
|
|
@@ -8,21 +8,18 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
8
8
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
9
|
};
|
|
10
10
|
import { OnWorkerEvent, WorkerHost } from "@nestjs/bullmq";
|
|
11
|
-
import { Inject, Injectable, Module
|
|
11
|
+
import { Inject, Injectable, Module } from "@nestjs/common";
|
|
12
12
|
import { EventCoalescer } from "../automations/events/coalesce.js";
|
|
13
13
|
import { TriggerDispatcher, TriggerDispatchModule } from "../automations/events/dispatcher.js";
|
|
14
14
|
import { AutomationFireModule, AutomationFirer } from "../automations/fire.js";
|
|
15
15
|
import { AUTOMATION_COALESCE_JOB, AUTOMATION_FIRE_JOB, AUTOMATION_SETTLE_JOB, TRIGGER_DISPATCH_JOB, } from "../automations/job-ids.js";
|
|
16
16
|
import { BackgroundModule } from "../background/background.module.js";
|
|
17
17
|
import { BG_WAKE_JOB } from "../background/wake-rules.js";
|
|
18
|
-
import { OWNED_PLUGIN_CLEANUP_JOB } from "../catalog/job-ids.js";
|
|
19
|
-
import { OwnedPluginCleanup, OwnedPluginCleanupModule } from "../catalog/owned-plugin-cleanup.js";
|
|
20
18
|
import { EventLogModule } from "../conversations/event-log.js";
|
|
21
19
|
import { ConversationNoticeDelivery, ConversationNoticesModule, NOTICE_PROMPT_TIMEOUT_MS, } from "../device-access/conversation-notice-delivery.js";
|
|
22
20
|
import { CONVERSATION_NOTICE_JOB, } from "../device-access/conversation-notices.js";
|
|
23
21
|
import { BLOB_DELETE_JOB, BlobObjects, BlobObjectsModule, FILE_RELEASE_JOB, FILE_STAGING_DELETE_JOB, } from "../files/blob-objects.js";
|
|
24
22
|
import { FILE_LIBRARY_HASH_JOB, FILE_LIBRARY_HASH_ORG_JOB, FileLibraryHashJob, } from "../files/hash-job.js";
|
|
25
|
-
import { FILE_LIBRARY_BACKFILL_JOB, FileLibraryBackfill } from "../files/library-backfill.js";
|
|
26
23
|
import { FileLibraryJobsModule } from "../files/library-jobs.module.js";
|
|
27
24
|
import { configuredProcessor } from "../infra/queue/configured-processor.js";
|
|
28
25
|
import { QueueModule } from "../infra/queue/queue.module.js";
|
|
@@ -33,7 +30,6 @@ import { KERNEL_LOGGER } from "../infra/tokens.js";
|
|
|
33
30
|
import { DIRECTORY_SYNC_JOB, DirectorySync } from "../orgs/directory-sync.js";
|
|
34
31
|
import { Offboarding, RUN_STOP_JOB } from "../orgs/offboarding.js";
|
|
35
32
|
import { OrgsModule } from "../orgs/orgs.module.js";
|
|
36
|
-
import { CloudPermissionSnapshots } from "../sandbox/cloud-permission-snapshot.js";
|
|
37
33
|
import { runSandboxDestroyFor, runSandboxResetFiles, SANDBOX_DESTROY_FOR_JOB, SANDBOX_RESET_FILES_JOB, } from "../sandbox/jobs.js";
|
|
38
34
|
import { LOOPBACK_REFRESH_JOB, LOOPBACK_REFRESH_TIMEOUT_MS, } from "../sandbox/loopback-grant-records.js";
|
|
39
35
|
import { LoopbackGrants } from "../sandbox/loopback-grants.js";
|
|
@@ -42,7 +38,6 @@ import { SandboxOperationReconcileJob } from "../sandbox/operation-reconcile.job
|
|
|
42
38
|
import { PERMISSION_APPROVAL_RECHECK } from "../sandbox/permission-transitions.js";
|
|
43
39
|
import { SandboxModule } from "../sandbox/sandbox.module.js";
|
|
44
40
|
import { SandboxService } from "../sandbox/sandbox.service.js";
|
|
45
|
-
import { SHARE_OBJECT_DELETE_JOB, ShareObjects, ShareObjectsModule, } from "../shares/share-objects.js";
|
|
46
41
|
import { PLATFORM_ICON_DELETE_JOB, PlatformIconObjects, PlatformIconObjectsModule, } from "../themes/platform-icon-objects.js";
|
|
47
42
|
import { ToolDrift } from "../tools/drift.js";
|
|
48
43
|
import { DRIFT_CONNECTOR_JOB } from "../tools/job-ids.js";
|
|
@@ -65,10 +60,9 @@ export const MAINTENANCE_CONCURRENCY = 5;
|
|
|
65
60
|
* `sandbox-reset-files` → {@link SandboxService}, `drift-connector` → {@link ToolDrift}, `directory-sync` →
|
|
66
61
|
* {@link DirectorySync}, `run-stop` → {@link Offboarding.stopRun}, `bg-wake` and `ensure-run` → {@link RunQueue.ensureRun}, `stop-tree` →
|
|
67
62
|
* {@link processStopTree} and `deliver-to-parent` → {@link processDeliverToParent} (both in
|
|
68
|
-
* runtime/subagents/tree-jobs.ts, over {@link Waits}), `
|
|
69
|
-
* {@link OwnedPluginCleanup}, `automation-fire` and `automation-settle` → {@link AutomationFirer}, `automation-coalesce` → {@link EventCoalescer}, `share-object-delete` → {@link ShareObjects}, `blob-delete`, `file-staging-delete` and `file-release` →
|
|
63
|
+
* runtime/subagents/tree-jobs.ts, over {@link Waits}), `automation-fire` and `automation-settle` → {@link AutomationFirer}, `automation-coalesce` → {@link EventCoalescer}, `blob-delete`, `file-staging-delete` and `file-release` →
|
|
70
64
|
* {@link BlobObjects}, `file-library-hash`, `file-library-hash-org` → {@link FileLibraryHashJob},
|
|
71
|
-
* `
|
|
65
|
+
* `platform-icon-delete` →
|
|
72
66
|
* {@link PlatformIconObjects}, `device-conversation-notice` → {@link ConversationNoticeDelivery},
|
|
73
67
|
* `idle-compaction` → {@link IdleCompactionJob}, `device-loopback-refresh` → {@link LoopbackGrants}). The name of a periodic job (a `@LockedCron` / `@LockedInterval` job,
|
|
74
68
|
* such as `sandbox-suspend-idle`) runs that job's body once ({@link ScheduledRuns.runNow}), as the
|
|
@@ -85,23 +79,19 @@ let MaintenanceProcessor = class MaintenanceProcessor extends WorkerHost {
|
|
|
85
79
|
deletion;
|
|
86
80
|
offboarding;
|
|
87
81
|
runs;
|
|
88
|
-
ownedCleanup;
|
|
89
82
|
automations;
|
|
90
83
|
scheduled;
|
|
91
84
|
log;
|
|
92
85
|
operations;
|
|
93
|
-
shareObjects;
|
|
94
86
|
blobObjects;
|
|
95
87
|
hashing;
|
|
96
|
-
backfill;
|
|
97
88
|
platformIcons;
|
|
98
89
|
notices;
|
|
99
90
|
triggers;
|
|
100
91
|
coalescer;
|
|
101
92
|
idleCompaction;
|
|
102
93
|
loopback;
|
|
103
|
-
|
|
104
|
-
constructor(permissionApprovals, waits, sandbox, drift, directory, deletion, offboarding, runs, ownedCleanup, automations, scheduled, log, operations, shareObjects, blobObjects, hashing, backfill, platformIcons, notices, triggers, coalescer, idleCompaction, loopback, snapshots) {
|
|
94
|
+
constructor(permissionApprovals, waits, sandbox, drift, directory, deletion, offboarding, runs, automations, scheduled, log, operations, blobObjects, hashing, platformIcons, notices, triggers, coalescer, idleCompaction, loopback) {
|
|
105
95
|
super();
|
|
106
96
|
this.permissionApprovals = permissionApprovals;
|
|
107
97
|
this.waits = waits;
|
|
@@ -111,22 +101,18 @@ let MaintenanceProcessor = class MaintenanceProcessor extends WorkerHost {
|
|
|
111
101
|
this.deletion = deletion;
|
|
112
102
|
this.offboarding = offboarding;
|
|
113
103
|
this.runs = runs;
|
|
114
|
-
this.ownedCleanup = ownedCleanup;
|
|
115
104
|
this.automations = automations;
|
|
116
105
|
this.scheduled = scheduled;
|
|
117
106
|
this.log = log;
|
|
118
107
|
this.operations = operations;
|
|
119
|
-
this.shareObjects = shareObjects;
|
|
120
108
|
this.blobObjects = blobObjects;
|
|
121
109
|
this.hashing = hashing;
|
|
122
|
-
this.backfill = backfill;
|
|
123
110
|
this.platformIcons = platformIcons;
|
|
124
111
|
this.notices = notices;
|
|
125
112
|
this.triggers = triggers;
|
|
126
113
|
this.coalescer = coalescer;
|
|
127
114
|
this.idleCompaction = idleCompaction;
|
|
128
115
|
this.loopback = loopback;
|
|
129
|
-
this.snapshots = snapshots;
|
|
130
116
|
}
|
|
131
117
|
process(job, token) {
|
|
132
118
|
return runJob(MAINTENANCE_QUEUE_NAME, job, () => this.dispatch(job, token), {
|
|
@@ -145,9 +131,14 @@ let MaintenanceProcessor = class MaintenanceProcessor extends WorkerHost {
|
|
|
145
131
|
case OPERATION_RECONCILE:
|
|
146
132
|
await this.operations.reconcile(job.data.operationId);
|
|
147
133
|
return;
|
|
148
|
-
case OPERATION_REVOKE:
|
|
149
|
-
|
|
134
|
+
case OPERATION_REVOKE: {
|
|
135
|
+
const { orgId, operationId, attempt, proof, repair } = job.data;
|
|
136
|
+
if (proof && orgId)
|
|
137
|
+
await this.operations.settleResumeProof(orgId, operationId, proof, repair);
|
|
138
|
+
else
|
|
139
|
+
await this.operations.revoke(operationId, attempt ?? 0, orgId);
|
|
150
140
|
return;
|
|
141
|
+
}
|
|
151
142
|
// a crashed sandbox holder's intents, owed before its record was forgotten (B-1)
|
|
152
143
|
case HOLDER_REVOKE: {
|
|
153
144
|
const { deviceId, token } = job.data;
|
|
@@ -164,7 +155,7 @@ let MaintenanceProcessor = class MaintenanceProcessor extends WorkerHost {
|
|
|
164
155
|
await runSandboxDestroyFor(this.sandbox, this.log, job);
|
|
165
156
|
return;
|
|
166
157
|
case SANDBOX_RESET_FILES_JOB:
|
|
167
|
-
await runSandboxResetFiles(this.sandbox, job
|
|
158
|
+
await runSandboxResetFiles(this.sandbox, job);
|
|
168
159
|
return;
|
|
169
160
|
case DRIFT_CONNECTOR_JOB: {
|
|
170
161
|
const { orgId, connectorId, trigger } = job.data;
|
|
@@ -210,10 +201,6 @@ let MaintenanceProcessor = class MaintenanceProcessor extends WorkerHost {
|
|
|
210
201
|
case DELIVER_TO_PARENT_JOB:
|
|
211
202
|
await processDeliverToParent(this.waits, job.data);
|
|
212
203
|
return;
|
|
213
|
-
// a removed org-owned plugin's extension (plugin scope phase 3, P3-20)
|
|
214
|
-
case OWNED_PLUGIN_CLEANUP_JOB:
|
|
215
|
-
await this.ownedCleanup.run(job.data.itemId);
|
|
216
|
-
return;
|
|
217
204
|
// one task run of an automation (scheduled tasks spec §6)
|
|
218
205
|
case AUTOMATION_FIRE_JOB:
|
|
219
206
|
await this.automations.fire(job.data.taskRunId);
|
|
@@ -233,10 +220,6 @@ let MaintenanceProcessor = class MaintenanceProcessor extends WorkerHost {
|
|
|
233
220
|
case AUTOMATION_COALESCE_JOB:
|
|
234
221
|
await this.coalescer.flush(job.data);
|
|
235
222
|
return;
|
|
236
|
-
// a share snapshot a refresh or revoke stopped using (file sharing spec §2)
|
|
237
|
-
case SHARE_OBJECT_DELETE_JOB:
|
|
238
|
-
await this.shareObjects.deleteObject(job.data);
|
|
239
|
-
return;
|
|
240
223
|
// a blob nothing points at any more, or an upload's unused staging object (file library §3)
|
|
241
224
|
case BLOB_DELETE_JOB:
|
|
242
225
|
await this.blobObjects.deleteBlob(job.data);
|
|
@@ -254,10 +237,6 @@ let MaintenanceProcessor = class MaintenanceProcessor extends WorkerHost {
|
|
|
254
237
|
case FILE_LIBRARY_HASH_ORG_JOB:
|
|
255
238
|
await this.hashing.runOrgBatch(job.data);
|
|
256
239
|
return;
|
|
257
|
-
// the one-off catch-up of the file library's data copy after a deploy
|
|
258
|
-
case FILE_LIBRARY_BACKFILL_JOB:
|
|
259
|
-
await this.backfill.run();
|
|
260
|
-
return;
|
|
261
240
|
// a platform icon object no row names any more, or an upload's orphan check (§10.2.1)
|
|
262
241
|
case PLATFORM_ICON_DELETE_JOB:
|
|
263
242
|
await this.platformIcons.deleteObject(job.data);
|
|
@@ -310,23 +289,18 @@ MaintenanceProcessor = __decorate([
|
|
|
310
289
|
__param(5, Inject(RunDeletion)),
|
|
311
290
|
__param(6, Inject(Offboarding)),
|
|
312
291
|
__param(7, Inject(RunQueue)),
|
|
313
|
-
__param(8, Inject(
|
|
314
|
-
__param(9, Inject(
|
|
315
|
-
__param(10, Inject(
|
|
316
|
-
__param(11, Inject(
|
|
317
|
-
__param(12, Inject(
|
|
318
|
-
__param(13, Inject(
|
|
319
|
-
__param(14, Inject(
|
|
320
|
-
__param(15, Inject(
|
|
321
|
-
__param(16, Inject(
|
|
322
|
-
__param(17, Inject(
|
|
323
|
-
__param(18, Inject(
|
|
324
|
-
__param(19, Inject(
|
|
325
|
-
__param(20, Inject(EventCoalescer)),
|
|
326
|
-
__param(21, Inject(IdleCompactionJob)),
|
|
327
|
-
__param(22, Inject(LoopbackGrants)),
|
|
328
|
-
__param(23, Optional()),
|
|
329
|
-
__param(23, Inject(CloudPermissionSnapshots))
|
|
292
|
+
__param(8, Inject(AutomationFirer)),
|
|
293
|
+
__param(9, Inject(ScheduledRuns)),
|
|
294
|
+
__param(10, Inject(KERNEL_LOGGER)),
|
|
295
|
+
__param(11, Inject(SandboxOperationReconcileJob)),
|
|
296
|
+
__param(12, Inject(BlobObjects)),
|
|
297
|
+
__param(13, Inject(FileLibraryHashJob)),
|
|
298
|
+
__param(14, Inject(PlatformIconObjects)),
|
|
299
|
+
__param(15, Inject(ConversationNoticeDelivery)),
|
|
300
|
+
__param(16, Inject(TriggerDispatcher)),
|
|
301
|
+
__param(17, Inject(EventCoalescer)),
|
|
302
|
+
__param(18, Inject(IdleCompactionJob)),
|
|
303
|
+
__param(19, Inject(LoopbackGrants))
|
|
330
304
|
], MaintenanceProcessor);
|
|
331
305
|
export { MaintenanceProcessor };
|
|
332
306
|
/**
|
|
@@ -349,17 +323,13 @@ MaintenanceModule = __decorate([
|
|
|
349
323
|
SandboxModule,
|
|
350
324
|
ToolsModule,
|
|
351
325
|
OrgsModule,
|
|
352
|
-
// the removed org plugins' cleanup job (worker-only through this module)
|
|
353
|
-
OwnedPluginCleanupModule,
|
|
354
326
|
// the automation fire job and the scanner (worker-only through this module)
|
|
355
327
|
AutomationFireModule,
|
|
356
328
|
// the trigger event dispatch job (worker-only through this module)
|
|
357
329
|
TriggerDispatchModule,
|
|
358
|
-
// the share snapshot deletion
|
|
359
|
-
ShareObjectsModule,
|
|
360
330
|
// the file library's blob and staging object deletions
|
|
361
331
|
BlobObjectsModule,
|
|
362
|
-
// the file library's hashing
|
|
332
|
+
// the file library's hashing
|
|
363
333
|
FileLibraryJobsModule,
|
|
364
334
|
// the platform icon object deletion
|
|
365
335
|
PlatformIconObjectsModule,
|
|
@@ -17,7 +17,7 @@ import { type ConversationKindForHooks, type HookRunner } from "./hook-calls.js"
|
|
|
17
17
|
import type { SubagentParent } from "./loop.js";
|
|
18
18
|
import { MediaCache } from "./media-cache.js";
|
|
19
19
|
import { type PermissionContextFailureKind } from "./permission-context-errors.js";
|
|
20
|
-
import { type
|
|
20
|
+
import { type ProviderRegistry } from "./providers.js";
|
|
21
21
|
import type { StepLog } from "./step-log.js";
|
|
22
22
|
import { type WriteBaseReader } from "./write-base.js";
|
|
23
23
|
/** 单轮收尾的尾部提醒(模型可见,英文;spec 6 轮次额度收尾)。 */
|
|
@@ -121,6 +121,8 @@ export interface ModelStepDeps {
|
|
|
121
121
|
* `conversationKind: "chat"` on the step input.
|
|
122
122
|
*/
|
|
123
123
|
hooks?: HookRunner;
|
|
124
|
+
/** Model-request hooks retained separately when replay omits other hook mounts. */
|
|
125
|
+
modelRequestHooks?: HookRunner;
|
|
124
126
|
/**
|
|
125
127
|
* The request boundary of the recorded permission context (permission context replay spec B2):
|
|
126
128
|
* before each agent-history request construction, record (live) or feed (full-run replay) the
|
|
@@ -587,7 +589,7 @@ export declare function trustedUsage(usage: ModelUsage, model: string, log?: Pic
|
|
|
587
589
|
* The usage goes through {@link trustedUsage}, so a malformed `cacheWriteByTtl` never fails a call
|
|
588
590
|
* after the model replied.
|
|
589
591
|
*/
|
|
590
|
-
export declare function consumeModelStream(
|
|
592
|
+
export declare function consumeModelStream(stream: (signal: AbortSignal) => AsyncIterable<ModelStreamEvent>, model: string, idleMs: number, signal: AbortSignal, onDelta: (ev: Exclude<ModelStreamEvent, {
|
|
591
593
|
type: "message_complete";
|
|
592
594
|
}>) => void,
|
|
593
595
|
/** Where a dropped `cacheWriteByTtl` is reported. */
|