@capybara-hq/kernel 0.1.0-rc.6 → 0.1.0-rc.7

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 (331) hide show
  1. package/bootstrap.json +27 -3
  2. package/dist/admin/admin.controller.d.ts +8 -72
  3. package/dist/admin/admin.controller.js +21 -46
  4. package/dist/admin/admin.schemas.d.ts +57 -0
  5. package/dist/admin/admin.schemas.js +50 -0
  6. package/dist/admin/extensions.controller.d.ts +10 -0
  7. package/dist/admin/extensions.controller.js +18 -0
  8. package/dist/admin/extensions.schemas.d.ts +7 -0
  9. package/dist/admin/extensions.schemas.js +10 -0
  10. package/dist/admin/limit-defaults.d.ts +20 -0
  11. package/dist/admin/limit-defaults.js +10 -0
  12. package/dist/agents/agent-profile.service.d.ts +7 -5
  13. package/dist/agents/agent-profile.service.js +14 -9
  14. package/dist/agents/agents.controller.d.ts +7 -287
  15. package/dist/agents/agents.controller.js +7 -67
  16. package/dist/agents/agents.schemas.d.ts +389 -0
  17. package/dist/agents/agents.schemas.js +126 -0
  18. package/dist/agents/agents.service.d.ts +13 -5
  19. package/dist/agents/agents.service.js +67 -13
  20. package/dist/agents/definition.d.ts +47 -19
  21. package/dist/agents/definition.js +119 -38
  22. package/dist/agents/from-template.d.ts +2 -2
  23. package/dist/agents/from-template.js +76 -45
  24. package/dist/agents/from-template.service.d.ts +12 -0
  25. package/dist/agents/from-template.service.js +20 -3
  26. package/dist/agents/models.controller.d.ts +1 -2
  27. package/dist/agents/models.controller.js +1 -1
  28. package/dist/agents/org-templates.d.ts +13 -3
  29. package/dist/agents/org-templates.js +69 -28
  30. package/dist/agents/pending-connector-requests.d.ts +2 -0
  31. package/dist/agents/pending-connector-requests.js +1 -1
  32. package/dist/agents/pending-connectors.controller.d.ts +1 -1
  33. package/dist/agents/pending-connectors.controller.js +2 -2
  34. package/dist/agents/pending-connectors.service.d.ts +2 -2
  35. package/dist/agents/pending-connectors.service.js +19 -19
  36. package/dist/agents/profile.d.ts +18 -0
  37. package/dist/agents/profile.js +5 -1
  38. package/dist/agents/templates.controller.d.ts +8 -17
  39. package/dist/agents/templates.controller.js +13 -31
  40. package/dist/agents/templates.schemas.d.ts +20 -0
  41. package/dist/agents/templates.schemas.js +45 -0
  42. package/dist/background/background.controller.js +3 -2
  43. package/dist/background/background.schemas.d.ts +10 -0
  44. package/dist/background/background.schemas.js +16 -0
  45. package/dist/background/tasks.service.d.ts +1 -1
  46. package/dist/background/tasks.service.js +7 -2
  47. package/dist/catalog/admin-catalog.controller.d.ts +4 -57
  48. package/dist/catalog/admin-catalog.controller.js +8 -45
  49. package/dist/catalog/admin-catalog.schemas.d.ts +72 -0
  50. package/dist/catalog/admin-catalog.schemas.js +92 -0
  51. package/dist/catalog/catalog-content.d.ts +12 -2
  52. package/dist/catalog/catalog-scope.service.js +8 -2
  53. package/dist/catalog/catalog.service.d.ts +2 -0
  54. package/dist/catalog/catalog.service.js +3 -0
  55. package/dist/catalog/component-scope.controller.d.ts +3 -65
  56. package/dist/catalog/component-scope.controller.js +3 -56
  57. package/dist/catalog/component-scope.schemas.d.ts +114 -0
  58. package/dist/catalog/component-scope.schemas.js +97 -0
  59. package/dist/catalog/component-scope.service.d.ts +28 -4
  60. package/dist/catalog/component-scope.service.js +55 -3
  61. package/dist/catalog/component-state.d.ts +9 -2
  62. package/dist/catalog/component-state.js +22 -13
  63. package/dist/catalog/marketplaces.controller.d.ts +5 -35
  64. package/dist/catalog/marketplaces.controller.js +6 -34
  65. package/dist/catalog/marketplaces.schemas.d.ts +48 -0
  66. package/dist/catalog/marketplaces.schemas.js +53 -0
  67. package/dist/catalog/marketplaces.service.d.ts +15 -1
  68. package/dist/catalog/marketplaces.service.js +22 -1
  69. package/dist/catalog/org-catalog.controller.d.ts +6 -62
  70. package/dist/catalog/org-catalog.controller.js +12 -66
  71. package/dist/catalog/org-catalog.schemas.d.ts +79 -0
  72. package/dist/catalog/org-catalog.schemas.js +82 -0
  73. package/dist/catalog/org-catalog.service.d.ts +9 -2
  74. package/dist/catalog/org-catalog.service.js +38 -5
  75. package/dist/catalog/org-extension.controller.d.ts +1 -12
  76. package/dist/catalog/org-extension.controller.js +1 -10
  77. package/dist/catalog/org-extension.schemas.d.ts +15 -0
  78. package/dist/catalog/org-extension.schemas.js +22 -0
  79. package/dist/catalog/org-plugin-uploads.controller.d.ts +2 -19
  80. package/dist/catalog/org-plugin-uploads.controller.js +15 -28
  81. package/dist/catalog/org-plugin-uploads.schemas.d.ts +20 -0
  82. package/dist/catalog/org-plugin-uploads.schemas.js +32 -0
  83. package/dist/catalog/owned-items.d.ts +6 -2
  84. package/dist/catalog/owned-items.js +16 -4
  85. package/dist/catalog/platform-components.d.ts +2 -0
  86. package/dist/catalog/platform-components.js +2 -0
  87. package/dist/catalog/plugin-import.js +1 -0
  88. package/dist/catalog/plugin-install.js +1 -1
  89. package/dist/catalog/requests.service.d.ts +2 -1
  90. package/dist/catalog/requests.service.js +6 -2
  91. package/dist/channels/channels.schemas.d.ts +33 -0
  92. package/dist/channels/channels.schemas.js +34 -0
  93. package/dist/channels/connections.controller.d.ts +2 -29
  94. package/dist/channels/connections.controller.js +1 -23
  95. package/dist/channels/connections.service.d.ts +8 -2
  96. package/dist/channels/connections.service.js +23 -5
  97. package/dist/channels/inbound.js +4 -0
  98. package/dist/conversations/conversations.controller.d.ts +16 -37
  99. package/dist/conversations/conversations.controller.js +16 -56
  100. package/dist/conversations/conversations.schemas.d.ts +52 -0
  101. package/dist/conversations/conversations.schemas.js +79 -0
  102. package/dist/conversations/conversations.service.d.ts +9 -1
  103. package/dist/conversations/conversations.service.js +23 -18
  104. package/dist/conversations/events.d.ts +80 -6
  105. package/dist/conversations/events.js +60 -5
  106. package/dist/conversations/message-context.d.ts +28 -0
  107. package/dist/conversations/message-context.js +56 -0
  108. package/dist/conversations/queue.d.ts +2 -1
  109. package/dist/conversations/queue.js +11 -2
  110. package/dist/db/kernel-schema.d.ts +20 -0
  111. package/dist/environments/environments.schemas.d.ts +3 -0
  112. package/dist/environments/environments.schemas.js +14 -0
  113. package/dist/environments/environments.service.d.ts +16 -4
  114. package/dist/environments/environments.service.js +58 -13
  115. package/dist/errors.d.ts +3 -0
  116. package/dist/errors.js +3 -0
  117. package/dist/evals/evals.schemas.d.ts +110 -0
  118. package/dist/evals/evals.schemas.js +107 -0
  119. package/dist/evals/reconstruct.js +18 -11
  120. package/dist/evals/recorded-tools.d.ts +2 -1
  121. package/dist/evals/recorded-tools.js +11 -3
  122. package/dist/evals/run-replay.d.ts +8 -1
  123. package/dist/evals/run-replay.js +13 -0
  124. package/dist/evals/runs.controller.d.ts +2 -57
  125. package/dist/evals/runs.controller.js +1 -42
  126. package/dist/evals/runs.service.d.ts +6 -6
  127. package/dist/evals/runs.service.js +32 -18
  128. package/dist/evals/sets.controller.d.ts +2 -28
  129. package/dist/evals/sets.controller.js +1 -31
  130. package/dist/evals/sets.service.d.ts +7 -7
  131. package/dist/evals/sets.service.js +23 -17
  132. package/dist/evals/snapshot.d.ts +3 -2
  133. package/dist/evals/snapshot.js +17 -4
  134. package/dist/extensions/admin-ops.d.ts +5 -3
  135. package/dist/extensions/admin-ops.js +17 -12
  136. package/dist/extensions/deployment-config.d.ts +16 -1
  137. package/dist/extensions/deployment-config.js +83 -0
  138. package/dist/extensions/extensions.module.js +3 -0
  139. package/dist/extensions/host.d.ts +33 -2
  140. package/dist/extensions/host.js +107 -1
  141. package/dist/extensions/installs.d.ts +5 -0
  142. package/dist/extensions/installs.js +12 -0
  143. package/dist/extensions/org-config.d.ts +17 -2
  144. package/dist/extensions/org-config.js +23 -4
  145. package/dist/extensions/point-defaults.controller.d.ts +2 -8
  146. package/dist/extensions/point-defaults.controller.js +1 -3
  147. package/dist/extensions/point-defaults.d.ts +3 -1
  148. package/dist/extensions/point-defaults.js +4 -2
  149. package/dist/extensions/point-defaults.schemas.d.ts +9 -0
  150. package/dist/extensions/point-defaults.schemas.js +14 -0
  151. package/dist/extensions/unavailable.d.ts +49 -0
  152. package/dist/extensions/unavailable.js +113 -0
  153. package/dist/files/previewers.controller.js +2 -3
  154. package/dist/files/previewers.d.ts +1 -1
  155. package/dist/files/previewers.js +4 -4
  156. package/dist/files/previewers.schemas.d.ts +10 -0
  157. package/dist/files/previewers.schemas.js +9 -0
  158. package/dist/http/api.module.js +2 -0
  159. package/dist/identity/accounts.d.ts +43 -4
  160. package/dist/identity/accounts.js +74 -6
  161. package/dist/identity/auth.guard.js +10 -1
  162. package/dist/identity/cookies.d.ts +6 -0
  163. package/dist/identity/cookies.js +14 -0
  164. package/dist/identity/identity.module.js +3 -0
  165. package/dist/identity/initial-passwords.controller.d.ts +22 -0
  166. package/dist/identity/initial-passwords.controller.js +49 -0
  167. package/dist/identity/initial-passwords.d.ts +61 -0
  168. package/dist/identity/initial-passwords.job.d.ts +16 -0
  169. package/dist/identity/initial-passwords.job.js +46 -0
  170. package/dist/identity/initial-passwords.js +159 -0
  171. package/dist/identity/me.controller.d.ts +14 -0
  172. package/dist/identity/me.controller.js +39 -1
  173. package/dist/identity/principal.d.ts +8 -0
  174. package/dist/identity/principal.js +8 -0
  175. package/dist/identity/settings.d.ts +3 -1
  176. package/dist/identity/settings.js +6 -4
  177. package/dist/inbox/inbox.schemas.d.ts +8 -0
  178. package/dist/inbox/inbox.schemas.js +11 -0
  179. package/dist/inbox/platform-inbox.controller.d.ts +1 -1
  180. package/dist/inbox/platform-inbox.controller.js +2 -2
  181. package/dist/index.d.ts +4 -0
  182. package/dist/index.js +6 -0
  183. package/dist/lifecycle/kernel-lifecycle.js +4 -0
  184. package/dist/models/enablement.d.ts +2 -0
  185. package/dist/models/enablement.js +1 -0
  186. package/dist/models/org-models.schemas.d.ts +8 -0
  187. package/dist/models/org-models.schemas.js +22 -0
  188. package/dist/models/prices.d.ts +3 -1
  189. package/dist/models/prices.js +7 -5
  190. package/dist/models/purposes.d.ts +12 -2
  191. package/dist/models/purposes.js +22 -8
  192. package/dist/orgs/orgs.controller.d.ts +2 -5
  193. package/dist/orgs/orgs.controller.js +3 -6
  194. package/dist/orgs/orgs.schemas.d.ts +8 -0
  195. package/dist/orgs/orgs.schemas.js +16 -0
  196. package/dist/orgs/orgs.service.d.ts +3 -1
  197. package/dist/orgs/orgs.service.js +6 -4
  198. package/dist/orgs/settings.service.d.ts +9 -1
  199. package/dist/orgs/settings.service.js +20 -5
  200. package/dist/overrides.d.ts +4 -0
  201. package/dist/overrides.js +2 -0
  202. package/dist/platform/errors.d.ts +21 -4
  203. package/dist/platform/errors.js +45 -6
  204. package/dist/platform/exclusions.d.ts +2 -3
  205. package/dist/platform/exclusions.js +68 -849
  206. package/dist/platform/method.js +1 -1
  207. package/dist/platform/operation.d.ts +82 -5
  208. package/dist/platform/operation.js +62 -7
  209. package/dist/platform/ops/accounts.ops.d.ts +32 -0
  210. package/dist/platform/ops/accounts.ops.js +291 -0
  211. package/dist/platform/ops/admin.ops.d.ts +36 -0
  212. package/dist/platform/ops/admin.ops.js +389 -0
  213. package/dist/platform/ops/agent-skills.ops.d.ts +24 -0
  214. package/dist/platform/ops/agent-skills.ops.js +226 -0
  215. package/dist/platform/ops/agent-templates.ops.d.ts +4 -1
  216. package/dist/platform/ops/agent-templates.ops.js +194 -14
  217. package/dist/platform/ops/agents.ops.d.ts +19 -1
  218. package/dist/platform/ops/agents.ops.js +481 -58
  219. package/dist/platform/ops/approvals.ops.d.ts +30 -0
  220. package/dist/platform/ops/approvals.ops.js +116 -0
  221. package/dist/platform/ops/background.ops.d.ts +14 -0
  222. package/dist/platform/ops/background.ops.js +134 -0
  223. package/dist/platform/ops/catalog-admin.ops.d.ts +74 -0
  224. package/dist/platform/ops/catalog-admin.ops.js +587 -0
  225. package/dist/platform/ops/channels.ops.d.ts +16 -0
  226. package/dist/platform/ops/channels.ops.js +195 -0
  227. package/dist/platform/ops/components.ops.d.ts +46 -0
  228. package/dist/platform/ops/components.ops.js +853 -0
  229. package/dist/platform/ops/connectors.ops.d.ts +4 -2
  230. package/dist/platform/ops/connectors.ops.js +68 -6
  231. package/dist/platform/ops/conversations.ops.d.ts +30 -0
  232. package/dist/platform/ops/conversations.ops.js +470 -0
  233. package/dist/platform/ops/environments.ops.d.ts +26 -0
  234. package/dist/platform/ops/environments.ops.js +289 -0
  235. package/dist/platform/ops/errors.d.ts +10 -5
  236. package/dist/platform/ops/errors.js +19 -11
  237. package/dist/platform/ops/evals.ops.d.ts +28 -0
  238. package/dist/platform/ops/evals.ops.js +783 -0
  239. package/dist/platform/ops/extensions-admin.ops.d.ts +25 -0
  240. package/dist/platform/ops/extensions-admin.ops.js +344 -0
  241. package/dist/platform/ops/extensions.ops.d.ts +7 -1
  242. package/dist/platform/ops/extensions.ops.js +248 -17
  243. package/dist/platform/ops/inbox.ops.d.ts +25 -0
  244. package/dist/platform/ops/inbox.ops.js +378 -0
  245. package/dist/platform/ops/marketplaces.ops.d.ts +7 -1
  246. package/dist/platform/ops/marketplaces.ops.js +326 -17
  247. package/dist/platform/ops/models.ops.d.ts +25 -0
  248. package/dist/platform/ops/models.ops.js +232 -0
  249. package/dist/platform/ops/org-plugins.ops.d.ts +29 -0
  250. package/dist/platform/ops/org-plugins.ops.js +329 -0
  251. package/dist/platform/ops/org-settings.ops.d.ts +16 -0
  252. package/dist/platform/ops/org-settings.ops.js +102 -0
  253. package/dist/platform/ops/orgs.ops.d.ts +28 -0
  254. package/dist/platform/ops/orgs.ops.js +295 -0
  255. package/dist/platform/ops/other-orgs.d.ts +20 -0
  256. package/dist/platform/ops/other-orgs.js +72 -0
  257. package/dist/platform/ops/platform.ops.d.ts +4 -4
  258. package/dist/platform/ops/platform.ops.js +23 -24
  259. package/dist/platform/ops/plugins.ops.d.ts +10 -8
  260. package/dist/platform/ops/plugins.ops.js +176 -77
  261. package/dist/platform/ops/previewers.ops.d.ts +14 -0
  262. package/dist/platform/ops/previewers.ops.js +109 -0
  263. package/dist/platform/ops/requests.ops.js +57 -19
  264. package/dist/platform/ops/skills.ops.d.ts +5 -1
  265. package/dist/platform/ops/skills.ops.js +129 -11
  266. package/dist/platform/ops/unavailable.d.ts +23 -0
  267. package/dist/platform/ops/unavailable.js +111 -0
  268. package/dist/platform/parity.d.ts +33 -0
  269. package/dist/platform/parity.js +272 -0
  270. package/dist/platform/platform-ops.module.d.ts +32 -0
  271. package/dist/platform/platform-ops.module.js +78 -11
  272. package/dist/platform/route-schemas.d.ts +18 -0
  273. package/dist/platform/route-schemas.js +60 -0
  274. package/dist/roles/worker.module.js +2 -0
  275. package/dist/runtime/context/build.d.ts +2 -0
  276. package/dist/runtime/context/build.js +28 -2
  277. package/dist/runtime/context/compaction.js +10 -1
  278. package/dist/runtime/context/run-context.d.ts +65 -0
  279. package/dist/runtime/context/run-context.js +215 -0
  280. package/dist/runtime/model-call.js +2 -1
  281. package/dist/runtime/providers.js +8 -1
  282. package/dist/runtime/run-context.service.d.ts +65 -0
  283. package/dist/runtime/run-context.service.js +220 -0
  284. package/dist/runtime/run-worker.d.ts +5 -0
  285. package/dist/runtime/run-worker.js +31 -6
  286. package/dist/runtime/runtime.module.js +2 -0
  287. package/dist/runtime/subagents/definition.d.ts +15 -15
  288. package/dist/runtime/subagents/definition.js +46 -115
  289. package/dist/skills/changes.controller.js +2 -1
  290. package/dist/skills/changes.service.d.ts +1 -1
  291. package/dist/skills/changes.service.js +4 -4
  292. package/dist/skills/invocable.controller.d.ts +1 -1
  293. package/dist/skills/invocable.controller.js +2 -2
  294. package/dist/skills/invoke.d.ts +2 -2
  295. package/dist/skills/invoke.js +8 -1
  296. package/dist/skills/skills.controller.d.ts +4 -13
  297. package/dist/skills/skills.controller.js +8 -24
  298. package/dist/skills/skills.schemas.d.ts +48 -0
  299. package/dist/skills/skills.schemas.js +61 -0
  300. package/dist/skills/skills.service.d.ts +11 -1
  301. package/dist/skills/skills.service.js +37 -14
  302. package/dist/time-zone.d.ts +5 -0
  303. package/dist/time-zone.js +19 -0
  304. package/dist/tools/approvals.controller.js +2 -3
  305. package/dist/tools/approvals.schemas.d.ts +21 -0
  306. package/dist/tools/approvals.schemas.js +15 -0
  307. package/dist/tools/builtin-names.d.ts +10 -8
  308. package/dist/tools/builtin-names.js +16 -11
  309. package/dist/tools/builtins/builtin-tools.d.ts +3 -1
  310. package/dist/tools/builtins/builtin-tools.js +15 -3
  311. package/dist/tools/builtins/current-time.d.ts +26 -0
  312. package/dist/tools/builtins/current-time.js +99 -0
  313. package/dist/tools/builtins/platform.d.ts +19 -2
  314. package/dist/tools/builtins/platform.js +105 -16
  315. package/dist/tools/connectors.controller.d.ts +1 -2
  316. package/dist/tools/connectors.controller.js +1 -4
  317. package/dist/tools/connectors.schemas.d.ts +12 -0
  318. package/dist/tools/connectors.schemas.js +19 -0
  319. package/dist/tools/connectors.service.d.ts +5 -2
  320. package/dist/tools/connectors.service.js +7 -5
  321. package/dist/tools/org-tool-switches.d.ts +16 -2
  322. package/dist/tools/org-tool-switches.js +26 -9
  323. package/dist/tools/pipeline.js +3 -1
  324. package/dist/tools/registry.d.ts +48 -51
  325. package/dist/tools/registry.js +222 -233
  326. package/package.json +3 -3
  327. package/src/migrations/0090_initial_passwords.sql +27 -0
  328. package/src/migrations/0091_account_time_zone.sql +4 -0
  329. package/src/migrations/0092_tools_default_on.sql +27 -0
  330. package/dist/platform/redact-orgs.d.ts +0 -7
  331. package/dist/platform/redact-orgs.js +0 -52
