@capybara-hq/kernel 0.1.0-rc.35 → 0.1.0-rc.37

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 (311) hide show
  1. package/bootstrap.json +5 -5
  2. package/dist/admin/admin.module.d.ts +3 -3
  3. package/dist/admin/admin.module.js +6 -6
  4. package/dist/admin/audit-log.service.d.ts +51 -0
  5. package/dist/admin/{platform-audit.service.js → audit-log.service.js} +20 -12
  6. package/dist/admin/audit.controller.d.ts +18 -6
  7. package/dist/admin/audit.controller.js +36 -6
  8. package/dist/admin/audit.schemas.d.ts +9 -1
  9. package/dist/admin/audit.schemas.js +22 -2
  10. package/dist/admin/outbox-dead.controller.d.ts +4 -6
  11. package/dist/admin/outbox-dead.controller.js +9 -6
  12. package/dist/admin/outbox-dead.schemas.d.ts +16 -0
  13. package/dist/admin/outbox-dead.schemas.js +25 -1
  14. package/dist/admin/outbox-dead.service.d.ts +16 -7
  15. package/dist/admin/outbox-dead.service.js +34 -10
  16. package/dist/admin/overview.service.d.ts +3 -3
  17. package/dist/admin/overview.service.js +0 -1
  18. package/dist/agents/agent-lookup.js +2 -10
  19. package/dist/agents/agents.module.js +3 -0
  20. package/dist/agents/agents.service.js +9 -20
  21. package/dist/agents/definition.d.ts +3 -51
  22. package/dist/agents/definition.js +4 -254
  23. package/dist/agents/org-templates.js +2 -6
  24. package/dist/agents/readiness.controller.d.ts +8 -19
  25. package/dist/agents/readiness.controller.js +11 -25
  26. package/dist/agents/readiness.service.d.ts +42 -0
  27. package/dist/agents/readiness.service.js +78 -0
  28. package/dist/agents/templates.d.ts +0 -6
  29. package/dist/agents/templates.js +8 -34
  30. package/dist/background/store.d.ts +2 -0
  31. package/dist/background/store.js +3 -1
  32. package/dist/background/wake-rules.js +2 -1
  33. package/dist/catalog/admin-catalog.controller.d.ts +1 -2
  34. package/dist/catalog/admin-catalog.controller.js +1 -2
  35. package/dist/catalog/appearance.service.js +1 -3
  36. package/dist/catalog/catalog-content.d.ts +1 -1
  37. package/dist/catalog/catalog-content.js +1 -4
  38. package/dist/catalog/catalog-items.js +3 -3
  39. package/dist/catalog/catalog-scope.service.d.ts +10 -28
  40. package/dist/catalog/catalog-scope.service.js +22 -73
  41. package/dist/catalog/cli.d.ts +0 -11
  42. package/dist/catalog/cli.js +0 -20
  43. package/dist/catalog/component-scope.service.js +0 -2
  44. package/dist/catalog/component-state.js +2 -2
  45. package/dist/catalog/install-status.d.ts +6 -0
  46. package/dist/catalog/install-status.js +6 -0
  47. package/dist/catalog/job-ids.d.ts +0 -4
  48. package/dist/catalog/job-ids.js +0 -4
  49. package/dist/catalog/marketplaces.service.d.ts +1 -1
  50. package/dist/catalog/org-catalog.service.d.ts +2 -0
  51. package/dist/catalog/org-catalog.service.js +8 -3
  52. package/dist/catalog/org-extension-switch.d.ts +7 -2
  53. package/dist/catalog/org-extension-switch.js +56 -9
  54. package/dist/catalog/org-plugin-uploads.d.ts +6 -15
  55. package/dist/catalog/org-plugin-uploads.js +9 -27
  56. package/dist/catalog/owned-items.js +1 -3
  57. package/dist/catalog/platform-import-update.js +1 -1
  58. package/dist/catalog/plugin-import.d.ts +15 -13
  59. package/dist/catalog/plugin-import.js +21 -30
  60. package/dist/catalog/plugin-install.d.ts +3 -43
  61. package/dist/catalog/plugin-install.js +8 -150
  62. package/dist/catalog/plugin-package.d.ts +5 -10
  63. package/dist/catalog/plugin-package.js +12 -33
  64. package/dist/catalog/plugin-upgrade.js +5 -4
  65. package/dist/catalog/scope-jobs.d.ts +34 -34
  66. package/dist/catalog/scope-jobs.js +50 -37
  67. package/dist/catalog/scope-orgs.d.ts +1 -1
  68. package/dist/catalog/scope-orgs.js +1 -2
  69. package/dist/catalog/scope-sync-workers.d.ts +4 -3
  70. package/dist/catalog/scope-sync-workers.js +18 -6
  71. package/dist/catalog/scope-sync.d.ts +56 -59
  72. package/dist/catalog/scope-sync.js +96 -166
  73. package/dist/catalog/unshare.d.ts +3 -4
  74. package/dist/catalog/unshare.js +5 -8
  75. package/dist/channels/job-ids.d.ts +2 -6
  76. package/dist/channels/job-ids.js +2 -6
  77. package/dist/channels/outbound.d.ts +1 -1
  78. package/dist/channels/outbound.js +1 -1
  79. package/dist/channels/supervisor.d.ts +2 -3
  80. package/dist/channels/supervisor.js +2 -3
  81. package/dist/client/client-access.service.js +1 -1
  82. package/dist/config/env.js +19 -1
  83. package/dist/config/load.d.ts +0 -6
  84. package/dist/config/load.js +8 -27
  85. package/dist/config/schema.d.ts +53 -47
  86. package/dist/config/schema.js +190 -40
  87. package/dist/conversations/attachments.service.d.ts +10 -3
  88. package/dist/conversations/attachments.service.js +49 -16
  89. package/dist/conversations/conversations.controller.d.ts +0 -39
  90. package/dist/conversations/conversations.controller.js +0 -39
  91. package/dist/conversations/events.d.ts +71 -46
  92. package/dist/conversations/events.js +124 -112
  93. package/dist/conversations/media-types.d.ts +25 -0
  94. package/dist/conversations/media-types.js +38 -0
  95. package/dist/conversations/queue.d.ts +3 -1
  96. package/dist/conversations/queue.service.js +9 -2
  97. package/dist/conversations/titles.js +6 -0
  98. package/dist/ctx/create-ctx.js +1 -2
  99. package/dist/ctx/secrets.d.ts +24 -7
  100. package/dist/ctx/secrets.js +97 -30
  101. package/dist/db/kernel-schema.d.ts +17 -6
  102. package/dist/errors.d.ts +5 -2
  103. package/dist/errors.js +5 -2
  104. package/dist/evals/reconstruct.d.ts +4 -17
  105. package/dist/evals/reconstruct.js +13 -53
  106. package/dist/evals/recorded-tools.d.ts +0 -27
  107. package/dist/evals/recorded-tools.js +2 -92
  108. package/dist/evals/run-replay.d.ts +1 -6
  109. package/dist/evals/run-replay.js +10 -17
  110. package/dist/evals/sets.service.d.ts +17 -5
  111. package/dist/evals/sets.service.js +33 -12
  112. package/dist/evals/snapshot.d.ts +1 -2
  113. package/dist/evals/snapshot.js +4 -17
  114. package/dist/extensions/admin-ops.d.ts +6 -1
  115. package/dist/extensions/admin-ops.js +17 -4
  116. package/dist/extensions/admin-view.d.ts +7 -4
  117. package/dist/extensions/admin-view.js +27 -21
  118. package/dist/extensions/bootstrap.js +0 -1
  119. package/dist/extensions/cli.js +0 -1
  120. package/dist/extensions/host.d.ts +2 -3
  121. package/dist/extensions/host.js +1 -5
  122. package/dist/extensions/installs.d.ts +1 -3
  123. package/dist/extensions/instance.d.ts +0 -2
  124. package/dist/extensions/instance.js +0 -3
  125. package/dist/extensions/org-config.d.ts +4 -4
  126. package/dist/extensions/org-config.js +13 -22
  127. package/dist/extensions/package.d.ts +6 -6
  128. package/dist/extensions/package.js +3 -7
  129. package/dist/extensions/permission-view.d.ts +2 -4
  130. package/dist/extensions/plugin-items.d.ts +21 -1
  131. package/dist/extensions/plugin-items.js +28 -0
  132. package/dist/extensions/sync.js +5 -10
  133. package/dist/extensions/unavailable.js +0 -1
  134. package/dist/http/api.module.js +2 -1
  135. package/dist/identity/audit.d.ts +0 -12
  136. package/dist/identity/audit.js +0 -27
  137. package/dist/identity/auth.controller.js +5 -9
  138. package/dist/identity/cookies.d.ts +4 -9
  139. package/dist/identity/cookies.js +8 -32
  140. package/dist/identity/initial-passwords.d.ts +1 -1
  141. package/dist/identity/initial-passwords.js +1 -2
  142. package/dist/identity/sessions.d.ts +0 -6
  143. package/dist/identity/sessions.js +0 -18
  144. package/dist/inbox/platform-inbox.service.d.ts +33 -1
  145. package/dist/inbox/platform-inbox.service.js +56 -6
  146. package/dist/index.d.ts +4 -2
  147. package/dist/index.js +4 -2
  148. package/dist/infra/cli/master-key-rewrap.d.ts +15 -0
  149. package/dist/infra/cli/master-key-rewrap.js +24 -0
  150. package/dist/infra/config/kernel-config.service.js +0 -17
  151. package/dist/infra/health/health.controller.js +8 -0
  152. package/dist/infra/health/process-fault.d.ts +16 -0
  153. package/dist/infra/health/process-fault.js +49 -0
  154. package/dist/infra/lifecycle/process-guards.d.ts +8 -2
  155. package/dist/infra/lifecycle/process-guards.js +12 -3
  156. package/dist/infra/lifecycle/shutdown-signals.d.ts +10 -1
  157. package/dist/infra/lifecycle/shutdown-signals.js +28 -13
  158. package/dist/infra/outbox/outbox.service.d.ts +12 -9
  159. package/dist/infra/outbox/outbox.service.js +22 -26
  160. package/dist/infra/outbox/registry.d.ts +15 -7
  161. package/dist/infra/outbox/registry.js +39 -23
  162. package/dist/lifecycle/kernel-lifecycle.js +1 -7
  163. package/dist/models/enablement.d.ts +5 -6
  164. package/dist/models/enablement.js +7 -14
  165. package/dist/orgs/orgs.module.d.ts +2 -2
  166. package/dist/orgs/orgs.module.js +2 -2
  167. package/dist/orgs/settings.controller.d.ts +3 -2
  168. package/dist/orgs/settings.service.d.ts +59 -14
  169. package/dist/orgs/settings.service.js +102 -20
  170. package/dist/overrides.d.ts +3 -7
  171. package/dist/overrides.js +2 -4
  172. package/dist/packages/tgz.d.ts +0 -2
  173. package/dist/packages/tgz.js +0 -2
  174. package/dist/platform/exclusions.js +0 -5
  175. package/dist/platform/operation.js +1 -1
  176. package/dist/platform/ops/admin.ops.d.ts +2 -2
  177. package/dist/platform/ops/admin.ops.js +9 -6
  178. package/dist/platform/ops/agents.ops.d.ts +3 -3
  179. package/dist/platform/ops/agents.ops.js +7 -10
  180. package/dist/platform/ops/connectors.ops.js +46 -1
  181. package/dist/platform/ops/evals.ops.js +1 -64
  182. package/dist/platform/ops/extensions-admin.ops.js +1 -1
  183. package/dist/platform/ops/inbox.ops.js +16 -3
  184. package/dist/platform/ops/org-plugins.ops.js +1 -1
  185. package/dist/platform/ops/orgs.ops.d.ts +5 -3
  186. package/dist/platform/ops/orgs.ops.js +19 -4
  187. package/dist/platform/ops/outbox.ops.js +5 -5
  188. package/dist/roles/worker-role.d.ts +2 -3
  189. package/dist/roles/worker-role.js +3 -13
  190. package/dist/runtime/context/build.d.ts +56 -18
  191. package/dist/runtime/context/build.js +143 -50
  192. package/dist/runtime/context/compaction.d.ts +1 -3
  193. package/dist/runtime/context/compaction.js +42 -8
  194. package/dist/runtime/context/run-context.js +1 -2
  195. package/dist/runtime/context/skills.d.ts +27 -56
  196. package/dist/runtime/context/skills.js +42 -114
  197. package/dist/runtime/context/tool-changes.d.ts +3 -3
  198. package/dist/runtime/context/tool-changes.js +6 -16
  199. package/dist/runtime/hook-calls.d.ts +6 -6
  200. package/dist/runtime/hook-calls.js +7 -7
  201. package/dist/runtime/langgraph-loop.js +1 -0
  202. package/dist/runtime/maintenance.d.ts +3 -11
  203. package/dist/runtime/maintenance.js +5 -20
  204. package/dist/runtime/model-call.d.ts +5 -0
  205. package/dist/runtime/model-call.js +48 -36
  206. package/dist/runtime/providers.d.ts +33 -35
  207. package/dist/runtime/providers.js +64 -109
  208. package/dist/runtime/run-context.service.js +7 -22
  209. package/dist/runtime/run-deletion.d.ts +6 -0
  210. package/dist/runtime/run-deletion.js +39 -16
  211. package/dist/runtime/run-execution.js +4 -3
  212. package/dist/runtime/run-finish.js +2 -1
  213. package/dist/runtime/run-liveness.d.ts +11 -0
  214. package/dist/runtime/run-liveness.js +19 -0
  215. package/dist/runtime/run-orphan-check.job.js +2 -1
  216. package/dist/runtime/run-queue.js +8 -16
  217. package/dist/runtime/run-worker.d.ts +2 -2
  218. package/dist/runtime/run-worker.js +8 -6
  219. package/dist/runtime/subagents/definition.d.ts +16 -20
  220. package/dist/runtime/subagents/definition.js +27 -27
  221. package/dist/runtime/subagents/dispatch.d.ts +6 -2
  222. package/dist/runtime/subagents/dispatch.js +17 -3
  223. package/dist/runtime/subagents/org-agents.js +1 -2
  224. package/dist/runtime/subagents/preamble.d.ts +3 -2
  225. package/dist/runtime/subagents/preamble.js +3 -2
  226. package/dist/runtime/subagents/render.d.ts +1 -2
  227. package/dist/runtime/subagents/render.js +1 -2
  228. package/dist/runtime/subagents/skill-fork.d.ts +2 -4
  229. package/dist/runtime/subagents/template-skills.d.ts +47 -0
  230. package/dist/runtime/subagents/template-skills.js +76 -0
  231. package/dist/schedules/effective-settings.d.ts +9 -3
  232. package/dist/schedules/effective-settings.js +5 -4
  233. package/dist/schedules/fire.js +11 -0
  234. package/dist/schedules/scheduled-tasks.service.js +5 -0
  235. package/dist/schedules/unattended.d.ts +2 -0
  236. package/dist/schedules/unattended.js +6 -1
  237. package/dist/skills/agent-skills.service.js +1 -2
  238. package/dist/skills/catalog.d.ts +1 -3
  239. package/dist/skills/catalog.js +1 -3
  240. package/dist/skills/conversation-catalog.d.ts +1 -2
  241. package/dist/skills/conversation-catalog.js +1 -2
  242. package/dist/skills/usable.js +2 -3
  243. package/dist/storage/storage.service.js +9 -1
  244. package/dist/tools/approvals.service.js +2 -4
  245. package/dist/tools/builtin-names.d.ts +2 -9
  246. package/dist/tools/builtin-names.js +4 -13
  247. package/dist/tools/builtins/sandbox/bash.js +3 -3
  248. package/dist/tools/builtins/sandbox/common.d.ts +7 -13
  249. package/dist/tools/builtins/sandbox/common.js +8 -115
  250. package/dist/tools/builtins/sandbox/fetch-attachment.d.ts +10 -0
  251. package/dist/tools/builtins/sandbox/fetch-attachment.js +119 -0
  252. package/dist/tools/builtins/sandbox/glob.js +1 -3
  253. package/dist/tools/builtins/sandbox/grep.js +3 -5
  254. package/dist/tools/builtins/sandbox/index.d.ts +8 -5
  255. package/dist/tools/builtins/sandbox/index.js +10 -5
  256. package/dist/tools/builtins/sandbox/read.js +3 -2
  257. package/dist/tools/builtins/tool-search.d.ts +4 -7
  258. package/dist/tools/builtins/tool-search.js +6 -10
  259. package/dist/tools/connector-account-policies.d.ts +30 -3
  260. package/dist/tools/connector-account-policies.js +54 -7
  261. package/dist/tools/connectors.controller.d.ts +24 -11
  262. package/dist/tools/connectors.controller.js +35 -6
  263. package/dist/tools/connectors.schemas.d.ts +14 -1
  264. package/dist/tools/connectors.schemas.js +14 -2
  265. package/dist/tools/connectors.service.d.ts +22 -0
  266. package/dist/tools/connectors.service.js +56 -0
  267. package/dist/tools/drift.d.ts +1 -1
  268. package/dist/tools/drift.js +1 -1
  269. package/dist/tools/git-push-policy.d.ts +4 -1
  270. package/dist/tools/git-push-policy.js +3 -1
  271. package/dist/tools/info.d.ts +1 -7
  272. package/dist/tools/info.js +5 -18
  273. package/dist/tools/job-ids.d.ts +0 -4
  274. package/dist/tools/job-ids.js +1 -6
  275. package/dist/tools/pipeline.d.ts +4 -10
  276. package/dist/tools/pipeline.js +16 -62
  277. package/dist/tools/policy.d.ts +6 -2
  278. package/dist/tools/policy.js +14 -12
  279. package/dist/tools/registry.js +1 -5
  280. package/dist/ui/views.d.ts +5 -5
  281. package/dist/ui/views.js +10 -16
  282. package/package.json +3 -3
  283. package/src/migrations/0137_audit_org_idx.sql +5 -0
  284. package/src/migrations/0138_plugin_install_status_no_upgrading.sql +18 -0
  285. package/src/migrations/0139_retire_legacy_forms.sql +183 -0
  286. package/src/migrations/0140_retire_history_forms.sql +148 -0
  287. package/src/migrations/0141_install_ledger_promoted_rows.sql +36 -0
  288. package/src/migrations/0142_backfill_event_fields.sql +74 -0
  289. package/src/migrations/0143_backfill_model_call_fields.sql +105 -0
  290. package/src/migrations/0144_retire_frozen_definition_keys.sql +163 -0
  291. package/dist/admin/platform-audit.service.d.ts +0 -41
  292. package/dist/conversations/job-ids.d.ts +0 -6
  293. package/dist/conversations/job-ids.js +0 -6
  294. package/dist/extensions/job-ids.d.ts +0 -6
  295. package/dist/extensions/job-ids.js +0 -6
  296. package/dist/infra/queue/retired-schedulers.d.ts +0 -7
  297. package/dist/infra/queue/retired-schedulers.js +0 -9
  298. package/dist/orgs/job-ids.d.ts +0 -8
  299. package/dist/orgs/job-ids.js +0 -8
  300. package/dist/runtime/context/legacy-text.d.ts +0 -22
  301. package/dist/runtime/context/legacy-text.js +0 -37
  302. package/dist/runtime/job-ids.d.ts +0 -10
  303. package/dist/runtime/job-ids.js +0 -10
  304. package/dist/runtime/retired-schedulers.d.ts +0 -7
  305. package/dist/runtime/retired-schedulers.js +0 -31
  306. package/dist/storage/job-ids.d.ts +0 -6
  307. package/dist/storage/job-ids.js +0 -6
  308. package/dist/tools/legacy-data.d.ts +0 -34
  309. package/dist/tools/legacy-data.js +0 -76
  310. package/dist/tools/legacy-keys.d.ts +0 -51
  311. package/dist/tools/legacy-keys.js +0 -114
