@capybara-hq/kernel 0.1.0-rc.36 → 0.1.0-rc.38

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 (351) hide show
  1. package/bootstrap.json +5 -5
  2. package/dist/admin/admin.module.d.ts +3 -2
  3. package/dist/admin/admin.module.js +9 -5
  4. package/dist/admin/audit-log.service.d.ts +51 -0
  5. package/dist/admin/{platform-audit.service.js → audit-log.service.js} +20 -12
  6. package/dist/admin/audit.controller.d.ts +18 -6
  7. package/dist/admin/audit.controller.js +36 -6
  8. package/dist/admin/audit.schemas.d.ts +9 -1
  9. package/dist/admin/audit.schemas.js +22 -2
  10. package/dist/admin/org-network.controller.d.ts +30 -0
  11. package/dist/admin/org-network.controller.js +77 -0
  12. package/dist/admin/org-network.schemas.d.ts +16 -0
  13. package/dist/admin/org-network.schemas.js +27 -0
  14. package/dist/admin/org-network.service.d.ts +41 -0
  15. package/dist/admin/org-network.service.js +101 -0
  16. package/dist/admin/outbox-dead.controller.d.ts +4 -6
  17. package/dist/admin/outbox-dead.controller.js +9 -6
  18. package/dist/admin/outbox-dead.schemas.d.ts +16 -0
  19. package/dist/admin/outbox-dead.schemas.js +25 -1
  20. package/dist/admin/outbox-dead.service.d.ts +16 -7
  21. package/dist/admin/outbox-dead.service.js +34 -10
  22. package/dist/admin/overview.service.d.ts +3 -3
  23. package/dist/admin/overview.service.js +0 -1
  24. package/dist/agents/agent-lookup.js +2 -10
  25. package/dist/agents/agents.service.js +9 -20
  26. package/dist/agents/definition.d.ts +3 -51
  27. package/dist/agents/definition.js +4 -254
  28. package/dist/agents/org-templates.js +2 -6
  29. package/dist/agents/readiness.controller.d.ts +4 -12
  30. package/dist/agents/readiness.controller.js +4 -12
  31. package/dist/agents/readiness.service.d.ts +23 -11
  32. package/dist/agents/readiness.service.js +31 -14
  33. package/dist/agents/templates.d.ts +0 -6
  34. package/dist/agents/templates.js +8 -34
  35. package/dist/background/store.d.ts +2 -0
  36. package/dist/background/store.js +3 -1
  37. package/dist/background/wake-rules.js +2 -1
  38. package/dist/catalog/admin-catalog.controller.d.ts +1 -2
  39. package/dist/catalog/admin-catalog.controller.js +1 -2
  40. package/dist/catalog/appearance.service.js +1 -3
  41. package/dist/catalog/catalog-content.d.ts +1 -1
  42. package/dist/catalog/catalog-content.js +1 -4
  43. package/dist/catalog/catalog-items.js +3 -3
  44. package/dist/catalog/catalog-scope.service.d.ts +10 -28
  45. package/dist/catalog/catalog-scope.service.js +22 -73
  46. package/dist/catalog/cli.d.ts +0 -11
  47. package/dist/catalog/cli.js +0 -20
  48. package/dist/catalog/component-scope.service.js +0 -2
  49. package/dist/catalog/component-state.js +2 -2
  50. package/dist/catalog/install-status.d.ts +6 -0
  51. package/dist/catalog/install-status.js +6 -0
  52. package/dist/catalog/job-ids.d.ts +0 -4
  53. package/dist/catalog/job-ids.js +0 -4
  54. package/dist/catalog/marketplaces.service.d.ts +1 -1
  55. package/dist/catalog/org-catalog.service.d.ts +2 -0
  56. package/dist/catalog/org-catalog.service.js +8 -3
  57. package/dist/catalog/org-extension-switch.d.ts +7 -2
  58. package/dist/catalog/org-extension-switch.js +56 -9
  59. package/dist/catalog/org-plugin-uploads.d.ts +6 -15
  60. package/dist/catalog/org-plugin-uploads.js +9 -27
  61. package/dist/catalog/owned-items.js +1 -3
  62. package/dist/catalog/platform-import-update.js +1 -1
  63. package/dist/catalog/plugin-import.d.ts +15 -13
  64. package/dist/catalog/plugin-import.js +21 -30
  65. package/dist/catalog/plugin-install.d.ts +3 -43
  66. package/dist/catalog/plugin-install.js +8 -150
  67. package/dist/catalog/plugin-package.d.ts +5 -10
  68. package/dist/catalog/plugin-package.js +12 -33
  69. package/dist/catalog/plugin-upgrade.js +5 -4
  70. package/dist/catalog/scope-jobs.d.ts +34 -34
  71. package/dist/catalog/scope-jobs.js +50 -37
  72. package/dist/catalog/scope-orgs.d.ts +1 -1
  73. package/dist/catalog/scope-orgs.js +1 -2
  74. package/dist/catalog/scope-sync-workers.d.ts +4 -3
  75. package/dist/catalog/scope-sync-workers.js +18 -6
  76. package/dist/catalog/scope-sync.d.ts +56 -59
  77. package/dist/catalog/scope-sync.js +96 -166
  78. package/dist/catalog/unshare.d.ts +3 -4
  79. package/dist/catalog/unshare.js +5 -8
  80. package/dist/channels/job-ids.d.ts +2 -6
  81. package/dist/channels/job-ids.js +2 -6
  82. package/dist/channels/outbound.d.ts +1 -1
  83. package/dist/channels/outbound.js +1 -1
  84. package/dist/channels/supervisor.d.ts +2 -3
  85. package/dist/channels/supervisor.js +2 -3
  86. package/dist/client/client-access.service.js +1 -1
  87. package/dist/config/env.js +19 -1
  88. package/dist/config/load.d.ts +0 -6
  89. package/dist/config/load.js +8 -27
  90. package/dist/config/schema.d.ts +54 -47
  91. package/dist/config/schema.js +198 -42
  92. package/dist/conversations/attachments.service.d.ts +10 -3
  93. package/dist/conversations/attachments.service.js +49 -16
  94. package/dist/conversations/conversations.controller.d.ts +0 -39
  95. package/dist/conversations/conversations.controller.js +0 -39
  96. package/dist/conversations/event-log.js +4 -1
  97. package/dist/conversations/events.d.ts +71 -46
  98. package/dist/conversations/events.js +124 -112
  99. package/dist/conversations/media-types.d.ts +25 -0
  100. package/dist/conversations/media-types.js +38 -0
  101. package/dist/conversations/queue.d.ts +3 -1
  102. package/dist/conversations/queue.service.js +9 -2
  103. package/dist/conversations/titles.js +6 -0
  104. package/dist/ctx/create-ctx.d.ts +8 -1
  105. package/dist/ctx/create-ctx.js +13 -3
  106. package/dist/ctx/net.d.ts +50 -0
  107. package/dist/ctx/net.js +67 -0
  108. package/dist/ctx/secrets.d.ts +24 -7
  109. package/dist/ctx/secrets.js +97 -30
  110. package/dist/db/kernel-schema.d.ts +27 -6
  111. package/dist/devices/devices.service.js +2 -1
  112. package/dist/errors.d.ts +10 -2
  113. package/dist/errors.js +10 -2
  114. package/dist/evals/reconstruct.d.ts +4 -17
  115. package/dist/evals/reconstruct.js +13 -53
  116. package/dist/evals/recorded-tools.d.ts +0 -27
  117. package/dist/evals/recorded-tools.js +2 -92
  118. package/dist/evals/run-replay.d.ts +1 -6
  119. package/dist/evals/run-replay.js +10 -17
  120. package/dist/evals/sets.service.d.ts +17 -5
  121. package/dist/evals/sets.service.js +33 -12
  122. package/dist/evals/snapshot.d.ts +1 -2
  123. package/dist/evals/snapshot.js +4 -17
  124. package/dist/extensions/admin-ops.d.ts +6 -1
  125. package/dist/extensions/admin-ops.js +17 -4
  126. package/dist/extensions/admin-view.d.ts +7 -4
  127. package/dist/extensions/admin-view.js +27 -21
  128. package/dist/extensions/bootstrap.js +0 -1
  129. package/dist/extensions/cli.js +0 -1
  130. package/dist/extensions/extensions.module.js +3 -0
  131. package/dist/extensions/host.d.ts +9 -4
  132. package/dist/extensions/host.js +14 -8
  133. package/dist/extensions/installs.d.ts +1 -3
  134. package/dist/extensions/instance.d.ts +0 -2
  135. package/dist/extensions/instance.js +0 -3
  136. package/dist/extensions/org-config.d.ts +4 -4
  137. package/dist/extensions/org-config.js +13 -22
  138. package/dist/extensions/package.d.ts +6 -6
  139. package/dist/extensions/package.js +3 -7
  140. package/dist/extensions/permission-view.d.ts +2 -4
  141. package/dist/extensions/plugin-items.d.ts +21 -1
  142. package/dist/extensions/plugin-items.js +28 -0
  143. package/dist/extensions/sync.js +5 -10
  144. package/dist/extensions/unavailable.js +0 -1
  145. package/dist/http/api.module.js +4 -1
  146. package/dist/identity/audit.d.ts +0 -12
  147. package/dist/identity/audit.js +0 -27
  148. package/dist/identity/auth.controller.js +5 -9
  149. package/dist/identity/cookies.d.ts +4 -9
  150. package/dist/identity/cookies.js +8 -32
  151. package/dist/identity/initial-passwords.d.ts +1 -1
  152. package/dist/identity/initial-passwords.js +1 -2
  153. package/dist/identity/sessions.d.ts +0 -6
  154. package/dist/identity/sessions.js +0 -18
  155. package/dist/inbox/platform-inbox.service.d.ts +33 -1
  156. package/dist/inbox/platform-inbox.service.js +56 -6
  157. package/dist/index.d.ts +4 -2
  158. package/dist/index.js +4 -2
  159. package/dist/infra/cli/master-key-rewrap.d.ts +15 -0
  160. package/dist/infra/cli/master-key-rewrap.js +24 -0
  161. package/dist/infra/config/kernel-config.service.js +0 -17
  162. package/dist/infra/database/transaction-host.d.ts +32 -1
  163. package/dist/infra/database/transaction-host.js +30 -4
  164. package/dist/infra/database/xact-lock.d.ts +16 -0
  165. package/dist/infra/database/xact-lock.js +28 -1
  166. package/dist/infra/health/health.controller.js +8 -0
  167. package/dist/infra/health/process-fault.d.ts +16 -0
  168. package/dist/infra/health/process-fault.js +49 -0
  169. package/dist/infra/lifecycle/process-guards.d.ts +8 -2
  170. package/dist/infra/lifecycle/process-guards.js +12 -3
  171. package/dist/infra/lifecycle/shutdown-signals.d.ts +10 -1
  172. package/dist/infra/lifecycle/shutdown-signals.js +28 -13
  173. package/dist/infra/outbox/outbox.service.d.ts +12 -9
  174. package/dist/infra/outbox/outbox.service.js +22 -26
  175. package/dist/infra/outbox/registry.d.ts +15 -7
  176. package/dist/infra/outbox/registry.js +39 -23
  177. package/dist/lifecycle/kernel-lifecycle.js +1 -7
  178. package/dist/models/enablement.d.ts +5 -6
  179. package/dist/models/enablement.js +7 -14
  180. package/dist/net/public-address.d.ts +21 -1
  181. package/dist/net/public-address.js +56 -10
  182. package/dist/net/safe-fetch.d.ts +4 -1
  183. package/dist/net/safe-fetch.js +15 -4
  184. package/dist/orgs/directory-sync.js +2 -0
  185. package/dist/orgs/members.service.js +5 -0
  186. package/dist/orgs/network-allowances.service.d.ts +79 -0
  187. package/dist/orgs/network-allowances.service.js +371 -0
  188. package/dist/orgs/offboarding.d.ts +3 -1
  189. package/dist/orgs/offboarding.js +9 -2
  190. package/dist/orgs/org-lock.d.ts +28 -2
  191. package/dist/orgs/org-lock.js +59 -4
  192. package/dist/orgs/orgs.controller.d.ts +11 -2
  193. package/dist/orgs/orgs.controller.js +19 -3
  194. package/dist/orgs/orgs.module.d.ts +3 -2
  195. package/dist/orgs/orgs.module.js +6 -2
  196. package/dist/orgs/orgs.schemas.d.ts +12 -0
  197. package/dist/orgs/orgs.schemas.js +5 -0
  198. package/dist/orgs/orgs.service.js +6 -1
  199. package/dist/orgs/settings.controller.d.ts +3 -2
  200. package/dist/orgs/settings.service.d.ts +59 -14
  201. package/dist/orgs/settings.service.js +102 -20
  202. package/dist/overrides.d.ts +7 -7
  203. package/dist/overrides.js +4 -4
  204. package/dist/packages/tgz.d.ts +0 -2
  205. package/dist/packages/tgz.js +0 -2
  206. package/dist/platform/exclusions.js +0 -5
  207. package/dist/platform/operation.js +1 -1
  208. package/dist/platform/ops/admin.ops.d.ts +2 -2
  209. package/dist/platform/ops/admin.ops.js +9 -6
  210. package/dist/platform/ops/agents.ops.js +1 -1
  211. package/dist/platform/ops/connectors.ops.js +46 -1
  212. package/dist/platform/ops/evals.ops.js +1 -64
  213. package/dist/platform/ops/extensions-admin.ops.js +1 -1
  214. package/dist/platform/ops/inbox.ops.js +16 -3
  215. package/dist/platform/ops/org-plugins.ops.js +1 -1
  216. package/dist/platform/ops/orgs.ops.d.ts +11 -3
  217. package/dist/platform/ops/orgs.ops.js +139 -5
  218. package/dist/platform/ops/outbox.ops.js +5 -5
  219. package/dist/platform/route-schemas.js +3 -0
  220. package/dist/roles/worker-role.d.ts +2 -3
  221. package/dist/roles/worker-role.js +3 -13
  222. package/dist/runtime/checkpointer.d.ts +3 -0
  223. package/dist/runtime/checkpointer.js +7 -4
  224. package/dist/runtime/context/build.d.ts +56 -18
  225. package/dist/runtime/context/build.js +143 -50
  226. package/dist/runtime/context/compaction.d.ts +1 -3
  227. package/dist/runtime/context/compaction.js +42 -8
  228. package/dist/runtime/context/run-context.js +1 -2
  229. package/dist/runtime/context/skills.d.ts +27 -56
  230. package/dist/runtime/context/skills.js +42 -114
  231. package/dist/runtime/context/tool-changes.d.ts +3 -3
  232. package/dist/runtime/context/tool-changes.js +6 -16
  233. package/dist/runtime/hook-calls.d.ts +6 -6
  234. package/dist/runtime/hook-calls.js +7 -7
  235. package/dist/runtime/langgraph-loop.js +9 -3
  236. package/dist/runtime/maintenance.d.ts +3 -11
  237. package/dist/runtime/maintenance.js +5 -20
  238. package/dist/runtime/model-call.d.ts +5 -0
  239. package/dist/runtime/model-call.js +48 -36
  240. package/dist/runtime/providers.d.ts +33 -35
  241. package/dist/runtime/providers.js +64 -109
  242. package/dist/runtime/run-context.service.js +7 -22
  243. package/dist/runtime/run-deletion.d.ts +6 -0
  244. package/dist/runtime/run-deletion.js +39 -16
  245. package/dist/runtime/run-execution.d.ts +56 -3
  246. package/dist/runtime/run-execution.js +81 -11
  247. package/dist/runtime/run-finish.js +2 -1
  248. package/dist/runtime/run-liveness.d.ts +11 -0
  249. package/dist/runtime/run-liveness.js +19 -0
  250. package/dist/runtime/run-orphan-check.job.js +2 -1
  251. package/dist/runtime/run-queue.js +8 -16
  252. package/dist/runtime/run-worker.d.ts +2 -2
  253. package/dist/runtime/run-worker.js +8 -6
  254. package/dist/runtime/step-log.d.ts +5 -0
  255. package/dist/runtime/step-log.js +9 -4
  256. package/dist/runtime/subagents/definition.d.ts +16 -20
  257. package/dist/runtime/subagents/definition.js +27 -27
  258. package/dist/runtime/subagents/dispatch.d.ts +6 -2
  259. package/dist/runtime/subagents/dispatch.js +17 -3
  260. package/dist/runtime/subagents/org-agents.js +1 -2
  261. package/dist/runtime/subagents/preamble.d.ts +3 -2
  262. package/dist/runtime/subagents/preamble.js +3 -2
  263. package/dist/runtime/subagents/render.d.ts +1 -2
  264. package/dist/runtime/subagents/render.js +1 -2
  265. package/dist/runtime/subagents/skill-fork.d.ts +2 -4
  266. package/dist/runtime/subagents/template-skills.d.ts +47 -0
  267. package/dist/runtime/subagents/template-skills.js +76 -0
  268. package/dist/runtime/waits.js +3 -1
  269. package/dist/schedules/effective-settings.d.ts +9 -3
  270. package/dist/schedules/effective-settings.js +5 -4
  271. package/dist/schedules/fire.js +11 -0
  272. package/dist/schedules/scheduled-tasks.service.js +5 -0
  273. package/dist/schedules/unattended.d.ts +2 -0
  274. package/dist/schedules/unattended.js +6 -1
  275. package/dist/skills/agent-skills.service.js +1 -2
  276. package/dist/skills/catalog.d.ts +1 -3
  277. package/dist/skills/catalog.js +1 -3
  278. package/dist/skills/conversation-catalog.d.ts +1 -2
  279. package/dist/skills/conversation-catalog.js +1 -2
  280. package/dist/skills/usable.js +2 -3
  281. package/dist/storage/storage.service.js +9 -1
  282. package/dist/tools/approvals.service.js +2 -4
  283. package/dist/tools/builtin-names.d.ts +2 -9
  284. package/dist/tools/builtin-names.js +4 -13
  285. package/dist/tools/builtins/sandbox/bash.js +3 -3
  286. package/dist/tools/builtins/sandbox/common.d.ts +7 -13
  287. package/dist/tools/builtins/sandbox/common.js +8 -115
  288. package/dist/tools/builtins/sandbox/fetch-attachment.d.ts +10 -0
  289. package/dist/tools/builtins/sandbox/fetch-attachment.js +119 -0
  290. package/dist/tools/builtins/sandbox/glob.js +1 -3
  291. package/dist/tools/builtins/sandbox/grep.js +3 -5
  292. package/dist/tools/builtins/sandbox/index.d.ts +8 -5
  293. package/dist/tools/builtins/sandbox/index.js +10 -5
  294. package/dist/tools/builtins/sandbox/read.js +3 -2
  295. package/dist/tools/builtins/tool-search.d.ts +4 -7
  296. package/dist/tools/builtins/tool-search.js +6 -10
  297. package/dist/tools/connector-account-policies.d.ts +30 -3
  298. package/dist/tools/connector-account-policies.js +54 -7
  299. package/dist/tools/connector-content.js +1 -0
  300. package/dist/tools/connectors.controller.d.ts +24 -11
  301. package/dist/tools/connectors.controller.js +35 -6
  302. package/dist/tools/connectors.schemas.d.ts +14 -1
  303. package/dist/tools/connectors.schemas.js +14 -2
  304. package/dist/tools/connectors.service.d.ts +22 -0
  305. package/dist/tools/connectors.service.js +65 -6
  306. package/dist/tools/drift.d.ts +6 -2
  307. package/dist/tools/drift.js +10 -5
  308. package/dist/tools/git-push-policy.d.ts +4 -1
  309. package/dist/tools/git-push-policy.js +3 -1
  310. package/dist/tools/info.d.ts +1 -7
  311. package/dist/tools/info.js +5 -18
  312. package/dist/tools/job-ids.d.ts +0 -4
  313. package/dist/tools/job-ids.js +1 -6
  314. package/dist/tools/pipeline.d.ts +4 -10
  315. package/dist/tools/pipeline.js +17 -62
  316. package/dist/tools/policy.d.ts +6 -2
  317. package/dist/tools/policy.js +14 -12
  318. package/dist/tools/registry.js +1 -5
  319. package/dist/ui/views.d.ts +5 -5
  320. package/dist/ui/views.js +10 -16
  321. package/package.json +3 -3
  322. package/src/migrations/0137_audit_org_idx.sql +5 -0
  323. package/src/migrations/0138_plugin_install_status_no_upgrading.sql +18 -0
  324. package/src/migrations/0139_retire_legacy_forms.sql +183 -0
  325. package/src/migrations/0140_retire_history_forms.sql +148 -0
  326. package/src/migrations/0141_install_ledger_promoted_rows.sql +36 -0
  327. package/src/migrations/0142_backfill_event_fields.sql +74 -0
  328. package/src/migrations/0143_backfill_model_call_fields.sql +105 -0
  329. package/src/migrations/0144_retire_frozen_definition_keys.sql +163 -0
  330. package/src/migrations/0145_org_network_allowances.sql +12 -0
  331. package/dist/admin/platform-audit.service.d.ts +0 -41
  332. package/dist/conversations/job-ids.d.ts +0 -6
  333. package/dist/conversations/job-ids.js +0 -6
  334. package/dist/extensions/job-ids.d.ts +0 -6
  335. package/dist/extensions/job-ids.js +0 -6
  336. package/dist/infra/queue/retired-schedulers.d.ts +0 -7
  337. package/dist/infra/queue/retired-schedulers.js +0 -9
  338. package/dist/orgs/job-ids.d.ts +0 -8
  339. package/dist/orgs/job-ids.js +0 -8
  340. package/dist/runtime/context/legacy-text.d.ts +0 -22
  341. package/dist/runtime/context/legacy-text.js +0 -37
  342. package/dist/runtime/job-ids.d.ts +0 -10
  343. package/dist/runtime/job-ids.js +0 -10
  344. package/dist/runtime/retired-schedulers.d.ts +0 -7
  345. package/dist/runtime/retired-schedulers.js +0 -31
  346. package/dist/storage/job-ids.d.ts +0 -6
  347. package/dist/storage/job-ids.js +0 -6
  348. package/dist/tools/legacy-data.d.ts +0 -34
  349. package/dist/tools/legacy-data.js +0 -76
  350. package/dist/tools/legacy-keys.d.ts +0 -51
  351. package/dist/tools/legacy-keys.js +0 -114
