@capybara-hq/kernel 0.1.0-rc.76 → 0.1.0-rc.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/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 +6 -0
  21. package/dist/catalog/catalog-content.js +1 -0
  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.js +2 -0
  29. package/dist/catalog/marketplaces.service.d.ts +6 -1
  30. package/dist/catalog/marketplaces.service.js +8 -3
  31. package/dist/catalog/org-catalog.controller.d.ts +9 -0
  32. package/dist/catalog/org-catalog.controller.js +18 -0
  33. package/dist/catalog/org-catalog.schemas.d.ts +2 -4
  34. package/dist/catalog/org-catalog.schemas.js +2 -3
  35. package/dist/catalog/org-catalog.service.d.ts +10 -1
  36. package/dist/catalog/org-catalog.service.js +34 -23
  37. package/dist/catalog/org-extension-switch.d.ts +3 -10
  38. package/dist/catalog/org-extension-switch.js +14 -60
  39. package/dist/catalog/org-extension.controller.d.ts +6 -7
  40. package/dist/catalog/org-extension.controller.js +4 -4
  41. package/dist/catalog/org-extension.schemas.d.ts +1 -2
  42. package/dist/catalog/org-extension.schemas.js +1 -3
  43. package/dist/catalog/owned-items.js +10 -1
  44. package/dist/catalog/ownership.js +2 -0
  45. package/dist/catalog/plugin-import.js +8 -0
  46. package/dist/catalog/plugin-install.d.ts +1 -4
  47. package/dist/catalog/plugin-install.js +11 -12
  48. package/dist/catalog/plugin-upgrade.js +4 -1
  49. package/dist/catalog/request-rules.js +6 -0
  50. package/dist/catalog/requests.service.js +4 -0
  51. package/dist/catalog/scope-orgs.js +1 -0
  52. package/dist/catalog/scope-sync.d.ts +8 -5
  53. package/dist/catalog/scope-sync.js +21 -23
  54. package/dist/catalog/unshare.js +3 -0
  55. package/dist/channels/connections.service.js +1 -0
  56. package/dist/channels/inbound.js +1 -0
  57. package/dist/channels/jobs.js +1 -0
  58. package/dist/channels/outbound.js +6 -0
  59. package/dist/channels/supervisor.js +1 -0
  60. package/dist/channels/threads.js +1 -0
  61. package/dist/client/client-reports.service.js +1 -0
  62. package/dist/config/fields.js +20 -4
  63. package/dist/conversations/access.js +1 -0
  64. package/dist/conversations/attachments.service.js +16 -4
  65. package/dist/conversations/conversations.service.js +17 -3
  66. package/dist/conversations/event-log.js +2 -0
  67. package/dist/conversations/events.d.ts +1 -0
  68. package/dist/conversations/events.js +3 -1
  69. package/dist/conversations/files.js +3 -2
  70. package/dist/conversations/permission-profiles.service.js +1 -0
  71. package/dist/conversations/prompt-suggestions.js +2 -0
  72. package/dist/conversations/queue.js +8 -0
  73. package/dist/conversations/queue.service.js +6 -2
  74. package/dist/conversations/source.js +2 -0
  75. package/dist/conversations/titles.js +10 -2
  76. package/dist/conversations/tree.js +6 -0
  77. package/dist/db/kernel-schema.d.ts +3 -1
  78. package/dist/devices/conversation-devices.js +3 -0
  79. package/dist/devices/device-projects.service.js +2 -0
  80. package/dist/devices/devices.service.js +5 -0
  81. package/dist/devices/legacy-cleanup.job.js +5 -2
  82. package/dist/dial-in/handlers.js +2 -0
  83. package/dist/dial-in/machines.js +11 -2
  84. package/dist/dial-in/targets.d.ts +0 -2
  85. package/dist/dial-in/targets.js +0 -10
  86. package/dist/errors.d.ts +0 -1
  87. package/dist/errors.js +0 -1
  88. package/dist/evals/budget.js +14 -1
  89. package/dist/evals/run-replay.js +4 -0
  90. package/dist/evals/runs.service.js +13 -7
  91. package/dist/evals/sets.service.js +23 -8
  92. package/dist/evals/trajectory.service.d.ts +1 -1
  93. package/dist/evals/trajectory.service.js +1 -0
  94. package/dist/evals/worker.js +5 -1
  95. package/dist/extensions/admin-ops.js +1 -0
  96. package/dist/extensions/admin-view.js +3 -1
  97. package/dist/extensions/bootstrap-packages.d.ts +12 -1
  98. package/dist/extensions/bootstrap-packages.js +49 -9
  99. package/dist/extensions/bootstrap.d.ts +36 -4
  100. package/dist/extensions/bootstrap.js +103 -16
  101. package/dist/extensions/config-json-schema.d.ts +2 -2
  102. package/dist/extensions/config-json-schema.js +1 -3
  103. package/dist/extensions/deployment-config.d.ts +5 -3
  104. package/dist/extensions/deployment-config.js +3 -3
  105. package/dist/extensions/effective-config.d.ts +8 -7
  106. package/dist/extensions/effective-config.js +8 -7
  107. package/dist/extensions/enabled.js +1 -0
  108. package/dist/extensions/host.d.ts +4 -3
  109. package/dist/extensions/host.js +11 -12
  110. package/dist/extensions/instance.d.ts +1 -1
  111. package/dist/extensions/instance.js +17 -2
  112. package/dist/extensions/org-config.d.ts +35 -97
  113. package/dist/extensions/org-config.js +48 -315
  114. package/dist/extensions/org-levels.d.ts +22 -9
  115. package/dist/extensions/org-levels.js +100 -20
  116. package/dist/extensions/org-overrides.d.ts +14 -15
  117. package/dist/extensions/org-overrides.js +20 -20
  118. package/dist/extensions/package.js +1 -1
  119. package/dist/extensions/permission-set.d.ts +1 -3
  120. package/dist/extensions/permission-set.js +3 -7
  121. package/dist/extensions/permission-view.d.ts +3 -1
  122. package/dist/extensions/permission-view.js +5 -4
  123. package/dist/extensions/plugin-icons.d.ts +72 -1
  124. package/dist/extensions/plugin-icons.js +194 -2
  125. package/dist/extensions/point-defaults.d.ts +17 -18
  126. package/dist/extensions/point-defaults.js +25 -28
  127. package/dist/identity/accounts.js +6 -0
  128. package/dist/identity/api-tokens.js +8 -0
  129. package/dist/infra/outbox/outbox.dispatcher.js +4 -1
  130. package/dist/infra/outbox/outbox.service.js +2 -0
  131. package/dist/orgs/directory-sync.d.ts +9 -6
  132. package/dist/orgs/directory-sync.js +15 -12
  133. package/dist/orgs/invitations.service.js +2 -0
  134. package/dist/orgs/members.service.js +2 -0
  135. package/dist/orgs/offboarding.js +2 -0
  136. package/dist/packages/npm.d.ts +9 -1
  137. package/dist/packages/npm.js +37 -5
  138. package/dist/platform/exclusions.js +20 -0
  139. package/dist/platform/ops/admin-items.ops.js +1 -0
  140. package/dist/platform/ops/agents.ops.js +1 -0
  141. package/dist/platform/ops/extensions.ops.d.ts +6 -8
  142. package/dist/platform/ops/extensions.ops.js +18 -97
  143. package/dist/platform/ops/org-plugins.ops.d.ts +3 -6
  144. package/dist/platform/ops/org-plugins.ops.js +14 -65
  145. package/dist/platform/ops/outbox.ops.js +1 -0
  146. package/dist/platform/ops/person-inputs.d.ts +0 -4
  147. package/dist/platform/ops/person-inputs.js +0 -8
  148. package/dist/platform/ops/plugins.ops.d.ts +4 -1
  149. package/dist/platform/ops/plugins.ops.js +27 -34
  150. package/dist/platform/person-fields.d.ts +1 -1
  151. package/dist/platform/person-fields.js +1 -1
  152. package/dist/platform/sealed-reveals.js +2 -0
  153. package/dist/push/recipients.js +9 -2
  154. package/dist/runtime/permission-context.service.js +1 -0
  155. package/dist/runtime/plugin-context.service.js +1 -0
  156. package/dist/runtime/project/knowledge.service.js +1 -0
  157. package/dist/runtime/run-context.service.js +1 -0
  158. package/dist/runtime/run-deletion.js +4 -0
  159. package/dist/runtime/run-execution.js +2 -0
  160. package/dist/runtime/run-finish.js +3 -0
  161. package/dist/runtime/run-jobs.js +3 -0
  162. package/dist/runtime/run-orphan-check.job.js +7 -0
  163. package/dist/runtime/run-queue.js +21 -2
  164. package/dist/runtime/run-worker.js +5 -0
  165. package/dist/runtime/step-log.js +1 -0
  166. package/dist/runtime/subagents/child.js +2 -0
  167. package/dist/runtime/subagents/deliveries.js +3 -0
  168. package/dist/runtime/subagents/dispatch.js +5 -1
  169. package/dist/runtime/subagents/messages.js +2 -0
  170. package/dist/runtime/subagents/org-agents.d.ts +1 -1
  171. package/dist/runtime/subagents/org-agents.js +2 -1
  172. package/dist/runtime/usage-report-jobs.js +1 -0
  173. package/dist/runtime/usage-report.js +3 -0
  174. package/dist/runtime/waits.js +5 -0
  175. package/dist/sandbox/cloud-permission-snapshot.js +9 -3
  176. package/dist/sandbox/device-reports.js +3 -0
  177. package/dist/sandbox/legacy-retirement.js +5 -1
  178. package/dist/sandbox/managed-device-context.js +1 -0
  179. package/dist/sandbox/modes.d.ts +5 -2
  180. package/dist/sandbox/modes.js +8 -4
  181. package/dist/sandbox/network-grants.js +2 -0
  182. package/dist/sandbox/operation-intents.js +58 -0
  183. package/dist/sandbox/operation-reconcile.job.js +2 -0
  184. package/dist/sandbox/permission-authority-lock.js +12 -6
  185. package/dist/sandbox/permission-call-grants.js +6 -0
  186. package/dist/sandbox/permission-ceiling-writes.js +5 -0
  187. package/dist/sandbox/permission-config-publication.js +5 -0
  188. package/dist/sandbox/permission-instance-writes.js +4 -0
  189. package/dist/sandbox/permission-runtime-reports.js +10 -1
  190. package/dist/sandbox/permission-transitions.js +3 -0
  191. package/dist/sandbox/review/review.service.js +8 -5
  192. package/dist/sandbox/sandbox.service.d.ts +14 -0
  193. package/dist/sandbox/sandbox.service.js +195 -29
  194. package/dist/sandbox/unreachable.js +4 -1
  195. package/dist/schedules/fire.js +9 -3
  196. package/dist/schedules/pause.js +2 -0
  197. package/dist/schedules/run-tracker.js +16 -1
  198. package/dist/schedules/scheduled-tasks.service.js +4 -2
  199. package/dist/schedules/store.js +8 -0
  200. package/dist/schedules/unattended.js +4 -0
  201. package/dist/setup/setup-checks.service.d.ts +1 -10
  202. package/dist/setup/setup-checks.service.js +19 -29
  203. package/dist/shares/share-open.service.js +1 -0
  204. package/dist/shares/shares.service.js +2 -0
  205. package/dist/skills/agent-skills.service.d.ts +1 -1
  206. package/dist/skills/agent-skills.service.js +13 -2
  207. package/dist/skills/catalog.js +3 -0
  208. package/dist/skills/changes.service.js +10 -2
  209. package/dist/skills/conversation-catalog.js +1 -0
  210. package/dist/skills/skills.service.js +4 -0
  211. package/dist/tools/approvals.service.js +40 -0
  212. package/dist/tools/builtins/schedules.js +11 -6
  213. package/dist/tools/builtins/skill-load.d.ts +10 -9
  214. package/dist/tools/builtins/skill-load.js +15 -19
  215. package/dist/tools/builtins/web/fetch.js +1 -1
  216. package/dist/tools/builtins/web/search.js +1 -1
  217. package/dist/tools/connector-account-policies.js +3 -0
  218. package/dist/tools/connectors.controller.d.ts +20 -8
  219. package/dist/tools/connectors.controller.js +30 -12
  220. package/dist/tools/connectors.service.d.ts +8 -0
  221. package/dist/tools/connectors.service.js +21 -1
  222. package/dist/tools/drift.js +5 -0
  223. package/dist/tools/git-push-policy.js +3 -0
  224. package/dist/tools/oauth/flow.js +1 -0
  225. package/dist/tools/outputs.js +2 -0
  226. package/dist/tools/permission-approval-jobs.js +3 -0
  227. package/dist/tools/pipeline.js +2 -0
  228. package/dist/tools/policy.js +3 -0
  229. package/dist/tools/questions.service.js +13 -0
  230. package/package.json +3 -3
