@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,19 +1,19 @@
|
|
|
1
|
+
import type { AutomationsService, UpdateTaskInput } from "../../automations/automations.service.js";
|
|
2
|
+
import { AutomationStore } from "../../automations/store.js";
|
|
3
|
+
import type { Automation, AutomationChat, AutomationTrigger } from "../../automations/types.js";
|
|
1
4
|
import type { KernelSchemaDb } from "../../db/kernel-schema.js";
|
|
2
5
|
import { ApiError } from "../../errors.js";
|
|
3
6
|
import type { KernelConfigService } from "../../infra/config/kernel-config.service.js";
|
|
4
7
|
import { KernelDb } from "../../infra/database/kernel-db.js";
|
|
5
8
|
import { TransactionHost } from "../../infra/database/transaction-host.js";
|
|
6
|
-
import type { ScheduledTasksService, UpdateTaskInput } from "../../schedules/scheduled-tasks.service.js";
|
|
7
|
-
import { ScheduledTaskStore } from "../../schedules/store.js";
|
|
8
|
-
import type { ScheduleChat, ScheduledTask, ScheduleTrigger } from "../../schedules/types.js";
|
|
9
9
|
import type { BuiltinTool } from "../registry.js";
|
|
10
10
|
/**
|
|
11
|
-
* The
|
|
12
|
-
* `
|
|
13
|
-
* trigger account through the same service as the HTTP routes (`
|
|
11
|
+
* The automation builtins (scheduled tasks spec §11): `AutomationCreate`, `AutomationUpdate`,
|
|
12
|
+
* `AutomationList`, `AutomationTargets` and `AutomationDelete` manage the automations of the run's
|
|
13
|
+
* trigger account through the same service as the HTTP routes (`AutomationsService`), so the
|
|
14
14
|
* org's limits and the grant rules apply unchanged.
|
|
15
15
|
*
|
|
16
|
-
* - `
|
|
16
|
+
* - `AutomationCreate` / `AutomationUpdate` are fixed asks (R3, `R3_FIXED_ASK_TOOL_KEYS`) with a
|
|
17
17
|
* per-call policy that never remembers: every call asks, no grant (conversation, always or task)
|
|
18
18
|
* covers it, and an unattended run in `fail` mode is refused. The approval card's summary is
|
|
19
19
|
* rendered here, by the kernel, from the input and the stored task: name, schedule in words with
|
|
@@ -21,9 +21,9 @@ import type { BuiltinTool } from "../registry.js";
|
|
|
21
21
|
* - The approved tools of a task are exactly the `approvedTools` of the approved input: create
|
|
22
22
|
* grants that list, and an update that passes it replaces the task's grants with it (the card
|
|
23
23
|
* lists the full new set), so nothing beyond what the person saw is ever granted.
|
|
24
|
-
* - `
|
|
24
|
+
* - `AutomationList` (allow) lists the person's own tasks; `AutomationTargets` (allow) lists the IM
|
|
25
25
|
* chats they can deliver to (the service's `chatTargets`, the same data as the route);
|
|
26
|
-
* `
|
|
26
|
+
* `AutomationDelete` (allow; deleting only narrows) deletes only the person's own task, even when
|
|
27
27
|
* they are an org admin.
|
|
28
28
|
* - `mode: "here"`: a `chat` task for this conversation's IM direct chat when the conversation is
|
|
29
29
|
* delivered to one (`channel_deliveries`) and is the live DM thread of the person
|
|
@@ -31,42 +31,42 @@ import type { BuiltinTool } from "../registry.js";
|
|
|
31
31
|
* the IM chat named by `chat`. The zone is the run's (`run_context`, else the org's, else UTC).
|
|
32
32
|
*/
|
|
33
33
|
/** The task service as the tools use it (bound at start; null when not loaded here). */
|
|
34
|
-
export type
|
|
34
|
+
export type AutomationService = Pick<AutomationsService, "create" | "update" | "list" | "remove" | "addGrants" | "removeGrant" | "chatTargets">;
|
|
35
35
|
/**
|
|
36
|
-
* Where the
|
|
36
|
+
* Where the automation tools find the task service: a registration port. `AutomationsModule` imports
|
|
37
37
|
* `ToolsModule` (its grants resolve the agent's tools through `ToolRegistry`, which lists these
|
|
38
|
-
* builtins), so the service cannot be injected into the builtins; `
|
|
38
|
+
* builtins), so the service cannot be injected into the builtins; `AutomationsModule` binds it here
|
|
39
39
|
* from `onModuleInit` instead, as the domain operations register into `PlatformOperations`. Null
|
|
40
|
-
* until bound (an application without `
|
|
40
|
+
* until bound (an application without `AutomationsModule`).
|
|
41
41
|
*/
|
|
42
|
-
export declare class
|
|
42
|
+
export declare class AutomationToolsPort {
|
|
43
43
|
private service;
|
|
44
|
-
bind(service:
|
|
45
|
-
get():
|
|
44
|
+
bind(service: AutomationService): void;
|
|
45
|
+
get(): AutomationService | null;
|
|
46
46
|
}
|
|
47
|
-
export interface
|
|
47
|
+
export interface AutomationToolsDeps {
|
|
48
48
|
/** The kernel-schema handle of the current context. */
|
|
49
49
|
db: () => KernelSchemaDb;
|
|
50
50
|
config: Pick<KernelConfigService, "get">;
|
|
51
|
-
store: Pick<
|
|
51
|
+
store: Pick<AutomationStore, "getTask" | "listGrants">;
|
|
52
52
|
/** The task service, or null when this application does not load it. */
|
|
53
|
-
service: () =>
|
|
54
|
-
/** `
|
|
55
|
-
updates: Pick<
|
|
53
|
+
service: () => AutomationService | null;
|
|
54
|
+
/** `AutomationUpdate`'s write (its field change and grant changes commit together). */
|
|
55
|
+
updates: Pick<AutomationUpdates, "apply">;
|
|
56
56
|
/** The conversation's zone: its latest `run_context`, else the org's, else UTC. */
|
|
57
57
|
timeZoneOf: (orgId: string, conversationId: string) => Promise<string>;
|
|
58
58
|
/** The clock (epoch ms), for the next run shown on cards and lists. */
|
|
59
59
|
now: () => number;
|
|
60
60
|
}
|
|
61
|
-
export declare const
|
|
62
|
-
export declare const
|
|
61
|
+
export declare const AUTOMATIONS_UNAVAILABLE_TEXT = "Automations are not available on this server; ask the user to manage the task on the automations page instead.";
|
|
62
|
+
export declare const AUTOMATIONS_OFF_TEXT = "Automations are turned off in this organization; ask an org admin to turn them on.";
|
|
63
63
|
/** The card recomputed at run time differs from the one the person approved. */
|
|
64
64
|
export declare const cardChangedText: (tool: string) => string;
|
|
65
|
-
export declare const NOT_A_MEMBER_TEXT = "The user is no longer a member of this organization, so their
|
|
65
|
+
export declare const NOT_A_MEMBER_TEXT = "The user is no longer a member of this organization, so their automations cannot be managed here; ask them to check their membership.";
|
|
66
66
|
/** No task with that id is the person's own (missing, deleted, or another member's). */
|
|
67
67
|
export declare const notYoursText: (id: string) => string;
|
|
68
68
|
/** The service's refusal as an actionable English tool error. */
|
|
69
|
-
export declare function
|
|
69
|
+
export declare function automationErrorText(e: ApiError, ctx: {
|
|
70
70
|
id?: string;
|
|
71
71
|
zone?: string;
|
|
72
72
|
}): string;
|
|
@@ -75,7 +75,7 @@ type Words = {
|
|
|
75
75
|
en: string;
|
|
76
76
|
};
|
|
77
77
|
/** A trigger in words, its zone included; an unusual cron reads as the expression itself. */
|
|
78
|
-
export declare function scheduleWords(t:
|
|
78
|
+
export declare function scheduleWords(t: AutomationTrigger): Words;
|
|
79
79
|
/** Where a task's runs go, resolved for a card or a result. */
|
|
80
80
|
export type Target = {
|
|
81
81
|
mode: "new";
|
|
@@ -84,8 +84,10 @@ export type Target = {
|
|
|
84
84
|
conversationId: string;
|
|
85
85
|
} | {
|
|
86
86
|
mode: "chat";
|
|
87
|
-
chat:
|
|
87
|
+
chat: AutomationChat;
|
|
88
88
|
connectionName: string;
|
|
89
|
+
} | {
|
|
90
|
+
mode: "subject";
|
|
89
91
|
};
|
|
90
92
|
/**
|
|
91
93
|
* `mode: "here"` (spec §8): the conversation's IM direct chat when the conversation is delivered
|
|
@@ -93,17 +95,17 @@ export type Target = {
|
|
|
93
95
|
*/
|
|
94
96
|
export declare function hereTarget(db: KernelSchemaDb, orgId: string, accountId: string, conversationId: string): Promise<Target>;
|
|
95
97
|
/**
|
|
96
|
-
* `
|
|
98
|
+
* `AutomationUpdate`'s write in one transaction: the field change, then (with `approvedTools`) the
|
|
97
99
|
* task's grants replaced by exactly that list. Each service call is `@Transactional` and joins
|
|
98
100
|
* this one, so a refused grant rolls the field change back too.
|
|
99
101
|
*/
|
|
100
|
-
export declare class
|
|
102
|
+
export declare class AutomationUpdates {
|
|
101
103
|
readonly txHost: TransactionHost;
|
|
102
104
|
private readonly db;
|
|
103
105
|
private readonly store;
|
|
104
|
-
constructor(txHost: TransactionHost, db: KernelDb, store:
|
|
105
|
-
apply(svc: Pick<
|
|
106
|
+
constructor(txHost: TransactionHost, db: KernelDb, store: AutomationStore);
|
|
107
|
+
apply(svc: Pick<AutomationService, "update" | "addGrants" | "removeGrant">, orgId: string, accountId: string, task: Automation, patch: UpdateTaskInput, approvedTools: readonly string[] | undefined): Promise<Automation>;
|
|
106
108
|
}
|
|
107
|
-
/** The five
|
|
108
|
-
export declare function
|
|
109
|
+
/** The five automation builtins. */
|
|
110
|
+
export declare function automationTools(deps: AutomationToolsDeps): BuiltinTool[];
|
|
109
111
|
export {};
|