@@ -0,0 +1,30 @@
1
+ import { type OnModuleInit } from "@nestjs/common";
2
+ import { ApprovalsService, type ApprovalView } from "../../tools/approvals.service.js";
3
+ import { PlatformOperations } from "../registry.js";
4
+ /** Where a person decides an approval: never through an agent (spec §6.4, §14.1 item 2). */
5
+ export declare const DECIDE_ON_WEB = "Decide it on the web, in the inbox or in its conversation; agents never decide approvals.";
6
+ /**
7
+ * An approval as the waiting list shows it: a compact row with the summary the inbox shows (the
8
+ * kernel-rendered summary of a per-call policy, else null). Never the tool input: it may carry
9
+ * another person's data or credentials (Review Focus 5); the web shows it to the person deciding.
10
+ */
11
+ export declare const approvalRow: (a: ApprovalView) => {
12
+ id: string;
13
+ name: string;
14
+ state: import("../../tools/approvals.service.js").ApprovalStatus;
15
+ summary: string | null;
16
+ agent: string;
17
+ expiresAt: string;
18
+ next?: string;
19
+ };
20
+ /**
21
+ * The approval reads of the `Platform` tool (spec §14.1 item 2): what waits for my decision, as
22
+ * the inbox shows it. Deciding stays with the person on the web; `POST /approvals/:id/decision`
23
+ * and the standing grants (`/me/tool-grants`) are excluded as human-only.
24
+ */
25
+ export declare class ApprovalsOperations implements OnModuleInit {
26
+ private readonly registry;
27
+ private readonly approvals;
28
+ constructor(registry: PlatformOperations, approvals: ApprovalsService);
29
+ onModuleInit(): void;
30
+ }
@@ -0,0 +1,116 @@
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 { ApprovalPathParams, ApprovalsListQuerySchema } from "../../tools/approvals.schemas.js";
13
+ import { ApprovalsService } from "../../tools/approvals.service.js";
14
+ import { defineOperation } from "../operation.js";
15
+ import { PlatformOperations } from "../registry.js";
16
+ import { Cursor, pageOf, startOf } from "./paging.js";
17
+ /** Where a person decides an approval: never through an agent (spec §6.4, §14.1 item 2). */
18
+ export const DECIDE_ON_WEB = "Decide it on the web, in the inbox or in its conversation; agents never decide approvals.";
19
+ /**
20
+ * An approval as the waiting list shows it: a compact row with the summary the inbox shows (the
21
+ * kernel-rendered summary of a per-call policy, else null). Never the tool input: it may carry
22
+ * another person's data or credentials (Review Focus 5); the web shows it to the person deciding.
23
+ */
24
+ export const approvalRow = (a) => ({
25
+ id: a.id,
26
+ name: a.toolKey,
27
+ state: a.status,
28
+ summary: a.summary?.en ?? null,
29
+ agent: a.agent.name,
30
+ expiresAt: a.expiresAt,
31
+ ...(a.status === "pending" && { next: DECIDE_ON_WEB }),
32
+ });
33
+ /**
34
+ * One approval as `approvals.get` shows it: what was called, by which agent and conversation, its
35
+ * state and the scopes a decider may choose. Left out: the tool input, the spec hash and the call
36
+ * and run ids (the decision route's material, not a summary).
37
+ */
38
+ const detail = (a) => ({
39
+ id: a.id,
40
+ toolKey: a.toolKey,
41
+ toolName: a.toolName,
42
+ connector: a.connector === null ? null : { id: a.connector.id, name: a.connector.name },
43
+ extension: a.extension,
44
+ agent: a.agent,
45
+ conversationId: a.conversationId,
46
+ conversationPath: a.conversationPath,
47
+ ...(a.parentConversationId !== undefined && { parentConversationId: a.parentConversationId }),
48
+ initiatorAccountId: a.initiatorAccountId,
49
+ summary: a.summary,
50
+ status: a.status,
51
+ approverRole: a.approverRole,
52
+ scopes: a.scopes,
53
+ attempt: a.attempt,
54
+ denyReason: a.denyReason,
55
+ decidedAt: a.decidedAt,
56
+ expiresAt: a.expiresAt,
57
+ createdAt: a.createdAt,
58
+ ...(a.status === "pending" && { next: DECIDE_ON_WEB }),
59
+ });
60
+ /**
61
+ * The approval reads of the `Platform` tool (spec §14.1 item 2): what waits for my decision, as
62
+ * the inbox shows it. Deciding stays with the person on the web; `POST /approvals/:id/decision`
63
+ * and the standing grants (`/me/tool-grants`) are excluded as human-only.
64
+ */
65
+ let ApprovalsOperations = class ApprovalsOperations {
66
+ registry;
67
+ approvals;
68
+ constructor(registry, approvals) {
69
+ this.registry = registry;
70
+ this.approvals = approvals;
71
+ }
72
+ onModuleInit() {
73
+ this.registry.register([
74
+ defineOperation({
75
+ id: "approvals.waiting",
76
+ description: "List the tool call approvals you can decide in this org, newest first: your own runs' calls and, for org admins, other people's calls that need an admin. One compact row each (tool, state, the summary the inbox shows, agent, expiry); pending by default, or pass one status (pending, approved, denied, expired, cancelled; there is no \"all\": call once per status to see more). Never the call's input. Deciding is done by you on the web, never by an agent. Pages by 50: pass the returned next as params.cursor.",
77
+ input: z
78
+ .object({ status: ApprovalsListQuerySchema.shape.status, cursor: Cursor.optional() })
79
+ .strict(),
80
+ example: {},
81
+ authz: { orgAction: "approvals.decide" },
82
+ mirrors: ["GET /api/v1/orgs/:orgId/approvals"],
83
+ extras: ["cursor"],
84
+ confirm: "read",
85
+ run: async (input, ctx) => {
86
+ const all = await this.approvals.list(ctx.orgId, ctx.actorAccountId, input.status ?? "pending");
87
+ return pageOf(all.map(approvalRow), startOf(input.cursor), 50);
88
+ },
89
+ }),
90
+ defineOperation({
91
+ id: "approvals.get",
92
+ description: "Read one approval you can decide (the id from approvals.waiting or inbox.list): the tool, its connector or extension, the agent and conversation, the summary, state, expiry and the scopes a decision may take. Never the call's input; the web shows it to you when you decide there.",
93
+ input: z.object({ id: ApprovalPathParams.shape.id.uuid() }).strict(),
94
+ example: { id: "3f1c2a9e-5b7d-4e21-9c0a-1d2e3f4a5b6c" },
95
+ authz: { orgAction: "approvals.decide" },
96
+ mirrors: ["GET /api/v1/orgs/:orgId/approvals/:id"],
97
+ confirm: "read",
98
+ errors: [
99
+ {
100
+ code: "approval.not_found",
101
+ next: "No approval with this id waits for you (it may be another person's); list yours with approvals.waiting.",
102
+ },
103
+ ],
104
+ run: async (input, ctx) => ({
105
+ approval: detail(await this.approvals.get(ctx.orgId, input.id, ctx.actorAccountId)),
106
+ }),
107
+ }),
108
+ ]);
109
+ }
110
+ };
111
+ ApprovalsOperations = __decorate([
112
+ Injectable(),
113
+ __param(0, Inject(PlatformOperations)),
114
+ __param(1, Inject(ApprovalsService))
115
+ ], ApprovalsOperations);
116
+ export { ApprovalsOperations };
@@ -0,0 +1,14 @@
1
+ import { type OnModuleInit } from "@nestjs/common";
2
+ import { BackgroundTasks } from "../../background/tasks.service.js";
3
+ import { PlatformOperations } from "../registry.js";
4
+ /**
5
+ * Background task operations of the `Platform` tool (the conversation domain): list the
6
+ * background commands of one of your conversations and stop one. The output is the web's
7
+ * (`transport`): bytes of a command's output are read there.
8
+ */
9
+ export declare class BackgroundOperations implements OnModuleInit {
10
+ private readonly registry;
11
+ private readonly tasks;
12
+ constructor(registry: PlatformOperations, tasks: BackgroundTasks);
13
+ onModuleInit(): void;
14
+ }
@@ -0,0 +1,134 @@
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 { BackgroundConversationParams, BackgroundTaskParams, } from "../../background/background.schemas.js";
13
+ import { BackgroundTasks } from "../../background/tasks.service.js";
14
+ import { ApiError } from "../../errors.js";
15
+ import { defineOperation } from "../operation.js";
16
+ import { PlatformOperations } from "../registry.js";
17
+ import { viaAgent } from "./errors.js";
18
+ import { Cursor, pageOf, startOf } from "./paging.js";
19
+ import { named } from "./summary.js";
20
+ const PAGE = 50;
21
+ const ConversationId = BackgroundConversationParams.shape.id;
22
+ const TaskId = BackgroundTaskParams.shape.taskId;
23
+ /** The longest command a row or a card quotes. */
24
+ const COMMAND_MAX = 200;
25
+ const row = (t) => ({
26
+ id: t.id,
27
+ name: t.description,
28
+ state: t.status,
29
+ ...(t.lostReason !== null && { reason: t.lostReason }),
30
+ command: t.command.length > COMMAND_MAX ? `${t.command.slice(0, COMMAND_MAX)}…` : t.command,
31
+ subagentId: t.subagentId,
32
+ stopping: t.stopping,
33
+ });
34
+ /**
35
+ * Background task operations of the `Platform` tool (the conversation domain): list the
36
+ * background commands of one of your conversations and stop one. The output is the web's
37
+ * (`transport`): bytes of a command's output are read there.
38
+ */
39
+ let BackgroundOperations = class BackgroundOperations {
40
+ registry;
41
+ tasks;
42
+ constructor(registry, tasks) {
43
+ this.registry = registry;
44
+ this.tasks = tasks;
45
+ }
46
+ onModuleInit() {
47
+ this.registry.register([
48
+ defineOperation({
49
+ id: "conversations.background-tasks",
50
+ description: "List the background commands of one of your conversations and of its sub-agents, newest first: description, state (running, finished, failed, stopped, lost), the command and whether a stop is under way. Pages by 50: pass the returned next as params.cursor.",
51
+ input: z.object({ conversationId: ConversationId, cursor: Cursor.optional() }).strict(),
52
+ example: { conversationId: "3f2b8a40-6c1d-4e0b-9a77-5d1e2c8b9f10" },
53
+ authz: { orgAction: "agents.use" },
54
+ mirrors: ["GET /api/v1/orgs/:orgId/conversations/:id/background-tasks"],
55
+ renames: { conversationId: "id" },
56
+ extras: ["cursor"],
57
+ confirm: "read",
58
+ errors: [
59
+ {
60
+ code: "conversation.not_found",
61
+ next: "Check the id with conversations.list: only conversations you can see are readable.",
62
+ },
63
+ ],
64
+ run: async (input, ctx) => pageOf((await this.tasks.list(ctx.orgId, input.conversationId, ctx.actorAccountId)).map(row), startOf(input.cursor), PAGE),
65
+ }),
66
+ defineOperation({
67
+ id: "conversations.stop-background-task",
68
+ description: "Stop one background command of one of your conversations, as the stop button does: the command is killed. Takes the task id from conversations.background-tasks. A task already stopping or finished is returned as it is. The person confirms every stop; it is never remembered.",
69
+ input: z.object({ conversationId: ConversationId, taskId: TaskId }).strict(),
70
+ example: {
71
+ conversationId: "3f2b8a40-6c1d-4e0b-9a77-5d1e2c8b9f10",
72
+ taskId: "bg-1a2b3c4d",
73
+ },
74
+ authz: { orgAction: "agents.use" },
75
+ mirrors: ["POST /api/v1/orgs/:orgId/conversations/:id/background-tasks/:taskId/stop"],
76
+ renames: { conversationId: "id" },
77
+ confirm: "personal",
78
+ // a stop kills the command: asked every time and never remembered, like conversations.abort
79
+ rememberable: false,
80
+ errors: [
81
+ {
82
+ code: "conversation.not_found",
83
+ next: "Check the id with conversations.list: only conversations you can see are readable.",
84
+ },
85
+ {
86
+ code: "background_task.not_found",
87
+ next: "Check the task id with conversations.background-tasks; the task may be gone.",
88
+ },
89
+ ],
90
+ precheck: async (i, ctx) => {
91
+ try {
92
+ const tasks = await this.tasks.list(ctx.orgId, i.conversationId, ctx.actorAccountId);
93
+ return tasks.some((t) => t.id === i.taskId)
94
+ ? { ok: true }
95
+ : {
96
+ ok: false,
97
+ code: "background_task.not_found",
98
+ message: "Background task not found",
99
+ };
100
+ }
101
+ catch (e) {
102
+ if (e instanceof ApiError)
103
+ return { ok: false, code: e.code, message: e.message };
104
+ throw e;
105
+ }
106
+ },
107
+ summary: async (i, ctx) => {
108
+ let label = i.taskId;
109
+ try {
110
+ const t = (await this.tasks.list(ctx.orgId, i.conversationId, ctx.actorAccountId)).find((x) => x.id === i.taskId);
111
+ if (t !== undefined)
112
+ label = `${t.description} (${named(t.command)})`;
113
+ }
114
+ catch {
115
+ // the card names the id when the task cannot be read
116
+ }
117
+ return {
118
+ zh: `停止后台任务「${named(label)}」`,
119
+ en: `Stop background task "${named(label)}"`,
120
+ };
121
+ },
122
+ run: async (input, ctx) => ({
123
+ task: row(await this.tasks.stop(ctx.orgId, input.conversationId, ctx.actorAccountId, input.taskId, undefined, viaAgent("conversations.stop-background-task", ctx))),
124
+ }),
125
+ }),
126
+ ]);
127
+ }
128
+ };
129
+ BackgroundOperations = __decorate([
130
+ Injectable(),
131
+ __param(0, Inject(PlatformOperations)),
132
+ __param(1, Inject(BackgroundTasks))
133
+ ], BackgroundOperations);
134
+ export { BackgroundOperations };
@@ -0,0 +1,74 @@
1
+ import { type OnModuleInit } from "@nestjs/common";
2
+ import { CatalogService } from "../../catalog/catalog.service.js";
3
+ import { CatalogScopeService } from "../../catalog/catalog-scope.service.js";
4
+ import { PluginImport, type PluginReview } from "../../catalog/plugin-import.js";
5
+ import { KernelDb } from "../../infra/database/kernel-db.js";
6
+ import { PlatformOperations } from "../registry.js";
7
+ /** `plugins.set-shown` on a plugin an org owns. */
8
+ export declare const ORG_OWNED = "An org owns this plugin and manages who sees it; the super admin changes that in the admin console, not here.";
9
+ /** Where the person confirms a staged import (the admin console's import review). */
10
+ export declare const reviewUrl: (stagingId: string) => string;
11
+ /** What only a person does with a staged import, after reading its review on the web. */
12
+ export declare const CONFIRM_ON_WEB = "Nothing is imported yet. Give the person the reviewUrl: they read the review (the extension's permissions among it) and confirm the import on the web. Confirming approves extension permissions, which only a person does.";
13
+ /** A staged import's review as the model needs it: what it brings, not the files themselves. */
14
+ export declare const reviewBrief: (r: PluginReview) => {
15
+ name: string;
16
+ version: string;
17
+ displayName: import("@capybara-hq/plugin-sdk").LocalizedName | null;
18
+ publisher: string;
19
+ description: string;
20
+ format: import("../../catalog/plugin-import.js").PluginSourceFormat;
21
+ source: {
22
+ kind: "bootstrap" | "file" | "git" | "marketplace" | "npm";
23
+ ref: string;
24
+ };
25
+ extension: {
26
+ name: string;
27
+ version: string;
28
+ action: import("../../catalog/plugin-import.js").ExtensionReviewAction;
29
+ deployed: boolean;
30
+ currentVersion: string | null;
31
+ sensitive: boolean;
32
+ addedPermissions: string[];
33
+ warnings: number;
34
+ } | null;
35
+ skills: string[];
36
+ connectorTemplates: string[];
37
+ agentTemplates: string[];
38
+ dependencies: {
39
+ name: string;
40
+ range: string;
41
+ resolved: string | null;
42
+ }[];
43
+ };
44
+ /**
45
+ * The super admin's platform catalog operations of the `Platform` tool (spec §14.2, §14.5 item
46
+ * 1): prepare an import from npm or git and read its review (a person confirms it on the web: the
47
+ * confirm approves extension permissions), preview and change a plugin's scope, disable or enable
48
+ * it on the platform, show or hide it, and delete it. Platform plugins and the org's own come with
49
+ * the admin console's data in full (orgs named); another org's own plugin is refused (the phase-1
50
+ * rule), and the plugins in a name conflict are counted, never named.
51
+ */
52
+ export declare class CatalogAdminOperations implements OnModuleInit {
53
+ private readonly registry;
54
+ private readonly catalog;
55
+ private readonly scope;
56
+ private readonly pluginImport;
57
+ private readonly kdb;
58
+ constructor(registry: PlatformOperations, catalog: CatalogService, scope: CatalogScopeService, pluginImport: PluginImport, kdb: KernelDb);
59
+ /** The precheck refusal of another org's private plugin (the phase-1 rule), else null. */
60
+ private otherOrgs;
61
+ /** Whether an org owns the item (its owner org manages it, not the super admin's agent). */
62
+ private orgOwned;
63
+ /**
64
+ * A name conflict the service found at write time (the precheck skipped, or a change landed in
65
+ * between) without the plugins it names, which may be another org's own: the same error code,
66
+ * the orgs and skill names from the current preview, the plugins counted, no details.
67
+ */
68
+ private withoutPluginNames;
69
+ /** The precheck refusal of an unknown or deleted item (`catalog.get` includes deleted ones). */
70
+ private live;
71
+ /** The item's names for a card, or the id when it cannot be read. */
72
+ private names;
73
+ onModuleInit(): void;
74
+ }