@capybara-hq/kernel 0.1.0-rc.12 → 0.1.0-rc.14

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 (267) hide show
  1. package/dist/admin/admin.schemas.d.ts +13 -0
  2. package/dist/agents/agent-lookup.d.ts +5 -0
  3. package/dist/agents/agent-lookup.js +15 -0
  4. package/dist/background/background.module.js +2 -2
  5. package/dist/background/launch-lock.d.ts +1 -1
  6. package/dist/background/launch-lock.js +1 -1
  7. package/dist/background/poll.job.d.ts +2 -2
  8. package/dist/background/poll.job.js +10 -10
  9. package/dist/background/stop.d.ts +1 -1
  10. package/dist/background/stop.js +3 -3
  11. package/dist/background/store.d.ts +5 -5
  12. package/dist/background/store.js +5 -5
  13. package/dist/background/tasks.service.d.ts +6 -6
  14. package/dist/background/tasks.service.js +13 -13
  15. package/dist/catalog/admin-catalog.controller.d.ts +13 -2
  16. package/dist/catalog/admin-catalog.controller.js +24 -3
  17. package/dist/catalog/admin-catalog.schemas.d.ts +10 -0
  18. package/dist/catalog/admin-catalog.schemas.js +7 -0
  19. package/dist/catalog/catalog-content.d.ts +9 -1
  20. package/dist/catalog/catalog-content.js +2 -1
  21. package/dist/catalog/catalog-files.d.ts +3 -2
  22. package/dist/catalog/catalog-files.js +8 -5
  23. package/dist/catalog/component-scope.service.d.ts +14 -1
  24. package/dist/catalog/component-scope.service.js +12 -2
  25. package/dist/catalog/marketplaces.service.d.ts +1 -1
  26. package/dist/catalog/org-catalog.controller.d.ts +5 -4
  27. package/dist/catalog/org-catalog.controller.js +5 -4
  28. package/dist/catalog/org-catalog.schemas.d.ts +18 -2
  29. package/dist/catalog/org-catalog.schemas.js +16 -2
  30. package/dist/catalog/org-catalog.service.js +8 -2
  31. package/dist/catalog/plugin-import.js +1 -1
  32. package/dist/catalog/plugin-package.js +37 -9
  33. package/dist/catalog/plugin-upgrade.d.ts +15 -1
  34. package/dist/catalog/plugin-upgrade.js +18 -5
  35. package/dist/channels/channels.module.js +2 -2
  36. package/dist/channels/connections.controller.d.ts +1 -1
  37. package/dist/channels/connections.controller.js +1 -1
  38. package/dist/channels/connections.service.d.ts +22 -5
  39. package/dist/channels/connections.service.js +56 -10
  40. package/dist/channels/inbound.d.ts +8 -8
  41. package/dist/channels/inbound.js +31 -31
  42. package/dist/channels/phrases.d.ts +27 -27
  43. package/dist/channels/phrases.js +27 -27
  44. package/dist/channels/webhook.d.ts +21 -1
  45. package/dist/channels/webhook.js +39 -4
  46. package/dist/config/docs.js +1 -1
  47. package/dist/config/schema.d.ts +2 -2
  48. package/dist/config/schema.js +21 -21
  49. package/dist/conversations/conversations.controller.d.ts +11 -11
  50. package/dist/conversations/conversations.controller.js +15 -15
  51. package/dist/conversations/conversations.module.d.ts +1 -1
  52. package/dist/conversations/conversations.module.js +7 -7
  53. package/dist/conversations/conversations.schemas.js +1 -1
  54. package/dist/conversations/conversations.service.d.ts +14 -14
  55. package/dist/conversations/conversations.service.js +19 -19
  56. package/dist/conversations/{environment-status.d.ts → device-status.d.ts} +9 -9
  57. package/dist/conversations/{environment-status.js → device-status.js} +18 -18
  58. package/dist/conversations/event-log.d.ts +1 -1
  59. package/dist/conversations/event-log.js +1 -1
  60. package/dist/conversations/events.d.ts +1 -1
  61. package/dist/conversations/events.js +2 -2
  62. package/dist/ctx/create-ctx.d.ts +26 -3
  63. package/dist/ctx/create-ctx.js +134 -26
  64. package/dist/db/kernel-schema.d.ts +37 -25
  65. package/dist/{environments → devices}/access.d.ts +19 -19
  66. package/dist/{environments → devices}/access.js +28 -28
  67. package/dist/devices/conversation-devices.d.ts +75 -0
  68. package/dist/{environments/conversation-environments.js → devices/conversation-devices.js} +71 -72
  69. package/dist/devices/devices.controller.d.ts +36 -0
  70. package/dist/{environments/environments.controller.js → devices/devices.controller.js} +37 -37
  71. package/dist/devices/devices.module.d.ts +5 -13
  72. package/dist/devices/devices.module.js +16 -29
  73. package/dist/devices/devices.schemas.d.ts +3 -0
  74. package/dist/devices/devices.schemas.js +14 -0
  75. package/dist/{environments/environments.service.d.ts → devices/devices.service.d.ts} +70 -70
  76. package/dist/{environments/environments.service.js → devices/devices.service.js} +122 -122
  77. package/dist/devices/dto.d.ts +13 -54
  78. package/dist/devices/dto.js +7 -39
  79. package/dist/devices/label.d.ts +11 -0
  80. package/dist/{environments → devices}/label.js +7 -7
  81. package/dist/{environments → devices}/legacy-cleanup.job.d.ts +3 -3
  82. package/dist/{environments → devices}/legacy-cleanup.job.js +3 -3
  83. package/dist/errors.d.ts +29 -25
  84. package/dist/errors.js +29 -25
  85. package/dist/evals/recorded-tools.d.ts +2 -2
  86. package/dist/evals/recorded-tools.js +6 -6
  87. package/dist/extensions/admin-ops.js +1 -0
  88. package/dist/extensions/admin-view.js +2 -0
  89. package/dist/extensions/effective-config.d.ts +6 -0
  90. package/dist/extensions/effective-config.js +18 -7
  91. package/dist/extensions/guide-places.d.ts +66 -0
  92. package/dist/extensions/guide-places.js +152 -0
  93. package/dist/extensions/host.d.ts +13 -2
  94. package/dist/extensions/host.js +27 -6
  95. package/dist/extensions/instance.d.ts +17 -2
  96. package/dist/extensions/instance.js +21 -0
  97. package/dist/extensions/ledger.d.ts +1 -1
  98. package/dist/extensions/permission-set.d.ts +16 -2
  99. package/dist/extensions/permission-set.js +17 -3
  100. package/dist/extensions/permission-view.d.ts +10 -1
  101. package/dist/extensions/plugin-guides.d.ts +207 -54
  102. package/dist/extensions/plugin-guides.js +436 -165
  103. package/dist/files/previewers.d.ts +1 -1
  104. package/dist/files/previewers.js +1 -1
  105. package/dist/http/api.module.js +16 -6
  106. package/dist/http/gateway-routes.d.ts +1 -1
  107. package/dist/http/gateway-routes.js +1 -1
  108. package/dist/identity/settings.d.ts +32 -0
  109. package/dist/identity/settings.js +26 -2
  110. package/dist/infra/config/kernel-config.service.js +4 -4
  111. package/dist/infra/lock/lock.service.d.ts +8 -0
  112. package/dist/infra/lock/lock.service.js +27 -0
  113. package/dist/infra/throttler/named-throttlers.d.ts +4 -1
  114. package/dist/infra/throttler/named-throttlers.js +16 -1
  115. package/dist/infra/throttler/throttler.guard.js +1 -1
  116. package/dist/kernel.module.js +3 -3
  117. package/dist/{devices → local-devices}/device-auth.controller.d.ts +6 -6
  118. package/dist/{devices → local-devices}/device-auth.controller.js +5 -5
  119. package/dist/{devices → local-devices}/device-auth.d.ts +20 -20
  120. package/dist/{devices → local-devices}/device-auth.js +51 -53
  121. package/dist/local-devices/device-auth.module.d.ts +7 -0
  122. package/dist/{devices → local-devices}/device-auth.module.js +5 -5
  123. package/dist/{devices → local-devices}/device-routes.d.ts +3 -3
  124. package/dist/{devices → local-devices}/device-routes.js +2 -2
  125. package/dist/local-devices/dto.d.ts +66 -0
  126. package/dist/local-devices/dto.js +44 -0
  127. package/dist/{devices → local-devices}/keys.d.ts +11 -11
  128. package/dist/{devices → local-devices}/keys.js +11 -11
  129. package/dist/{devices/device-gateway.d.ts → local-devices/local-device-gateway.d.ts} +14 -14
  130. package/dist/{devices/device-gateway.js → local-devices/local-device-gateway.js} +44 -44
  131. package/dist/{devices/device-provider.d.ts → local-devices/local-device-provider.d.ts} +15 -15
  132. package/dist/{devices/device-provider.js → local-devices/local-device-provider.js} +23 -23
  133. package/dist/local-devices/local-devices.module.d.ts +16 -0
  134. package/dist/local-devices/local-devices.module.js +44 -0
  135. package/dist/{devices → local-devices}/machines.d.ts +26 -26
  136. package/dist/{devices → local-devices}/machines.js +71 -71
  137. package/dist/{devices → local-devices}/relay.d.ts +15 -15
  138. package/dist/{devices → local-devices}/relay.js +55 -55
  139. package/dist/{devices → local-devices}/targets.d.ts +8 -8
  140. package/dist/{devices → local-devices}/targets.js +14 -14
  141. package/dist/orgs/offboarding.d.ts +6 -6
  142. package/dist/orgs/offboarding.js +12 -12
  143. package/dist/orgs/settings.service.d.ts +28 -0
  144. package/dist/orgs/settings.service.js +20 -1
  145. package/dist/overrides.d.ts +3 -1
  146. package/dist/overrides.js +2 -0
  147. package/dist/platform/exclusions.js +48 -8
  148. package/dist/platform/operation.js +10 -2
  149. package/dist/platform/ops/admin.ops.js +8 -2
  150. package/dist/platform/ops/connectors.ops.js +2 -0
  151. package/dist/platform/ops/conversations.ops.d.ts +3 -3
  152. package/dist/platform/ops/conversations.ops.js +9 -9
  153. package/dist/platform/ops/devices.ops.d.ts +26 -0
  154. package/dist/platform/ops/devices.ops.js +311 -0
  155. package/dist/platform/ops/org-settings.ops.js +2 -2
  156. package/dist/platform/ops/orgs.ops.js +1 -0
  157. package/dist/platform/ops/setup.ops.d.ts +24 -0
  158. package/dist/platform/ops/setup.ops.js +212 -0
  159. package/dist/platform/ops/ui.ops.d.ts +8 -0
  160. package/dist/platform/ops/ui.ops.js +41 -0
  161. package/dist/platform/platform-ops.module.d.ts +4 -2
  162. package/dist/platform/platform-ops.module.js +13 -5
  163. package/dist/platform/route-schemas.js +11 -3
  164. package/dist/roles/gateway-role.d.ts +3 -3
  165. package/dist/roles/gateway-role.js +4 -4
  166. package/dist/roles/gateway.module.d.ts +1 -1
  167. package/dist/roles/gateway.module.js +5 -5
  168. package/dist/roles/worker.module.js +1 -1
  169. package/dist/runtime/context/build.d.ts +1 -1
  170. package/dist/runtime/context/build.js +6 -6
  171. package/dist/runtime/context/compaction.js +1 -1
  172. package/dist/runtime/context/{environment-paths.d.ts → device-paths.d.ts} +11 -11
  173. package/dist/runtime/context/{environment-paths.js → device-paths.js} +13 -13
  174. package/dist/runtime/maintenance.d.ts +1 -1
  175. package/dist/sandbox/jobs.d.ts +13 -13
  176. package/dist/sandbox/jobs.js +20 -20
  177. package/dist/sandbox/leases.d.ts +9 -9
  178. package/dist/sandbox/leases.js +14 -14
  179. package/dist/sandbox/providers.d.ts +8 -8
  180. package/dist/sandbox/providers.js +8 -8
  181. package/dist/sandbox/sandbox.module.d.ts +1 -1
  182. package/dist/sandbox/sandbox.module.js +1 -1
  183. package/dist/sandbox/sandbox.service.d.ts +76 -76
  184. package/dist/sandbox/sandbox.service.js +230 -230
  185. package/dist/setup/kernel-checks.d.ts +91 -0
  186. package/dist/setup/kernel-checks.js +295 -0
  187. package/dist/setup/oauth-token-probe.d.ts +47 -0
  188. package/dist/setup/oauth-token-probe.js +108 -0
  189. package/dist/setup/redact-check.d.ts +18 -0
  190. package/dist/setup/redact-check.js +46 -0
  191. package/dist/setup/setup-check-registry.d.ts +86 -0
  192. package/dist/setup/setup-check-registry.js +75 -0
  193. package/dist/setup/setup-checks.controller.d.ts +28 -0
  194. package/dist/setup/setup-checks.controller.js +78 -0
  195. package/dist/setup/setup-checks.schemas.d.ts +38 -0
  196. package/dist/setup/setup-checks.schemas.js +43 -0
  197. package/dist/setup/setup-checks.service.d.ts +144 -0
  198. package/dist/setup/setup-checks.service.js +683 -0
  199. package/dist/setup/setup-guides.controller.d.ts +18 -0
  200. package/dist/setup/setup-guides.controller.js +48 -0
  201. package/dist/setup/setup-guides.schemas.d.ts +10 -0
  202. package/dist/setup/setup-guides.schemas.js +6 -0
  203. package/dist/setup/setup-guides.service.d.ts +126 -0
  204. package/dist/setup/setup-guides.service.js +315 -0
  205. package/dist/setup/setup.module.d.ts +8 -0
  206. package/dist/setup/setup.module.js +31 -0
  207. package/dist/tools/builtins/builtin-tools.d.ts +2 -2
  208. package/dist/tools/builtins/builtin-tools.js +5 -5
  209. package/dist/tools/builtins/platform.js +1 -1
  210. package/dist/tools/builtins/sandbox/bash.js +6 -6
  211. package/dist/tools/builtins/sandbox/common.d.ts +25 -25
  212. package/dist/tools/builtins/sandbox/common.js +51 -51
  213. package/dist/tools/builtins/sandbox/edit.js +2 -2
  214. package/dist/tools/builtins/sandbox/index.d.ts +1 -1
  215. package/dist/tools/builtins/sandbox/index.js +1 -1
  216. package/dist/tools/builtins/sandbox/task-output.d.ts +6 -6
  217. package/dist/tools/builtins/sandbox/task-output.js +10 -10
  218. package/dist/tools/builtins/sandbox/task-stop.js +2 -2
  219. package/dist/tools/builtins/sandbox/write.js +2 -2
  220. package/dist/tools/builtins/skill-load.d.ts +1 -1
  221. package/dist/tools/builtins/skill-load.js +2 -2
  222. package/dist/tools/connectors.controller.d.ts +28 -11
  223. package/dist/tools/connectors.controller.js +49 -14
  224. package/dist/tools/connectors.schemas.d.ts +4 -0
  225. package/dist/tools/connectors.schemas.js +4 -0
  226. package/dist/tools/connectors.service.d.ts +30 -2
  227. package/dist/tools/connectors.service.js +98 -3
  228. package/dist/tools/credentials.d.ts +20 -0
  229. package/dist/tools/credentials.js +90 -1
  230. package/dist/tools/oauth/tokens.d.ts +20 -0
  231. package/dist/tools/oauth/tokens.js +49 -24
  232. package/dist/tools/pipeline.js +4 -3
  233. package/dist/tools/registry.d.ts +2 -2
  234. package/dist/tools/tools.module.js +3 -3
  235. package/dist/ui/admin-ui.controller.d.ts +56 -0
  236. package/dist/ui/admin-ui.controller.js +192 -0
  237. package/dist/ui/arrangement.d.ts +74 -0
  238. package/dist/ui/arrangement.js +98 -0
  239. package/dist/ui/embed-token.d.ts +2 -2
  240. package/dist/ui/embed-token.js +30 -5
  241. package/dist/ui/registry.d.ts +29 -14
  242. package/dist/ui/registry.js +31 -10
  243. package/dist/ui/slots.controller.d.ts +11 -0
  244. package/dist/ui/slots.controller.js +25 -0
  245. package/dist/ui/ui-stream.d.ts +20 -3
  246. package/dist/ui/ui-stream.js +25 -7
  247. package/dist/ui/ui.schemas.d.ts +66 -0
  248. package/dist/ui/ui.schemas.js +65 -0
  249. package/dist/ui/views.controller.d.ts +35 -49
  250. package/dist/ui/views.controller.js +48 -70
  251. package/dist/ui/views.d.ts +84 -18
  252. package/dist/ui/views.js +201 -38
  253. package/package.json +3 -3
  254. package/src/migrations/0105_devices_rename.sql +136 -0
  255. package/src/migrations/0106_setup_guides_v2.sql +10 -0
  256. package/dist/devices/device-auth.module.d.ts +0 -7
  257. package/dist/environments/conversation-environments.d.ts +0 -75
  258. package/dist/environments/dto.d.ts +0 -25
  259. package/dist/environments/dto.js +0 -12
  260. package/dist/environments/environments.controller.d.ts +0 -36
  261. package/dist/environments/environments.module.d.ts +0 -8
  262. package/dist/environments/environments.module.js +0 -31
  263. package/dist/environments/environments.schemas.d.ts +0 -3
  264. package/dist/environments/environments.schemas.js +0 -14
  265. package/dist/environments/label.d.ts +0 -11
  266. package/dist/platform/ops/environments.ops.d.ts +0 -26
  267. package/dist/platform/ops/environments.ops.js +0 -311