@@ -22,14 +22,17 @@ export const personalAuth = (auth) => {
22
22
  const a = auth;
23
23
  return a !== null && a.type !== "none" && a.ownership === "personal";
24
24
  };
25
+ /** The prefix of {@link gitPushPolicyName}. */
26
+ const GIT_PUSH_PREFIX = "git_push:";
25
27
  /**
26
28
  * The tool name of a member's own policy for pushes to one repository on one host through the
27
29
  * connector (sandbox git credentials spec §7: the virtual tool `git_push`,
28
30
  * `git_push:<host>/<owner>/<repo>`, so an allow never covers another host). No
29
- * `connector_tools` row backs it, so the 权限 sheet ({@link ConnectorAccountPolicies.read}) does
30
- * not list it; 「一直允许」 on a git push ask writes it.
31
+ * `connector_tools` row backs it: the Permissions sheet lists these apart from the tools
32
+ * ({@link ConnectorAccountPolicies.gitPush}), and the member may only clear one there;
33
+ * "Always allow" on a git push ask writes it.
31
34
  */
32
- export const gitPushPolicyName = (host, repo) => `git_push:${host.toLowerCase()}/${repo}`;
35
+ export const gitPushPolicyName = (host, repo) => `${GIT_PUSH_PREFIX}${host.toLowerCase()}/${repo}`;
33
36
  const notPersonal = () => new ApiError("connector.not_personal", "This connector uses one credential for the whole organization; only a connector each member connects to with their own credential has per-member tool policies");