@@ -1,7 +1,7 @@
1
1
  import { type OnModuleInit } from "@nestjs/common";
2
+ import { AuditLogService } from "../../admin/audit-log.service.js";
2
3
  import { AdminHealthService } from "../../admin/health.service.js";
3
4
  import { AdminOverviewService } from "../../admin/overview.service.js";
4
- import { PlatformAuditService } from "../../admin/platform-audit.service.js";
5
5
  import { AdminUsageService } from "../../admin/usage.service.js";
6
6
  import { ExtensionDisplayNames } from "../../extensions/display-name.js";
7
7
  import { ExtensionRegistry } from "../../extensions/registry.js";
@@ -32,7 +32,7 @@ export declare class AdminOperations implements OnModuleInit {
32
32
  private readonly overview;
33
33
  private readonly health;
34
34
  private readonly usage;
35
- constructor(registry: PlatformOperations, settings: SettingsService, providers: ProviderRegistry, displayNames: ExtensionDisplayNames, extensionRegistry: ExtensionRegistry, enablement: ModelEnablement, prices: PricesService, purposes: ModelPurposesService, themes: ThemesService, audit: PlatformAuditService, overview: AdminOverviewService, health: AdminHealthService, usage: AdminUsageService);
35
+ constructor(registry: PlatformOperations, settings: SettingsService, providers: ProviderRegistry, displayNames: ExtensionDisplayNames, extensionRegistry: ExtensionRegistry, enablement: ModelEnablement, prices: PricesService, purposes: ModelPurposesService, themes: ThemesService, audit: AuditLogService, overview: AdminOverviewService, health: AdminHealthService, usage: AdminUsageService);
36
36
  private assertProvider;
37
37
  onModuleInit(): void;
38
38
  }