@@ -0,0 +1,24 @@
1
+ import { type OnModuleInit } from "@nestjs/common";
2
+ import { KernelDb } from "../../infra/database/kernel-db.js";
3
+ import { SetupChecksService } from "../../setup/setup-checks.service.js";
4
+ import { SetupGuidesService } from "../../setup/setup-guides.service.js";
5
+ import { PlatformOperations } from "../registry.js";
6
+ /**
7
+ * Setup guide operations of the `Platform` tool (spec 2026-11-09-setup-guides-v2-design.md §12),
8
+ * the `setup` domain: the guides a person may see, one guide rendered as Markdown, the cached check
9
+ * states of a guide and running one check. All are reads (a check never writes anywhere; its cost
10
+ * is bounded by the cache, the cooldown and the org's concurrency cap) and use the routes'
11
+ * services, so a guide carries no secret (§6.3) and check results only the fixed, redacted fields.
12
+ * Entering a secret, OAuth consent and the guide ack stay with the person on the web (`human-only`
13
+ * and `secret` exclusions); no setup operation takes a value.
14
+ */
15
+ export declare class SetupOperations implements OnModuleInit {
16
+ private readonly registry;
17
+ private readonly checks;
18
+ private readonly guides;
19
+ private readonly kdb;
20
+ constructor(registry: PlatformOperations, checks: SetupChecksService, guides: SetupGuidesService, kdb: KernelDb);
21
+ /** The actor as the routes see a caller: the org, their role there now and their account. */
22
+ private caller;
23
+ onModuleInit(): void;
24
+ }
@@ -0,0 +1,212 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
8
+ return function (target, key) { decorator(target, key, paramIndex); }
9
+ };
10
+ import { Inject, Injectable } from "@nestjs/common";
11
+ import { CatalogGuidePathParams, CatalogGuideQuery } from "../../catalog/org-catalog.schemas.js";
12
+ import { ApiError } from "../../errors.js";
13
+ import { KernelDb } from "../../infra/database/kernel-db.js";
14
+ import { SetupCheckPathParams, SetupCheckRunBody, SetupChecksQuery, SetupGuidePathParams, } from "../../setup/setup-checks.schemas.js";
15
+ import { SetupChecksService } from "../../setup/setup-checks.service.js";
16
+ import { SetupGuidesQuery } from "../../setup/setup-guides.schemas.js";
17
+ import { SetupGuidesService } from "../../setup/setup-guides.service.js";
18
+ import { defineOperation } from "../operation.js";
19
+ import { PlatformOperations } from "../registry.js";
20
+ import { roleOf } from "./role.js";
21
+ const ITEM = "00000000-0000-4000-8000-000000000000";
22
+ const CONNECTION = "00000000-0000-4000-8000-000000000001";
23
+ /**
24
+ * Setup guide operations of the `Platform` tool (spec 2026-11-09-setup-guides-v2-design.md §12),
25
+ * the `setup` domain: the guides a person may see, one guide rendered as Markdown, the cached check
26
+ * states of a guide and running one check. All are reads (a check never writes anywhere; its cost
27
+ * is bounded by the cache, the cooldown and the org's concurrency cap) and use the routes'
28
+ * services, so a guide carries no secret (§6.3) and check results only the fixed, redacted fields.
29
+ * Entering a secret, OAuth consent and the guide ack stay with the person on the web (`human-only`
30
+ * and `secret` exclusions); no setup operation takes a value.
31
+ */
32
+ let SetupOperations = class SetupOperations {
33
+ registry;
34
+ checks;
35
+ guides;
36
+ kdb;
37
+ constructor(registry, checks, guides, kdb) {
38
+ this.registry = registry;
39
+ this.checks = checks;
40
+ this.guides = guides;
41
+ this.kdb = kdb;
42
+ }
43
+ /** The actor as the routes see a caller: the org, their role there now and their account. */
44
+ async caller(ctx) {
45
+ const role = await roleOf(this.kdb.db, ctx.orgId, ctx.actorAccountId);
46
+ if (role === null)
47
+ throw new ApiError("forbidden", "Insufficient organization role");
48
+ return { orgId: ctx.orgId, role, accountId: ctx.actorAccountId };
49
+ }
50
+ onModuleInit() {
51
+ this.registry.register([
52
+ defineOperation({
53
+ id: "setup.guides",
54
+ description: "List the plugin setup guides this person may help with in the org: per guide its targets (channel connections, connectors made from a template, templates switched on without a connector yet), whether the guide changed since a target was set up (drift), a count of the cached check states and the web page where the person does the setup. Org admins get the admin guides; members get the guides for connecting their own account. Read a guide with setup.read.",
55
+ input: SetupGuidesQuery,
56
+ example: {},
57
+ authz: { orgAction: "catalog.read" },
58
+ mirrors: ["GET /api/v1/orgs/:orgId/setup-guides"],
59
+ confirm: "read",
60
+ run: async (input, ctx) => ({
61
+ guides: await this.guides.list(await this.caller(ctx), input),
62
+ }),
63
+ }),
64
+ defineOperation({
65
+ id: "setup.read",
66
+ description: "Read one plugin setup guide rendered for a target as a Markdown document: the steps, the app manifest and URLs to paste at the third-party platform, and the checks as '- [check <id>] <label>' lines (run them with setup.check), with the modes, the variables that have no value yet and why, and the web page of the target. Explain the step the person is on. Secrets are never in the guide: ask the person to paste each token or secret into its field on the returned webPath, never into the conversation.",
67
+ input: CatalogGuidePathParams.extend(CatalogGuideQuery.shape).strict(),
68
+ example: { itemId: ITEM, guideId: "slack-app", connectionId: CONNECTION },
69
+ authz: { orgAction: "catalog.read" },
70
+ mirrors: ["GET /api/v1/orgs/:orgId/catalog/:itemId/guides/:guideId"],
71
+ confirm: "read",
72
+ errors: [
73
+ {
74
+ code: "catalog.item_not_found",
75
+ next: "The plugin is not in this org's catalog; list the guides with setup.guides.",
76
+ },
77
+ {
78
+ code: "catalog.guide_not_found",
79
+ next: "The plugin has no setup guide with that id; list the guides with setup.guides.",
80
+ },
81
+ {
82
+ code: "channel.not_found",
83
+ next: "No channel connection with that id in this org; list the targets with setup.guides.",
84
+ },
85
+ {
86
+ code: "connector.not_found",
87
+ next: "No connector made from this guide's template with that id in this org; list the targets with setup.guides.",
88
+ },
89
+ {
90
+ code: "validation_failed",
91
+ next: "Pass a mode and audience the guide has (setup.guides lists the audience) and the target of its place: connectionId for a channel guide, connectorId for a connector template guide.",
92
+ },
93
+ {
94
+ code: "forbidden",
95
+ next: {
96
+ member: "Only org admins read the admin guides; members read the member section of a connector template guide (audience member).",
97
+ },
98
+ },
99
+ ],
100
+ run: async (input, ctx) => {
101
+ const { itemId, guideId, ...q } = input;
102
+ return { guide: await this.guides.read(await this.caller(ctx), itemId, guideId, q) };
103
+ },
104
+ }),
105
+ defineOperation({
106
+ id: "setup.status",
107
+ description: "Read the cached state of every check of a plugin's setup guide for one target (a channel connection or a connector made from a template), by check id: ok, failing, unknown, running or not_run, with the reason and fix to show the person. Runs nothing; run a check with setup.check.",
108
+ input: SetupGuidePathParams.extend(SetupChecksQuery.shape).strict(),
109
+ example: { itemId: ITEM, guideId: "slack-app", connectionId: CONNECTION },
110
+ authz: { orgAction: "catalog.read" },
111
+ mirrors: ["GET /api/v1/orgs/:orgId/catalog/:itemId/guides/:guideId/checks"],
112
+ confirm: "read",
113
+ errors: [
114
+ {
115
+ code: "catalog.item_not_found",
116
+ next: "The plugin is not in this org's catalog; check the item id on the plugin's page.",
117
+ },
118
+ {
119
+ code: "catalog.guide_not_found",
120
+ next: "The plugin has no setup guide with that id; read the guide id from the connection or connector page.",
121
+ },
122
+ {
123
+ code: "channel.not_found",
124
+ next: "No channel connection with that id in this org; list the targets with setup.guides.",
125
+ },
126
+ {
127
+ code: "connector.not_found",
128
+ next: "No connector made from this guide's template with that id in this org; list the targets with setup.guides.",
129
+ },
130
+ {
131
+ code: "validation_failed",
132
+ next: "Checks need a saved target: pass connectionId for a channel guide or connectorId for a connector template guide, and a mode and audience the guide has.",
133
+ },
134
+ {
135
+ code: "forbidden",
136
+ next: {
137
+ member: "Only org admins run the admin checks of a guide; members run the member checks (audience member).",
138
+ },
139
+ },
140
+ ],
141
+ run: async (input, ctx) => {
142
+ const { itemId, guideId, ...q } = input;
143
+ return { results: await this.checks.states(await this.caller(ctx), itemId, guideId, q) };
144
+ },
145
+ }),
146
+ defineOperation({
147
+ id: "setup.check",
148
+ description: "Run one check of a plugin's setup guide for one target (a channel connection or a connector made from a template) and return its state: ok, failing (with a reason and a fix to explain), unknown, or running (try again in a moment). A fresh cached result is returned as is; force reruns it, at most once per 10 seconds per check and target. A check only reads; run it after the person says they finished a step.",
149
+ input: SetupCheckPathParams.extend(SetupCheckRunBody.shape).strict(),
150
+ example: {
151
+ itemId: ITEM,
152
+ guideId: "slack-app",
153
+ checkId: "bot-token",
154
+ connectionId: CONNECTION,
155
+ },
156
+ authz: { orgAction: "catalog.read" },
157
+ mirrors: ["POST /api/v1/orgs/:orgId/catalog/:itemId/guides/:guideId/checks/:checkId/run"],
158
+ confirm: "read",
159
+ errors: [
160
+ {
161
+ code: "catalog.item_not_found",
162
+ next: "The plugin is not in this org's catalog; check the item id on the plugin's page.",
163
+ },
164
+ {
165
+ code: "catalog.guide_not_found",
166
+ next: "The plugin has no setup guide with that id; read the guide id from the connection or connector page.",
167
+ },
168
+ {
169
+ code: "channel.not_found",
170
+ next: "No channel connection with that id in this org; list the targets with setup.guides.",
171
+ },
172
+ {
173
+ code: "connector.not_found",
174
+ next: "No connector made from this guide's template with that id in this org; list the targets with setup.guides.",
175
+ },
176
+ {
177
+ code: "validation_failed",
178
+ next: "Checks need a saved target: pass connectionId for a channel guide or connectorId for a connector template guide, and a mode and audience the guide has.",
179
+ },
180
+ {
181
+ code: "forbidden",
182
+ next: {
183
+ member: "Only org admins run the admin checks of a guide; members run the member checks (audience member).",
184
+ },
185
+ },
186
+ {
187
+ code: "catalog.check_not_found",
188
+ next: "That check is not in the guide for this mode and audience; read the check ids with setup.status.",
189
+ },
190
+ {
191
+ code: "rate_limited",
192
+ next: "This person ran 30 checks in the last minute; wait a minute before running another, and read the cached states with setup.status meanwhile.",
193
+ },
194
+ ],
195
+ run: async (input, ctx) => {
196
+ const { itemId, guideId, checkId, ...body } = input;
197
+ return {
198
+ result: await this.checks.run(await this.caller(ctx), itemId, guideId, checkId, body),
199
+ };
200
+ },
201
+ }),
202
+ ]);
203
+ }
204
+ };
205
+ SetupOperations = __decorate([
206
+ Injectable(),
207
+ __param(0, Inject(PlatformOperations)),
208
+ __param(1, Inject(SetupChecksService)),
209
+ __param(2, Inject(SetupGuidesService)),
210
+ __param(3, Inject(KernelDb))
211
+ ], SetupOperations);
212
+ export { SetupOperations };
@@ -0,0 +1,8 @@
1
+ import { type OnModuleInit } from "@nestjs/common";
2
+ import { PlatformOperations } from "../registry.js";
3
+ /** UI operations of the `Platform` tool (UI slots spec §3): the slot catalog. */
4
+ export declare class UiOperations implements OnModuleInit {
5
+ private readonly registry;
6
+ constructor(registry: PlatformOperations);
7
+ onModuleInit(): void;
8
+ }
@@ -0,0 +1,41 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
8
+ return function (target, key) { decorator(target, key, paramIndex); }
9
+ };
10
+ import { UI_SLOTS } from "@capybara-hq/plugin-sdk";
11
+ import { Inject, Injectable } from "@nestjs/common";
12
+ import { z } from "zod";
13
+ import { defineOperation } from "../operation.js";
14
+ import { PlatformOperations } from "../registry.js";
15
+ /** UI operations of the `Platform` tool (UI slots spec §3): the slot catalog. */
16
+ let UiOperations = class UiOperations {
17
+ registry;
18
+ constructor(registry) {
19
+ this.registry = registry;
20
+ }
21
+ onModuleInit() {
22
+ this.registry.register([
23
+ defineOperation({
24
+ id: "ui.slots",
25
+ description: "List the UI slots an extension can contribute to (id, version, where it is, scope and args, accepted kinds view / embed, minimum role, anchors). Use a slot id as a ui contribution's `slot` in a plugin manifest.",
26
+ input: z.object({}).strict(),
27
+ example: {},
28
+ // any signed-in person may call the route; every run's actor is a member of this org
29
+ authz: { orgAction: "agents.use" },
30
+ mirrors: ["GET /api/v1/ui/slots"],
31
+ confirm: "read",
32
+ run: async () => ({ slots: UI_SLOTS }),
33
+ }),
34
+ ]);
35
+ }
36
+ };
37
+ UiOperations = __decorate([
38
+ Injectable(),
39
+ __param(0, Inject(PlatformOperations))
40
+ ], UiOperations);
41
+ export { UiOperations };
@@ -10,7 +10,7 @@ import { ChannelsOperations } from "./ops/channels.ops.js";
10
10
  import { ComponentsOperations } from "./ops/components.ops.js";