34
37
  const notFound = () => new ApiError("connector.not_found", "Connector not found");
35
38
  /**
@@ -86,24 +89,64 @@ let ConnectorAccountPolicies = class ConnectorAccountPolicies {
86
89
  };
87
90
  });
88
91
  }
92
+ /**
93
+ * The account's standing git push decisions on the connector and the org's default; not
94
+ * personal -> 409 `connector.not_personal`.
95
+ */
96
+ async gitPush(orgId, connectorId, accountId) {
97
+ const c = await this.connector(orgId, connectorId);
98
+ const rows = await this.db
99
+ .selectFrom("connector_tool_account_policies")
100
+ .select(["tool_name", "policy"])
101
+ .where("connector_id", "=", connectorId)
102
+ .where("account_id", "=", accountId)
103
+ .where(sql `starts_with(tool_name, ${GIT_PUSH_PREFIX})`)
104
+ .orderBy("tool_name")
105
+ .execute();
106
+ if (!c.git && rows.length === 0)
107
+ return null;
108
+ return {
109
+ orgDefault: c.gitPushPolicy,
110
+ grants: rows.map((r) => {
111
+ const target = r.tool_name.slice(GIT_PUSH_PREFIX.length);
112
+ const slash = target.indexOf("/");
113
+ return {
114
+ name: r.tool_name,
115
+ host: target.slice(0, slash),
116
+ repo: target.slice(slash + 1),
117
+ policy: r.policy,
118
+ };
119
+ }),
120
+ };
121
+ }
89
122
  /**
90
123
  * Sets (a policy) or clears (null) the account's policies for some of the connector's tools;
91
124
  * an unknown tool -> 404 `connector.tool_not_found`. Locked tools may hold a setting: it does not
92
- * apply while the lock lasts. Audits `connector.member_policies_changed`.
125
+ * apply while the lock lasts. A `git_push:*` name may only be cleared (a standing push decision
126
+ * is written by "Always allow" on a push ask; setting one here -> 400 `validation_failed`).
127
+ * Audits `connector.member_policies_changed`.
93
128
  */
