@capybara-hq/kernel 0.1.0-rc.11 → 0.1.0-rc.13

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 (220) 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/agents/agents.schemas.d.ts +3 -0
  5. package/dist/agents/agents.service.js +11 -1
  6. package/dist/agents/definition.d.ts +1 -0
  7. package/dist/agents/definition.js +7 -3
  8. package/dist/agents/org-templates.js +4 -0
  9. package/dist/agents/pending-connectors.service.js +1 -1
  10. package/dist/background/background.module.js +2 -2
  11. package/dist/background/launch-lock.d.ts +1 -1
  12. package/dist/background/launch-lock.js +1 -1
  13. package/dist/background/poll.job.d.ts +2 -2
  14. package/dist/background/poll.job.js +10 -10
  15. package/dist/background/stop.d.ts +1 -1
  16. package/dist/background/stop.js +3 -3
  17. package/dist/background/store.d.ts +5 -5
  18. package/dist/background/store.js +5 -5
  19. package/dist/background/tasks.service.d.ts +6 -6
  20. package/dist/background/tasks.service.js +13 -13
  21. package/dist/catalog/component-scope.controller.d.ts +18 -6
  22. package/dist/catalog/component-scope.controller.js +36 -13
  23. package/dist/catalog/component-scope.service.d.ts +11 -0
  24. package/dist/catalog/component-scope.service.js +4 -0
  25. package/dist/catalog/component-state.d.ts +8 -0
  26. package/dist/catalog/component-state.js +19 -11
  27. package/dist/catalog/marketplaces.service.d.ts +1 -1
  28. package/dist/catalog/plugin-import.js +4 -1
  29. package/dist/channels/channels.module.js +2 -2
  30. package/dist/channels/inbound.d.ts +8 -8
  31. package/dist/channels/inbound.js +31 -31
  32. package/dist/channels/phrases.d.ts +27 -27
  33. package/dist/channels/phrases.js +27 -27
  34. package/dist/config/docs.js +1 -1
  35. package/dist/config/schema.d.ts +2 -2
  36. package/dist/config/schema.js +21 -21
  37. package/dist/conversations/conversations.controller.d.ts +11 -11
  38. package/dist/conversations/conversations.controller.js +15 -15
  39. package/dist/conversations/conversations.module.d.ts +1 -1
  40. package/dist/conversations/conversations.module.js +7 -7
  41. package/dist/conversations/conversations.schemas.js +1 -1
  42. package/dist/conversations/conversations.service.d.ts +23 -14
  43. package/dist/conversations/conversations.service.js +28 -21
  44. package/dist/conversations/{environment-status.d.ts → device-status.d.ts} +9 -9
  45. package/dist/conversations/{environment-status.js → device-status.js} +18 -18
  46. package/dist/conversations/event-log.d.ts +1 -1
  47. package/dist/conversations/event-log.js +1 -1
  48. package/dist/conversations/events.d.ts +2 -1
  49. package/dist/conversations/events.js +2 -2
  50. package/dist/ctx/create-ctx.d.ts +10 -1
  51. package/dist/ctx/create-ctx.js +86 -25
  52. package/dist/db/kernel-schema.d.ts +39 -23
  53. package/dist/{environments → devices}/access.d.ts +19 -19
  54. package/dist/{environments → devices}/access.js +28 -28
  55. package/dist/devices/conversation-devices.d.ts +75 -0
  56. package/dist/{environments/conversation-environments.js → devices/conversation-devices.js} +71 -72
  57. package/dist/devices/devices.controller.d.ts +36 -0
  58. package/dist/{environments/environments.controller.js → devices/devices.controller.js} +37 -37
  59. package/dist/devices/devices.module.d.ts +5 -13
  60. package/dist/devices/devices.module.js +16 -29
  61. package/dist/devices/devices.schemas.d.ts +3 -0
  62. package/dist/devices/devices.schemas.js +14 -0
  63. package/dist/{environments/environments.service.d.ts → devices/devices.service.d.ts} +70 -70
  64. package/dist/{environments/environments.service.js → devices/devices.service.js} +122 -122
  65. package/dist/devices/dto.d.ts +13 -54
  66. package/dist/devices/dto.js +7 -39
  67. package/dist/devices/label.d.ts +11 -0
  68. package/dist/{environments → devices}/label.js +7 -7
  69. package/dist/{environments → devices}/legacy-cleanup.job.d.ts +3 -3
  70. package/dist/{environments → devices}/legacy-cleanup.job.js +3 -3
  71. package/dist/errors.d.ts +27 -25
  72. package/dist/errors.js +27 -25
  73. package/dist/evals/recorded-tools.d.ts +2 -2
  74. package/dist/evals/recorded-tools.js +6 -6
  75. package/dist/extensions/admin-ops.js +1 -0
  76. package/dist/extensions/admin-view.js +2 -0
  77. package/dist/extensions/effective-config.d.ts +6 -0
  78. package/dist/extensions/effective-config.js +18 -7
  79. package/dist/extensions/host.d.ts +13 -2
  80. package/dist/extensions/host.js +24 -3
  81. package/dist/extensions/instance.d.ts +12 -1
  82. package/dist/extensions/instance.js +13 -0
  83. package/dist/extensions/permission-view.d.ts +10 -1
  84. package/dist/files/previewers.d.ts +1 -1
  85. package/dist/files/previewers.js +1 -1
  86. package/dist/http/api.module.js +10 -6
  87. package/dist/http/gateway-routes.d.ts +1 -1
  88. package/dist/http/gateway-routes.js +1 -1
  89. package/dist/identity/settings.d.ts +32 -0
  90. package/dist/identity/settings.js +26 -2
  91. package/dist/infra/config/kernel-config.service.js +4 -4
  92. package/dist/kernel.module.js +3 -3
  93. package/dist/{devices → local-devices}/device-auth.controller.d.ts +6 -6
  94. package/dist/{devices → local-devices}/device-auth.controller.js +5 -5
  95. package/dist/{devices → local-devices}/device-auth.d.ts +20 -20
  96. package/dist/{devices → local-devices}/device-auth.js +51 -53
  97. package/dist/local-devices/device-auth.module.d.ts +7 -0
  98. package/dist/{devices → local-devices}/device-auth.module.js +5 -5
  99. package/dist/{devices → local-devices}/device-routes.d.ts +3 -3
  100. package/dist/{devices → local-devices}/device-routes.js +2 -2
  101. package/dist/local-devices/dto.d.ts +66 -0
  102. package/dist/local-devices/dto.js +44 -0
  103. package/dist/{devices → local-devices}/keys.d.ts +11 -11
  104. package/dist/{devices → local-devices}/keys.js +11 -11
  105. package/dist/{devices/device-gateway.d.ts → local-devices/local-device-gateway.d.ts} +14 -14
  106. package/dist/{devices/device-gateway.js → local-devices/local-device-gateway.js} +44 -44
  107. package/dist/{devices/device-provider.d.ts → local-devices/local-device-provider.d.ts} +15 -15
  108. package/dist/{devices/device-provider.js → local-devices/local-device-provider.js} +23 -23
  109. package/dist/local-devices/local-devices.module.d.ts +16 -0
  110. package/dist/local-devices/local-devices.module.js +44 -0
  111. package/dist/{devices → local-devices}/machines.d.ts +26 -26
  112. package/dist/{devices → local-devices}/machines.js +71 -71
  113. package/dist/{devices → local-devices}/relay.d.ts +15 -15
  114. package/dist/{devices → local-devices}/relay.js +55 -55
  115. package/dist/{devices → local-devices}/targets.d.ts +8 -8
  116. package/dist/{devices → local-devices}/targets.js +14 -14
  117. package/dist/orgs/offboarding.d.ts +6 -6
  118. package/dist/orgs/offboarding.js +12 -12
  119. package/dist/orgs/settings.service.d.ts +28 -0
  120. package/dist/orgs/settings.service.js +20 -1
  121. package/dist/platform/exclusions.js +48 -3
  122. package/dist/platform/operation.js +6 -2
  123. package/dist/platform/ops/admin.ops.js +8 -2
  124. package/dist/platform/ops/agents.ops.js +19 -6
  125. package/dist/platform/ops/conversations.ops.d.ts +3 -3
  126. package/dist/platform/ops/conversations.ops.js +9 -9
  127. package/dist/platform/ops/devices.ops.d.ts +26 -0
  128. package/dist/platform/ops/devices.ops.js +311 -0
  129. package/dist/platform/ops/org-settings.ops.js +2 -2
  130. package/dist/platform/ops/orgs.ops.js +1 -0
  131. package/dist/platform/ops/ui.ops.d.ts +8 -0
  132. package/dist/platform/ops/ui.ops.js +41 -0
  133. package/dist/platform/platform-ops.module.d.ts +3 -2
  134. package/dist/platform/platform-ops.module.js +8 -5
  135. package/dist/platform/route-schemas.js +6 -3
  136. package/dist/roles/gateway-role.d.ts +3 -3
  137. package/dist/roles/gateway-role.js +4 -4
  138. package/dist/roles/gateway.module.d.ts +1 -1
  139. package/dist/roles/gateway.module.js +5 -5
  140. package/dist/roles/worker.module.js +1 -1
  141. package/dist/runtime/context/build.d.ts +1 -1
  142. package/dist/runtime/context/build.js +6 -6
  143. package/dist/runtime/context/compaction.js +1 -1
  144. package/dist/runtime/context/{environment-paths.d.ts → device-paths.d.ts} +11 -11
  145. package/dist/runtime/context/{environment-paths.js → device-paths.js} +13 -13
  146. package/dist/runtime/maintenance.d.ts +1 -1
  147. package/dist/runtime/subagents/definition.d.ts +3 -2
  148. package/dist/runtime/subagents/definition.js +2 -1
  149. package/dist/sandbox/jobs.d.ts +13 -13
  150. package/dist/sandbox/jobs.js +20 -20
  151. package/dist/sandbox/leases.d.ts +9 -9
  152. package/dist/sandbox/leases.js +14 -14
  153. package/dist/sandbox/providers.d.ts +8 -8
  154. package/dist/sandbox/providers.js +8 -8
  155. package/dist/sandbox/sandbox.module.d.ts +1 -1
  156. package/dist/sandbox/sandbox.module.js +1 -1
  157. package/dist/sandbox/sandbox.service.d.ts +76 -76
  158. package/dist/sandbox/sandbox.service.js +230 -230
  159. package/dist/tools/builtins/builtin-tools.d.ts +2 -2
  160. package/dist/tools/builtins/builtin-tools.js +5 -5
  161. package/dist/tools/builtins/platform.js +1 -1
  162. package/dist/tools/builtins/sandbox/bash.js +6 -6
  163. package/dist/tools/builtins/sandbox/common.d.ts +25 -25
  164. package/dist/tools/builtins/sandbox/common.js +51 -51
  165. package/dist/tools/builtins/sandbox/edit.js +2 -2
  166. package/dist/tools/builtins/sandbox/index.d.ts +1 -1
  167. package/dist/tools/builtins/sandbox/index.js +1 -1
  168. package/dist/tools/builtins/sandbox/task-output.d.ts +6 -6
  169. package/dist/tools/builtins/sandbox/task-output.js +10 -10
  170. package/dist/tools/builtins/sandbox/task-stop.js +2 -2
  171. package/dist/tools/builtins/sandbox/write.js +2 -2
  172. package/dist/tools/builtins/skill-load.d.ts +1 -1
  173. package/dist/tools/builtins/skill-load.js +2 -2
  174. package/dist/tools/connector-account-policies.d.ts +51 -0
  175. package/dist/tools/connector-account-policies.js +165 -0
  176. package/dist/tools/connectors.controller.d.ts +35 -4
  177. package/dist/tools/connectors.controller.js +66 -7
  178. package/dist/tools/connectors.schemas.d.ts +11 -0
  179. package/dist/tools/connectors.schemas.js +11 -0
  180. package/dist/tools/connectors.service.d.ts +2 -0
  181. package/dist/tools/connectors.service.js +1 -0
  182. package/dist/tools/pipeline.d.ts +1 -1
  183. package/dist/tools/pipeline.js +4 -3
  184. package/dist/tools/policy.d.ts +23 -1
  185. package/dist/tools/policy.js +99 -24
  186. package/dist/tools/registry.d.ts +2 -2
  187. package/dist/tools/tools.module.js +6 -3
  188. package/dist/ui/admin-ui.controller.d.ts +56 -0
  189. package/dist/ui/admin-ui.controller.js +192 -0
  190. package/dist/ui/arrangement.d.ts +74 -0
  191. package/dist/ui/arrangement.js +98 -0
  192. package/dist/ui/embed-token.d.ts +2 -2
  193. package/dist/ui/embed-token.js +30 -5
  194. package/dist/ui/registry.d.ts +29 -14
  195. package/dist/ui/registry.js +31 -10
  196. package/dist/ui/slots.controller.d.ts +11 -0
  197. package/dist/ui/slots.controller.js +25 -0
  198. package/dist/ui/ui-stream.d.ts +20 -3
  199. package/dist/ui/ui-stream.js +25 -7
  200. package/dist/ui/ui.schemas.d.ts +66 -0
  201. package/dist/ui/ui.schemas.js +65 -0
  202. package/dist/ui/views.controller.d.ts +35 -49
  203. package/dist/ui/views.controller.js +48 -70
  204. package/dist/ui/views.d.ts +84 -18
  205. package/dist/ui/views.js +201 -38
  206. package/package.json +3 -3
  207. package/src/migrations/0104_connector_tool_account_policies.sql +16 -0
  208. package/src/migrations/0105_devices_rename.sql +136 -0
  209. package/dist/devices/device-auth.module.d.ts +0 -7
  210. package/dist/environments/conversation-environments.d.ts +0 -75
  211. package/dist/environments/dto.d.ts +0 -25
  212. package/dist/environments/dto.js +0 -12
  213. package/dist/environments/environments.controller.d.ts +0 -36
  214. package/dist/environments/environments.module.d.ts +0 -8
  215. package/dist/environments/environments.module.js +0 -31
  216. package/dist/environments/environments.schemas.d.ts +0 -3
  217. package/dist/environments/environments.schemas.js +0 -14
  218. package/dist/environments/label.d.ts +0 -11
  219. package/dist/platform/ops/environments.ops.d.ts +0 -26
  220. package/dist/platform/ops/environments.ops.js +0 -311