11
11
  import { ConnectorsOperations } from "./ops/connectors.ops.js";
12
12
  import { ConversationsOperations } from "./ops/conversations.ops.js";
13
- import { EnvironmentsOperations } from "./ops/environments.ops.js";
13
+ import { DevicesOperations } from "./ops/devices.ops.js";
14
14
  import { EvalsOperations } from "./ops/evals.ops.js";
15
15
  import { ExtensionsOperations } from "./ops/extensions.ops.js";
16
16
  import { ExtensionsAdminOperations } from "./ops/extensions-admin.ops.js";
@@ -24,13 +24,15 @@ import { PlatformOperationsProvider } from "./ops/platform.ops.js";
24
24
  import { PluginsOperations } from "./ops/plugins.ops.js";
25
25
  import { PreviewersOperations } from "./ops/previewers.ops.js";
26
26
  import { RequestsOperations } from "./ops/requests.ops.js";
27
+ import { SetupOperations } from "./ops/setup.ops.js";
27
28
  import { SkillsOperations } from "./ops/skills.ops.js";
28
29
  import { ThemesOperations } from "./ops/themes.ops.js";
30
+ import { UiOperations } from "./ops/ui.ops.js";
29
31
  /**
30
32
  * One provider per domain, each taking `PlatformOperations` as its first constructor argument:
31
33
  * the parity test in `tools/checks` builds the operations from it without a Nest app.
32
34
  */
