@capybara-hq/kernel 0.1.0-rc.67 → 0.1.0-rc.69

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 (226) hide show
  1. package/bootstrap.json +9 -1
  2. package/dist/admin/admin.module.js +2 -0
  3. package/dist/admin/health.service.d.ts +11 -4
  4. package/dist/admin/health.service.js +33 -17
  5. package/dist/background/poll.job.js +2 -2
  6. package/dist/background/tasks.service.d.ts +5 -5
  7. package/dist/background/tasks.service.js +9 -8
  8. package/dist/catalog/credential-key.d.ts +10 -0
  9. package/dist/catalog/credential-key.js +28 -0
  10. package/dist/catalog/marketplaces.service.d.ts +1 -1
  11. package/dist/catalog/plugin-upgrade.js +1 -19
  12. package/dist/catalog/requests.service.js +1 -1
  13. package/dist/config/schema.d.ts +1 -1
  14. package/dist/config/schema.js +9 -9
  15. package/dist/conversations/conversations.controller.d.ts +8 -3
  16. package/dist/conversations/conversations.controller.js +8 -3
  17. package/dist/conversations/conversations.service.d.ts +33 -15
  18. package/dist/conversations/conversations.service.js +60 -10
  19. package/dist/conversations/events.d.ts +21 -41
  20. package/dist/conversations/events.js +57 -31
  21. package/dist/conversations/permission-profiles.controller.d.ts +6 -4
  22. package/dist/conversations/permission-profiles.service.d.ts +6 -4
  23. package/dist/ctx/create-ctx.d.ts +20 -1
  24. package/dist/ctx/create-ctx.js +77 -6
  25. package/dist/ctx/device-provider-check.d.ts +6 -2
  26. package/dist/ctx/device-provider-check.js +17 -2
  27. package/dist/db/kernel-schema.d.ts +10 -48
  28. package/dist/devices/access.d.ts +3 -4
  29. package/dist/devices/access.js +3 -4
  30. package/dist/devices/conversation-devices.d.ts +1 -3
  31. package/dist/devices/conversation-devices.js +2 -7
  32. package/dist/devices/device-projects.service.js +24 -29
  33. package/dist/devices/device-provider-selection.d.ts +5 -6
  34. package/dist/devices/device-provider-selection.js +8 -9
  35. package/dist/devices/devices.controller.d.ts +8 -21
  36. package/dist/devices/devices.controller.js +9 -34
  37. package/dist/devices/devices.module.js +6 -4
  38. package/dist/devices/devices.schemas.d.ts +1 -5
  39. package/dist/devices/devices.schemas.js +1 -5
  40. package/dist/devices/devices.service.d.ts +84 -147
  41. package/dist/devices/devices.service.js +134 -229
  42. package/dist/devices/dto.d.ts +5 -32
  43. package/dist/devices/dto.js +5 -37
  44. package/dist/devices/errors.d.ts +6 -5
  45. package/dist/devices/errors.js +7 -8
  46. package/dist/devices/project-rules.d.ts +9 -11
  47. package/dist/devices/project-rules.js +7 -7
  48. package/dist/devices/working-root.d.ts +3 -6
  49. package/dist/devices/working-root.js +3 -8
  50. package/dist/dial-in/access.d.ts +23 -0
  51. package/dist/dial-in/access.js +64 -0
  52. package/dist/{local-devices/device-auth.controller.d.ts → dial-in/auth.controller.d.ts} +12 -6
  53. package/dist/{local-devices/device-auth.controller.js → dial-in/auth.controller.js} +30 -15
  54. package/dist/dial-in/auth.module.d.ts +7 -0
  55. package/dist/dial-in/auth.module.js +27 -0
  56. package/dist/{local-devices/device-auth.d.ts → dial-in/auth.service.d.ts} +42 -13
  57. package/dist/{local-devices/device-auth.js → dial-in/auth.service.js} +83 -32
  58. package/dist/dial-in/dial-in.module.d.ts +9 -0
  59. package/dist/dial-in/dial-in.module.js +37 -0
  60. package/dist/{local-devices → dial-in}/dto.d.ts +17 -2
  61. package/dist/{local-devices → dial-in}/dto.js +14 -2
  62. package/dist/dial-in/envelope.d.ts +95 -0
  63. package/dist/dial-in/envelope.js +89 -0
  64. package/dist/dial-in/gateway.d.ts +214 -0
  65. package/dist/{local-devices/local-device-gateway.js → dial-in/gateway.js} +337 -181
  66. package/dist/dial-in/handlers.d.ts +47 -0
  67. package/dist/dial-in/handlers.js +84 -0
  68. package/dist/dial-in/machines.d.ts +155 -0
  69. package/dist/dial-in/machines.js +383 -0
  70. package/dist/dial-in/relay.d.ts +135 -0
  71. package/dist/dial-in/relay.js +444 -0
  72. package/dist/dial-in/relay.module.d.ts +7 -0
  73. package/dist/dial-in/relay.module.js +24 -0
  74. package/dist/{local-devices/device-routes.d.ts → dial-in/routes.d.ts} +19 -11
  75. package/dist/{local-devices/device-routes.js → dial-in/routes.js} +45 -25
  76. package/dist/{local-devices → dial-in}/targets.d.ts +3 -18
  77. package/dist/{local-devices → dial-in}/targets.js +3 -48
  78. package/dist/errors.d.ts +8 -27
  79. package/dist/errors.js +8 -27
  80. package/dist/extensions/bootstrap.d.ts +5 -0
  81. package/dist/extensions/bootstrap.js +10 -1
  82. package/dist/extensions/extensions.module.js +6 -0
  83. package/dist/extensions/host.d.ts +6 -0
  84. package/dist/extensions/host.js +12 -2
  85. package/dist/extensions/permission-set.d.ts +15 -1
  86. package/dist/extensions/permission-set.js +11 -1
  87. package/dist/extensions/permission-view.d.ts +1 -1
  88. package/dist/extensions/permission-view.js +4 -1
  89. package/dist/http/api.module.js +4 -4
  90. package/dist/http/gateway-routes.d.ts +1 -1
  91. package/dist/http/gateway-routes.js +1 -1
  92. package/dist/http/meta.controller.js +1 -1
  93. package/dist/identity/settings.d.ts +1 -1
  94. package/dist/identity/settings.js +6 -8
  95. package/dist/infra/config/kernel-config.service.js +2 -2
  96. package/dist/infra/outbox/registry.d.ts +0 -14
  97. package/dist/infra/outbox/registry.js +0 -15
  98. package/dist/infra/throttler/named-throttlers.d.ts +1 -1
  99. package/dist/infra/throttler/named-throttlers.js +1 -1
  100. package/dist/kernel.module.js +0 -3
  101. package/dist/orgs/settings.service.js +5 -10
  102. package/dist/overrides.d.ts +0 -4
  103. package/dist/overrides.js +0 -2
  104. package/dist/platform/exclusions.js +5 -5
  105. package/dist/platform/ops/admin.ops.js +1 -1
  106. package/dist/platform/ops/conversations.ops.js +5 -2
  107. package/dist/platform/ops/devices.ops.js +11 -24
  108. package/dist/platform/ops/inbox.ops.js +1 -1
  109. package/dist/roles/gateway-role.d.ts +3 -3
  110. package/dist/roles/gateway-role.js +4 -4
  111. package/dist/roles/gateway.module.d.ts +1 -1
  112. package/dist/roles/gateway.module.js +5 -5
  113. package/dist/runtime/context/device-paths.d.ts +4 -1
  114. package/dist/runtime/context/permission-profile.js +5 -5
  115. package/dist/runtime/maintenance.d.ts +2 -5
  116. package/dist/runtime/maintenance.js +9 -19
  117. package/dist/runtime/project/knowledge.js +4 -5
  118. package/dist/runtime/project/knowledge.service.js +2 -1
  119. package/dist/sandbox/cloud-permission-snapshot.d.ts +1 -1
  120. package/dist/sandbox/cloud-permission-snapshot.js +1 -3
  121. package/dist/sandbox/device-reports.d.ts +74 -14
  122. package/dist/sandbox/device-reports.js +190 -33
  123. package/dist/sandbox/device-reports.module.d.ts +7 -0
  124. package/dist/sandbox/device-reports.module.js +25 -0
  125. package/dist/sandbox/device-sandbox.d.ts +39 -41
  126. package/dist/sandbox/device-sandbox.js +44 -83
  127. package/dist/sandbox/kernel-read.d.ts +2 -2
  128. package/dist/sandbox/legacy-retirement.d.ts +11 -59
  129. package/dist/sandbox/legacy-retirement.js +34 -186
  130. package/dist/sandbox/legacy-retirement.module.d.ts +2 -2
  131. package/dist/sandbox/legacy-retirement.module.js +2 -2
  132. package/dist/sandbox/managed-device-context.d.ts +16 -4
  133. package/dist/sandbox/managed-device-context.js +25 -8
  134. package/dist/sandbox/managed-device-context.module.js +4 -0
  135. package/dist/sandbox/modes.d.ts +3 -12
  136. package/dist/sandbox/modes.js +2 -14
  137. package/dist/{local-devices → sandbox}/network-grants.d.ts +2 -21
  138. package/dist/{local-devices → sandbox}/network-grants.js +4 -49
  139. package/dist/sandbox/operation-authority-types.d.ts +2 -1
  140. package/dist/sandbox/operation-authority.d.ts +6 -20
  141. package/dist/sandbox/operation-authority.js +43 -104
  142. package/dist/sandbox/operation-authority.module.js +1 -1
  143. package/dist/sandbox/operation-intents.d.ts +4 -1
  144. package/dist/sandbox/operation-intents.js +11 -2
  145. package/dist/sandbox/operation-reconcile.job.js +2 -4
  146. package/dist/sandbox/permission-availability.d.ts +6 -7
  147. package/dist/sandbox/permission-availability.js +7 -10
  148. package/dist/sandbox/permission-call-grants.d.ts +2 -1
  149. package/dist/sandbox/permission-call-grants.js +1 -7
  150. package/dist/sandbox/permission-call-types.d.ts +4 -4
  151. package/dist/sandbox/permission-ceiling-writes.d.ts +7 -23
  152. package/dist/sandbox/permission-ceiling-writes.js +8 -35
  153. package/dist/sandbox/permission-config-publication.d.ts +9 -1
  154. package/dist/sandbox/permission-config-publication.js +29 -21
  155. package/dist/sandbox/permission-context-types.d.ts +17 -10
  156. package/dist/sandbox/permission-facts.d.ts +98 -95
  157. package/dist/sandbox/permission-facts.js +160 -314
  158. package/dist/sandbox/permission-instance-writes.d.ts +23 -37
  159. package/dist/sandbox/permission-instance-writes.js +44 -121
  160. package/dist/sandbox/permission-runtime-reports.d.ts +38 -30
  161. package/dist/sandbox/permission-runtime-reports.js +105 -122
  162. package/dist/sandbox/providers.d.ts +26 -38
  163. package/dist/sandbox/providers.js +36 -18
  164. package/dist/sandbox/request-not-sent.d.ts +2 -13
  165. package/dist/sandbox/request-not-sent.js +2 -13
  166. package/dist/sandbox/review/permission-candidate.d.ts +13 -8
  167. package/dist/sandbox/review/permission-candidate.js +38 -48
  168. package/dist/sandbox/sandbox.module.js +7 -3
  169. package/dist/sandbox/sandbox.service.d.ts +49 -59
  170. package/dist/sandbox/sandbox.service.js +139 -259
  171. package/dist/schedules/fire.d.ts +15 -6
  172. package/dist/schedules/fire.js +27 -13
  173. package/dist/schedules/grant-rules.js +1 -1
  174. package/dist/schedules/scheduled-tasks.service.d.ts +0 -7
  175. package/dist/schedules/scheduled-tasks.service.js +1 -4
  176. package/dist/schedules/schedules.module.js +5 -3
  177. package/dist/skills/invoke.d.ts +1 -1
  178. package/dist/skills/invoke.js +2 -3
  179. package/dist/tools/approvals.service.d.ts +8 -5
  180. package/dist/tools/approvals.service.js +5 -5
  181. package/dist/tools/builtins/sandbox/bash.js +1 -2
  182. package/dist/tools/builtins/sandbox/common.d.ts +15 -9
  183. package/dist/tools/builtins/sandbox/common.js +37 -38
  184. package/dist/tools/connectors.controller.d.ts +2 -0
  185. package/dist/tools/connectors.schemas.d.ts +2 -0
  186. package/dist/tools/credentials.d.ts +2 -0
  187. package/dist/tools/network-asks.d.ts +19 -22
  188. package/dist/tools/network-asks.js +15 -21
  189. package/dist/tools/oauth/authorization-params.d.ts +7 -0
  190. package/dist/tools/oauth/authorization-params.js +19 -0
  191. package/dist/tools/oauth/flow.js +7 -0
  192. package/dist/tools/oauth/tokens.js +2 -1
  193. package/dist/tools/pipeline.d.ts +6 -7
  194. package/dist/tools/pipeline.js +17 -21
  195. package/dist/tools/tools.module.js +3 -7
  196. package/package.json +3 -4
  197. package/src/migrations/0177_dial_in_contract.sql +32 -0
  198. package/dist/local-devices/device-auth.module.d.ts +0 -7
  199. package/dist/local-devices/device-auth.module.js +0 -25
  200. package/dist/local-devices/device-policy.service.d.ts +0 -213
  201. package/dist/local-devices/device-policy.service.js +0 -605
  202. package/dist/local-devices/instance-bindings.d.ts +0 -82
  203. package/dist/local-devices/instance-bindings.js +0 -307
  204. package/dist/local-devices/local-device-gateway.d.ts +0 -153
  205. package/dist/local-devices/local-device-provider.d.ts +0 -122
  206. package/dist/local-devices/local-device-provider.js +0 -326
  207. package/dist/local-devices/local-devices.module.d.ts +0 -31
  208. package/dist/local-devices/local-devices.module.js +0 -100
  209. package/dist/local-devices/machines.d.ts +0 -211
  210. package/dist/local-devices/machines.js +0 -766
  211. package/dist/local-devices/owner-report.d.ts +0 -81
  212. package/dist/local-devices/owner-report.js +0 -150
  213. package/dist/local-devices/owner-reports.d.ts +0 -48
  214. package/dist/local-devices/owner-reports.js +0 -208
  215. package/dist/local-devices/policy-op-jobs.d.ts +0 -15
  216. package/dist/local-devices/policy-op-jobs.js +0 -12
  217. package/dist/local-devices/policy-summary.d.ts +0 -102
  218. package/dist/local-devices/policy-summary.js +0 -155
  219. package/dist/local-devices/relay.d.ts +0 -166
  220. package/dist/local-devices/relay.js +0 -559
  221. package/dist/tools/device-op-resolver.d.ts +0 -34
  222. package/dist/tools/device-op-resolver.js +0 -120
  223. /package/dist/{local-devices → dial-in}/keys.d.ts +0 -0
  224. /package/dist/{local-devices → dial-in}/keys.js +0 -0
  225. /package/dist/{local-devices → sandbox}/network-grants.module.d.ts +0 -0
  226. /package/dist/{local-devices → sandbox}/network-grants.module.js +0 -0