@@ -11,10 +11,10 @@ import { Inject, Injectable } from "@nestjs/common";
11
11
  import { z } from "zod";
12
12
  import { DeploymentSettingsBody, PurposeParams } from "../../admin/admin.schemas.js";
13
13
  import { AuditListQuery } from "../../admin/audit.schemas.js";
14
+ import { AuditLogService } from "../../admin/audit-log.service.js";
14
15
  import { AdminHealthService } from "../../admin/health.service.js";
15
16
  import { UsageQuery } from "../../admin/overview.schemas.js";
16
17
  import { AdminOverviewService } from "../../admin/overview.service.js";
17
- import { PlatformAuditService } from "../../admin/platform-audit.service.js";
18
18
  import { AdminUsageService } from "../../admin/usage.service.js";
19
19
  import { ApiError } from "../../errors.js";
20
20
  import { ExtensionDisplayNames } from "../../extensions/display-name.js";
@@ -154,7 +154,7 @@ let AdminOperations = class AdminOperations {
154
154
  }),
155
155
  defineOperation({
156
156
  id: "admin.attention",
157
- description: "What needs the super admin besides the platform inbox (super admin), one compact row each (kind, id, name, state, reason, next step): extensions (reason config, load_failed, approval, dependency, conflict, converging or legacy_format), platform plugins with a newer marketplace version (reason names both versions) model providers (reason list_failed or no_chat_model) background work the kernel could not queue (kind outbox: how many outbox rows are dead and since when) and run jobs the queue lost (kind queue: Redis lost data; the runs were queued again). Each kind lists at most 20 rows; more counts the rest per kind. unavailable names a kind that could not be read right now (try again later). The platform inbox itself is inbox.platform-list.",
157
+ description: "What needs the super admin besides the platform inbox (super admin), one compact row each (kind, id, name, state, reason, next step): extensions (reason config, load_failed, approval, dependency, conflict, or converging), platform plugins with a newer marketplace version (reason names both versions) model providers (reason list_failed or no_chat_model) background work the kernel could not queue (kind outbox: how many outbox rows are dead and since when) and run jobs the queue lost (kind queue: Redis lost data; the runs were queued again). Each kind lists at most 20 rows; more counts the rest per kind. unavailable names a kind that could not be read right now (try again later). The platform inbox itself is inbox.platform-list.",
158
158
  input: z.object({}).strict(),
159
159
  example: {},
160
160
  authz: { superAdmin: true },
@@ -190,13 +190,16 @@ let AdminOperations = class AdminOperations {
190
190
  }),
191
191
  defineOperation({
192
192
  id: "admin.audit",
193
- description: "The platform-level audit log (super admin), newest first: deployment settings, accounts, marketplaces, catalog imports and scope, extensions, model prices and purposes, setup. Each event has its id, time, actor (id, name, email; null for the kernel itself), viaToken (done with a personal access token), viaAgent (done through the Platform tool), action and target; never the event's details, and never an org's own events. limit is 1 to 100 (default 20); pages by keyset: pass the returned next as params.after (null: no more).",
194
- input: AuditListQuery.strict(),
193
+ description: "The platform-level audit log (super admin), newest first: deployment settings, accounts, marketplaces, catalog imports and scope, extensions, model prices and purposes, setup. Each event has its id, time, actor (id, name, email; null for the kernel itself), viaToken (done with a personal access token), viaAgent (done through the Platform tool), action and target; never the event's details, and never an org's own events (an org's log is orgs.audit, in that org). action filters by an action name or its prefix (e.g. marketplace.). limit is 1 to 100 (default 20); pages by keyset: pass the returned next as params.after (null: no more).",
194
+ // Another org's events are never read through an agent (the conversation's org: orgs.audit).
195
+ // The route's `orgId` query field is left out; parity treats `orgId` as implicit (never an
196
+ // operation field), so it needs no `omits` entry.
197
+ input: AuditListQuery.omit({ orgId: true }).strict(),
195
198
  example: { limit: 20 },
196
199
  authz: { superAdmin: true },
197
200
  mirrors: ["GET /api/v1/admin/audit"],
198
201
  confirm: "read",
199
- run: (input) => this.audit.list(input),
202
+ run: (input) => this.audit.list({ platform: true }, input),
200
203
  }),
201
204
  defineOperation({
202
205
  id: "admin.settings",
@@ -538,7 +541,7 @@ AdminOperations = __decorate([
538
541
  __param(6, Inject(PricesService)),
539
542
  __param(7, Inject(ModelPurposesService)),
540
543
  __param(8, Inject(ThemesService)),
541
- __param(9, Inject(PlatformAuditService)),
544
+ __param(9, Inject(AuditLogService)),
542
545
  __param(10, Inject(AdminOverviewService)),
543
546
  __param(11, Inject(AdminHealthService)),
544
547
  __param(12, Inject(AdminUsageService))
@@ -696,7 +696,7 @@ let AgentsOperations = class AgentsOperations {
696
696
  }),
697
697
  defineOperation({
698
698
  id: "agents.readiness",
699
- description: "Whether the org can run agents: modelProvider is ready when a model provider is available in the org (none otherwise); orgCanAddModel is true when an org admin can make one available on the org's extensions page (switch on a provider the platform offers, or fill its org config), false when only the super admin can; and how many agents you can see.",
699
+ description: "Whether the org can run agents: modelProvider is ready when a model provider is available in the org; org_fixable when an org admin can make one available on Settings > Models (orgFixableProviders names each provider and its reason: not_enabled, switch it on; needs_config, fill the org's config); none when only the super admin can help; and how many agents you can see.",
700
700
  input: z.object({}).strict(),
701
701
  example: {},
702
702
  authz: { orgAction: "org.read" },
@@ -10,7 +10,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
10
10
  import { Inject, Injectable } from "@nestjs/common";
11
11
  import { z } from "zod";
12
12
  import { ComponentScopeService } from "../../catalog/component-scope.service.js";
13
- import { ConnectorPathParams } from "../../tools/connectors.schemas.js";
13
+ import { ConnectorPathParams, GitPushPolicyBody } from "../../tools/connectors.schemas.js";
14
14
  import { ConnectorsService, } from "../../tools/connectors.service.js";
15
15
  import { publicEndpoint } from "../../tools/endpoint.js";
16
16
  import { defineOperation } from "../operation.js";
@@ -19,6 +19,11 @@ import { precheckBy, viaAgent } from "./errors.js";
19
19
  import { Cursor, pageOf, startOf } from "./paging.js";
20
20
  import { named, orElse } from "./summary.js";
21
21
  const PAGE = 50;
22
+ /** `connectors.set-git-push-policy`: the route's path param and body. */
23
+ const SetGitPushPolicyInput = z
24
+ .object({ connectorId: ConnectorPathParams.shape.connectorId.max(100) })
25
+ .extend(GitPushPolicyBody.shape)
26
+ .strict();
22
27
  /**
23
28
  * A connector without anything secret: the auth method and who holds the credential (the org or
24
29
  * each person), never the auth preset's fields or a credential. The endpoint is always the public
@@ -42,6 +47,8 @@ const summary = (c) => ({
42
47
  /** A connector's detail: its tools (name, description, state, default policy) and your credential state. */
43
48
  const detail = (c) => ({
44
49
  ...summary(c),
50
+ // the org's default for git pushes through its credential, when it serves git hosts
51
+ gitPushPolicy: c.git !== null ? c.gitPushPolicy : null,
45
52
  credential: c.credential,
46
53
  tools: c.tools.map((t) => ({
47
54
  name: t.name,
@@ -178,6 +185,44 @@ let ConnectorsOperations = class ConnectorsOperations {
178
185
  return { connector: detail(r.connector), issues: r.issues, changes: r.changes };
179
186
  },
180
187
  }),
188
+ defineOperation({
189
+ id: "connectors.set-git-push-policy",
190
+ description: "Set the org's default for git pushes through a connector's credential in sandboxes (org admins): deny refuses every push, ask asks the person for each repository, allow pushes without asking. Through this tool it may only be tightened (allow to ask or deny, ask to deny); loosening needs a person on the connector's settings page. Only a connector that declares git hosts.",
191
+ input: SetGitPushPolicyInput,
192
+ example: { connectorId: "5d2e8f1a-0b3c-4d5e-8f9a-1b2c3d4e5f60", policy: "deny" },
193
+ authz: { orgAction: "connectors.manage" },
194
+ mirrors: ["PUT /api/v1/orgs/:orgId/connectors/:connectorId/git-push-policy"],
195
+ confirm: "org",
196
+ errors: [
197
+ { code: "connector.not_found", next: "Check the connector id with connectors.list." },
198
+ {
199
+ code: "connector.git_push_widen_not_allowed",
200
+ next: {
201
+ orgAdmin: "Loosen the git push policy yourself on the connector's settings page on the web.",
202
+ member: "Ask an org admin to loosen the git push policy on the connector's settings page on the web.",
203
+ },
204
+ },
205
+ {
206
+ code: "validation_failed",
207
+ next: "The connector declares no git hosts, so it has no git push policy; connectors.get shows gitPushPolicy null for such a connector.",
208
+ },
209
+ ],
210
+ precheck: (i, ctx) => precheckBy(() => this.connectors.checkGitPushPolicy(ctx.orgId, i.connectorId, i.policy, true)),
211
+ summary: async (i, ctx) => {
212
+ const n = await this.connectorName(ctx, i.connectorId);
213
+ const zh = { allow: "允许", ask: "需审批", deny: "禁止" }[i.policy];
214
+ return {
215
+ zh: `把连接器「${n}」的 git 推送默认策略设为「${zh}」`,
216
+ en: `Set the default git push policy of connector "${n}" to ${i.policy}`,
217
+ };
218
+ },
219
+ run: async (input, ctx) => ({
220
+ connector: detail(await this.connectors.setGitPushPolicy(ctx.orgId, input.connectorId, ctx.actorAccountId, input.policy, {
221
+ auditDetail: viaAgent("connectors.set-git-push-policy", ctx),
222
+ onlyNarrows: true,
223
+ })),
224
+ }),
225
+ }),
181
226
  ]);
182
227
  }
183
228
  };
@@ -313,70 +313,7 @@ let EvalsOperations = class EvalsOperations {
313
313
  },
314
314
  ],
315
315
  precheck: async (i, ctx) => {
316
- const found = await this.setCheck(ctx, i.setId);
317
- if (!found.ok)
318
- return found;
319
- const set = await this.sets.get(ctx.orgId, i.setId);
320
- const conv = await this.kdb.db
321
- .selectFrom("conversations")
322
- .select(["agent_id", "kind"])
323
- .where("id", "=", i.conversationId)
324
- .where("org_id", "=", ctx.orgId)
325
- .executeTakeFirst();
326
- if (conv?.kind !== "chat" && conv?.kind !== "subagent") {
327
- return {
328
- ok: false,
329
- code: "conversation.not_found",
330
- message: "Conversation or run not found",
331
- };
332
- }
333
- const sets = await this.kdb.db
334
- .selectFrom("eval_sets")
335
- .select("agent_id")
336
- .where("id", "=", i.setId)
337
- .executeTakeFirstOrThrow();
338
- if (conv.agent_id !== sets.agent_id) {
339
- return {
340
- ok: false,
341
- code: "eval.agent_mismatch",
342
- message: "The run belongs to a different agent",
343
- };
344
- }
345
- if (set.cases.some((c) => c.sourceRunId === i.runId)) {
346
- return {
347
- ok: false,
348
- code: "eval.case_exists",
349
- message: "That run is already a case of the eval set",
350
- };
351
- }
352
- const run = await this.kdb.db
353
- .selectFrom("runs")
354
- .select(["status", "compact"])
355
- .where("id", "=", i.runId)
356
- .where("conversation_id", "=", i.conversationId)
357
- .executeTakeFirst();
358
- if (run === undefined) {
359
- return {
360
- ok: false,
361
- code: "conversation.not_found",
362
- message: "Conversation or run not found",
363
- };
364
- }
365
- if (run.compact) {
366
- return {
367
- ok: false,
368
- code: "eval.compact_not_replayable",
369
- message: "A manual compaction run has no model step to replay",
370
- };
371
- }
372
- if (run.status === "running" || run.status === "queued") {
373
- return {
374
- ok: false,
375
- code: "eval.run_not_finished",
376
- message: "The run has not finished yet",
377
- };
378
- }
379
- return this.roomCheck(ctx, i.setId);
316
+ return precheckBy(() => this.sets.checkAddCase(ctx.orgId, i.setId, i));
380
317
  },
381
318
  summary: async (i, ctx) => {
382
319
  const n = await this.setName(ctx, i.setId);
@@ -132,7 +132,7 @@ let ExtensionsAdminOperations = class ExtensionsAdminOperations {
132
132
  this.registry.register([
133
133
  defineOperation({
134
134
  id: "extensions.platform-list",
135
- description: "List the extensions on the platform (super admin), one compact row each: the deployment status (enabled, disabled, pending_approval, pending_config, pending_migration, converging, failed, dependency, conflict, legacy_format), why one does not run (reason) and your next step (next), its version, how many orgs have it on and whether it is required. Extensions only other orgs' own plugins bring are counted (otherOrgExtensions), never listed. Details come from extensions.platform-get. Pages by 50: pass the returned next as params.cursor.",
135
+ description: "List the extensions on the platform (super admin), one compact row each: the deployment status (enabled, disabled, pending_approval, pending_config, pending_migration, converging, failed, dependency, conflict), why one does not run (reason) and your next step (next), its version, how many orgs have it on and whether it is required. Extensions only other orgs' own plugins bring are counted (otherOrgExtensions), never listed. Details come from extensions.platform-get. Pages by 50: pass the returned next as params.cursor.",
136
136
  input: z.object({ cursor: Cursor.optional() }).strict(),
137
137
  example: {},
138
138
  authz: { superAdmin: true },
@@ -180,6 +180,16 @@ function platformRow(i) {
180
180
  next: "Open the plugin in the admin console to see the error and retry.",
181
181
  };
182
182
  }
183
+ case "extension_disabled": {
184
+ const d = i.disabled;
185
+ return {
186
+ ...base,
187
+ name: d.item.name,
188
+ state: "disabled",
189
+ summary: `Plugin ${d.item.name} is on by its scope, but its extension ${d.extension.name} ${d.extension.version} is disabled on the deployment, so it is installed in no org that lacks it.`,
190
+ next: "Enable the extension in the admin console (or disable another provider of its single-provider extension point first); the enable syncs the plugin's scope.",
191
+ };
192
+ }
183
193
  case "ownership_transferred":
184
194
  return {
185
195
  ...base,
@@ -307,7 +317,7 @@ let InboxOperations = class InboxOperations {
307
317
  }),
308
318
  defineOperation({
309
319
  id: "inbox.platform-list",
310
- 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 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.",
320
+ 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.",
311
321
  input: z.object({ cursor: Cursor.optional() }).strict(),
312
322
  example: {},
313
323
  authz: { superAdmin: true },
@@ -320,7 +330,9 @@ let InboxOperations = class InboxOperations {
320
330
  ? [i.item.id]
321
331
  : i.type === "scope_sync_failed"
322
332
  ? [i.failure.item.id]
323
- : []);
333
+ : i.type === "extension_disabled"
334
+ ? [i.disabled.item.id]
335
+ : []);
324
336
  const owners = await this.owners(itemIds);
325
337
  const theirs = (itemId) => {
326
338
  const o = owners.get(itemId);
@@ -328,7 +340,8 @@ let InboxOperations = class InboxOperations {
328
340
  };
329
341
  const shown = view.items.filter((i) => !(((i.type === "org_upload_pending" || i.type === "permission_confirmation") &&
330
342
  theirs(i.item.id)) ||
331
- (i.type === "scope_sync_failed" && theirs(i.failure.item.id))));
343
+ (i.type === "scope_sync_failed" && theirs(i.failure.item.id)) ||
344
+ (i.type === "extension_disabled" && theirs(i.disabled.item.id))));
332
345
  const page = pageOf(shown.map(platformRow), startOf(input.cursor), 50);
333
346
  // total is the console's count of everything waiting (other orgs' items included): when
334
347
  // the inbox is truncated the items past the newest 100 cannot be told apart, so the
@@ -101,7 +101,7 @@ let OrgPluginsOperations = class OrgPluginsOperations {
101
101
  this.registry.register([
102
102
  defineOperation({
103
103
  id: "plugins.installs",
104
- description: "List the plugin installs of this org (org admins), one compact row each: the plugin, the install state (installing, installed, failed, uninstalling, upgrading), a failure's step and code (reason), the version and how many components it brought. Pages by 50: pass the returned next as params.cursor.",
104
+ description: "List the plugin installs of this org (org admins), one compact row each: the plugin, the install state (installing, installed, failed, uninstalling), a failure's step and code (reason), the version and how many components it brought. Pages by 50: pass the returned next as params.cursor.",
105
105
  input: z.object({ cursor: Cursor.optional() }).strict(),
106
106
  example: {},
107
107
  authz: { orgAction: "org.extensions.manage" },
@@ -1,16 +1,19 @@
1
1
  import { type OnModuleInit } from "@nestjs/common";
2
+ import { AuditLogService } from "../../admin/audit-log.service.js";
3
+ import { OrgNetworkAdmin } from "../../admin/org-network.service.js";
2
4
  import { AccountsService } from "../../identity/accounts.js";
3
5
  import { SettingsService } from "../../identity/settings.js";
4
6
  import { KernelConfigService } from "../../infra/config/kernel-config.service.js";
5
7
  import { KernelDb } from "../../infra/database/kernel-db.js";
6
8
  import { MembersService } from "../../orgs/members.service.js";
9
+ import { OrgNetworkAllowances } from "../../orgs/network-allowances.service.js";
7
10
  import { OrgsService } from "../../orgs/orgs.service.js";
8
11
  import { PlatformOperations } from "../registry.js";
9
12
  /**
10
13
  * Org operations of the `Platform` tool (spec §14.2): the super admin's view of every org (list,
11
14
  * get, the per-org limits) through their own private agent, and the conversation's org for its
12
- * members (read, rename, member list). Creating, deleting and transferring an org, invitations,
13
- * member role changes and removal stay on the web (human-only).
15
+ * members (read, rename, member list, the org audit log for its admins). Creating, deleting and
16
+ * transferring an org, invitations, member role changes and removal stay on the web (human-only).
14
17
  */
15
18
  export declare class OrgsOperations implements OnModuleInit {
16
19
  private readonly registry;
@@ -20,9 +23,14 @@ export declare class OrgsOperations implements OnModuleInit {
20
23
  private readonly accounts;
21
24
  private readonly config;
22
25
  private readonly kdb;
23
- constructor(registry: PlatformOperations, orgs: OrgsService, members: MembersService, settings: SettingsService, accounts: AccountsService, config: KernelConfigService, kdb: KernelDb);
26
+ private readonly audit;
27
+ private readonly networkAdmin;
28
+ private readonly allowances;
29
+ constructor(registry: PlatformOperations, orgs: OrgsService, members: MembersService, settings: SettingsService, accounts: AccountsService, config: KernelConfigService, kdb: KernelDb, audit: AuditLogService, networkAdmin: OrgNetworkAdmin, allowances: OrgNetworkAllowances);
24
30
  private org;
25
31
  /** The actor as `OrgsService.update` takes it (it re-checks the role under the org lock). */
26
32
  private actor;
33
+ /** The org's allowance `id` (for a card and the remove precheck); none → the remove's 404. */
34
+ private allowance;
27
35
  onModuleInit(): void;
28
36
  }
@@ -9,14 +9,19 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
9
9
  };
10
10
  import { Inject, Injectable } from "@nestjs/common";
11
11
  import { z } from "zod";
12
+ import { OrgAuditListQuery } from "../../admin/audit.schemas.js";
13
+ import { AuditLogService } from "../../admin/audit-log.service.js";
12
14
  import { limitDefaults } from "../../admin/limit-defaults.js";
15
+ import { NetworkAllowanceBody, NetworkAllowanceParams } from "../../admin/org-network.schemas.js";
16
+ import { OrgNetworkAdmin } from "../../admin/org-network.service.js";
13
17
  import { ApiError } from "../../errors.js";
14
18
  import { AccountsService } from "../../identity/accounts.js";
15
19
  import { DEPLOYMENT_SETTINGS_PATCH, SettingsService } from "../../identity/settings.js";
16
20
  import { KernelConfigService } from "../../infra/config/kernel-config.service.js";
17
21
  import { KernelDb } from "../../infra/database/kernel-db.js";
18
22
  import { MembersService } from "../../orgs/members.service.js";
19
- import { OrgUpdateBody } from "../../orgs/orgs.schemas.js";
23
+ import { OrgNetworkAllowances } from "../../orgs/network-allowances.service.js";
24
+ import { networkAllowanceView, OrgUpdateBody } from "../../orgs/orgs.schemas.js";
20
25
  import { OrgsService } from "../../orgs/orgs.service.js";
21
26
  import { defineOperation } from "../operation.js";
22
27
  import { PlatformOperations } from "../registry.js";
@@ -43,8 +48,8 @@ async function limitsOf(settings, orgId) {
43
48
  /**
44
49
  * Org operations of the `Platform` tool (spec §14.2): the super admin's view of every org (list,
45
50
  * get, the per-org limits) through their own private agent, and the conversation's org for its
46
- * members (read, rename, member list). Creating, deleting and transferring an org, invitations,
47
- * member role changes and removal stay on the web (human-only).
51
+ * members (read, rename, member list, the org audit log for its admins). Creating, deleting and
52
+ * transferring an org, invitations, member role changes and removal stay on the web (human-only).
48
53
  */
49
54
  let OrgsOperations = class OrgsOperations {
50
55
  registry;
@@ -54,7 +59,10 @@ let OrgsOperations = class OrgsOperations {
54
59
  accounts;
55
60
  config;
56
61
  kdb;
57
- constructor(registry, orgs, members, settings, accounts, config, kdb) {
62
+ audit;
63
+ networkAdmin;
64
+ allowances;
65
+ constructor(registry, orgs, members, settings, accounts, config, kdb, audit, networkAdmin, allowances) {
58
66
  this.registry = registry;
59
67
  this.orgs = orgs;
60
68
  this.members = members;
@@ -62,6 +70,9 @@ let OrgsOperations = class OrgsOperations {
62
70
  this.accounts = accounts;
63
71
  this.config = config;
64
72
  this.kdb = kdb;
73
+ this.audit = audit;
74
+ this.networkAdmin = networkAdmin;
75
+ this.allowances = allowances;
65
76
  }
66
77
  async org(orgId) {
67
78
  const o = await this.orgs.get(orgId);
@@ -76,6 +87,14 @@ let OrgsOperations = class OrgsOperations {
76
87
  throw new ApiError("forbidden", "Your account no longer exists");
77
88
  return a;
78
89
  }
90
+ /** The org's allowance `id` (for a card and the remove precheck); none → the remove's 404. */
91
+ async allowance(orgId, id) {
92
+ const a = (await this.networkAdmin.list(orgId)).find((x) => x.id === id);
93
+ if (!a) {
94
+ throw new ApiError("org.network_allowance_not_found", "The organization has no such internal endpoint allowance");
95
+ }
96
+ return a;
97
+ }
79
98
  onModuleInit() {
80
99
  this.registry.register([
81
100
  defineOperation({
@@ -211,6 +230,108 @@ let OrgsOperations = class OrgsOperations {
211
230
  };
212
231
  },
213
232
  }),
233
+ defineOperation({
234
+ id: "admin.org-network-allowances",
235
+ description: "List an org's internal endpoint allowances (super admin): the hosts, wildcards, IPs or CIDRs and origins the org's extension requests may reach although they resolve to private or loopback addresses, oldest first, each with its id, entry and when it was added. Add one with admin.org-network-allowance-add, remove one with admin.org-network-allowance-remove.",
236
+ input: z.object({ orgId: OrgId }).strict(),
237
+ example: { orgId: "00000000-0000-4000-8000-000000000000" },
238
+ authz: { superAdmin: true },
239
+ mirrors: ["GET /api/v1/admin/orgs/:orgId/network-allowances"],
240
+ extras: ["orgId"],
241
+ confirm: "read",
242
+ errors: [
243
+ {
244
+ code: "org.not_found",
245
+ next: "Look the org up with orgs.list and pass its id.",
246
+ },
247
+ ],
248
+ run: async (input) => ({
249
+ allowances: (await this.networkAdmin.list(input.orgId)).map(networkAllowanceView),
250
+ }),
251
+ }),
252
+ defineOperation({
253
+ id: "admin.org-network-allowance-add",
254
+ description: "Let an org's extension requests reach an internal endpoint (super admin): entry is a hostname or *.domain wildcard (https, any port), an IP address or CIDR such as 10.1.0.0/16 (IP-literal URLs only), or an origin such as http://mcp.internal:8080 (exactly that scheme, host and port; plain http allowed). Link-local (cloud metadata), loopback and unspecified addresses are never allowed. Only a person widens: through this tool the add is always refused, and the super admin adds the endpoint in the admin console on the web; listing and removing work here.",
255
+ input: NetworkAllowanceBody.extend({ orgId: OrgId }).strict(),
256
+ example: {
257
+ orgId: "00000000-0000-4000-8000-000000000000",
258
+ entry: "http://mcp.internal:8080",
259
+ },
260
+ authz: { superAdmin: true },
261
+ mirrors: ["POST /api/v1/admin/orgs/:orgId/network-allowances"],
262
+ extras: ["orgId"],
263
+ confirm: "platform",
264
+ errors: [
265
+ {
266
+ code: "org.not_found",
267
+ next: "Look the org up with orgs.list and pass its id.",
268
+ },
269
+ {
270
+ code: "org.network_allowance_widen_not_allowed",
271
+ next: "Add the internal endpoint yourself on the org's page in the admin console on the web.",
272
+ },
273
+ ],
274
+ precheck: (i) => precheckBy(() => this.networkAdmin.checkAdd(i.orgId, i.entry, true)),
275
+ summary: async (i) => {
276
+ const name = await orElse(async () => named((await this.org(i.orgId)).name), i.orgId);
277
+ const entry = named(i.entry.trim());
278
+ return {
279
+ zh: `允许组织「${name}」的扩展请求访问内部端点 ${entry}`,
280
+ en: `Let the extension requests of org "${name}" reach the internal endpoint ${entry}`,
281
+ };
282
+ },
283
+ run: async (input, ctx) => ({
284
+ allowance: networkAllowanceView(await this.networkAdmin.add(input.orgId, input.entry, { accountId: ctx.actorAccountId }, true, viaAgent("admin.org-network-allowance-add", ctx))),
285
+ }),
286
+ }),
287
+ defineOperation({
288
+ id: "admin.org-network-allowance-remove",
289
+ description: "Remove one of an org's internal endpoint allowances (super admin) by its id (admin.org-network-allowances): the org's extension requests to that endpoint are refused from the next request on. The org's audit log records it.",
290
+ input: NetworkAllowanceParams.extend({ orgId: OrgId }).strict(),
291
+ example: {
292
+ orgId: "00000000-0000-4000-8000-000000000000",
293
+ id: "00000000-0000-4000-8000-000000000001",
294
+ },
295
+ authz: { superAdmin: true },
296
+ mirrors: ["DELETE /api/v1/admin/orgs/:orgId/network-allowances/:id"],
297
+ extras: ["orgId"],
298
+ confirm: "platform",
299
+ errors: [
300
+ {
301
+ code: "org.not_found",
302
+ next: "Look the org up with orgs.list and pass its id.",
303
+ },
304
+ {
305
+ code: "org.network_allowance_not_found",
306
+ next: "List the org's allowances again with admin.org-network-allowances and pass one of their ids.",
307
+ },
308
+ ],
309
+ precheck: (i) => precheckBy(() => this.allowance(i.orgId, i.id)),
310
+ summary: async (i) => {
311
+ const name = await orElse(async () => named((await this.org(i.orgId)).name), i.orgId);
312
+ const entry = await orElse(async () => named((await this.allowance(i.orgId, i.id)).entry), i.id);
313
+ return {
314
+ zh: `移除组织「${name}」的内部端点 ${entry},该组织的扩展请求将无法再访问它`,
315
+ en: `Remove the internal endpoint ${entry} of org "${name}"; the org's extension requests can no longer reach it`,
316
+ };
317
+ },
318
+ run: async (input, ctx) => {
319
+ await this.networkAdmin.remove(input.orgId, input.id, { accountId: ctx.actorAccountId }, viaAgent("admin.org-network-allowance-remove", ctx));
320
+ return { id: input.id, removed: true };
321
+ },
322
+ }),
323
+ defineOperation({
324
+ id: "orgs.network-allowances",
325
+ description: "Read this conversation's org's internal endpoint allowances (org admins, read-only): the hosts, wildcards, IPs or CIDRs and origins a super admin lets the org's extension requests reach although they resolve to private or loopback addresses. An extension request to an internal endpoint not listed is refused; only a super admin can add one.",
326
+ input: z.object({}).strict(),
327
+ example: {},
328
+ authz: { orgAction: "org.update" },
329
+ mirrors: ["GET /api/v1/orgs/:orgId/network-allowances"],
330
+ confirm: "read",
331
+ run: async (_input, ctx) => ({
332
+ allowances: (await this.allowances.list(ctx.orgId)).map(networkAllowanceView),
333
+ }),
334
+ }),
214
335
  defineOperation({
215
336
  id: "orgs.current",
216
337
  description: "Read this conversation's org: its id, name, slug, when it was created, and your role in it.",
@@ -285,6 +406,16 @@ let OrgsOperations = class OrgsOperations {
285
406
  ...(m.anonymous && { anonymous: true }),
286
407
  })), startOf(input.cursor), PAGE),
287
408
  }),
409
+ defineOperation({
410
+ id: "orgs.audit",
411
+ description: "The audit log of this conversation's org (org admins), newest first: members and invitations, settings, agents, connectors, skills, plugins and extensions in the org, channels, schedules. Each event has its id, time, actor (id, name, email; null for the kernel itself), viaToken (done with a personal access token), viaAgent (done through the Platform tool), action and target; never the event's details. action filters by an action name or its prefix (e.g. org.member.). limit is 1 to 100 (default 20); pages by keyset: pass the returned next as params.after (null: no more).",
412
+ input: OrgAuditListQuery.strict(),
413
+ example: { limit: 20 },
414
+ authz: { orgAction: "org.update" },
415
+ mirrors: ["GET /api/v1/orgs/:orgId/audit"],
416
+ confirm: "read",
417
+ run: (input, ctx) => this.audit.list({ orgId: ctx.orgId }, input),
418
+ }),
288
419
  ]);
289
420
  }
290
421
  };
@@ -296,6 +427,9 @@ OrgsOperations = __decorate([
296
427
  __param(3, Inject(SettingsService)),
297
428
  __param(4, Inject(AccountsService)),
298
429
  __param(5, Inject(KernelConfigService)),
299
- __param(6, Inject(KernelDb))
430
+ __param(6, Inject(KernelDb)),
431
+ __param(7, Inject(AuditLogService)),
432
+ __param(8, Inject(OrgNetworkAdmin)),
433
+ __param(9, Inject(OrgNetworkAllowances))
300
434
  ], OrgsOperations);
301
435
  export { OrgsOperations };
@@ -9,7 +9,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
9
9
  };
10
10
  import { Inject, Injectable } from "@nestjs/common";
11
11
  import { z } from "zod";
12
- import { OutboxDeadParams } from "../../admin/outbox-dead.schemas.js";
12
+ import { OutboxDeadListQuery, OutboxDeadParams } from "../../admin/outbox-dead.schemas.js";
13
13
  import { OutboxDeadService } from "../../admin/outbox-dead.service.js";
14
14
  import { KernelDb } from "../../infra/database/kernel-db.js";
15
15
  import { defineOperation } from "../operation.js";
@@ -54,13 +54,13 @@ let OutboxOperations = class OutboxOperations {
54
54
  this.registry.register([
55
55
  defineOperation({
56
56
  id: "admin.outbox-list-dead",
57
- description: "List background work the kernel could not queue (super admin): outbox rows dead after their last delivery attempt, oldest first (at most 200), each with its id, queue, job name, job id, org (null for platform work), attempts, last error and when it died. Retry one with admin.outbox-retry or drop it with admin.outbox-discard.",
58
- input: z.object({}).strict(),
59
- example: {},
57
+ description: "List background work the kernel could not queue (super admin): outbox rows dead after their last delivery attempt, oldest first, a page of at most 200 (pass the returned next as after for the following page; next is null at the end), each with its id, queue, job name, job id, org (null for platform work), attempts, last error and when it died. Retry one with admin.outbox-retry or drop it with admin.outbox-discard.",
58
+ input: OutboxDeadListQuery.strict(),
59
+ example: { limit: 200 },
60
60
  authz: { superAdmin: true },
61
61
  mirrors: ["GET /api/v1/admin/outbox/dead"],
62
62
  confirm: "read",
63
- run: () => this.dead.list(),
63
+ run: (input) => this.dead.list(input),
64
64
  }),
65
65
  defineOperation({
66
66
  id: "admin.outbox-retry",
@@ -2,6 +2,7 @@ import { ADMIN_ROUTES } from "../admin/admin.schemas.js";
2
2
  import { ADMIN_ITEM_ROUTES } from "../admin/admin-items.schemas.js";
3
3
  import { AUDIT_ROUTES } from "../admin/audit.schemas.js";
4
4
  import { ADMIN_EXTENSION_ROUTES } from "../admin/extensions.schemas.js";
5
+ import { ORG_NETWORK_ROUTES } from "../admin/org-network.schemas.js";
5
6
  import { OUTBOX_DEAD_ROUTES } from "../admin/outbox-dead.schemas.js";
6
7
  import { OVERVIEW_ROUTES } from "../admin/overview.schemas.js";
7
8
  import { AGENT_ROUTES } from "../agents/agents.schemas.js";
@@ -88,4 +89,6 @@ export const ROUTE_SCHEMAS = [
88
89
  ...AUDIT_ROUTES,
89
90
  // dead outbox rows (transactional outbox spec §3.4)
90
91
  ...OUTBOX_DEAD_ROUTES,
92
+ // org network allowances (plugin safe fetch spec)
93
+ ...ORG_NETWORK_ROUTES,
91
94
  ];
@@ -49,10 +49,9 @@ export declare class WorkerRole {
49
49
  * Starts the queue consumers (after the extension load), then opens the schedules' start gate:
50
50
  * the cron and interval timers were armed at application bootstrap, but every tick before this
51
51
  * point skipped (decision R21 of the Nest kernel spec); the `@LockedInterval({ runOnStart })`
52
- * jobs run now, in the background (once across replicas starting together). `checkpoint` throws
53
- * when a stop began meanwhile.
52
+ * jobs run now, in the background (once across replicas starting together).
54
53
  */
55
- start(checkpoint: () => void): Promise<void>;
54
+ start(): void;
56
55
  /**
57
56
  * Closes the start gate and stops the schedulers (no new tick; the runs in progress get the stop
58
57
  * signal) and returns the wait for those runs, at most `budgetMs`.
@@ -78,25 +78,15 @@ let WorkerRole = class WorkerRole {
78
78
  * Starts the queue consumers (after the extension load), then opens the schedules' start gate:
79
79
  * the cron and interval timers were armed at application bootstrap, but every tick before this
80
80
  * point skipped (decision R21 of the Nest kernel spec); the `@LockedInterval({ runOnStart })`
81
- * jobs run now, in the background (once across replicas starting together). `checkpoint` throws
82
- * when a stop began meanwhile.
81
+ * jobs run now, in the background (once across replicas starting together).
83
82
  */
84
- async start(checkpoint) {
83
+ start() {
85
84
  // both run queues' @Processor workers (built with the run config, never autorun)
86
85
  this.runWorker.start([this.runsProcessor.worker, this.subagentRunsProcessor.worker]);
87
86
  this.runsStarted = true;
88
87
  this.evalWorker.start(this.evalsProcessor.worker);
89
88
  this.evalsStarted = true;
90
- // The maintenance queue: remove the retired job schedulers (idempotent, harmless when several
91
- // replicas do it), then start its one consumer. A failure is only logged and does not stop the
92
- // start (like the workers' connection errors): any worker replica removes them on its next start.
93
- try {
94
- await this.maintenanceProcessor.removeRetiredSchedulers();
95
- }
96
- catch (err) {
97
- this.log.error("cannot register maintenance job schedulers", { err });
98
- }
99
- checkpoint();
89
+ // the maintenance queue's one consumer
100
90
  this.maintenanceProcessor.start();
101
91
  this.scopeProcessor.start();
102
92
  this.lifecycleProcessor.start();