@capybara-hq/kernel 0.1.0-rc.105 → 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.
Files changed (211) hide show
  1. package/dist/agents/agents.schemas.d.ts +9 -9
  2. package/dist/{schedules/schedules.controller.d.ts → automations/automations.controller.d.ts} +37 -32
  3. package/dist/{schedules/schedules.controller.js → automations/automations.controller.js} +68 -57
  4. package/dist/automations/automations.module.d.ts +16 -0
  5. package/dist/{schedules/schedules.module.js → automations/automations.module.js} +18 -15
  6. package/dist/{schedules/schedules.schemas.d.ts → automations/automations.schemas.d.ts} +151 -50
  7. package/dist/automations/automations.schemas.js +253 -0
  8. package/dist/{schedules/scheduled-tasks.service.d.ts → automations/automations.service.d.ts} +99 -52
  9. package/dist/{schedules/scheduled-tasks.service.js → automations/automations.service.js} +303 -134
  10. package/dist/{schedules → automations}/calendar.d.ts +8 -8
  11. package/dist/{schedules → automations}/calendar.js +2 -2
  12. package/dist/automations/effective-settings.d.ts +28 -0
  13. package/dist/automations/effective-settings.js +25 -0
  14. package/dist/automations/errors.d.ts +19 -0
  15. package/dist/automations/errors.js +19 -0
  16. package/dist/automations/events/coalesce.d.ts +28 -0
  17. package/dist/automations/events/coalesce.js +131 -0
  18. package/dist/automations/events/deadline.d.ts +10 -0
  19. package/dist/automations/events/deadline.js +24 -0
  20. package/dist/automations/events/dispatcher.d.ts +74 -0
  21. package/dist/automations/events/dispatcher.js +353 -0
  22. package/dist/automations/events/events.module.d.ts +7 -0
  23. package/dist/automations/events/events.module.js +26 -0
  24. package/dist/automations/events/guards.d.ts +32 -0
  25. package/dist/automations/events/guards.js +87 -0
  26. package/dist/automations/events/sweep.job.d.ts +49 -0
  27. package/dist/automations/events/sweep.job.js +202 -0
  28. package/dist/automations/events/token.d.ts +5 -0
  29. package/dist/automations/events/token.js +5 -0
  30. package/dist/automations/events/trigger-events.service.d.ts +47 -0
  31. package/dist/automations/events/trigger-events.service.js +254 -0
  32. package/dist/{schedules → automations}/fire.d.ts +57 -17
  33. package/dist/{schedules → automations}/fire.js +311 -79
  34. package/dist/{schedules → automations}/grant-rules.d.ts +1 -1
  35. package/dist/{schedules → automations}/grant-rules.js +5 -5
  36. package/dist/automations/job-ids.d.ts +113 -0
  37. package/dist/automations/job-ids.js +117 -0
  38. package/dist/{schedules → automations}/pause.d.ts +3 -3
  39. package/dist/{schedules → automations}/pause.js +3 -3
  40. package/dist/{schedules → automations}/run-tracker.d.ts +21 -10
  41. package/dist/{schedules → automations}/run-tracker.js +68 -56
  42. package/dist/{schedules → automations}/scan.job.d.ts +12 -8
  43. package/dist/{schedules → automations}/scan.job.js +39 -23
  44. package/dist/{schedules → automations}/schedule-math.d.ts +19 -12
  45. package/dist/{schedules → automations}/schedule-math.js +17 -7
  46. package/dist/{schedules → automations}/store.d.ts +57 -27
  47. package/dist/{schedules → automations}/store.js +102 -52
  48. package/dist/automations/store.module.d.ts +6 -0
  49. package/dist/{schedules → automations}/store.module.js +9 -9
  50. package/dist/automations/types.d.ts +178 -0
  51. package/dist/{schedules → automations}/unattended.d.ts +22 -11
  52. package/dist/{schedules → automations}/unattended.js +53 -30
  53. package/dist/catalog/marketplaces.service.d.ts +1 -1
  54. package/dist/channels/channels.module.js +3 -3
  55. package/dist/channels/outbound.d.ts +5 -5
  56. package/dist/channels/outbound.js +17 -17
  57. package/dist/channels/threads.d.ts +1 -1
  58. package/dist/channels/threads.js +1 -1
  59. package/dist/config/schema.d.ts +5 -1
  60. package/dist/config/schema.js +44 -6
  61. package/dist/conversations/approval-profile.d.ts +2 -2
  62. package/dist/conversations/approval-profile.js +3 -3
  63. package/dist/conversations/conversations.controller.d.ts +7 -1
  64. package/dist/conversations/conversations.controller.js +26 -10
  65. package/dist/conversations/conversations.service.d.ts +101 -25
  66. package/dist/conversations/conversations.service.js +132 -32
  67. package/dist/conversations/events.d.ts +46 -0
  68. package/dist/conversations/events.js +54 -3
  69. package/dist/conversations/message-context.d.ts +2 -2
  70. package/dist/conversations/message-context.js +1 -1
  71. package/dist/conversations/permission-profile-store.d.ts +2 -1
  72. package/dist/conversations/permission-profiles.controller.d.ts +3 -0
  73. package/dist/conversations/permission-profiles.service.js +1 -1
  74. package/dist/conversations/prompt-suggestion-request.d.ts +1 -1
  75. package/dist/conversations/prompt-suggestion-request.js +2 -1
  76. package/dist/conversations/queue.d.ts +7 -4
  77. package/dist/conversations/queue.js +6 -2
  78. package/dist/conversations/queue.service.d.ts +5 -5
  79. package/dist/conversations/queue.service.js +20 -14
  80. package/dist/ctx/create-ctx.d.ts +20 -1
  81. package/dist/ctx/create-ctx.js +59 -2
  82. package/dist/db/kernel-schema.d.ts +104 -25
  83. package/dist/devices/device-project-files.service.d.ts +88 -0
  84. package/dist/devices/device-project-files.service.js +249 -0
  85. package/dist/devices/device-projects.service.d.ts +40 -0
  86. package/dist/devices/device-projects.service.js +16 -13
  87. package/dist/devices/devices.controller.d.ts +9 -3
  88. package/dist/devices/devices.controller.js +27 -5
  89. package/dist/devices/devices.module.js +9 -1
  90. package/dist/devices/devices.schemas.js +6 -1
  91. package/dist/devices/dto.d.ts +15 -0
  92. package/dist/devices/dto.js +11 -0
  93. package/dist/devices/project-paths.d.ts +29 -0
  94. package/dist/devices/project-paths.js +66 -0
  95. package/dist/devices/project-rules.d.ts +5 -1
  96. package/dist/devices/project-rules.js +5 -1
  97. package/dist/errors.d.ts +34 -13
  98. package/dist/errors.js +34 -13
  99. package/dist/evals/reconstruct.d.ts +10 -1
  100. package/dist/evals/reconstruct.js +7 -0
  101. package/dist/extensions/host.d.ts +6 -1
  102. package/dist/extensions/host.js +10 -0
  103. package/dist/extensions/permission-set.d.ts +17 -1
  104. package/dist/extensions/permission-set.js +13 -1
  105. package/dist/extensions/permission-view.d.ts +1 -1
  106. package/dist/extensions/permission-view.js +4 -1
  107. package/dist/git/gateway.js +2 -2
  108. package/dist/http/api.module.js +5 -5
  109. package/dist/http/request-signal.d.ts +8 -0
  110. package/dist/http/request-signal.js +14 -0
  111. package/dist/inbox/inbox.module.js +2 -2
  112. package/dist/inbox/inbox.service.d.ts +8 -8
  113. package/dist/inbox/inbox.service.js +7 -7
  114. package/dist/infra/config/kernel-config.service.js +10 -5
  115. package/dist/infra/outbox/registry.d.ts +29 -2
  116. package/dist/infra/outbox/registry.js +30 -7
  117. package/dist/kernel.module.js +3 -0
  118. package/dist/orgs/roles.d.ts +1 -1
  119. package/dist/orgs/roles.js +3 -3
  120. package/dist/orgs/settings.controller.d.ts +1 -1
  121. package/dist/orgs/settings.service.d.ts +27 -11
  122. package/dist/orgs/settings.service.js +42 -24
  123. package/dist/platform/operation.js +2 -2
  124. package/dist/platform/ops/{schedules.ops.d.ts → automations.ops.d.ts} +4 -4
  125. package/dist/platform/ops/automations.ops.js +560 -0
  126. package/dist/platform/ops/devices.ops.d.ts +3 -1
  127. package/dist/platform/ops/devices.ops.js +77 -3
  128. package/dist/platform/ops/inbox.ops.js +4 -4
  129. package/dist/platform/ops/orgs.ops.js +1 -1
  130. package/dist/platform/ops/platform.ops.js +4 -4
  131. package/dist/platform/platform-ops.module.d.ts +2 -2
  132. package/dist/platform/platform-ops.module.js +5 -5
  133. package/dist/platform/route-schemas.js +3 -3
  134. package/dist/push/jobs.d.ts +3 -3
  135. package/dist/push/jobs.js +2 -2
  136. package/dist/push/preferences.service.js +1 -1
  137. package/dist/push/push-owed.d.ts +3 -3
  138. package/dist/push/push-owed.js +6 -6
  139. package/dist/push/push.schemas.d.ts +4 -4
  140. package/dist/push/push.schemas.js +3 -3
  141. package/dist/push/recipients.d.ts +4 -4
  142. package/dist/push/recipients.js +23 -23
  143. package/dist/push/texts.d.ts +3 -3
  144. package/dist/push/texts.js +2 -2
  145. package/dist/push/triggers.d.ts +1 -1
  146. package/dist/roles/worker.module.js +3 -3
  147. package/dist/runtime/context/build.d.ts +6 -0
  148. package/dist/runtime/context/build.js +14 -3
  149. package/dist/runtime/context/compaction.js +15 -5
  150. package/dist/runtime/context/run-context.d.ts +38 -0
  151. package/dist/runtime/context/run-context.js +54 -0
  152. package/dist/runtime/maintenance.d.ts +8 -4
  153. package/dist/runtime/maintenance.js +37 -16
  154. package/dist/runtime/run-finish.d.ts +4 -4
  155. package/dist/runtime/run-finish.js +3 -3
  156. package/dist/runtime/run-queue.js +12 -7
  157. package/dist/runtime/run-worker.js +7 -1
  158. package/dist/runtime/runtime.module.js +3 -3
  159. package/dist/runtime/subagents/dispatch.js +11 -3
  160. package/dist/sandbox/browse-roots.d.ts +8 -0
  161. package/dist/sandbox/browse-roots.js +22 -0
  162. package/dist/sandbox/network-grants.d.ts +4 -4
  163. package/dist/sandbox/network-grants.js +7 -7
  164. package/dist/sandbox/operation-authority.d.ts +10 -3
  165. package/dist/sandbox/operation-authority.js +20 -10
  166. package/dist/sandbox/operation-intents.d.ts +3 -1
  167. package/dist/sandbox/operation-intents.js +11 -4
  168. package/dist/sandbox/permission-call-grants.js +2 -2
  169. package/dist/sandbox/permission-facts.js +1 -1
  170. package/dist/sandbox/review/classifier.d.ts +2 -2
  171. package/dist/sandbox/review/classifier.js +22 -11
  172. package/dist/sandbox/review/permission-candidate.d.ts +1 -1
  173. package/dist/sandbox/review/permission-candidate.js +1 -1
  174. package/dist/sandbox/sandbox.service.d.ts +15 -5
  175. package/dist/sandbox/sandbox.service.js +14 -8
  176. package/dist/storage/purge.d.ts +1 -1
  177. package/dist/storage/purge.js +2 -2
  178. package/dist/tools/approvals.service.d.ts +6 -6
  179. package/dist/tools/approvals.service.js +19 -19
  180. package/dist/tools/builtin-names.d.ts +12 -12
  181. package/dist/tools/builtin-names.js +29 -29
  182. package/dist/tools/builtins/{schedules.d.ts → automations.d.ts} +35 -33
  183. package/dist/tools/builtins/{schedules.js → automations.js} +236 -105
  184. package/dist/tools/builtins/builtin-tools.d.ts +8 -8
  185. package/dist/tools/builtins/builtin-tools.js +16 -16
  186. package/dist/tools/call-scope.d.ts +1 -1
  187. package/dist/tools/git-asks.js +1 -1
  188. package/dist/tools/git-push-policy.d.ts +3 -3
  189. package/dist/tools/git-push-policy.js +6 -6
  190. package/dist/tools/network-asks.d.ts +3 -3
  191. package/dist/tools/network-asks.js +3 -3
  192. package/dist/tools/pipeline.d.ts +4 -4
  193. package/dist/tools/pipeline.js +2 -2
  194. package/dist/tools/policy.d.ts +3 -3
  195. package/dist/tools/policy.js +3 -3
  196. package/dist/tools/tools.module.js +9 -9
  197. package/package.json +3 -3
  198. package/src/migrations/0188_automations_rename.sql +309 -0
  199. package/src/migrations/0189_event_automations.sql +136 -0
  200. package/dist/platform/ops/schedules.ops.js +0 -509
  201. package/dist/schedules/effective-settings.d.ts +0 -22
  202. package/dist/schedules/effective-settings.js +0 -18
  203. package/dist/schedules/errors.d.ts +0 -8
  204. package/dist/schedules/errors.js +0 -8
  205. package/dist/schedules/job-ids.d.ts +0 -81
  206. package/dist/schedules/job-ids.js +0 -95
  207. package/dist/schedules/schedules.module.d.ts +0 -16
  208. package/dist/schedules/schedules.schemas.js +0 -213
  209. package/dist/schedules/store.module.d.ts +0 -6
  210. package/dist/schedules/types.d.ts +0 -110
  211. /package/dist/{schedules → automations}/types.js +0 -0