33
- export declare const PLATFORM_OPERATION_PROVIDERS: readonly [typeof PlatformOperationsProvider, typeof SkillsOperations, typeof AgentsOperations, typeof AgentTemplatesOperations, typeof PluginsOperations, typeof MarketplacesOperations, typeof RequestsOperations, typeof ConnectorsOperations, typeof ExtensionsOperations, typeof ConversationsOperations, typeof ComponentsOperations, typeof AccountsOperations, typeof OrgsOperations, typeof AdminOperations, typeof CatalogAdminOperations, typeof OrgPluginsOperations, typeof ExtensionsAdminOperations, typeof ModelsOperations, typeof InboxOperations, typeof ApprovalsOperations, typeof ChannelsOperations, typeof OrgSettingsOperations, typeof EvalsOperations, typeof BackgroundOperations, typeof PreviewersOperations, typeof EnvironmentsOperations, typeof AgentSkillsOperations, typeof ThemesOperations];
35
+ export declare const PLATFORM_OPERATION_PROVIDERS: readonly [typeof PlatformOperationsProvider, typeof SkillsOperations, typeof AgentsOperations, typeof AgentTemplatesOperations, typeof PluginsOperations, typeof MarketplacesOperations, typeof RequestsOperations, typeof ConnectorsOperations, typeof ExtensionsOperations, typeof ConversationsOperations, typeof ComponentsOperations, typeof AccountsOperations, typeof OrgsOperations, typeof AdminOperations, typeof CatalogAdminOperations, typeof OrgPluginsOperations, typeof ExtensionsAdminOperations, typeof ModelsOperations, typeof InboxOperations, typeof ApprovalsOperations, typeof ChannelsOperations, typeof OrgSettingsOperations, typeof EvalsOperations, typeof BackgroundOperations, typeof PreviewersOperations, typeof DevicesOperations, typeof AgentSkillsOperations, typeof ThemesOperations, typeof SetupOperations, typeof UiOperations];
34
36
  /**
35
37
  * The `Platform` tool's operations (ruling P2): one provider per domain, each registering its
36
38
  * operations into `PlatformOperations` from `onModuleInit`. It imports the domain modules, which
@@ -10,7 +10,7 @@ import { BackgroundModule } from "../background/background.module.js";
10
10
  import { CatalogModule } from "../catalog/catalog.module.js";
11
11
  import { ChannelsModule } from "../channels/channels.module.js";
12
12
  import { ConversationsModule } from "../conversations/conversations.module.js";
13
- import { EnvironmentsModule } from "../environments/environments.module.js";
13
+ import { DevicesModule } from "../devices/devices.module.js";
14
14
  import { EvalsModule } from "../evals/evals.module.js";
15
15
  import { ExtensionsModule } from "../extensions/extensions.module.js";
16
16
  import { FilesModule } from "../files/files.module.js";
@@ -19,6 +19,7 @@ import { InboxModule } from "../inbox/inbox.module.js";
19
19
  import { ModelsModule } from "../models/models.module.js";
20
20
  import { OrgsModule } from "../orgs/orgs.module.js";
21
21
  import { ProvidersModule } from "../runtime/providers.js";
22
+ import { SetupModule } from "../setup/setup.module.js";
22
23
  import { SkillsModule } from "../skills/skills.module.js";
23
24
  import { ThemesModule } from "../themes/themes.module.js";
24
25
  import { ToolsModule } from "../tools/tools.module.js";
@@ -34,7 +35,7 @@ import { ChannelsOperations } from "./ops/channels.ops.js";
34
35
  import { ComponentsOperations } from "./ops/components.ops.js";
35
36
  import { ConnectorsOperations } from "./ops/connectors.ops.js";
36
37
  import { ConversationsOperations } from "./ops/conversations.ops.js";
37
- import { EnvironmentsOperations } from "./ops/environments.ops.js";
38
+ import { DevicesOperations } from "./ops/devices.ops.js";
38
39
  import { EvalsOperations } from "./ops/evals.ops.js";
39
40
  import { ExtensionsOperations } from "./ops/extensions.ops.js";
40
41
  import { ExtensionsAdminOperations } from "./ops/extensions-admin.ops.js";
@@ -48,8 +49,10 @@ import { PlatformOperationsProvider } from "./ops/platform.ops.js";
48
49
  import { PluginsOperations } from "./ops/plugins.ops.js";
49
50
  import { PreviewersOperations } from "./ops/previewers.ops.js";
50
51
  import { RequestsOperations } from "./ops/requests.ops.js";
52
+ import { SetupOperations } from "./ops/setup.ops.js";
51
53
  import { SkillsOperations } from "./ops/skills.ops.js";
52
54
  import { ThemesOperations } from "./ops/themes.ops.js";
55
+ import { UiOperations } from "./ops/ui.ops.js";
53
56
  import { PlatformModule } from "./platform.module.js";
54
57
  /**
55
58
  * One provider per domain, each taking `PlatformOperations` as its first constructor argument:
@@ -86,11 +89,15 @@ export const PLATFORM_OPERATION_PROVIDERS = [
86
89
  EvalsOperations,
87
90
  BackgroundOperations,
88
91
  PreviewersOperations,
89
- // Task 11b: environments, agent skills
90
- EnvironmentsOperations,
92
+ // Task 11b: devices, agent skills
93
+ DevicesOperations,
91
94
  AgentSkillsOperations,
92
95
  // themes (themes spec §9)
93
96
  ThemesOperations,
97
+ // setup guide checks (setup guides v2 §12; plan task 13 adds the rest of the domain)
98
+ SetupOperations,
99
+ // UI slot catalog (UI slots spec §3)
100
+ UiOperations,
94
101
  ];
95
102
  /**
96
103
  * The `Platform` tool's operations (ruling P2): one provider per domain, each registering its
@@ -116,10 +123,11 @@ PlatformOpsModule = __decorate([
116
123
  InboxModule,
117
124
  ChannelsModule,
118
125
  EvalsModule,
119
- EnvironmentsModule,
126
+ DevicesModule,
120
127
  BackgroundModule,
121
128
  FilesModule,
122
129
  ThemesModule,
130
+ SetupModule,
123
131
  ],
124
132
  providers: [...PLATFORM_OPERATION_PROVIDERS],
125
133
  })
@@ -11,7 +11,7 @@ import { ORG_EXTENSION_ROUTES } from "../catalog/org-extension.schemas.js";
11
11
  import { ORG_PLUGIN_UPLOAD_ROUTES } from "../catalog/org-plugin-uploads.schemas.js";
12
12
  import { CHANNEL_ROUTES } from "../channels/channels.schemas.js";
13
13
  import { CONVERSATION_ROUTES } from "../conversations/conversations.schemas.js";
14
- import { ENVIRONMENT_ROUTES } from "../environments/environments.schemas.js";
14
+ import { DEVICE_ROUTES } from "../devices/devices.schemas.js";
15
15
  import { EVAL_ROUTES } from "../evals/evals.schemas.js";
16
16
  import { EXTENSION_POINT_ROUTES } from "../extensions/point-defaults.schemas.js";
17
17
  import { FILE_PREVIEWER_ROUTES } from "../files/previewers.schemas.js";
@@ -19,10 +19,13 @@ import { ME_ROUTES } from "../identity/me.schemas.js";
19
19
  import { INBOX_ROUTES } from "../inbox/inbox.schemas.js";
20
20
  import { ORG_MODEL_ROUTES } from "../models/org-models.schemas.js";
21
21
  import { ORG_ROUTES, ORG_SETTINGS_ROUTES } from "../orgs/orgs.schemas.js";
22
+ import { SETUP_CHECK_ROUTES } from "../setup/setup-checks.schemas.js";
23
+ import { SETUP_GUIDE_ROUTES } from "../setup/setup-guides.schemas.js";
22
24
  import { SKILL_ROUTES } from "../skills/skills.schemas.js";
23
25
  import { THEME_ROUTES } from "../themes/themes.schemas.js";
24
26
  import { APPROVAL_ROUTES } from "../tools/approvals.schemas.js";
25
27
  import { CONNECTOR_ROUTES } from "../tools/connectors.schemas.js";
28
+ import { UI_ROUTES } from "../ui/ui.schemas.js";
26
29
  /**
27
30
  * Every route a Platform operation mirrors, from the exported `<domain>.schemas.ts` next to each
28
31
  * controller. An operation builds its input from these (`pick` / `omit` / `extend`); the parity
@@ -57,10 +60,15 @@ export const ROUTE_SCHEMAS = [
57
60
  ...EVAL_ROUTES,
58
61
  ...BACKGROUND_ROUTES,
59
62
  ...FILE_PREVIEWER_ROUTES,
60
- // Task 11b: environments
61
- ...ENVIRONMENT_ROUTES,
63
+ // Task 11b: devices
64
+ ...DEVICE_ROUTES,
62
65
  // personal preferences (run context spec §3.4)
63
66
  ...ME_ROUTES,
64
67
  // themes (themes spec §9)
65
68
  ...THEME_ROUTES,
69
+ // setup guide checks (setup guides v2 §10.3, §12)
70
+ ...SETUP_CHECK_ROUTES,
71
+ ...SETUP_GUIDE_ROUTES,
72
+ // UI slots (UI slots spec §3)
73
+ ...UI_ROUTES,
66
74
  ];
@@ -1,15 +1,15 @@
1
1
  import type { ExtensionContext } from "@capybara-hq/plugin-sdk";
2
2
  import { ChannelSupervisor } from "../channels/supervisor.js";
3
3
  import { ChannelWebhooks } from "../channels/webhook.js";
4
- import { DeviceGateway } from "../devices/device-gateway.js";
5
4
  import { ExtensionHost } from "../extensions/host.js";
6
5
  import type { GatewayRoutes } from "../http/gateway-routes.js";
7
6
  import { KernelConfigService } from "../infra/config/kernel-config.service.js";
7
+ import { LocalDeviceGateway } from "../local-devices/local-device-gateway.js";
8
8
  /**
9
9
  * The gateway role's parts, driven by `KernelLifecycle` at fixed points of its start order and
10
10
  * stop phases: the channel long-connection supervisor (leader election and share) and the webhook
11
11
  * inbound (its raw Fastify route, {@link routes}, and its runtime cache's invalidation), and the
12
- * device connections ({@link DeviceGateway}, `GET /device/connect`). Provided
12
+ * device connections ({@link LocalDeviceGateway}, `GET /device/connect`). Provided
13
13
  * only by `GatewayModule`, so a process without the gateway role has none of them.
14
14
  */
