@capybara-hq/kernel 0.1.0-rc.77 → 0.1.0-rc.79

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 (247) hide show
  1. package/bootstrap.json +6 -6
  2. package/dist/admin/outbox-dead.service.js +4 -1
  3. package/dist/agents/admin-agents.js +2 -0
  4. package/dist/agents/agent-lookup.js +4 -0
  5. package/dist/agents/agent-profile.service.js +3 -0
  6. package/dist/agents/agents.service.js +7 -0
  7. package/dist/agents/org-templates.js +1 -0
  8. package/dist/agents/pending-connector-requests.js +6 -0
  9. package/dist/agents/pending-connectors.service.js +2 -0
  10. package/dist/agents/readiness.service.d.ts +9 -3
  11. package/dist/agents/readiness.service.js +3 -3
  12. package/dist/agents/templates.js +1 -0
  13. package/dist/background/finish.js +3 -0
  14. package/dist/background/stop.js +2 -0
  15. package/dist/background/store.js +44 -0
  16. package/dist/background/tasks.service.js +3 -2
  17. package/dist/background/wake-rules.js +1 -0
  18. package/dist/catalog/admin-catalog.controller.d.ts +6 -0
  19. package/dist/catalog/admin-catalog.controller.js +13 -0
  20. package/dist/catalog/catalog-content.d.ts +9 -0
  21. package/dist/catalog/catalog-content.js +3 -1
  22. package/dist/catalog/catalog-items.js +4 -0
  23. package/dist/catalog/catalog-scope.service.js +4 -1
  24. package/dist/catalog/component-promotion.js +2 -0
  25. package/dist/catalog/component-scope.controller.d.ts +9 -15
  26. package/dist/catalog/component-scope.controller.js +14 -9
  27. package/dist/catalog/component-scope.service.js +5 -0
  28. package/dist/catalog/component-state.d.ts +4 -1
  29. package/dist/catalog/component-state.js +4 -2
  30. package/dist/catalog/marketplace-fetch.d.ts +1 -1
  31. package/dist/catalog/marketplace-fetch.js +1 -1
  32. package/dist/catalog/marketplaces.service.d.ts +6 -1
  33. package/dist/catalog/marketplaces.service.js +8 -3
  34. package/dist/catalog/org-catalog.controller.d.ts +9 -0
  35. package/dist/catalog/org-catalog.controller.js +18 -0
  36. package/dist/catalog/org-catalog.schemas.d.ts +2 -4
  37. package/dist/catalog/org-catalog.schemas.js +2 -3
  38. package/dist/catalog/org-catalog.service.d.ts +10 -1
  39. package/dist/catalog/org-catalog.service.js +34 -23
  40. package/dist/catalog/org-extension-switch.d.ts +3 -10
  41. package/dist/catalog/org-extension-switch.js +14 -60
  42. package/dist/catalog/org-extension.controller.d.ts +6 -7
  43. package/dist/catalog/org-extension.controller.js +4 -4
  44. package/dist/catalog/org-extension.schemas.d.ts +1 -2
  45. package/dist/catalog/org-extension.schemas.js +1 -3
  46. package/dist/catalog/owned-items.js +10 -1
  47. package/dist/catalog/ownership.js +2 -0
  48. package/dist/catalog/plugin-import.d.ts +3 -0
  49. package/dist/catalog/plugin-import.js +10 -1
  50. package/dist/catalog/plugin-install.d.ts +1 -4
  51. package/dist/catalog/plugin-install.js +11 -12
  52. package/dist/catalog/plugin-upgrade.js +4 -1
  53. package/dist/catalog/request-rules.js +6 -0
  54. package/dist/catalog/requests.service.js +4 -0
  55. package/dist/catalog/scope-orgs.js +1 -0
  56. package/dist/catalog/scope-sync.d.ts +8 -5
  57. package/dist/catalog/scope-sync.js +21 -23
  58. package/dist/catalog/template-description.d.ts +17 -0
  59. package/dist/catalog/template-description.js +18 -0
  60. package/dist/catalog/unshare.js +3 -0
  61. package/dist/channels/connections.service.js +1 -0
  62. package/dist/channels/inbound.js +1 -0
  63. package/dist/channels/jobs.js +1 -0
  64. package/dist/channels/outbound.js +6 -0
  65. package/dist/channels/supervisor.js +1 -0
  66. package/dist/channels/threads.js +1 -0
  67. package/dist/client/client-reports.service.js +1 -0
  68. package/dist/config/fields.js +20 -4
  69. package/dist/config/schema.d.ts +1 -1
  70. package/dist/config/schema.js +13 -13
  71. package/dist/conversations/access.js +1 -0
  72. package/dist/conversations/attachments.service.js +16 -4
  73. package/dist/conversations/conversations.service.js +17 -3
  74. package/dist/conversations/event-log.js +2 -0
  75. package/dist/conversations/events.d.ts +1 -0
  76. package/dist/conversations/events.js +3 -1
  77. package/dist/conversations/files.js +3 -2
  78. package/dist/conversations/permission-profiles.service.js +1 -0
  79. package/dist/conversations/prompt-suggestions.js +2 -0
  80. package/dist/conversations/queue.js +8 -0
  81. package/dist/conversations/queue.service.js +6 -2
  82. package/dist/conversations/source.js +2 -0
  83. package/dist/conversations/titles.js +10 -2
  84. package/dist/conversations/tree.js +6 -0
  85. package/dist/db/kernel-schema.d.ts +5 -1
  86. package/dist/devices/conversation-devices.js +3 -0
  87. package/dist/devices/device-projects.service.js +2 -0
  88. package/dist/devices/devices.service.js +5 -0
  89. package/dist/devices/legacy-cleanup.job.js +5 -2
  90. package/dist/dial-in/handlers.js +2 -0
  91. package/dist/dial-in/machines.js +11 -2
  92. package/dist/dial-in/targets.d.ts +0 -2
  93. package/dist/dial-in/targets.js +0 -10
  94. package/dist/errors.d.ts +0 -1
  95. package/dist/errors.js +0 -1
  96. package/dist/evals/budget.js +14 -1
  97. package/dist/evals/run-replay.js +4 -0
  98. package/dist/evals/runs.service.js +13 -7
  99. package/dist/evals/sets.service.js +23 -8
  100. package/dist/evals/trajectory.service.d.ts +1 -1
  101. package/dist/evals/trajectory.service.js +1 -0
  102. package/dist/evals/worker.js +5 -1
  103. package/dist/extensions/admin-ops.js +1 -0
  104. package/dist/extensions/admin-view.js +3 -1
  105. package/dist/extensions/bootstrap-packages.d.ts +12 -1
  106. package/dist/extensions/bootstrap-packages.js +49 -9
  107. package/dist/extensions/bootstrap.d.ts +17 -2
  108. package/dist/extensions/bootstrap.js +41 -9
  109. package/dist/extensions/config-json-schema.d.ts +2 -2
  110. package/dist/extensions/config-json-schema.js +1 -3
  111. package/dist/extensions/deployment-config.d.ts +5 -3
  112. package/dist/extensions/deployment-config.js +3 -3
  113. package/dist/extensions/effective-config.d.ts +8 -7
  114. package/dist/extensions/effective-config.js +8 -7
  115. package/dist/extensions/enabled.js +1 -0
  116. package/dist/extensions/host.d.ts +4 -3
  117. package/dist/extensions/host.js +11 -12
  118. package/dist/extensions/instance.d.ts +1 -1
  119. package/dist/extensions/instance.js +17 -2
  120. package/dist/extensions/org-config.d.ts +35 -97
  121. package/dist/extensions/org-config.js +48 -315
  122. package/dist/extensions/org-levels.d.ts +22 -9
  123. package/dist/extensions/org-levels.js +100 -20
  124. package/dist/extensions/org-overrides.d.ts +14 -15
  125. package/dist/extensions/org-overrides.js +20 -20
  126. package/dist/extensions/package.js +1 -1
  127. package/dist/extensions/permission-set.d.ts +1 -3
  128. package/dist/extensions/permission-set.js +3 -7
  129. package/dist/extensions/permission-view.d.ts +3 -1
  130. package/dist/extensions/permission-view.js +5 -4
  131. package/dist/extensions/plugin-icons.d.ts +80 -1
  132. package/dist/extensions/plugin-icons.js +211 -2
  133. package/dist/extensions/point-defaults.d.ts +17 -18
  134. package/dist/extensions/point-defaults.js +25 -28
  135. package/dist/git/gateway.js +1 -1
  136. package/dist/git/identity.d.ts +1 -1
  137. package/dist/git/identity.js +2 -2
  138. package/dist/identity/accounts.js +6 -0
  139. package/dist/identity/api-tokens.js +8 -0
  140. package/dist/infra/outbox/outbox.dispatcher.js +4 -1
  141. package/dist/infra/outbox/outbox.service.js +2 -0
  142. package/dist/net/public-address.d.ts +3 -3
  143. package/dist/net/public-address.js +3 -3
  144. package/dist/orgs/directory-sync.d.ts +9 -6
  145. package/dist/orgs/directory-sync.js +15 -12
  146. package/dist/orgs/invitations.service.js +2 -0
  147. package/dist/orgs/members.service.js +2 -0
  148. package/dist/orgs/offboarding.js +2 -0
  149. package/dist/packages/npm.d.ts +10 -2
  150. package/dist/packages/npm.js +38 -6
  151. package/dist/platform/exclusions.js +20 -0
  152. package/dist/platform/ops/admin-items.ops.js +1 -0
  153. package/dist/platform/ops/agents.ops.js +1 -0
  154. package/dist/platform/ops/connectors.ops.js +7 -1
  155. package/dist/platform/ops/extensions.ops.d.ts +6 -8
  156. package/dist/platform/ops/extensions.ops.js +18 -97
  157. package/dist/platform/ops/org-plugins.ops.d.ts +3 -6
  158. package/dist/platform/ops/org-plugins.ops.js +14 -65
  159. package/dist/platform/ops/outbox.ops.js +1 -0
  160. package/dist/platform/ops/person-inputs.d.ts +0 -4
  161. package/dist/platform/ops/person-inputs.js +0 -8
  162. package/dist/platform/ops/plugins.ops.d.ts +4 -1
  163. package/dist/platform/ops/plugins.ops.js +27 -34
  164. package/dist/platform/person-fields.d.ts +1 -1
  165. package/dist/platform/person-fields.js +1 -1
  166. package/dist/platform/sealed-reveals.js +2 -0
  167. package/dist/push/recipients.js +9 -2
  168. package/dist/runtime/permission-context.service.js +1 -0
  169. package/dist/runtime/plugin-context.service.js +1 -0
  170. package/dist/runtime/project/knowledge.service.js +1 -0
  171. package/dist/runtime/run-context.service.js +1 -0
  172. package/dist/runtime/run-deletion.js +4 -0
  173. package/dist/runtime/run-execution.js +2 -0
  174. package/dist/runtime/run-finish.js +3 -0
  175. package/dist/runtime/run-jobs.js +3 -0
  176. package/dist/runtime/run-orphan-check.job.js +7 -0
  177. package/dist/runtime/run-queue.js +21 -2
  178. package/dist/runtime/run-worker.js +5 -0
  179. package/dist/runtime/step-log.js +1 -0
  180. package/dist/runtime/subagents/child.js +2 -0
  181. package/dist/runtime/subagents/deliveries.js +3 -0
  182. package/dist/runtime/subagents/dispatch.js +5 -1
  183. package/dist/runtime/subagents/messages.js +2 -0
  184. package/dist/runtime/subagents/org-agents.d.ts +1 -1
  185. package/dist/runtime/subagents/org-agents.js +2 -1
  186. package/dist/runtime/usage-report-jobs.js +1 -0
  187. package/dist/runtime/usage-report.js +3 -0
  188. package/dist/runtime/waits.js +5 -0
  189. package/dist/sandbox/cloud-permission-snapshot.js +9 -3
  190. package/dist/sandbox/device-reports.js +3 -0
  191. package/dist/sandbox/legacy-retirement.js +5 -1
  192. package/dist/sandbox/managed-device-context.js +1 -0
  193. package/dist/sandbox/modes.d.ts +5 -2
  194. package/dist/sandbox/modes.js +8 -4
  195. package/dist/sandbox/network-grants.js +2 -0
  196. package/dist/sandbox/operation-intents.js +58 -0
  197. package/dist/sandbox/operation-reconcile.job.js +2 -0
  198. package/dist/sandbox/permission-authority-lock.js +12 -6
  199. package/dist/sandbox/permission-call-grants.js +6 -0
  200. package/dist/sandbox/permission-ceiling-writes.js +5 -0
  201. package/dist/sandbox/permission-config-publication.js +5 -0
  202. package/dist/sandbox/permission-instance-writes.js +4 -0
  203. package/dist/sandbox/permission-runtime-reports.js +10 -1
  204. package/dist/sandbox/permission-transitions.js +3 -0
  205. package/dist/sandbox/review/review.service.js +8 -5
  206. package/dist/sandbox/sandbox.service.d.ts +14 -0
  207. package/dist/sandbox/sandbox.service.js +195 -29
  208. package/dist/sandbox/unreachable.js +4 -1
  209. package/dist/schedules/fire.js +9 -3
  210. package/dist/schedules/pause.js +2 -0
  211. package/dist/schedules/run-tracker.js +16 -1
  212. package/dist/schedules/scheduled-tasks.service.js +4 -2
  213. package/dist/schedules/store.js +8 -0
  214. package/dist/schedules/unattended.js +4 -0
  215. package/dist/setup/setup-checks.service.d.ts +1 -10
  216. package/dist/setup/setup-checks.service.js +19 -29
  217. package/dist/shares/share-open.service.js +1 -0
  218. package/dist/shares/shares.service.js +2 -0
  219. package/dist/skills/agent-skills.service.d.ts +1 -1
  220. package/dist/skills/agent-skills.service.js +13 -2
  221. package/dist/skills/catalog.js +3 -0
  222. package/dist/skills/changes.service.js +10 -2
  223. package/dist/skills/conversation-catalog.js +1 -0
  224. package/dist/skills/skills.service.js +4 -0
  225. package/dist/tools/approvals.service.js +40 -0
  226. package/dist/tools/builtins/schedules.js +11 -6
  227. package/dist/tools/builtins/web/fetch.js +1 -1
  228. package/dist/tools/builtins/web/search.js +1 -1
  229. package/dist/tools/connector-account-policies.js +3 -0
  230. package/dist/tools/connectors.controller.d.ts +37 -9
  231. package/dist/tools/connectors.controller.js +47 -12
  232. package/dist/tools/connectors.schemas.d.ts +4 -0
  233. package/dist/tools/connectors.schemas.js +13 -1
  234. package/dist/tools/connectors.service.d.ts +17 -0
  235. package/dist/tools/connectors.service.js +36 -2
  236. package/dist/tools/drift.js +5 -0
  237. package/dist/tools/git-push-policy.js +3 -0
  238. package/dist/tools/oauth/discovery.d.ts +2 -2
  239. package/dist/tools/oauth/discovery.js +2 -2
  240. package/dist/tools/oauth/flow.js +1 -0
  241. package/dist/tools/outputs.js +2 -0
  242. package/dist/tools/permission-approval-jobs.js +3 -0
  243. package/dist/tools/pipeline.js +2 -0
  244. package/dist/tools/policy.js +3 -0
  245. package/dist/tools/questions.service.js +13 -0
  246. package/package.json +3 -3
  247. package/src/migrations/0181_connector_description.sql +3 -0
