@capybara-hq/kernel 0.1.0-rc.105 → 0.1.0-rc.107
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.schemas.d.ts +3 -0
- package/dist/agents/agents.schemas.d.ts +9 -9
- package/dist/{schedules/schedules.controller.d.ts → automations/automations.controller.d.ts} +37 -32
- package/dist/{schedules/schedules.controller.js → automations/automations.controller.js} +68 -57
- package/dist/automations/automations.module.d.ts +16 -0
- package/dist/{schedules/schedules.module.js → automations/automations.module.js} +18 -15
- package/dist/{schedules/schedules.schemas.d.ts → automations/automations.schemas.d.ts} +151 -50
- package/dist/automations/automations.schemas.js +253 -0
- package/dist/{schedules/scheduled-tasks.service.d.ts → automations/automations.service.d.ts} +99 -52
- package/dist/{schedules/scheduled-tasks.service.js → automations/automations.service.js} +303 -134
- package/dist/{schedules → automations}/calendar.d.ts +8 -8
- package/dist/{schedules → automations}/calendar.js +2 -2
- package/dist/automations/effective-settings.d.ts +28 -0
- package/dist/automations/effective-settings.js +25 -0
- package/dist/automations/errors.d.ts +19 -0
- package/dist/automations/errors.js +19 -0
- package/dist/automations/events/coalesce.d.ts +28 -0
- package/dist/automations/events/coalesce.js +131 -0
- package/dist/automations/events/deadline.d.ts +10 -0
- package/dist/automations/events/deadline.js +24 -0
- package/dist/automations/events/dispatcher.d.ts +74 -0
- package/dist/automations/events/dispatcher.js +353 -0
- package/dist/automations/events/events.module.d.ts +7 -0
- package/dist/automations/events/events.module.js +26 -0
- package/dist/automations/events/guards.d.ts +32 -0
- package/dist/automations/events/guards.js +87 -0
- package/dist/automations/events/sweep.job.d.ts +49 -0
- package/dist/automations/events/sweep.job.js +202 -0
- package/dist/automations/events/token.d.ts +5 -0
- package/dist/automations/events/token.js +5 -0
- package/dist/automations/events/trigger-events.service.d.ts +47 -0
- package/dist/automations/events/trigger-events.service.js +254 -0
- package/dist/{schedules → automations}/fire.d.ts +57 -17
- package/dist/{schedules → automations}/fire.js +311 -79
- package/dist/{schedules → automations}/grant-rules.d.ts +1 -1
- package/dist/{schedules → automations}/grant-rules.js +5 -5
- package/dist/automations/job-ids.d.ts +113 -0
- package/dist/automations/job-ids.js +117 -0
- package/dist/{schedules → automations}/pause.d.ts +3 -3
- package/dist/{schedules → automations}/pause.js +3 -3
- package/dist/{schedules → automations}/run-tracker.d.ts +21 -10
- package/dist/{schedules → automations}/run-tracker.js +68 -56
- package/dist/{schedules → automations}/scan.job.d.ts +12 -8
- package/dist/{schedules → automations}/scan.job.js +39 -23
- package/dist/{schedules → automations}/schedule-math.d.ts +19 -12
- package/dist/{schedules → automations}/schedule-math.js +17 -7
- package/dist/{schedules → automations}/store.d.ts +57 -27
- package/dist/{schedules → automations}/store.js +102 -52
- package/dist/automations/store.module.d.ts +6 -0
- package/dist/{schedules → automations}/store.module.js +9 -9
- package/dist/automations/types.d.ts +178 -0
- package/dist/{schedules → automations}/unattended.d.ts +22 -11
- package/dist/{schedules → automations}/unattended.js +53 -30
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/channels/channels.module.js +7 -6
- package/dist/channels/file-delivery.d.ts +26 -11
- package/dist/channels/file-delivery.js +32 -11
- package/dist/channels/outbound.d.ts +8 -8
- package/dist/channels/outbound.js +32 -30
- package/dist/channels/threads.d.ts +1 -1
- package/dist/channels/threads.js +1 -1
- package/dist/config/schema.d.ts +8 -1
- package/dist/config/schema.js +56 -6
- package/dist/conversations/approval-profile.d.ts +2 -2
- package/dist/conversations/approval-profile.js +3 -3
- package/dist/conversations/artifacts.d.ts +20 -17
- package/dist/conversations/artifacts.js +30 -37
- package/dist/conversations/attachments.controller.d.ts +6 -19
- package/dist/conversations/attachments.controller.js +8 -59
- package/dist/conversations/attachments.service.d.ts +30 -74
- package/dist/conversations/attachments.service.js +51 -193
- package/dist/conversations/conversations.controller.d.ts +7 -1
- package/dist/conversations/conversations.controller.js +26 -10
- package/dist/conversations/conversations.module.js +4 -0
- package/dist/conversations/conversations.service.d.ts +112 -35
- package/dist/conversations/conversations.service.js +160 -43
- package/dist/conversations/event-log.d.ts +1 -0
- package/dist/conversations/events.d.ts +95 -27
- package/dist/conversations/events.js +108 -10
- package/dist/conversations/files.d.ts +66 -64
- package/dist/conversations/files.js +127 -147
- package/dist/conversations/message-context.d.ts +2 -2
- package/dist/conversations/message-context.js +1 -1
- package/dist/conversations/permission-profile-store.d.ts +2 -1
- package/dist/conversations/permission-profiles.controller.d.ts +3 -0
- package/dist/conversations/permission-profiles.service.js +1 -1
- package/dist/conversations/prompt-suggestion-request.d.ts +1 -1
- package/dist/conversations/prompt-suggestion-request.js +4 -2
- package/dist/conversations/prompt-suggestions.d.ts +3 -3
- package/dist/conversations/prompt-suggestions.js +11 -10
- package/dist/conversations/queue.d.ts +7 -4
- package/dist/conversations/queue.js +6 -2
- package/dist/conversations/queue.service.d.ts +5 -5
- package/dist/conversations/queue.service.js +27 -16
- package/dist/ctx/create-ctx.d.ts +23 -2
- package/dist/ctx/create-ctx.js +78 -3
- package/dist/db/kernel-schema.d.ts +184 -27
- package/dist/devices/device-project-files.service.d.ts +88 -0
- package/dist/devices/device-project-files.service.js +249 -0
- package/dist/devices/device-projects.service.d.ts +40 -0
- package/dist/devices/device-projects.service.js +16 -13
- package/dist/devices/devices.controller.d.ts +9 -3
- package/dist/devices/devices.controller.js +27 -5
- package/dist/devices/devices.module.js +9 -1
- package/dist/devices/devices.schemas.js +6 -1
- package/dist/devices/dto.d.ts +15 -0
- package/dist/devices/dto.js +11 -0
- package/dist/devices/project-paths.d.ts +29 -0
- package/dist/devices/project-paths.js +66 -0
- package/dist/devices/project-rules.d.ts +5 -1
- package/dist/devices/project-rules.js +5 -1
- package/dist/errors.d.ts +53 -13
- package/dist/errors.js +53 -13
- package/dist/evals/canonical-json.d.ts +7 -0
- package/dist/evals/canonical-json.js +21 -0
- package/dist/evals/reconstruct.d.ts +10 -1
- package/dist/evals/reconstruct.js +20 -1
- package/dist/evals/recorded-tools.d.ts +0 -2
- package/dist/evals/recorded-tools.js +1 -16
- package/dist/evals/snapshot.d.ts +26 -3
- package/dist/evals/snapshot.js +110 -57
- package/dist/evals/worker.d.ts +4 -3
- package/dist/evals/worker.js +8 -4
- package/dist/extensions/host.d.ts +9 -2
- package/dist/extensions/host.js +12 -0
- package/dist/extensions/instance.d.ts +3 -1
- package/dist/extensions/instance.js +4 -0
- package/dist/extensions/ledger.d.ts +1 -1
- package/dist/extensions/permission-set.d.ts +17 -1
- package/dist/extensions/permission-set.js +13 -1
- package/dist/extensions/permission-view.d.ts +1 -1
- package/dist/extensions/permission-view.js +4 -1
- package/dist/files/blob-objects.d.ts +124 -0
- package/dist/files/blob-objects.js +341 -0
- package/dist/files/blob-sweep.job.d.ts +122 -0
- package/dist/files/blob-sweep.job.js +389 -0
- package/dist/files/blobs.service.d.ts +135 -0
- package/dist/files/blobs.service.js +300 -0
- package/dist/files/conversation-media.d.ts +41 -0
- package/dist/files/conversation-media.js +124 -0
- package/dist/files/deliveries.d.ts +64 -0
- package/dist/files/deliveries.js +156 -0
- package/dist/files/deliveries.module.d.ts +6 -0
- package/dist/files/deliveries.module.js +24 -0
- package/dist/files/draft-cleanup.job.d.ts +26 -0
- package/dist/files/draft-cleanup.job.js +93 -0
- package/dist/files/files.module.d.ts +1 -1
- package/dist/files/files.module.js +3 -2
- package/dist/files/hash-job.d.ts +127 -0
- package/dist/files/hash-job.js +447 -0
- package/dist/files/library-backfill.d.ts +63 -0
- package/dist/files/library-backfill.js +143 -0
- package/dist/files/library-files.service.d.ts +255 -0
- package/dist/files/library-files.service.js +883 -0
- package/dist/files/library-jobs.module.d.ts +8 -0
- package/dist/files/library-jobs.module.js +27 -0
- package/dist/files/library-query.d.ts +127 -0
- package/dist/files/library-query.js +322 -0
- package/dist/files/library-read.module.d.ts +9 -0
- package/dist/files/library-read.module.js +30 -0
- package/dist/files/library.controller.d.ts +77 -0
- package/dist/files/library.controller.js +235 -0
- package/dist/files/library.module.d.ts +9 -0
- package/dist/files/library.module.js +29 -0
- package/dist/files/library.schemas.d.ts +46 -0
- package/dist/files/library.schemas.js +49 -0
- package/dist/files/previewers.controller.d.ts +20 -0
- package/dist/files/previewers.controller.js +47 -0
- package/dist/files/previewers.d.ts +25 -11
- package/dist/files/previewers.js +43 -27
- package/dist/files/referenced-files.d.ts +150 -0
- package/dist/files/referenced-files.js +234 -0
- package/dist/git/gateway.js +2 -2
- package/dist/html/html-document.controller.d.ts +8 -1
- package/dist/html/html-document.controller.js +19 -1
- package/dist/html/html-document.service.d.ts +19 -4
- package/dist/html/html-document.service.js +43 -22
- package/dist/html/html-token.d.ts +10 -1
- package/dist/html/html-token.js +14 -0
- package/dist/html/html.module.js +8 -1
- package/dist/http/api.module.js +10 -5
- package/dist/http/request-signal.d.ts +8 -0
- package/dist/http/request-signal.js +14 -0
- package/dist/identity/settings.d.ts +26 -0
- package/dist/identity/settings.js +33 -2
- package/dist/inbox/inbox.module.js +2 -2
- package/dist/inbox/inbox.service.d.ts +8 -8
- package/dist/inbox/inbox.service.js +7 -7
- package/dist/infra/config/kernel-config.service.js +10 -5
- package/dist/infra/outbox/registry.d.ts +111 -2
- package/dist/infra/outbox/registry.js +104 -9
- package/dist/infra/throttler/named-throttlers.d.ts +2 -0
- package/dist/infra/throttler/named-throttlers.js +14 -0
- package/dist/kernel.module.js +3 -0
- package/dist/lifecycle/kernel-lifecycle.js +6 -0
- package/dist/models/purposes.js +1 -1
- package/dist/orgs/offboarding.js +1 -1
- package/dist/orgs/roles.d.ts +1 -1
- package/dist/orgs/roles.js +3 -3
- package/dist/orgs/settings.controller.d.ts +1 -1
- package/dist/orgs/settings.service.d.ts +75 -13
- package/dist/orgs/settings.service.js +104 -26
- package/dist/platform/exclusions.js +45 -8
- package/dist/platform/file-ref.d.ts +18 -3
- package/dist/platform/file-ref.js +22 -11
- package/dist/platform/operation.js +6 -2
- package/dist/platform/ops/admin.ops.js +5 -2
- package/dist/platform/ops/{schedules.ops.d.ts → automations.ops.d.ts} +4 -4
- package/dist/platform/ops/automations.ops.js +560 -0
- package/dist/platform/ops/devices.ops.d.ts +3 -1
- package/dist/platform/ops/devices.ops.js +77 -3
- package/dist/platform/ops/files.ops.d.ts +18 -0
- package/dist/platform/ops/files.ops.js +267 -0
- package/dist/platform/ops/inbox.ops.js +4 -4
- package/dist/platform/ops/org-settings.ops.js +6 -2
- package/dist/platform/ops/orgs.ops.js +2 -1
- package/dist/platform/ops/platform.ops.js +4 -4
- package/dist/platform/ops/shares.ops.js +2 -2
- package/dist/platform/platform-ops.module.d.ts +3 -2
- package/dist/platform/platform-ops.module.js +10 -5
- package/dist/platform/route-schemas.js +6 -3
- package/dist/push/jobs.d.ts +3 -3
- package/dist/push/jobs.js +2 -2
- package/dist/push/preferences.service.js +1 -1
- package/dist/push/push-owed.d.ts +3 -3
- package/dist/push/push-owed.js +6 -6
- package/dist/push/push.schemas.d.ts +4 -4
- package/dist/push/push.schemas.js +3 -3
- package/dist/push/recipients.d.ts +4 -4
- package/dist/push/recipients.js +23 -23
- package/dist/push/texts.d.ts +3 -3
- package/dist/push/texts.js +2 -2
- package/dist/push/triggers.d.ts +1 -1
- package/dist/roles/worker.module.js +18 -4
- package/dist/runtime/compaction-settings.service.d.ts +13 -1
- package/dist/runtime/compaction-settings.service.js +16 -1
- package/dist/runtime/compaction.service.d.ts +3 -1
- package/dist/runtime/compaction.service.js +3 -1
- package/dist/runtime/context/build.d.ts +24 -1
- package/dist/runtime/context/build.js +33 -11
- package/dist/runtime/context/cache-expiry.d.ts +31 -0
- package/dist/runtime/context/cache-expiry.js +60 -0
- package/dist/runtime/context/cache-ttl.d.ts +18 -0
- package/dist/runtime/context/cache-ttl.js +30 -0
- package/dist/runtime/context/compaction.d.ts +9 -2
- package/dist/runtime/context/compaction.js +64 -21
- package/dist/runtime/context/in-context-compaction.d.ts +156 -0
- package/dist/runtime/context/in-context-compaction.js +310 -0
- package/dist/runtime/context/run-context.d.ts +38 -0
- package/dist/runtime/context/run-context.js +54 -0
- package/dist/runtime/hook-calls.d.ts +2 -1
- package/dist/runtime/hook-calls.js +5 -2
- package/dist/runtime/maintenance.d.ts +16 -4
- package/dist/runtime/maintenance.js +79 -18
- package/dist/runtime/model-call.d.ts +34 -5
- package/dist/runtime/model-call.js +207 -22
- package/dist/runtime/providers.js +11 -1
- package/dist/runtime/run-finish.d.ts +4 -4
- package/dist/runtime/run-finish.js +3 -3
- package/dist/runtime/run-queue.js +12 -7
- package/dist/runtime/run-steps.d.ts +4 -2
- package/dist/runtime/run-steps.js +10 -5
- package/dist/runtime/run-worker.js +7 -1
- package/dist/runtime/runtime.module.js +6 -3
- package/dist/runtime/subagents/dispatch.js +11 -3
- package/dist/sandbox/browse-roots.d.ts +8 -0
- package/dist/sandbox/browse-roots.js +22 -0
- package/dist/sandbox/network-grants.d.ts +4 -4
- package/dist/sandbox/network-grants.js +7 -7
- package/dist/sandbox/operation-authority.d.ts +10 -3
- package/dist/sandbox/operation-authority.js +20 -10
- package/dist/sandbox/operation-intents.d.ts +3 -1
- package/dist/sandbox/operation-intents.js +11 -4
- package/dist/sandbox/permission-call-grants.js +2 -2
- package/dist/sandbox/permission-facts.js +1 -1
- package/dist/sandbox/review/classifier.d.ts +2 -2
- package/dist/sandbox/review/classifier.js +22 -11
- package/dist/sandbox/review/permission-candidate.d.ts +1 -1
- package/dist/sandbox/review/permission-candidate.js +1 -1
- package/dist/sandbox/sandbox.service.d.ts +15 -5
- package/dist/sandbox/sandbox.service.js +14 -8
- package/dist/shares/liveness.d.ts +26 -12
- package/dist/shares/liveness.js +79 -20
- package/dist/shares/revoke.d.ts +16 -11
- package/dist/shares/revoke.js +18 -14
- package/dist/shares/share-objects.d.ts +16 -21
- package/dist/shares/share-objects.js +25 -55
- package/dist/shares/share-open.service.d.ts +8 -4
- package/dist/shares/share-open.service.js +14 -11
- package/dist/shares/shares.controller.d.ts +16 -5
- package/dist/shares/shares.controller.js +39 -5
- package/dist/shares/shares.module.d.ts +4 -4
- package/dist/shares/shares.module.js +7 -6
- package/dist/shares/shares.schemas.d.ts +4 -0
- package/dist/shares/shares.schemas.js +2 -0
- package/dist/shares/shares.service.d.ts +93 -54
- package/dist/shares/shares.service.js +292 -131
- package/dist/shares/sweep.job.d.ts +18 -39
- package/dist/shares/sweep.job.js +47 -206
- package/dist/storage/purge.d.ts +1 -1
- package/dist/storage/purge.js +2 -2
- package/dist/tools/approvals.service.d.ts +6 -6
- package/dist/tools/approvals.service.js +19 -19
- package/dist/tools/builtin-names.d.ts +12 -12
- package/dist/tools/builtin-names.js +29 -29
- package/dist/tools/builtins/artifacts.d.ts +21 -13
- package/dist/tools/builtins/artifacts.js +81 -51
- package/dist/tools/builtins/{schedules.d.ts → automations.d.ts} +35 -33
- package/dist/tools/builtins/{schedules.js → automations.js} +236 -105
- package/dist/tools/builtins/builtin-tools.d.ts +15 -9
- package/dist/tools/builtins/builtin-tools.js +33 -22
- package/dist/tools/builtins/conversation-files.d.ts +23 -13
- package/dist/tools/builtins/conversation-files.js +62 -83
- package/dist/tools/builtins/image/generate.d.ts +7 -1
- package/dist/tools/builtins/image/generate.js +1 -1
- package/dist/tools/builtins/platform.js +1 -0
- package/dist/tools/builtins/sandbox/common.d.ts +6 -2
- package/dist/tools/builtins/sandbox/deliver.js +6 -7
- package/dist/tools/builtins/sandbox/fetch-attachment.d.ts +6 -5
- package/dist/tools/builtins/sandbox/fetch-attachment.js +19 -12
- package/dist/tools/call-scope.d.ts +1 -1
- package/dist/tools/git-asks.js +1 -1
- package/dist/tools/git-push-policy.d.ts +3 -3
- package/dist/tools/git-push-policy.js +6 -6
- package/dist/tools/network-asks.d.ts +3 -3
- package/dist/tools/network-asks.js +3 -3
- package/dist/tools/pipeline.d.ts +4 -4
- package/dist/tools/pipeline.js +2 -2
- package/dist/tools/policy.d.ts +3 -3
- package/dist/tools/policy.js +3 -3
- package/dist/tools/tools.module.js +15 -9
- package/dist/ui/call-extension.d.ts +6 -4
- package/dist/ui/call-extension.js +5 -4
- package/dist/ui/embed-token.js +6 -3
- package/dist/ui/registry.d.ts +21 -5
- package/dist/ui/registry.js +24 -6
- package/dist/ui/ui.schemas.d.ts +22 -0
- package/dist/ui/ui.schemas.js +22 -4
- package/dist/ui/views.controller.d.ts +13 -3
- package/dist/ui/views.controller.js +33 -2
- package/dist/ui/views.d.ts +29 -1
- package/dist/ui/views.js +131 -7
- package/package.json +3 -3
- package/src/migrations/0188_automations_rename.sql +309 -0
- package/src/migrations/0189_event_automations.sql +136 -0
- package/src/migrations/0190_file_library.sql +285 -0
- package/src/migrations/0191_file_library_copy.sql +4 -0
- package/dist/platform/ops/schedules.ops.js +0 -509
- package/dist/schedules/effective-settings.d.ts +0 -22
- package/dist/schedules/effective-settings.js +0 -18
- package/dist/schedules/errors.d.ts +0 -8
- package/dist/schedules/errors.js +0 -8
- package/dist/schedules/job-ids.d.ts +0 -81
- package/dist/schedules/job-ids.js +0 -95
- package/dist/schedules/schedules.module.d.ts +0 -16
- package/dist/schedules/schedules.schemas.js +0 -213
- package/dist/schedules/store.module.d.ts +0 -6
- package/dist/schedules/types.d.ts +0 -110
- /package/dist/{schedules → automations}/types.js +0 -0
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { WorkerHost } from "@nestjs/bullmq";
|
|
2
2
|
import type { Job, Worker } from "bullmq";
|
|
3
|
+
import { EventCoalescer } from "../automations/events/coalesce.js";
|
|
4
|
+
import { TriggerDispatcher } from "../automations/events/dispatcher.js";
|
|
5
|
+
import { AutomationFirer } from "../automations/fire.js";
|
|
3
6
|
import { OwnedPluginCleanup } from "../catalog/owned-plugin-cleanup.js";
|
|
4
7
|
import { ConversationNoticeDelivery } from "../device-access/conversation-notice-delivery.js";
|
|
8
|
+
import { BlobObjects } from "../files/blob-objects.js";
|
|
9
|
+
import { FileLibraryHashJob } from "../files/hash-job.js";
|
|
10
|
+
import { FileLibraryBackfill } from "../files/library-backfill.js";
|
|
5
11
|
import { ScheduledRuns } from "../infra/schedule/scheduled-runs.js";
|
|
6
12
|
import type { KernelLogger } from "../log.js";
|
|
7
13
|
import { DirectorySync } from "../orgs/directory-sync.js";
|
|
@@ -9,7 +15,6 @@ import { Offboarding } from "../orgs/offboarding.js";
|
|
|
9
15
|
import { CloudPermissionSnapshots } from "../sandbox/cloud-permission-snapshot.js";
|
|
10
16
|
import { SandboxOperationReconcileJob } from "../sandbox/operation-reconcile.job.js";
|
|
11
17
|
import { SandboxService } from "../sandbox/sandbox.service.js";
|
|
12
|
-
import { ScheduledTaskFirer } from "../schedules/fire.js";
|
|
13
18
|
import { ShareObjects } from "../shares/share-objects.js";
|
|
14
19
|
import { PlatformIconObjects } from "../themes/platform-icon-objects.js";
|
|
15
20
|
import { ToolDrift } from "../tools/drift.js";
|
|
@@ -27,7 +32,9 @@ export declare const MAINTENANCE_CONCURRENCY = 5;
|
|
|
27
32
|
* {@link DirectorySync}, `run-stop` → {@link Offboarding.stopRun}, `bg-wake` and `ensure-run` → {@link RunQueue.ensureRun}, `stop-tree` →
|
|
28
33
|
* {@link processStopTree} and `deliver-to-parent` → {@link processDeliverToParent} (both in
|
|
29
34
|
* runtime/subagents/tree-jobs.ts, over {@link Waits}), `owned-plugin-cleanup` →
|
|
30
|
-
* {@link OwnedPluginCleanup}, `
|
|
35
|
+
* {@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` →
|
|
36
|
+
* {@link BlobObjects}, `file-library-hash`, `file-library-hash-org` → {@link FileLibraryHashJob},
|
|
37
|
+
* `file-library-backfill` → {@link FileLibraryBackfill}, `platform-icon-delete` →
|
|
31
38
|
* {@link PlatformIconObjects}, `device-conversation-notice` → {@link ConversationNoticeDelivery}). The name of a periodic job (a `@LockedCron` / `@LockedInterval` job,
|
|
32
39
|
* such as `sandbox-suspend-idle`) runs that job's body once ({@link ScheduledRuns.runNow}), as the
|
|
33
40
|
* maintenance handlers did when those jobs were schedulers on this queue: an operator's or a
|
|
@@ -44,15 +51,20 @@ export declare class MaintenanceProcessor extends WorkerHost<Worker> {
|
|
|
44
51
|
private readonly offboarding;
|
|
45
52
|
private readonly runs;
|
|
46
53
|
private readonly ownedCleanup;
|
|
47
|
-
private readonly
|
|
54
|
+
private readonly automations;
|
|
48
55
|
private readonly scheduled;
|
|
49
56
|
private readonly log;
|
|
50
57
|
private readonly operations;
|
|
51
58
|
private readonly shareObjects;
|
|
59
|
+
private readonly blobObjects;
|
|
60
|
+
private readonly hashing;
|
|
61
|
+
private readonly backfill;
|
|
52
62
|
private readonly platformIcons;
|
|
53
63
|
private readonly notices;
|
|
64
|
+
private readonly triggers;
|
|
65
|
+
private readonly coalescer;
|
|
54
66
|
private readonly snapshots?;
|
|
55
|
-
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">,
|
|
67
|
+
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">, snapshots?: Pick<CloudPermissionSnapshots, "reconcileDevice"> | undefined);
|
|
56
68
|
process(job: Job, token?: string): Promise<void>;
|
|
57
69
|
/** Starts consuming (worker role, after the extensions loaded; built with `autorun: false`). */
|
|
58
70
|
start(): void;
|
|
@@ -9,6 +9,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
9
9
|
};
|
|
10
10
|
import { OnWorkerEvent, WorkerHost } from "@nestjs/bullmq";
|
|
11
11
|
import { Inject, Injectable, Module, Optional } from "@nestjs/common";
|
|
12
|
+
import { EventCoalescer } from "../automations/events/coalesce.js";
|
|
13
|
+
import { TriggerDispatcher, TriggerDispatchModule } from "../automations/events/dispatcher.js";
|
|
14
|
+
import { AutomationFireModule, AutomationFirer } from "../automations/fire.js";
|
|
15
|
+
import { AUTOMATION_COALESCE_JOB, AUTOMATION_FIRE_JOB, AUTOMATION_SETTLE_JOB, TRIGGER_DISPATCH_JOB, } from "../automations/job-ids.js";
|
|
12
16
|
import { BackgroundModule } from "../background/background.module.js";
|
|
13
17
|
import { BG_WAKE_JOB } from "../background/wake-rules.js";
|
|
14
18
|
import { OWNED_PLUGIN_CLEANUP_JOB } from "../catalog/job-ids.js";
|
|
@@ -16,6 +20,10 @@ import { OwnedPluginCleanup, OwnedPluginCleanupModule } from "../catalog/owned-p
|
|
|
16
20
|
import { EventLogModule } from "../conversations/event-log.js";
|
|
17
21
|
import { ConversationNoticeDelivery, ConversationNoticesModule, NOTICE_PROMPT_TIMEOUT_MS, } from "../device-access/conversation-notice-delivery.js";
|
|
18
22
|
import { CONVERSATION_NOTICE_JOB, } from "../device-access/conversation-notices.js";
|
|
23
|
+
import { BLOB_DELETE_JOB, BlobObjects, BlobObjectsModule, FILE_RELEASE_JOB, FILE_STAGING_DELETE_JOB, } from "../files/blob-objects.js";
|
|
24
|
+
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
|
+
import { FileLibraryJobsModule } from "../files/library-jobs.module.js";
|
|
19
27
|
import { configuredProcessor } from "../infra/queue/configured-processor.js";
|
|
20
28
|
import { QueueModule } from "../infra/queue/queue.module.js";
|
|
21
29
|
import { runJob } from "../infra/queue/run-job.js";
|
|
@@ -32,8 +40,6 @@ import { SandboxOperationReconcileJob } from "../sandbox/operation-reconcile.job
|
|
|
32
40
|
import { PERMISSION_APPROVAL_RECHECK } from "../sandbox/permission-transitions.js";
|
|
33
41
|
import { SandboxModule } from "../sandbox/sandbox.module.js";
|
|
34
42
|
import { SandboxService } from "../sandbox/sandbox.service.js";
|
|
35
|
-
import { ScheduledTaskFireModule, ScheduledTaskFirer } from "../schedules/fire.js";
|
|
36
|
-
import { SCHED_FIRE_JOB, SCHED_SETTLE_JOB, } from "../schedules/job-ids.js";
|
|
37
43
|
import { SHARE_OBJECT_DELETE_JOB, ShareObjects, ShareObjectsModule, } from "../shares/share-objects.js";
|
|
38
44
|
import { PLATFORM_ICON_DELETE_JOB, PlatformIconObjects, PlatformIconObjectsModule, } from "../themes/platform-icon-objects.js";
|
|
39
45
|
import { ToolDrift } from "../tools/drift.js";
|
|
@@ -56,7 +62,9 @@ export const MAINTENANCE_CONCURRENCY = 5;
|
|
|
56
62
|
* {@link DirectorySync}, `run-stop` → {@link Offboarding.stopRun}, `bg-wake` and `ensure-run` → {@link RunQueue.ensureRun}, `stop-tree` →
|
|
57
63
|
* {@link processStopTree} and `deliver-to-parent` → {@link processDeliverToParent} (both in
|
|
58
64
|
* runtime/subagents/tree-jobs.ts, over {@link Waits}), `owned-plugin-cleanup` →
|
|
59
|
-
* {@link OwnedPluginCleanup}, `
|
|
65
|
+
* {@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` →
|
|
66
|
+
* {@link BlobObjects}, `file-library-hash`, `file-library-hash-org` → {@link FileLibraryHashJob},
|
|
67
|
+
* `file-library-backfill` → {@link FileLibraryBackfill}, `platform-icon-delete` →
|
|
60
68
|
* {@link PlatformIconObjects}, `device-conversation-notice` → {@link ConversationNoticeDelivery}). The name of a periodic job (a `@LockedCron` / `@LockedInterval` job,
|
|
61
69
|
* such as `sandbox-suspend-idle`) runs that job's body once ({@link ScheduledRuns.runNow}), as the
|
|
62
70
|
* maintenance handlers did when those jobs were schedulers on this queue: an operator's or a
|
|
@@ -73,15 +81,20 @@ let MaintenanceProcessor = class MaintenanceProcessor extends WorkerHost {
|
|
|
73
81
|
offboarding;
|
|
74
82
|
runs;
|
|
75
83
|
ownedCleanup;
|
|
76
|
-
|
|
84
|
+
automations;
|
|
77
85
|
scheduled;
|
|
78
86
|
log;
|
|
79
87
|
operations;
|
|
80
88
|
shareObjects;
|
|
89
|
+
blobObjects;
|
|
90
|
+
hashing;
|
|
91
|
+
backfill;
|
|
81
92
|
platformIcons;
|
|
82
93
|
notices;
|
|
94
|
+
triggers;
|
|
95
|
+
coalescer;
|
|
83
96
|
snapshots;
|
|
84
|
-
constructor(permissionApprovals, waits, sandbox, drift, directory, deletion, offboarding, runs, ownedCleanup,
|
|
97
|
+
constructor(permissionApprovals, waits, sandbox, drift, directory, deletion, offboarding, runs, ownedCleanup, automations, scheduled, log, operations, shareObjects, blobObjects, hashing, backfill, platformIcons, notices, triggers, coalescer, snapshots) {
|
|
85
98
|
super();
|
|
86
99
|
this.permissionApprovals = permissionApprovals;
|
|
87
100
|
this.waits = waits;
|
|
@@ -92,13 +105,18 @@ let MaintenanceProcessor = class MaintenanceProcessor extends WorkerHost {
|
|
|
92
105
|
this.offboarding = offboarding;
|
|
93
106
|
this.runs = runs;
|
|
94
107
|
this.ownedCleanup = ownedCleanup;
|
|
95
|
-
this.
|
|
108
|
+
this.automations = automations;
|
|
96
109
|
this.scheduled = scheduled;
|
|
97
110
|
this.log = log;
|
|
98
111
|
this.operations = operations;
|
|
99
112
|
this.shareObjects = shareObjects;
|
|
113
|
+
this.blobObjects = blobObjects;
|
|
114
|
+
this.hashing = hashing;
|
|
115
|
+
this.backfill = backfill;
|
|
100
116
|
this.platformIcons = platformIcons;
|
|
101
117
|
this.notices = notices;
|
|
118
|
+
this.triggers = triggers;
|
|
119
|
+
this.coalescer = coalescer;
|
|
102
120
|
this.snapshots = snapshots;
|
|
103
121
|
}
|
|
104
122
|
process(job, token) {
|
|
@@ -187,18 +205,50 @@ let MaintenanceProcessor = class MaintenanceProcessor extends WorkerHost {
|
|
|
187
205
|
case OWNED_PLUGIN_CLEANUP_JOB:
|
|
188
206
|
await this.ownedCleanup.run(job.data.itemId);
|
|
189
207
|
return;
|
|
190
|
-
// one task run of
|
|
191
|
-
case
|
|
192
|
-
await this.
|
|
208
|
+
// one task run of an automation (scheduled tasks spec §6)
|
|
209
|
+
case AUTOMATION_FIRE_JOB:
|
|
210
|
+
await this.automations.fire(job.data.taskRunId);
|
|
193
211
|
return;
|
|
194
212
|
// a task run's settle check, claimed or unfired (ruling R26)
|
|
195
|
-
case
|
|
196
|
-
await this.
|
|
213
|
+
case AUTOMATION_SETTLE_JOB:
|
|
214
|
+
await this.automations.settle(job.data);
|
|
215
|
+
return;
|
|
216
|
+
// one stored trigger event's routing to the automations it fires (collaboration spec §4.2)
|
|
217
|
+
case TRIGGER_DISPATCH_JOB:
|
|
218
|
+
await this.triggers.dispatch(job.data, {
|
|
219
|
+
// a source that never answers leaves the event undelivered on the last attempt
|
|
220
|
+
finalAttempt: job.attemptsMade + 1 >= (job.opts?.attempts ?? 1),
|
|
221
|
+
});
|
|
222
|
+
return;
|
|
223
|
+
// one coalescing window of an event automation's events for one subject (spec §4.7)
|
|
224
|
+
case AUTOMATION_COALESCE_JOB:
|
|
225
|
+
await this.coalescer.flush(job.data);
|
|
197
226
|
return;
|
|
198
227
|
// a share snapshot a refresh or revoke stopped using (file sharing spec §2)
|
|
199
228
|
case SHARE_OBJECT_DELETE_JOB:
|
|
200
229
|
await this.shareObjects.deleteObject(job.data);
|
|
201
230
|
return;
|
|
231
|
+
// a blob nothing points at any more, or an upload's unused staging object (file library §3)
|
|
232
|
+
case BLOB_DELETE_JOB:
|
|
233
|
+
await this.blobObjects.deleteBlob(job.data);
|
|
234
|
+
return;
|
|
235
|
+
case FILE_STAGING_DELETE_JOB:
|
|
236
|
+
await this.blobObjects.deleteStaging(job.data);
|
|
237
|
+
return;
|
|
238
|
+
case FILE_RELEASE_JOB:
|
|
239
|
+
await this.blobObjects.releaseFile(job.data);
|
|
240
|
+
return;
|
|
241
|
+
// the hashing of migrated blobs: the dispatcher, then one org's batch (file library §9)
|
|
242
|
+
case FILE_LIBRARY_HASH_JOB:
|
|
243
|
+
await this.hashing.dispatch();
|
|
244
|
+
return;
|
|
245
|
+
case FILE_LIBRARY_HASH_ORG_JOB:
|
|
246
|
+
await this.hashing.runOrgBatch(job.data);
|
|
247
|
+
return;
|
|
248
|
+
// the one-off catch-up of the file library's data copy after a deploy
|
|
249
|
+
case FILE_LIBRARY_BACKFILL_JOB:
|
|
250
|
+
await this.backfill.run();
|
|
251
|
+
return;
|
|
202
252
|
// a platform icon object no row names any more, or an upload's orphan check (§10.2.1)
|
|
203
253
|
case PLATFORM_ICON_DELETE_JOB:
|
|
204
254
|
await this.platformIcons.deleteObject(job.data);
|
|
@@ -243,15 +293,20 @@ MaintenanceProcessor = __decorate([
|
|
|
243
293
|
__param(6, Inject(Offboarding)),
|
|
244
294
|
__param(7, Inject(RunQueue)),
|
|
245
295
|
__param(8, Inject(OwnedPluginCleanup)),
|
|
246
|
-
__param(9, Inject(
|
|
296
|
+
__param(9, Inject(AutomationFirer)),
|
|
247
297
|
__param(10, Inject(ScheduledRuns)),
|
|
248
298
|
__param(11, Inject(KERNEL_LOGGER)),
|
|
249
299
|
__param(12, Inject(SandboxOperationReconcileJob)),
|
|
250
300
|
__param(13, Inject(ShareObjects)),
|
|
251
|
-
__param(14, Inject(
|
|
252
|
-
__param(15, Inject(
|
|
253
|
-
__param(16,
|
|
254
|
-
__param(
|
|
301
|
+
__param(14, Inject(BlobObjects)),
|
|
302
|
+
__param(15, Inject(FileLibraryHashJob)),
|
|
303
|
+
__param(16, Inject(FileLibraryBackfill)),
|
|
304
|
+
__param(17, Inject(PlatformIconObjects)),
|
|
305
|
+
__param(18, Inject(ConversationNoticeDelivery)),
|
|
306
|
+
__param(19, Inject(TriggerDispatcher)),
|
|
307
|
+
__param(20, Inject(EventCoalescer)),
|
|
308
|
+
__param(21, Optional()),
|
|
309
|
+
__param(21, Inject(CloudPermissionSnapshots))
|
|
255
310
|
], MaintenanceProcessor);
|
|
256
311
|
export { MaintenanceProcessor };
|
|
257
312
|
/**
|
|
@@ -276,10 +331,16 @@ MaintenanceModule = __decorate([
|
|
|
276
331
|
OrgsModule,
|
|
277
332
|
// the removed org plugins' cleanup job (worker-only through this module)
|
|
278
333
|
OwnedPluginCleanupModule,
|
|
279
|
-
// the
|
|
280
|
-
|
|
334
|
+
// the automation fire job and the scanner (worker-only through this module)
|
|
335
|
+
AutomationFireModule,
|
|
336
|
+
// the trigger event dispatch job (worker-only through this module)
|
|
337
|
+
TriggerDispatchModule,
|
|
281
338
|
// the share snapshot deletion
|
|
282
339
|
ShareObjectsModule,
|
|
340
|
+
// the file library's blob and staging object deletions
|
|
341
|
+
BlobObjectsModule,
|
|
342
|
+
// the file library's hashing and catch-up copy
|
|
343
|
+
FileLibraryJobsModule,
|
|
283
344
|
// the platform icon object deletion
|
|
284
345
|
PlatformIconObjectsModule,
|
|
285
346
|
// a deleted conversation's notice to its device's services
|
|
@@ -4,6 +4,7 @@ import type { KernelConfig } from "../config/schema.js";
|
|
|
4
4
|
import type { AppendEvent, EventLog } from "../conversations/event-log.js";
|
|
5
5
|
import { type ConversationEvent } from "../conversations/events.js";
|
|
6
6
|
import type { KernelSchemaDb } from "../db/kernel-schema.js";
|
|
7
|
+
import type { CaseSnapshot } from "../evals/snapshot.js";
|
|
7
8
|
import type { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
8
9
|
import type { ToolRegistry, UnavailableTool } from "../tools/registry.js";
|
|
9
10
|
import type { CompactionProgressSink } from "./compaction-progress.js";
|
|
@@ -84,16 +85,21 @@ export interface ModelStepDeps {
|
|
|
84
85
|
tools: Pick<ToolRegistry, "forAgent">;
|
|
85
86
|
config: Pick<KernelConfigService, "get">;
|
|
86
87
|
/**
|
|
87
|
-
* The compaction settings in effect for the run's organization (context compaction spec §4.8)
|
|
88
|
-
* resolved once per model step
|
|
88
|
+
* The compaction settings in effect for the run's organization (context compaction spec §4.8)
|
|
89
|
+
* and its prompt cache settings (idle compaction spec §9.2): both resolved once per model step
|
|
90
|
+
* (`resolveStep`, one org settings read); `resolve` is the compaction settings alone, which
|
|
91
|
+
* step replays read.
|
|
89
92
|
*/
|
|
90
|
-
compactionSettings: Pick<CompactionSettingsService, "resolve">;
|
|
93
|
+
compactionSettings: Pick<CompactionSettingsService, "resolve" | "resolveStep">;
|
|
91
94
|
/**
|
|
92
95
|
* Ephemeral compaction progress (context compaction spec §4.6): display-only, never in the log.
|
|
93
96
|
* Absent in eval replays and single-step replays, which have no live conversation to show it on.
|
|
94
97
|
*/
|
|
95
98
|
compactionProgress?: CompactionProgressSink;
|
|
96
|
-
|
|
99
|
+
/** The kernel logger (its `debug` level is optional here: SDK loggers have none). */
|
|
100
|
+
log: Logger & {
|
|
101
|
+
debug?(msg: string, fields?: Record<string, unknown>): void;
|
|
102
|
+
};
|
|
97
103
|
/**
|
|
98
104
|
* 会话附件(构建请求时解析日志里的媒体引用;见 AttachmentsService)。未提供时媒体引用一律按「不再可用」处理。
|
|
99
105
|
* 两个方法都只对「确定不存在」返回缺省 / null;暂时故障(存储不可用、网络错误)一律抛错(Ruling M4)。
|
|
@@ -121,6 +127,14 @@ export interface ModelStepDeps {
|
|
|
121
127
|
* as `tool_base`. Only chat and sub-agent runs use it (never an eval replay); absent, no base.
|
|
122
128
|
*/
|
|
123
129
|
writeBase?: WriteBaseReader;
|
|
130
|
+
/**
|
|
131
|
+
* The live snapshot of the conversation for the in-context summary (idle compaction spec §9.4,
|
|
132
|
+
* `evals/snapshot.ts` `liveSnapshot`): `events` with the definitions and tool specs they
|
|
133
|
+
* reference, for run `runId` (the run of the last model call) of agent `agentId`. Live runs and
|
|
134
|
+
* manual compact runs get it (`RunSteps`); absent (eval replays, most tests), every compaction
|
|
135
|
+
* summarizes the transcript.
|
|
136
|
+
*/
|
|
137
|
+
liveSnapshot?: (orgId: string, conversationId: string, runId: string, agentId: string, events: readonly ConversationEvent[]) => Promise<CaseSnapshot>;
|
|
124
138
|
/**
|
|
125
139
|
* How long an attempt waits for its aborted base reads (default `WRITE_BASE_SETTLE_MS`); tests
|
|
126
140
|
* shorten it.
|
|
@@ -380,6 +394,11 @@ interface CompactOptions {
|
|
|
380
394
|
* `compaction_failed`.
|
|
381
395
|
*/
|
|
382
396
|
manual?: boolean;
|
|
397
|
+
/**
|
|
398
|
+
* Summarize the transcript, never the in-context request (idle compaction spec §9.4): the
|
|
399
|
+
* reactive path sets it, since its last request is the one that overflowed.
|
|
400
|
+
*/
|
|
401
|
+
transcriptOnly?: boolean;
|
|
383
402
|
}
|
|
384
403
|
/** What one compaction execution wrote: the events, the summary's seq and whether it failed. */
|
|
385
404
|
export interface CompactionOutcome {
|
|
@@ -411,11 +430,21 @@ export declare function runCompaction(deps: ModelStepDeps, input: ModelStepInput
|
|
|
411
430
|
export declare function deltaChars(ev: Exclude<ModelStreamEvent, {
|
|
412
431
|
type: "message_complete";
|
|
413
432
|
}>): number;
|
|
433
|
+
/**
|
|
434
|
+
* The provider's usage as the kernel records it: a `cacheWriteByTtl` that fails
|
|
435
|
+
* `validateCacheWriteByTtl` is dropped with a warn (the rest of the usage stays), so the `usage`
|
|
436
|
+
* event's schema never rejects a call the model already answered.
|
|
437
|
+
*/
|
|
438
|
+
export declare function trustedUsage(usage: ModelUsage, model: string, log?: Pick<Logger, "warn">): ModelUsage;
|
|
414
439
|
/**
|
|
415
440
|
* 消费一次模型流,带空闲看门狗:两次事件之间超过 `idleMs` → 本地中止并按 `ModelError("timeout")` 抛出。
|
|
416
441
|
* 外部 `signal` 触发 → `StepAborted`。每次 `next()` 都与停止信号竞速,供应商不响应 signal 也不会卡住。
|
|
417
442
|
* 运行时与评测单步回放(`evals/step-replay.ts`)、评委共用。
|
|
443
|
+
* The usage goes through {@link trustedUsage}, so a malformed `cacheWriteByTtl` never fails a call
|
|
444
|
+
* after the model replied.
|
|
418
445
|
*/
|
|
419
446
|
export declare function consumeModelStream(provider: BoundProvider, request: ModelRequest, idleMs: number, signal: AbortSignal, onDelta: (ev: Exclude<ModelStreamEvent, {
|
|
420
447
|
type: "message_complete";
|
|
421
|
-
}>) => void
|
|
448
|
+
}>) => void,
|
|
449
|
+
/** Where a dropped `cacheWriteByTtl` is reported. */
|
|
450
|
+
log?: Pick<Logger, "warn">): Promise<StreamOutcome>;
|