@@ -1,4 +1,5 @@
1
1
  import type { Logger } from "@capybara-hq/plugin-sdk";
2
+ import { AutomationStore } from "../../automations/store.js";
2
3
  import { BackgroundTaskFinisher } from "../../background/finish.js";
3
4
  import { BackgroundTaskStopper } from "../../background/stop.js";
4
5
  import { BackgroundTaskStore } from "../../background/store.js";
@@ -20,11 +21,10 @@ import { ProviderRegistry } from "../../runtime/providers.js";
20
21
  import { StepLog } from "../../runtime/step-log.js";
21
22
  import { ManagedDeviceContextRecorder } from "../../sandbox/managed-device-context.js";
22
23
  import { SandboxService } from "../../sandbox/sandbox.service.js";
23
- import { ScheduledTaskStore } from "../../schedules/store.js";
24
24
  import { StorageService } from "../../storage/storage.service.js";
25
25
  import { ToolOutputs } from "../outputs.js";
26
26
  import type { BuiltinCallContext, BuiltinTool } from "../registry.js";
27
- import { ScheduleToolsPort, ScheduleUpdates } from "./schedules.js";
27
+ import { AutomationToolsPort, AutomationUpdates } from "./automations.js";
28
28
  import { WebPages } from "./web/index.js";
