@capybara-hq/kernel 0.1.0-rc.120 → 0.1.0-rc.122

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 (230) hide show
  1. package/dist/background/finish.d.ts +5 -1
  2. package/dist/background/finish.js +29 -18
  3. package/dist/background/launch.d.ts +0 -5
  4. package/dist/background/launch.js +1 -6
  5. package/dist/background/managed.js +1 -4
  6. package/dist/background/poll.job.d.ts +3 -25
  7. package/dist/background/poll.job.js +20 -112
  8. package/dist/background/render.d.ts +2 -8
  9. package/dist/background/render.js +3 -17
  10. package/dist/background/stop.d.ts +15 -16
  11. package/dist/background/stop.js +39 -76
  12. package/dist/background/store.d.ts +17 -45
  13. package/dist/background/store.js +60 -94
  14. package/dist/background/tasks.service.d.ts +2 -5
  15. package/dist/background/tasks.service.js +9 -20
  16. package/dist/background/wake.js +3 -2
  17. package/dist/catalog/admin-catalog.controller.d.ts +2 -18
  18. package/dist/catalog/admin-catalog.controller.js +2 -28
  19. package/dist/catalog/catalog-content.d.ts +1 -5
  20. package/dist/catalog/catalog-items.d.ts +2 -6
  21. package/dist/catalog/catalog-items.js +5 -26
  22. package/dist/catalog/catalog-scope.service.d.ts +1 -121
  23. package/dist/catalog/catalog-scope.service.js +12 -552
  24. package/dist/catalog/catalog.service.d.ts +4 -15
  25. package/dist/catalog/catalog.service.js +7 -35
  26. package/dist/catalog/job-ids.d.ts +0 -18
  27. package/dist/catalog/job-ids.js +0 -20
  28. package/dist/catalog/marketplaces.service.d.ts +1 -1
  29. package/dist/catalog/org-catalog.service.js +6 -20
  30. package/dist/catalog/org-plugin-uploads.controller.d.ts +4 -19
  31. package/dist/catalog/org-plugin-uploads.controller.js +6 -34
  32. package/dist/catalog/org-plugin-uploads.d.ts +3 -10
  33. package/dist/catalog/org-plugin-uploads.js +4 -18
  34. package/dist/catalog/org-plugin-uploads.schemas.js +0 -1
  35. package/dist/catalog/owned-items.d.ts +6 -11
  36. package/dist/catalog/owned-items.js +10 -20
  37. package/dist/catalog/ownership.d.ts +3 -29
  38. package/dist/catalog/ownership.js +4 -54
  39. package/dist/catalog/platform-components.d.ts +5 -11
  40. package/dist/catalog/platform-components.js +8 -15
  41. package/dist/catalog/plugin-import.d.ts +3 -42
  42. package/dist/catalog/plugin-import.js +26 -195
  43. package/dist/catalog/plugin-install.js +1 -6
  44. package/dist/catalog/plugin-package.d.ts +1 -0
  45. package/dist/catalog/plugin-package.js +5 -0
  46. package/dist/catalog/plugin-upgrade.d.ts +3 -26
  47. package/dist/catalog/plugin-upgrade.js +20 -103
  48. package/dist/catalog/request-rules.js +4 -6
  49. package/dist/catalog/scope-sync.js +2 -4
  50. package/dist/catalog/scope.d.ts +2 -5
  51. package/dist/channels/jobs.d.ts +3 -3
  52. package/dist/channels/jobs.js +4 -3
  53. package/dist/channels/outbound.d.ts +1 -0
  54. package/dist/channels/outbound.js +32 -8
  55. package/dist/config/load.d.ts +0 -25
  56. package/dist/config/load.js +0 -57
  57. package/dist/config/schema.js +2 -3
  58. package/dist/conversations/attachments.service.js +3 -5
  59. package/dist/conversations/conversations.service.d.ts +3 -3
  60. package/dist/conversations/conversations.service.js +3 -3
  61. package/dist/conversations/job-org.d.ts +3 -0
  62. package/dist/conversations/job-org.js +11 -0
  63. package/dist/conversations/prompt-suggestions.d.ts +2 -7
  64. package/dist/conversations/prompt-suggestions.js +29 -27
  65. package/dist/conversations/titles.d.ts +3 -4
  66. package/dist/conversations/titles.js +19 -30
  67. package/dist/db/kernel-schema.d.ts +6 -16
  68. package/dist/db/pool.js +7 -2
  69. package/dist/devices/devices.controller.d.ts +0 -5
  70. package/dist/devices/devices.controller.js +2 -20
  71. package/dist/devices/devices.service.d.ts +1 -17
  72. package/dist/devices/devices.service.js +0 -22
  73. package/dist/errors.d.ts +1 -5
  74. package/dist/errors.js +1 -5
  75. package/dist/evals/judge.d.ts +3 -0
  76. package/dist/evals/judge.js +1 -1
  77. package/dist/evals/run-replay.d.ts +1 -1
  78. package/dist/evals/run-replay.js +26 -29
  79. package/dist/evals/step-replay.d.ts +3 -1
  80. package/dist/evals/step-replay.js +10 -1
  81. package/dist/evals/worker.d.ts +3 -1
  82. package/dist/evals/worker.js +53 -21
  83. package/dist/extensions/deployment-config-store.js +18 -14
  84. package/dist/extensions/effective-config.d.ts +1 -5
  85. package/dist/extensions/effective-config.js +1 -5
  86. package/dist/extensions/hooks.d.ts +3 -1
  87. package/dist/extensions/hooks.js +7 -2
  88. package/dist/extensions/installs.d.ts +2 -14
  89. package/dist/extensions/installs.js +10 -32
  90. package/dist/extensions/org-config.d.ts +3 -4
  91. package/dist/extensions/org-config.js +3 -4
  92. package/dist/extensions/plugin-guides.d.ts +0 -1
  93. package/dist/extensions/plugin-guides.js +0 -1
  94. package/dist/extensions/plugin-icons.d.ts +0 -1
  95. package/dist/extensions/plugin-icons.js +0 -3
  96. package/dist/files/blob-sweep.job.d.ts +2 -11
  97. package/dist/files/blob-sweep.job.js +7 -21
  98. package/dist/files/hash-job.d.ts +5 -15
  99. package/dist/files/hash-job.js +14 -33
  100. package/dist/files/library-jobs.module.d.ts +1 -6
  101. package/dist/files/library-jobs.module.js +3 -9
  102. package/dist/identity/api-tokens.js +54 -40
  103. package/dist/identity/auth.guard.js +2 -2
  104. package/dist/identity/sessions.js +7 -3
  105. package/dist/identity/settings.js +5 -21
  106. package/dist/inbox/inbox.service.d.ts +2 -3
  107. package/dist/inbox/org-notices.d.ts +0 -14
  108. package/dist/inbox/platform-inbox.service.d.ts +1 -8
  109. package/dist/inbox/platform-inbox.service.js +2 -6
  110. package/dist/inbox/platform-notices.d.ts +3 -3
  111. package/dist/index.d.ts +0 -4
  112. package/dist/index.js +0 -3
  113. package/dist/infra/database/database.module.js +2 -1
  114. package/dist/infra/database/org-scope.d.ts +5 -3
  115. package/dist/infra/database/org-scope.js +7 -1
  116. package/dist/infra/database/scoped-dialect.d.ts +3 -1
  117. package/dist/infra/database/scoped-dialect.js +17 -5
  118. package/dist/infra/events/kernel-events.d.ts +2 -0
  119. package/dist/infra/outbox/outbox.service.d.ts +2 -0
  120. package/dist/infra/outbox/outbox.service.js +10 -0
  121. package/dist/infra/outbox/registry.d.ts +0 -41
  122. package/dist/infra/outbox/registry.js +0 -37
  123. package/dist/models/embeddings.d.ts +0 -5
  124. package/dist/models/embeddings.js +28 -35
  125. package/dist/models/images.d.ts +3 -8
  126. package/dist/models/images.js +19 -37
  127. package/dist/models/purposes.d.ts +7 -2
  128. package/dist/models/purposes.js +16 -3
  129. package/dist/orgs/device-network-setting.d.ts +0 -44
  130. package/dist/orgs/device-network-setting.js +0 -83
  131. package/dist/orgs/invitations.service.js +34 -30
  132. package/dist/orgs/offboarding.d.ts +2 -2
  133. package/dist/orgs/offboarding.js +2 -2
  134. package/dist/orgs/orgs.service.d.ts +1 -1
  135. package/dist/orgs/orgs.service.js +19 -15
  136. package/dist/orgs/settings.service.d.ts +19 -14
  137. package/dist/orgs/settings.service.js +12 -37
  138. package/dist/platform/exclusions.js +0 -11
  139. package/dist/platform/ops/catalog-admin.ops.js +0 -8
  140. package/dist/platform/ops/devices.ops.js +0 -28
  141. package/dist/platform/ops/extensions-admin.ops.js +3 -3
  142. package/dist/platform/ops/inbox.ops.js +5 -22
  143. package/dist/platform/ops/org-plugins.ops.d.ts +1 -3
  144. package/dist/platform/ops/org-plugins.ops.js +11 -67
  145. package/dist/plugin-reads/plugin-reads.service.js +2 -1
  146. package/dist/roles/worker.module.js +0 -9
  147. package/dist/runtime/hook-calls.d.ts +13 -6
  148. package/dist/runtime/hook-calls.js +26 -4
  149. package/dist/runtime/maintenance.d.ts +3 -12
  150. package/dist/runtime/maintenance.js +25 -55
  151. package/dist/runtime/model-call.d.ts +4 -2
  152. package/dist/runtime/model-call.js +59 -58
  153. package/dist/runtime/providers.d.ts +27 -1
  154. package/dist/runtime/providers.js +57 -0
  155. package/dist/runtime/run-jobs.d.ts +1 -1
  156. package/dist/runtime/run-processors.d.ts +3 -9
  157. package/dist/runtime/run-worker.d.ts +2 -0
  158. package/dist/runtime/run-worker.js +23 -8
  159. package/dist/runtime/subagents/deliveries.js +6 -1
  160. package/dist/runtime/subagents/dispatch.d.ts +3 -3
  161. package/dist/runtime/write-base.service.d.ts +2 -3
  162. package/dist/runtime/write-base.service.js +3 -5
  163. package/dist/sandbox/device-sandbox-settings.d.ts +38 -92
  164. package/dist/sandbox/device-sandbox-settings.js +19 -325
  165. package/dist/sandbox/jobs.d.ts +3 -14
  166. package/dist/sandbox/jobs.js +2 -20
  167. package/dist/sandbox/modes.d.ts +5 -45
  168. package/dist/sandbox/modes.js +3 -60
  169. package/dist/sandbox/operation-authority.js +0 -11
  170. package/dist/sandbox/operation-intents.d.ts +32 -9
  171. package/dist/sandbox/operation-intents.js +241 -32
  172. package/dist/sandbox/operation-intents.module.js +2 -1
  173. package/dist/sandbox/operation-reconcile.job.d.ts +9 -11
  174. package/dist/sandbox/operation-reconcile.job.js +119 -33
  175. package/dist/sandbox/operation-revoke.d.ts +20 -0
  176. package/dist/sandbox/operation-revoke.js +3 -0
  177. package/dist/sandbox/permission-ceiling-writes.d.ts +1 -2
  178. package/dist/sandbox/permission-ceiling-writes.js +3 -6
  179. package/dist/sandbox/permission-config-publication.d.ts +1 -28
  180. package/dist/sandbox/permission-config-publication.js +14 -211
  181. package/dist/sandbox/permission-facts.d.ts +4 -15
  182. package/dist/sandbox/permission-facts.js +7 -29
  183. package/dist/sandbox/permission-instance-writes.d.ts +1 -4
  184. package/dist/sandbox/permission-instance-writes.js +1 -55
  185. package/dist/sandbox/providers.d.ts +1 -6
  186. package/dist/sandbox/providers.js +1 -15
  187. package/dist/sandbox/review/classifier.js +12 -13
  188. package/dist/sandbox/sandbox.module.js +3 -6
  189. package/dist/sandbox/sandbox.service.d.ts +17 -123
  190. package/dist/sandbox/sandbox.service.js +239 -998
  191. package/dist/shares/liveness.d.ts +1 -2
  192. package/dist/shares/liveness.js +1 -2
  193. package/dist/shares/shares.module.d.ts +1 -2
  194. package/dist/shares/shares.module.js +2 -5
  195. package/dist/shares/shares.service.js +1 -2
  196. package/dist/tools/builtins/image/generate.js +7 -15
  197. package/dist/tools/builtins/sandbox/common.d.ts +0 -2
  198. package/dist/tools/builtins/sandbox/common.js +1 -27
  199. package/dist/tools/builtins/sandbox/task-list.js +10 -10
  200. package/dist/tools/builtins/sandbox/task-output.d.ts +3 -10
  201. package/dist/tools/builtins/sandbox/task-output.js +13 -83
  202. package/dist/tools/builtins/sandbox/task-stop.js +18 -22
  203. package/dist/tools/builtins/vision/read-image.js +9 -10
  204. package/dist/tools/builtins/web/extract.js +9 -10
  205. package/package.json +3 -3
  206. package/src/migrations/0206_retire_org_extension_uploads.sql +125 -0
  207. package/src/migrations/0207_confirm_device_instance_destruction.sql +25 -0
  208. package/src/migrations/0208_convert_stored_permission_settings.sql +189 -0
  209. package/dist/background/retire-legacy-tasks.job.d.ts +0 -57
  210. package/dist/background/retire-legacy-tasks.job.js +0 -149
  211. package/dist/catalog/owned-plugin-cleanup.d.ts +0 -47
  212. package/dist/catalog/owned-plugin-cleanup.js +0 -140
  213. package/dist/config/permission-migration.d.ts +0 -34
  214. package/dist/config/permission-migration.js +0 -115
  215. package/dist/devices/legacy-cleanup.job.d.ts +0 -34
  216. package/dist/devices/legacy-cleanup.job.js +0 -147
  217. package/dist/files/library-backfill.d.ts +0 -63
  218. package/dist/files/library-backfill.js +0 -143
  219. package/dist/infra/cli/permission-cutover.d.ts +0 -59
  220. package/dist/infra/cli/permission-cutover.js +0 -107
  221. package/dist/sandbox/cloud-permission-snapshot.d.ts +0 -159
  222. package/dist/sandbox/cloud-permission-snapshot.js +0 -430
  223. package/dist/sandbox/cloud-permission-snapshot.module.d.ts +0 -8
  224. package/dist/sandbox/cloud-permission-snapshot.module.js +0 -34
  225. package/dist/sandbox/legacy-retirement.d.ts +0 -284
  226. package/dist/sandbox/legacy-retirement.js +0 -1165
  227. package/dist/sandbox/legacy-retirement.module.d.ts +0 -8
  228. package/dist/sandbox/legacy-retirement.module.js +0 -25
  229. package/dist/shares/share-objects.d.ts +0 -47
  230. package/dist/shares/share-objects.js +0 -93
