@capybara-hq/kernel 0.1.0-rc.104 → 0.1.0-rc.106
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/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 +3 -3
- package/dist/channels/outbound.d.ts +5 -5
- package/dist/channels/outbound.js +17 -17
- package/dist/channels/threads.d.ts +1 -1
- package/dist/channels/threads.js +1 -1
- package/dist/config/schema.d.ts +5 -1
- package/dist/config/schema.js +44 -6
- package/dist/conversations/approval-profile.d.ts +2 -2
- package/dist/conversations/approval-profile.js +3 -3
- package/dist/conversations/conversations.controller.d.ts +7 -1
- package/dist/conversations/conversations.controller.js +26 -10
- package/dist/conversations/conversations.service.d.ts +103 -25
- package/dist/conversations/conversations.service.js +138 -33
- package/dist/conversations/events.d.ts +48 -1
- package/dist/conversations/events.js +61 -9
- 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 +2 -1
- 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 +20 -14
- package/dist/ctx/create-ctx.d.ts +20 -1
- package/dist/ctx/create-ctx.js +59 -2
- package/dist/db/kernel-schema.d.ts +104 -25
- 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 +47 -13
- package/dist/errors.js +47 -13
- package/dist/evals/reconstruct.d.ts +10 -1
- package/dist/evals/reconstruct.js +7 -0
- package/dist/extensions/host.d.ts +6 -1
- package/dist/extensions/host.js +10 -0
- 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/git/gateway.js +2 -2
- package/dist/handoff/app-schemes.d.ts +28 -0
- package/dist/handoff/app-schemes.js +41 -0
- package/dist/handoff/handoff-paths.d.ts +26 -0
- package/dist/handoff/handoff-paths.js +25 -0
- package/dist/handoff/handoff-tickets.d.ts +28 -0
- package/dist/handoff/handoff-tickets.js +111 -0
- package/dist/handoff/handoff.controller.d.ts +24 -0
- package/dist/handoff/handoff.controller.js +74 -0
- package/dist/handoff/handoff.module.d.ts +7 -0
- package/dist/handoff/handoff.module.js +26 -0
- package/dist/handoff/handoff.schemas.d.ts +13 -0
- package/dist/handoff/handoff.schemas.js +3 -0
- package/dist/handoff/handoff.service.d.ts +49 -0
- package/dist/handoff/handoff.service.js +96 -0
- package/dist/http/api.module.js +13 -5
- package/dist/http/meta.controller.d.ts +1 -0
- package/dist/http/meta.controller.js +7 -0
- package/dist/http/request-signal.d.ts +8 -0
- package/dist/http/request-signal.js +14 -0
- package/dist/identity/sso.controller.d.ts +30 -6
- package/dist/identity/sso.controller.js +51 -17
- package/dist/identity/sso.d.ts +10 -2
- package/dist/identity/sso.js +15 -3
- 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 +29 -2
- package/dist/infra/outbox/registry.js +30 -7
- package/dist/kernel.module.js +3 -0
- 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 +27 -11
- package/dist/orgs/settings.service.js +42 -24
- package/dist/overrides.d.ts +4 -4
- package/dist/overrides.js +1 -1
- package/dist/platform/exclusions.js +5 -0
- package/dist/platform/operation.js +2 -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/connectors.ops.js +4 -2
- package/dist/platform/ops/devices.ops.d.ts +3 -1
- package/dist/platform/ops/devices.ops.js +77 -3
- package/dist/platform/ops/inbox.ops.js +4 -4
- package/dist/platform/ops/orgs.ops.js +1 -1
- package/dist/platform/ops/platform.ops.js +4 -4
- package/dist/platform/platform-ops.module.d.ts +2 -2
- package/dist/platform/platform-ops.module.js +5 -5
- package/dist/platform/route-schemas.js +3 -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 +3 -3
- package/dist/runtime/compaction.service.d.ts +3 -1
- package/dist/runtime/compaction.service.js +3 -1
- package/dist/runtime/context/build.d.ts +6 -0
- package/dist/runtime/context/build.js +14 -3
- package/dist/runtime/context/compaction.d.ts +27 -1
- package/dist/runtime/context/compaction.js +102 -37
- package/dist/runtime/context/run-context.d.ts +38 -0
- package/dist/runtime/context/run-context.js +54 -0
- package/dist/runtime/maintenance.d.ts +8 -4
- package/dist/runtime/maintenance.js +37 -16
- package/dist/runtime/model-call.d.ts +6 -4
- package/dist/runtime/model-call.js +17 -7
- package/dist/runtime/project/knowledge.service.d.ts +16 -7
- package/dist/runtime/project/knowledge.service.js +31 -13
- 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-worker.js +7 -1
- package/dist/runtime/runtime.module.js +3 -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/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/{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 +8 -8
- package/dist/tools/builtins/builtin-tools.js +16 -16
- package/dist/tools/call-scope.d.ts +1 -1
- package/dist/tools/connectors.service.d.ts +4 -13
- package/dist/tools/connectors.service.js +12 -21
- 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/oauth/flow.d.ts +16 -2
- package/dist/tools/oauth/flow.js +23 -4
- package/dist/tools/oauth/oauth.controller.d.ts +19 -7
- package/dist/tools/oauth/oauth.controller.js +42 -12
- package/dist/tools/oauth/oauth.schemas.d.ts +14 -1
- package/dist/tools/oauth/oauth.schemas.js +4 -1
- 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 +9 -9
- package/package.json +3 -3
- package/src/migrations/0188_automations_rename.sql +309 -0
- package/src/migrations/0189_event_automations.sql +136 -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
|
@@ -77,12 +77,12 @@ export type OrgThemeSetting = z.infer<typeof OrgThemeSettingSchema>;
|
|
|
77
77
|
/** The theme setting of an org that has none: follow the platform, personal picks allowed. */
|
|
78
78
|
export declare const DEFAULT_ORG_THEME: OrgThemeSetting;
|
|
79
79
|
/**
|
|
80
|
-
* Org settings of
|
|
80
|
+
* Org settings of automations (spec §9); every field reads leniently (invalid = default,
|
|
81
81
|
* except `forbiddenTools`, which keeps its valid entries). A stored `forbiddenTools` that is not a
|
|
82
82
|
* list (or a group that is not an object) reads as `[]` here, for display; enforcement checks
|
|
83
83
|
* {@link invalidStoredForbiddenTools} and fails unattended runs instead (never wider).
|
|
84
84
|
*/
|
|
85
|
-
export declare const
|
|
85
|
+
export declare const AutomationsSettingsSchema: z.ZodObject<{
|
|
86
86
|
enabled: z.ZodCatch<z.ZodDefault<z.ZodBoolean>>;
|
|
87
87
|
minIntervalMinutes: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
|
|
88
88
|
maxTasksPerMember: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
|
|
@@ -95,14 +95,18 @@ export declare const ScheduledTasksSettingsSchema: z.ZodObject<{
|
|
|
95
95
|
wait: "wait";
|
|
96
96
|
}>>>;
|
|
97
97
|
pauseAfterFailures: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
|
|
98
|
+
maxEventDepth: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
|
|
99
|
+
coalesceSeconds: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
|
|
100
|
+
maxEventRunsPerSubjectPerHour: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
|
|
101
|
+
eventSourcesOff: z.ZodCatch<z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodString>>, unknown>>;
|
|
98
102
|
forbiddenTools: z.ZodCatch<z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodString>>, unknown>>;
|
|
99
103
|
}, z.core.$strip>;
|
|
100
|
-
export type
|
|
104
|
+
export type AutomationsSettings = z.infer<typeof AutomationsSettingsSchema>;
|
|
101
105
|
/**
|
|
102
106
|
* The PATCH form: a partial merge into the group (fields left out keep their stored value; see
|
|
103
107
|
* `OrgSettingsService.update`). A field given replaces that field whole, `forbiddenTools` too.
|
|
104
108
|
*/
|
|
105
|
-
export declare const
|
|
109
|
+
export declare const AutomationsPatchSchema: z.ZodObject<{
|
|
106
110
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
107
111
|
minIntervalMinutes: z.ZodOptional<z.ZodNumber>;
|
|
108
112
|
maxTasksPerMember: z.ZodOptional<z.ZodNumber>;
|
|
@@ -115,6 +119,10 @@ export declare const ScheduledTasksPatchSchema: z.ZodObject<{
|
|
|
115
119
|
wait: "wait";
|
|
116
120
|
}>>;
|
|
117
121
|
pauseAfterFailures: z.ZodOptional<z.ZodNumber>;
|
|
122
|
+
maxEventDepth: z.ZodOptional<z.ZodNumber>;
|
|
123
|
+
coalesceSeconds: z.ZodOptional<z.ZodNumber>;
|
|
124
|
+
maxEventRunsPerSubjectPerHour: z.ZodOptional<z.ZodNumber>;
|
|
125
|
+
eventSourcesOff: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
118
126
|
forbiddenTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
119
127
|
}, z.core.$strict>;
|
|
120
128
|
/**
|
|
@@ -187,7 +195,7 @@ export declare const OrgSettingsSchema: z.ZodObject<{
|
|
|
187
195
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
188
196
|
hostSources: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
189
197
|
}, z.core.$strip>>>;
|
|
190
|
-
|
|
198
|
+
automations: z.ZodCatch<z.ZodPrefault<z.ZodObject<{
|
|
191
199
|
enabled: z.ZodCatch<z.ZodDefault<z.ZodBoolean>>;
|
|
192
200
|
minIntervalMinutes: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
|
|
193
201
|
maxTasksPerMember: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
|
|
@@ -200,6 +208,10 @@ export declare const OrgSettingsSchema: z.ZodObject<{
|
|
|
200
208
|
wait: "wait";
|
|
201
209
|
}>>>;
|
|
202
210
|
pauseAfterFailures: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
|
|
211
|
+
maxEventDepth: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
|
|
212
|
+
coalesceSeconds: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
|
|
213
|
+
maxEventRunsPerSubjectPerHour: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
|
|
214
|
+
eventSourcesOff: z.ZodCatch<z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodString>>, unknown>>;
|
|
203
215
|
forbiddenTools: z.ZodCatch<z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodString>>, unknown>>;
|
|
204
216
|
}, z.core.$strip>>>;
|
|
205
217
|
compaction: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
@@ -221,12 +233,12 @@ export declare const OrgSettingsSchema: z.ZodObject<{
|
|
|
221
233
|
export type OrgSettings = z.infer<typeof OrgSettingsSchema>;
|
|
222
234
|
/**
|
|
223
235
|
* The settings as the responses carry them: {@link OrgSettings} plus
|
|
224
|
-
* `
|
|
236
|
+
* `automations.forbiddenToolsUnreadable: true` when the stored list cannot be read
|
|
225
237
|
* ({@link invalidStoredForbiddenTools}; `forbiddenTools` then reads `[]`), so the settings page
|
|
226
238
|
* says so and saves the list. Never stored.
|
|
227
239
|
*/
|
|
228
240
|
export type OrgSettingsView = OrgSettings & {
|
|
229
|
-
|
|
241
|
+
automations: OrgSettings["automations"] & {
|
|
230
242
|
forbiddenToolsUnreadable?: true;
|
|
231
243
|
};
|
|
232
244
|
};
|
|
@@ -280,7 +292,7 @@ export declare const OrgSettingsPatchSchema: z.ZodObject<{
|
|
|
280
292
|
}>;
|
|
281
293
|
}, z.core.$strict>>>;
|
|
282
294
|
uiArrangement: z.ZodOptional<z.ZodType<Partial<Record<"agent.detail.section" | "conversation.composer.frame" | "conversation.empty" | "conversation.panel" | "conversation.properties.section" | "conversation.tool-result.card" | "file.preview" | "org.page" | "org.settings.section" | "platform.page" | "shell.brand" | "shell.overlay", import("../ui/arrangement.js").UiArrangementEntry | null>>, unknown, z.core.$ZodTypeInternals<Partial<Record<"agent.detail.section" | "conversation.composer.frame" | "conversation.empty" | "conversation.panel" | "conversation.properties.section" | "conversation.tool-result.card" | "file.preview" | "org.page" | "org.settings.section" | "platform.page" | "shell.brand" | "shell.overlay", import("../ui/arrangement.js").UiArrangementEntry | null>>, unknown>>>;
|
|
283
|
-
|
|
295
|
+
automations: z.ZodOptional<z.ZodObject<{
|
|
284
296
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
285
297
|
minIntervalMinutes: z.ZodOptional<z.ZodNumber>;
|
|
286
298
|
maxTasksPerMember: z.ZodOptional<z.ZodNumber>;
|
|
@@ -293,6 +305,10 @@ export declare const OrgSettingsPatchSchema: z.ZodObject<{
|
|
|
293
305
|
wait: "wait";
|
|
294
306
|
}>>;
|
|
295
307
|
pauseAfterFailures: z.ZodOptional<z.ZodNumber>;
|
|
308
|
+
maxEventDepth: z.ZodOptional<z.ZodNumber>;
|
|
309
|
+
coalesceSeconds: z.ZodOptional<z.ZodNumber>;
|
|
310
|
+
maxEventRunsPerSubjectPerHour: z.ZodOptional<z.ZodNumber>;
|
|
311
|
+
eventSourcesOff: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
296
312
|
forbiddenTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
297
313
|
}, z.core.$strict>>;
|
|
298
314
|
compaction: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
@@ -383,16 +399,16 @@ log?: Pick<KernelLogger, "debug">): Promise<OrgSettings>;
|
|
|
383
399
|
/** Whether a stored settings object holds a `sandboxToolPolicy` this version reads as `ask`. */
|
|
384
400
|
export declare function invalidStoredSandboxToolPolicy(raw: unknown): boolean;
|
|
385
401
|
/**
|
|
386
|
-
* Whether the stored
|
|
402
|
+
* Whether the stored automation `forbiddenTools` cannot be read: the group or the field is
|
|
387
403
|
* present but not an object / a list. Unattended runs of such an org fail
|
|
388
404
|
* ({@link FORBIDDEN_TOOLS_UNREADABLE_ERROR}) rather than run with nothing forbidden. Invalid
|
|
389
405
|
* entries inside a list are dropped instead (the valid ones stay forbidden).
|
|
390
406
|
*/
|
|
391
407
|
export declare function invalidStoredForbiddenTools(raw: unknown): boolean;
|
|
392
408
|
/** The refusal of an unattended run of an org whose `forbiddenTools` cannot be read. */
|
|
393
|
-
export declare const FORBIDDEN_TOOLS_UNREADABLE_ERROR = "The organization's forbidden tool list for
|
|
409
|
+
export declare const FORBIDDEN_TOOLS_UNREADABLE_ERROR = "The organization's forbidden tool list for automations is unreadable, so this scheduled run cannot continue; an org admin must save the list again in the organization's automation settings.";
|
|
394
410
|
/** The refusal of a new task grant while the org's `forbiddenTools` cannot be read. */
|
|
395
|
-
export declare const FORBIDDEN_TOOLS_UNREADABLE_GRANT_ERROR = "The organization's forbidden tool list for
|
|
411
|
+
export declare const FORBIDDEN_TOOLS_UNREADABLE_GRANT_ERROR = "The organization's forbidden tool list for automations is unreadable, so no tool can be approved for a task now; an org admin must save the list again in the organization's automation settings.";
|
|
396
412
|
/**
|
|
397
413
|
* Logs (through `log`, at the caller's level) the security settings a stored value reads narrower
|
|
398
414
|
* than written, with the org id.
|
|
@@ -94,22 +94,36 @@ export const DEFAULT_ORG_THEME = { id: null, personal: "allowed" };
|
|
|
94
94
|
const posInt = (max, def) => z.number().int().min(1).max(max).default(def).catch(def);
|
|
95
95
|
/** A stored `forbiddenTools` entry worth keeping: a tool key of the length the PATCH accepts. */
|
|
96
96
|
const isForbiddenToolEntry = (v) => typeof v === "string" && v.length >= 1 && v.length <= 200;
|
|
97
|
+
/** A stored `eventSourcesOff` entry worth keeping: an extension name of the length the PATCH accepts. */
|
|
98
|
+
const isEventSourceEntry = (v) => typeof v === "string" && v.length >= 1 && v.length <= 214;
|
|
97
99
|
/**
|
|
98
|
-
* Org settings of
|
|
100
|
+
* Org settings of automations (spec §9); every field reads leniently (invalid = default,
|
|
99
101
|
* except `forbiddenTools`, which keeps its valid entries). A stored `forbiddenTools` that is not a
|
|
100
102
|
* list (or a group that is not an object) reads as `[]` here, for display; enforcement checks
|
|
101
103
|
* {@link invalidStoredForbiddenTools} and fails unattended runs instead (never wider).
|
|
102
104
|
*/
|
|
103
|
-
export const
|
|
105
|
+
export const AutomationsSettingsSchema = z.object({
|
|
104
106
|
enabled: z.boolean().default(true).catch(true),
|
|
105
107
|
minIntervalMinutes: posInt(1_000_000, 60),
|
|
106
108
|
maxTasksPerMember: posInt(1_000_000, 20),
|
|
107
109
|
maxTasksPerOrg: posInt(1_000_000, 200),
|
|
110
|
+
// the runs one member's automations may start per hour (collaboration spec §4.7: per person)
|
|
108
111
|
maxRunsPerHour: posInt(1_000_000, 60),
|
|
109
112
|
defaultExpiryDays: z.number().int().min(1).max(36_500).nullable().default(null).catch(null),
|
|
110
113
|
catchUpWindowMinutes: posInt(1_000_000, 60),
|
|
111
114
|
unattendedAsk: z.enum(["fail", "wait"]).default("fail").catch("fail"),
|
|
112
115
|
pauseAfterFailures: posInt(1000, 5),
|
|
116
|
+
// event automations (collaboration spec §4.7): the chain depth past which an event is stored
|
|
117
|
+
// but not dispatched, the window that coalesces one subject's events into one run, and how many
|
|
118
|
+
// runs (up to this many, not skipped) one automation may make for one subject per hour
|
|
119
|
+
maxEventDepth: posInt(1000, 8),
|
|
120
|
+
coalesceSeconds: posInt(86_400, 30),
|
|
121
|
+
maxEventRunsPerSubjectPerHour: posInt(1_000_000, 12),
|
|
122
|
+
// the trigger sources (extension names) whose events fire no automation of the org; an invalid
|
|
123
|
+
// entry is dropped, the valid ones stay off
|
|
124
|
+
eventSourcesOff: z
|
|
125
|
+
.preprocess((v) => (Array.isArray(v) ? v.filter(isEventSourceEntry).slice(0, 200) : v), z.array(z.string()).max(200).default([]))
|
|
126
|
+
.catch([]),
|
|
113
127
|
// fail-safe: an invalid entry is dropped, the valid ones stay forbidden (never reset to []);
|
|
114
128
|
// past the PATCH's 500 the list is truncated
|
|
115
129
|
forbiddenTools: z
|
|
@@ -120,7 +134,7 @@ export const ScheduledTasksSettingsSchema = z.object({
|
|
|
120
134
|
* The PATCH form: a partial merge into the group (fields left out keep their stored value; see
|
|
121
135
|
* `OrgSettingsService.update`). A field given replaces that field whole, `forbiddenTools` too.
|
|
122
136
|
*/
|
|
123
|
-
export const
|
|
137
|
+
export const AutomationsPatchSchema = z
|
|
124
138
|
.object({
|
|
125
139
|
enabled: z.boolean(),
|
|
126
140
|
minIntervalMinutes: z.number().int().min(1).max(1_000_000),
|
|
@@ -131,6 +145,10 @@ export const ScheduledTasksPatchSchema = z
|
|
|
131
145
|
catchUpWindowMinutes: z.number().int().min(1).max(1_000_000),
|
|
132
146
|
unattendedAsk: z.enum(["fail", "wait"]),
|
|
133
147
|
pauseAfterFailures: z.number().int().min(1).max(1000),
|
|
148
|
+
maxEventDepth: z.number().int().min(1).max(1000),
|
|
149
|
+
coalesceSeconds: z.number().int().min(1).max(86_400),
|
|
150
|
+
maxEventRunsPerSubjectPerHour: z.number().int().min(1).max(1_000_000),
|
|
151
|
+
eventSourcesOff: z.array(z.string().min(1).max(214)).max(200),
|
|
134
152
|
forbiddenTools: z.array(z.string().min(1).max(200)).max(500),
|
|
135
153
|
})
|
|
136
154
|
.partial()
|
|
@@ -175,8 +193,8 @@ export const OrgSettingsSchema = z.object({
|
|
|
175
193
|
uiArrangement: UiArrangementSchema.optional().catch(undefined),
|
|
176
194
|
/** The org's git gateway switch and host sources; absent = on, sources chosen by default. */
|
|
177
195
|
gitGateway: GitGatewaySettingSchema.optional().catch({ ...GIT_GATEWAY_INVALID }),
|
|
178
|
-
/**
|
|
179
|
-
|
|
196
|
+
/** Automations (spec §9); the platform bounds clamp it, see `effectiveAutomationSettings`. */
|
|
197
|
+
automations: AutomationsSettingsSchema.prefault({}).catch(AutomationsSettingsSchema.parse({})),
|
|
180
198
|
/**
|
|
181
199
|
* Conversation compaction overrides (context compaction spec §4.8): every field given wins, the
|
|
182
200
|
* rest follow the platform; absent (or an invalid stored value) follows the platform entirely.
|
|
@@ -197,7 +215,7 @@ export const OrgSettingsSchema = z.object({
|
|
|
197
215
|
const viewOf = (settings, raw) => invalidStoredForbiddenTools(raw)
|
|
198
216
|
? {
|
|
199
217
|
...settings,
|
|
200
|
-
|
|
218
|
+
automations: { ...settings.automations, forbiddenToolsUnreadable: true },
|
|
201
219
|
}
|
|
202
220
|
: settings;
|
|
203
221
|
/** PATCH 体:只改给出的字段;未知字段 → 400。 */
|
|
@@ -237,8 +255,8 @@ export const OrgSettingsPatchSchema = z
|
|
|
237
255
|
* null removes a slot's entry (it follows the platform again). `platform.page` is refused.
|
|
238
256
|
*/
|
|
239
257
|
uiArrangement: OrgUiArrangementPatchSchema.optional(),
|
|
240
|
-
/** Fields to change in the
|
|
241
|
-
|
|
258
|
+
/** Fields to change in the automations group; the rest keep their value. */
|
|
259
|
+
automations: AutomationsPatchSchema.optional(),
|
|
242
260
|
/**
|
|
243
261
|
* Conversation compaction overrides (context compaction spec §4.8): a partial object merges
|
|
244
262
|
* into the stored fields (absent fields keep their value); null clears the whole override
|
|
@@ -324,13 +342,13 @@ export function invalidStoredSandboxToolPolicy(raw) {
|
|
|
324
342
|
return v !== undefined && !OrgSettingsPatchSchema.shape.sandboxToolPolicy.safeParse(v).success;
|
|
325
343
|
}
|
|
326
344
|
/**
|
|
327
|
-
* Whether the stored
|
|
345
|
+
* Whether the stored automation `forbiddenTools` cannot be read: the group or the field is
|
|
328
346
|
* present but not an object / a list. Unattended runs of such an org fail
|
|
329
347
|
* ({@link FORBIDDEN_TOOLS_UNREADABLE_ERROR}) rather than run with nothing forbidden. Invalid
|
|
330
348
|
* entries inside a list are dropped instead (the valid ones stay forbidden).
|
|
331
349
|
*/
|
|
332
350
|
export function invalidStoredForbiddenTools(raw) {
|
|
333
|
-
const group = asObject(raw).
|
|
351
|
+
const group = asObject(raw).automations;
|
|
334
352
|
if (group === undefined)
|
|
335
353
|
return false;
|
|
336
354
|
if (group === null || typeof group !== "object" || Array.isArray(group))
|
|
@@ -339,9 +357,9 @@ export function invalidStoredForbiddenTools(raw) {
|
|
|
339
357
|
return v !== undefined && !Array.isArray(v);
|
|
340
358
|
}
|
|
341
359
|
/** The refusal of an unattended run of an org whose `forbiddenTools` cannot be read. */
|
|
342
|
-
export const FORBIDDEN_TOOLS_UNREADABLE_ERROR = "The organization's forbidden tool list for
|
|
360
|
+
export const FORBIDDEN_TOOLS_UNREADABLE_ERROR = "The organization's forbidden tool list for automations is unreadable, so this scheduled run cannot continue; an org admin must save the list again in the organization's automation settings.";
|
|
343
361
|
/** The refusal of a new task grant while the org's `forbiddenTools` cannot be read. */
|
|
344
|
-
export const FORBIDDEN_TOOLS_UNREADABLE_GRANT_ERROR = "The organization's forbidden tool list for
|
|
362
|
+
export const FORBIDDEN_TOOLS_UNREADABLE_GRANT_ERROR = "The organization's forbidden tool list for automations is unreadable, so no tool can be approved for a task now; an org admin must save the list again in the organization's automation settings.";
|
|
345
363
|
/**
|
|
346
364
|
* Logs (through `log`, at the caller's level) the security settings a stored value reads narrower
|
|
347
365
|
* than written, with the org id.
|
|
@@ -351,7 +369,7 @@ export function logUnreadableSecuritySettings(log, orgId, raw) {
|
|
|
351
369
|
log("org settings: stored sandboxToolPolicy is invalid; it reads as ask", { orgId });
|
|
352
370
|
}
|
|
353
371
|
if (invalidStoredForbiddenTools(raw)) {
|
|
354
|
-
log("org settings: stored
|
|
372
|
+
log("org settings: stored automations.forbiddenTools is unreadable; unattended runs fail until an org admin saves it again", { orgId });
|
|
355
373
|
}
|
|
356
374
|
}
|
|
357
375
|
const outsideSandboxNotAllowed = (message) => new ApiError("org.outside_sandbox_not_allowed", message);
|
|
@@ -694,13 +712,13 @@ let OrgSettingsService = class OrgSettingsService {
|
|
|
694
712
|
const arrangementPatch = patch.uiArrangement;
|
|
695
713
|
const compactionPatch = patch.compaction;
|
|
696
714
|
delete changes.uiArrangement;
|
|
697
|
-
delete changes.
|
|
715
|
+
delete changes.automations;
|
|
698
716
|
delete changes.compaction;
|
|
699
717
|
const after = { ...before, ...changes };
|
|
700
|
-
if (patch.
|
|
701
|
-
after.
|
|
702
|
-
...before.
|
|
703
|
-
...Object.fromEntries(Object.entries(patch.
|
|
718
|
+
if (patch.automations !== undefined) {
|
|
719
|
+
after.automations = AutomationsSettingsSchema.parse({
|
|
720
|
+
...before.automations,
|
|
721
|
+
...Object.fromEntries(Object.entries(patch.automations).filter(([, v]) => v !== undefined)),
|
|
704
722
|
});
|
|
705
723
|
}
|
|
706
724
|
if (compactionPatch !== undefined) {
|
|
@@ -747,7 +765,7 @@ let OrgSettingsService = class OrgSettingsService {
|
|
|
747
765
|
if (after.promptSuggestions === undefined)
|
|
748
766
|
delete after.promptSuggestions;
|
|
749
767
|
// saving an unreadable security setting writes it even when it equals what it read as
|
|
750
|
-
const repairs = (invalidStoredForbiddenTools(stored) && patch.
|
|
768
|
+
const repairs = (invalidStoredForbiddenTools(stored) && patch.automations?.forbiddenTools !== undefined) ||
|
|
751
769
|
(invalidStoredSandboxToolPolicy(stored) && patch.sandboxToolPolicy !== undefined);
|
|
752
770
|
if (!repairs && sameSettings(before, after))
|
|
753
771
|
return viewOf(before, stored);
|
|
@@ -758,15 +776,15 @@ let OrgSettingsService = class OrgSettingsService {
|
|
|
758
776
|
}
|
|
759
777
|
// Merge with the stored value: keep the keys this version does not know (a cleared
|
|
760
778
|
// outsideSandbox / deviceNetwork is not kept; the old keys are rewritten in step)
|
|
761
|
-
const { autoMode: _legacyAutoMode, fullAccess: _legacyFullAccess, cloudNetwork: _legacyNetwork, outsideSandbox: _oldOutside, deviceNetwork: _oldNetwork, deviceDefaultProvider: _oldDeviceProvider, wakeOnBackgroundTask: _oldWake, timeZone: _oldZone, theme: _oldTheme, uiArrangement: _oldArrangement,
|
|
779
|
+
const { autoMode: _legacyAutoMode, fullAccess: _legacyFullAccess, cloudNetwork: _legacyNetwork, outsideSandbox: _oldOutside, deviceNetwork: _oldNetwork, deviceDefaultProvider: _oldDeviceProvider, wakeOnBackgroundTask: _oldWake, timeZone: _oldZone, theme: _oldTheme, uiArrangement: _oldArrangement, automations: _oldAutomations, compaction: _oldCompaction, externalSharing: _oldExternalSharing, promptSuggestions: _oldPromptSuggestions, ...rest } = stored;
|
|
762
780
|
const written = { ...rest, ...after };
|
|
763
781
|
keepOrgLegacyKeysInStep(written, stored);
|
|
764
782
|
// An unreadable forbiddenTools reads as [] for display only: a write that does not replace the
|
|
765
783
|
// list keeps it unreadable (never healed to "nothing forbidden"); saving the list fixes it
|
|
766
|
-
if (invalidStoredForbiddenTools(stored) && patch.
|
|
767
|
-
const group = asObject(stored.
|
|
768
|
-
written.
|
|
769
|
-
...after.
|
|
784
|
+
if (invalidStoredForbiddenTools(stored) && patch.automations?.forbiddenTools === undefined) {
|
|
785
|
+
const group = asObject(stored.automations);
|
|
786
|
+
written.automations = {
|
|
787
|
+
...after.automations,
|
|
770
788
|
forbiddenTools: group.forbiddenTools ?? null,
|
|
771
789
|
};
|
|
772
790
|
}
|
package/dist/overrides.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ import { OUTBOX_FAST_PATH_SETTLED } from "./infra/outbox/outbox.module.js";
|
|
|
20
20
|
import { PRESENCE_INTERVAL_MS } from "./infra/presence/replica-presence.js";
|
|
21
21
|
import type { KernelQueueName } from "./infra/queue/queue-names.js";
|
|
22
22
|
import { PUSH_SEND_TIMEOUT_MS } from "./push/delivery.js";
|
|
23
|
-
import { PROJECT_KNOWLEDGE_TIMEOUT } from "./runtime/project/knowledge.service.js";
|
|
23
|
+
import { PROJECT_KNOWLEDGE_TIMEOUT, type ProjectKnowledgeTimeouts } from "./runtime/project/knowledge.service.js";
|
|
24
24
|
import { LIST_MODELS_TIMEOUT } from "./runtime/providers.js";
|
|
25
25
|
import { RUN_CONTEXT_CLOCK } from "./runtime/run-context.service.js";
|
|
26
26
|
import { ENSURE_RUN_FAILS } from "./runtime/run-queue.js";
|
|
@@ -58,8 +58,8 @@ import { EMBED_TOKEN_CLOCK } from "./ui/embed-token.js";
|
|
|
58
58
|
* - `OUTBOX_FAST_PATH_SETTLED`: receives each detached outbox fast-path pass (a test awaits them);
|
|
59
59
|
* - `ENSURE_RUN_FAILS`: returns true to make `RunQueue.ensureRun` throw (Redis unreachable, or the
|
|
60
60
|
* direct call after a commit skipped by a crash);
|
|
61
|
-
* - `PROJECT_KNOWLEDGE_TIMEOUT`: the run-start read of a bound project's time
|
|
62
|
-
* read (a test shortens
|
|
61
|
+
* - `PROJECT_KNOWLEDGE_TIMEOUT`: the run-start read of a bound project's time limits (the device's
|
|
62
|
+
* start, the read), read at every read (a test shortens them for one run);
|
|
63
63
|
* - `PUSH_SEND_TIMEOUT_MS`: one push send's time limit, read at every send (a test shortens it
|
|
64
64
|
* for a hanging provider);
|
|
65
65
|
* - `BACKGROUND_STOP_ATTEMPT_MS`: one exact background task stop attempt's time limit, read at
|
|
@@ -99,7 +99,7 @@ interface KernelSeams {
|
|
|
99
99
|
[OUTBOX_FAST_PATH_SETTLED]: (pass: Promise<void>) => void;
|
|
100
100
|
[ENSURE_RUN_FAILS]: () => boolean;
|
|
101
101
|
[SCOPE_ORG_CHUNK_SIZE]: number;
|
|
102
|
-
[PROJECT_KNOWLEDGE_TIMEOUT]: () =>
|
|
102
|
+
[PROJECT_KNOWLEDGE_TIMEOUT]: () => ProjectKnowledgeTimeouts;
|
|
103
103
|
[PROMPT_SUGGESTION_TIMEOUT]: () => number;
|
|
104
104
|
[PUSH_SEND_TIMEOUT_MS]: () => number;
|
|
105
105
|
[BACKGROUND_STOP_ATTEMPT_MS]: () => number;
|
package/dist/overrides.js
CHANGED
|
@@ -17,7 +17,7 @@ import { OUTBOX_DISPATCH_FAILS } from "./infra/outbox/outbox.dispatcher.js";
|
|
|
17
17
|
import { OUTBOX_FAST_PATH_SETTLED } from "./infra/outbox/outbox.module.js";
|
|
18
18
|
import { PRESENCE_INTERVAL_MS } from "./infra/presence/replica-presence.js";
|
|
19
19
|
import { PUSH_SEND_TIMEOUT_MS } from "./push/delivery.js";
|
|
20
|
-
import { PROJECT_KNOWLEDGE_TIMEOUT } from "./runtime/project/knowledge.service.js";
|
|
20
|
+
import { PROJECT_KNOWLEDGE_TIMEOUT, } from "./runtime/project/knowledge.service.js";
|
|
21
21
|
import { LIST_MODELS_TIMEOUT } from "./runtime/providers.js";
|
|
22
22
|
import { RUN_CONTEXT_CLOCK } from "./runtime/run-context.service.js";
|
|
23
23
|
import { ENSURE_RUN_FAILS } from "./runtime/run-queue.js";
|
|
@@ -502,6 +502,11 @@ export const PLATFORM_EXCLUSIONS = [
|
|
|
502
502
|
category: "human-only",
|
|
503
503
|
reason: "A person's own sign-in with a password: completes a pending link and signs in",
|
|
504
504
|
},
|
|
505
|
+
{
|
|
506
|
+
route: "POST /api/v1/auth/handoffs/redeem",
|
|
507
|
+
category: "human-only",
|
|
508
|
+
reason: "Redeems a shell's browser handoff in the person's own signed-in browser; it starts an OAuth or SSO flow there",
|
|
509
|
+
},
|
|
505
510
|
{
|
|
506
511
|
route: "GET /api/v1/bind/:token",
|
|
507
512
|
category: "human-only",
|
|
@@ -92,8 +92,8 @@ export const PLATFORM_DOMAINS = [
|
|
|
92
92
|
description: "Your own cloud devices (the workspaces your conversations run in): list, read, create, rename, narrow the sandbox network, delete, wipe the files.",
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
|
-
id: "
|
|
96
|
-
description: "Your
|
|
95
|
+
id: "automations",
|
|
96
|
+
description: "Your automations (an agent runs a prompt on a schedule, as you, unattended): list, read, create, edit, pause, resume, delete, run now or as a trial, run history, and the tools approved for a task.",
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
99
|
id: "setup",
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { type OnModuleInit } from "@nestjs/common";
|
|
2
|
-
import {
|
|
2
|
+
import { AutomationsService } from "../../automations/automations.service.js";
|
|
3
3
|
import { PlatformOperations } from "../registry.js";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Automation operations of the `Platform` tool (scheduled tasks spec §10): the same service
|
|
6
6
|
* as the HTTP routes. Writes are `personal`. Creating or changing a task and its approved tools
|
|
7
7
|
* are never remembered (`rememberable: false`): an approval, remembered or granted to a task,
|
|
8
8
|
* must never let an unattended run create or widen a task. Delete, run and resume are never
|
|
9
9
|
* remembered either. List, pause and delete are `org.read` like their routes: a creator demoted
|
|
10
10
|
* to guest can still see and stop their own tasks (the service decides by ownership).
|
|
11
11
|
*/
|
|
12
|
-
export declare class
|
|
12
|
+
export declare class AutomationsOperations implements OnModuleInit {
|
|
13
13
|
private readonly registry;
|
|
14
14
|
private readonly tasks;
|
|
15
|
-
constructor(registry: PlatformOperations, tasks:
|
|
15
|
+
constructor(registry: PlatformOperations, tasks: AutomationsService);
|
|
16
16
|
/** The caller as the service expects (it reads the live role itself). */
|
|
17
17
|
private actor;
|
|
18
18
|
/** The task's name for a card; its id when it cannot be read. */
|