29
29
  /**
30
30
  * The kernel's builtin tools, built once from the injected services (their specs: names,
@@ -43,12 +43,12 @@ export declare class BuiltinTools {
43
43
  sealedInputs: SealedInputs,
44
44
  /** A Platform write's file reference: a conversation file (spec §5). */
45
45
  fileRefs: FileRefs,
46
- /** The schedule tools read tasks and grants; their writes go through the task service. */
47
- scheduleStore: ScheduledTaskStore,
48
- /** `ScheduleUpdate`'s write: its field change and grant changes in one transaction. */
49
- scheduleUpdates: ScheduleUpdates,
50
- /** The task service, bound by `SchedulesModule` at start (a registration port: no cycle). */
51
- schedulePort: ScheduleToolsPort,
46
+ /** The automation tools read tasks and grants; their writes go through the task service. */
47
+ automationStore: AutomationStore,
48
+ /** `AutomationUpdate`'s write: its field change and grant changes in one transaction. */
49
+ automationUpdates: AutomationUpdates,
50
+ /** The task service, bound by `AutomationsModule` at start (a registration port: no cycle). */
51
+ automationPort: AutomationToolsPort,
52
52
  /** `GenerateImage`: the image calls, and the image model's availability per listing. */
53
53
  images: ModelImages, providers: ProviderRegistry,
54
54
  /** The clock `CurrentTime` reads (the run context's clock seam; `Date.now` by default). */