@@ -277,6 +277,7 @@ let ApprovalsService = class ApprovalsService {
277
277
  .selectFrom("conversations")
278
278
  .select("id")
279
279
  .where("id", "=", input.conversationId)
280
+ .where("org_id", "=", input.orgId)
280
281
  .forUpdate()
281
282
  .execute();
282
283
  await t
@@ -306,6 +307,7 @@ let ApprovalsService = class ApprovalsService {
306
307
  const row = await t
307
308
  .selectFrom("approvals")
308
309
  .selectAll()
310
+ .where("org_id", "=", input.orgId)
309
311
  .where("run_id", "=", input.runId)
310
312
  .where("call_id", "=", input.callId)
311
313
  .where("attempt", "=", input.attempt ?? 1)
@@ -359,6 +361,7 @@ let ApprovalsService = class ApprovalsService {
359
361
  .selectFrom("conversations")
360
362
  .select("id")
361
363
  .where("id", "=", input.conversationId)
364
+ .where("org_id", "=", input.orgId)
362
365
  .forUpdate()
363
366
  .execute();
364
367
  const detail = { personFields: input.personFields, target: input.target };
@@ -391,6 +394,7 @@ let ApprovalsService = class ApprovalsService {
391
394
  const row = await t
392
395
  .selectFrom("approvals")
393
396
  .selectAll()
397
+ .where("org_id", "=", input.orgId)
394
398
  .where("run_id", "=", input.runId)
395
399
  .where("call_id", "=", input.callId)
396
400
  .where("attempt", "=", input.attempt)
@@ -457,6 +461,7 @@ let ApprovalsService = class ApprovalsService {
457
461
  .selectFrom("conversations")
458
462
  .select("id")
459
463
  .where("id", "=", input.conversationId)
464
+ .where("org_id", "=", input.orgId)
460
465
  .forUpdate()
461
466
  .execute();
462
467
  // only the device's owner is ever asked: never another account the caller names
@@ -470,6 +475,7 @@ let ApprovalsService = class ApprovalsService {
470
475
  const last = await t
471
476
  .selectFrom("approvals")
472
477
  .select(sql `max(attempt)`.as("attempt"))
478
+ .where("org_id", "=", input.orgId)
473
479
  .where("run_id", "=", input.runId)
474
480
  .where("call_id", "=", input.callId)
475
481
  .executeTakeFirst();
@@ -552,6 +558,7 @@ let ApprovalsService = class ApprovalsService {
552
558
  .selectFrom("conversations")
553
559
  .select("id")
554
560
  .where("id", "=", input.conversationId)
561
+ .where("org_id", "=", input.orgId)
555
562
  .forUpdate()
556
563
  .execute();
557
564
  // only a member of the org is asked, and only about a live connector of the org
@@ -572,6 +579,7 @@ let ApprovalsService = class ApprovalsService {
572
579
  const last = await t
573
580
  .selectFrom("approvals")
574
581
  .select(sql `max(attempt)`.as("attempt"))
582
+ .where("org_id", "=", input.orgId)
575
583
  .where("run_id", "=", input.runId)
576
584
  .where("call_id", "=", input.callId)
577
585
  .executeTakeFirst();
@@ -668,6 +676,7 @@ let ApprovalsService = class ApprovalsService {
668
676
  .selectFrom("conversations")
669
677
  .select("id")
670
678
  .where("id", "=", input.conversationId)
679
+ .where("org_id", "=", input.orgId)
671
680
  .forUpdate()
672
681
  .execute();
673
682
  // only the device's owner is ever asked: never another account the caller names
@@ -685,6 +694,7 @@ let ApprovalsService = class ApprovalsService {
685
694
  const last = await t
686
695
  .selectFrom("approvals")
687
696
  .select(sql `max(attempt)`.as("attempt"))
697
+ .where("org_id", "=", input.orgId)
688
698
  .where("run_id", "=", input.runId)
689
699
  .where("call_id", "=", input.callId)
690
700
  .executeTakeFirst();
@@ -1216,6 +1226,7 @@ let ApprovalsService = class ApprovalsService {
1216
1226
  }),
1217
1227
  })
1218
1228
  .where("id", "=", id)
1229
+ .where("org_id", "=", orgId)
1219
1230
  .execute();
1220
1231
  return { leaked };
1221
1232
  }
@@ -1277,6 +1288,7 @@ let ApprovalsService = class ApprovalsService {
1277
1288
  }),
1278
1289
  })
1279
1290
  .where("id", "=", id)
1291
+ .where("org_id", "=", orgId)
1280
1292
  .returningAll()
1281
1293
  .executeTakeFirstOrThrow();
1282
1294
  if (approved && before.command?.permissionCandidate) {
@@ -1483,6 +1495,7 @@ let ApprovalsService = class ApprovalsService {
1483
1495
  .leftJoin("agent_versions as v", (j) => j.onRef("v.agent_id", "=", "ag.id").onRef("v.version", "=", "ag.current_version"))
1484
1496
  .select(["s.account_id", "v.definition"])
1485
1497
  .where("s.id", "=", served.taskId)
1498
+ .where("s.org_id", "=", a.orgId)
1486
1499
  .where("s.deleted_at", "is", null)
1487
1500
  .executeTakeFirst();
1488
1501
  if (task?.account_id !== decidedBy)
@@ -1612,6 +1625,8 @@ let ApprovalsService = class ApprovalsService {
1612
1625
  * 详情,不做处理人校验(内核内部用:渠道出站投递组装 IM 审批卡片);不存在返回 null。
1613
1626
  * 不得直接回给请求方——HTTP 接口用 {@link get}。
1614
1627
  */
1628
+ // org-filter: approvalId comes from an approval event payload in the conversation's own event
1629
+ // log (channel outbound cards), kernel-written, never caller input
1615
1630
  async describe(id) {
1616
1631
  const row = await this.db
1617
1632
  .selectFrom("approvals")
@@ -1624,6 +1639,8 @@ let ApprovalsService = class ApprovalsService {
1624
1639
  return view ?? null;
1625
1640
  }
1626
1641
  /** 某个工具调用最近一次的工具审批(attempt 最大者,网络询问除外);没有则返回 null。 */
1642
+ // org-filter: runId is the runtime's own run (a uuid) whose call the tool pipeline is handling;
1643
+ // never caller input
1627
1644
  async forCall(runId, callId) {
1628
1645
  const row = await this.db
1629
1646
  .selectFrom("approvals")
@@ -1637,6 +1654,8 @@ let ApprovalsService = class ApprovalsService {
1637
1654
  return row ? toRecord(row) : null;
1638
1655
  }
1639
1656
  /** The latest secure input request of a tool call (highest attempt); null when it has none. */
1657
+ // org-filter: runId is the runtime's own run (a uuid) whose call the tool pipeline is handling;
1658
+ // never caller input
1640
1659
  async secureInputForCall(runId, callId) {
1641
1660
  const row = await this.db
1642
1661
  .selectFrom("approvals")
@@ -1650,6 +1669,8 @@ let ApprovalsService = class ApprovalsService {
1650
1669
  return row ? toRecord(row) : null;
1651
1670
  }
1652
1671
  /** The network ask of a tool call (at most one per call); null when it has none. */
1672
+ // org-filter: runId is the runtime's own run (a uuid) whose call the tool pipeline is handling;
1673
+ // never caller input
1653
1674
  async networkForCall(runId, callId) {
1654
1675
  const row = await this.db
1655
1676
  .selectFrom("approvals")
@@ -1663,6 +1684,8 @@ let ApprovalsService = class ApprovalsService {
1663
1684
  return row ? toRecord(row) : null;
1664
1685
  }
1665
1686
  /** The git push ask of a tool call (at most one per call); null when it has none. */
1687
+ // org-filter: runId is the runtime's own run (a uuid) whose call the tool pipeline is handling;
1688
+ // never caller input
1666
1689
  async gitForCall(runId, callId) {
1667
1690
  const row = await this.db
1668
1691
  .selectFrom("approvals")
@@ -1676,6 +1699,8 @@ let ApprovalsService = class ApprovalsService {
1676
1699
  return row ? toRecord(row) : null;
1677
1700
  }
1678
1701
  /** The command review ask of a tool call (at most one per call); null when it has none. */
1702
+ // org-filter: runId is the runtime's own run (a uuid) whose call the tool pipeline is handling;
1703
+ // never caller input
1679
1704
  async commandForCall(runId, callId) {
1680
1705
  const row = await this.db
1681
1706
  .selectFrom("approvals")
@@ -1700,6 +1725,7 @@ let ApprovalsService = class ApprovalsService {
1700
1725
  }
1701
1726
  return r.record ? { outcome: r.outcome, record: r.record } : { outcome: r.outcome };
1702
1727
  }
1728
+ // org-filter: id is the approval of the kernel-written timeout job payload (Waits), not caller input
1703
1729
  async expireIn(id) {
1704
1730
  const t = this.db.db;
1705
1731
  if (!(await this.lockConversationOf(id)))
@@ -1731,6 +1757,8 @@ let ApprovalsService = class ApprovalsService {
1731
1757
  * 在调用方的事务内(`mandatory`)取消运行的全部 pending 审批(运行在等待中被中止),各写
1732
1758
  * `approval_decided{cancelled}`(处理人为 null)。返回被取消的记录;调用方提交后发布事件。
1733
1759
  */
1760
+ // org-filter: runId is the run the kernel is stopping or finishing (Waits, RunFinish), not caller
1761
+ // input
1734
1762
  async cancelPendingIn(runId) {
1735
1763
  const t = this.db.db;
1736
1764
  const rows = await t
@@ -1802,6 +1830,7 @@ let ApprovalsService = class ApprovalsService {
1802
1830
  .updateTable("approvals")
1803
1831
  .set({ status: "cancelled", decided_at: sql `now()` })
1804
1832
  .where("id", "=", row.id)
1833
+ .where("org_id", "=", orgId)
1805
1834
  .returningAll()
1806
1835
  .executeTakeFirstOrThrow();
1807
1836
  const seq = await this.decidedEvent(toRecord(row), "cancelled");
@@ -1823,6 +1852,9 @@ let ApprovalsService = class ApprovalsService {
1823
1852
  * and emits the domain event `approval.decided{skipped}` after the commit (its IM card update is
1824
1853
  * owed by the append, transactional outbox spec §8.1).
1825
1854
  */
1855
+ // org-filter: conversationId is the conversation the caller wrote the author's message in and
1856
+ // holds locked (ConversationsService, checked in its org); the tree is its sub-agents'
1857
+ // conversations, and every row below is read from that tree
1826
1858
  async skipNetworkIn(conversationId, authorAccountId) {
1827
1859
  const t = this.db.db;
1828
1860
  const tree = await this.subtreeOf(conversationId);
@@ -1880,6 +1912,8 @@ let ApprovalsService = class ApprovalsService {
1880
1912
  const row = await q.executeTakeFirst();
1881
1913
  if (!row)
1882
1914
  return false;
1915
+ // org-filter: the conversation of the approval row read just above (org-filtered when the
1916
+ // caller passes orgId; otherwise a kernel-written approval id, see expireIn)
1883
1917
  await t
1884
1918
  .selectFrom("conversations")
1885
1919
  .select("id")
@@ -1893,6 +1927,8 @@ let ApprovalsService = class ApprovalsService {
1893
1927
  const found = [...new Set((await ids.execute()).map((r) => r.conversation_id))];
1894
1928
  if (found.length === 0)
1895
1929
  return [];
1930
+ // org-filter: the ids come from the caller's query over approvals of a conversation tree it
1931
+ // already holds (skipNetworkIn)
1896
1932
  const rows = await this.db.db
1897
1933
  .selectFrom("conversations")
1898
1934
  .select("id")
@@ -1903,6 +1939,7 @@ let ApprovalsService = class ApprovalsService {
1903
1939
  return rows.map((r) => r.id);
1904
1940
  }
1905
1941
  /** `conversationId` and its sub-agents' conversations at any depth (at most 16 levels). */
1942
+ // org-filter: sub-agent conversations live in their parent's org; the root is the caller's
1906
1943
  async subtreeOf(conversationId) {
1907
1944
  const all = [conversationId];
1908
1945
  let level = [conversationId];
@@ -1984,6 +2021,8 @@ let ApprovalsService = class ApprovalsService {
1984
2021
  return m?.role ?? null;
1985
2022
  }
1986
2023
  /** agent id → 当前版本定义里的名字。 */
2024
+ // org-filter: the agent ids come from the conversations of approval rows the callers already
2025
+ // read in their org (views)
1987
2026
  async agentNames(ids) {
1988
2027
  if (ids.length === 0)
1989
2028
  return new Map();
@@ -2027,6 +2066,7 @@ let ApprovalsService = class ApprovalsService {
2027
2066
  const connectorIds = [
2028
2067
  ...new Set(recs.flatMap((r) => (r.connectorId === null ? [] : [r.connectorId]))),
2029
2068
  ];
2069
+ // org-filter: connector ids from approval rows the callers already read in their org
2030
2070
  const apps = connectorIds.length === 0
2031
2071
  ? []
2032
2072
  : await db
@@ -366,19 +366,23 @@ const normalizedChat = (chat) => ({
366
366
  chatId: chat.chatId,
367
367
  chatType: chat.chatType ?? "dm",
368
368
  });
369
- /** A chat target with its connection's name for the words. */
370
- async function chatTargetOf(db, chat) {
369
+ /**
370
+ * A chat target with its connection's name for the words. The connection id may come from the
371
+ * model's tool input: only a connection of `orgId` lends its name (another org's id shows as is).
372
+ */
373
+ async function chatTargetOf(db, orgId, chat) {
371
374
  const c = await db
372
375
  .selectFrom("channel_connections")
373
376
  .select("name")
374
377
  .where("id", "=", chat.connectionId)
378
+ .where("org_id", "=", orgId)
375
379
  .executeTakeFirst();
376
380
  return { mode: "chat", chat, connectionName: c?.name ?? chat.connectionId };
377
381
  }
378
382
  /** A stored task's target; a chat's connection name is read for the words. */
379
383
  async function storedTarget(db, task) {
380
384
  if (task.mode === "chat" && task.chat !== null)
381
- return chatTargetOf(db, task.chat);
385
+ return chatTargetOf(db, task.orgId, task.chat);
382
386
  if (task.mode === "conversation" && task.conversationId !== null) {
383
387
  return { mode: "conversation", conversationId: task.conversationId };
384
388
  }
@@ -552,6 +556,7 @@ export function scheduleTools(deps) {
552
556
  .db()
553
557
  .selectFrom("approvals")
554
558
  .select("summary")
559
+ .where("org_id", "=", ctx.orgId)
555
560
  .where("run_id", "=", ctx.runId)
556
561
  .where("call_id", "=", ctx.callId)
557
562
  .where("status", "=", "approved")
@@ -594,7 +599,7 @@ export function scheduleTools(deps) {
594
599
  const target = input.mode === "here"
595
600
  ? await hereTarget(deps.db(), ctx.orgId, ctx.accountId, ctx.conversationId)
596
601
  : input.mode === "chat"
597
- ? await chatTargetOf(deps.db(), normalizedChat(input.chat))
602
+ ? await chatTargetOf(deps.db(), ctx.orgId, normalizedChat(input.chat))
598
603
  : { mode: "new" };
599
604
  return {
600
605
  trigger,
@@ -709,7 +714,7 @@ export function scheduleTools(deps) {
709
714
  const after = input.mode === "here"
710
715
  ? await hereTarget(db, ctx.orgId, ctx.accountId, ctx.conversationId)
711
716
  : input.mode === "chat"
712
- ? await chatTargetOf(db, normalizedChat(input.chat))
717
+ ? await chatTargetOf(db, ctx.orgId, normalizedChat(input.chat))
713
718
  : { mode: "new" };
714
719
  if (!sameTarget(before, after)) {
715
720
  const b = targetWords(before, ctx.conversationId);
@@ -814,7 +819,7 @@ export function scheduleTools(deps) {
814
819
  const target = input.mode === "here"
815
820
  ? await hereTarget(deps.db(), ctx.orgId, ctx.accountId, ctx.conversationId)
816
821
  : input.mode === "chat"
817
- ? await chatTargetOf(deps.db(), normalizedChat(input.chat))
822
+ ? await chatTargetOf(deps.db(), ctx.orgId, normalizedChat(input.chat))
818
823
  : { mode: "new" };
819
824
  const f = targetFields(target);
820
825
  patch.mode = f.mode;
@@ -63,10 +63,12 @@ export declare function findSkillVersion(db: KernelSchemaDb, ctx: Pick<BuiltinCa
63
63
  /** A digest of the right shape for the renderer; only inside the sentinel directory. */
64
64
  export declare const PROJECT_DIR_DIGEST = "000000000000";
65
65
  /** Why a project skill's SKILL.md could not be used (each caller phrases it for its reader). */
66
- export type ProjectSkillProblem = {
67
- kind: "outside_mode";
66
+ export type ProjectSkillProblem =
67
+ /** The path built from the recorded root fails the shape checks (`why`: which). */
68
+ {
69
+ kind: "bad_path";
68
70
  path: string;
69
- mode: string;
71
+ why: string;
70
72
  } | {
71
73
  kind: "gone";
72
74
  path: string;
@@ -97,12 +99,11 @@ export interface ProjectSkillFile {
97
99
  truncated: boolean;
98
100
  }
99
101
  /**
100
- * Reads `<root>/.agents/skills/<name>/SKILL.md` in `s` (its path checked as `Read` checks one,
101
- * {@link checkToolPath}) and parses it; its name must be its
102
- * directory's. Shared by `Skill` and a person's invocation (`SkillInvoker`), so both read a
103
- * project skill the same way. A problem with the file or its path throws
104
- * {@link ProjectSkillReadError}; the sandbox's own failures (offline, lost files, ...) and an abort
105
- * are rethrown as they are.
102
+ * Reads `<root>/.agents/skills/<name>/SKILL.md` in `s` (its path shape checked as `Read` checks
103
+ * one, `validateSandboxPathShape`) and parses it; its name must be its directory's. A problem with
104
+ * the file or its path throws {@link ProjectSkillReadError}; the sandbox's own failures (offline,
105
+ * lost files, a read outside the scope the device admits, ...) and an abort are rethrown as they
106
+ * are.
106
107
  */
107
108
  export declare function readProjectSkill(s: SandboxSession, root: string, bare: string, signal?: AbortSignal): Promise<ProjectSkillFile>;
108
109
  /** 内置工具 `Skill`(见文件头)。 */
@@ -1,5 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
- import { parseSkillMd, renderSkillBody, SKILL_ENTRY_FILE, SKILL_INVOCATION_LIMITS, SKILLS_SANDBOX_ROOT, skillDigest, skillInvocation, skillSandboxDir, skillSandboxPath, ToolError, } from "@capybara-hq/plugin-sdk";
2
+ import { parseSkillMd, renderSkillBody, SKILL_ENTRY_FILE, SKILL_INVOCATION_LIMITS, SKILLS_SANDBOX_ROOT, skillDigest, skillInvocation, skillSandboxDir, skillSandboxPath, ToolError, validateSandboxPathShape, } from "@capybara-hq/plugin-sdk";
3
3
  import { sql } from "kysely";
4
4
  import { normalizeStoredDefinition } from "../../agents/definition.js";
5
5
  import { ApiError } from "../../errors.js";
@@ -11,7 +11,7 @@ import { resolveSkillForkType } from "../../runtime/subagents/roster.js";
11
11
  import { invocationOf, resolveSkills } from "../../skills/catalog.js";
12
12
  import { PLATFORM_SOURCE, skillFileStore } from "../../skills/usable.js";
13
13
  import { AGENT_TOOL, SANDBOX_TOOL_NAMES } from "../builtin-names.js";
14
- import { checkToolPath, clip, display, inSandboxPreparation, inToolSandbox, mapSandboxError, sandboxBaseTimeoutMs, sandboxConversationOf, sandboxUnusableReason, withNotices, withPathLease, } from "./sandbox/common.js";
14
+ import { clip, display, inSandboxPreparation, inToolSandbox, mapSandboxError, sandboxBaseTimeoutMs, sandboxConversationOf, sandboxUnusableReason, withNotices, withPathLease, } from "./sandbox/common.js";
15
15
  /**
16
16
  * Builtin tool `Skill` (M5 T14, ruling M17): resolves the name against the latest skills catalog
17
17
  * snapshot in the log to an id and version, and returns that version's SKILL.md body and file list
@@ -392,7 +392,7 @@ const notInProject = (asked, project, names) => {
392
392
  const more = names.length > shown.length ? ", …" : "";
393
393
  return `Skill "${clip(asked, 80)}" is not one of the skills of the project "${project}"; call Skill with one of the project's skills (${shown.length === 0 ? "it lists none" : `${shown.join(", ")}${more}`}).`;
394
394
  };
395
- const projectOutsideModeText = (asked, path, mode) => `Skill "${asked}" cannot be loaded: ${path} is outside what the device can read in ${mode} mode now. Ask the user to switch the device to auto mode, or do the task without the skill.`;
395
+ const projectBadPathText = (asked, path, why) => `Skill "${asked}" cannot be loaded: the project's recorded root makes its SKILL.md path ${clip(path, 300)}, which is not a clean absolute path (${why}), so nothing was read. Ask the user to check the project's location on the device, or do the task without the skill.`;
396
396
  const projectFileGoneText = (asked, path) => `Skill "${asked}" cannot be loaded: ${path} is no longer on the device. Check the project's .agents/skills directory with Glob or Read, or do the task without the skill.`;
397
397
  const projectReadFailedText = (asked, path, why) => `Skill "${asked}" cannot be loaded: reading ${path} on the device failed (${clip(why, 300)}). Retry once; if it fails again, do the task without the skill.`;
398
398
  const projectParseText = (asked, path, why) => `Skill "${asked}" cannot be loaded: ${path} is not a valid SKILL.md (${clip(why, 300)}). Ask the user to fix it, or do the task without the skill.`;
@@ -405,24 +405,20 @@ export class ProjectSkillReadError extends Error {
405
405
  }
406
406
  }
407
407
  /**
408
- * Reads `<root>/.agents/skills/<name>/SKILL.md` in `s` (its path checked as `Read` checks one,
409
- * {@link checkToolPath}) and parses it; its name must be its
410
- * directory's. Shared by `Skill` and a person's invocation (`SkillInvoker`), so both read a
411
- * project skill the same way. A problem with the file or its path throws
412
- * {@link ProjectSkillReadError}; the sandbox's own failures (offline, lost files, ...) and an abort
413
- * are rethrown as they are.
408
+ * Reads `<root>/.agents/skills/<name>/SKILL.md` in `s` (its path shape checked as `Read` checks
409
+ * one, `validateSandboxPathShape`) and parses it; its name must be its directory's. A problem with
410
+ * the file or its path throws {@link ProjectSkillReadError}; the sandbox's own failures (offline,
411
+ * lost files, a read outside the scope the device admits, ...) and an abort are rethrown as they
412
+ * are.
414
413
  */
415
414
  export async function readProjectSkill(s, root, bare, signal = s.signal) {
416
415
  const dir = `${root}/${PROJECT_SKILLS_DIR}/${bare}`;
417
416
  const path = `${dir}/${SKILL_ENTRY_FILE}`;
418
- try {
419
- checkToolPath(path);
420
- }
421
- catch (e) {
422
- if (!(e instanceof ToolError))
423
- throw e;
424
- // only a path whose shape fails (from the recorded root) is refused here
425
- throw new ProjectSkillReadError({ kind: "outside_mode", path, mode: "sandbox" });
417
+ // only a path whose shape fails (from the recorded root) is refused here; what the device may
418
+ // read is the provider's rule, refused by the read itself
419
+ const shape = validateSandboxPathShape(path);
420
+ if (shape.length > 0) {
421
+ throw new ProjectSkillReadError({ kind: "bad_path", path, why: shape.join("; ") });
426
422
  }
427
423
  let read;
428
424
  try {
@@ -469,8 +465,8 @@ export async function readProjectSkill(s, root, bare, signal = s.signal) {
469
465
  /** The model's text for a {@link ProjectSkillProblem} of `Skill`. */
470
466
  function projectProblemText(asked, p) {
471
467
  switch (p.kind) {
472
- case "outside_mode":
473
- return projectOutsideModeText(asked, p.path, p.mode);
468
+ case "bad_path":
469
+ return projectBadPathText(asked, p.path, p.why);
474
470
  case "gone":
475
471
  return projectFileGoneText(asked, p.path);
476
472
  case "read_failed":
@@ -104,8 +104,8 @@ export async function fetchPage(deps, ctx, url) {
104
104
  try {
105
105
  fetched = await resolved.impl.fetch({
106
106
  url,
107
- orgConfig: resolved.orgConfig,
108
107
  config: resolved.config,
108
+ orgId: ctx.orgId,
109
109
  signal: ctx.signal,
110
110
  });
111
111
  }
@@ -182,8 +182,8 @@ export function webSearchTool(deps) {
182
182
  ...(allowed !== undefined && allowed.length > 0 && { allowedDomains: allowed }),
183
183
  ...(blocked !== undefined && blocked.length > 0 && { blockedDomains: blocked }),
184
184
  maxResults: max,
185
- orgConfig: resolved.orgConfig,
186
185
  config: resolved.config,
186
+ orgId: ctx.orgId,
187
187
  signal: ctx.signal,
188
188
  });
189
189
  results = Array.isArray(out?.results) ? out.results : [];
@@ -67,6 +67,7 @@ let ConnectorAccountPolicies = class ConnectorAccountPolicies {
67
67
  const mine = new Map((await this.db
68
68
  .selectFrom("connector_tool_account_policies")
69
69
  .select(["tool_name", "policy"])
70
+ .where("org_id", "=", orgId)
70
71
  .where("connector_id", "=", connectorId)
71
72
  .where("account_id", "=", accountId)
72
73
  .execute()).map((r) => [r.tool_name, r.policy]));
@@ -98,6 +99,7 @@ let ConnectorAccountPolicies = class ConnectorAccountPolicies {
98
99
  const rows = await this.db
99
100
  .selectFrom("connector_tool_account_policies")
100
101
  .select(["tool_name", "policy"])
102
+ .where("org_id", "=", orgId)
101
103
  .where("connector_id", "=", connectorId)
102
104
  .where("account_id", "=", accountId)
103
105
  .where(sql `starts_with(tool_name, ${GIT_PUSH_PREFIX})`)
@@ -154,6 +156,7 @@ let ConnectorAccountPolicies = class ConnectorAccountPolicies {
154
156
  if (cleared.length > 0) {
155
157
  await this.db
156
158
  .deleteFrom("connector_tool_account_policies")
159
+ .where("org_id", "=", orgId)
157
160
  .where("connector_id", "=", connectorId)
158
161
  .where("account_id", "=", accountId)
159
162
  .where("tool_name", "in", cleared)
@@ -1,3 +1,4 @@
1
+ import type { FastifyReply } from "fastify";
1
2
  import { z } from "zod";
2
3
  import type { ConnectionGuideState } from "../extensions/plugin-guides.js";
3
4
  import { PluginIcons } from "../extensions/plugin-icons.js";
@@ -180,9 +181,9 @@ interface MemberPolicySheet {
180
181
  gitPush: MemberGitPushView | null;
181
182
  }
182
183
  /**
183
- * A connector as the org's pages show it: with its plugin's icon (`icon`, see `withIcons`), its
184
- * template's setup guide and the drift since it was set up (`setupGuide`, `guideDrift`; spec
185
- * 2026-11-09-setup-guides-v2-design.md §9.3, §11).
184
+ * A connector as the org's pages show it: with its template's or plugin's icon (`icon`, see
185
+ * `withIcons`), its template's setup guide and the drift since it was set up (`setupGuide`,
186
+ * `guideDrift`; spec 2026-11-09-setup-guides-v2-design.md §9.3, §11).
186
187
  */
187
188
  export type ConnectorPage<T extends ConnectorSummary = ConnectorDetail> = T & ConnectionGuideState & {
188
189
  icon: string | null;
@@ -190,8 +191,9 @@ export type ConnectorPage<T extends ConnectorSummary = ConnectorDetail> = T & Co
190
191
  oauthCallbackUrl?: string | null;
191
192
  };
192
193
  /**
193
- * 连接器(`/api/v1/orgs/:orgId/connectors`):读与个人凭据用 `connectors.use`(访客起),安装 / 修改 / 删除 / 刷新 /
194
- * 组织凭据用 `connectors.manage`(管理员起);两者都仅限用户主体。
194
+ * Connectors (`/api/v1/orgs/:orgId/connectors`): reads and personal credentials need
195
+ * `connectors.use` (guests and up); install / update / delete / refresh / org credentials need
196
+ * `connectors.manage` (admins and up); both are for user principals only.
195
197
  */
196
198
  export declare class ConnectorsController {
197
199
  private readonly connectors;
@@ -200,11 +202,21 @@ export declare class ConnectorsController {
200
202
  private readonly config;
201
203
  constructor(connectors: ConnectorsService, icons: PluginIcons, memberPolicies: ConnectorAccountPolicies, config: Pick<KernelConfigService, "get">);
202
204
  /**
203
- * Each connector with `icon`: the icon of the plugin its template came from, on the org's catalog
204
- * route (null for a custom connector, a plugin without an icon, or one the reader's catalog does
205
- * not show: the share gate holds; maintainer decision 2026-11-09).
205
+ * Each connector with `icon`, on its own icon route (`GET …/connectors/:id/icon`, so guests can
206
+ * load it too): the own icon of the platform connector template it was made from (its current
207
+ * version, the platform's one version of the template), else the icon of the plugin its template
208
+ * came from, else null (a custom connector, no icon, or one the reader's catalog does not show:
209
+ * the share gate holds; maintainer decision 2026-11-09).
206
210
  */
207
211
  private withIcons;
212
+ /**
213
+ * The icon the connector shows (svg or png, the catalog icon response headers): its template's
214
+ * own icon, else its plugin's, under the same visibility gate as the catalog icon routes. It is
215
+ * the connector pages' icon URL, so every role that reads connectors (`connectors.use`, guests
216
+ * included) may load it without reading the catalog. Unknown connector -> 404
217
+ * `connector.not_found`; no icon the reader may see -> 404 `catalog.icon_not_found`.
218
+ */
219
+ icon(org: OrgContext, connectorId: string, reply: FastifyReply): Promise<void>;
208
220
  list(org: OrgContext): Promise<{
209
221
  connectors: ConnectorPage<ConnectorSummary>[];
210
222
  }>;
@@ -7,8 +7,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __param = (this && this.__param) || function (paramIndex, decorator) {
8
8
  return function (target, key) { decorator(target, key, paramIndex); }
9
9
  };
10
- import { Controller, Delete, Get, HttpCode, Inject, Param, Patch, Post, Put } from "@nestjs/common";
10
+ import { Controller, Delete, Get, HttpCode, Inject, Param, Patch, Post, Put, Res, } from "@nestjs/common";
11
11
  import { z } from "zod";
12
+ import { sendCatalogIcon } from "../catalog/org-catalog.controller.js";
12
13
  import { orgIconScope, PluginIcons } from "../extensions/plugin-icons.js";
13
14
  import { CurrentPrincipal, patTokenId, requireUser, } from "../identity/principal.js";
14
15
  import { KernelConfigService } from "../infra/config/kernel-config.service.js";
@@ -59,8 +60,9 @@ class GitPushPolicyDto extends createZodDto(GitPushPolicyBody, "ConnectorGitPush
59
60
  class ConnectorGuideAckBody extends createZodDto(ConnectorGuideAckSchema, "ConnectorGuideAckBody") {
60
61
  }
61
62
  /**
62
- * 连接器(`/api/v1/orgs/:orgId/connectors`):读与个人凭据用 `connectors.use`(访客起),安装 / 修改 / 删除 / 刷新 /
63
- * 组织凭据用 `connectors.manage`(管理员起);两者都仅限用户主体。
63
+ * Connectors (`/api/v1/orgs/:orgId/connectors`): reads and personal credentials need
64
+ * `connectors.use` (guests and up); install / update / delete / refresh / org credentials need
65
+ * `connectors.manage` (admins and up); both are for user principals only.
64
66
  */
65
67
  let ConnectorsController = class ConnectorsController {
66
68
  connectors;
@@ -74,17 +76,26 @@ let ConnectorsController = class ConnectorsController {
74
76
  this.config = config;
75
77
  }
76
78
  /**
77
- * Each connector with `icon`: the icon of the plugin its template came from, on the org's catalog
78
- * route (null for a custom connector, a plugin without an icon, or one the reader's catalog does
79
- * not show: the share gate holds; maintainer decision 2026-11-09).
79
+ * Each connector with `icon`, on its own icon route (`GET …/connectors/:id/icon`, so guests can
80
+ * load it too): the own icon of the platform connector template it was made from (its current
81
+ * version, the platform's one version of the template), else the icon of the plugin its template
82
+ * came from, else null (a custom connector, no icon, or one the reader's catalog does not show:
83
+ * the share gate holds; maintainer decision 2026-11-09).
80
84
  */
81
85
  async withIcons(org, rows) {
82
- const ids = rows.flatMap((r) => (r.catalogItemId === null ? [] : [r.catalogItemId]));
83
- const urls = await this.icons.ofItems(ids, orgIconScope(org));
84
- return rows.map((r) => ({
85
- ...r,
86
- icon: r.catalogItemId === null ? null : (urls.get(r.catalogItemId) ?? null),
87
- }));
86
+ const urls = await this.icons.ofConnectors(rows.map((r) => ({ id: r.id, templateId: r.platformTemplateId, itemId: r.catalogItemId })), orgIconScope(org));
87
+ return rows.map((r, i) => ({ ...r, icon: urls[i] ?? null }));
88
+ }
89
+ /**
90
+ * The icon the connector shows (svg or png, the catalog icon response headers): its template's
91
+ * own icon, else its plugin's, under the same visibility gate as the catalog icon routes. It is
92
+ * the connector pages' icon URL, so every role that reads connectors (`connectors.use`, guests
93
+ * included) may load it without reading the catalog. Unknown connector -> 404
94
+ * `connector.not_found`; no icon the reader may see -> 404 `catalog.icon_not_found`.
95
+ */
96
+ async icon(org, connectorId, reply) {
97
+ const ref = await this.connectors.iconRef(org.orgId, connectorId);
98
+ await sendCatalogIcon(reply, await this.icons.readConnectorIcon(ref, orgIconScope(org)));
88
99
  }
89
100
  async list(org) {
90
101
  const list = (await this.connectors.list(org.orgId)).map((a) => forViewer(org, a));
@@ -221,6 +232,13 @@ let ConnectorsController = class ConnectorsController {
221
232
  await this.connectors.clearMyCredential(org.orgId, connectorId, p.account.id, patTokenId(p));
222
233
  }
223
234
  };
235
+ __decorate([
236
+ Get(":connectorId/icon"),
237
+ OrgAction("connectors.use"),
238
+ __param(0, CurrentOrg()),
239
+ __param(1, Param("connectorId")),
240
+ __param(2, Res())
241
+ ], ConnectorsController.prototype, "icon", null);
224
242
  __decorate([
225
243
  Get(),
226
244
  OrgAction("connectors.use"),
@@ -381,6 +381,14 @@ export declare class ConnectorsService {
381
381
  private ackIn;
382
382
  /** The org's connectors that are not deleted (by creation time). */
383
383
  list(orgId: string): Promise<ConnectorSummary[]>;
384
+ /**
385
+ * Where a live connector of the org takes its icon from: its platform template and its plugin
386
+ * (catalog item). Unknown -> `connector.not_found`.
387
+ */
388
+ iconRef(orgId: string, connectorId: string): Promise<{
389
+ templateId: string | null;
390
+ itemId: string | null;
391
+ }>;
384
392
  get(orgId: string, connectorId: string, viewerAccountId: string): Promise<ConnectorDetail>;
385
393
  /** 改名、启停连接器、工具启停与默认策略、批量把无注解工具改为 allow(`connectors.manage`)。 */
386
394
  update(orgId: string, connectorId: string, actorAccountId: string, patch: UpdateConnectorInput, actorTokenId?: string, auditDetail?: Record<string, unknown>): Promise<ConnectorDetail>;