@capybara-hq/kernel 0.1.0-rc.53 → 0.1.0-rc.55

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 (190) hide show
  1. package/dist/admin/admin.schemas.d.ts +11 -1
  2. package/dist/catalog/catalog.module.js +1 -1
  3. package/dist/catalog/marketplaces.service.d.ts +1 -1
  4. package/dist/catalog/requests.service.d.ts +5 -5
  5. package/dist/catalog/requests.service.js +9 -9
  6. package/dist/channels/cards.d.ts +4 -3
  7. package/dist/channels/cards.js +25 -16
  8. package/dist/channels/phrases.d.ts +15 -4
  9. package/dist/channels/phrases.js +15 -1
  10. package/dist/config/load.d.ts +26 -7
  11. package/dist/config/load.js +60 -9
  12. package/dist/config/permission-migration.d.ts +17 -9
  13. package/dist/config/permission-migration.js +60 -9
  14. package/dist/config/schema.d.ts +15 -1
  15. package/dist/config/schema.js +66 -11
  16. package/dist/conversations/events.d.ts +247 -5
  17. package/dist/conversations/events.js +127 -16
  18. package/dist/conversations/permission-profiles.controller.d.ts +12 -2
  19. package/dist/conversations/permission-profiles.service.d.ts +12 -2
  20. package/dist/conversations/permission-profiles.service.js +11 -4
  21. package/dist/db/kernel-schema.d.ts +18 -2
  22. package/dist/devices/device-projects.service.d.ts +1 -1
  23. package/dist/devices/device-projects.service.js +6 -6
  24. package/dist/devices/devices.controller.d.ts +10 -8
  25. package/dist/devices/devices.controller.js +14 -18
  26. package/dist/devices/devices.schemas.d.ts +5 -5
  27. package/dist/devices/devices.schemas.js +5 -5
  28. package/dist/devices/devices.service.d.ts +188 -175
  29. package/dist/devices/devices.service.js +284 -292
  30. package/dist/devices/dto.d.ts +43 -23
  31. package/dist/devices/dto.js +45 -49
  32. package/dist/devices/project-rules.d.ts +0 -10
  33. package/dist/devices/project-rules.js +0 -5
  34. package/dist/errors.d.ts +43 -19
  35. package/dist/errors.js +43 -19
  36. package/dist/evals/reconstruct.d.ts +12 -3
  37. package/dist/evals/reconstruct.js +10 -6
  38. package/dist/evals/recorded-permission-context.d.ts +6 -4
  39. package/dist/evals/recorded-permission-context.js +15 -9
  40. package/dist/evals/run-replay.d.ts +6 -1
  41. package/dist/evals/run-replay.js +7 -2
  42. package/dist/evals/worker.js +3 -1
  43. package/dist/http/api.module.js +8 -0
  44. package/dist/http/app.js +9 -0
  45. package/dist/http/meta.controller.d.ts +33 -0
  46. package/dist/http/meta.controller.js +72 -0
  47. package/dist/identity/app-auth.controller.d.ts +25 -0
  48. package/dist/identity/app-auth.controller.js +64 -0
  49. package/dist/identity/app-auth.d.ts +66 -0
  50. package/dist/identity/app-auth.js +203 -0
  51. package/dist/identity/app-auth.schemas.d.ts +47 -0
  52. package/dist/identity/app-auth.schemas.js +43 -0
  53. package/dist/identity/identity.module.d.ts +1 -1
  54. package/dist/identity/identity.module.js +4 -1
  55. package/dist/identity/settings.d.ts +45 -18
  56. package/dist/identity/settings.js +151 -51
  57. package/dist/infra/config/kernel-config.service.d.ts +1 -1
  58. package/dist/infra/config/kernel-config.service.js +19 -5
  59. package/dist/infra/outbox/registry.d.ts +14 -0
  60. package/dist/infra/outbox/registry.js +15 -0
  61. package/dist/infra/throttler/named-throttlers.d.ts +3 -2
  62. package/dist/infra/throttler/named-throttlers.js +14 -2
  63. package/dist/local-devices/device-auth.controller.d.ts +1 -1
  64. package/dist/local-devices/device-auth.controller.js +1 -1
  65. package/dist/local-devices/device-auth.d.ts +4 -4
  66. package/dist/local-devices/device-auth.js +1 -1
  67. package/dist/local-devices/device-policy.service.d.ts +18 -9
  68. package/dist/local-devices/device-policy.service.js +21 -61
  69. package/dist/local-devices/device-routes.d.ts +3 -1
  70. package/dist/local-devices/device-routes.js +15 -4
  71. package/dist/local-devices/instance-bindings.js +5 -2
  72. package/dist/local-devices/local-device-gateway.d.ts +2 -2
  73. package/dist/local-devices/local-device-gateway.js +3 -3
  74. package/dist/local-devices/local-device-provider.d.ts +4 -4
  75. package/dist/local-devices/local-device-provider.js +23 -9
  76. package/dist/local-devices/local-devices.module.d.ts +1 -1
  77. package/dist/local-devices/local-devices.module.js +1 -1
  78. package/dist/local-devices/machines.d.ts +40 -16
  79. package/dist/local-devices/machines.js +89 -61
  80. package/dist/local-devices/owner-report.d.ts +16 -14
  81. package/dist/local-devices/owner-report.js +24 -30
  82. package/dist/local-devices/owner-reports.js +26 -8
  83. package/dist/local-devices/policy-summary.d.ts +25 -44
  84. package/dist/local-devices/policy-summary.js +26 -71
  85. package/dist/local-devices/relay.d.ts +6 -6
  86. package/dist/local-devices/relay.js +10 -8
  87. package/dist/net/public-address.d.ts +1 -1
  88. package/dist/net/public-address.js +5 -2
  89. package/dist/orgs/device-network-setting.d.ts +82 -0
  90. package/dist/orgs/device-network-setting.js +142 -0
  91. package/dist/orgs/settings.service.d.ts +103 -66
  92. package/dist/orgs/settings.service.js +201 -137
  93. package/dist/overrides.d.ts +5 -1
  94. package/dist/overrides.js +2 -0
  95. package/dist/platform/exclusions.js +24 -1
  96. package/dist/platform/operation.js +2 -2
  97. package/dist/platform/ops/admin.ops.js +20 -11
  98. package/dist/platform/ops/devices.ops.js +70 -5
  99. package/dist/platform/ops/org-settings.ops.js +10 -6
  100. package/dist/platform/ops/orgs.ops.js +2 -1
  101. package/dist/platform/ops/platform-icons.ops.d.ts +14 -0
  102. package/dist/platform/ops/platform-icons.ops.js +117 -0
  103. package/dist/platform/platform-ops.module.d.ts +2 -1
  104. package/dist/platform/platform-ops.module.js +3 -0
  105. package/dist/platform/route-schemas.js +3 -0
  106. package/dist/runtime/context/permission-profile.d.ts +17 -8
  107. package/dist/runtime/context/permission-profile.js +126 -45
  108. package/dist/runtime/maintenance.d.ts +5 -2
  109. package/dist/runtime/maintenance.js +15 -4
  110. package/dist/runtime/permission-context.service.d.ts +1 -1
  111. package/dist/runtime/permission-context.service.js +5 -3
  112. package/dist/runtime/project/knowledge.d.ts +5 -4
  113. package/dist/runtime/project/knowledge.js +2 -1
  114. package/dist/runtime/project/knowledge.service.js +16 -13
  115. package/dist/sandbox/cloud-permission-snapshot.js +22 -3
  116. package/dist/sandbox/device-sandbox-settings.d.ts +230 -0
  117. package/dist/sandbox/device-sandbox-settings.js +470 -0
  118. package/dist/sandbox/device-sandbox.d.ts +187 -0
  119. package/dist/sandbox/device-sandbox.js +236 -0
  120. package/dist/sandbox/held-operations.js +15 -7
  121. package/dist/sandbox/modes.d.ts +49 -24
  122. package/dist/sandbox/modes.js +27 -19
  123. package/dist/sandbox/operation-authority-types.d.ts +6 -5
  124. package/dist/sandbox/operation-authority-types.js +7 -8
  125. package/dist/sandbox/operation-authority.d.ts +23 -9
  126. package/dist/sandbox/operation-authority.js +179 -97
  127. package/dist/sandbox/permission-auto-grants.d.ts +42 -0
  128. package/dist/sandbox/permission-auto-grants.js +145 -0
  129. package/dist/sandbox/permission-call-grants.d.ts +12 -4
  130. package/dist/sandbox/permission-call-grants.js +84 -35
  131. package/dist/sandbox/permission-call-grants.module.js +10 -3
  132. package/dist/sandbox/permission-call-types.d.ts +39 -5
  133. package/dist/sandbox/permission-ceiling-writes.d.ts +29 -3
  134. package/dist/sandbox/permission-ceiling-writes.js +38 -4
  135. package/dist/sandbox/permission-config-publication.d.ts +44 -2
  136. package/dist/sandbox/permission-config-publication.js +230 -59
  137. package/dist/sandbox/permission-context-types.d.ts +2 -2
  138. package/dist/sandbox/permission-facts.d.ts +144 -15
  139. package/dist/sandbox/permission-facts.js +258 -70
  140. package/dist/sandbox/permission-runtime-reports.d.ts +5 -4
  141. package/dist/sandbox/permission-runtime-reports.js +19 -29
  142. package/dist/sandbox/review/classifier.d.ts +8 -0
  143. package/dist/sandbox/review/classifier.js +10 -0
  144. package/dist/sandbox/review/permission-candidate.d.ts +69 -5
  145. package/dist/sandbox/review/permission-candidate.js +153 -30
  146. package/dist/sandbox/review/review.service.d.ts +19 -3
  147. package/dist/sandbox/review/review.service.js +59 -11
  148. package/dist/sandbox/review/rules.js +23 -3
  149. package/dist/sandbox/sandbox.service.d.ts +29 -11
  150. package/dist/sandbox/sandbox.service.js +51 -26
  151. package/dist/skills/invoke.js +3 -2
  152. package/dist/themes/platform-icon-objects.d.ts +51 -0
  153. package/dist/themes/platform-icon-objects.js +113 -0
  154. package/dist/themes/platform-icon-public.controller.d.ts +17 -0
  155. package/dist/themes/platform-icon-public.controller.js +58 -0
  156. package/dist/themes/platform-icon.controller.d.ts +22 -0
  157. package/dist/themes/platform-icon.controller.js +65 -0
  158. package/dist/themes/platform-icon.schemas.d.ts +48 -0
  159. package/dist/themes/platform-icon.schemas.js +53 -0
  160. package/dist/themes/platform-icon.service.d.ts +83 -0
  161. package/dist/themes/platform-icon.service.js +301 -0
  162. package/dist/themes/themes.module.d.ts +4 -1
  163. package/dist/themes/themes.module.js +9 -4
  164. package/dist/tools/approvals.service.d.ts +26 -116
  165. package/dist/tools/approvals.service.js +42 -346
  166. package/dist/tools/builtins/sandbox/bash.d.ts +16 -3
  167. package/dist/tools/builtins/sandbox/bash.js +80 -28
  168. package/dist/tools/builtins/sandbox/common.d.ts +39 -14
  169. package/dist/tools/builtins/sandbox/common.js +47 -24
  170. package/dist/tools/builtins/sandbox/deliver.js +7 -4
  171. package/dist/tools/builtins/skill-load.d.ts +2 -2
  172. package/dist/tools/builtins/skill-load.js +4 -3
  173. package/dist/tools/device-op-resolver.d.ts +4 -10
  174. package/dist/tools/device-op-resolver.js +8 -19
  175. package/dist/tools/network-asks.d.ts +52 -15
  176. package/dist/tools/network-asks.js +55 -25
  177. package/dist/tools/pipeline.d.ts +26 -14
  178. package/dist/tools/pipeline.js +144 -61
  179. package/dist/tools/registry.d.ts +6 -0
  180. package/dist/tools/tools.module.js +1 -1
  181. package/package.json +4 -4
  182. package/src/migrations/0164_platform_icons.sql +10 -0
  183. package/src/migrations/0165_device_network_columns.sql +50 -0
  184. package/src/migrations/0166_permission_grant_full_access.sql +17 -0
  185. package/src/migrations/0167_device_network_backfill.sql +32 -0
  186. package/src/migrations/0168_binding_installed_connection.sql +6 -0
  187. package/dist/orgs/cloud-network-setting.d.ts +0 -33
  188. package/dist/orgs/cloud-network-setting.js +0 -47
  189. package/dist/sandbox/platform-full-access.d.ts +0 -110
  190. package/dist/sandbox/platform-full-access.js +0 -198