@@ -15,6 +15,7 @@ import { AccountsService } from "../identity/accounts.js";
15
15
  import { audit } from "../identity/audit.js";
16
16
  import { sha256Hex } from "../identity/hash.js";
17
17
  import { KernelDb } from "../infra/database/kernel-db.js";
18
+ import { asPlatform, withOrgScope } from "../infra/database/org-scope.js";
18
19
  import { TransactionHost } from "../infra/database/transaction-host.js";
19
20
  import { Transactional } from "../infra/database/transactional.decorator.js";
20
21
  import { MembersService } from "./members.service.js";
@@ -179,42 +180,45 @@ let InvitationsService = class InvitationsService {
179
180
  }
180
181
  async acceptIn(token, who, existing, passwordHash, inTx) {
181
182
  const inv = await this.classify(token);
182
- // 先建账号再锁组织行,缩短持锁时间;失败时随事务回滚,不残留账号
183
- const account = existing ?? (await this.accounts.createLocal(signupOf(who), passwordHash));
184
- if (!(await this.orgLock.tryLock(inv.org_id)))
185
- throw invalid();
186
- const taken = await this.db
187
- .updateTable("invitations")
188
- .set({ accepted_at: sql `now()`, accepted_by: account.id })
189
- .where("id", "=", inv.id)
190
- .where("org_id", "=", inv.org_id)
191
- .where("accepted_at", "is", null)
192
- .where("revoked_at", "is", null)
193
- .where(sql `expires_at > now()`)
194
- .returning("id")
195
- .executeTakeFirst();
196
- if (!taken) {
197
- await this.classify(token);
198
- throw new ApiError("invitation.used", "Invitation was already used");
199
- }
200
- await this.members.add(inv.org_id, account.id, inv.role, account.id);
201
- await audit(this.db.db, {
202
- actorAccountId: account.id,
203
- orgId: inv.org_id,
204
- action: "org.invitation.accepted",
205
- target: inv.id,
206
- detail: { role: inv.role, signup: "signup" in who },
183
+ return withOrgScope(inv.org_id, async () => {
184
+ // Create the account before locking the org. A later failure rolls back its creation.
185
+ const account = existing ?? (await this.accounts.createLocal(signupOf(who), passwordHash));
186
+ if (!(await this.orgLock.tryLock(inv.org_id)))
187
+ throw invalid();
188
+ const taken = await this.db
189
+ .updateTable("invitations")
190
+ .set({ accepted_at: sql `now()`, accepted_by: account.id })
191
+ .where("id", "=", inv.id)
192
+ .where("org_id", "=", inv.org_id)
193
+ .where("accepted_at", "is", null)
194
+ .where("revoked_at", "is", null)
195
+ .where(sql `expires_at > now()`)
196
+ .returning("id")
197
+ .executeTakeFirst();
198
+ if (!taken) {
199
+ await this.classify(token);
200
+ throw new ApiError("invitation.used", "Invitation was already used");
201
+ }
202
+ await this.members.add(inv.org_id, account.id, inv.role, account.id);
203
+ await audit(this.db.db, {
204
+ actorAccountId: account.id,
205
+ orgId: inv.org_id,
206
+ action: "org.invitation.accepted",
207
+ target: inv.id,
208
+ detail: { role: inv.role, signup: "signup" in who },
209
+ });
210
+ // Invitation signup creates the session in the same transaction as the account.
211
+ const extra = inTx ? await inTx(account) : undefined;
212
+ return { account, orgId: inv.org_id, role: inv.role, extra };
207
213
  });
208
- // 凭邀请注册时在同一事务里建会话:失败整体回滚,不残留没有会话的新账号
209
- const extra = inTx ? await inTx(account) : undefined;
210
- return { account, orgId: inv.org_id, role: inv.role, extra };
211
214
  }
212
215
  /**
213
216
  * 按令牌 hash 读邀请并分类:不存在、已撤销或组织已软删除 → `invitation.invalid`;
214
217
  * 已接受 → `invitation.used`;已过期 → `invitation.expired`。过期按数据库时间判定。
215
218
  */
216
219
  async classify(token) {
217
- const r = await this.db
220
+ // org-filter: deployment-wide lookup by the invitation token hash before resolving its org.
221
+ const r = await asPlatform("Find the invitation's org from its token", () => this.db
218
222
  .selectFrom("invitations")
219
223
  .innerJoin("orgs", "orgs.id", "invitations.org_id")
220
224
  .select([
@@ -229,7 +233,7 @@ let InvitationsService = class InvitationsService {
229
233
  ])
230
234
  .select(sql `invitations.expires_at <= now()`.as("expired"))
231
235
  .where("invitations.token_hash", "=", sha256Hex(token))
232
- .executeTakeFirst();
236
+ .executeTakeFirst());
233
237
  if (!r || r.revoked_at || r.org_deleted_at)
234
238
  throw invalid();
235
239
  if (r.accepted_at)
@@ -115,8 +115,8 @@ export declare class Offboarding {
115
115
  * destruction of each (instance and files, `device-destroy-<deviceId>`);
116
116
  * 10. Owes the `org.member_removed` lifecycle hook deliveries (outbox jobs, one per subscribing
117
117
  * plugin);
118
- * 11. Revokes the person's file shares in the org (`member_offboarded`) and owes the deletion of
119
- * each snapshot (`share-object-delete-<shareId>-<generation>`, file sharing spec §9).
118
+ * 11. Revokes the person's file shares in the org (`member_offboarded`). The share and blob
119
+ * sweeps reclaim unreferenced snapshot bytes (file sharing spec §9).
120
120
  */
121
121
  offboard(orgId: string, accountId: string, reason: OffboardReason, actor?: {
122
122
  actorAccountId?: string;
@@ -116,8 +116,8 @@ let Offboarding = class Offboarding {
116
116
  * destruction of each (instance and files, `device-destroy-<deviceId>`);
117
117
  * 10. Owes the `org.member_removed` lifecycle hook deliveries (outbox jobs, one per subscribing
118
118
  * plugin);
119
- * 11. Revokes the person's file shares in the org (`member_offboarded`) and owes the deletion of
120
- * each snapshot (`share-object-delete-<shareId>-<generation>`, file sharing spec §9).
119
+ * 11. Revokes the person's file shares in the org (`member_offboarded`). The share and blob
120
+ * sweeps reclaim unreferenced snapshot bytes (file sharing spec §9).
121
121
  */
122
122
  async offboard(orgId, accountId, reason, actor = {}) {
123
123
  // the org admission lock exclusively (the callers take it first, before the org row; a no-op
@@ -64,7 +64,7 @@ export declare class OrgsService {
64
64
  actorTokenId?: string | undefined;
65
65
  }): Promise<Org>;
66
66
  private createIn;
67
- /** 账号所属的(未软删除的)组织及其角色,按创建时间升序。 */
67
+ /** The account's live organizations and roles in creation order. */
68
68
  listForAccount(accountId: string): Promise<(Org & {
69
69
  role: OrgRole;
70
70
  })[]>;
@@ -21,6 +21,7 @@ import { audit } from "../identity/audit.js";
21
21
  import { SettingsService } from "../identity/settings.js";
22
22
  import { afterCommit } from "../infra/database/after-commit.js";
23
23
  import { KernelDb } from "../infra/database/kernel-db.js";
24
+ import { asPlatform, withOrgScope } from "../infra/database/org-scope.js";
24
25
  import { TransactionHost } from "../infra/database/transaction-host.js";
25
26
  import { Transactional } from "../infra/database/transactional.decorator.js";
26
27
  import { KernelEvents } from "../infra/events/kernel-events.js";
@@ -139,24 +140,27 @@ let OrgsService = class OrgsService {
139
140
  .values({ id: randomUUID(), slug, name, created_by: actor.id })
140
141
  .returning(["id", "slug", "name", "created_at"])
141
142
  .executeTakeFirstOrThrow();
142
- await this.db
143
- .insertInto("memberships")
144
- .values({ org_id: row.id, account_id: actor.id, role: "owner" })
145
- .execute();
146
- await audit(this.db.db, {
147
- actorAccountId: actor.id,
148
- ...(actorTokenId !== undefined && { actorTokenId }),
149
- orgId: row.id,
150
- action: "org.created",
151
- target: row.id,
152
- detail: { slug, name },
143
+ await withOrgScope(row.id, async () => {
144
+ await this.db
145
+ .insertInto("memberships")
146
+ .values({ org_id: row.id, account_id: actor.id, role: "owner" })
147
+ .execute();
148
+ await audit(this.db.db, {
149
+ actorAccountId: actor.id,
150
+ ...(actorTokenId !== undefined && { actorTokenId }),
151
+ orgId: row.id,
152
+ action: "org.created",
153
+ target: row.id,
154
+ detail: { slug, name },
155
+ });
156
+ await this.scopeSync.enqueueOrg(row.id);
153
157
  });
154
- await this.scopeSync.enqueueOrg(row.id);
155
158
  return toOrg(row);
156
159
  }
157
- /** 账号所属的(未软删除的)组织及其角色,按创建时间升序。 */
160
+ /** The account's live organizations and roles in creation order. */
158
161
  async listForAccount(accountId) {
159
- const rows = await this.db
162
+ // org-filter: deployment-wide list of organizations where the account holds a membership.
163
+ const rows = await asPlatform("List the account's memberships across organizations", () => this.db
160
164
  .selectFrom("memberships")
161
165
  .innerJoin("orgs", "orgs.id", "memberships.org_id")
162
166
  .select(["orgs.id", "orgs.slug", "orgs.name", "orgs.created_at", "memberships.role"])
@@ -164,7 +168,7 @@ let OrgsService = class OrgsService {
164
168
  .where("orgs.deleted_at", "is", null)
165
169
  .orderBy("orgs.created_at")
166
170
  .orderBy("orgs.id")
167
- .execute();
171
+ .execute());
168
172
  return rows.map((r) => ({ ...toOrg(r), role: r.role }));
169
173
  }
170
174
  /** 全部(未软删除的)组织及成员数(超级管理员用)。 */
@@ -29,15 +29,12 @@ import { type OrgRole } from "./roles.js";
29
29
  * - `wakeOnBackgroundTask`: the org's override of `runtime.wakeOnBackgroundTask` (absent follows
30
30
  * the deployment), see {@link effectiveWakeOnBackgroundTask}.
31
31
  * - `outsideSandbox`: whether devices of the org may be granted running a call outside their
32
- * sandbox (approval-only profiles design, replacing `fullAccess`); absent follows the platform's
33
- * `devices.outsideSandbox`, and an invalid stored value reads as `off` (narrower, never wider).
32
+ * sandbox. An absent value follows the platform's `devices.outsideSandbox`, and an invalid
33
+ * stored value reads as `off`.
34
34
  * Setting `allowed` while the platform is `off` is refused.
35
35
  * - `deviceNetwork`: the org's device sandbox network, its default and ceiling and its hosts as a
36
- * delta over the platform's allowlist ({@link DeviceNetworkSettingSchema}, replacing
37
- * `cloudNetwork`). An invalid stored value reads as the empty allowlist (narrower, never wider);
38
- * a default or ceiling above the platform's ceiling is refused.
39
- * Old keys are read and kept in step until the permission configuration publication converts
40
- * them ({@link orgDeviceSandboxOf}).
36
+ * delta over the platform's allowlist ({@link DeviceNetworkSettingSchema}). An invalid value
37
+ * reads as the empty allowlist. A default or ceiling above the platform's ceiling is refused.
41
38
  * - `deviceDefaultProvider`: the org's override of the platform's default device provider (the
42
39
  * `device-provider@1` extension that makes a member's default device); absent follows the
43
40
  * platform, an invalid stored value reads as absent. Only a provider that is on in the org may
@@ -195,7 +192,7 @@ export declare const OrgSettingsSchema: z.ZodObject<{
195
192
  allowed: "allowed";
196
193
  off: "off";
197
194
  }>>>;
198
- deviceNetwork: z.ZodCatch<z.ZodOptional<z.ZodObject<{
195
+ deviceNetwork: z.ZodOptional<z.ZodPipe<z.ZodCatch<z.ZodObject<{
199
196
  default: z.ZodOptional<z.ZodEnum<{
200
197
  allowlist: "allowlist";
201
198
  open: "open";
@@ -210,7 +207,19 @@ export declare const OrgSettingsSchema: z.ZodObject<{
210
207
  }>>;
211
208
  extraHosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
212
209
  excludedHosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
213
- }, z.core.$strict>>>;
210
+ }, z.core.$strict>>, z.ZodTransform<{
211
+ default?: "allowlist" | "open" | undefined;
212
+ ceiling?: "allowlist" | "open" | undefined;
213
+ base?: "none" | "platform" | undefined;
214
+ extraHosts?: string[] | undefined;
215
+ excludedHosts?: string[] | undefined;
216
+ } | undefined, {
217
+ default?: "allowlist" | "open" | undefined;
218
+ ceiling?: "allowlist" | "open" | undefined;
219
+ base?: "none" | "platform" | undefined;
220
+ extraHosts?: string[] | undefined;
221
+ excludedHosts?: string[] | undefined;
222
+ }>>>;
214
223
  deviceDefaultProvider: z.ZodCatch<z.ZodOptional<z.ZodString>>;
215
224
  wakeOnBackgroundTask: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
216
225
  timeZone: z.ZodCatch<z.ZodOptional<z.ZodString>>;
@@ -464,11 +473,7 @@ export interface OrgSettingsResponse {
464
473
  /** Distinct ready blobs referenced by an org file or share, for user admins only. */
465
474
  fileLibraryBytes?: number;
466
475
  }
467
- /**
468
- * Parses the stored jsonb into settings (leniently, see {@link OrgSettingsSchema}).
469
- * `outsideSandbox` and `deviceNetwork` are read over the new and the old keys the permission
470
- * configuration publication has not converted yet ({@link orgDeviceSandboxOf}; fail closed).
471
- */
476
+ /** Parse the stored settings using the field-specific fallbacks in {@link OrgSettingsSchema}. */
472
477
  export declare function parseOrgSettings(raw: unknown): OrgSettings;
473
478
  /** The org's stored settings jsonb, read live; undefined when the org is missing or deleted. */
474
479
  export declare function readStoredOrgSettings(db: KernelSchemaDb, orgId: string): Promise<unknown>;
@@ -23,7 +23,7 @@ import { TransactionHost, withOrderedLocks } from "../infra/database/transaction
23
23
  import { Transactional } from "../infra/database/transactional.decorator.js";
24
24
  import { KERNEL_LOGGER } from "../infra/tokens.js";
25
25
  import { hostGrantable, hostGrantCeiling, } from "../sandbox/device-sandbox.js";
26
- import { keepOrgLegacyKeysInStep, orgDeviceSandboxOf, readDeviceSandboxSettingsView, } from "../sandbox/device-sandbox-settings.js";
26
+ import { OrgDeviceSandboxStoredSchema, readDeviceSandboxSettingsView, } from "../sandbox/device-sandbox-settings.js";
27
27
  import { coversHost, orgCloudMode, orgEffectiveHosts, orgHostOutsideCeiling, } from "../sandbox/modes.js";
28
28
  import { PermissionAuthorityModule } from "../sandbox/permission-authority.module.js";
29
29
  import { devicesFollowingDefault, hostsNarrowed, needsFullCeiling, needsOpenNetwork, PermissionCeilingWrites, } from "../sandbox/permission-ceiling-writes.js";
@@ -31,7 +31,7 @@ import { readExternalSharing, readShareMaxExpiry, } from "../shares/settings.js"
31
31
  import { assertThemeOnIn } from "../themes/theme-state.js";
32
32
  import { IanaTimeZone } from "../time-zone.js";
33
33
  import { mergeArrangement, OrgUiArrangementPatchSchema, UiArrangementSchema, } from "../ui/arrangement.js";
34
- import { DeviceNetworkSettingSchema, invalidDeviceNetwork, } from "./device-network-setting.js";
34
+ import { DeviceNetworkSettingSchema } from "./device-network-setting.js";
35
35
  import { OrgLock, OrgLockModule } from "./org-lock.js";
36
36
  import { can } from "./roles.js";
37
37
  /**
@@ -48,15 +48,12 @@ import { can } from "./roles.js";
48
48
  * - `wakeOnBackgroundTask`: the org's override of `runtime.wakeOnBackgroundTask` (absent follows
49
49
  * the deployment), see {@link effectiveWakeOnBackgroundTask}.
50
50
  * - `outsideSandbox`: whether devices of the org may be granted running a call outside their
51
- * sandbox (approval-only profiles design, replacing `fullAccess`); absent follows the platform's
52
- * `devices.outsideSandbox`, and an invalid stored value reads as `off` (narrower, never wider).
51
+ * sandbox. An absent value follows the platform's `devices.outsideSandbox`, and an invalid
52
+ * stored value reads as `off`.
53
53
  * Setting `allowed` while the platform is `off` is refused.
54
54
  * - `deviceNetwork`: the org's device sandbox network, its default and ceiling and its hosts as a
55
- * delta over the platform's allowlist ({@link DeviceNetworkSettingSchema}, replacing
56
- * `cloudNetwork`). An invalid stored value reads as the empty allowlist (narrower, never wider);
57
- * a default or ceiling above the platform's ceiling is refused.
58
- * Old keys are read and kept in step until the permission configuration publication converts
59
- * them ({@link orgDeviceSandboxOf}).
55
+ * delta over the platform's allowlist ({@link DeviceNetworkSettingSchema}). An invalid value
56
+ * reads as the empty allowlist. A default or ceiling above the platform's ceiling is refused.
60
57
  * - `deviceDefaultProvider`: the org's override of the platform's default device provider (the
61
58
  * `device-provider@1` extension that makes a member's default device); absent follows the
62
59
  * platform, an invalid stored value reads as absent. Only a provider that is on in the org may
@@ -212,9 +209,9 @@ export const OrgSettingsSchema = z.object({
212
209
  sandboxToolPolicy: z.enum(["allow", "ask"]).default("allow").catch("ask"),
213
210
  platformTool: z.enum(["on", "read-only", "off"]).default("on").catch("on"),
214
211
  /** The org's outside-sandbox ceiling; absent follows the platform. */
215
- outsideSandbox: OutsideSandboxSetting.optional().catch("off"),
212
+ outsideSandbox: OrgDeviceSandboxStoredSchema.shape.outsideSandbox,
216
213
  /** The org's device sandbox network; absent follows the platform. */
217
- deviceNetwork: DeviceNetworkSettingSchema.optional().catch(invalidDeviceNetwork),
214
+ deviceNetwork: OrgDeviceSandboxStoredSchema.shape.deviceNetwork,
218
215
  /** The org's default device provider; absent follows the platform. */
219
216
  deviceDefaultProvider: DeviceProviderName.optional().catch(undefined),
220
217
  /** Overrides `runtime.wakeOnBackgroundTask`; absent follows the deployment. */
@@ -338,24 +335,9 @@ export function effectiveSandboxLimits(deployment, override) {
338
335
  /** Compare by value (`deviceNetwork` is an object); the schema fixes the key order. */
339
336
  const sameSettings = (a, b) => JSON.stringify(OrgSettingsSchema.parse(a)) === JSON.stringify(OrgSettingsSchema.parse(b));
340
337
  const asObject = (v) => v !== null && typeof v === "object" && !Array.isArray(v) ? v : {};
341
- /**
342
- * Parses the stored jsonb into settings (leniently, see {@link OrgSettingsSchema}).
343
- * `outsideSandbox` and `deviceNetwork` are read over the new and the old keys the permission
344
- * configuration publication has not converted yet ({@link orgDeviceSandboxOf}; fail closed).
345
- */
338
+ /** Parse the stored settings using the field-specific fallbacks in {@link OrgSettingsSchema}. */
346
339
  export function parseOrgSettings(raw) {
347
- const stored = asObject(raw);
348
- const settings = OrgSettingsSchema.parse(stored);
349
- const { outsideSandbox, deviceNetwork } = orgDeviceSandboxOf(stored);
350
- if (outsideSandbox === undefined)
351
- delete settings.outsideSandbox;
352
- else
353
- settings.outsideSandbox = outsideSandbox;
354
- if (deviceNetwork === undefined)
355
- delete settings.deviceNetwork;
356
- else
357
- settings.deviceNetwork = deviceNetwork;
358
- return settings;
340
+ return OrgSettingsSchema.parse(asObject(raw));
359
341
  }
360
342
  /** The org's stored settings jsonb, read live; undefined when the org is missing or deleted. */
361
343
  export async function readStoredOrgSettings(db, orgId) {
@@ -814,11 +796,6 @@ let OrgSettingsService = class OrgSettingsService {
814
796
  if (Object.keys(after.uiArrangement).length === 0)
815
797
  delete after.uiArrangement;
816
798
  }
817
- // Stored old keys (`autoMode`, `fullAccess`, `cloudNetwork`) are never dropped here: only the
818
- // permission configuration publication converts them (a mismatch window before activation
819
- // keeps them). `before` already reads them narrowed (orgDeviceSandboxOf), so a write that does
820
- // not choose a value stores what every reader already sees (never refused, never wider), and
821
- // the old keys are carried in step below.
822
799
  if (after.outsideSandbox === undefined)
823
800
  delete after.outsideSandbox;
824
801
  if (after.deviceNetwork === undefined)
@@ -862,11 +839,9 @@ let OrgSettingsService = class OrgSettingsService {
862
839
  if (patch.theme?.id != null && patch.theme.id !== before.theme?.id) {
863
840
  await assertThemeOnIn(this.db.db, orgId, patch.theme.id);
864
841
  }
865
- // Merge with the stored value: keep the keys this version does not know (a cleared
866
- // outsideSandbox / deviceNetwork is not kept; the old keys are rewritten in step)
867
- const { autoMode: _legacyAutoMode, fullAccess: _legacyFullAccess, cloudNetwork: _legacyNetwork, outsideSandbox: _oldOutside, deviceNetwork: _oldNetwork, deviceDefaultProvider: _oldDeviceProvider, wakeOnBackgroundTask: _oldWake, timeZone: _oldZone, theme: _oldTheme, uiArrangement: _oldArrangement, navigation: _oldNavigation, automations: _oldAutomations, compaction: _oldCompaction, promptCache: _oldPromptCache, externalSharing: _oldExternalSharing, promptSuggestions: _oldPromptSuggestions, ...rest } = stored;
842
+ // Preserve unknown settings and apply cleared optional fields.
843
+ const { outsideSandbox: _oldOutside, deviceNetwork: _oldNetwork, deviceDefaultProvider: _oldDeviceProvider, wakeOnBackgroundTask: _oldWake, timeZone: _oldZone, theme: _oldTheme, uiArrangement: _oldArrangement, navigation: _oldNavigation, automations: _oldAutomations, compaction: _oldCompaction, promptCache: _oldPromptCache, externalSharing: _oldExternalSharing, promptSuggestions: _oldPromptSuggestions, ...rest } = stored;
868
844
  const written = { ...rest, ...after };
869
- keepOrgLegacyKeysInStep(written, stored);
870
845
  // An unreadable forbiddenTools reads as [] for display only: a write that does not replace the
871
846
  // list keeps it unreadable (never healed to "nothing forbidden"); saving the list fixes it
872
847
  if (invalidStoredForbiddenTools(stored) && patch.automations?.forbiddenTools === undefined) {
@@ -101,12 +101,6 @@ export const PLATFORM_EXCLUSIONS = [
101
101
  category: "transport",
102
102
  reason: "Redirects to the avatar image for <img>; no agent use",
103
103
  },
104
- // devices
105
- {
106
- route: "POST /api/v1/orgs/:orgId/devices/:id/retirement/check",
107
- category: "human-only",
108
- reason: "An owner initiates the machine proof check from their authenticated device page",
109
- },
110
104
  // background
111
105
  {
112
106
  route: "GET /api/v1/orgs/:orgId/conversations/:id/background-tasks/:taskId/output",
@@ -144,11 +138,6 @@ export const PLATFORM_EXCLUSIONS = [
144
138
  category: "human-only",
145
139
  reason: "Confirms a catalog item's reviewed changes, an approval decision",
146
140
  },
147
- {
148
- route: "POST /api/v1/admin/catalog/items/:id/reject",
149
- category: "human-only",
150
- reason: "Rejects a catalog item's reviewed changes, an approval decision",
151
- },
152
141
  // components
153
142
  // marketplaces
154
143
  {
@@ -493,10 +493,6 @@ let CatalogAdminOperations = class CatalogAdminOperations {
493
493
  code: "plugin.scope_stale",
494
494
  next: "Call plugins.scope-preview again with the same target, show the new preview, and call again with its scopeHash.",
495
495
  },
496
- {
497
- code: "catalog.item_pending",
498
- next: "The plugin's first version waits for the super admin's confirmation in the admin console (Plugins → Pending); confirm or reject it there first.",
499
- },
500
496
  {
501
497
  code: "plugin.skill_conflict",
502
498
  next: "Those orgs already have a skill of that name: narrow the target (scope named without them) or have the name resolved in those orgs, then preview again.",
@@ -646,10 +642,6 @@ let CatalogAdminOperations = class CatalogAdminOperations {
646
642
  code: "catalog.item_not_found",
647
643
  next: "Check the plugin id with plugins.platform-list.",
648
644
  },
649
- {
650
- code: "catalog.item_pending",
651
- next: "The plugin's first version waits for the super admin's confirmation in the admin console (Plugins → Pending); confirm or reject it there first.",
652
- },
653
645
  {
654
646
  code: "catalog.org_owned",
655
647
  next: "An org owns this plugin and manages who sees it; leave it to that org, or use the admin console.",
@@ -16,7 +16,6 @@ import { DeviceCreateBody, DeviceNameBody, DeviceNetworkBody, DeviceParams, Devi
16
16
  import { deviceLabel } from "../../devices/label.js";
17
17
  import { KernelDb } from "../../infra/database/kernel-db.js";
18
18
  import { rootConversationOf } from "../../runtime/subagents/child.js";
19
- import { LOCAL_RETIREMENT_PROVIDER } from "../../sandbox/providers.js";
20
19
  import { defineOperation } from "../operation.js";
21
20
  import { PlatformOperations } from "../registry.js";
22
21
  import { precheckBy, viaAgent } from "./errors.js";
@@ -42,33 +41,6 @@ function stateOf(e) {
42
41
  : "Wipe its files with devices.reset-files to use it again.",
43
42
  };
44
43
  }
45
- if (e.reconcileRequired) {
46
- return {
47
- state: "reconcile_required",
48
- reason: "Its sandbox limits must be established again after the permission migration; nothing runs on it until then.",
49
- next: "Rebuild its files with devices.reset-files (the workspace is wiped), or ask the person to do it on its device page.",
50
- };
51
- }
52
- if (e.retirement === "recreateRequired") {
53
- if (e.provider === LOCAL_RETIREMENT_PROVIDER && e.dialIn)
54
- return {
55
- state: "recreate_required",
56
- reason: "Earlier background work on the connected machine has not been confirmed stopped.",
57
- next: "Ask the device owner to open the device page and choose Check again.",
58
- };
59
- return {
60
- state: "recreate_required",
61
- reason: "Background work an earlier instance of it started may still run and can no longer be confirmed stopped; nothing runs on it.",
62
- next: "Ask the person to delete the device and create it again (a device served by their own machine: sign the machine in again); use another device meanwhile.",
63
- };
64
- }
65
- if (e.retirement === "pending") {
66
- return {
67
- state: "retirement_pending",
68
- reason: "An earlier instance of it has not been confirmed destroyed yet; nothing runs on it until its provider confirms it.",
69
- next: "It is retried on its own; use another device meanwhile.",
70
- };
71
- }
72
44
  return { state: e.instance?.status ?? "ready" };
73
45
  }
74
46
  const row = (e) => ({
@@ -157,13 +157,13 @@ const pendingExtension = (v) => ({
157
157
  permissions: { added: v.added, removed: v.removed, sensitive: v.sensitive },
158
158
  next: `${CONFIRM_ON_WEB} (Extensions → ${enName(v)})`,
159
159
  });
160
- /** A catalog plugin waiting for a permission confirmation (or this org's upload): a compact row. */
160
+ /** A catalog plugin waiting for a permission confirmation: a compact row. */
161
161
  const pendingPlugin = (i) => ({
162
162
  id: i.id,
163
163
  name: i.name,
164
164
  state: "pending",
165
165
  kind: "plugin",
166
- version: i.pendingVersion ?? i.latestVersion,
166
+ version: i.latestVersion,
167
167
  owner: i.owner.kind === "org" ? i.owner.name : "platform",
168
168
  next: `${CONFIRM_ON_WEB} (plugins, pending tab)`,
169
169
  });
@@ -243,7 +243,7 @@ let ExtensionsAdminOperations = class ExtensionsAdminOperations {
243
243
  }),
244
244
  defineOperation({
245
245
  id: "extensions.pending-permissions",
246
- description: "List what waits for a super admin to confirm extension permissions (super admin): extensions whose permissions changed since they were approved (state pending_approval, with the permission keys added and removed and whether they are sensitive) and catalog plugins waiting for a confirmation, including this org's uploads with an extension. State and permission keys only, never config values. Other orgs' own plugins are only counted (otherOrgItems, otherOrgExtensions). Confirming is done by you in the admin console. Pages by 50: pass the returned next as params.cursor.",
246
+ description: "List what waits for a super admin to confirm extension permissions (super admin): extensions whose permissions changed since they were approved (state pending_approval, with the permission keys added and removed and whether they are sensitive) and catalog plugins waiting for a confirmation. State and permission keys only, never config values. Other orgs' own plugins are only counted (otherOrgItems, otherOrgExtensions). Confirming is done by you in the admin console. Pages by 50: pass the returned next as params.cursor.",
247
247
  input: z.object({ cursor: Cursor.optional() }).strict(),
248
248
  example: {},
249
249
  authz: { superAdmin: true },
@@ -56,14 +56,6 @@ function orgNoticeSummary(n) {
56
56
  const d = n.detail;
57
57
  return `Shared ${d.ref.kind} ${d.name} changed from ${d.from} to ${d.to}.`;
58
58
  }
59
- case "upload_confirmed": {
60
- const d = n.detail;
61
- return `The super admin confirmed the upload of ${d.name} ${d.version}.`;
62
- }
63
- case "upload_rejected": {
64
- const d = n.detail;
65
- return `The super admin rejected the upload of ${d.name} ${d.version}: ${d.reason ?? "no reason given"}.`;
66
- }
67
59
  }
68
60
  }
69
61
  /**
@@ -172,7 +164,7 @@ function orgRow(i) {
172
164
  }
173
165
  }
174
166
  /** A platform notice's subject, as the inbox tells it. */
175
- const platformNoticeSummary = (d) => `${d.ref.kind} ${d.name} of ${d.reason === "org_deleted" ? "deleted org" : "org"} ${d.fromOrg.name} now belongs to the platform; ${d.usedBy} other org(s) use it.`;
167
+ const platformNoticeSummary = (d) => `${d.ref.kind} ${d.name} of ${d.reason === "org_deleted" ? "deleted org" : "org"} ${d.fromOrg.name} now belongs to the platform; ${d.usedBy} org(s) still use it.`;
176
168
  /** A platform inbox item as `inbox.platform-list` shows it: a compact row (admin data in full). */
177
169
  function platformRow(i) {
178
170
  const base = { id: i.id, type: i.type, createdAt: i.createdAt };
@@ -195,14 +187,6 @@ function platformRow(i) {
195
187
  summary: `Plugin ${i.item.name} ${i.item.latestVersion} waits for a super admin to confirm its extension permissions. Details: extensions.pending-permissions.`,
196
188
  next: ADMIN_CONSOLE_PENDING,
197
189
  };
198
- case "org_upload_pending":
199
- return {
200
- ...base,
201
- name: i.item.name,
202
- state: "pending",
203
- summary: `This org uploaded ${i.item.name} ${i.item.pendingVersion ?? i.item.latestVersion} with an extension; it waits for a super admin.`,
204
- next: ADMIN_CONSOLE_PENDING,
205
- };
206
190
  case "scope_sync_failed": {
207
191
  const f = i.failure;
208
192
  return {
@@ -335,7 +319,7 @@ let InboxOperations = class InboxOperations {
335
319
  }),
336
320
  defineOperation({
337
321
  id: "inbox.dismiss-notice",
338
- description: "Dismiss an org notice from the inbox for every org admin (org admins): the id of a notice row from inbox.list (types item_shared, shared_item_updated, upload_confirmed, upload_rejected). Approvals and requests are not dismissed here: they are decided on the web.",
322
+ description: "Dismiss an org notice from the inbox for every org admin (org admins): the id of a notice row from inbox.list (types item_shared and shared_item_updated). Approvals and requests are not dismissed here: they are decided on the web.",
339
323
  input: NoticeInput,
340
324
  example: NOTICE_EXAMPLE,
341
325
  authz: { orgAction: "catalog.decide" },
@@ -399,7 +383,7 @@ let InboxOperations = class InboxOperations {
399
383
  }),
400
384
  defineOperation({
401
385
  id: "inbox.platform-list",
402
- description: "List the platform inbox (super admin), newest first, one compact row each (type, what, state, summary, next step): orgs' requests to the platform, plugins waiting for a permission confirmation, this org's uploads waiting for you, failed scope syncs, plugins on by scope whose extension is disabled, and ownership notices. Only the newest 100 items are read (truncated: more wait); listed is how many of them are shown, otherOrgItems how many are items of plugins other orgs own (only counted). total counts everything waiting on the platform, other orgs' items included, as the admin console does; byType splits total by type (everything waiting, not the listed page). Nothing is decided here: requests and confirmations are done in the admin console. Pages by 50: pass the returned next as params.cursor.",
386
+ description: "List the platform inbox (super admin), newest first, one compact row each (type, what, state, summary, next step): orgs' requests to the platform, plugins waiting for a permission confirmation, failed scope syncs, plugins on by scope whose extension is disabled, and ownership notices. Only the newest 100 items are read (truncated: more wait); listed is how many of them are shown, otherOrgItems how many are items of plugins other orgs own (only counted). total counts everything waiting on the platform, other orgs' items included, as the admin console does; byType splits total by type (everything waiting, not the listed page). Nothing is decided here: requests and confirmations are done in the admin console. Pages by 50: pass the returned next as params.cursor.",
403
387
  input: z.object({ cursor: Cursor.optional() }).strict(),
404
388
  example: {},
405
389
  authz: { superAdmin: true },
@@ -408,7 +392,7 @@ let InboxOperations = class InboxOperations {
408
392
  confirm: "read",
409
393
  run: async (input, ctx) => {
410
394
  const view = await this.platformInbox.list();
411
- const itemIds = view.items.flatMap((i) => i.type === "org_upload_pending" || i.type === "permission_confirmation"
395
+ const itemIds = view.items.flatMap((i) => i.type === "permission_confirmation"
412
396
  ? [i.item.id]
413
397
  : i.type === "scope_sync_failed"
414
398
  ? [i.failure.item.id]
@@ -420,8 +404,7 @@ let InboxOperations = class InboxOperations {
420
404
  const o = owners.get(itemId);
421
405
  return o !== undefined && o !== ctx.orgId;
422
406
  };
423
- const shown = view.items.filter((i) => !(((i.type === "org_upload_pending" || i.type === "permission_confirmation") &&
424
- theirs(i.item.id)) ||
407
+ const shown = view.items.filter((i) => !((i.type === "permission_confirmation" && theirs(i.item.id)) ||
425
408
  (i.type === "scope_sync_failed" && theirs(i.failure.item.id)) ||
426
409
  (i.type === "extension_disabled" && theirs(i.disabled.item.id))));
427
410
  const page = pageOf(shown.map(platformRow), startOf(input.cursor), 50);
@@ -1,6 +1,5 @@
1
1
  import { type OnModuleInit } from "@nestjs/common";
2
2
  import { AppearanceService } from "../../catalog/appearance.service.js";
3
- import { CatalogScopeService } from "../../catalog/catalog-scope.service.js";
4
3
  import { OrgCatalogService } from "../../catalog/org-catalog.service.js";
5
4
  import { OrgPluginUploads } from "../../catalog/org-plugin-uploads.js";
6
5
  import { OwnedItems } from "../../catalog/owned-items.js";
@@ -29,12 +28,11 @@ export declare class OrgPluginsOperations implements OnModuleInit {
29
28
  private readonly orgCatalog;
30
29
  private readonly uploads;
31
30
  private readonly owned;
32
- private readonly scope;
33
31
  private readonly kdb;
34
32
  private readonly appearance;
35
33
  private readonly themes;
36
34
  private readonly config;
37
- constructor(registry: PlatformOperations, installer: PluginInstaller, orgCatalog: OrgCatalogService, uploads: OrgPluginUploads, owned: OwnedItems, scope: CatalogScopeService, kdb: KernelDb, appearance: AppearanceService, themes: ThemesService, config: KernelConfigService);
35
+ constructor(registry: PlatformOperations, installer: PluginInstaller, orgCatalog: OrgCatalogService, uploads: OrgPluginUploads, owned: OwnedItems, kdb: KernelDb, appearance: AppearanceService, themes: ThemesService, config: KernelConfigService);
38
36
  /** The display name of the live plugin of `extension`, or the name when it cannot be read. */
39
37
  private pluginNames;
40
38
  /** The org's own live plugin `id`, or null (another org's, a platform one, deleted, unknown). */