@@ -8,6 +8,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
8
8
  return function (target, key) { decorator(target, key, paramIndex); }
9
9
  };
10
10
  import { Inject, Injectable, Optional } from "@nestjs/common";
11
+ import { AutomationStore } from "../../automations/store.js";
11
12
  import { BackgroundTaskFinisher } from "../../background/finish.js";
12
13
  import { BackgroundTaskStopper } from "../../background/stop.js";
13
14
  import { BackgroundTaskStore } from "../../background/store.js";
@@ -35,18 +36,17 @@ import { conversationTimeZone, RUN_CONTEXT_CLOCK } from "../../runtime/run-conte
35
36
  import { StepLog } from "../../runtime/step-log.js";
36
37
  import { ManagedDeviceContextRecorder } from "../../sandbox/managed-device-context.js";
37
38
  import { SandboxService } from "../../sandbox/sandbox.service.js";
38
- import { ScheduledTaskStore } from "../../schedules/store.js";
39
39
  import { StorageService } from "../../storage/storage.service.js";
40
40
  import { ToolOutputs } from "../outputs.js";
41
41
  import { agentTool } from "./agent.js";
42
42
  import { askUserTool } from "./ask-user.js";
43
+ import { AutomationToolsPort, AutomationUpdates, automationTools } from "./automations.js";
43
44
  import { currentTimeTool } from "./current-time.js";
44
45
  import { handbackTool } from "./handback.js";
45
46
  import { generateImageTool } from "./image/index.js";
46
47
  import { platformTool } from "./platform.js";
47
48
  import { readToolOutputTool } from "./read-tool-output.js";
48
49
  import { sandboxTools } from "./sandbox/index.js";
49
- import { ScheduleToolsPort, ScheduleUpdates, scheduleTools } from "./schedules.js";
50
50
  import { sendMessageTool } from "./send-message.js";
51
51
  import { skillLoadTool } from "./skill-load.js";
52
52
  import { toolSearchTool } from "./tool-search.js";
@@ -66,12 +66,12 @@ let BuiltinTools = class BuiltinTools {
66
66
  sealedInputs,
67
67
  /** A Platform write's file reference: a conversation file (spec §5). */
68
68
  fileRefs,
69
- /** The schedule tools read tasks and grants; their writes go through the task service. */
70
- scheduleStore,
71
- /** `ScheduleUpdate`'s write: its field change and grant changes in one transaction. */
72
- scheduleUpdates,
73
- /** The task service, bound by `SchedulesModule` at start (a registration port: no cycle). */
74
- schedulePort,
69
+ /** The automation tools read tasks and grants; their writes go through the task service. */
70
+ automationStore,
71
+ /** `AutomationUpdate`'s write: its field change and grant changes in one transaction. */
72
+ automationUpdates,
73
+ /** The task service, bound by `AutomationsModule` at start (a registration port: no cycle). */
74
+ automationPort,
75
75
  /** `GenerateImage`: the image calls, and the image model's availability per listing. */
76
76
  images, providers,
77
77
  /** The clock `CurrentTime` reads (the run context's clock seam; `Date.now` by default). */
@@ -211,13 +211,13 @@ let BuiltinTools = class BuiltinTools {
211
211
  now: now ?? Date.now,
212
212
  timeZoneOf: ({ orgId, conversationId }) => conversationTimeZone(db.db, orgId, conversationId),
213
213
  }),