@@ -1037,14 +1037,14 @@ export const KernelConfigSchema = z.object({
1037
1037
  .min(1)
1038
1038
  .optional()
1039
1039
  .meta(meta({
1040
- description: "Image for environment instances, passed to the sandbox extension; unset (the default), each extension uses the image published with its own version (ghcr.io/capybara-hq/capybara-sandbox). Set it to a locally built or mirrored image for offline deployments; an extension that builds instances from its own template may ignore it",
1040
+ description: "Image for cloud device instances, passed to the sandbox extension; unset (the default), each extension uses the image published with its own version (ghcr.io/capybara-hq/capybara-sandbox). Set it to a locally built or mirrored image for offline deployments; an extension that builds instances from its own template may ignore it",
1041
1041
  })),
1042
1042
  lockWaitSeconds: z
1043
1043
  .number()
1044
1044
  .positive()
1045
1045
  .default(75)
1046
1046
  .meta(meta({
1047
- description: "Seconds a sandbox call waits for the environment's instance (while it is being created, resumed or suspended, or all its concurrent command slots are taken) before failing with sandbox.busy; keep it above the 60-second sandbox lock TTL so a call after a replica crash waits for the dead replica's lock to expire",
1047
+ description: "Seconds a sandbox call waits for the device's instance (while it is being created, resumed or suspended, or all its concurrent command slots are taken) before failing with sandbox.busy; keep it above the 60-second sandbox lock TTL so a call after a replica crash waits for the dead replica's lock to expire",
1048
1048
  })),
1049
1049
  maxConcurrentCommands: z
1050
1050
  .number()
@@ -1054,7 +1054,7 @@ export const KernelConfigSchema = z.object({
1054
1054
  .default(6)
1055
1055
  .meta(meta({
1056
1056
  hot: true,
1057
- description: "Sandbox commands and file operations that may run at the same time in one environment, shared by all its conversations and their sub-agents; 1 runs them one at a time",
1057
+ description: "Sandbox commands and file operations that may run at the same time in one device, shared by all its conversations and their sub-agents; 1 runs them one at a time",
1058
1058
  })),
1059
1059
  deliverMaxBytes: z
1060
1060
  .number()
@@ -1073,7 +1073,7 @@ export const KernelConfigSchema = z.object({
1073
1073
  .max(100)
1074
1074
  .default(4)
1075
1075
  .meta(meta({
1076
- description: "Most background Bash tasks (run_in_background) that may run at once in one conversation, its sub-agents included (counted per root conversation, not per environment); a launch beyond it is refused",
1076
+ description: "Most background Bash tasks (run_in_background) that may run at once in one conversation, its sub-agents included (counted per root conversation, not per device); a launch beyond it is refused",
1077
1077
  })),
1078
1078
  maxSeconds: z
1079
1079
  .number()
@@ -1089,7 +1089,7 @@ export const KernelConfigSchema = z.object({
1089
1089
  .min(1)
1090
1090
  .default(10)
1091
1091
  .meta(meta({
1092
- description: "How often the worker checks the running background Bash tasks of every environment for a finish, in seconds; read when the worker starts",
1092
+ description: "How often the worker checks the running background Bash tasks of every device for a finish, in seconds; read when the worker starts",
1093
1093
  })),
1094
1094
  })
1095
1095
  .prefault({}),
@@ -1100,7 +1100,7 @@ export const KernelConfigSchema = z.object({
1100
1100
  .positive()
1101
1101
  .default(1)
1102
1102
  .meta(meta({
1103
- description: "CPU cores for each environment instance; applies to instances created after the change (an extension that sizes instances by its own template, such as E2B, may not apply it)",
1103
+ description: "CPU cores for each cloud device instance; applies to instances created after the change (an extension that sizes instances by its own template, such as E2B, may not apply it)",
1104
1104
  })),
1105
1105
  memoryMb: z
1106
1106
  .number()
@@ -1108,7 +1108,7 @@ export const KernelConfigSchema = z.object({
1108
1108
  .positive()
1109
1109
  .default(2048)
1110
1110
  .meta(meta({
1111
- description: "Memory limit of each environment instance in MiB; applies to instances created after the change (an extension that sizes instances by its own template, such as E2B, may not apply it)",
1111
+ description: "Memory limit of each cloud device instance in MiB; applies to instances created after the change (an extension that sizes instances by its own template, such as E2B, may not apply it)",
1112
1112
  })),
1113
1113
  diskMb: z
1114
1114
  .number()
@@ -1116,7 +1116,7 @@ export const KernelConfigSchema = z.object({
1116
1116
  .positive()
1117
1117
  .default(5120)
1118
1118
  .meta(meta({
1119
- description: "Disk limit of each environment's file system in MiB; applies to file systems created after the change (Docker: only with a volume driver that supports size; an extension whose storage cannot be sized may not apply it)",
1119
+ description: "Disk limit of each cloud device's file system in MiB; applies to file systems created after the change (Docker: only with a volume driver that supports size; an extension whose storage cannot be sized may not apply it)",
1120
1120
  })),
1121
1121
  maxCommandSeconds: z
1122
1122
  .number()
@@ -1132,7 +1132,7 @@ export const KernelConfigSchema = z.object({
1132
1132
  .positive()
1133
1133
  .default(10)
1134
1134
  .meta(meta({
1135
- description: "Minutes without a command from any conversation of the environment before its running instance is suspended (files are kept, processes end)",
1135
+ description: "Minutes without a command from any conversation of the device before its running instance is suspended (files are kept, processes end)",
1136
1136
  })),
1137
1137
  destroyAfterInactiveDays: z
1138
1138
  .number()
@@ -1140,7 +1140,7 @@ export const KernelConfigSchema = z.object({
1140
1140
  .positive()
1141
1141
  .default(7)
1142
1142
  .meta(meta({
1143
- description: "Days without use before an environment's instance is destroyed; its files are kept until the environment is deleted, and the next use starts a new instance on them",
1143
+ description: "Days without use before a device's instance is destroyed; its files are kept until the device is deleted, and the next use starts a new instance on them",
1144
1144
  })),
1145
1145
  maxRunningMinutes: z
1146
1146
  .number()
@@ -1148,13 +1148,13 @@ export const KernelConfigSchema = z.object({
1148
1148
  .positive()
1149
1149
  .default(120)
1150
1150
  .meta(meta({
1151
- description: "Minutes an environment's instance may run continuously before it is suspended even while in use (skipped while a command is running)",
1151
+ description: "Minutes a device's instance may run continuously before it is suspended even while in use (skipped while a command is running)",
1152
1152
  })),
1153
1153
  egress: z
1154
1154
  .enum(["none", "allowlist", "open"])
1155
1155
  .default("allowlist")
1156
1156
  .meta(meta({
1157
- description: "Outbound network from environment instances: none, allowlist (only allowHosts) or open; applies to instances created after the change, existing ones keep theirs until destroyed",
1157
+ description: "Outbound network from cloud device instances: none, allowlist (only allowHosts) or open; applies to instances created after the change, existing ones keep theirs until destroyed",
1158
1158
  })),
1159
1159
  allowHosts: z
1160
1160
  .array(z.string())
@@ -1167,13 +1167,13 @@ export const KernelConfigSchema = z.object({
1167
1167
  });
1168
1168
  })
1169
1169
  .meta(meta({
1170
- description: "Hosts environment instances may reach when egress is allowlist: lowercase hostnames, optional leading '*.', no IPs, ports or internal-only names; applies to instances created after the change",
1170
+ description: "Hosts cloud device instances may reach when egress is allowlist: lowercase hostnames, optional leading '*.', no IPs, ports or internal-only names; applies to instances created after the change",
1171
1171
  })),
1172
1172
  })
1173
1173
  .prefault({}),
1174
1174
  })
1175
1175
  .prefault({}),
1176
- environments: z
1176
+ devices: z
1177
1177
  .object({
1178
1178
  maxPersonal: z
1179
1179
  .number()
@@ -1182,9 +1182,9 @@ export const KernelConfigSchema = z.object({
1182
1182
  .default(10)
1183
1183
  .meta(meta({
1184
1184
  hot: true,
1185
- description: "Most personal environments a member may have in one org, the default one included; creating one more fails with environment.limit_reached",
1185
+ description: "Most personal devices a member may have in one org, the default one and local devices included; creating one more fails with device.limit_reached",
1186
1186
  })),
1187
- device: z
1187
+ local: z
1188
1188
  .object({
1189
1189
  reconnectGraceSeconds: z
1190
1190
  .number()
@@ -1193,7 +1193,7 @@ export const KernelConfigSchema = z.object({
1193
1193
  .default(120)
1194
1194
  .meta(meta({
1195
1195
  hot: true,
1196
- description: "Seconds a connected machine may stay disconnected before its environment is reported offline; also sent to the device program at sign-in",
1196
+ description: "Seconds a local device's machine may stay disconnected before the device is reported offline; also sent to capybara-device at sign-in",
1197
1197
  })),
1198
1198
  leaseTtlMs: z
1199
1199
  .number()
@@ -1201,7 +1201,7 @@ export const KernelConfigSchema = z.object({
1201
1201
  .min(6000)
1202
1202
  .default(30000)
1203
1203
  .meta(meta({
1204
- description: "Milliseconds the replica holding a machine's connection keeps its lease without renewing it; at least 6000",
1204
+ description: "Milliseconds the replica holding a local device's connection keeps its lease without renewing it; at least 6000",
1205
1205
  })),
1206
1206
  authCodeTtlSeconds: z
1207
1207
  .number()
@@ -1209,7 +1209,7 @@ export const KernelConfigSchema = z.object({
1209
1209
  .positive()
1210
1210
  .default(600)
1211
1211
  .meta(meta({
1212
- description: "Seconds a device sign-in code stays valid before the program must start over (device.expired)",
1212
+ description: "Seconds a device sign-in code stays valid before capybara-device must start over (device_sign_in.expired)",
1213
1213
  })),
1214
1214
  pollIntervalSeconds: z
1215
1215
  .number()
@@ -1217,7 +1217,7 @@ export const KernelConfigSchema = z.object({
1217
1217
  .positive()
1218
1218
  .default(5)
1219
1219
  .meta(meta({
1220
- description: "Seconds the device program waits between token polls during sign-in; polling faster gets device.slow_down",
1220
+ description: "Seconds capybara-device waits between token polls during sign-in; polling faster gets device_sign_in.slow_down",
1221
1221
  })),
1222
1222
  maxFrameBytes: z
1223
1223
  .number()
@@ -1225,7 +1225,7 @@ export const KernelConfigSchema = z.object({
1225
1225
  .positive()
1226
1226
  .default(16 * 1024 * 1024)
1227
1227
  .meta(meta({
1228
- description: "Largest WebSocket frame in bytes accepted from or sent to a connected machine",
1228
+ description: "Largest WebSocket frame in bytes accepted from or sent to a local device's machine",
1229
1229
  })),
1230
1230
  })
1231
1231
  .prefault({}),
@@ -1,6 +1,6 @@
1
1
  import type { FastifyReply } from "fastify";
2
2
  import { z } from "zod";
3
- import type { EnvironmentView } from "../environments/environments.service.js";
3
+ import type { DeviceView } from "../devices/devices.service.js";
4
4
  import { type Principal } from "../identity/principal.js";
5
5
  import { type OrgContext } from "../orgs/org.guard.js";
6
6
  import { ConversationToolInfo, type ToolInfo } from "../tools/info.js";
@@ -8,7 +8,7 @@ import type { AgentTreeNode } from "./agent-tree.js";
8
8
  import { type ArtifactPreview, ConversationArtifacts } from "./artifacts.js";
9
9
  import { EventsQuery, FilesQuery, IdParams, ListQuery, PatchBody, SubagentsQuery } from "./conversations.schemas.js";
10
10
  import { type ConversationGroup, ConversationsService, type ConversationView, type SubagentView, type UsageTotals } from "./conversations.service.js";
11
- import { ConversationEnvironmentStatus } from "./environment-status.js";
11
+ import { ConversationDeviceStatus } from "./device-status.js";
12
12
  import type { ConversationEvent } from "./events.js";
13
13
  import { ConversationFiles, type FileOutput } from "./files.js";
14
14
  import { ConversationOutputs, type OutputPage } from "./outputs-read.js";
@@ -78,12 +78,12 @@ declare const MessageBody: z.ZodObject<{
78
78
  * `POST /conversations`: `message` creates the conversation with its first message (create on
79
79
  * first send; `clientMessageId` is required and makes a retry return the same conversation).
80
80
  * Without it the conversation is created empty (API clients; the web never does).
81
- * `environmentId` binds it to one of the caller's environments; without it the caller's default
82
- * environment (environments spec §4.1 item 1).
81
+ * `deviceId` binds it to one of the caller's devices; without it the caller's default
82
+ * device (environments spec §4.1 item 1).
83
83
  */
84
84
  declare const CreateBody: z.ZodObject<{
85
85
  agentId: z.ZodString;
86
- environmentId: z.ZodOptional<z.ZodString>;
86
+ deviceId: z.ZodOptional<z.ZodString>;
87
87
  message: z.ZodOptional<z.ZodObject<{
88
88
  text: z.ZodString;
89
89
  attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -156,11 +156,11 @@ export declare class ConversationsController {
156
156
  private readonly conversations;
157
157
  private readonly outputs;
158
158
  private readonly artifacts;
159
- private readonly environmentStatus;
159
+ private readonly deviceStatus;
160
160
  private readonly toolInfo;
161
161
  private readonly queue;
162
162
  private readonly files;
163
- constructor(conversations: ConversationsService, outputs: ConversationOutputs, artifacts: ConversationArtifacts, environmentStatus: ConversationEnvironmentStatus, toolInfo: ConversationToolInfo, queue: ConversationQueue, files: ConversationFiles);
163
+ constructor(conversations: ConversationsService, outputs: ConversationOutputs, artifacts: ConversationArtifacts, deviceStatus: ConversationDeviceStatus, toolInfo: ConversationToolInfo, queue: ConversationQueue, files: ConversationFiles);
164
164
  /**
165
165
  * 201 when created; 200 when `message.clientMessageId` repeats an earlier first send. With a
166
166
  * message the answer has `event` (the `user_message`) and `events`: every event the first send
@@ -266,12 +266,12 @@ export declare class ConversationsController {
266
266
  */
267
267
  fileContent(principal: Principal, org: OrgContext, id: string, fileId: string, q: z.infer<typeof FileContentQuery>, reply: FastifyReply): Promise<void>;
268
268
  /**
269
- * The environment the conversation works in (a sub-agent: its root's), as its owner sees it,
270
- * with its instance state; `null` while unbound, or when the environment was deleted. Same
269
+ * The device the conversation works in (a sub-agent: its root's), as its owner sees it,
270
+ * with its instance state; `null` while unbound, or when the device was deleted. Same
271
271
  * visibility as the event stream.
272
272
  */
273
- environment(principal: Principal, org: OrgContext, id: string): Promise<{
274
- environment: EnvironmentView | null;
273
+ device(principal: Principal, org: OrgContext, id: string): Promise<{
274
+ device: DeviceView | null;
275
275
  }>;
276
276
  /**
277
277
  * Display metadata (title, kind, key arguments, source) of the tools a conversation's calls name,
@@ -19,7 +19,7 @@ import { ConversationToolInfo, TOOL_INFO_KEY_MAX, TOOL_INFO_MAX_KEYS, } from "..
19
19
  import { ARTIFACT_DOWNLOAD_CACHE_SECONDS, ConversationArtifacts, } from "./artifacts.js";
20
20
  import { EventsQuery, FilesQuery, IdParams, ListQuery, PatchBody, SubagentsQuery, searchFields, } from "./conversations.schemas.js";
21
21
  import { ConversationsService, } from "./conversations.service.js";
22
- import { ConversationEnvironmentStatus } from "./environment-status.js";
22
+ import { ConversationDeviceStatus } from "./device-status.js";
23
23
  import { ConversationFiles, FILE_CONTENT_MAX_BYTES } from "./files.js";
24
24
  import { ConversationOutputs, OUTPUT_PAGE_MAX_CHARS } from "./outputs-read.js";
25
25
  import { ConversationQueue } from "./queue.service.js";
@@ -106,13 +106,13 @@ const MessageBody = MessageFields.strict().refine(...textRule);
106
106
  * `POST /conversations`: `message` creates the conversation with its first message (create on
107
107
  * first send; `clientMessageId` is required and makes a retry return the same conversation).
108
108
  * Without it the conversation is created empty (API clients; the web never does).
109
- * `environmentId` binds it to one of the caller's environments; without it the caller's default
110
- * environment (environments spec §4.1 item 1).
109
+ * `deviceId` binds it to one of the caller's devices; without it the caller's default
110
+ * device (environments spec §4.1 item 1).
111
111
  */
112
112
  const CreateBody = z
113
113
  .object({
114
114
  agentId: z.string().min(1).max(100),
115
- environmentId: z.string().min(1).max(100).optional(),
115
+ deviceId: z.string().min(1).max(100).optional(),
116
116
  message: MessageFields.omit({ retryOf: true })
117
117
  .extend({ clientMessageId: z.string().min(1).max(200) })
118
118
  .strict()
@@ -167,15 +167,15 @@ let ConversationsController = class ConversationsController {
167
167
  conversations;
168
168
  outputs;
169
169
  artifacts;
170
- environmentStatus;
170
+ deviceStatus;
171
171
  toolInfo;
172
172
  queue;
173
173
  files;
174
- constructor(conversations, outputs, artifacts, environmentStatus, toolInfo, queue, files) {
174
+ constructor(conversations, outputs, artifacts, deviceStatus, toolInfo, queue, files) {
175
175
  this.conversations = conversations;
176
176
  this.outputs = outputs;
177
177
  this.artifacts = artifacts;
178
- this.environmentStatus = environmentStatus;
178
+ this.deviceStatus = deviceStatus;
179
179
  this.toolInfo = toolInfo;
180
180
  this.queue = queue;
181
181
  this.files = files;
@@ -187,7 +187,7 @@ let ConversationsController = class ConversationsController {
187
187
  */
188
188
  async create(principal, org, body, reply) {
189
189
  const p = requireUser(principal);
190
- const pick = body.environmentId === undefined ? {} : { environmentId: body.environmentId };
190
+ const pick = body.deviceId === undefined ? {} : { deviceId: body.deviceId };
191
191
  if (body.message === undefined) {
192
192
  return {
193
193
  conversation: await this.conversations.create(org.orgId, p.account.id, body.agentId, pick),
@@ -371,13 +371,13 @@ let ConversationsController = class ConversationsController {
371
371
  await reply.send(c.body);
372
372
  }
373
373
  /**
374
- * The environment the conversation works in (a sub-agent: its root's), as its owner sees it,
375
- * with its instance state; `null` while unbound, or when the environment was deleted. Same
374
+ * The device the conversation works in (a sub-agent: its root's), as its owner sees it,
375
+ * with its instance state; `null` while unbound, or when the device was deleted. Same
376
376
  * visibility as the event stream.
377
377
  */
378
- async environment(principal, org, id) {
378
+ async device(principal, org, id) {
379
379
  const p = requireUser(principal);
380
- return { environment: await this.environmentStatus.get(org.orgId, id, p.account.id) };
380
+ return { device: await this.deviceStatus.get(org.orgId, id, p.account.id) };
381
381
  }
382
382
  /**
383
383
  * Display metadata (title, kind, key arguments, source) of the tools a conversation's calls name,
@@ -590,13 +590,13 @@ __decorate([
590
590
  __param(5, Res())
591
591
  ], ConversationsController.prototype, "fileContent", null);
592
592
  __decorate([
593
- Get(":id/environment"),
593
+ Get(":id/device"),
594
594
  Header("cache-control", "private, no-store"),
595
595
  OrgAction("agents.use"),
596
596
  __param(0, CurrentPrincipal()),
597
597
  __param(1, CurrentOrg()),
598
598
  __param(2, Param("id"))
599
- ], ConversationsController.prototype, "environment", null);
599
+ ], ConversationsController.prototype, "device", null);
600
600
  __decorate([
601
601
  Get(":id/tools"),
602
602
  Header("cache-control", "private, no-store"),
@@ -680,7 +680,7 @@ ConversationsController = __decorate([
680
680
  __param(0, Inject(ConversationsService)),
681
681
  __param(1, Inject(ConversationOutputs)),
682
682
  __param(2, Inject(ConversationArtifacts)),
683
- __param(3, Inject(ConversationEnvironmentStatus)),
683
+ __param(3, Inject(ConversationDeviceStatus)),
684
684
  __param(4, Inject(ConversationToolInfo)),
685
685
  __param(5, Inject(ConversationQueue)),
686
686
  __param(6, Inject(ConversationFiles))
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Conversations: the one {@link ConversationsService} (messages, model switches, skill
3
3
  * invocations, sub-agent views, abort), the queue, the file / artifact / output reads and the
4
- * conversation's environment. The event log, the access check and the attachments are their own modules (the
4
+ * conversation's device. The event log, the access check and the attachments are their own modules (the
5
5
  * skills and tools use them too) and are re-exported here.
6
6
  */
7
7
  export declare class ConversationsModule {
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { Module } from "@nestjs/common";
8
8
  import { AgentLookupModule } from "../agents/agent-lookup.js";
9
9
  import { BackgroundModule } from "../background/background.module.js";
10
- import { EnvironmentsModule } from "../environments/environments.module.js";
10
+ import { DevicesModule } from "../devices/devices.module.js";
11
11
  import { ProvidersModule } from "../runtime/providers.js";
12
12
  import { RuntimeModule } from "../runtime/runtime.module.js";
13
13
  import { SkillsModule } from "../skills/skills.module.js";
@@ -17,7 +17,7 @@ import { ConversationAccessModule } from "./access.js";
17
17
  import { ConversationArtifacts } from "./artifacts.js";
18
18
  import { AttachmentsModule } from "./attachments.module.js";
19
19
  import { ConversationsService } from "./conversations.service.js";
20
- import { ConversationEnvironmentStatus } from "./environment-status.js";
20
+ import { ConversationDeviceStatus } from "./device-status.js";
21
21
  import { EventLogModule } from "./event-log.js";
22
22
  import { ConversationFiles } from "./files.js";
23
23
  import { ConversationOutputs } from "./outputs-read.js";
@@ -25,7 +25,7 @@ import { ConversationQueue } from "./queue.service.js";
25
25
  /**
26
26
  * Conversations: the one {@link ConversationsService} (messages, model switches, skill
27
27
  * invocations, sub-agent views, abort), the queue, the file / artifact / output reads and the
28
- * conversation's environment. The event log, the access check and the attachments are their own modules (the
28
+ * conversation's device. The event log, the access check and the attachments are their own modules (the
29
29
  * skills and tools use them too) and are re-exported here.
30
30
  */
31
31
  let ConversationsModule = class ConversationsModule {
@@ -43,8 +43,8 @@ ConversationsModule = __decorate([
43
43
  // the run control (start a run after a message, stop runs) and the model provider registry
44
44
  RuntimeModule,
45
45
  ProvidersModule,
46
- // the environment a conversation is bound to, and its view
47
- EnvironmentsModule,
46
+ // the device a conversation is bound to, and its view
47
+ DevicesModule,
48
48
  // the stop of a deleted conversation's background tasks
49
49
  BackgroundModule,
50
50
  ],
@@ -54,7 +54,7 @@ ConversationsModule = __decorate([
54
54
  ConversationOutputs,
55
55
  ConversationArtifacts,
56
56
  ConversationFiles,
57
- ConversationEnvironmentStatus,
57
+ ConversationDeviceStatus,
58
58
  ],
59
59
  exports: [
60
60
  EventLogModule,
@@ -65,7 +65,7 @@ ConversationsModule = __decorate([
65
65
  ConversationOutputs,
66
66
  ConversationArtifacts,
67
67
  ConversationFiles,
68
- ConversationEnvironmentStatus,
68
+ ConversationDeviceStatus,
69
69
  ],
70
70
  })
71
71
  ], ConversationsModule);
@@ -74,6 +74,6 @@ export const CONVERSATION_ROUTES = [
74
74
  { route: "GET /api/v1/orgs/:orgId/conversations/:id/agent-tree", params: IdParams },
75
75
  { route: "GET /api/v1/orgs/:orgId/conversations/:id/usage", params: IdParams },
76
76
  { route: "GET /api/v1/orgs/:orgId/conversations/:id/files", params: IdParams, query: FilesQuery },
77
- { route: "GET /api/v1/orgs/:orgId/conversations/:id/environment", params: IdParams },
77
+ { route: "GET /api/v1/orgs/:orgId/conversations/:id/device", params: IdParams },
78
78
  { route: "POST /api/v1/orgs/:orgId/conversations/:id/abort", params: IdParams },
79
79
  ];
@@ -1,8 +1,9 @@
1
1
  import { AgentLookup } from "../agents/agent-lookup.js";
2
2
  import type { ModelRef } from "../agents/definition.js";
3
+ import type { AgentAvatar } from "../agents/profile.js";
3
4
  import { BackgroundTaskStopper } from "../background/stop.js";
4
5
  import type { TitleSource } from "../db/kernel-schema.js";
5
- import { ConversationEnvironments, type NewConversationEnvironment } from "../environments/conversation-environments.js";
6
+ import { ConversationDevices, type NewConversationDevice } from "../devices/conversation-devices.js";
6
7
  import { KernelDb } from "../infra/database/kernel-db.js";
7
8
  import { TransactionHost } from "../infra/database/transaction-host.js";
8
9
  import type { KernelLogger } from "../log.js";
@@ -38,11 +39,11 @@ export interface ConversationView {
38
39
  /** When the owner archived it; null = not archived (hidden from the default lists). */
39
40
  archivedAt: Date | null;
40
41
  /**
41
- * The environment it works in (environments spec §4.1 item 1); null while unbound (no sandbox
42
- * provider when it was created, an anonymous IM sender's, or created before environments). A
42
+ * The device it works in (environments spec §4.1 item 1); null while unbound (no sandbox
43
+ * provider when it was created, an anonymous IM sender's, or created before devices). A
43
44
  * sub-agent's is null: it works in its root conversation's.
44
45
  */
45
- environmentId: string | null;
46
+ deviceId: string | null;
46
47
  /**
47
48
  * What the latest run is doing: `running` (queued or running), `waiting` (an approval or a
48
49
  * question), else null. Only the list queries compute it; other responses carry null.
@@ -53,9 +54,17 @@ export interface ConversationView {
53
54
  export declare function escapeLike(s: string): string;
54
55
  /** One agent's group in the sidebar list: the caller's newest conversations with that agent. */
55
56
  export interface ConversationGroup {
57
+ /**
58
+ * The agent's name and the avatar half of its profile, in the agents API's shape (the sidebar
59
+ * draws the group title from it without reading the agents list).
60
+ */
56
61
  agent: {
57
62
  id: string;
58
63
  name: string;
64
+ profile: {
65
+ avatar: AgentAvatar;
66
+ updatedAt: string;
67
+ };
59
68
  };
60
69
  /** max(updated_at) of the group's conversations. */
61
70
  latestAt: Date;
@@ -196,8 +205,8 @@ export declare class ConversationsService {
196
205
  private readonly invoker;
197
206
  /** Stops a deleted conversation's background tasks. */
198
207
  private readonly background;
199
- /** The environment a new conversation is bound to (environments spec §4.1 item 1). */
200
- private readonly environments;
208
+ /** The device a new conversation is bound to (environments spec §4.1 item 1). */
209
+ private readonly devices;
201
210
  readonly txHost: TransactionHost;
202
211
  constructor(db: KernelDb, eventLog: EventLog, agents: Pick<AgentLookup, "get">, access: Pick<ConversationAccess, "isAccessible">,
203
212
  /** Starts and stops the conversation's runs. */
@@ -212,20 +221,20 @@ export declare class ConversationsService {
212
221
  invoker: Pick<SkillInvoker, "prepare">,
213
222
  /** Stops a deleted conversation's background tasks. */
214
223
  background: Pick<BackgroundTaskStopper, "stopForDeletedConversation">,
215
- /** The environment a new conversation is bound to (environments spec §4.1 item 1). */
216
- environments: Pick<ConversationEnvironments, "forNew">, txHost: TransactionHost);
224
+ /** The device a new conversation is bound to (environments spec §4.1 item 1). */
225
+ devices: Pick<ConversationDevices, "forNew">, txHost: TransactionHost);
217
226
  /**
218
227
  * 不阻塞地调用一次 `ensureRun`(打开 SSE、读事件时):它幂等,并顺带清理孤儿运行,
219
228
  * 会话不会因为某次运行结束后的投递失败而永远停在「运行中」。失败只记日志。
220
229
  */
221
230
  kickRun(conversationId: string): void;
222
231
  /**
223
- * Creates an empty conversation bound to its environment (`pick`, see
224
- * {@link ConversationEnvironments.forNew}); an agent the account cannot use →
225
- * `agent.not_found`, an environment it may not use → `environment.not_found` /
226
- * `environment.unavailable`, and nothing is created.
232
+ * Creates an empty conversation bound to its device (`pick`, see
233
+ * {@link ConversationDevices.forNew}); an agent the account cannot use →
234
+ * `agent.not_found`, a device it may not use → `device.not_found` /
235
+ * `device.unavailable`, and nothing is created.
227
236
  */
228
- create(orgId: string, accountId: string, agentId: string, pick?: NewConversationEnvironment): Promise<ConversationView>;
237
+ create(orgId: string, accountId: string, agentId: string, pick?: NewConversationDevice): Promise<ConversationView>;
229
238
  /**
230
239
  * Creates a conversation together with its first message (UI refresh B, create on first send):
231
240
  * the conversation row and the `user_message` are written in one transaction, keyed by the
@@ -237,7 +246,7 @@ export declare class ConversationsService {
237
246
  */
238
247
  createWithMessage(orgId: string, accountId: string, agentId: string, input: UserMessageInput & {
239
248
  clientMessageId: string;
240
- }, pick?: NewConversationEnvironment): Promise<{
249
+ }, pick?: NewConversationDevice): Promise<{
241
250
  conversation: ConversationView;
242
251
  event: ConversationEvent;
243
252
  events: ConversationEvent[];