@@ -66,6 +66,23 @@ export const PLATFORM_EXCLUSIONS = [
66
66
  category: "human-only",
67
67
  reason: "Fetches an extension package and returns its permission review; installing it means confirming those permissions, which only a person does (spec §6.4)",
68
68
  },
69
+ // meta
70
+ {
71
+ route: "GET /api/v1/meta",
72
+ category: "transport",
73
+ reason: "Pre-sign-in discovery for native clients: platform name, icon and protocol ranges",
74
+ },
75
+ // native-app sign-in (desktop client spec §6.5)
76
+ {
77
+ route: "POST /api/v1/app-auth/authorize",
78
+ category: "human-only",
79
+ reason: "A person consents in the browser to sign a native app in",
80
+ },
81
+ {
82
+ route: "POST /api/v1/app-auth/token",
83
+ category: "transport",
84
+ reason: "A native app exchanges a one-time sign-in code; nothing for an agent",
85
+ },
69
86
  // setup
70
87
  {
71
88
  route: "GET /api/v1/setup",
@@ -317,7 +334,7 @@ export const PLATFORM_EXCLUSIONS = [
317
334
  {
318
335
  route: "POST /api/v1/orgs/:orgId/devices/:id/policy",
319
336
  category: "human-only",
320
- reason: "A person changes their own machine's mode and sandbox-mode network; enabling auto mode happens on the machine, never through an agent",
337
+ reason: "A person narrows their own machine's sandbox (hosts, network, running outside the sandbox) on its device page; widening happens on the machine, never through an agent",
321
338
  },
322
339
  {
323
340
  route: "POST /api/v1/device/authorize",
@@ -862,6 +879,12 @@ export const PLATFORM_EXCLUSIONS = [
862
879
  category: "transport",
863
880
  reason: "Serves a theme version's font and logo bytes to the browser",
864
881
  },
882
+ // the platform icon (mobile layout spec §10.2.1)
883
+ {
884
+ route: "GET /api/v1/platform/icon/:purpose",
885
+ category: "transport",
886
+ reason: "Public image delivery for the manifest and favicons",
887
+ },
865
888
  {
866
889
  route: "GET /api/v1/platform/theme",
867
890
  category: "transport",
@@ -57,7 +57,7 @@ export const PLATFORM_DOMAINS = [
57
57
  },
58
58
  {
59
59
  id: "admin",
60
- description: "The admin console (super admin): dashboard totals, deployment settings, the org's members, and the agents and connectors of the org (read, delete, disable or enable; other orgs' only in the console).",
60
+ description: "The admin console (super admin): dashboard totals, deployment settings, the platform icon, the org's members, and the agents and connectors of the org (read, delete, disable or enable; other orgs' only in the console).",
61
61
  },
62
62
  {
63
63
  id: "models",
@@ -85,7 +85,7 @@ export const PLATFORM_DOMAINS = [
85
85
  },
86
86
  {
87
87
  id: "devices",
88
- description: "Your own cloud devices (the workspaces your conversations run in): list, read, create, rename, delete, wipe the files.",
88
+ description: "Your own cloud devices (the workspaces your conversations run in): list, read, create, rename, narrow the sandbox network, delete, wipe the files.",
89
89
  },
90
90
  {
91
91
  id: "schedules",
@@ -43,7 +43,8 @@ const SettingsInput = DEPLOYMENT_SETTINGS_PATCH.pick({
43
43
  uiTheme: true,
44
44
  uiArrangement: true,
45
45
  clientExtensions: true,
46
- devicesFullAccess: true,
46
+ devicesOutsideSandbox: true,
47
+ devicesNetwork: true,
47
48
  attribution: true,
48
49
  externalSharing: true,
49
50
  shareMaxExpiryDays: true,
@@ -207,7 +208,7 @@ let AdminOperations = class AdminOperations {
207
208
  }),
208
209
  defineOperation({
209
210
  id: "admin.settings",
210
- description: "Read the deployment settings (super admin): who may create orgs (orgCreation), the price currency, whether orgs may create their own connectors and skills, whether org admins may browse the marketplaces, the per-org limit overrides keyed by org id (orgs.get reads one org's), the platform's Full permission switch in effect (devicesFullAccess: permission allowed or off), the platform's attribution defaults for agent-created git commits and pull requests (attribution: commit, pr, sessionUrl), file sharing (externalSharing: value allow or deny, whether orgs may turn on public links to conversation files; shareMaxExpiryDays: value, the longest expiry a share may take in days), htmlRenderCdnAllowlist (the https origins a rendered HTML file may load libraries, styles, fonts and images from) and promptSuggestions (on or off, absent meaning on: whether the composer suggests the person's next message after a completed run; an org's own promptSuggestions must be on too); the switches each with sources: env, file or nacos are set in the startup config and read-only, db chosen in the admin console, default.",
211
+ description: "Read the deployment settings (super admin): who may create orgs (orgCreation), the price currency, whether orgs may create their own connectors and skills, whether org admins may browse the marketplaces, the per-org limit overrides keyed by org id (orgs.get reads one org's), the platform's device sandbox settings in effect (devicesOutsideSandbox: permission allowed or off, whether a device may be granted running a call outside its sandbox; devicesNetwork: default and ceiling, open for the public internet with private addresses closed or allowlist, the network a device gets and the widest an org or device may choose), the platform's attribution defaults for agent-created git commits and pull requests (attribution: commit, pr, sessionUrl), file sharing (externalSharing: value allow or deny, whether orgs may turn on public links to conversation files; shareMaxExpiryDays: value, the longest expiry a share may take in days), htmlRenderCdnAllowlist (the https origins a rendered HTML file may load libraries, styles, fonts and images from) and promptSuggestions (on or off, absent meaning on: whether the composer suggests the person's next message after a completed run; an org's own promptSuggestions must be on too); the switches each with sources: env, file or nacos are set in the startup config and read-only, db chosen in the admin console, default.",
211
212
  input: z.object({}).strict(),
212
213
  example: {},
213
214
  authz: { superAdmin: true },
@@ -217,7 +218,7 @@ let AdminOperations = class AdminOperations {
217
218
  }),
218
219
  defineOperation({
219
220
  id: "admin.update-settings",
220
- description: "Change deployment settings (super admin); give only the keys to change: orgCreation (anyone or super_admin), priceCurrency (ISO 4217 code), customConnectors / customSkills (allow or deny: whether orgs may create their own instead of installing from the catalog), orgMarketplaceBrowse (true or false), uiTheme ({ id }: the platform default theme, a platform theme whose scope is all, or null for the built-in theme; it is what every org falls back to and what the sign-in pages show), uiArrangement ({ <slot>: { hidden, order } } for a list slot, { <slot>: { use } } for a single slot: the platform default arrangement of UI slots, with contribution keys <extension>/<contribution>; hidden ones are not listed but still open by URL; use names the contribution that replaces the built-in, null for the built-in; null for a slot removes its entry), clientExtensions ({ enabled?, disabled? }: the kill switch of plugin client code; enabled false stops every plugin's interface code in every browser, disabled is the whole list of plugins whose interface code alone is stopped while their tools keep working; read the current list from admin.settings first), devicesFullAccess ({ permission }: the platform's Full permission switch, allowed or off; null clears it back to the default, allowed; through this tool it may only be turned off, never allowed, and a value set in the startup config is read-only), attribution ({ commit?, pr?, sessionUrl? }: the platform's defaults for agent-created git commits and pull requests; null clears a field back to its default, an empty string turns that line off, and fields set in the startup config are read-only), externalSharing (allow or deny: whether orgs may turn on public links to conversation files; null clears it back to the default, deny; externalSharing may only be turned off through this tool, and a value set in the startup config is read-only), shareMaxExpiryDays (1 to 365: the longest expiry a share may take, in days; null clears it back to 30; through this tool it may only be lowered, never raised, and it is read-only when set in the startup config), htmlRenderCdnAllowlist (the whole list of https origins, scheme and host with an optional port and nothing else, that a rendered HTML file may load from; at most 50; through this tool origins may only be removed, never added, so read the current list from admin.settings first and send it without the ones to drop). promptSuggestions (on or off; null clears it, absent meaning on: whether the composer suggests the person's next message after a completed run; an org's own promptSuggestions must be on too) may be set either way. Per-org limits are orgs.set-limits.",
221
+ description: "Change deployment settings (super admin); give only the keys to change: orgCreation (anyone or super_admin), priceCurrency (ISO 4217 code), customConnectors / customSkills (allow or deny: whether orgs may create their own instead of installing from the catalog), orgMarketplaceBrowse (true or false), uiTheme ({ id }: the platform default theme, a platform theme whose scope is all, or null for the built-in theme; it is what every org falls back to and what the sign-in pages show), uiArrangement ({ <slot>: { hidden, order } } for a list slot, { <slot>: { use } } for a single slot: the platform default arrangement of UI slots, with contribution keys <extension>/<contribution>; hidden ones are not listed but still open by URL; use names the contribution that replaces the built-in, null for the built-in; null for a slot removes its entry), clientExtensions ({ enabled?, disabled? }: the kill switch of plugin client code; enabled false stops every plugin's interface code in every browser, disabled is the whole list of plugins whose interface code alone is stopped while their tools keep working; read the current list from admin.settings first), devicesOutsideSandbox ({ permission }: whether a device may be granted running a call outside its sandbox, allowed or off; null clears it back to the default, allowed; through this tool it may only be turned off, never allowed, and a value set in the startup config is read-only), devicesNetwork ({ default?, ceiling? }: the device sandbox network, open or allowlist; null clears a field back to the default, open; the default may not be above the ceiling; through this tool either may only be narrowed to allowlist, never opened, and a field set in the startup config is read-only), attribution ({ commit?, pr?, sessionUrl? }: the platform's defaults for agent-created git commits and pull requests; null clears a field back to its default, an empty string turns that line off, and fields set in the startup config are read-only), externalSharing (allow or deny: whether orgs may turn on public links to conversation files; null clears it back to the default, deny; externalSharing may only be turned off through this tool, and a value set in the startup config is read-only), shareMaxExpiryDays (1 to 365: the longest expiry a share may take, in days; null clears it back to 30; through this tool it may only be lowered, never raised, and it is read-only when set in the startup config), htmlRenderCdnAllowlist (the whole list of https origins, scheme and host with an optional port and nothing else, that a rendered HTML file may load from; at most 50; through this tool origins may only be removed, never added, so read the current list from admin.settings first and send it without the ones to drop). promptSuggestions (on or off; null clears it, absent meaning on: whether the composer suggests the person's next message after a completed run; an org's own promptSuggestions must be on too) may be set either way. Per-org limits are orgs.set-limits.",
221
222
  input: SettingsInput.refine((b) => Object.keys(b).length > 0, {
222
223
  message: "at least one setting is required",
223
224
  }),
@@ -239,8 +240,12 @@ let AdminOperations = class AdminOperations {
239
240
  next: "Fix the values as the message says (admin.settings shows the current ones).",
240
241
  },
241
242
  {
242
- code: "deployment.full_access_not_allowed",
243
- next: "Through this tool the platform's Full permission switch may only be turned off; to allow it, ask a super admin to change it in the admin console settings on the web.",
243
+ code: "deployment.outside_sandbox_not_allowed",
244
+ next: "Through this tool running outside the sandbox (devicesOutsideSandbox) may only be turned off; to allow it, ask a super admin to change it in the admin console settings on the web.",
245
+ },
246
+ {
247
+ code: "deployment.network_not_allowed",
248
+ next: "Through this tool the device network (devicesNetwork) may only be narrowed to allowlist, and its default may never be above its ceiling (admin.settings shows both); to open it, ask a super admin to change it in the admin console settings on the web.",
244
249
  },
245
250
  {
246
251
  code: "deployment.external_sharing_not_allowed",
@@ -269,20 +274,24 @@ let AdminOperations = class AdminOperations {
269
274
  };
270
275
  }
271
276
  return precheckBy(async () => {
272
- const full = i.devicesFullAccess;
273
- if (full !== undefined)
274
- await this.settings.checkDevicesFullAccess(full, { onlyNarrows: true });
277
+ if (i.devicesOutsideSandbox !== undefined || i.devicesNetwork !== undefined)
278
+ await this.settings.checkDeviceSandbox(i, { onlyNarrows: true });
275
279
  await this.settings.checkSharing(i, { onlyNarrows: true });
276
280
  });
277
281
  },
278
282
  summary: async (i) => {
279
- const { uiTheme, uiArrangement, clientExtensions, devicesFullAccess, attribution, htmlRenderCdnAllowlist, ...rest } = i;
283
+ const { uiTheme, uiArrangement, clientExtensions, devicesOutsideSandbox, devicesNetwork, attribution, htmlRenderCdnAllowlist, ...rest } = i;
280
284
  const parts = Object.entries(rest).map(([k, v]) => `${k}=${String(v)}`);
281
285
  if (htmlRenderCdnAllowlist !== undefined) {
282
286
  parts.push(`htmlRenderCdnAllowlist=[${htmlRenderCdnAllowlist.join(", ")}]`);
283
287
  }
284
- if (devicesFullAccess !== undefined) {
285
- parts.push(`devicesFullAccess=${String(devicesFullAccess.permission)}`);
288
+ if (devicesOutsideSandbox !== undefined) {
289
+ parts.push(`devicesOutsideSandbox=${String(devicesOutsideSandbox.permission)}`);
290
+ }
291
+ if (devicesNetwork !== undefined) {
292
+ for (const field of ["default", "ceiling"])
293
+ if (devicesNetwork[field] !== undefined)
294
+ parts.push(`devicesNetwork.${field}=${String(devicesNetwork[field])}`);
286
295
  }
287
296
  const zh = [...parts];
288
297
  const en = [...parts];
@@ -11,7 +11,7 @@ import { Inject, Injectable } from "@nestjs/common";
11
11
  import { z } from "zod";
12
12
  import { DeviceProjectsService } from "../../devices/device-projects.service.js";
13
13
  import { DevicesService } from "../../devices/devices.service.js";
14
- import { DeviceNameBody, DeviceParams, DeviceProjectAddBody, DeviceProjectParams, } from "../../devices/dto.js";
14
+ import { DeviceNameBody, DeviceNetworkBody, DeviceParams, DeviceProjectAddBody, DeviceProjectParams, } from "../../devices/dto.js";
15
15
  import { deviceLabel } from "../../devices/label.js";
16
16
  import { KernelDb } from "../../infra/database/kernel-db.js";
17
17
  import { rootConversationOf } from "../../runtime/subagents/child.js";
@@ -141,7 +141,7 @@ let DevicesOperations = class DevicesOperations {
141
141
  }),
142
142
  defineOperation({
143
143
  id: "devices.get",
144
- description: "Read one of your devices with its source (cloud or local), provider, state, instance, the machine of a local one and whether it is online, limits, its mode (the one its commands run at and the one this org allows, and which layer allows auto mode), its network and where that comes from, a pending change that applies on its next use, its recent mode and policy changes, and creation time. Takes the id from devices.list. Only the person changes a device's mode: a local device's on the machine (auto mode is enabled only there), a cloud device's on its device page (to sandbox, or back to following the org's mode).",
144
+ description: "Read one of your devices with its source (cloud or local), provider, state, instance, the machine of a local one and whether it is online, limits, its sandbox (the network in effect and its ceiling: open, allowlist or none, with the allowlist hosts; the device's own network setting and host list; whether a call may run outside the sandbox; which layer set each ceiling; a pending change that applies on its next use; its recent setting changes), a local machine's owner ceiling, and creation time. Takes the id from devices.list. A local device's sandbox is widened only on its machine; a cloud device's network can be narrowed with devices.set-network.",
145
145
  input: DeviceId,
146
146
  example: { deviceId: "4e8a0c1d-6b2f-4a37-8d19-3c5e7f9a1b20" },
147
147
  authz: { orgAction: "agents.use" },
@@ -286,9 +286,8 @@ let DevicesOperations = class DevicesOperations {
286
286
  authz: { orgAction: "agents.use" },
287
287
  mirrors: ["PATCH /api/v1/orgs/:orgId/devices/:id"],
288
288
  renames: { deviceId: "id" },
289
- // a person changes their own device's mode or owner ceiling in a web session; widening a
290
- // machine's ceiling happens on the machine (B2)
291
- omits: ["mode", "ownerCeiling", "confirmWidening"],
289
+ // the network is devices.set-network's (narrow only)
290
+ omits: ["network"],
292
291
  confirm: "personal",
293
292
  errors: [
294
293
  {
@@ -312,6 +311,72 @@ let DevicesOperations = class DevicesOperations {
312
311
  device: row(await this.devices.rename(ctx.orgId, ctx.actorAccountId, input.deviceId, input.name, undefined, viaAgent("devices.rename", ctx))),
313
312
  }),
314
313
  }),
314
+ defineOperation({
315
+ id: "devices.set-network",
316
+ description: "Narrow the sandbox network of one of your cloud devices: mode allowlist (its organization's allowed hosts, optionally narrowed to hosts: a device's list never adds a host) or none (no network). Only narrowing is allowed here, in its stored setting and in effect: opening the network, adding a host, dropping its own host list or following the organization again (mode null) is refused and needs the person on the device's page. A local device's network is kept on its machine. Takes the id from devices.list; devices.get shows the network in effect.",
317
+ input: DeviceId.extend({ network: DeviceNetworkBody }).strict(),
318
+ example: {
319
+ deviceId: "4e8a0c1d-6b2f-4a37-8d19-3c5e7f9a1b20",
320
+ network: { mode: "allowlist", hosts: ["registry.npmjs.org"] },
321
+ },
322
+ authz: { orgAction: "agents.use" },
323
+ mirrors: ["PATCH /api/v1/orgs/:orgId/devices/:id"],
324
+ renames: { deviceId: "id" },
325
+ omits: ["name"],
326
+ confirm: "personal",
327
+ errors: [
328
+ {
329
+ code: "device.not_found",
330
+ next: "Check the id with devices.list: you only see your own devices.",
331
+ },
332
+ {
333
+ code: "device.network_not_allowed",
334
+ next: "Through this tool a device's network may only narrow, within its organization's hosts: pick allowlist or none, or hosts its organization allows (devices.get shows them). To open it, ask the person to change it on the device's page; a host outside the organization's list needs an org admin.",
335
+ },
336
+ {
337
+ code: "device.ceiling_on_machine",
338
+ next: "This is a local device: its network is kept on its machine. Ask the person to narrow it on the device's page or on the machine.",
339
+ },
340
+ ],
341
+ precheck: (i, ctx) => precheckBy(() => this.devices.checkNetwork(ctx.orgId, ctx.actorAccountId, i.deviceId, i.network, true)),
342
+ summary: async (i, ctx) => {
343
+ const name = await orElse(async () => named(labelOf(await this.devices.get(ctx.orgId, ctx.actorAccountId, i.deviceId))), i.deviceId);
344
+ const hosts = i.network.hosts?.length ? i.network.hosts.join(", ") : null;
345
+ const zh = i.network.mode === "none"
346
+ ? "关闭网络"
347
+ : i.network.mode === "allowlist"
348
+ ? `仅白名单${hosts ? `(${hosts})` : ""}`
349
+ : i.network.mode === "open"
350
+ ? "开放互联网"
351
+ : "跟随组织";
352
+ const en = i.network.mode === "none"
353
+ ? "no network"
354
+ : i.network.mode === "allowlist"
355
+ ? `the allowlist only${hosts ? ` (${hosts})` : ""}`
356
+ : i.network.mode === "open"
357
+ ? "the open internet"
358
+ : "follow the organization";
359
+ // neutral wording: the precheck and the run refuse anything but a narrowing
360
+ return {
361
+ zh: `将设备「${name}」的沙箱网络设为:${zh}`,
362
+ en: `Set the sandbox network of device "${name}" to ${en}`,
363
+ };
364
+ },
365
+ run: async (input, ctx) => {
366
+ const e = await this.devices.update(ctx.orgId, ctx.actorAccountId, input.deviceId, {
367
+ network: {
368
+ mode: input.network.mode,
369
+ ...(input.network.hosts !== undefined && { hosts: input.network.hosts }),
370
+ },
371
+ }, undefined, { narrowOnly: true, auditDetail: viaAgent("devices.set-network", ctx) });
372
+ return {
373
+ device: {
374
+ ...row(e),
375
+ sandbox: { network: e.sandbox.network, hosts: e.sandbox.hosts },
376
+ },
377
+ };
378
+ },
379
+ }),
315
380
  defineOperation({
316
381
  id: "devices.list-projects",
317
382
  description: "List the projects of one of your devices that its current mode can read (name and absolute path), plus the mode, the base a new project's path is relative to (the workspace in sandbox mode and on a cloud device, your home directory in auto mode), how many stored projects the mode hides, and whether the device offers projects at all. Takes the id from devices.list.",
@@ -39,7 +39,7 @@ let OrgSettingsOperations = class OrgSettingsOperations {
39
39
  this.registry.register([
40
40
  defineOperation({
41
41
  id: "org-settings.get",
42
- description: "Read this org's settings: toolSearch, locale, sandboxToolPolicy, platformTool (on, read-only or off), fullAccess (allowed or off: whether the org's devices may run with Full permission; absent follows the deployment's switch, and the org may never exceed it), cloudNetwork (the org's sandbox-mode network stored as a delta over the platform's allowlist: mode open or allowlist for a cloud device in sandbox mode, absent following the platform; base platform or none; extraHosts the org adds; excludedHosts platform hosts it drops; open means any public host, while loopback, private and cloud metadata addresses stay blocked), wakeOnBackgroundTask (absent means it follows the deployment), theme (the org's default theme id, null or absent following the platform, and personal: allowed or locked), uiArrangement (per list slot, the extension contributions the org hides and their order; per single slot, the contribution that replaces the built-in as use, null for the built-in; a slot not listed follows the platform), the deployment's Full switch (fullAccess) and network (its allowlist, orgHosts: extend lets the org go beyond it, within makes it the ceiling, and off for the platform kill switch), effectiveNetwork (the mode and hosts the org's sandbox mode really gets), externalSharing (on or off, absent meaning off: whether members may share conversation files through public links; the deployment's externalSharing must be allow too) with the deployment's externalSharing and shareMaxExpiryDays, promptSuggestions (on or off, absent meaning on: whether the composer suggests the person's next message after a completed run; the deployment's promptSuggestions must be on too) with the deployment's promptSuggestions, and the sandbox cpu / memory limits in effect.",
42
+ description: "Read this org's settings: toolSearch, locale, sandboxToolPolicy, platformTool (on, read-only or off), outsideSandbox (allowed or off: whether the org's devices may be granted running a call outside their sandbox; absent follows the deployment, and the org may never exceed it), deviceNetwork (the org's device sandbox network: default, the network a device gets when its owner chooses none, and ceiling, the widest a device may choose, each open or allowlist and absent following the platform; base platform or none; extraHosts the org adds; excludedHosts platform hosts it drops; open means any public host, while loopback, private and cloud metadata addresses stay closed), wakeOnBackgroundTask (absent means it follows the deployment), theme (the org's default theme id, null or absent following the platform, and personal: allowed or locked), uiArrangement (per list slot, the extension contributions the org hides and their order; per single slot, the contribution that replaces the built-in as use, null for the built-in; a slot not listed follows the platform), the deployment's outside-sandbox switch (outsideSandbox) and device network (deviceNetwork: its default and ceiling, its allowlist, orgHosts: extend lets the org go beyond the allowlist, within makes it the hosts' ceiling, and off for the platform kill switch), effectiveNetwork (the mode and hosts the org's devices really get), externalSharing (on or off, absent meaning off: whether members may share conversation files through public links; the deployment's externalSharing must be allow too) with the deployment's externalSharing and shareMaxExpiryDays, promptSuggestions (on or off, absent meaning on: whether the composer suggests the person's next message after a completed run; the deployment's promptSuggestions must be on too) with the deployment's promptSuggestions, and the sandbox cpu / memory limits in effect.",
43
43
  input: z.object({}).strict(),
44
44
  example: {},
45
45
  authz: { orgAction: "org.read" },
@@ -57,7 +57,7 @@ let OrgSettingsOperations = class OrgSettingsOperations {
57
57
  }),
58
58
  defineOperation({
59
59
  id: "org-settings.update",
60
- description: "Change this org's settings (org admins). Give only the settings to change; null clears fullAccess, cloudNetwork or wakeOnBackgroundTask so they follow the deployment again (refused when the deployment value is wider than what this tool may set). fullAccess (allowed or off; the platform must allow it) and cloudNetwork ({ mode?, base?: platform | none, extraHosts?, excludedHosts? }, replaced whole, so send the stored fields you keep) may only narrow the org's devices here: allowing Full where the org has it off, switching the cloud network from allowlist to open, adding an extra host, dropping an exclusion or moving base from none to platform is refused and needs a person in the organization settings on the web. theme: { id, personal } sets the org's default theme (a theme id from themes.list, or null to follow the platform) and whether members may pick their own (allowed) or not (locked); null clears it. uiArrangement: { <slot>: { hidden, order } } (a list slot) or { <slot>: { use } } (a single slot: shell.brand, conversation.empty, conversation.composer.frame) replaces that slot's entry, where hidden, order and use name contribution keys <extension>/<contribution> (hidden ones are not listed in the web UI but their pages still open by URL; use null is the built-in); null for a slot makes it follow the platform again; platform.page is refused. externalSharing (on or off; null clears it, off) may only be turned off through this tool: turning it on needs a person in the organization settings on the web, and the platform must allow it. promptSuggestions (on or off; null clears it, absent meaning on: whether the composer suggests the person's next message after a completed run; the deployment's promptSuggestions must be on too) may be set either way through this tool. Setting platformTool to off or read-only takes effect from the next call and cuts this Platform tool off in the org; an org admin switches it back on in the web settings.",
60
+ description: "Change this org's settings (org admins). Give only the settings to change; null clears outsideSandbox, deviceNetwork or wakeOnBackgroundTask so they follow the deployment again (refused when the deployment value is wider than what this tool may set). outsideSandbox (allowed or off; the platform must allow it) and deviceNetwork ({ default?, ceiling?: open | allowlist, base?: platform | none, extraHosts?, excludedHosts? }, replaced whole, so send the stored fields you keep; neither default nor ceiling may be open where the platform's ceiling is allowlist, and the default may not be above the ceiling) may only narrow the org's devices here: allowing outside-sandbox runs where the org has them off, opening the default or the ceiling, adding an extra host, dropping an exclusion or moving base from none to platform is refused and needs a person in the organization settings on the web. theme: { id, personal } sets the org's default theme (a theme id from themes.list, or null to follow the platform) and whether members may pick their own (allowed) or not (locked); null clears it. uiArrangement: { <slot>: { hidden, order } } (a list slot) or { <slot>: { use } } (a single slot: shell.brand, conversation.empty, conversation.composer.frame) replaces that slot's entry, where hidden, order and use name contribution keys <extension>/<contribution> (hidden ones are not listed in the web UI but their pages still open by URL; use null is the built-in); null for a slot makes it follow the platform again; platform.page is refused. externalSharing (on or off; null clears it, off) may only be turned off through this tool: turning it on needs a person in the organization settings on the web, and the platform must allow it. promptSuggestions (on or off; null clears it, absent meaning on: whether the composer suggests the person's next message after a completed run; the deployment's promptSuggestions must be on too) may be set either way through this tool. Setting platformTool to off or read-only takes effect from the next call and cuts this Platform tool off in the org; an org admin switches it back on in the web settings.",
61
61
  input: OrgSettingsPatchSchema.refine((i) => Object.values(i).some((v) => v !== undefined), {
62
62
  message: "give at least one setting",
63
63
  }),
@@ -68,11 +68,15 @@ let OrgSettingsOperations = class OrgSettingsOperations {
68
68
  errors: [
69
69
  {
70
70
  code: "org.sandbox_egress_not_allowed",
71
- next: "Through this tool the org's cloud network may only be narrowed: it may drop extra hosts, exclude platform hosts, move base to none or switch open to allowlist, but never add an extra host, drop an exclusion or switch back to open (the hosts are the local sandbox-mode ceiling whatever the cloud mode). To widen it, ask an org admin to change it in the organization settings on the web. When the platform limits hosts to its allowlist (deployment.cloudNetwork.orgHosts within), a host outside it needs a super admin.",
71
+ next: "Through this tool the org's device network hosts may only be narrowed: it may drop extra hosts, exclude platform hosts or move base to none, but never add an extra host or drop an exclusion. To widen them, ask an org admin to change them in the organization settings on the web. When the platform limits hosts to its allowlist (deployment.deviceNetwork.orgHosts within), a host outside it needs a super admin.",
72
72
  },
73
73
  {
74
- code: "org.full_access_not_allowed",
75
- next: "Through this tool the org's Full permission (fullAccess) may only be turned off, never allowed (the platform may turn it off too; org-settings.get shows both); to allow it, ask an org admin to change it in the organization settings on the web.",
74
+ code: "org.network_not_allowed",
75
+ next: "The org's device network default and ceiling may not be open where the platform's ceiling is allowlist (org-settings.get shows deployment.deviceNetwork), and through this tool they may only be narrowed to allowlist, never opened; to open them, ask an org admin in the organization settings on the web, and a super admin when the platform limits them.",
76
+ },
77
+ {
78
+ code: "org.outside_sandbox_not_allowed",
79
+ next: "Through this tool running outside the sandbox (outsideSandbox) may only be turned off, never allowed (the platform may turn it off too; org-settings.get shows both); to allow it, ask an org admin to change it in the organization settings on the web.",
76
80
  },
77
81
  {
78
82
  code: "org.external_sharing_not_allowed",
@@ -124,7 +128,7 @@ let OrgSettingsOperations = class OrgSettingsOperations {
124
128
  },
125
129
  run: async (input, ctx) => {
126
130
  const settings = await this.settings.update(ctx.orgId, input, ctx.actorAccountId, undefined, viaAgent("org-settings.update", ctx),
127
- // a person widens auto mode or the cloud network, never an agent (auto mode spec §4.3)
131
+ // a person widens the device sandbox settings, never an agent
128
132
  { onlyNarrows: true });
129
133
  const note = input.platformTool === undefined
130
134
  ? undefined
@@ -180,7 +180,8 @@ let OrgsOperations = class OrgsOperations {
180
180
  "uiTheme",
181
181
  "uiArrangement",
182
182
  "clientExtensions",
183
- "devicesFullAccess",
183
+ "devicesOutsideSandbox",
184
+ "devicesNetwork",
184
185
  "attribution",
185
186
  "compaction",
186
187
  "externalSharing",
@@ -0,0 +1,14 @@
1
+ import { type OnModuleInit } from "@nestjs/common";
2
+ import { PlatformIconService } from "../../themes/platform-icon.service.js";
3
+ import { PlatformOperations } from "../registry.js";
4
+ /**
5
+ * The platform icon setting through the `Platform` tool (mobile layout spec §10.2.1): the list,
6
+ * upload and restore of `/api/v1/admin/platform/icons*`, run through the same service. The public
7
+ * read of the bytes is a transport exclusion.
8
+ */
9
+ export declare class PlatformIconsOperations implements OnModuleInit {
10
+ private readonly registry;
11
+ private readonly icons;
12
+ constructor(registry: PlatformOperations, icons: PlatformIconService);
13
+ onModuleInit(): void;
14
+ }
@@ -0,0 +1,117 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
8
+ return function (target, key) { decorator(target, key, paramIndex); }
9
+ };
10
+ import { Inject, Injectable } from "@nestjs/common";
11
+ import { z } from "zod";
12
+ import { PlatformIconBody, PlatformIconParams, } from "../../themes/platform-icon.schemas.js";
13
+ import { PlatformIconService } from "../../themes/platform-icon.service.js";
14
+ import { defineOperation } from "../operation.js";
15
+ import { PlatformOperations } from "../registry.js";
16
+ import { precheckBy, viaAgent } from "./errors.js";
17
+ const SetIconInput = PlatformIconParams.merge(PlatformIconBody).strict();
18
+ const ClearIconInput = PlatformIconParams.strict();
19
+ /** The card's name of an icon purpose. */
20
+ const NAMES = {
21
+ app: { zh: "应用图标", en: "app icon" },
22
+ maskable: { zh: "可遮罩应用图标", en: "maskable app icon" },
23
+ favicon: { zh: "网站图标(SVG)", en: "SVG favicon" },
24
+ };
25
+ /**
26
+ * The platform icon setting through the `Platform` tool (mobile layout spec §10.2.1): the list,
27
+ * upload and restore of `/api/v1/admin/platform/icons*`, run through the same service. The public
28
+ * read of the bytes is a transport exclusion.
29
+ */
30
+ let PlatformIconsOperations = class PlatformIconsOperations {
31
+ registry;
32
+ icons;
33
+ constructor(registry, icons) {
34
+ this.registry = registry;
35
+ this.icons = icons;
36
+ }
37
+ onModuleInit() {
38
+ this.registry.register([
39
+ defineOperation({
40
+ id: "admin.icons",
41
+ description: "List the platform icons the super admin uploaded: the app icon (app), its maskable variant (maskable) and the SVG favicon (favicon), each with its public URL, SHA-256 and when it was set. The installed web app, the browser tab and the native clients use them; a purpose not listed uses the built-in Capybara icon.",
42
+ input: z.object({}).strict(),
43
+ example: {},
44
+ authz: { superAdmin: true },
45
+ mirrors: ["GET /api/v1/admin/platform/icons"],
46
+ confirm: "read",
47
+ run: () => this.icons.list(),
48
+ }),
49
+ defineOperation({
50
+ id: "admin.set-icon",
51
+ description: "Upload a platform icon (super admin), given as standard base64 of the file, at most 1 MiB: app and maskable take a PNG (image/png) of exactly 512 × 512 pixels (maskable keeps its subject inside the central 80 % safe zone); favicon takes an SVG (image/svg+xml) of at most 128 KiB with a viewBox and no script, style element or external reference. It replaces the purpose's previous upload for every org and every installed app. The platform audit log records it.",
52
+ input: SetIconInput,
53
+ example: { purpose: "app", contentType: "image/png", dataBase64: "iVBORw0KGgo..." },
54
+ authz: { superAdmin: true },
55
+ mirrors: ["PUT /api/v1/admin/platform/icons/:purpose"],
56
+ confirm: "platform",
57
+ errors: [
58
+ {
59
+ code: "platform_icon.invalid_type",
60
+ next: "Send app and maskable as a PNG (image/png) and favicon as an SVG (image/svg+xml) with a viewBox and no script; the message says what was wrong.",
61
+ },
62
+ {
63
+ code: "platform_icon.invalid_size",
64
+ next: "Resize the PNG to exactly 512 × 512 pixels and upload it again.",
65
+ },
66
+ {
67
+ code: "platform_icon.too_large",
68
+ next: "Make the file at most 1 MiB (1048576 bytes), an SVG favicon at most 128 KiB (131072 bytes), and upload it again.",
69
+ },
70
+ {
71
+ code: "platform_icon.storage_unavailable",
72
+ next: {
73
+ superAdmin: "This deployment has no object storage: install and configure an object-store plugin in the admin console, then upload again.",
74
+ member: "This deployment has no object storage; ask the super admin to set one up.",
75
+ },
76
+ },
77
+ ],
78
+ precheck: (i) => precheckBy(() => this.icons.check(i.purpose, i.contentType, i.dataBase64)),
79
+ summary: async (i) => {
80
+ const n = NAMES[i.purpose];
81
+ const bytes = Math.floor((i.dataBase64.length * 3) / 4);
82
+ return {
83
+ zh: `把平台的${n.zh}换成上传的文件(约 ${bytes} 字节),所有组织和已安装的应用都会使用它`,
84
+ en: `Replace the platform ${n.en} with the uploaded file (about ${bytes} bytes); every org and installed app uses it`,
85
+ };
86
+ },
87
+ run: (i, ctx) => this.icons.set(i.purpose, i.contentType, i.dataBase64, { accountId: ctx.actorAccountId }, viaAgent("admin.set-icon", ctx)),
88
+ }),
89
+ defineOperation({
90
+ id: "admin.clear-icon",
91
+ description: "Restore the built-in Capybara icon for one platform icon purpose (super admin): app, maskable or favicon. The uploaded file is deleted. The platform audit log records it.",
92
+ input: ClearIconInput,
93
+ example: { purpose: "maskable" },
94
+ authz: { superAdmin: true },
95
+ mirrors: ["DELETE /api/v1/admin/platform/icons/:purpose"],
96
+ confirm: "platform",
97
+ summary: async (i) => {
98
+ const n = NAMES[i.purpose];
99
+ return {
100
+ zh: `把平台的${n.zh}恢复为内置的 Capybara 图标`,
101
+ en: `Restore the built-in Capybara ${n.en} for the platform`,
102
+ };
103
+ },
104
+ run: async (i, ctx) => {
105
+ const cleared = await this.icons.clear(i.purpose, { accountId: ctx.actorAccountId }, viaAgent("admin.clear-icon", ctx));
106
+ return { purpose: i.purpose, cleared };
107
+ },
108
+ }),
109
+ ]);
110
+ }
111
+ };
112
+ PlatformIconsOperations = __decorate([
113
+ Injectable(),
114
+ __param(0, Inject(PlatformOperations)),
115
+ __param(1, Inject(PlatformIconService))
116
+ ], PlatformIconsOperations);
117
+ export { PlatformIconsOperations };
@@ -23,6 +23,7 @@ import { OrgSettingsOperations } from "./ops/org-settings.ops.js";
23
23
  import { OrgsOperations } from "./ops/orgs.ops.js";
24
24
  import { OutboxOperations } from "./ops/outbox.ops.js";
25
25
  import { PlatformOperationsProvider } from "./ops/platform.ops.js";
26
+ import { PlatformIconsOperations } from "./ops/platform-icons.ops.js";
26
27
  import { PluginsOperations } from "./ops/plugins.ops.js";
27
28
  import { PreviewersOperations } from "./ops/previewers.ops.js";
28
29
  import { RequestsOperations } from "./ops/requests.ops.js";
@@ -36,7 +37,7 @@ import { UiOperations } from "./ops/ui.ops.js";
36
37
  * One provider per domain, each taking `PlatformOperations` as its first constructor argument:
37
38
  * the parity test in `tools/checks` builds the operations from it without a Nest app.
38
39
  */
39
- export declare const PLATFORM_OPERATION_PROVIDERS: readonly [typeof PlatformOperationsProvider, typeof SkillsOperations, typeof AgentsOperations, typeof AgentTemplatesOperations, typeof PluginsOperations, typeof MarketplacesOperations, typeof RequestsOperations, typeof ConnectorsOperations, typeof ExtensionsOperations, typeof ConversationsOperations, typeof ComponentsOperations, typeof AccountsOperations, typeof OrgsOperations, typeof AdminOperations, typeof CatalogAdminOperations, typeof OrgPluginsOperations, typeof ExtensionsAdminOperations, typeof ModelsOperations, typeof InboxOperations, typeof ApprovalsOperations, typeof ChannelsOperations, typeof OrgSettingsOperations, typeof EvalsOperations, typeof BackgroundOperations, typeof PreviewersOperations, typeof DevicesOperations, typeof AgentSkillsOperations, typeof ThemesOperations, typeof SetupOperations, typeof UiOperations, typeof AdminItemsOperations, typeof SchedulesOperations, typeof OutboxOperations, typeof SharesOperations];
40
+ export declare const PLATFORM_OPERATION_PROVIDERS: readonly [typeof PlatformOperationsProvider, typeof SkillsOperations, typeof AgentsOperations, typeof AgentTemplatesOperations, typeof PluginsOperations, typeof MarketplacesOperations, typeof RequestsOperations, typeof ConnectorsOperations, typeof ExtensionsOperations, typeof ConversationsOperations, typeof ComponentsOperations, typeof AccountsOperations, typeof OrgsOperations, typeof AdminOperations, typeof CatalogAdminOperations, typeof OrgPluginsOperations, typeof ExtensionsAdminOperations, typeof ModelsOperations, typeof InboxOperations, typeof ApprovalsOperations, typeof ChannelsOperations, typeof OrgSettingsOperations, typeof EvalsOperations, typeof BackgroundOperations, typeof PreviewersOperations, typeof DevicesOperations, typeof AgentSkillsOperations, typeof ThemesOperations, typeof SetupOperations, typeof UiOperations, typeof AdminItemsOperations, typeof SchedulesOperations, typeof OutboxOperations, typeof SharesOperations, typeof PlatformIconsOperations];
40
41
  /**
41
42
  * The `Platform` tool's operations (ruling P2): one provider per domain, each registering its
42
43
  * operations into `PlatformOperations` from `onModuleInit`. It imports the domain modules, which
@@ -52,6 +52,7 @@ import { OrgSettingsOperations } from "./ops/org-settings.ops.js";
52
52
  import { OrgsOperations } from "./ops/orgs.ops.js";
53
53
  import { OutboxOperations } from "./ops/outbox.ops.js";
54
54
  import { PlatformOperationsProvider } from "./ops/platform.ops.js";
55
+ import { PlatformIconsOperations } from "./ops/platform-icons.ops.js";
55
56
  import { PluginsOperations } from "./ops/plugins.ops.js";
56
57
  import { PreviewersOperations } from "./ops/previewers.ops.js";
57
58
  import { RequestsOperations } from "./ops/requests.ops.js";
@@ -114,6 +115,8 @@ export const PLATFORM_OPERATION_PROVIDERS = [
114
115
  OutboxOperations,
115
116
  // shared file links (file sharing spec §10)
116
117
  SharesOperations,
118
+ // the platform icon (mobile layout spec §10.2.1)
119
+ PlatformIconsOperations,
117
120
  ];
118
121
  /**
119
122
  * The `Platform` tool's operations (ruling P2): one provider per domain, each registering its
@@ -30,6 +30,7 @@ import { SETUP_CHECK_ROUTES } from "../setup/setup-checks.schemas.js";
30
30
  import { SETUP_GUIDE_ROUTES } from "../setup/setup-guides.schemas.js";
31
31
  import { SHARE_ROUTES } from "../shares/shares.schemas.js";
32
32
  import { SKILL_ROUTES } from "../skills/skills.schemas.js";
33
+ import { PLATFORM_ICON_ROUTES } from "../themes/platform-icon.schemas.js";
33
34
  import { THEME_ROUTES } from "../themes/themes.schemas.js";
34
35
  import { APPROVAL_ROUTES } from "../tools/approvals.schemas.js";
35
36
  import { CONNECTOR_ROUTES } from "../tools/connectors.schemas.js";
@@ -74,6 +75,8 @@ export const ROUTE_SCHEMAS = [
74
75
  ...ME_ROUTES,
75
76
  // themes (themes spec §9)
76
77
  ...THEME_ROUTES,
78
+ // the platform icon (mobile layout spec §10.2.1)
79
+ ...PLATFORM_ICON_ROUTES,
77
80
  // a plugin's suggested appearance (client extensions spec §6.5)
78
81
  ...APPEARANCE_ROUTES,
79
82
  // setup guide checks (setup guides v2 §10.3, §12)
@@ -1,27 +1,36 @@
1
- import { type ConversationEvent, type ManagedDevicePathsV1, type PermissionContextMetaV1, type PermissionContextV1 } from "../../conversations/events.js";
2
- /** A recorded log carries a present v1 marker or version that its strict schema rejects. */
1
+ import { type ConversationEvent, type ManagedDevicePathsV1, type PermissionContextMetaV1, type PermissionContextSandbox, type PermissionContextV2 } from "../../conversations/events.js";
2
+ /** A recorded log carries a present marker or version that its strict schema rejects. */
3
3
  export declare class RecordedPermissionContextError extends Error {
4
4
  readonly seq: number;
5
5
  readonly eventType: "permission_context" | "device_paths";
6
6
  readonly name = "RecordedPermissionContextError";
7
7
  constructor(seq: number, eventType: "permission_context" | "device_paths");
8
8
  }
9
- /** Canonical v1 bytes: explicit nulls, code-point object keys, validated array order. */
9
+ /** Canonical bytes: explicit nulls, code-point object keys, validated array order. */
10
10
  export declare function canonicalPermissionJson(value: unknown): string;
11
11
  /** JSON quoting makes recorded values inert, including markup and Unicode line separators. */
12
12
  export declare const permissionQuote: (value: string) => string;
13
- export declare function permissionContextText(payload: PermissionContextV1): string;
13
+ /**
14
+ * The model-facing text of a recorded context: the sandbox once (its boundary, directories and
15
+ * network), then the approver per crossing kind. A supported context without a sandbox block
16
+ * keeps the profile-level policy line.
17
+ */
18
+ export declare function permissionContextText(payload: PermissionContextV2): string;
14
19
  export declare function managedDevicePathsText(payload: ManagedDevicePathsV1): string;
15
- export declare const permissionContextHash: (payload: PermissionContextV1) => string;
20
+ /** A recorded payload read as v2 (a stored v1 one up-converted with `sandbox: null`); throws. */
21
+ export declare function readRecordedPermissionContext(payload: unknown): PermissionContextV2;
22
+ /** The canonical hash of a recorded device sandbox block (request metadata `sandbox`). */
23
+ export declare const permissionSandboxHash: (sandbox: PermissionContextSandbox) => string;
24
+ export declare const permissionContextHash: (payload: PermissionContextV2) => string;
16
25
  export declare const managedDevicePathsHash: (payload: ManagedDevicePathsV1) => string;
17
- export declare const permissionContextIdemKey: (payload: PermissionContextV1, previousSeq: number) => string;
26
+ export declare const permissionContextIdemKey: (payload: PermissionContextV2, previousSeq: number) => string;
18
27
  export declare const managedDevicePathsIdemKey: (payload: ManagedDevicePathsV1, previousSeq: number) => string;
19
28
  export declare function permissionContextAt(events: readonly ConversationEvent[], seq: number): Extract<ConversationEvent, {
20
29
  type: "permission_context";
21
30
  }> | undefined;
22
31
  /**
23
32
  * Snapshot validation for raw (cast) events: every `permission_context` and every `device_paths`
24
- * carrying a marker must satisfy its strict v1 schema, covered or not, before any rendering; an
33
+ * carrying a marker must satisfy its strict schema, covered or not, before any rendering; an
25
34
  * unsupported version must never fall back to historical text. Unmarked paths keep their parser.
26
35
  */
27
36
  export declare function assertRecordedPermissionEvents(events: readonly ConversationEvent[]): void;
@@ -32,7 +41,7 @@ export interface PermissionContribution {
32
41
  export declare function permissionContextMeta(events: readonly ConversationEvent[], contributions: readonly PermissionContribution[]): PermissionContextMetaV1 | undefined;
33
42
  /**
34
43
  * One traversal for request rendering and original-coordinate replay diagnostics. Both callers get
35
- * the same marker rule: a present marker or version that fails its strict v1 schema (covered by a
44
+ * the same marker rule: a present marker or version that fails its strict schema (covered by a
36
45
  * summary or not) throws {@link RecordedPermissionContextError} before anything renders, so it is
37
46
  * never shown as historical device-mode text nor surfaces as a raw schema error. Unmarked events
38
47
  * are left to their historical rendering.