214
- // the person's scheduled tasks (scheduled tasks spec §11)
215
- ...scheduleTools({
214
+ // the person's automations (scheduled tasks spec §11)
215
+ ...automationTools({
216
216
  db: () => db.db,
217
217
  config,
218
- store: scheduleStore,
219
- service: () => schedulePort.get(),
220
- updates: scheduleUpdates,
218
+ store: automationStore,
219
+ service: () => automationPort.get(),
220
+ updates: automationUpdates,
221
221
  timeZoneOf: (orgId, conversationId) => conversationTimeZone(db.db, orgId, conversationId),
222
222
  now: now ?? Date.now,
223
223
  }),
@@ -252,9 +252,9 @@ BuiltinTools = __decorate([
252
252
  __param(19, Inject(AgentDocs)),
253
253
  __param(20, Inject(SealedInputs)),
254
254
  __param(21, Inject(FileRefs)),
255
- __param(22, Inject(ScheduledTaskStore)),
256
- __param(23, Inject(ScheduleUpdates)),
257
- __param(24, Inject(ScheduleToolsPort)),
255
+ __param(22, Inject(AutomationStore)),
256
+ __param(23, Inject(AutomationUpdates)),
257
+ __param(24, Inject(AutomationToolsPort)),
258
258
  __param(25, Inject(ModelImages)),
259
259
  __param(26, Inject(ProviderRegistry)),
260
260
  __param(27, Inject(ManagedDeviceContextRecorder)),
@@ -15,7 +15,7 @@ export interface CallFacts {
15
15
  step: number;
16
16
  /** The root conversation of the run's tree (a sub-agent works in its root's device). */
17
17
  rootConversationId: string;
18
- /** An unattended run (a scheduled task): nobody is there to answer an ask. */
18
+ /** An unattended run (an automation): nobody is there to answer an ask. */
19
19
  unattended: boolean;
20
20
  agentVersion: number;
21
21
  conversationKind?: ConversationKindForHooks;
@@ -1,5 +1,5 @@
1
+ import { gitPushGrantKey, normalizeGitRepo } from "../automations/grant-rules.js";
1
2
  import { GIT_ASK_MAX_REFS, GIT_REF_MAX_CHARS } from "../conversations/events.js";
2
- import { gitPushGrantKey, normalizeGitRepo } from "../schedules/grant-rules.js";
3
3
  import { GIT_ASK_CANCELLED_NOTE } from "./approvals.service.js";
4
4
  import { clipKeptWith } from "./network-asks.js";
5
5
  /**
@@ -1,6 +1,6 @@
1
+ import { type UnattendedRun } from "../automations/unattended.js";
1
2
  import type { KernelSchemaDb } from "../db/kernel-schema.js";
2
3
  import type { KernelConfigService } from "../infra/config/kernel-config.service.js";
3
- import { type UnattendedRun } from "../schedules/unattended.js";
4
4
  import { type GitRunState } from "./git-asks.js";
5
5
  import type { ToolPolicy } from "./registry.js";
6
6
  /** Why {@link decideGitPush} decided as it did. */
@@ -11,7 +11,7 @@ export type GitPushReason =
11
11
  | "member_allow"
12
12
  /** An approved 「这次允许」 of the run tree for the repository. */
13
13
  | "run_grant"
14
- /** The scheduled task's `git:push` / `git:push:<owner>/<repo>` grant (unattended run). */
14
+ /** The automation's `git:push` / `git:push:<owner>/<repo>` grant (unattended run). */
15
15
  | "task_grant"
16
16
  /** The policy asks the actor. */
17
17
  | "ask"
@@ -55,7 +55,7 @@ export interface GitPushInput {
55
55
  /** `<owner>/<repo>` (a trailing `.git` and case are normalized here). */
56
56
  repo: string;
57
57
  /**
58
- * The scheduled task context of the run, when the caller has it (`unattendedRunOf`); undefined:
58
+ * The automation context of the run, when the caller has it (`unattendedRunOf`); undefined:
59
59
  * read here. Null: an attended run.
60
60
  */
61
61
  unattended?: UnattendedRun | null;
@@ -1,7 +1,7 @@
1
1
  import { sql } from "kysely";
2
+ import { GIT_PUSH_GRANT, gitPushForbidden, gitPushGrantKey, normalizeGitRepo, } from "../automations/grant-rules.js";
3
+ import { unattendedRules, unattendedRunOf } from "../automations/unattended.js";
2
4
  import { budgetRunOf } from "../runtime/subagents/limits.js";
3
- import { GIT_PUSH_GRANT, gitPushForbidden, gitPushGrantKey, normalizeGitRepo, } from "../schedules/grant-rules.js";
4
- import { unattendedRules, unattendedRunOf } from "../schedules/unattended.js";
5
5
  import { gitPushPolicyName, personalAuth } from "./connector-account-policies.js";
6
6
  import { gitRepoKey } from "./git-asks.js";
7
7
  import { connectorPolicy } from "./policy.js";
@@ -13,8 +13,8 @@ import { connectorPolicy } from "./policy.js";
13
13
  * Storage (no new table): the org's default is `connectors.git_push_policy` (default `ask`); a
14
14
  * member's standing allow (or deny) for one repository is their `connector_tool_account_policies`
15
15
  * row `git_push:<host>/<owner>/<repo>` (a personal connector only: an org connector's push acts as the
16
- * org); a run grant is an approved `once` git ask of the run tree; a scheduled task's grants are
17
- * `git:push` and `git:push:<owner>/<repo>` in `scheduled_task_grants`.
16
+ * org); a run grant is an approved `once` git ask of the run tree; an automation's grants are
17
+ * `git:push` and `git:push:<owner>/<repo>` in `automation_grants`.
18
18
  */
19
19
  /** The statuses of a run that has not ended: its run grants still apply. */
20
20
  const LIVE_RUN = ["queued", "running", "waiting"];
@@ -92,9 +92,9 @@ export async function decideGitPush(db, config, input) {
92
92
  }
93
93
  if (rules !== null) {
94
94
  const granted = await db
95
- .selectFrom("scheduled_task_grants")
95
+ .selectFrom("automation_grants")
96
96
  .select("tool_key")
97
- .where("task_id", "=", rules.taskId)
97
+ .where("automation_id", "=", rules.taskId)
98
98
  .where("tool_key", "in", [GIT_PUSH_GRANT, key])
99
99
  .executeTakeFirst();
100
100
  if (granted !== undefined)
@@ -1,6 +1,6 @@
1
1
  import { type NetworkBlockedHost } from "@capybara-hq/plugin-sdk";
2
+ import { type UnattendedRun } from "../automations/unattended.js";
2
3
  import type { NetworkRunState } from "../sandbox/network-grants.js";
3
- import { type UnattendedRun } from "../schedules/unattended.js";
4
4
  import { type ApprovalRecord, type NetworkAppliesAt } from "./approvals.service.js";
5
5
  /**
6
6
  * Network asks in the tool pipeline (network ask-to-allow spec §6.2, §6.6–§6.9, §8.3): what a
@@ -154,7 +154,7 @@ export interface NetworkPlanContext {
154
154
  * is never asked about.
155
155
  */
156
156
  offer?: (hosts: string[]) => NetworkAskOffer | null;
157
- /** The scheduled task run the run serves (null / undefined: attended). */
157
+ /** The automation run the run serves (null / undefined: attended). */
158
158
  unattended: UnattendedRun | null | undefined;
159
159
  /**
160
160
  * Whether a host is beyond the platform's ceiling (`sandbox.limits.orgHosts: within`, org egress
@@ -245,7 +245,7 @@ export declare function blockedEventHosts(blocked: readonly NetworkBlockedHost[]
245
245
  * carried that list (`ctx.deviceBlocks`): a note saying so, never asked;
246
246
  * - a `device` host the device's settings already allow (`ctx.onList`: not yet applied to the
247
247
  * instance): a note saying when it applies, never asked again;
248
- * - approved by the scheduled task the run serves (`run.taskGranted`) yet refused: a note that
248
+ * - approved by the automation the run serves (`run.taskGranted`) yet refused: a note that
249
249
  * the device ignores the task's grants (never asked, never a missing grant);
250
250
  * - refused earlier in the run tree: the denied note; an unattended run in `fail` mode: its note
251
251
  * and a missing grant;
@@ -1,8 +1,8 @@
1
1
  import { validateAllowHost } from "@capybara-hq/plugin-sdk";
2
+ import { networkGrantKey, unattendedFails, unattendedRules, } from "../automations/unattended.js";
2
3
  import { NETWORK_ASK_MAX_HOSTS, NETWORK_HOST_MAX_CHARS } from "../conversations/events.js";
3
4
  import { coversHost } from "../sandbox/modes.js";
4
5
  import { ESCALATION_UNATTENDED_WHY } from "../sandbox/review/permission-candidate.js";
5
- import { networkGrantKey, unattendedFails, unattendedRules, } from "../schedules/unattended.js";
6
6
  import { NETWORK_ASK_CANCELLED_NOTE, networkAskHosts, } from "./approvals.service.js";
7
7
  /**
8
8
  * Network asks in the tool pipeline (network ask-to-allow spec §6.2, §6.6–§6.9, §8.3): what a
@@ -191,7 +191,7 @@ export const unavailableHostNote = (host, why) => `[network] ${host} was blocked
191
191
  * provider did not apply the task's network grant. Not asked, not a missing grant: the device's
192
192
  * owner adds the host to the device's network list on its page.
193
193
  */
194
- export const taskGrantIgnoredNote = (hosts) => `${blockedLead(hosts)} The scheduled task approves ${pron(hosts)}, but this device did not apply the task's network grant. The device owner can add ${pron(hosts)} to the device's network list on its page. Continue without ${pron(hosts)}.`;
194
+ export const taskGrantIgnoredNote = (hosts) => `${blockedLead(hosts)} The automation approves ${pron(hosts)}, but this device did not apply the task's network grant. The device owner can add ${pron(hosts)} to the device's network list on its page. Continue without ${pron(hosts)}.`;
195
195
  /** An unattended run in `fail` mode (spec §8.3): no ask, the creator can add a task grant. */
196
196
  export const unattendedNetworkNote = (hosts) => `[network] ${list(hosts)} ${one(hosts) ? "is" : "are"} blocked on this device and this scheduled run cannot ask for network access. The task's owner can add ${pron(hosts)} to the task's approved domains. Continue without ${pron(hosts)}.`;
197
197
  /**
@@ -239,7 +239,7 @@ export function blockedEventHosts(blocked) {
239
239
  * carried that list (`ctx.deviceBlocks`): a note saying so, never asked;
240
240
  * - a `device` host the device's settings already allow (`ctx.onList`: not yet applied to the
241
241
  * instance): a note saying when it applies, never asked again;
242
- * - approved by the scheduled task the run serves (`run.taskGranted`) yet refused: a note that
242
+ * - approved by the automation the run serves (`run.taskGranted`) yet refused: a note that
243
243
  * the device ignores the task's grants (never asked, never a missing grant);
244
244
  * - refused earlier in the run tree: the denied note; an unattended run in `fail` mode: its note
245
245
  * and a missing grant;
@@ -1,5 +1,6 @@
1
1
  import { type ConversationSource, type FormAnswer, type InputForm, type Logger, type ServiceBlockedHost, type ToolCallContext, type ToolDisplay } from "@capybara-hq/plugin-sdk";
2
2
  import type { AgentDefinition } from "../agents/definition.js";
3
+ import { type UnattendedRun } from "../automations/unattended.js";
3
4
  import { ConversationApprovalProfile } from "../conversations/approval-profile.js";
4
5
  import { AttachmentsService } from "../conversations/attachments.service.js";
5
6
  import { EventLog } from "../conversations/event-log.js";
@@ -25,7 +26,6 @@ import { PermissionAutoGrants } from "../sandbox/permission-auto-grants.js";
25
26
  import { PermissionCallGrants } from "../sandbox/permission-call-grants.js";
26
27
  import { type CommandReview } from "../sandbox/review/index.js";
27
28
  import { SandboxService } from "../sandbox/sandbox.service.js";
28
- import { type UnattendedRun } from "../schedules/unattended.js";
29
29
  import { ApprovalsService, type NetworkAskDetail } from "./approvals.service.js";
30
30
  import { Breaker } from "./breaker.js";
31
31
  import { Credentials } from "./credentials.js";
@@ -90,7 +90,7 @@ export declare const INPUT_SKIPPED_TEXT = "The user did not provide the requeste
90
90
  */
91
91
  export declare const WAIT_SKIPPED_TEXT = "The user sent a message while this wait was running, which ended it; read the message below and continue. Call the tool again only if the wait is still needed.";
92
92
  /** A watched ask over `tools.maxWatchedWaitsPerAccount` (spec §5.2). */
93
- export declare const TOO_MANY_WATCHED_WAITS_TEXT = "Too many waits are running for this user; end one, or finish and let a scheduled task check later.";
93
+ export declare const TOO_MANY_WATCHED_WAITS_TEXT = "Too many waits are running for this user; end one, or finish and let an automation check later.";
94
94
  /** A tool asked for a watched wait without a registered watcher (spec §5.2). */
95
95
  export declare const watchWithoutWatcherText: (key: string) => string;
96
96
  /** 同一调用连续请求输入超过上限。 */
@@ -208,7 +208,7 @@ export interface PolicyContext {
208
208
  */
209
209
  callPolicy?: CallPolicy | null;
210
210
  /**
211
- * The scheduled task run the run serves, unattended or trial (scheduled tasks spec §7); unset or
211
+ * The automation run the run serves, unattended or trial (scheduled tasks spec §7); unset or
212
212
  * null: an attended run.
213
213
  */
214
214
  unattended?: UnattendedRun | null;
@@ -344,7 +344,7 @@ export interface ToolStepContext {
344
344
  */
345
345
  parent?: SubagentParent;
346
346
  /**
347
- * The scheduled task run this run serves (scheduled tasks spec §7); filled by `runStep` once per
347
+ * The automation run this run serves (scheduled tasks spec §7); filled by `runStep` once per
348
348
  * step from PG (`unattendedRunOf`), null when attended. Callers leave it unset.
349
349
  */
350
350
  unattended?: UnattendedRun | null;
@@ -10,6 +10,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
10
10
  import { CARD_BADGE_MAX, CARD_TEXT_MAX, DeviceAccessError, ToolError, validateInputForm, validateToolDisplay, } from "@capybara-hq/plugin-sdk";
11
11
  import { Inject, Injectable, Optional } from "@nestjs/common";
12
12
  import { sql } from "kysely";
13
+ import { appendMissingGrant, connectionGrantKey, UNATTENDED_CONNECTION_ERROR, UNATTENDED_ELICITATION_NOTE, UNATTENDED_QUESTION_ERROR, unattendedFails, unattendedRules, unattendedRunOf, } from "../automations/unattended.js";
13
14
  import { backgroundMaxSeconds } from "../background/launch.js";
14
15
  import { ConversationApprovalProfile } from "../conversations/approval-profile.js";
15
16
  import { AttachmentsService } from "../conversations/attachments.service.js";
@@ -49,7 +50,6 @@ import { isSessionGrantableRule, } from "../sandbox/review/index.js";
49
50
  import { approverForCrossing, buildPermissionCandidate, crossingOfCandidate, ESCALATION_RETRY_HINT, ESCALATION_UNATTENDED_WHY, escalationRefusedText, isEscalatedCall, } from "../sandbox/review/permission-candidate.js";
50
51
  import { CommandReviewService } from "../sandbox/review/review.service.js";
51
52
  import { SandboxService } from "../sandbox/sandbox.service.js";
52
- import { appendMissingGrant, connectionGrantKey, UNATTENDED_CONNECTION_ERROR, UNATTENDED_ELICITATION_NOTE, UNATTENDED_QUESTION_ERROR, unattendedFails, unattendedRules, unattendedRunOf, } from "../schedules/unattended.js";
53
53
  import { skillLoadOfferedIn } from "../skills/catalog.js";
54
54
  import { ApprovalsService, } from "./approvals.service.js";
55
55
  import { Breaker, breakerOpenMessage } from "./breaker.js";
@@ -144,7 +144,7 @@ export const INPUT_SKIPPED_TEXT = "The user did not provide the requested input
144
144
  */
145
145
  export const WAIT_SKIPPED_TEXT = "The user sent a message while this wait was running, which ended it; read the message below and continue. Call the tool again only if the wait is still needed.";
146
146
  /** A watched ask over `tools.maxWatchedWaitsPerAccount` (spec §5.2). */
147
- export const TOO_MANY_WATCHED_WAITS_TEXT = "Too many waits are running for this user; end one, or finish and let a scheduled task check later.";
147
+ export const TOO_MANY_WATCHED_WAITS_TEXT = "Too many waits are running for this user; end one, or finish and let an automation check later.";
148
148
  /** A tool asked for a watched wait without a registered watcher (spec §5.2). */
149
149
  export const watchWithoutWatcherText = (key) => `Tool ${key} asked for a watched wait but registers no watcher.`;
150
150
  /** 同一调用连续请求输入超过上限。 */
@@ -6,7 +6,7 @@ export { R3_FIXED_ASK_TOOL_KEYS } from "./builtin-names.js";
6
6
  export { isFixedAsk } from "./fixed-ask.js";
7
7
  /**
8
8
  * What allowed an ask without an approval: this conversation's grant, an "always" grant, or a
9
- * scheduled task's grant (its unattended runs, scheduled tasks spec §7).
9
+ * automation's grant (its unattended runs, scheduled tasks spec §7).
10
10
  */
11
11
  export type GrantKind = "session" | "always" | "task";
12
12
  /** 取更严的策略(`allow < ask < deny`)。 */
@@ -16,10 +16,10 @@ export interface PolicyInput {
16
16
  connectorDefault: ToolPolicy;
17
17
  /** agent 负责人的收紧(`definition.toolPolicies[key]`)。 */
18
18
  agentOverride?: "ask" | "deny";
19
- /** `requiresUserInteraction`。 */
19
+ /** `requiresUserInteraction`. */
20
20
  fixedAsk: boolean;
21
21
  /**
22
- * 已记住且 specHash 与当前一致的授权; `task`: a scheduled task's grant in its unattended run.
22
+ * A remembered grant whose specHash matches the current one; `task`: an automation's grant in its unattended run.
23
23
  */
24
24
  grant: GrantKind | null;
25
25
  }
@@ -1,10 +1,10 @@
1
1
  import { sql } from "kysely";
2
2
  import { normalizeStoredDefinition } from "../agents/definition.js";
3
+ import { grantRefusalOf } from "../automations/grant-rules.js";
4
+ import { findTaskGrant } from "../automations/store.js";
5
+ import { changesAgentSkills, UNATTENDED_ASK_ERROR, UNATTENDED_FIXED_ASK_ERROR, UNATTENDED_QUESTION_ERROR, unattendedRules, } from "../automations/unattended.js";
3
6
  import { roleAtLeast } from "../orgs/roles.js";
4
7
  import { FORBIDDEN_TOOLS_UNREADABLE_ERROR, readOrgSettings } from "../orgs/settings.service.js";
5
- import { grantRefusalOf } from "../schedules/grant-rules.js";
6
- import { findTaskGrant } from "../schedules/store.js";
7
- import { changesAgentSkills, UNATTENDED_ASK_ERROR, UNATTENDED_FIXED_ASK_ERROR, UNATTENDED_QUESTION_ERROR, unattendedRules, } from "../schedules/unattended.js";
8
8
  import { BUILTIN, SANDBOX_ASK_TOOL_NAMES } from "./builtin-names.js";
9
9
  import { personalAuth } from "./connector-account-policies.js";
10
10
  import { isFixedAsk } from "./fixed-ask.js";
@@ -5,6 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { Module } from "@nestjs/common";
8
+ import { AutomationStoreModule } from "../automations/store.module.js";
8
9
  import { BackgroundModule } from "../background/background.module.js";
9
10
  import { ConversationAccessModule } from "../conversations/access.js";
10
11
  import { ConversationApprovalProfileModule } from "../conversations/approval-profile.js";
@@ -29,14 +30,13 @@ import { OperationAuthorityModule } from "../sandbox/operation-authority.module.
29
30
  import { PermissionAuthorityModule } from "../sandbox/permission-authority.module.js";
30
31
  import { PermissionCallGrantsModule } from "../sandbox/permission-call-grants.module.js";
31
32
  import { SandboxModule } from "../sandbox/sandbox.module.js";
32
- import { ScheduledTaskStoreModule } from "../schedules/store.module.js";
33
33
  import { SkillsModule } from "../skills/skills.module.js";
34
34
  import { StorageModule } from "../storage/storage.module.js";
35
35
  import { AdminConnectors } from "./admin-connectors.js";
36
36
  import { ApprovalsService } from "./approvals.service.js";
37
37
  import { Breaker } from "./breaker.js";
38
+ import { AutomationToolsPort, AutomationUpdates } from "./builtins/automations.js";
38
39
  import { BuiltinTools } from "./builtins/builtin-tools.js";
39
- import { ScheduleToolsPort, ScheduleUpdates } from "./builtins/schedules.js";
40
40
  import { WebPages } from "./builtins/web/page-cache.js";
41
41
  import { ConnectorAccountPolicies } from "./connector-account-policies.js";
42
42
  import { ConnectorContent } from "./connector-content.js";
@@ -108,8 +108,8 @@ ToolsModule = __decorate([
108
108
  // ConnectorToolsProcessor)
109
109
  ConnectorToolsQueueModule,
110
110
  ToolWatchQueueModule,
111
- // a trial run's approvals become its scheduled task's grants (scheduled tasks spec §7)
112
- ScheduledTaskStoreModule,
111
+ // a trial run's approvals become its automation's grants (scheduled tasks spec §7)
112
+ AutomationStoreModule,
113
113
  // connector credentials (also the git gateway's, without importing this module)
114
114
  CredentialsModule,
115
115
  ],
@@ -119,10 +119,10 @@ ToolsModule = __decorate([
119
119
  BuiltinTools,
120
120
  // a Platform write's file reference (a conversation file)
121
121
  FileRefs,
122
- // `ScheduleUpdate`'s write in one transaction (scheduled tasks spec §11)
123
- ScheduleUpdates,
124
- // where `SchedulesModule` binds the task service for the schedule tools (no provider cycle)
125
- ScheduleToolsPort,
122
+ // `AutomationUpdate`'s write in one transaction (scheduled tasks spec §11)
123
+ AutomationUpdates,
124
+ // where `AutomationsModule` binds the task service for the automation tools (no provider cycle)
125
+ AutomationToolsPort,
126
126
  WebPages,
127
127
  ToolRegistry,
128
128
  ApprovalsService,
@@ -144,7 +144,7 @@ ToolsModule = __decorate([
144
144
  ],
145
145
  exports: [
146
146
  PermissionApprovalJobs,
147
- ScheduleToolsPort,
147
+ AutomationToolsPort,
148
148
  CredentialsModule,
149
149
  ToolOutputs,
150
150
  BuiltinTools,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capybara-hq/kernel",
3
- "version": "0.1.0-rc.105",
3
+ "version": "0.1.0-rc.106",
4
4
  "description": "Capybara kernel: config, database, plugin host and HTTP API of the Capybara agent platform",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -66,7 +66,7 @@
66
66
  "yaml": "^2.9.1",
67
67
  "yauzl": "3.4.0",
68
68
  "zod": "^4.6.7",
69
- "@capybara-hq/plugin-sdk": "^0.1.0-rc.84"
69
+ "@capybara-hq/plugin-sdk": "^0.1.0-rc.85"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@langchain/langgraph-checkpoint-validation": "^1.2.0",
@@ -75,7 +75,7 @@
75
75
  "@types/ws": "^8.18.2",
76
76
  "@types/yauzl": "3.4.0",
77
77
  "ws": "^8.22.0",
78
- "@capybara-hq/testing": "0.1.0-rc.46"
78
+ "@capybara-hq/testing": "0.1.0-rc.47"
79
79
  },
80
80
  "scripts": {
81
81
  "build": "tsc -b"