package/bootstrap.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "schemaVersion": 1,
4
4
  "marketplace": {
5
5
  "url": "https://github.com/capybara-hq/plugins.git",
6
- "commit": "895bfc11d7ed76726b20e2e6140764b7fadc6598"
6
+ "commit": "ae3c41845e672ece6210d202a325056b6e784c08"
7
7
  },
8
8
  "plugins": [
9
9
  {
@@ -86,6 +86,14 @@
86
86
  "integrity": "sha512-c0DFvKKQrO3qDkwAEBoBbFhDDfktucjWCIPyh+wRWGAbrXLwz69zX8C0f6MHI0YmlM68EW+NxVM3f1w8bDHOQg==",
87
87
  "required": false
88
88
  },
89
+ {
90
+ "name": "device-docker",
91
+ "source": "npm",
92
+ "npm": "@capybara-hq/plugin-device-docker",
93
+ "version": "0.1.0-rc.22",
94
+ "integrity": "sha512-cbxrv0s9YfMT8rw4TygcRYxrb6x0JPVF2WwtdQtT13lHsQmyOSxIT1GJAHxs5GxUZeRIwrt38AaIGXL/NIqvJA==",
95
+ "required": false
96
+ },
89
97
  {
90
98
  "name": "todo",
91
99
  "source": "npm",
@@ -20,6 +20,7 @@ import { PushModule } from "../push/push.module.js";
20
20
  import { ProvidersModule } from "../runtime/providers.js";
21
21
  import { RunJobsModule } from "../runtime/run-jobs.js";
22
22
  import { UsageReportModule } from "../runtime/usage-report.js";
23
+ import { SandboxProviderRegistryModule } from "../sandbox/providers.module.js";
23
24
  import { AuditLogService } from "./audit-log.service.js";
24
25
  import { AdminHealthService } from "./health.service.js";
25
26
  import { OrgNetworkAdmin } from "./org-network.service.js";
@@ -39,6 +40,7 @@ let AdminModule = class AdminModule {
39
40
  AdminModule = __decorate([
40
41
  Module({
41
42
  imports: [
43
+ SandboxProviderRegistryModule,
42
44
  IdentityModule,
43
45
  OrgsModule,
44
46
  SetupLockModule,
@@ -3,6 +3,7 @@ import type { Redis } from "ioredis";
3
3
  import { KernelDb } from "../infra/database/kernel-db.js";
4
4
  import { type LiveReplica, ReplicaPresence } from "../infra/presence/replica-presence.js";
5
5
  import type { KernelLogger } from "../log.js";
6
+ import { DeviceProviders } from "../sandbox/providers.js";
6
7
  /** The kernel's own queues, in the order the overview lists them (extension queues are not read). */
7
8
  export declare const KERNEL_QUEUE_NAMES: readonly ["cap-kernel-runs", "cap-kernel-subagent-runs", "cap-kernel-channels", "cap-kernel-maintenance", "cap-kernel-plugin-scope", "cap-kernel-titles", "cap-kernel-suggestions", "cap-kernel-usage-report", "cap-kernel-evals", "cap-kernel-lifecycle", "cap-push-deliver"];
8
9
  /** How long each source's reads may take before the answer marks it unavailable. */
@@ -66,12 +67,17 @@ export interface AdminHealth {
66
67
  error: number | null;
67
68
  };
68
69
  /**
69
- * `local`: local devices (not deleted, org not deleted); `online`: the devices whose connection a
70
- * live replica holds (lease held), at most `local`.
70
+ * Live devices (not deleted, org not deleted) per provider (most first); `dialIn`: those of the
71
+ * providers loaded here that serve their devices over the dial-in channel; `online`: the devices
72
+ * whose connection a live replica holds (lease held), at most `dialIn`.
71
73
  */
72
74
  devices: {
73
75
  online: number | null;
74
- local: number | null;
76
+ dialIn: number | null;
77
+ byProvider: {
78
+ provider: string;
79
+ devices: number;
80
+ }[] | null;
75
81
  };
76
82
  /** Sandbox instances by status, and running ones per provider (most first). */
77
83
  sandboxes: {
@@ -96,8 +102,9 @@ export declare class AdminHealthService {
96
102
  private readonly db;
97
103
  private readonly redis;
98
104
  private readonly log;
105
+ private readonly providers;
99
106
  private readonly queues;
100
- constructor(presence: Pick<ReplicaPresence, "live">, db: KernelDb, redis: Pick<Redis, "zcount" | "status">, log: Pick<KernelLogger, "warn">, runs: Queue, subagentRuns: Queue, channels: Queue, maintenance: Queue, pluginScope: Queue, titles: Queue, suggestions: Queue, usageReport: Queue, evals: Queue, lifecycle: Queue, push: Queue);
107
+ constructor(presence: Pick<ReplicaPresence, "live">, db: KernelDb, redis: Pick<Redis, "zcount" | "status">, log: Pick<KernelLogger, "warn">, providers: Pick<DeviceProviders, "forDevice">, runs: Queue, subagentRuns: Queue, channels: Queue, maintenance: Queue, pluginScope: Queue, titles: Queue, suggestions: Queue, usageReport: Queue, evals: Queue, lifecycle: Queue, push: Queue);
101
108
  read(): Promise<AdminHealth>;
102
109
  private readRedis;
103
110
  private readDb;
@@ -23,6 +23,7 @@ import { PUSH_QUEUE } from "../push/jobs.js";
23
23
  import { MAINTENANCE_QUEUE_NAME } from "../runtime/maintenance-queue.js";
24
24
  import { RUN_QUEUE_NAME, SUBAGENT_RUN_QUEUE_NAME } from "../runtime/run-jobs.js";
25
25
  import { USAGE_REPORT_QUEUE } from "../runtime/usage-report-jobs.js";
26
+ import { DeviceProviders, servesDialIn } from "../sandbox/providers.js";
26
27
  import { KERNEL_VERSION } from "../version.js";
27
28
  /** The kernel's own queues, in the order the overview lists them (extension queues are not read). */
28
29
  export const KERNEL_QUEUE_NAMES = [
@@ -63,12 +64,14 @@ let AdminHealthService = class AdminHealthService {
63
64
  db;
64
65
  redis;
65
66
  log;
67
+ providers;
66
68
  queues;
67
- constructor(presence, db, redis, log, runs, subagentRuns, channels, maintenance, pluginScope, titles, suggestions, usageReport, evals, lifecycle, push) {
69
+ constructor(presence, db, redis, log, providers, runs, subagentRuns, channels, maintenance, pluginScope, titles, suggestions, usageReport, evals, lifecycle, push) {
68
70
  this.presence = presence;
69
71
  this.db = db;
70
72
  this.redis = redis;
71
73
  this.log = log;
74
+ this.providers = providers;
72
75
  // the order of KERNEL_QUEUE_NAMES
73
76
  this.queues = [
74
77
  runs,
@@ -109,7 +112,18 @@ let AdminHealthService = class AdminHealthService {
109
112
  // Each replica counts only the devices whose lease it holds, so a device is online on at most
110
113
  // one; the clamp covers a lease handover in flight and devices deleted while still connected
111
114
  const connected = sum("devicesConnected");
112
- const devicesOnline = connected === null || db === null ? connected : Math.min(connected, db.localDevices);
115
+ const dialIn = db === null
116
+ ? null
117
+ : db.devices.reduce((n, d) => {
118
+ const p = this.providers.forDevice(d.provider);
119
+ return p !== undefined && servesDialIn(p) ? n + d.n : n;
120
+ }, 0);
121
+ const devicesOnline = connected === null || dialIn === null ? connected : Math.min(connected, dialIn);
122
+ const devicesByProvider = db === null
123
+ ? null
124
+ : db.devices
125
+ .flatMap((d) => (d.provider === null ? [] : [{ provider: d.provider, devices: d.n }]))
126
+ .sort((a, b) => b.devices - a.devices || a.provider.localeCompare(b.provider));
113
127
  let sandboxes = null;
114
128
  if (db !== null) {
115
129
  const byProvider = new Map();
@@ -157,7 +171,7 @@ let AdminHealthService = class AdminHealthService {
157
171
  disabled: channelCount((c) => c.status === "disabled"),
158
172
  error: channelCount((c) => c.status === "error"),
159
173
  },
160
- devices: { online: devicesOnline, local: db?.localDevices ?? null },
174
+ devices: { online: devicesOnline, dialIn, byProvider: devicesByProvider },
161
175
  sandboxes,
162
176
  unavailable,
163
177
  };
@@ -209,11 +223,12 @@ let AdminHealthService = class AdminHealthService {
209
223
  db
210
224
  .selectFrom("devices as d")
211
225
  .innerJoin("orgs as o", "o.id", "d.org_id")
226
+ .select(["d.provider as provider"])
212
227
  .select(sql `count(*)`.as("n"))
213
- .where("d.source", "=", "local")
214
228
  .where("d.deleted_at", "is", null)
215
229
  .where("o.deleted_at", "is", null)
216
- .executeTakeFirst(),
230
+ .groupBy("d.provider")
231
+ .execute(),
217
232
  // the partial indexes on device_instances (running / live) serve these statuses; an
218
233
  // instance of a deleted org is left out like its channels and devices
219
234
  db
@@ -228,7 +243,7 @@ let AdminHealthService = class AdminHealthService {
228
243
  ]);
229
244
  return {
230
245
  channels: channels.map((c) => ({ status: c.status, mode: c.mode, n: Number(c.n) })),
231
- localDevices: Number(devices?.n ?? 0),
246
+ devices: devices.map((d) => ({ provider: d.provider, n: Number(d.n) })),
232
247
  instances: instances.map((i) => ({
233
248
  provider: i.provider,
234
249
  status: i.status,
@@ -243,16 +258,17 @@ AdminHealthService = __decorate([
243
258
  __param(1, Inject(KernelDb)),
244
259
  __param(2, Inject(REDIS)),
245
260
  __param(3, Inject(KERNEL_LOGGER)),
246
- __param(4, Inject(getQueueToken(RUN_QUEUE_NAME))),
247
- __param(5, Inject(getQueueToken(SUBAGENT_RUN_QUEUE_NAME))),
248
- __param(6, Inject(getQueueToken(CHANNEL_QUEUE_NAME))),
249
- __param(7, Inject(getQueueToken(MAINTENANCE_QUEUE_NAME))),
250
- __param(8, Inject(getQueueToken(PLUGIN_SCOPE_QUEUE))),
251
- __param(9, Inject(getQueueToken(TITLE_QUEUE))),
252
- __param(10, Inject(getQueueToken(PROMPT_SUGGESTION_QUEUE))),
253
- __param(11, Inject(getQueueToken(USAGE_REPORT_QUEUE))),
254
- __param(12, Inject(getQueueToken(EVAL_QUEUE_NAME))),
255
- __param(13, Inject(getQueueToken(LIFECYCLE_QUEUE))),
256
- __param(14, Inject(getQueueToken(PUSH_QUEUE)))
261
+ __param(4, Inject(DeviceProviders)),
262
+ __param(5, Inject(getQueueToken(RUN_QUEUE_NAME))),
263
+ __param(6, Inject(getQueueToken(SUBAGENT_RUN_QUEUE_NAME))),
264
+ __param(7, Inject(getQueueToken(CHANNEL_QUEUE_NAME))),
265
+ __param(8, Inject(getQueueToken(MAINTENANCE_QUEUE_NAME))),
266
+ __param(9, Inject(getQueueToken(PLUGIN_SCOPE_QUEUE))),
267
+ __param(10, Inject(getQueueToken(TITLE_QUEUE))),
268
+ __param(11, Inject(getQueueToken(PROMPT_SUGGESTION_QUEUE))),
269
+ __param(12, Inject(getQueueToken(USAGE_REPORT_QUEUE))),
270
+ __param(13, Inject(getQueueToken(EVAL_QUEUE_NAME))),
271
+ __param(14, Inject(getQueueToken(LIFECYCLE_QUEUE))),
272
+ __param(15, Inject(getQueueToken(PUSH_QUEUE)))
257
273
  ], AdminHealthService);
258
274
  export { AdminHealthService };
@@ -106,8 +106,8 @@ let BackgroundTaskPollJob = class BackgroundTaskPollJob {
106
106
  if (signal.aborted)
107
107
  break;
108
108
  try {
109
- // the device's provider does not serve its org now (off in the org, not loaded, `@local`
110
- // not registered): its tasks stay as they are until it does. A task without a device
109
+ // the device's provider does not serve its org now (off in the org or not loaded): its
110
+ // tasks stay as they are until it does. A task without a device
111
111
  // needs no provider: pollLegacy finishes it as gone.
112
112
  const first = tasks[0];
113
113
  if (first?.deviceId && !(await this.sandbox.availableFor(first.deviceId, first.orgId))) {
@@ -38,10 +38,10 @@ export interface BackgroundTaskView {
38
38
  * finished legacy one, whose output is never read live).
39
39
  */
40
40
  export type OutputUnavailableReason = "starting" | "not_started" | "device_offline" | "suspended" | "rebuilt" | "output_missing" | "no_access" | "unavailable" | "read_failed";
41
- /** Why the live read failed, and where the task ran: a `local` device or a `cloud` sandbox. */
41
+ /** Why the live read failed, and the provider of the device the task ran on (null: none known). */
42
42
  export interface OutputUnavailable {
43
43
  reason: OutputUnavailableReason;
44
- environment: "local" | "cloud";
44
+ provider: string | null;
45
45
  }
46
46
  export interface BackgroundTaskOutput {
47
47
  text: string;
@@ -94,11 +94,11 @@ export declare class BackgroundTasks {
94
94
  * The end of the task's output, at most `tail` bytes. Read live when the task's device
95
95
  * instance runs (never resuming a suspended one); a finished task that cannot be read live
96
96
  * answers with the last lines its finished event kept and why (`unavailable`). Anything else is
97
- * `background_task.output_unavailable` (409) with `details: [{ reason, environment }]`.
97
+ * `background_task.output_unavailable` (409) with `details: [{ reason, provider }]`.
98
98
  */
99
99
  output(orgId: string, conversationId: string, accountId: string, taskId: string, tail: number): Promise<BackgroundTaskOutput>;
100
- /** Whether the task ran on a local device (its machine) or in a cloud sandbox. */
101
- private environmentOf;
100
+ /** The provider of the device the task ran on (`devices.provider`); null when none is known. */
101
+ private providerOf;
102
102
  /** Reads the output from the task's running instance, or says why it cannot. */
103
103
  private readLive;
104
104
  /**
@@ -7,7 +7,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __param = (this && this.__param) || function (paramIndex, decorator) {
8
8
  return function (target, key) { decorator(target, key, paramIndex); }
9
9
  };
10
- import { DeviceProtocolError, isSandboxGoneError, isSandboxPermissionUnsupportedError, isSandboxScopeDeniedError, ToolError, } from "@capybara-hq/plugin-sdk";
10
+ import { isSandboxGoneError, isSandboxPermissionUnsupportedError, isSandboxScopeDeniedError, ToolError, } from "@capybara-hq/plugin-sdk";
11
+ import { DeviceProtocolError } from "@capybara-hq/plugin-sdk/device-protocol";
11
12
  import { Inject, Injectable } from "@nestjs/common";
12
13
  import { ConversationAccess } from "../conversations/access.js";
13
14
  import { EventLog } from "../conversations/event-log.js";
@@ -149,7 +150,7 @@ let BackgroundTasks = class BackgroundTasks {
149
150
  * The end of the task's output, at most `tail` bytes. Read live when the task's device
150
151
  * instance runs (never resuming a suspended one); a finished task that cannot be read live
151
152
  * answers with the last lines its finished event kept and why (`unavailable`). Anything else is
152
- * `background_task.output_unavailable` (409) with `details: [{ reason, environment }]`.
153
+ * `background_task.output_unavailable` (409) with `details: [{ reason, provider }]`.
153
154
  */
154
155
  async output(orgId, conversationId, accountId, taskId, tail) {
155
156
  const task = await this.owned(orgId, conversationId, accountId, taskId);
@@ -158,7 +159,7 @@ let BackgroundTasks = class BackgroundTasks {
158
159
  return { ...read.value, source: "live" };
159
160
  const unavailable = {
160
161
  reason: read.reason,
161
- environment: await this.environmentOf(task.deviceId),
162
+ provider: await this.providerOf(task.deviceId),
162
163
  };
163
164
  if (task.status !== "running") {
164
165
  const ev = await this.eventLog.findByIdem(task.conversationId, finishedEventKey(task.id));
@@ -168,16 +169,16 @@ let BackgroundTasks = class BackgroundTasks {
168
169
  }
169
170
  throw new ApiError("background_task.output_unavailable", `The task's output cannot be read now (${unavailable.reason})`, [unavailable]);
170
171
  }
171
- /** Whether the task ran on a local device (its machine) or in a cloud sandbox. */
172
- async environmentOf(deviceId) {
172
+ /** The provider of the device the task ran on (`devices.provider`); null when none is known. */
173
+ async providerOf(deviceId) {
173
174
  if (deviceId === null)
174
- return "cloud";
175
+ return null;
175
176
  const row = await this.db.db
176
177
  .selectFrom("devices")
177
- .select("source")
178
+ .select("provider")
178
179
  .where("id", "=", deviceId)
179
180
  .executeTakeFirst();
180
- return row?.source === "local" ? "local" : "cloud";
181
+ return row?.provider ?? null;
181
182
  }
182
183
  /** Reads the output from the task's running instance, or says why it cannot. */
183
184
  async readLive(orgId, task, tail) {
@@ -0,0 +1,10 @@
1
+ import type { ConnectorAuth } from "../tools/credentials.js";
2
+ /**
3
+ * What a credential of `auth` looks like: two auths with the same key take the same stored
4
+ * credential (static: the type family, ownership and header names; OAuth: any other change
5
+ * re-enters), so a template update that changes the key clears the connector's stored credentials
6
+ * (`credentialsReset`). An `oauth_code` preset compares by canonical JSON without
7
+ * `authorizationParams`: they only shape the next authorize request, so
8
+ * existing tokens and the org's OAuth client stay valid (design 2026-11-22 §3.4, D3).
9
+ */
10
+ export declare function credentialKey(auth: ConnectorAuth): string;
@@ -0,0 +1,28 @@
1
+ import { canonicalJson } from "../tools/canonical-json.js";
2
+ /**
3
+ * What a credential of `auth` looks like: two auths with the same key take the same stored
4
+ * credential (static: the type family, ownership and header names; OAuth: any other change
5
+ * re-enters), so a template update that changes the key clears the connector's stored credentials
6
+ * (`credentialsReset`). An `oauth_code` preset compares by canonical JSON without
7
+ * `authorizationParams`: they only shape the next authorize request, so
8
+ * existing tokens and the org's OAuth client stay valid (design 2026-11-22 §3.4, D3).
9
+ */
10
+ export function credentialKey(auth) {
11
+ switch (auth.type) {
12
+ case "none":
13
+ return "none";
14
+ case "bearer":
15
+ case "api_key":
16
+ return `token:${auth.ownership}`;
17
+ case "basic":
18
+ return `basic:${auth.ownership}`;
19
+ case "headers":
20
+ return `headers:${auth.ownership}:${[...auth.names].sort().join(",")}`;
21
+ case "oauth_code": {
22
+ const { authorizationParams: _ignored, ...rest } = auth;
23
+ return canonicalJson(rest);
24
+ }
25
+ default:
26
+ return canonicalJson(auth);
27
+ }
28
+ }
@@ -203,7 +203,7 @@ export declare function headsToResolve(entries: readonly MarketplaceEntry[], imp
203
203
  /** The host versions (an entry's `minKernel` is judged against them). */
204
204
  export declare const HOST_VERSIONS: {
205
205
  readonly kernel: string;
206
- readonly sdk: "0.1.0-rc.51";
206
+ readonly sdk: "0.1.0-rc.54";
207
207
  };
208
208
  /** Whether this deployment satisfies the entry's `minKernel`. */
209
209
  export declare const entryCompatible: (e: Pick<MarketplaceEntry, "minKernel">) => boolean;
@@ -40,6 +40,7 @@ import { ConnectorsService } from "../tools/connectors.service.js";
40
40
  import { dirDigest, getPath, readCatalogAgentTemplates, readCatalogTemplates, readCatalogThemes, setPath, skillFilesDigest, templatePluginProblem, themeAssetsDigest, } from "./catalog-content.js";
41
41
  import { markVersionApplied, versionUsable } from "./catalog-items.js";
42
42
  import { agentsUsing, clashingOrgSkills, clashingPlatformSkills, componentOn, connectorsMadeFrom, connectorTemplatesOn, listedIn, loadComponents, loadScopeState, pluginFactsOf, switchOf, themeIdClashes, } from "./component-state.js";
43
+ import { credentialKey } from "./credential-key.js";
43
44
  import { LIVE_INSTALL_STATUSES } from "./install-status.js";
44
45
  import { CatalogItemLock } from "./locks.js";
45
46
  import { itemPendingError, itemRemovedError } from "./ownership.js";
@@ -64,25 +65,6 @@ const KIND_ORDER = {
64
65
  };
65
66
  /** How long one update holds its item (renewed while it runs). */
66
67
  const UPDATE_LOCK_TTL_MS = 60_000;
67
- /**
68
- * What a credential of `auth` looks like: two auths with the same key take the same stored
69
- * credential (static: the type family, ownership and header names; OAuth: any change re-enters).
70
- */
71
- function credentialKey(auth) {
72
- switch (auth.type) {
73
- case "none":
74
- return "none";
75
- case "bearer":
76
- case "api_key":
77
- return `token:${auth.ownership}`;
78
- case "basic":
79
- return `basic:${auth.ownership}`;
80
- case "headers":
81
- return `headers:${auth.ownership}:${[...auth.names].sort().join(",")}`;
82
- default:
83
- return canonicalJson(auth);
84
- }
85
- }
86
68
  /** The digest of all files of a catalog version. */
87
69
  const filesDigest = (row) => skillFilesDigest(row.files.map((f) => ({ path: f.path, sha256: f.sha256 })));
88
70
  /**
@@ -21,11 +21,11 @@ import { TransactionHost } from "../infra/database/transaction-host.js";
21
21
  import { Transactional } from "../infra/database/transactional.decorator.js";
22
22
  import { LockService } from "../infra/lock/lock.service.js";
23
23
  import { WithLock } from "../infra/lock/with-lock.decorator.js";
24
- import { orgAllows } from "../local-devices/network-grants.js";
25
24
  import { OrgLock } from "../orgs/org-lock.js";
26
25
  import { roleAtLeast } from "../orgs/roles.js";
27
26
  import { ORG_SANDBOX_ALLOW_HOSTS_MAX, OrgSettingsService, readOrgSettings, } from "../orgs/settings.service.js";
28
27
  import { orgEffectiveHosts, orgHostOutsideCeiling } from "../sandbox/modes.js";
28
+ import { orgAllows } from "../sandbox/network-grants.js";
29
29
  import { CatalogService } from "./catalog.service.js";
30
30
  import { CatalogScopeService } from "./catalog-scope.service.js";
31
31
  import { assertEntryNotDeprecated, loadMarketplaceEntry } from "./marketplaces.service.js";
@@ -295,7 +295,7 @@ export declare const KernelConfigSchema: z.ZodObject<{
295
295
  }>>;
296
296
  }, z.core.$strict>>;
297
297
  maxPersonal: z.ZodDefault<z.ZodNumber>;
298
- local: z.ZodPrefault<z.ZodObject<{
298
+ dialIn: z.ZodPrefault<z.ZodObject<{
299
299
  reconnectGraceSeconds: z.ZodDefault<z.ZodNumber>;
300
300
  leaseTtlMs: z.ZodDefault<z.ZodNumber>;
301
301
  authCodeTtlSeconds: z.ZodDefault<z.ZodNumber>;
@@ -1616,7 +1616,7 @@ export const KernelConfigSchema = z.strictObject({
1616
1616
  })
1617
1617
  .default("allowlist")
1618
1618
  .meta(meta({
1619
- description: "Outbound network kill switch of sandboxed devices: allowlist (the normal setting) or none. none cuts every network the kernel controls: a cloud device reaches no host (an empty allowlist) and a local device in sandbox mode has an empty allowlist; a local device in auto mode uses the machine's own network, which the kernel cannot cut",
1619
+ description: "Outbound network kill switch of sandboxed devices: allowlist (the normal setting) or none. none cuts every network the kernel controls: every device's sandbox reaches no host (an empty allowlist); a command a provider runs outside its sandbox (a per-call escalation) is outside what the kernel cuts",
1620
1620
  })),
1621
1621
  allowHosts: z
1622
1622
  .array(z.string())
@@ -1629,7 +1629,7 @@ export const KernelConfigSchema = z.strictObject({
1629
1629
  });
1630
1630
  })
1631
1631
  .meta(meta({
1632
- description: "Host list of the allowlist: in sandbox mode, the hosts a cloud device instance may reach on allowlist and a local device's allowlist; organizations follow it, adding or dropping hosts of their own (see orgHosts); lowercase hostnames, optional leading '*.', no IPs, ports or internal-only names; applies to instances created after the change",
1632
+ description: "Host list of the allowlist: in sandbox mode, the hosts a device's sandbox may reach on allowlist; organizations follow it, adding or dropping hosts of their own (see orgHosts); lowercase hostnames, optional leading '*.', no IPs, ports or internal-only names; applies to instances created after the change",
1633
1633
  })),
1634
1634
  orgHosts: z
1635
1635
  .enum(["extend", "within"])
@@ -1705,9 +1705,9 @@ export const KernelConfigSchema = z.strictObject({
1705
1705
  .default(10)
1706
1706
  .meta(meta({
1707
1707
  hot: true,
1708
- 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",
1708
+ description: "Most personal devices a member may have in one org, the default one and dial-in devices included; creating one more fails with device.limit_reached",
1709
1709
  })),
1710
- local: z
1710
+ dialIn: z
1711
1711
  .strictObject({
1712
1712
  reconnectGraceSeconds: z
1713
1713
  .number()
@@ -1716,7 +1716,7 @@ export const KernelConfigSchema = z.strictObject({
1716
1716
  .default(120)
1717
1717
  .meta(meta({
1718
1718
  hot: true,
1719
- description: "Seconds a local device's machine may stay disconnected before the device is reported offline; also sent to capybara-device at sign-in",
1719
+ description: "Seconds a dial-in device's machine may stay disconnected before the device is reported offline; also sent to the machine's program at sign-in",
1720
1720
  })),
1721
1721
  leaseTtlMs: z
1722
1722
  .number()
@@ -1724,7 +1724,7 @@ export const KernelConfigSchema = z.strictObject({
1724
1724
  .min(6000)
1725
1725
  .default(30000)
1726
1726
  .meta(meta({
1727
- description: "Milliseconds the replica holding a local device's connection keeps its lease without renewing it; at least 6000",
1727
+ description: "Milliseconds the replica holding a dial-in device's connection keeps its lease without renewing it; at least 6000",
1728
1728
  })),
1729
1729
  authCodeTtlSeconds: z
1730
1730
  .number()
@@ -1732,7 +1732,7 @@ export const KernelConfigSchema = z.strictObject({
1732
1732
  .positive()
1733
1733
  .default(600)
1734
1734
  .meta(meta({
1735
- description: "Seconds a device sign-in code stays valid before capybara-device must start over (device_sign_in.expired)",
1735
+ description: "Seconds a device sign-in code stays valid before the machine's program must start over (device_sign_in.expired)",
1736
1736
  })),
1737
1737
  pollIntervalSeconds: z
1738
1738
  .number()
@@ -1740,7 +1740,7 @@ export const KernelConfigSchema = z.strictObject({
1740
1740
  .positive()
1741
1741
  .default(5)
1742
1742
  .meta(meta({
1743
- description: "Seconds capybara-device waits between token polls during sign-in; polling faster gets device_sign_in.slow_down",
1743
+ description: "Seconds the machine's program waits between token polls during sign-in; polling faster gets device_sign_in.slow_down",
1744
1744
  })),
1745
1745
  maxFrameBytes: z
1746
1746
  .number()
@@ -1748,7 +1748,7 @@ export const KernelConfigSchema = z.strictObject({
1748
1748
  .positive()
1749
1749
  .default(16 * 1024 * 1024)
1750
1750
  .meta(meta({
1751
- description: "Largest WebSocket frame in bytes accepted from or sent to a local device's machine",
1751
+ description: "Largest WebSocket frame in bytes accepted from or sent to a dial-in device's machine",
1752
1752
  })),
1753
1753
  })
1754
1754
  .prefault({}),
@@ -8,7 +8,7 @@ import { ConversationToolInfo, type ToolInfo } from "../tools/info.js";
8
8
  import type { AgentTreeNode } from "./agent-tree.js";
9
9
  import { type ArtifactPreview, ConversationArtifacts } from "./artifacts.js";
10
10
  import { CompactBody, EventsQuery, FilesQuery, IdParams, ListQuery, PatchBody, SubagentsQuery } from "./conversations.schemas.js";
11
- import { type ConversationGroup, ConversationsService, type ConversationView, type SubagentView, type UsageTotals } from "./conversations.service.js";
11
+ import { type ConversationGroup, type ConversationListRow, ConversationsService, type ConversationView, type SubagentView, type UsageTotals } from "./conversations.service.js";
12
12
  import { ConversationDeviceStatus } from "./device-status.js";
13
13
  import type { ConversationEvent } from "./events.js";
14
14
  import { ConversationFiles, type FileOutput } from "./files.js";
@@ -160,10 +160,15 @@ export declare class ConversationsController {
160
160
  }>;
161
161
  /** Soft delete (owner only): stops an active run and hides the conversation everywhere. */
162
162
  remove(principal: Principal, org: OrgContext, { id }: z.infer<typeof IdParams>): Promise<void>;
163
- /** 我的会话,最近更新的在前:`next` 为下一页游标(作为 `after` 传回),没有更多时为 null。 */
163
+ /**
164
+ * My conversations, most recently updated first, each with its agent: `next` is the next page's
165
+ * cursor (passed back as `after`), null when there are no more; `total` counts every match of
166
+ * the filters and comes on the first page (no `after`) only.
167
+ */
164
168
  list(principal: Principal, org: OrgContext, q: z.infer<typeof ListQuery>): Promise<{
165
- conversations: ConversationView[];
169
+ conversations: ConversationListRow[];
166
170
  next: string | null;
171
+ total?: number;
167
172
  }>;
168
173
  /**
169
174
  * My conversations grouped by agent, for the sidebar: groups by latest activity, `perGroup`
@@ -246,11 +246,16 @@ let ConversationsController = class ConversationsController {
246
246
  const p = requireUser(principal);
247
247
  await this.conversations.remove(org.orgId, id, p.account.id);
248
248
  }
249
- /** 我的会话,最近更新的在前:`next` 为下一页游标(作为 `after` 传回),没有更多时为 null。 */
249
+ /**
250
+ * My conversations, most recently updated first, each with its agent: `next` is the next page's
251
+ * cursor (passed back as `after`), null when there are no more; `total` counts every match of
252
+ * the filters and comes on the first page (no `after`) only.
253
+ */
250
254
  async list(principal, org, q) {
251
255
  const p = requireUser(principal);
252
- const rows = await this.conversations.listMine(org.orgId, p.account.id, {
256
+ const { conversations: rows, total } = await this.conversations.listMine(org.orgId, p.account.id, {
253
257
  limit: q.limit + 1,
258
+ total: q.after === undefined,
254
259
  ...(q.after !== undefined && { after: q.after }),
255
260
  ...(q.agentId !== undefined && { agentId: q.agentId }),
256
261
  ...(q.q !== undefined && { q: q.q }),
@@ -259,7 +264,7 @@ let ConversationsController = class ConversationsController {
259
264
  });
260
265
  const conversations = rows.slice(0, q.limit);
261
266
  const next = rows.length > q.limit ? (conversations.at(-1)?.id ?? null) : null;
262
- return { conversations, next };
267
+ return { conversations, next, ...(total !== undefined && { total }) };
263
268
  }
264
269
  /**
265
270
  * My conversations grouped by agent, for the sidebar: groups by latest activity, `perGroup`
@@ -87,20 +87,26 @@ export type ProjectState = {
87
87
  };
88
88
  /** Escapes `\`, `%` and `_` so user text is matched literally by `LIKE … ESCAPE '\'`. */
89
89
  export declare function escapeLike(s: string): string;
90
+ /**
91
+ * An agent as the conversation lists carry it: its name and the avatar half of its profile, in the
92
+ * agents API's shape (the web draws it without reading the agents list).
93
+ */
94
+ export interface ConversationAgent {
95
+ id: string;
96
+ name: string;
97
+ profile: {
98
+ avatar: AgentAvatarView;
99
+ updatedAt: string;
100
+ };
101
+ }
102
+ /** One row of {@link ConversationsService.listMine}: the conversation and its agent. */
103
+ export interface ConversationListRow extends ConversationView {
104
+ /** Null only when the agent stopped being visible between the page read and the agent read. */
105
+ agent: ConversationAgent | null;
106
+ }
90
107
  /** One agent's group in the sidebar list: the caller's newest conversations with that agent. */
91
108
  export interface ConversationGroup {
92
- /**
93
- * The agent's name and the avatar half of its profile, in the agents API's shape (the sidebar
94
- * draws the group title from it without reading the agents list).
95
- */
96
- agent: {
97
- id: string;
98
- name: string;
99
- profile: {
100
- avatar: AgentAvatarView;
101
- updatedAt: string;
102
- };
103
- };
109
+ agent: ConversationAgent;
104
110
  /** max(updated_at) of the group's conversations. */
105
111
  latestAt: Date;
106
112
  /** At most `perGroup`, updated_at DESC, id DESC. */
@@ -424,8 +430,11 @@ export declare class ConversationsService {
424
430
  /** The stream's visibility check ({@link ConversationAccess.isAccessible}). */
425
431
  isAccessible(orgId: string, conversationId: string, viewerAccountId: string): Promise<boolean>;
426
432
  /**
427
- * 我的会话,最近更新的在前;只含 agent 仍可用的会话。`after` 为上一页最后一个会话的 id,
428
- * 从它当前的 (updated_at, id) 之后继续;游标会话已不存在时返回空页。
433
+ * My conversations, most recently updated first; only those whose agent is in this org, not
434
+ * deleted and visible to me. `after` is the previous page's last conversation id, continued after
435
+ * its current (updated_at, id); a cursor that no longer exists gives an empty page. Each row
436
+ * carries its agent (one batch read for the page). With `total`, also counts every conversation
437
+ * matching the same filters (the cursor aside) in the same statement.
429
438
  */
430
439
  listMine(orgId: string, accountId: string, opts: {
431
440
  after?: string;
@@ -434,7 +443,16 @@ export declare class ConversationsService {
434
443
  archived?: boolean;
435
444
  q?: string;
436
445
  state?: "running" | "waiting";
437
- }): Promise<ConversationView[]>;
446
+ total?: boolean;
447
+ }): Promise<{
448
+ conversations: ConversationListRow[];
449
+ total?: number;
450
+ }>;
451
+ /**
452
+ * The agents of `ids` that are in this org, not deleted and visible to the viewer, by id, in one
453
+ * statement (the same visibility as the agents read path).
454
+ */
455
+ private listAgents;
438
456
  /**
439
457
  * My chat conversations grouped by agent (the sidebar, UI refresh spec §5.9), in one statement.
440
458
  * Only agents that are not deleted and still visible to me (as {@link listMine}). Groups are