package/bootstrap.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "schemaVersion": 1,
4
4
  "marketplace": {
5
5
  "url": "https://github.com/capybara-hq/plugins.git",
6
- "commit": "a9c5d9c9328a855162c2bbaf758f261add863fa2"
6
+ "commit": "03a53c895cc9993306203fc0d41a6cc71acc3107"
7
7
  },
8
8
  "plugins": [
9
9
  {
@@ -12,7 +12,7 @@
12
12
  "npm": "@capybara-hq/plugin-openai-compatible",
13
13
  "version": "0.1.0-rc.11",
14
14
  "integrity": "sha512-xhLYmzgzC6I8VAx/xzGSrW53On9hVT9aXrNJaeLYBMVr84lY765MZ6P6qt5hDhHIH13sxyfaCf+3FQ6muc4U/w==",
15
- "required": true
15
+ "required": false
16
16
  },
17
17
  {
18
18
  "name": "object-store-s3",
@@ -90,16 +90,16 @@
90
90
  "name": "device-docker",
91
91
  "source": "npm",
92
92
  "npm": "@capybara-hq/plugin-device-docker",
93
- "version": "0.1.0-rc.24",
94
- "integrity": "sha512-M+XP8iLgbQe8K27u29Ta2O5Pg+1pCHT4lFZPN9VxyP9+FrtqBcYG0Uf0tC9/f1MUWBdN4fesyeqHXUpoObUg+w==",
93
+ "version": "0.1.0-rc.25",
94
+ "integrity": "sha512-2ooWuxVKvGoXWNQTpEwwFRZP2/qUiPvihP/858VDwiRqkEU9DY3zsf2QrcIOUeL6NcjGhNRWsz6r5ReKdXUc8w==",
95
95
  "required": false
96
96
  },
97
97
  {
98
98
  "name": "device-local",
99
99
  "source": "npm",
100
100
  "npm": "@capybara-hq/plugin-device-local",
101
- "version": "0.1.0-rc.6",
102
- "integrity": "sha512-wB9147kTphsBKwtvcgd6fylqECDqtqeZfkqiDY2jBAcErjrOL19alogWYIstof9les4CSi6tO8VgBgdfSYN97A==",
101
+ "version": "0.1.0-rc.7",
102
+ "integrity": "sha512-IGhfG42LMy8Rf95vHEjGKkEHHhASClFvPZZnLZAHjdHr6fqox6z2q1c4Kn1BRee2kSVT31AOw8hiTurfIXyalA==",
103
103
  "required": false,
104
104
  "scope": "all"
105
105
  },
@@ -239,7 +239,10 @@ __decorate([
239
239
  Transactional()
240
240
  ], OutboxDeadService.prototype, "discard", null);
241
241
  OutboxDeadService = __decorate([
242
- Injectable(),
242
+ Injectable()
243
+ // org-filter: super-admin service (callers authorize through SuperAdminLock / admin routes); the
244
+ // outbox is deployment-wide and every dead row of every org is listed and handled on purpose
245
+ ,
243
246
  __param(0, Inject(TransactionHost)),
244
247
  __param(1, Inject(KernelDb)),
245
248
  __param(2, Inject(OUTBOX_FAST_PATH)),
@@ -109,6 +109,8 @@ let AdminAgents = class AdminAgents {
109
109
  const db = this.db.db;
110
110
  const builtinPlugins = await builtinSkillPlugins(db);
111
111
  const agentIds = [...byOrg.values()].flat().map((a) => a.id);
112
+ // org-filter: super admin's cross-org agent list; skills are matched by the agent ids loaded
113
+ // across orgs above (origin_agent_id is unique to one org's agent), not by caller input
112
114
  const sharedRows = await db
113
115
  .selectFrom("skills")
114
116
  .select(["id", "origin_agent_id"])
@@ -61,6 +61,8 @@ export function visibleTo(viewerAccountId) {
61
61
  * the live org). Deleted agents are never visible.
62
62
  */
63
63
  export async function isAgentVisibleTo(db, agentId, accountId) {
64
+ // org-filter: visibleTo requires the account's membership in the agent's own org; callers load
65
+ // the agent with their org filter first (isAgentVisibleIn is the org-pinned variant)
64
66
  const row = await db
65
67
  .selectFrom("agents")
66
68
  .select("id")
@@ -132,6 +134,8 @@ let AgentLookup = class AgentLookup {
132
134
  return v;
133
135
  }
134
136
  /** 按给定 id 顺序组装视图(调用方已完成可见性判定)。 */
137
+ // org-filter: assembles views for ids the caller already resolved with its org and visibility
138
+ // filter (get / listVisible and the services' own org-filtered reads)
135
139
  async views(ids) {
136
140
  if (ids.length === 0)
137
141
  return [];
@@ -69,6 +69,7 @@ let AgentProfileService = class AgentProfileService {
69
69
  .selectFrom("agents")
70
70
  .select(sql `to_char(profile_updated_at at time zone 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"')`.as("at"))
71
71
  .where("id", "=", agentId)
72
+ .where("org_id", "=", orgId)
72
73
  .executeTakeFirstOrThrow();
73
74
  if (current.at !== expectedUpdatedAt) {
74
75
  throw new ApiError("agent.profile_conflict", "The profile was changed by someone else; reload it and apply your changes again");
@@ -92,6 +93,7 @@ let AgentProfileService = class AgentProfileService {
92
93
  profile_updated_at: sql `greatest(date_trunc('milliseconds', now()), profile_updated_at + interval '1 millisecond')`,
93
94
  })
94
95
  .where("id", "=", agentId)
96
+ .where("org_id", "=", orgId)
95
97
  .execute();
96
98
  if (patch.avatar !== undefined) {
97
99
  // the avatar changed: every other upload bound to this agent is garbage; the cleanup job
@@ -99,6 +101,7 @@ let AgentProfileService = class AgentProfileService {
99
101
  await t
100
102
  .updateTable("attachments")
101
103
  .set({ expires_at: sql `now()` })
104
+ .where("org_id", "=", orgId)
102
105
  .where("agent_id", "=", agentId)
103
106
  .where("purpose", "=", "agent-avatar")
104
107
  .$if(patch.avatar?.kind === "upload", (q) => q.where("id", "<>", patch.avatar.uploadId))
@@ -577,6 +577,7 @@ let AgentsService = class AgentsService {
577
577
  .selectFrom("agents")
578
578
  .select("id")
579
579
  .where("id", "=", agentId)
580
+ .where("org_id", "=", orgId)
580
581
  .where(visibleTo(actorAccountId))
581
582
  .executeTakeFirst();
582
583
  if (!visible)
@@ -608,6 +609,7 @@ let AgentsService = class AgentsService {
608
609
  * deleted org → `agent.not_found`. The super admin check is the caller's (`@SuperAdmin()`).
609
610
  */
610
611
  async lockForPlatform(agentId) {
612
+ // org-filter: platform path (super admin, checked by the caller): finds the agent's org
611
613
  const found = await this.db.db
612
614
  .selectFrom("agents")
613
615
  .select("org_id")
@@ -660,6 +662,7 @@ let AgentsService = class AgentsService {
660
662
  .updateTable("agents")
661
663
  .set({ profile_description: definition.description ?? "" })
662
664
  .where("id", "=", agentId)
665
+ .where("org_id", "=", orgId)
663
666
  .execute();
664
667
  }
665
668
  // what the current version already turns off is not checked again (skills default-on §4)
@@ -714,6 +717,7 @@ let AgentsService = class AgentsService {
714
717
  .updateTable("agents")
715
718
  .set({ visibility, current_version: toVersion, updated_at: sql `now()` })
716
719
  .where("id", "=", agentId)
720
+ .where("org_id", "=", orgId)
717
721
  .execute();
718
722
  await audit(t, {
719
723
  actorAccountId,
@@ -768,11 +772,13 @@ let AgentsService = class AgentsService {
768
772
  .updateTable("agents")
769
773
  .set({ deleted_at: sql `now()`, updated_at: sql `now()` })
770
774
  .where("id", "=", agentId)
775
+ .where("org_id", "=", orgId)
771
776
  .execute();
772
777
  // the avatar upload is garbage now: the cleanup job deletes it (and its object) once expired
773
778
  await t
774
779
  .updateTable("attachments")
775
780
  .set({ expires_at: sql `now()` })
781
+ .where("org_id", "=", orgId)
776
782
  .where("agent_id", "=", agentId)
777
783
  .where("purpose", "=", "agent-avatar")
778
784
  .execute();
@@ -836,6 +842,7 @@ let AgentsService = class AgentsService {
836
842
  .updateTable("agents")
837
843
  .set({ owner_account_id: newOwnerId, needs_reassignment: false, updated_at: sql `now()` })
838
844
  .where("id", "=", agentId)
845
+ .where("org_id", "=", orgId)
839
846
  .execute();
840
847
  // the new owner hears about the agent's connector setup request (P4-T6-4)
841
848
  await this.setupRequests.retargetIn([agentId], newOwnerId);
@@ -885,6 +885,7 @@ let OrgAgentTemplates = class OrgAgentTemplates {
885
885
  .selectFrom("agent_templates")
886
886
  .select("platform_template_id")
887
887
  .where("id", "=", t.id)
888
+ .where("org_id", "=", orgId)
888
889
  .executeTakeFirst())?.platform_template_id ??
889
890
  null;
890
891
  if (pid !== null) {
@@ -22,6 +22,8 @@ import { Transactional } from "../infra/database/transactional.decorator.js";
22
22
  export async function retargetSetupRequests(db, agentIds, owner) {
23
23
  if (agentIds.length === 0)
24
24
  return;
25
+ // org-filter: the agent ids were resolved in the caller's org (owner change, offboarding) and a
26
+ // setup request lives in its agent's org
25
27
  await db
26
28
  .updateTable("catalog_requests")
27
29
  .set({ requested_by: owner })
@@ -129,6 +131,7 @@ let PendingConnectorRequests = class PendingConnectorRequests {
129
131
  const existing = await t
130
132
  .selectFrom("catalog_requests")
131
133
  .select("id")
134
+ .where("org_id", "=", a.orgId)
132
135
  .where("agent_id", "=", a.agentId)
133
136
  .where("kind", "=", "connector_setup")
134
137
  .where("status", "=", "pending")
@@ -157,6 +160,7 @@ let PendingConnectorRequests = class PendingConnectorRequests {
157
160
  const row = await t
158
161
  .selectFrom("catalog_requests")
159
162
  .select(["id", "pending_keys", "requested_by"])
163
+ .where("org_id", "=", a.orgId)
160
164
  .where("agent_id", "=", a.agentId)
161
165
  .where("kind", "=", "connector_setup")
162
166
  .where("status", "=", "pending")
@@ -172,6 +176,7 @@ let PendingConnectorRequests = class PendingConnectorRequests {
172
176
  .updateTable("catalog_requests")
173
177
  .set({ pending_keys: JSON.stringify(left) })
174
178
  .where("id", "=", row.id)
179
+ .where("org_id", "=", a.orgId)
175
180
  .execute();
176
181
  }
177
182
  return;
@@ -187,6 +192,7 @@ let PendingConnectorRequests = class PendingConnectorRequests {
187
192
  row.requested_by === a.actor && { dismissed_at: sql `now()` }),
188
193
  })
189
194
  .where("id", "=", row.id)
195
+ .where("org_id", "=", a.orgId)
190
196
  .execute();
191
197
  await audit(t, {
192
198
  actorAccountId: a.actor,
@@ -166,6 +166,7 @@ let PendingConnectorsService = class PendingConnectorsService {
166
166
  .updateTable("agents")
167
167
  .set({ current_version: toVersion, updated_at: sql `now()` })
168
168
  .where("id", "=", agentId)
169
+ .where("org_id", "=", orgId)
169
170
  .execute();
170
171
  await audit(t, {
171
172
  actorAccountId: actor,
@@ -208,6 +209,7 @@ let PendingConnectorsService = class PendingConnectorsService {
208
209
  .selectFrom("agents")
209
210
  .select("owner_account_id")
210
211
  .where("id", "=", agentId)
212
+ .where("org_id", "=", orgId)
211
213
  .executeTakeFirstOrThrow();
212
214
  const r = await this.requests.open({
213
215
  orgId,
@@ -1,13 +1,13 @@
1
1
  import { type LocalizedName } from "@capybara-hq/plugin-sdk";
2
2
  import { ExtensionDisplayNames } from "../extensions/display-name.js";
3
- import { OrgExtensionConfigs } from "../extensions/org-config.js";
3
+ import { OrgExtensionConfigs, type OrgExtensionView } from "../extensions/org-config.js";
4
4
  import { type ListErrorKind, ProviderRegistry } from "../runtime/providers.js";
5
5
  import { AgentsService } from "./agents.service.js";
6
6
  /**
7
7
  * A model provider an org admin can make usable on `/settings/models`, and what it waits for:
8
8
  * `not_enabled`, the org has not switched it on (it may also need the org's config then);
9
- * `needs_config`, it is on but waits for the org's own config (an org-level field, or an
10
- * overridable platform field the platform left empty).
9
+ * `needs_config`, it is on but waits for the org's own copy of an overridable deployment field
10
+ * the platform left empty.
11
11
  */
12
12
  export interface OrgFixableProvider {
13
13
  provider: string;
@@ -53,6 +53,12 @@ export interface OrgReadiness {
53
53
  /** The agents the caller can see (the agent list's visibility). */
54
54
  agents: number;
55
55
  }
56
+ /**
57
+ * What the org admin must do to make `v` usable here, or null when they cannot (or need not). The
58
+ * view comes from the org's extension list, which shows an extension only when it is offered to
59
+ * the org (`offeredToOrg`): not named to other orgs only, not disabled while off.
60
+ */
61
+ export declare function fixOf(v: OrgExtensionView): OrgFixableProvider["reason"] | null;
56
62
  /**
57
63
  * Whether the org can run (web-order spec §3.8), the one place it is computed (the readiness
58
64
  * route and the `agents.readiness` operation): the web app decides between the shell and the setup
@@ -15,14 +15,14 @@ import { ProviderRegistry } from "../runtime/providers.js";
15
15
  import { AgentsService } from "./agents.service.js";
16
16
  const MODEL_PROVIDER = parseExtensionPoint(MODEL_PROVIDER_EXTENSION_POINT_V2).name;
17
17
  const isModelProvider = (v) => providesOf(v).some((ref) => parseExtensionPoint(ref).name === MODEL_PROVIDER);
18
- /** The org can fill the config the extension waits for: an org-level or an overridable field. */
19
- const orgCanConfigure = (v) => v.configurable || v.overrideState !== "none";
18
+ /** The org can fill the config the extension waits for: it has an overridable field. */
19
+ const orgCanConfigure = (v) => v.configurable;
20
20
  /**
21
21
  * What the org admin must do to make `v` usable here, or null when they cannot (or need not). The
22
22
  * view comes from the org's extension list, which shows an extension only when it is offered to
23
23
  * the org (`offeredToOrg`): not named to other orgs only, not disabled while off.
24
24
  */
25
- function fixOf(v) {
25
+ export function fixOf(v) {
26
26
  if (!v.available)
27
27
  return null;
28
28
  if (!v.enabled)
@@ -568,6 +568,7 @@ export async function putTemplateVersionIn(t, s, template) {
568
568
  updated_at: new Date(),
569
569
  })
570
570
  .where("id", "=", id)
571
+ .where("org_id", "=", s.orgId)
571
572
  .execute();
572
573
  }
573
574
  return { id, version, created: !live, changed: true };
@@ -74,6 +74,7 @@ let BackgroundTaskFinisher = class BackgroundTaskFinisher {
74
74
  .selectFrom("sandbox_operation_intents")
75
75
  .select("operation_id")
76
76
  .where("operation_id", "=", task.operationId)
77
+ .where("org_id", "=", task.orgId)
77
78
  .forUpdate()
78
79
  .executeTakeFirst();
79
80
  if (!(await this.store.finish(task.id, to, {
@@ -86,6 +87,7 @@ let BackgroundTaskFinisher = class BackgroundTaskFinisher {
86
87
  .updateTable("sandbox_operation_intents")
87
88
  .set({ state: "completed", updated_at: new Date() })
88
89
  .where("operation_id", "=", task.operationId)
90
+ .where("org_id", "=", task.orgId)
89
91
  .where("state", "=", "background-running")
90
92
  .execute();
91
93
  // A lost end (supervision lost, instance gone or replaced) is no proof the process is gone:
@@ -96,6 +98,7 @@ let BackgroundTaskFinisher = class BackgroundTaskFinisher {
96
98
  .updateTable("sandbox_operation_intents")
97
99
  .set({ state: "revoked", outcome_unknown: true, updated_at: new Date() })
98
100
  .where("operation_id", "=", task.operationId)
101
+ .where("org_id", "=", task.orgId)
99
102
  .where("state", "=", "background-running")
100
103
  .returning("operation_id")
101
104
  .executeTakeFirst();
@@ -122,6 +122,7 @@ let BackgroundTaskStopper = class BackgroundTaskStopper {
122
122
  .selectFrom("conversations")
123
123
  .select(["id", "deleted_at"])
124
124
  .where("id", "in", ids)
125
+ .where("org_id", "=", cur.orgId)
125
126
  .execute(),
126
127
  this.db.db
127
128
  .selectFrom("orgs")
@@ -218,6 +219,7 @@ let BackgroundTaskStopper = class BackgroundTaskStopper {
218
219
  */
219
220
  async stopSubagentTasks(conversationId, runId) {
220
221
  try {
222
+ // org-filter: conversationId is kernel-supplied (the run that just ended), not caller input
221
223
  const conv = await this.db
222
224
  .selectFrom("conversations")
223
225
  .select("kind")
@@ -87,6 +87,8 @@ let BackgroundTaskStore = class BackgroundTaskStore {
87
87
  */
88
88
  async reserveManaged(row, maxTasks) {
89
89
  await this.launchLock.lock(row.sandboxConversationId);
90
+ // org-filter: launch reservation keyed by the launching run's run id and call id (kernel-
91
+ // supplied by the Bash tool call)
90
92
  const previous = await this.db
91
93
  .selectFrom("background_tasks")
92
94
  .selectAll()
@@ -130,6 +132,8 @@ let BackgroundTaskStore = class BackgroundTaskStore {
130
132
  * when `executionId` is still the run's current execution claim.
131
133
  * A dispatched row is never failed here: a null reference is no proof that nothing launched.
132
134
  */
135
+ // org-filter: by task id: callers check ownership first (ownedTask: the calling conversation;
136
+ // TasksService.owned: org and conversation scope) or pass the id of a row they already read
133
137
  async failManagedPreEffect(id, reason, executionId) {
134
138
  const r = await this.db
135
139
  .updateTable("background_tasks")
@@ -155,6 +159,8 @@ let BackgroundTaskStore = class BackgroundTaskStore {
155
159
  * Claims a running task for a stop (`stopping_at`): false when it is no longer running or another
156
160
  * live stop claimed it ({@link STOP_CLAIM_TTL_MS}). While claimed the poller leaves it alone.
157
161
  */
162
+ // org-filter: by task id: callers check ownership first (ownedTask: the calling conversation;
163
+ // TasksService.owned: org and conversation scope) or pass the id of a row they already read
158
164
  async claimStop(id) {
159
165
  const r = await this.db
160
166
  .updateTable("background_tasks")
@@ -166,6 +172,8 @@ let BackgroundTaskStore = class BackgroundTaskStore {
166
172
  return Number(r.numUpdatedRows) > 0;
167
173
  }
168
174
  /** Gives up a stop's claim (the stop failed while the sandbox runs: the task keeps running). */
175
+ // org-filter: by task id: callers check ownership first (ownedTask: the calling conversation;
176
+ // TasksService.owned: org and conversation scope) or pass the id of a row they already read
169
177
  async releaseStop(id) {
170
178
  await this.db
171
179
  .updateTable("background_tasks")
@@ -185,6 +193,8 @@ let BackgroundTaskStore = class BackgroundTaskStore {
185
193
  * Returns the rows it finished (their owner and sandbox conversations, for the caller's
186
194
  * `changed: "background"` frames).
187
195
  */
196
+ // org-filter: deployment-wide background-task poller sweep across all orgs; each row is
197
+ // handled in its own org
188
198
  async failAbandonedLaunches(before) {
189
199
  const r = await this.db
190
200
  .updateTable("background_tasks")
@@ -240,6 +250,8 @@ let BackgroundTaskStore = class BackgroundTaskStore {
240
250
  .execute();
241
251
  }
242
252
  /** The managed task launched by start operation `operationId`, if its row still exists. */
253
+ // org-filter: by start operation id read from a kernel-written row (operation intent or
254
+ // retirement marker), not caller input
243
255
  async byOperation(operationId) {
244
256
  const r = await this.db
245
257
  .selectFrom("background_tasks")
@@ -252,6 +264,8 @@ let BackgroundTaskStore = class BackgroundTaskStore {
252
264
  * A finished managed task whose owed cancellation was later established by its exact ref (the
253
265
  * revoke worker): its record becomes `terminal`. Its finish and event stay as they were.
254
266
  */
267
+ // org-filter: by task id: callers check ownership first (ownedTask: the calling conversation;
268
+ // TasksService.owned: org and conversation scope) or pass the id of a row they already read
255
269
  async settleOwedCancel(id) {
256
270
  await this.db
257
271
  .updateTable("background_tasks")
@@ -261,6 +275,8 @@ let BackgroundTaskStore = class BackgroundTaskStore {
261
275
  .where("launch_state", "=", "cancel-pending")
262
276
  .execute();
263
277
  }
278
+ // org-filter: by task id: callers check ownership first (ownedTask: the calling conversation;
279
+ // TasksService.owned: org and conversation scope) or pass the id of a row they already read
264
280
  async get(id) {
265
281
  const r = await this.db
266
282
  .selectFrom("background_tasks")
@@ -270,6 +286,8 @@ let BackgroundTaskStore = class BackgroundTaskStore {
270
286
  return r === undefined ? undefined : toRow(r);
271
287
  }
272
288
  /** The running tasks of one root conversation's tree, oldest first. */
289
+ // org-filter: by conversation id the caller already resolved in its org (the tool call's
290
+ // conversation, TasksService.scope(orgId, ...), or a kernel launch / deletion path)
273
291
  async runningIn(sandboxConversationId) {
274
292
  const rows = await this.db
275
293
  .selectFrom("background_tasks")
@@ -287,6 +305,8 @@ let BackgroundTaskStore = class BackgroundTaskStore {
287
305
  * exec). A legacy reservation that never started is failed as abandoned, a claimed task is left
288
306
  * to its stop.
289
307
  */
308
+ // org-filter: deployment-wide background-task poller sweep across all orgs; each row is
309
+ // handled in its own org
290
310
  async runningLegacy() {
291
311
  const rows = await this.db
292
312
  .selectFrom("background_tasks")
@@ -304,6 +324,8 @@ let BackgroundTaskStore = class BackgroundTaskStore {
304
324
  * Every running acknowledged managed task with no live stop claim, oldest first: what the
305
325
  * poller checks by exact status.
306
326
  */
327
+ // org-filter: deployment-wide background-task poller sweep across all orgs; each row is
328
+ // handled in its own org
307
329
  async runningManaged() {
308
330
  const rows = await this.db
309
331
  .selectFrom("background_tasks")
@@ -322,6 +344,8 @@ let BackgroundTaskStore = class BackgroundTaskStore {
322
344
  * claim), least recently attempted first. A task whose recorded instance is suspended is left
323
345
  * out: a stop never resumes it, so it cannot progress there.
324
346
  */
347
+ // org-filter: deployment-wide background-task poller sweep across all orgs; each row is
348
+ // handled in its own org
325
349
  async owedCancels() {
326
350
  const rows = await this.db
327
351
  .selectFrom("background_tasks")
@@ -339,6 +363,8 @@ let BackgroundTaskStore = class BackgroundTaskStore {
339
363
  return rows.map(toRow);
340
364
  }
341
365
  /** Records that an exact stop of the task is being attempted now (its owed-stop turn moves back). */
366
+ // org-filter: by task id: callers check ownership first (ownedTask: the calling conversation;
367
+ // TasksService.owned: org and conversation scope) or pass the id of a row they already read
342
368
  async noteCancelAttempt(id) {
343
369
  await this.db
344
370
  .updateTable("background_tasks")
@@ -353,6 +379,8 @@ let BackgroundTaskStore = class BackgroundTaskStore {
353
379
  * is given up, so the poller owes the exact stop; without, the claim stays (a task without its
354
380
  * ref yet: the dispatch binding or the acknowledgement turns the claim into the owed cancel).
355
381
  */
382
+ // org-filter: by task id: callers check ownership first (ownedTask: the calling conversation;
383
+ // TasksService.owned: org and conversation scope) or pass the id of a row they already read
356
384
  async requestCancel(id, by, release) {
357
385
  await this.db
358
386
  .updateTable("background_tasks")
@@ -370,6 +398,8 @@ let BackgroundTaskStore = class BackgroundTaskStore {
370
398
  .execute();
371
399
  }
372
400
  /** The running tasks one conversation owns (not those of its sub-agents), oldest first. */
401
+ // org-filter: by conversation id the caller already resolved in its org (the tool call's
402
+ // conversation, TasksService.scope(orgId, ...), or a kernel launch / deletion path)
373
403
  async runningOwnedBy(conversationId) {
374
404
  const rows = await this.db
375
405
  .selectFrom("background_tasks")
@@ -385,6 +415,8 @@ let BackgroundTaskStore = class BackgroundTaskStore {
385
415
  * The finished tasks one conversation owns (not those of its sub-agents), the most recently
386
416
  * finished first, at most `limit` of them, with how many it owns in all (`TaskList`).
387
417
  */
418
+ // org-filter: by conversation id the caller already resolved in its org (the tool call's
419
+ // conversation, TasksService.scope(orgId, ...), or a kernel launch / deletion path)
388
420
  async finishedOwnedBy(conversationId, limit) {
389
421
  const [rows, count] = await Promise.all([
390
422
  this.db
@@ -406,6 +438,8 @@ let BackgroundTaskStore = class BackgroundTaskStore {
406
438
  return { rows: rows.map(toRow), total: Number(count.n) };
407
439
  }
408
440
  /** The running tasks of one root conversation's tree (what `maxTasks` limits). */
441
+ // org-filter: by conversation id the caller already resolved in its org (the tool call's
442
+ // conversation, TasksService.scope(orgId, ...), or a kernel launch / deletion path)
409
443
  async countRunning(sandboxConversationId) {
410
444
  const r = await this.db
411
445
  .selectFrom("background_tasks")
@@ -416,6 +450,8 @@ let BackgroundTaskStore = class BackgroundTaskStore {
416
450
  return Number(r.n);
417
451
  }
418
452
  /** The tasks owned by any of the conversations, newest first. */
453
+ // org-filter: by conversation id the caller already resolved in its org (the tool call's
454
+ // conversation, TasksService.scope(orgId, ...), or a kernel launch / deletion path)
419
455
  async listFor(conversationIds) {
420
456
  if (conversationIds.length === 0)
421
457
  return [];
@@ -434,6 +470,9 @@ let BackgroundTaskStore = class BackgroundTaskStore {
434
470
  * The caller's transaction also appends the finished event.
435
471
  */
436
472
  async finish(id, to, opts = {}) {
473
+ // org-filter: by task id: callers check ownership first (ownedTask: the calling
474
+ // conversation; TasksService.owned: org and conversation scope) or pass the id of a row
475
+ // they already read
437
476
  let q = this.db
438
477
  .updateTable("background_tasks")
439
478
  .set({
@@ -457,6 +496,8 @@ let BackgroundTaskStore = class BackgroundTaskStore {
457
496
  return Number(r.numUpdatedRows) > 0;
458
497
  }
459
498
  /** Moves the read offset forward only (a concurrent reader never moves it back). */
499
+ // org-filter: by task id: callers check ownership first (ownedTask: the calling conversation;
500
+ // TasksService.owned: org and conversation scope) or pass the id of a row they already read
460
501
  async advanceOffset(id, to) {
461
502
  await this.db
462
503
  .updateTable("background_tasks")
@@ -465,6 +506,8 @@ let BackgroundTaskStore = class BackgroundTaskStore {
465
506
  .where(sql `read_offset < ${to}`)
466
507
  .execute();
467
508
  }
509
+ // org-filter: by task id: callers check ownership first (ownedTask: the calling conversation;
510
+ // TasksService.owned: org and conversation scope) or pass the id of a row they already read
468
511
  async clearKill(ids) {
469
512
  if (ids.length === 0)
470
513
  return;
@@ -479,6 +522,7 @@ let BackgroundTaskStore = class BackgroundTaskStore {
479
522
  * managed record whose launch or cancellation is still uncertain (only `legacy` and settled
480
523
  * `terminal` rows go).
481
524
  */
525
+ // org-filter: deployment-wide retention sweep across all orgs (finished rows past their age)
482
526
  async pruneFinished(before) {
483
527
  const r = await this.db
484
528
  .deleteFrom("background_tasks")
@@ -159,7 +159,7 @@ let BackgroundTasks = class BackgroundTasks {
159
159
  return { ...read.value, source: "live" };
160
160
  const unavailable = {
161
161
  reason: read.reason,
162
- provider: await this.providerOf(task.deviceId),
162
+ provider: await this.providerOf(task.orgId, task.deviceId),
163
163
  };
164
164
  if (task.status !== "running") {
165
165
  const ev = await this.eventLog.findByIdem(task.conversationId, finishedEventKey(task.id));
@@ -170,13 +170,14 @@ let BackgroundTasks = class BackgroundTasks {
170
170
  throw new ApiError("background_task.output_unavailable", `The task's output cannot be read now (${unavailable.reason})`, [unavailable]);
171
171
  }
172
172
  /** The provider of the device the task ran on (`devices.provider`); null when none is known. */
173
- async providerOf(deviceId) {
173
+ async providerOf(orgId, deviceId) {
174
174
  if (deviceId === null)
175
175
  return null;
176
176
  const row = await this.db.db
177
177
  .selectFrom("devices")
178
178
  .select("provider")
179
179
  .where("id", "=", deviceId)
180
+ .where("org_id", "=", orgId)
180
181
  .executeTakeFirst();
181
182
  return row?.provider ?? null;
182
183
  }
@@ -86,6 +86,7 @@ export async function wakeDecisionIn(t, conv, consumed, deploymentOn, canSend) {
86
86
  .selectFrom("conversations")
87
87
  .select(["queue_paused", "deleted_at", "tree_stopped_at"])
88
88
  .where("id", "=", conv.rootId)
89
+ .where("org_id", "=", conv.orgId)
89
90
  .executeTakeFirst();
90
91
  if (!root || root.queue_paused || !isLive(root.deleted_at))
91
92
  return null;
@@ -165,6 +165,12 @@ export declare class AdminCatalogController {
165
165
  * `sendCatalogIcon`). No icon -> 404 `catalog.icon_not_found`.
166
166
  */
167
167
  icon(id: string, reply: FastifyReply): Promise<void>;
168
+ /**
169
+ * A platform connector template's own icon (any live template; same response headers as the
170
+ * item icon). Unknown template -> 404 `component.not_found`; no icon of its own -> 404
171
+ * `catalog.icon_not_found`.
172
+ */
173
+ templateIcon(templateId: string, reply: FastifyReply): Promise<void>;
168
174
  /**
169
175
  * A setup guide of the item as the platform sees it (spec 2026-11-09-setup-guides-v2-design.md
170
176
  * §9.3; the admin console's connector template page): any live item, the admin audience, no org
@@ -255,6 +255,14 @@ let AdminCatalogController = class AdminCatalogController {
255
255
  async icon(id, reply) {
256
256
  await sendCatalogIcon(reply, await this.orgCatalog.icon(id, true));
257
257
  }
258
+ /**
259
+ * A platform connector template's own icon (any live template; same response headers as the
260
+ * item icon). Unknown template -> 404 `component.not_found`; no icon of its own -> 404
261
+ * `catalog.icon_not_found`.
262
+ */
263
+ async templateIcon(templateId, reply) {
264
+ await sendCatalogIcon(reply, await this.icons.readTemplateIcon(templateId, { kind: "admin" }));
265
+ }
258
266
  /**
259
267
  * A setup guide of the item as the platform sees it (spec 2026-11-09-setup-guides-v2-design.md
260
268
  * §9.3; the admin console's connector template page): any live item, the admin audience, no org
@@ -424,6 +432,11 @@ __decorate([
424
432
  __param(0, Param("id")),
425
433
  __param(1, Res())
426
434
  ], AdminCatalogController.prototype, "icon", null);
435
+ __decorate([
436
+ Get("connector-templates/:templateId/icon"),
437
+ __param(0, Param("templateId")),
438
+ __param(1, Res())
439
+ ], AdminCatalogController.prototype, "templateIcon", null);
427
440
  __decorate([
428
441
  Get(":itemId/guides/:guideId"),
429
442
  __param(0, Param("itemId")),
@@ -65,7 +65,10 @@ export interface OrgCatalogItem extends Omit<CatalogItemView, "installs" | "mark
65
65
  export interface OrgCatalogTemplate {
66
66
  id: string;
67
67
  displayName: LocalizedName | null;
68
+ /** The English text, or the one text of a plain-string description ("" without one). */
68
69
  description: string;
70
+ /** The Chinese text of a `{ zh, en }` description; null: `description` serves both languages. */
71
+ descriptionZh: string | null;
69
72
  plugin: string;
70
73
  connector: string;
71
74
  endpoint: Record<string, unknown>;
@@ -98,6 +101,11 @@ export interface OrgCatalogTemplate {
98
101
  itemId: string;
99
102
  guideId: string;
100
103
  } | null;
104
+ /**
105
+ * The template's icon on the org's routes: its own icon, else its plugin's, else null
106
+ * (`PluginIcons.ofItemTemplates`).
107
+ */
108
+ icon: string | null;
101
109
  }
102
110
  /** `GET /orgs/:orgId/catalog/:itemId`: the item and what the install wizard needs (latest version). */
103
111
  export interface OrgCatalogDetail {
@@ -135,6 +143,7 @@ export declare function orgTemplateView(id: string, file: ConnectorTemplateFile,
135
143
  guide?: OrgCatalogTemplate["guide"];
136
144
  on?: boolean;
137
145
  connected?: boolean;
146
+ icon?: string | null;
138
147
  }): OrgCatalogTemplate;
139
148
  /** An item's icon (the latest version's plugin icon). */
140
149
  export interface CatalogIcon {
@@ -10,6 +10,7 @@ import { packagePath } from "../packages/tgz.js";
10
10
  import { checkSkillFiles, SkillArchiveError } from "../skills/package.js";
11
11
  import { readDisplayFiles } from "./catalog-files.js";
12
12
  import { iconProblem, pluginThemeError, themeApiError } from "./plugin-package.js";
13
+ import { templateDescriptionText } from "./template-description.js";
13
14
  import { satisfiesRange } from "./versions.js";
14
15
  /**
15
16
  * A connector template as an org sees it (the install wizard and the upgrade preview's inputs):
@@ -20,7 +21,7 @@ export function orgTemplateView(id, file, o = {}) {
20
21
  return {
21
22
  id,
22
23
  displayName: file.displayName,
23
- description: file.description ?? "",
24
+ ...templateDescriptionText(file.description),
24
25
  plugin: t.plugin,
25
26
  connector: t.connector,
26
27
  endpoint: t.endpoint,
@@ -32,6 +33,7 @@ export function orgTemplateView(id, file, o = {}) {
32
33
  on: o.on ?? true,
33
34
  connected: o.connected ?? false,
34
35
  guide: o.guide ?? null,
36
+ icon: o.icon ?? null,
35
37
  };
36
38
  }
37
39
  const iconNotFound = () => new ApiError("catalog.icon_not_found", "This catalog item has no icon");