15
15
  export declare class GatewayRole {
@@ -26,7 +26,7 @@ export declare class GatewayRole {
26
26
  private unsubscribeWebhooks;
27
27
  /** The supervisor was started: the runs phase stops it. */
28
28
  private supervisorStarted;
29
- constructor(config: KernelConfigService, host: ExtensionHost, bus: Pick<ExtensionContext["bus"], "subscribe">, supervisor: ChannelSupervisor, webhooks: ChannelWebhooks, devices: DeviceGateway);
29
+ constructor(config: KernelConfigService, host: ExtensionHost, bus: Pick<ExtensionContext["bus"], "subscribe">, supervisor: ChannelSupervisor, webhooks: ChannelWebhooks, devices: LocalDeviceGateway);
30
30
  /**
31
31
  * The gateway role's HTTP routes (the channel webhook, the device connection), registered when
32
32
  * the app is built.
@@ -11,15 +11,15 @@ import { Inject, Injectable } from "@nestjs/common";
11
11
  import { CHANNEL_CHANGED_TOPIC } from "../channels/connections.service.js";
12
12
  import { ChannelSupervisor } from "../channels/supervisor.js";
13
13
  import { ChannelWebhooks } from "../channels/webhook.js";
14
- import { DeviceGateway } from "../devices/device-gateway.js";
15
14
  import { ExtensionHost } from "../extensions/host.js";
16
15
  import { KernelConfigService } from "../infra/config/kernel-config.service.js";
17
16
  import { KERNEL_BUS } from "../infra/tokens.js";
17
+ import { LocalDeviceGateway } from "../local-devices/local-device-gateway.js";
18
18
  /**
19
19
  * The gateway role's parts, driven by `KernelLifecycle` at fixed points of its start order and
20
20
  * stop phases: the channel long-connection supervisor (leader election and share) and the webhook
21
21
  * inbound (its raw Fastify route, {@link routes}, and its runtime cache's invalidation), and the
22
- * device connections ({@link DeviceGateway}, `GET /device/connect`). Provided
22
+ * device connections ({@link LocalDeviceGateway}, `GET /device/connect`). Provided
23
23
  * only by `GatewayModule`, so a process without the gateway role has none of them.
24
24
  */
25
25
  let GatewayRole = class GatewayRole {
@@ -55,7 +55,7 @@ let GatewayRole = class GatewayRole {
55
55
  webhookMaxBodyBytes: config.channels.webhookMaxBodyBytes,
56
56
  devices: {
57
57
  gateway: this.devices,
58
- maxFrameBytes: config.environments.device.maxFrameBytes,
58
+ maxFrameBytes: config.devices.local.maxFrameBytes,
59
59
  },
60
60
  };
61
61
  }
@@ -113,6 +113,6 @@ GatewayRole = __decorate([
113
113
  __param(2, Inject(KERNEL_BUS)),
114
114
  __param(3, Inject(ChannelSupervisor)),
115
115
  __param(4, Inject(ChannelWebhooks)),
116
- __param(5, Inject(DeviceGateway))
116
+ __param(5, Inject(LocalDeviceGateway))
117
117
  ], GatewayRole);
118
118
  export { GatewayRole };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The gateway role (nest kernel spec §2), imported by `KernelModule` only when `roles` includes
3
3
  * `gateway`: the channel long-connection supervisor, the webhook inbound (served as a raw Fastify
4
- * route, `http/gateway-routes.ts`), the device connections ({@link DeviceGateway}, `GET
4
+ * route, `http/gateway-routes.ts`), the device connections ({@link LocalDeviceGateway}, `GET
5
5
  * /device/connect`) and {@link GatewayRole}, which `KernelLifecycle` drives. It runs
6
6
  * no cron and no queue consumer (those are the worker role's).
7
7
  */
@@ -8,14 +8,14 @@ import { Module } from "@nestjs/common";
8
8
  import { ChannelsModule } from "../channels/channels.module.js";
9
9
  import { ChannelSupervisor } from "../channels/supervisor.js";
10
10
  import { ChannelWebhooks } from "../channels/webhook.js";
11
- import { DeviceGateway } from "../devices/device-gateway.js";
12
- import { DevicesModule } from "../devices/devices.module.js";
13
11
  import { ExtensionsModule } from "../extensions/extensions.module.js";
12
+ import { LocalDeviceGateway } from "../local-devices/local-device-gateway.js";
13
+ import { LocalDevicesModule } from "../local-devices/local-devices.module.js";
14
14
  import { GatewayRole } from "./gateway-role.js";
15
15
  /**
16
16
  * The gateway role (nest kernel spec §2), imported by `KernelModule` only when `roles` includes
17
17
  * `gateway`: the channel long-connection supervisor, the webhook inbound (served as a raw Fastify
18
- * route, `http/gateway-routes.ts`), the device connections ({@link DeviceGateway}, `GET
18
+ * route, `http/gateway-routes.ts`), the device connections ({@link LocalDeviceGateway}, `GET
19
19
  * /device/connect`) and {@link GatewayRole}, which `KernelLifecycle` drives. It runs
20
20
  * no cron and no queue consumer (those are the worker role's).
21
21
  */
@@ -23,8 +23,8 @@ let GatewayModule = class GatewayModule {
23
23
  };
24
24
  GatewayModule = __decorate([
25
25
  Module({
26
- imports: [ChannelsModule, ExtensionsModule, DevicesModule],
27
- providers: [ChannelSupervisor, ChannelWebhooks, DeviceGateway, GatewayRole],
26
+ imports: [ChannelsModule, ExtensionsModule, LocalDevicesModule],
27
+ providers: [ChannelSupervisor, ChannelWebhooks, LocalDeviceGateway, GatewayRole],
28
28
  exports: [GatewayRole],
29
29
  })
30
30
  ], GatewayModule);
@@ -18,7 +18,7 @@ import { AttachmentsModule } from "../conversations/attachments.module.js";
18
18
  import { AttachmentCleanupJob } from "../conversations/attachments.service.js";
19
19
  import { EventLogModule } from "../conversations/event-log.js";
20
20
  import { TitlesModule } from "../conversations/titles.js";
21
- import { LegacySandboxCleanupJob } from "../environments/legacy-cleanup.job.js";
21
+ import { LegacySandboxCleanupJob } from "../devices/legacy-cleanup.job.js";
22
22
  import { EvalWorkersModule } from "../evals/evals.module.js";
23
23
  import { ExtensionsModule } from "../extensions/extensions.module.js";
24
24
  import { PluginsReconcileJob } from "../extensions/lifecycle.js";
@@ -233,7 +233,7 @@ export declare function summaryText(summary: string): string;
233
233
  * `user_message` / `assistant_message`(content 原样,含 opaque;aborted 的也回放;媒体引用按
234
234
  * {@link resolveMedia} 换成 base64 或文字占位)/ `reminder`
235
235
  * (`role: "system"`,放在它所在的位置)/ `tools_changed` (`role: "system"`, the text of {@link toolsChangedText}, at its position) /
236
- * `environment_paths` (`role: "system"` at its position, `environmentPathsText`; covered by the
236
+ * `device_paths` (`role: "system"` at its position, `devicePathsText`; covered by the
237
237
  * summary: the latest one follows the summary) /
238
238
  * `run_context` (`role: "system"` at its position, `runContextText`; covered by the summary: the
239
239
  * current context follows the summary whole; a user message's sender line by `senderLines`) /
@@ -4,7 +4,7 @@ import { renderBackgroundFinished } from "../../background/render.js";
4
4
  import { isAbsorbable, } from "../../conversations/events.js";
5
5
  import { catalogText, isAlwaysLoaded } from "../../tools/builtins/tool-search.js";
6
6
  import { renderSubagentDelivery } from "../subagents/render.js";
7
- import { environmentPathsAt, environmentPathsText } from "./environment-paths.js";
7
+ import { devicePathsAt, devicePathsText } from "./device-paths.js";
8
8
  import { LEGACY_CATALOG_HEADER, LEGACY_SKILL_TEXTS, usesLegacyToolNames } from "./legacy-text.js";
9
9
  import { currentRunContext, runContextEvents, runContextFullText, runContextText, senderLines, } from "./run-context.js";
10
10
  import { invokedSkillNames, invokedSkillsText, SKILL_TEXTS, skillsCatalogEvents, snapshotChangeText, snapshotCurrentText, snapshotSystemText, systemSkillsCatalog, } from "./skills.js";
@@ -337,7 +337,7 @@ export function summaryText(summary) {
337
337
  * `user_message` / `assistant_message`(content 原样,含 opaque;aborted 的也回放;媒体引用按
338
338
  * {@link resolveMedia} 换成 base64 或文字占位)/ `reminder`
339
339
  * (`role: "system"`,放在它所在的位置)/ `tools_changed` (`role: "system"`, the text of {@link toolsChangedText}, at its position) /
340
- * `environment_paths` (`role: "system"` at its position, `environmentPathsText`; covered by the
340
+ * `device_paths` (`role: "system"` at its position, `devicePathsText`; covered by the
341
341
  * summary: the latest one follows the summary) /
342
342
  * `run_context` (`role: "system"` at its position, `runContextText`; covered by the summary: the
343
343
  * current context follows the summary whole; a user message's sender line by `senderLines`) /
@@ -552,9 +552,9 @@ export function buildModelRequest(input) {
552
552
  }
553
553
  // environments spec §13.1: the instance's directories told before the boundary follow the
554
554
  // summary again (the model keeps using the real paths)
555
- const paths = environmentPathsAt(events, after);
555
+ const paths = devicePathsAt(events, after);
556
556
  if (paths) {
557
- messages.push({ role: "system", content: environmentPathsText(paths.payload.roots) });
557
+ messages.push({ role: "system", content: devicePathsText(paths.payload.roots) });
558
558
  }
559
559
  // 被摘要覆盖的变更提醒不再发送:摘要时生效的目录与 system 里的不同 → 紧随摘要补上完整的当前目录
560
560
  const covered = skillSnaps.filter((e) => e.seq <= after).at(-1);
@@ -631,8 +631,8 @@ export function buildModelRequest(input) {
631
631
  break;
632
632
  // the instance's directories (environments spec §13.1): logged during a step's tool call,
633
633
  // so rendered after that step's tool results
634
- case "environment_paths":
635
- messages.push({ role: "system", content: environmentPathsText(e.payload.roots) });
634
+ case "device_paths":
635
+ messages.push({ role: "system", content: devicePathsText(e.payload.roots) });
636
636
  break;
637
637
  // hook_denied is not model-visible: the model sees only the denied tool call's tool_result
638
638
  // (and nothing for a denied model request), so request building skips it
@@ -134,7 +134,7 @@ function transcriptLine(e) {
134
134
  // phase D: a forked skill's report is user content of the request (build.ts)
135
135
  case "skill_fork_result":
136
136
  return `User: ${e.payload.text}`;
137
- // environment_paths is left out too: the latest one follows the summary (build.ts)
137
+ // device_paths is left out too: the latest one follows the summary (build.ts)
138
138
  // run_context is left out: its current values follow the summary anyway (build.ts), and
139
139
  // stale names should not be summarised as current
140
140
  case "tool_result":