94
129
  async set(orgId, connectorId, accountId, changes, actorTokenId) {
95
130
  await this.orgLock.lockAndAuthorize(orgId, accountId, "connectors.use");
96
131
  await this.connector(orgId, connectorId);
132
+ const pushSet = Object.keys(changes).filter((n) => n.startsWith(GIT_PUSH_PREFIX) && changes[n] !== null);
133
+ if (pushSet.length > 0) {
134
+ throw new ApiError("validation_failed", "Request validation failed", pushSet.map((n) => ({
135
+ path: `tools.${n}`,
136
+ message: "A standing push decision can only be cleared here; 「一直允许」 on a push ask sets one",
137
+ })));
138
+ }
97
139
  const names = Object.keys(changes);
98
140
  if (names.length === 0)
99
141
  return;
142
+ // a push decision has no connector_tools row: clearing one (or none) is always known
100
143
  const known = new Set((await this.db
101
144
  .selectFrom("connector_tools")
102
145
  .select("name")
103
146
  .where("connector_id", "=", connectorId)
104
147
  .where("name", "in", names)
105
148
  .execute()).map((r) => r.name));
106
- const unknown = names.find((n) => !known.has(n));
149
+ const unknown = names.find((n) => !known.has(n) && !n.startsWith(GIT_PUSH_PREFIX));
107
150
  if (unknown !== undefined) {
108
151
  throw new ApiError("connector.tool_not_found", `No tool ${unknown} in this connector`);
109
152
  }
@@ -149,7 +192,7 @@ let ConnectorAccountPolicies = class ConnectorAccountPolicies {
149
192
  async connector(orgId, connectorId) {
150
193
  const c = await this.db
151
194
  .selectFrom("connectors")
152
- .select(["slug", "auth"])
195
+ .select(["slug", "auth", "git_hosts", "git_push_policy"])
153
196
  .where("id", "=", connectorId)
154
197
  .where("org_id", "=", orgId)
155
198
  .where("deleted_at", "is", null)
@@ -158,7 +201,11 @@ let ConnectorAccountPolicies = class ConnectorAccountPolicies {
158
201
  throw notFound();
159
202
  if (!personalAuth(c.auth))
160
203
  throw notPersonal();
161
- return { slug: c.slug };
204
+ return {
205
+ slug: c.slug,
206
+ git: c.git_hosts !== null && c.git_hosts.length > 0,
207
+ gitPushPolicy: c.git_push_policy,
208
+ };
162
209
  }
163
210
  };
164
211
  __decorate([
@@ -4,8 +4,8 @@ import { PluginIcons } from "../extensions/plugin-icons.js";
4
4
  import { type Principal } from "../identity/principal.js";
5
5
  import { KernelConfigService } from "../infra/config/kernel-config.service.js";
6
6
  import { type OrgContext } from "../orgs/org.guard.js";
7
- import { ConnectorAccountPolicies, type MemberToolPolicyView } from "./connector-account-policies.js";
8
- import { ConnectorGuideAckSchema, CredentialValue, MemberToolPoliciesBody } from "./connectors.schemas.js";
7
+ import { ConnectorAccountPolicies, type MemberGitPushView, type MemberToolPolicyView } from "./connector-account-policies.js";
8
+ import { ConnectorGuideAckSchema, CredentialValue, GitPushPolicyBody, MemberToolPoliciesBody } from "./connectors.schemas.js";
9
9
  import { type ConnectorDetail, type ConnectorPreview, type ConnectorSummary, ConnectorsService, type ToolIssue } from "./connectors.service.js";
10
10
  declare const CreateBody: z.ZodObject<{
11
11
  name: z.ZodString;
@@ -173,6 +173,11 @@ declare const UpdateBody: z.ZodObject<{
173
173
  allowUnannotated: z.ZodOptional<z.ZodBoolean>;
174
174
  useForGit: z.ZodOptional<z.ZodBoolean>;
175
175
  }, z.core.$strict>;
176
+ /** The member's Permissions sheet: their tool policies and the git push part (null without git). */
177
+ interface MemberPolicySheet {
178
+ tools: MemberToolPolicyView[];
179
+ gitPush: MemberGitPushView | null;
180
+ }
176
181
  /**
177
182
  * A connector as the org's pages show it: with its plugin's icon (`icon`, see `withIcons`), its
178
183
  * template's setup guide and the drift since it was set up (`setupGuide`, `guideDrift`; spec
@@ -253,25 +258,33 @@ export declare class ConnectorsController {
253
258
  ackGuide(principal: Principal, org: OrgContext, connectorId: string, body: z.infer<typeof ConnectorGuideAckSchema>): Promise<{
254
259
  connector: ConnectorPage;
255
260
  }>;
261
+ /**
262
+ * The org's default for git pushes through the connector's credential in sandboxes
263
+ * (`{ policy: "allow" | "ask" | "deny" }`, the virtual tool `git_push`) -> `{ connector }`. A
264
+ * connector without git hosts -> 400 on `policy`. An API token may only narrow it (400
265
+ * `connector.git_push_widen_not_allowed`).
266
+ */
267
+ setGitPushPolicy(principal: Principal, org: OrgContext, connectorId: string, body: z.infer<typeof GitPushPolicyBody>): Promise<{
268
+ connector: ConnectorPage;
269
+ }>;
256
270
  setOrgCredential(principal: Principal, org: OrgContext, connectorId: string, body: z.infer<typeof CredentialValue>): Promise<void>;
257
271
  setMyCredential(principal: Principal, org: OrgContext, connectorId: string, body: z.infer<typeof CredentialValue>): Promise<void>;
258
272
  /**
259
273
  * The caller's own tool policies for their own connection of a personal-credential connector
260
274
  * (the card's 权限, decision 2026-11-09): each tool with the org default, the annotation default,
261
- * the caller's setting and whether the org locked it. Only ever the caller's rows. A connector
262
- * with one org credential -> 409 `connector.not_personal`.
275
+ * the caller's setting and whether the org locked it; `gitPush`: the org's default for pushes
276
+ * and the caller's standing push decisions per repository (null without git). Only ever the
277
+ * caller's rows. A connector with one org credential -> 409 `connector.not_personal`.
263
278
  */
264
- myToolPolicies(principal: Principal, org: OrgContext, connectorId: string): Promise<{
265
- tools: MemberToolPolicyView[];
266
- }>;
279
+ myToolPolicies(principal: Principal, org: OrgContext, connectorId: string): Promise<MemberPolicySheet>;
280
+ private sheet;
267
281
  /**
268
282
  * Sets (`allow` / `ask` / `deny`) or clears (null) the caller's own policies for some tools:
269
283
  * `{ tools: { <name>: policy | null } }` -> the sheet again. Unknown tool -> 404
270
- * `connector.tool_not_found`.
284
+ * `connector.tool_not_found`; a standing push decision `git_push:<host>/<owner>/<repo>` may only
285
+ * be cleared (null).
271
286
  */
272
- setMyToolPolicies(principal: Principal, org: OrgContext, connectorId: string, body: z.infer<typeof MemberToolPoliciesBody>): Promise<{
273
- tools: MemberToolPolicyView[];
274
- }>;
287
+ setMyToolPolicies(principal: Principal, org: OrgContext, connectorId: string, body: z.infer<typeof MemberToolPoliciesBody>): Promise<MemberPolicySheet>;
275
288
  clearMyCredential(principal: Principal, org: OrgContext, connectorId: string): Promise<void>;
276
289
  }
277
290
  export {};
@@ -18,7 +18,7 @@ import { ZBody } from "../infra/validation/zod-params.js";
18
18
  import { CurrentOrg, OrgAction } from "../orgs/org.guard.js";
19
19
  import { can } from "../orgs/roles.js";
20
20
  import { ConnectorAccountPolicies, } from "./connector-account-policies.js";
21
- import { ConnectorGuideAckSchema, CredentialValue, MemberToolPoliciesBody, } from "./connectors.schemas.js";
21
+ import { ConnectorGuideAckSchema, CredentialValue, GitPushPolicyBody, MemberToolPoliciesBody, } from "./connectors.schemas.js";
22
22
  import { ConnectorsService, } from "./connectors.service.js";
23
23
  import { publicEndpoint } from "./endpoint.js";
24
24
  import { callbackUrl } from "./oauth/flow-paths.js";
@@ -94,6 +94,8 @@ class ConnectorCredentialBody extends createZodDto(CredentialValue, "ConnectorCr
94
94
  }
95
95
  class MemberToolPoliciesDto extends createZodDto(MemberToolPoliciesBody, "MemberToolPoliciesBody") {
96
96
  }
97
+ class GitPushPolicyDto extends createZodDto(GitPushPolicyBody, "ConnectorGitPushPolicyBody") {
98
+ }
97
99
  class ConnectorGuideAckBody extends createZodDto(ConnectorGuideAckSchema, "ConnectorGuideAckBody") {
98
100
  }
99
101
  /**
@@ -207,6 +209,17 @@ let ConnectorsController = class ConnectorsController {
207
209
  const view = await this.connectors.ackGuide({ orgId: org.orgId, role: org.role }, connectorId, body.hash, p.account.id, patTokenId(p));
208
210
  return { connector: await this.withGuide(org, view) };
209
211
  }
212
+ /**
213
+ * The org's default for git pushes through the connector's credential in sandboxes
214
+ * (`{ policy: "allow" | "ask" | "deny" }`, the virtual tool `git_push`) -> `{ connector }`. A
215
+ * connector without git hosts -> 400 on `policy`. An API token may only narrow it (400
216
+ * `connector.git_push_widen_not_allowed`).
217
+ */
218
+ async setGitPushPolicy(principal, org, connectorId, body) {
219
+ const p = requireUser(principal);
220
+ const view = await this.connectors.setGitPushPolicy(org.orgId, connectorId, p.account.id, body.policy, { actorTokenId: patTokenId(p), onlyNarrows: patTokenId(p) !== undefined });
221
+ return { connector: await this.withGuide(org, view) };
222
+ }
210
223
  async setOrgCredential(principal, org, connectorId, body) {
211
224
  const p = requireUser(principal);
212
225
  await this.connectors.setCredential(org.orgId, connectorId, p.account.id, "org", body, patTokenId(p));
@@ -218,22 +231,30 @@ let ConnectorsController = class ConnectorsController {
218
231
  /**
219
232
  * The caller's own tool policies for their own connection of a personal-credential connector
220
233
  * (the card's 权限, decision 2026-11-09): each tool with the org default, the annotation default,
221
- * the caller's setting and whether the org locked it. Only ever the caller's rows. A connector
222
- * with one org credential -> 409 `connector.not_personal`.
234
+ * the caller's setting and whether the org locked it; `gitPush`: the org's default for pushes
235
+ * and the caller's standing push decisions per repository (null without git). Only ever the
236
+ * caller's rows. A connector with one org credential -> 409 `connector.not_personal`.
223
237
  */
224
238
  async myToolPolicies(principal, org, connectorId) {
225
239
  const p = requireUser(principal);
226
- return { tools: await this.memberPolicies.read(org.orgId, connectorId, p.account.id) };
240
+ return this.sheet(org.orgId, connectorId, p.account.id);
241
+ }
242
+ async sheet(orgId, connectorId, accountId) {
243
+ return {
244
+ tools: await this.memberPolicies.read(orgId, connectorId, accountId),
245
+ gitPush: await this.memberPolicies.gitPush(orgId, connectorId, accountId),
246
+ };
227
247
  }
228
248
  /**
229
249
  * Sets (`allow` / `ask` / `deny`) or clears (null) the caller's own policies for some tools:
230
250
  * `{ tools: { <name>: policy | null } }` -> the sheet again. Unknown tool -> 404
231
- * `connector.tool_not_found`.
251
+ * `connector.tool_not_found`; a standing push decision `git_push:<host>/<owner>/<repo>` may only
252
+ * be cleared (null).
232
253
  */
233
254
  async setMyToolPolicies(principal, org, connectorId, body) {
234
255
  const p = requireUser(principal);
235
256
  await this.memberPolicies.set(org.orgId, connectorId, p.account.id, body.tools, patTokenId(p));
236
- return { tools: await this.memberPolicies.read(org.orgId, connectorId, p.account.id) };
257
+ return this.sheet(org.orgId, connectorId, p.account.id);
237
258
  }
238
259
  async clearMyCredential(principal, org, connectorId) {
239
260
  const p = requireUser(principal);
@@ -315,6 +336,14 @@ __decorate([
315
336
  __param(2, Param("connectorId")),
316
337
  __param(3, ZBody(ConnectorGuideAckBody))
317
338
  ], ConnectorsController.prototype, "ackGuide", null);
339
+ __decorate([
340
+ Put(":connectorId/git-push-policy"),
341
+ OrgAction("connectors.manage"),
342
+ __param(0, CurrentPrincipal()),
343
+ __param(1, CurrentOrg()),
344
+ __param(2, Param("connectorId")),
345
+ __param(3, ZBody(GitPushPolicyDto))
346
+ ], ConnectorsController.prototype, "setGitPushPolicy", null);
318
347
  __decorate([
319
348
  Put(":connectorId/credentials/org"),
320
349
  HttpCode(204),
@@ -13,10 +13,23 @@ export declare const ConnectorGuideAckSchema: z.ZodObject<{
13
13
  export declare const ConnectorPathParams: z.ZodObject<{
14
14
  connectorId: z.ZodString;
15
15
  }, z.core.$strip>;
16
+ /**
17
+ * `PUT …/connectors/:connectorId/git-push-policy`: the org's default for pushes through the
18
+ * connector's credential in sandboxes (the virtual tool `git_push`, sandbox git credentials
19
+ * spec §7).
20
+ */
21
+ export declare const GitPushPolicyBody: z.ZodObject<{
22
+ policy: z.ZodEnum<{
23
+ allow: "allow";
24
+ ask: "ask";
25
+ deny: "deny";
26
+ }>;
27
+ }, z.core.$strict>;
16
28
  export declare const CONNECTOR_ROUTES: readonly RouteSchemas[];
17
29
  /**
18
30
  * `PUT …/connectors/:connectorId/tool-policies/me`: the caller's own policy per tool name (null
19
- * clears it; decision 2026-11-09).
31
+ * clears it; decision 2026-11-09). A key may also be a standing push decision
32
+ * `git_push:<host>/<owner>/<repo>` (only cleared), hence the longer bound.
20
33
  */
21
34
  export declare const MemberToolPoliciesBody: z.ZodObject<{
22
35
  tools: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodEnum<{
@@ -12,6 +12,12 @@ export const ConnectorGuideAckSchema = z
12
12
  .strict();
13
13
  /** `:connectorId` as the routes take it (`@Param`). */
14
14
  export const ConnectorPathParams = z.object({ connectorId: z.string().min(1) });
15
+ /**
16
+ * `PUT …/connectors/:connectorId/git-push-policy`: the org's default for pushes through the
17
+ * connector's credential in sandboxes (the virtual tool `git_push`, sandbox git credentials
18
+ * spec §7).
19
+ */
20
+ export const GitPushPolicyBody = z.object({ policy: z.enum(["allow", "ask", "deny"]) }).strict();
15
21
  export const CONNECTOR_ROUTES = [
16
22
  { route: "GET /api/v1/orgs/:orgId/connectors" },
17
23
  { route: "GET /api/v1/orgs/:orgId/connectors/:connectorId", params: ConnectorPathParams },
@@ -20,15 +26,21 @@ export const CONNECTOR_ROUTES = [
20
26
  route: "POST /api/v1/orgs/:orgId/connectors/:connectorId/refresh",
21
27
  params: ConnectorPathParams,
22
28
  },
29
+ {
30
+ route: "PUT /api/v1/orgs/:orgId/connectors/:connectorId/git-push-policy",
31
+ params: ConnectorPathParams,
32
+ body: GitPushPolicyBody,
33
+ },
23
34
  ];
24
35
  /**
25
36
  * `PUT …/connectors/:connectorId/tool-policies/me`: the caller's own policy per tool name (null
26
- * clears it; decision 2026-11-09).
37
+ * clears it; decision 2026-11-09). A key may also be a standing push decision
38
+ * `git_push:<host>/<owner>/<repo>` (only cleared), hence the longer bound.
27
39
  */
28
40
  export const MemberToolPoliciesBody = z
29
41
  .object({
30
42
  tools: z
31
- .record(z.string().min(1).max(200), z.enum(["allow", "ask", "deny"]).nullable())
43
+ .record(z.string().min(1).max(500), z.enum(["allow", "ask", "deny"]).nullable())
32
44
  .refine((v) => Object.keys(v).length <= 1000, { message: "Too many tools" }),
33
45
  })
34
46
  .strict();
@@ -81,6 +81,11 @@ export interface ConnectorSummary {
81
81
  * admin); personal connectors with `git` always do and keep this false.
82
82
  */
83
83
  useForGit: boolean;
84
+ /**
85
+ * The org's default for pushes through this connector's credential (`connectors.git_push_policy`,
86
+ * the virtual tool `git_push`; sandbox git credentials spec §7); meaningful only with `git`.
87
+ */
88
+ gitPushPolicy: ToolPolicy;
84
89
  createdBy: string;
85
90
  createdAt: Date;
86
91
  updatedAt: Date;
@@ -367,6 +372,23 @@ export declare class ConnectorsService {
367
372
  get(orgId: string, connectorId: string, viewerAccountId: string): Promise<ConnectorDetail>;
368
373
  /** 改名、启停连接器、工具启停与默认策略、批量把无注解工具改为 allow(`connectors.manage`)。 */
369
374
  update(orgId: string, connectorId: string, actorAccountId: string, patch: UpdateConnectorInput, actorTokenId?: string): Promise<ConnectorDetail>;
375
+ /**
376
+ * The read-only checks of {@link setGitPushPolicy} (the Platform operation's precheck): the
377
+ * connector exists (`connector.not_found`) and declares git hosts (400 on `policy`); with
378
+ * `onlyNarrows`, the change does not loosen it ({@link assertGitPushSettable}).
379
+ */
380
+ checkGitPushPolicy(orgId: string, connectorId: string, policy: ToolPolicy, onlyNarrows: boolean): Promise<void>;
381
+ /**
382
+ * Sets the org's default git push policy for the connector (sandbox git credentials spec §7, the
383
+ * virtual tool `git_push`; `connectors.manage`): read on every push by `decideGitPush`. Only a
384
+ * connector that declares git hosts (else 400 on `policy`). `onlyNarrows` (the Platform tool,
385
+ * API tokens): it may only tighten ({@link assertGitPushSettable}). Audits `connector.git_push_policy_changed`.
386
+ */
387
+ setGitPushPolicy(orgId: string, connectorId: string, actorAccountId: string, policy: ToolPolicy, opts?: {
388
+ actorTokenId?: string | undefined;
389
+ auditDetail?: Record<string, unknown> | undefined;
390
+ onlyNarrows?: boolean;
391
+ }): Promise<ConnectorDetail>;
370
392
  /**
371
393
  * The org id of a live connector of a live org (the platform paths address a connector by its
372
394
  * global id); else `connector.not_found`.
@@ -31,6 +31,7 @@ import { deriveSlug, isValidSlug, SLUG_RULE } from "./naming.js";
31
31
  import { checkOAuthUrl, discoverMcp, OAuthSetupError, oauthHttpOptions, pickAuthMethod, registerClient, } from "./oauth/discovery.js";
32
32
  import { callbackUrl, publicUrlRequired } from "./oauth/flow-paths.js";
33
33
  import { OAuthGrantError, OAuthUnavailable, tokenRequest, } from "./oauth/tokens.js";
34
+ import { stricter } from "./policy.js";
34
35
  import { policyFromAnnotations, ToolRegistry } from "./registry.js";
35
36
  import { recordToolSpecs } from "./specs.js";
36
37
  /** 预览时没给 slug、也推导不出时,拼 key 用的占位 slug。 */
@@ -39,6 +40,20 @@ const PREVIEW_SLUG = "app";
39
40
  const MAX_INSPECT_DETAIL = 500;
40
41
  const notFound = () => new ApiError("connector.not_found", "Connector not found");
41
42
  const fail = (path, message) => new ApiError("validation_failed", "Request validation failed", [{ path, message }]);
43
+ /**
44
+ * Whether a connector's default git push policy may become `policy` (pure): only a connector that
45
+ * declares git hosts has one (400 on `policy`); `onlyNarrows` (the Platform tool, API tokens) refuses
46
+ * a change that loosens it (`deny` -> `ask` -> `allow`) with `connector.git_push_widen_not_allowed`:
47
+ * only a person in a session loosens it, as the org's sandbox settings.
48
+ */
49
+ function assertGitPushSettable(gitHosts, before, policy, onlyNarrows) {
50
+ if (gitHosts === null || gitHosts.length === 0) {
51
+ throw fail("policy", "This connector declares no git hosts");
52
+ }
53
+ if (onlyNarrows && stricter(policy, before) !== policy) {
54
+ throw new ApiError("connector.git_push_widen_not_allowed", "Loosening the connector's git push policy needs a person on the connector's settings page.");
55
+ }
56
+ }
42
57
  const isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
43
58
  /** OAuth 连接器在安装时可带的客户端(手填 client / 客户端凭据流)。 */
44
59
  const OAuthClientCredential = z.strictObject({
@@ -784,6 +799,7 @@ let ConnectorsService = class ConnectorsService {
784
799
  catalogItemId: r.catalog_item_id ?? null,
785
800
  git: r.git_hosts !== null && r.git_hosts.length > 0 ? { hosts: r.git_hosts } : null,
786
801
  useForGit: r.use_for_git,
802
+ gitPushPolicy: r.git_push_policy,
787
803
  createdBy: r.created_by,
788
804
  createdAt: r.created_at,
789
805
  updatedAt: r.updated_at,
@@ -1081,6 +1097,43 @@ let ConnectorsService = class ConnectorsService {
1081
1097
  });
1082
1098
  return this.detail(t, orgId, connectorId, actorAccountId);
1083
1099
  }
1100
+ /**
1101
+ * The read-only checks of {@link setGitPushPolicy} (the Platform operation's precheck): the
1102
+ * connector exists (`connector.not_found`) and declares git hosts (400 on `policy`); with
1103
+ * `onlyNarrows`, the change does not loosen it ({@link assertGitPushSettable}).
1104
+ */
1105
+ async checkGitPushPolicy(orgId, connectorId, policy, onlyNarrows) {
1106
+ const app = await this.row(this.db, orgId, connectorId);
1107
+ assertGitPushSettable(app.git_hosts, app.git_push_policy, policy, onlyNarrows);
1108
+ }
1109
+ /**
1110
+ * Sets the org's default git push policy for the connector (sandbox git credentials spec §7, the
1111
+ * virtual tool `git_push`; `connectors.manage`): read on every push by `decideGitPush`. Only a
1112
+ * connector that declares git hosts (else 400 on `policy`). `onlyNarrows` (the Platform tool,
1113
+ * API tokens): it may only tighten ({@link assertGitPushSettable}). Audits `connector.git_push_policy_changed`.
1114
+ */
1115
+ async setGitPushPolicy(orgId, connectorId, actorAccountId, policy, opts = {}) {
1116
+ const t = this.db;
1117
+ await this.orgLock.lockAndAuthorize(orgId, actorAccountId, "connectors.manage");
1118
+ const app = await this.row(t, orgId, connectorId, true);
1119
+ assertGitPushSettable(app.git_hosts, app.git_push_policy, policy, opts.onlyNarrows === true);
1120
+ if (policy !== app.git_push_policy) {
1121
+ await t
1122
+ .updateTable("connectors")
1123
+ .set({ git_push_policy: policy, updated_at: sql `now()` })
1124
+ .where("id", "=", connectorId)
1125
+ .execute();
1126
+ await audit(t, {
1127
+ actorAccountId,
1128
+ ...(opts.actorTokenId !== undefined && { actorTokenId: opts.actorTokenId }),
1129
+ orgId,
1130
+ action: "connector.git_push_policy_changed",
1131
+ target: connectorId,
1132
+ detail: { from: app.git_push_policy, to: policy, ...opts.auditDetail },
1133
+ });
1134
+ }
1135
+ return this.detail(t, orgId, connectorId, actorAccountId);
1136
+ }
1084
1137
  /**
1085
1138
  * The org id of a live connector of a live org (the platform paths address a connector by its
1086
1139
  * global id); else `connector.not_found`.
@@ -1471,6 +1524,9 @@ __decorate([
1471
1524
  __decorate([
1472
1525
  Transactional()
1473
1526
  ], ConnectorsService.prototype, "update", null);
1527
+ __decorate([
1528
+ Transactional()
1529
+ ], ConnectorsService.prototype, "setGitPushPolicy", null);
1474
1530
  __decorate([
1475
1531
  Transactional({ propagation: "mandatory" })
1476
1532
  ], ConnectorsService.prototype, "disableWithPluginIn", null);
@@ -5,7 +5,7 @@ import { KernelDb } from "../infra/database/kernel-db.js";
5
5
  import { TransactionHost } from "../infra/database/transaction-host.js";
6
6
  import { Credentials } from "./credentials.js";
7
7
  import { ToolRegistry } from "./registry.js";
8
- export { DRIFT_CONNECTOR_JOB, DRIFT_SCAN_JOB, DRIFT_SCHEDULER_ID } from "./job-ids.js";
8
+ export { DRIFT_CONNECTOR_JOB, DRIFT_SCAN_JOB } from "./job-ids.js";
9
9
  /**
10
10
  * list_changed 触发的检查:jobId 按连接器与分钟桶去重(同一分钟内多次通知只检查一次;connectorId 为 UUID,不含 `:`)。
11
11
  */
@@ -42,7 +42,7 @@ import { recordToolSpecs } from "./specs.js";
42
42
  * 授权(`tool_grants` / `conversation_tool_grants`)按 spec_hash 比对(D8),复核通过采用新指纹后旧授权自然失效。
43
43
  */
44
44
  import { DRIFT_CONNECTOR_JOB } from "./job-ids.js";
45
- export { DRIFT_CONNECTOR_JOB, DRIFT_SCAN_JOB, DRIFT_SCHEDULER_ID } from "./job-ids.js";
45
+ export { DRIFT_CONNECTOR_JOB, DRIFT_SCAN_JOB } from "./job-ids.js";
46
46
  /**
47
47
  * list_changed 触发的检查:jobId 按连接器与分钟桶去重(同一分钟内多次通知只检查一次;connectorId 为 UUID,不含 `:`)。
48
48
  */
@@ -19,7 +19,10 @@ export type GitPushReason =
19
19
  | "org_deny"
20
20
  /** The member denied pushes to the repository for themselves. */
21
21
  | "member_deny"
22
- /** The org forbids `git:push` (or the repository's key) in scheduled runs. */
22
+ /**
23
+ * The org forbids `git:push` (or the repository's key) in scheduled runs, or its forbidden list
24
+ * cannot be read (fails closed).
25
+ */
23
26
  | "forbidden"
24
27
  /** An unattended run in `fail` mode without a task grant: no one can be asked. */
25
28
  | "unattended"
@@ -79,7 +79,9 @@ export async function decideGitPush(db, config, input) {
79
79
  ? input.unattended
80
80
  : await unattendedRunOf(db, config, input.orgId, input.runId);
81
81
  const rules = unattendedRules(unattended) ? unattended : null;
82
- if (rules !== null && gitPushForbidden(rules.forbiddenTools, key)) {
82
+ // fail closed: an unreadable list forbids every push of an unattended run
83
+ if (rules !== null &&
84
+ (rules.forbiddenToolsUnreadable === true || gitPushForbidden(rules.forbiddenTools, key))) {
83
85
  return { decision: "deny", reason: "forbidden", repo };
84
86
  }
85
87
  if (base.policy === "allow")
@@ -13,12 +13,6 @@ export type ToolKind = "command" | "read" | "edit" | "search" | "connector" | "m
13
13
  export interface ToolInfo {
14
14
  /** The model-visible tool key, as asked for. */
15
15
  key: string;
16
- /**
17
- * Set only for a release-candidate builtin key (old history, tool naming spec §9): the current
18
- * tool it stands for. Everything else describes that tool, with `keyArgs` in the old parameter
19
- * names the logged input carries. Pages map a call's name through it (the `Agent` row, labels).
20
- */
21
- aliasOf?: string;
22
16
  /** The declared display title (`ToolSpec.title`), or null. */
23
17
  title: string | null;
24
18
  kind: ToolKind;
@@ -59,7 +53,7 @@ export interface ToolInfoDeps {
59
53
  }
60
54
  /**
61
55
  * Presentation metadata for `keys` in this org, in request order with repeats dropped. Builtins
62
- * by name (a release-candidate builtin key as its current tool, with `aliasOf`); `plugin__<plugin>__<tool>` keys as a loaded extension's registration, and `mcp__<slug>__<tool>` keys as a live
56
+ * by name; `plugin__<plugin>__<tool>` keys as a loaded extension's registration, and `mcp__<slug>__<tool>` keys as a live
63
57
  * connector's current stored tool (its reviewed definition, never a pending one). Anything else
64
58
  * comes back as an unknown plain tool.
65
59
  *
@@ -15,7 +15,6 @@ import { KernelDb } from "../infra/database/kernel-db.js";
15
15
  import { UUID_RE } from "../ui/registry.js";
16
16
  import { BUILTIN_TOOL_KINDS, SANDBOX_TOOL_NAMES } from "./builtin-names.js";
17
17
  import { pluginDisplayNames } from "./display-names.js";
18
- import { isLegacyBuiltinKey, LEGACY_BUILTINS } from "./legacy-keys.js";
19
18
  import { toolKeyIssue } from "./naming.js";
20
19
  import { OrgToolSwitches } from "./org-tool-switches.js";
21
20
  import { policyFromAnnotations, ToolRegistry } from "./registry.js";
@@ -29,7 +28,7 @@ const display = (spec) => ({
29
28
  });
30
29
  /**
31
30
  * Presentation metadata for `keys` in this org, in request order with repeats dropped. Builtins
32
- * by name (a release-candidate builtin key as its current tool, with `aliasOf`); `plugin__<plugin>__<tool>` keys as a loaded extension's registration, and `mcp__<slug>__<tool>` keys as a live
31
+ * by name; `plugin__<plugin>__<tool>` keys as a loaded extension's registration, and `mcp__<slug>__<tool>` keys as a live
33
32
  * connector's current stored tool (its reviewed definition, never a pending one). Anything else
34
33
  * comes back as an unknown plain tool.
35
34
  *
@@ -74,30 +73,18 @@ export async function toolInfo(deps, orgId, keys) {
74
73
  const p = parseToolKey(key);
75
74
  return p && p.kind !== "builtin" ? p.tool : null;
76
75
  };
77
- const builtinInfo = (key, name, spec) => ({
76
+ const builtinInfo = (key, spec) => ({
78
77
  key,
79
78
  ...display(spec),
80
- kind: BUILTIN_TOOL_KINDS[name] ?? "tool",
81
- sandbox: SANDBOX_TOOL_NAMES.includes(name),
79
+ kind: BUILTIN_TOOL_KINDS[key] ?? "tool",
80
+ sandbox: SANDBOX_TOOL_NAMES.includes(key),
82
81
  tool: null,
83
82
  source: { kind: "builtin" },
84
83
  });
85
84
  return unique.map((key) => {
86
85
  const b = builtins.get(key);
87
86
  if (b)
88
- return builtinInfo(key, key, b);
89
- const legacy = isLegacyBuiltinKey(key) ? LEGACY_BUILTINS[key] : undefined;
90
- const current = legacy && builtins.get(legacy.name);
91
- if (legacy && current) {
92
- // the logged input of an rc call names the old parameters: key arguments in those names
93
- const oldName = new Map(Object.entries(legacy.params).map(([o, n]) => [n, o]));
94
- const info = builtinInfo(key, legacy.name, current);
95
- return {
96
- ...info,
97
- aliasOf: legacy.name,
98
- keyArgs: info.keyArgs.map((a) => oldName.get(a) ?? a),
99
- };
100
- }
87
+ return builtinInfo(key, b);
101
88
  const e = extensions.get(key);
102
89
  if (e)
103
90
  return {
@@ -1,7 +1,5 @@
1
1
  /** The periodic drift scan (`@LockedInterval`, tools/jobs.ts). */
2
2
  export declare const DRIFT_SCAN_JOB = "drift-scan";
3
- /** The BullMQ repeatable scheduler the scan had before it became `@LockedInterval` (retired). */
4
- export declare const DRIFT_SCHEDULER_ID = "drift-scan-interval";
5
3
  /**
6
4
  * 单个连接器的漂移检查任务名(维护队列上的一次性任务:生产方是 `ToolDrift`,消费方是
7
5
  * `MaintenanceProcessor`)。
@@ -9,5 +7,3 @@ export declare const DRIFT_SCHEDULER_ID = "drift-scan-interval";
9
7
  export declare const DRIFT_CONNECTOR_JOB = "drift-connector";
10
8
  /** The hourly cleanup of expired tool output archives (`@LockedCron`, tools/jobs.ts). */
11
9
  export declare const OUTPUT_CLEANUP_JOB = "output-cleanup";
12
- /** The BullMQ repeatable scheduler the cleanup had before it became `@LockedCron` (retired). */
13
- export declare const OUTPUT_CLEANUP_SCHEDULER_ID = "output-cleanup-hourly";
@@ -1,9 +1,6 @@
1
- // The tools' job names and the retired scheduler ids: a leaf module (no service imports), read by
2
- // the maintenance queue's retirement list.
1
+ // The tools' job names: a leaf module (no service imports), read by the maintenance queue.
3
2
  /** The periodic drift scan (`@LockedInterval`, tools/jobs.ts). */
4
3
  export const DRIFT_SCAN_JOB = "drift-scan";
5
- /** The BullMQ repeatable scheduler the scan had before it became `@LockedInterval` (retired). */
6
- export const DRIFT_SCHEDULER_ID = "drift-scan-interval";
7
4
  /**
8
5
  * 单个连接器的漂移检查任务名(维护队列上的一次性任务:生产方是 `ToolDrift`,消费方是
9
6
  * `MaintenanceProcessor`)。
@@ -11,5 +8,3 @@ export const DRIFT_SCHEDULER_ID = "drift-scan-interval";
11
8
  export const DRIFT_CONNECTOR_JOB = "drift-connector";
12
9
  /** The hourly cleanup of expired tool output archives (`@LockedCron`, tools/jobs.ts). */
13
10
  export const OUTPUT_CLEANUP_JOB = "output-cleanup";
14
- /** The BullMQ repeatable scheduler the cleanup had before it became `@LockedCron` (retired). */
15
- export const OUTPUT_CLEANUP_SCHEDULER_ID = "output-cleanup-hourly";