@agent-native/core 0.79.1 → 0.79.5

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 (258) hide show
  1. package/corpus/README.md +2 -2
  2. package/corpus/core/CHANGELOG.md +30 -0
  3. package/corpus/core/docs/content/locales/zh-TW/a2a-protocol.md +392 -0
  4. package/corpus/core/docs/content/locales/zh-TW/actions.md +583 -0
  5. package/corpus/core/docs/content/locales/zh-TW/agent-mentions.md +164 -0
  6. package/corpus/core/docs/content/locales/zh-TW/agent-surfaces.md +397 -0
  7. package/corpus/core/docs/content/locales/zh-TW/agent-teams.md +171 -0
  8. package/corpus/core/docs/content/locales/zh-TW/agent-web-surfaces.md +161 -0
  9. package/corpus/core/docs/content/locales/zh-TW/audit-log.md +111 -0
  10. package/corpus/core/docs/content/locales/zh-TW/authentication.md +332 -0
  11. package/corpus/core/docs/content/locales/zh-TW/automations.md +268 -0
  12. package/corpus/core/docs/content/locales/zh-TW/blueprint-installer.md +83 -0
  13. package/corpus/core/docs/content/locales/zh-TW/cli-adapters.md +129 -0
  14. package/corpus/core/docs/content/locales/zh-TW/client.md +398 -0
  15. package/corpus/core/docs/content/locales/zh-TW/cloneable-saas.md +114 -0
  16. package/corpus/core/docs/content/locales/zh-TW/code-agents-ui.md +436 -0
  17. package/corpus/core/docs/content/locales/zh-TW/components.md +368 -0
  18. package/corpus/core/docs/content/locales/zh-TW/context-awareness.md +373 -0
  19. package/corpus/core/docs/content/locales/zh-TW/creating-templates.md +411 -0
  20. package/corpus/core/docs/content/locales/zh-TW/cross-app-sso.md +188 -0
  21. package/corpus/core/docs/content/locales/zh-TW/database.md +183 -0
  22. package/corpus/core/docs/content/locales/zh-TW/deployment.md +348 -0
  23. package/corpus/core/docs/content/locales/zh-TW/dispatch.md +146 -0
  24. package/corpus/core/docs/content/locales/zh-TW/drop-in-agent.md +260 -0
  25. package/corpus/core/docs/content/locales/zh-TW/durable-resume.md +65 -0
  26. package/corpus/core/docs/content/locales/zh-TW/embedding-sdk.md +597 -0
  27. package/corpus/core/docs/content/locales/zh-TW/evals.md +155 -0
  28. package/corpus/core/docs/content/locales/zh-TW/extensions.md +360 -0
  29. package/corpus/core/docs/content/locales/zh-TW/external-agents.md +619 -0
  30. package/corpus/core/docs/content/locales/zh-TW/faq.md +142 -0
  31. package/corpus/core/docs/content/locales/zh-TW/file-uploads.md +122 -0
  32. package/corpus/core/docs/content/locales/zh-TW/frames.md +153 -0
  33. package/corpus/core/docs/content/locales/zh-TW/getting-started.md +199 -0
  34. package/corpus/core/docs/content/locales/zh-TW/harness-agents.md +349 -0
  35. package/corpus/core/docs/content/locales/zh-TW/human-approval.md +86 -0
  36. package/corpus/core/docs/content/locales/zh-TW/internationalization.md +147 -0
  37. package/corpus/core/docs/content/locales/zh-TW/key-concepts.md +312 -0
  38. package/corpus/core/docs/content/locales/zh-TW/local-file-mode.md +433 -0
  39. package/corpus/core/docs/content/locales/zh-TW/mcp-apps.md +147 -0
  40. package/corpus/core/docs/content/locales/zh-TW/mcp-clients.md +330 -0
  41. package/corpus/core/docs/content/locales/zh-TW/mcp-protocol.md +279 -0
  42. package/corpus/core/docs/content/locales/zh-TW/messaging.md +461 -0
  43. package/corpus/core/docs/content/locales/zh-TW/migration-workbench.md +33 -0
  44. package/corpus/core/docs/content/locales/zh-TW/multi-app-workspace.md +312 -0
  45. package/corpus/core/docs/content/locales/zh-TW/multi-tenancy.md +52 -0
  46. package/corpus/core/docs/content/locales/zh-TW/native-chat-ui.md +321 -0
  47. package/corpus/core/docs/content/locales/zh-TW/notifications.md +231 -0
  48. package/corpus/core/docs/content/locales/zh-TW/observability.md +294 -0
  49. package/corpus/core/docs/content/locales/zh-TW/observational-memory.md +77 -0
  50. package/corpus/core/docs/content/locales/zh-TW/onboarding.md +216 -0
  51. package/corpus/core/docs/content/locales/zh-TW/plan-plugin.md +200 -0
  52. package/corpus/core/docs/content/locales/zh-TW/pr-visual-recap.md +384 -0
  53. package/corpus/core/docs/content/locales/zh-TW/processors.md +106 -0
  54. package/corpus/core/docs/content/locales/zh-TW/progress.md +199 -0
  55. package/corpus/core/docs/content/locales/zh-TW/pure-agent-apps.md +39 -0
  56. package/corpus/core/docs/content/locales/zh-TW/real-time-collaboration.md +680 -0
  57. package/corpus/core/docs/content/locales/zh-TW/recurring-jobs.md +142 -0
  58. package/corpus/core/docs/content/locales/zh-TW/routing.md +79 -0
  59. package/corpus/core/docs/content/locales/zh-TW/sandbox-adapters.md +227 -0
  60. package/corpus/core/docs/content/locales/zh-TW/security.md +330 -0
  61. package/corpus/core/docs/content/locales/zh-TW/server.md +265 -0
  62. package/corpus/core/docs/content/locales/zh-TW/sharing.md +219 -0
  63. package/corpus/core/docs/content/locales/zh-TW/skills-guide.md +281 -0
  64. package/corpus/core/docs/content/locales/zh-TW/template-analytics.md +259 -0
  65. package/corpus/core/docs/content/locales/zh-TW/template-assets.md +303 -0
  66. package/corpus/core/docs/content/locales/zh-TW/template-brain.md +324 -0
  67. package/corpus/core/docs/content/locales/zh-TW/template-calendar.md +194 -0
  68. package/corpus/core/docs/content/locales/zh-TW/template-chat.md +129 -0
  69. package/corpus/core/docs/content/locales/zh-TW/template-clips.md +368 -0
  70. package/corpus/core/docs/content/locales/zh-TW/template-content.md +402 -0
  71. package/corpus/core/docs/content/locales/zh-TW/template-design.md +173 -0
  72. package/corpus/core/docs/content/locales/zh-TW/template-dispatch.md +220 -0
  73. package/corpus/core/docs/content/locales/zh-TW/template-forms.md +178 -0
  74. package/corpus/core/docs/content/locales/zh-TW/template-mail.md +239 -0
  75. package/corpus/core/docs/content/locales/zh-TW/template-plan.md +814 -0
  76. package/corpus/core/docs/content/locales/zh-TW/template-slides.md +293 -0
  77. package/corpus/core/docs/content/locales/zh-TW/template-videos.md +222 -0
  78. package/corpus/core/docs/content/locales/zh-TW/tracking.md +236 -0
  79. package/corpus/core/docs/content/locales/zh-TW/using-your-agent.md +71 -0
  80. package/corpus/core/docs/content/locales/zh-TW/voice-input.md +81 -0
  81. package/corpus/core/docs/content/locales/zh-TW/what-is-agent-native.md +202 -0
  82. package/corpus/core/docs/content/locales/zh-TW/workspace-connections.md +321 -0
  83. package/corpus/core/docs/content/locales/zh-TW/workspace-management.md +175 -0
  84. package/corpus/core/docs/content/locales/zh-TW/workspace.md +323 -0
  85. package/corpus/core/docs/content/locales/zh-TW/writing-agent-instructions.md +173 -0
  86. package/corpus/core/package.json +1 -1
  87. package/corpus/core/src/client/ErrorBoundary.tsx +10 -0
  88. package/corpus/core/src/client/FeedbackButton.tsx +12 -0
  89. package/corpus/core/src/client/blocks/library/block-copy.ts +32 -0
  90. package/corpus/core/src/client/extensions/ExtensionsSidebarSection.tsx +33 -0
  91. package/corpus/core/src/client/i18n.tsx +5 -0
  92. package/corpus/core/src/localization/actions/set-localization-preference.ts +2 -1
  93. package/corpus/core/src/localization/shared.ts +45 -0
  94. package/corpus/core/src/server/agent-chat-plugin.ts +54 -2
  95. package/corpus/core/src/server/onboarding-html.ts +99 -0
  96. package/corpus/core/src/templates/default/app/i18n/index.ts +2 -0
  97. package/corpus/core/src/templates/default/app/i18n/zh-TW.ts +466 -0
  98. package/corpus/core/src/templates/default/app/root.tsx +8 -0
  99. package/corpus/templates/analytics/app/i18n/index.ts +2 -0
  100. package/corpus/templates/analytics/app/i18n/zh-TW.ts +818 -0
  101. package/corpus/templates/analytics/app/i18n-data.ts +9 -0
  102. package/corpus/templates/assets/app/i18n/index.ts +2 -0
  103. package/corpus/templates/assets/app/i18n/zh-TW.ts +860 -0
  104. package/corpus/templates/assets/app/i18n-data.ts +3 -0
  105. package/corpus/templates/brain/app/i18n/index.ts +2 -0
  106. package/corpus/templates/brain/app/i18n/zh-TW.ts +709 -0
  107. package/corpus/templates/brain/app/i18n-data.ts +3 -0
  108. package/corpus/templates/calendar/app/i18n/zh-TW.ts +836 -0
  109. package/corpus/templates/calendar/app/i18n-data.ts +4 -0
  110. package/corpus/templates/chat/app/i18n/index.ts +2 -0
  111. package/corpus/templates/chat/app/i18n/zh-TW.ts +67 -0
  112. package/corpus/templates/chat/app/i18n-data.ts +3 -0
  113. package/corpus/templates/clips/app/i18n/index.ts +2 -0
  114. package/corpus/templates/clips/app/i18n/zh-TW.ts +1280 -0
  115. package/corpus/templates/content/app/i18n/index.ts +2 -0
  116. package/corpus/templates/content/app/i18n/zh-TW.ts +906 -0
  117. package/corpus/templates/content/app/i18n-data.ts +4 -0
  118. package/corpus/templates/design/app/i18n/index.ts +2 -0
  119. package/corpus/templates/design/app/i18n/zh-TW.ts +517 -0
  120. package/corpus/templates/design/app/i18n-data.ts +6 -0
  121. package/corpus/templates/dispatch/app/i18n/index.ts +2 -0
  122. package/corpus/templates/dispatch/app/i18n/zh-TW.ts +195 -0
  123. package/corpus/templates/dispatch/app/i18n-data.ts +3 -0
  124. package/corpus/templates/forms/app/i18n/index.ts +2 -0
  125. package/corpus/templates/forms/app/i18n/zh-TW.ts +349 -0
  126. package/corpus/templates/macros/app/i18n/index.ts +2 -0
  127. package/corpus/templates/macros/app/i18n/zh-TW.ts +224 -0
  128. package/corpus/templates/mail/app/i18n/index.ts +2 -0
  129. package/corpus/templates/mail/app/i18n/zh-TW.ts +562 -0
  130. package/corpus/templates/mail/app/root.tsx +6 -0
  131. package/corpus/templates/plan/app/i18n/index.ts +2 -0
  132. package/corpus/templates/plan/app/i18n/zh-TW.ts +712 -0
  133. package/corpus/templates/slides/app/i18n/index.ts +2 -0
  134. package/corpus/templates/slides/app/i18n/zh-TW.ts +531 -0
  135. package/corpus/templates/videos/app/i18n/index.ts +2 -0
  136. package/corpus/templates/videos/app/i18n/zh-TW.ts +435 -0
  137. package/dist/client/ErrorBoundary.d.ts.map +1 -1
  138. package/dist/client/ErrorBoundary.js +10 -0
  139. package/dist/client/ErrorBoundary.js.map +1 -1
  140. package/dist/client/FeedbackButton.d.ts.map +1 -1
  141. package/dist/client/FeedbackButton.js +12 -0
  142. package/dist/client/FeedbackButton.js.map +1 -1
  143. package/dist/client/blocks/library/block-copy.d.ts.map +1 -1
  144. package/dist/client/blocks/library/block-copy.js +32 -0
  145. package/dist/client/blocks/library/block-copy.js.map +1 -1
  146. package/dist/client/extensions/ExtensionsSidebarSection.d.ts.map +1 -1
  147. package/dist/client/extensions/ExtensionsSidebarSection.js +32 -0
  148. package/dist/client/extensions/ExtensionsSidebarSection.js.map +1 -1
  149. package/dist/client/i18n.d.ts.map +1 -1
  150. package/dist/client/i18n.js +5 -0
  151. package/dist/client/i18n.js.map +1 -1
  152. package/dist/collab/awareness.d.ts +2 -2
  153. package/dist/collab/awareness.d.ts.map +1 -1
  154. package/dist/collab/routes.d.ts +1 -1
  155. package/dist/localization/actions/set-localization-preference.d.ts.map +1 -1
  156. package/dist/localization/actions/set-localization-preference.js +2 -2
  157. package/dist/localization/actions/set-localization-preference.js.map +1 -1
  158. package/dist/localization/shared.d.ts +1 -1
  159. package/dist/localization/shared.d.ts.map +1 -1
  160. package/dist/localization/shared.js +43 -0
  161. package/dist/localization/shared.js.map +1 -1
  162. package/dist/resources/handlers.d.ts +2 -2
  163. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  164. package/dist/server/agent-chat-plugin.js +55 -2
  165. package/dist/server/agent-chat-plugin.js.map +1 -1
  166. package/dist/server/onboarding-html.d.ts.map +1 -1
  167. package/dist/server/onboarding-html.js +96 -0
  168. package/dist/server/onboarding-html.js.map +1 -1
  169. package/dist/templates/default/app/i18n/index.ts +2 -0
  170. package/dist/templates/default/app/i18n/zh-TW.ts +466 -0
  171. package/dist/templates/default/app/root.tsx +8 -0
  172. package/docs/content/locales/zh-TW/a2a-protocol.md +392 -0
  173. package/docs/content/locales/zh-TW/actions.md +583 -0
  174. package/docs/content/locales/zh-TW/agent-mentions.md +164 -0
  175. package/docs/content/locales/zh-TW/agent-surfaces.md +397 -0
  176. package/docs/content/locales/zh-TW/agent-teams.md +171 -0
  177. package/docs/content/locales/zh-TW/agent-web-surfaces.md +161 -0
  178. package/docs/content/locales/zh-TW/audit-log.md +111 -0
  179. package/docs/content/locales/zh-TW/authentication.md +332 -0
  180. package/docs/content/locales/zh-TW/automations.md +268 -0
  181. package/docs/content/locales/zh-TW/blueprint-installer.md +83 -0
  182. package/docs/content/locales/zh-TW/cli-adapters.md +129 -0
  183. package/docs/content/locales/zh-TW/client.md +398 -0
  184. package/docs/content/locales/zh-TW/cloneable-saas.md +114 -0
  185. package/docs/content/locales/zh-TW/code-agents-ui.md +436 -0
  186. package/docs/content/locales/zh-TW/components.md +368 -0
  187. package/docs/content/locales/zh-TW/context-awareness.md +373 -0
  188. package/docs/content/locales/zh-TW/creating-templates.md +411 -0
  189. package/docs/content/locales/zh-TW/cross-app-sso.md +188 -0
  190. package/docs/content/locales/zh-TW/database.md +183 -0
  191. package/docs/content/locales/zh-TW/deployment.md +348 -0
  192. package/docs/content/locales/zh-TW/dispatch.md +146 -0
  193. package/docs/content/locales/zh-TW/drop-in-agent.md +260 -0
  194. package/docs/content/locales/zh-TW/durable-resume.md +65 -0
  195. package/docs/content/locales/zh-TW/embedding-sdk.md +597 -0
  196. package/docs/content/locales/zh-TW/evals.md +155 -0
  197. package/docs/content/locales/zh-TW/extensions.md +360 -0
  198. package/docs/content/locales/zh-TW/external-agents.md +619 -0
  199. package/docs/content/locales/zh-TW/faq.md +142 -0
  200. package/docs/content/locales/zh-TW/file-uploads.md +122 -0
  201. package/docs/content/locales/zh-TW/frames.md +153 -0
  202. package/docs/content/locales/zh-TW/getting-started.md +199 -0
  203. package/docs/content/locales/zh-TW/harness-agents.md +349 -0
  204. package/docs/content/locales/zh-TW/human-approval.md +86 -0
  205. package/docs/content/locales/zh-TW/internationalization.md +147 -0
  206. package/docs/content/locales/zh-TW/key-concepts.md +312 -0
  207. package/docs/content/locales/zh-TW/local-file-mode.md +433 -0
  208. package/docs/content/locales/zh-TW/mcp-apps.md +147 -0
  209. package/docs/content/locales/zh-TW/mcp-clients.md +330 -0
  210. package/docs/content/locales/zh-TW/mcp-protocol.md +279 -0
  211. package/docs/content/locales/zh-TW/messaging.md +461 -0
  212. package/docs/content/locales/zh-TW/migration-workbench.md +33 -0
  213. package/docs/content/locales/zh-TW/multi-app-workspace.md +312 -0
  214. package/docs/content/locales/zh-TW/multi-tenancy.md +52 -0
  215. package/docs/content/locales/zh-TW/native-chat-ui.md +321 -0
  216. package/docs/content/locales/zh-TW/notifications.md +231 -0
  217. package/docs/content/locales/zh-TW/observability.md +294 -0
  218. package/docs/content/locales/zh-TW/observational-memory.md +77 -0
  219. package/docs/content/locales/zh-TW/onboarding.md +216 -0
  220. package/docs/content/locales/zh-TW/plan-plugin.md +200 -0
  221. package/docs/content/locales/zh-TW/pr-visual-recap.md +384 -0
  222. package/docs/content/locales/zh-TW/processors.md +106 -0
  223. package/docs/content/locales/zh-TW/progress.md +199 -0
  224. package/docs/content/locales/zh-TW/pure-agent-apps.md +39 -0
  225. package/docs/content/locales/zh-TW/real-time-collaboration.md +680 -0
  226. package/docs/content/locales/zh-TW/recurring-jobs.md +142 -0
  227. package/docs/content/locales/zh-TW/routing.md +79 -0
  228. package/docs/content/locales/zh-TW/sandbox-adapters.md +227 -0
  229. package/docs/content/locales/zh-TW/security.md +330 -0
  230. package/docs/content/locales/zh-TW/server.md +265 -0
  231. package/docs/content/locales/zh-TW/sharing.md +219 -0
  232. package/docs/content/locales/zh-TW/skills-guide.md +281 -0
  233. package/docs/content/locales/zh-TW/template-analytics.md +259 -0
  234. package/docs/content/locales/zh-TW/template-assets.md +303 -0
  235. package/docs/content/locales/zh-TW/template-brain.md +324 -0
  236. package/docs/content/locales/zh-TW/template-calendar.md +194 -0
  237. package/docs/content/locales/zh-TW/template-chat.md +129 -0
  238. package/docs/content/locales/zh-TW/template-clips.md +368 -0
  239. package/docs/content/locales/zh-TW/template-content.md +402 -0
  240. package/docs/content/locales/zh-TW/template-design.md +173 -0
  241. package/docs/content/locales/zh-TW/template-dispatch.md +220 -0
  242. package/docs/content/locales/zh-TW/template-forms.md +178 -0
  243. package/docs/content/locales/zh-TW/template-mail.md +239 -0
  244. package/docs/content/locales/zh-TW/template-plan.md +814 -0
  245. package/docs/content/locales/zh-TW/template-slides.md +293 -0
  246. package/docs/content/locales/zh-TW/template-videos.md +222 -0
  247. package/docs/content/locales/zh-TW/tracking.md +236 -0
  248. package/docs/content/locales/zh-TW/using-your-agent.md +71 -0
  249. package/docs/content/locales/zh-TW/voice-input.md +81 -0
  250. package/docs/content/locales/zh-TW/what-is-agent-native.md +202 -0
  251. package/docs/content/locales/zh-TW/workspace-connections.md +321 -0
  252. package/docs/content/locales/zh-TW/workspace-management.md +175 -0
  253. package/docs/content/locales/zh-TW/workspace.md +323 -0
  254. package/docs/content/locales/zh-TW/writing-agent-instructions.md +173 -0
  255. package/package.json +1 -1
  256. package/src/templates/default/app/i18n/index.ts +2 -0
  257. package/src/templates/default/app/i18n/zh-TW.ts +466 -0
  258. package/src/templates/default/app/root.tsx +8 -0
@@ -0,0 +1,321 @@
1
+ ---
2
+ title: "工作區連線"
3
+ description: "用於 connect-once-use-everywhere 整合的共用提供者元資料、授權和憑證引用。"
4
+ ---
5
+
6
+ # 工作區連線
7
+
8
+ 工作區連線是可重用整合元資料的框架原語。它們使“連線一次、授予應用程式、重複使用憑證”成為可能,而無需假裝每個提供者都是完全通用的。
9
+
10
+ ## 快速入門 {#quickstart}
11
+
12
+ ### 四個概念
13
+
14
+ - **連線** — 指定提供者帳戶(`team-slack`、`acme-hubspot`)。紀錄提供者 ID、帳戶標籤、狀態、範圍和安全設定。從不存儲秘密值。
15
+ - **授予** — 特定應用程式使用連線的權限。未經授權的應用程式無法檢視連線的憑證。
16
+ - **credentialRef** — 指向保管庫機密 (`{ key: "SLACK_BOT_TOKEN", scope: "org" }`) 的指針。連線表明權杖所在的位置;金庫儲存著價值。
17
+ - **就緒** - 應用程式看到的組合狀態:`connected`(已授予 + 存在憑證)、`needs_grant`、`needs_credentials`、`needs_attention` 或 `not_configured`。
18
+
19
+ ```an-diagram title="連線一次、授予應用程式、重複使用憑證" summary="連線儲存提供者元資料(絕不是秘密)和指向保管庫的 credentialRefs。每個應用程式授予解鎖它。應用程式讀取單個就緒狀態。"
20
+ {
21
+ "html": "<div class=\"diagram-conn\"><div class=\"diagram-panel col\" data-rough><span class=\"diagram-pill accent\">Connection</span><div class=\"diagram-box\" data-rough>named provider account<br><small class=\"diagram-muted\">provider, label, 狀態、作用域、設定 &middot; never stores secret values</small></div><div class=\"diagram-muted\">credentialRef &rarr; pointer to a vault secret</div></div><div class=\"diagram-arrow diagram-muted\" aria-hidden=\"true\">&rarr;</div><div class=\"diagram-panel col\" data-rough><span class=\"diagram-pill\">Grant</span><div class=\"diagram-box\" data-rough>per-app permission<br><small class=\"diagram-muted\">no grant = no credential access</small></div></div><div class=\"diagram-arrow diagram-muted\" aria-hidden=\"true\">&rarr;</div><div class=\"diagram-panel col\" data-rough><span class=\"diagram-pill ok\">Readiness</span><small class=\"diagram-muted\">what the app sees</small><div class=\"sev-row\"><span class=\"diagram-pill ok\">connected</span><span class=\"diagram-pill warn\">needs_grant</span></div><div class=\"sev-row\"><span class=\"diagram-pill warn\">needs_credentials</span><span class=\"diagram-pill warn\">needs_attention</span></div><div class=\"sev-row\"><span class=\"diagram-pill\">not_configured</span></div></div></div>",
22
+ "css": ".diagram-conn{display:flex;align-items:center;gap:14px;flex-wrap:wrap}.diagram-conn .col{display:flex;flex-direction:column;gap:8px;padding:14px;min-width:220px}.diagram-conn .diagram-arrow{font-size:22px;line-height:1}.diagram-conn .sev-row{display:flex;gap:8px;flex-wrap:wrap}"
23
+ }
24
+ ```
25
+
26
+ ### 工作範例:Slack
27
+
28
+ 連線 Slack 一次並將其授予 Brain and Analytics:
29
+
30
+ ```ts
31
+ import {
32
+ upsertWorkspaceConnection,
33
+ upsertWorkspaceConnectionGrant,
34
+ } from "@agent-native/core/workspace-connections";
35
+
36
+ await upsertWorkspaceConnection({
37
+ id: "acme-slack",
38
+ provider: "slack",
39
+ label: "Acme Slack",
40
+ accountId: "T012345",
41
+ accountLabel: "Acme",
42
+ status: "connected",
43
+ scopes: ["channels:history", "groups:history", "chat:write"],
44
+ config: {
45
+ teamDomain: "acme",
46
+ channelHints: ["product", "dev-fusion", "customer-success"],
47
+ },
48
+ credentialRefs: [{ key: "SLACK_BOT_TOKEN", scope: "org" }],
49
+ });
50
+
51
+ await upsertWorkspaceConnectionGrant({
52
+ connectionId: "acme-slack",
53
+ appId: "brain",
54
+ });
55
+ await upsertWorkspaceConnectionGrant({
56
+ connectionId: "acme-slack",
57
+ appId: "analytics",
58
+ });
59
+ ```
60
+
61
+ ```an-schema title="連線模型" summary="A connection records safe provider metadata and credentialRefs (pointers, not secrets). Each grant unlocks one app — one connection, many grants."
62
+ {
63
+ "entities": [
64
+ {
65
+ "id": "conn",
66
+ "name": "workspace_connections",
67
+ "note": "指定的提供者帳戶。從不存儲秘密值。",
68
+ "fields": [
69
+ { "name": "id", "type": "string", "pk": true, "note": "e.g. acme-slack" },
70
+ { "name": "provider", "type": "string", "note": "穩定的提供者 ID,e.g。松弛" },
71
+ { "name": "label", "type": "string" },
72
+ { "name": "accountId", "type": "string", "nullable": true },
73
+ { "name": "accountLabel", "type": "string", "nullable": true },
74
+ { "name": "status", "type": "string", "note": "e.g. connected" },
75
+ { "name": "scopes", "type": "string[]", "nullable": true },
76
+ { "name": "config", "type": "json", "nullable": true, "note": "安全、非秘密設定" },
77
+ { "name": "credentialRefs", "type": "json", "nullable": true, "note": "pointers to vault keys, e.g. { key, scope }" }
78
+ ]
79
+ },
80
+ {
81
+ "id": "grant",
82
+ "name": "workspace_connection_grants",
83
+ "note": "每個應用程式使用連線的權限。",
84
+ "fields": [
85
+ { "name": "connectionId", "type": "string", "fk": "conn.id" },
86
+ { "name": "appId", "type": "string", "note": "e.g。大腦、分析" }
87
+ ]
88
+ }
89
+ ],
90
+ "relations": [
91
+ { "from": "conn", "to": "grant", "kind": "1-n", "label": "grants apps" }
92
+ ]
93
+ }
94
+ ```
95
+
96
+ ### 調用哪些應用
97
+
98
+ 在要求使用者貼上新金鑰之前,請先檢查準備情況:
99
+
100
+ ```ts
101
+ import { listWorkspaceConnectionProviderCatalogForApp } from "@agent-native/core/workspace-connections";
102
+
103
+ const catalog = await listWorkspaceConnectionProviderCatalogForApp({
104
+ appId: "brain",
105
+ templateUse: "brain",
106
+ provider: "slack",
107
+ includeConnections: "all",
108
+ });
109
+
110
+ const slack = catalog.providers[0];
111
+ if (slack.workspaceConnection.grantState === "needs_grant") {
112
+ // Show "Grant Brain access" instead of asking for a second Slack token.
113
+ }
114
+ if (slack.readiness.status === "needs_credentials") {
115
+ // Show the missing credential ref names, never a secret value.
116
+ }
117
+ ```
118
+
119
+ ## 參考 {#reference}
120
+
121
+ ### 提供者目錄
122
+
123
+ 從`@agent-native/core/connections`匯入目錄:
124
+
125
+ ```ts
126
+ import {
127
+ getWorkspaceConnectionProvider,
128
+ listWorkspaceConnectionProvidersForTemplate,
129
+ workspaceConnectionProviderSupports,
130
+ } from "@agent-native/core/connections";
131
+
132
+ const brainProviders = listWorkspaceConnectionProvidersForTemplate("brain");
133
+ const slack = getWorkspaceConnectionProvider("slack");
134
+
135
+ if (workspaceConnectionProviderSupports("slack", "messages")) {
136
+ // Offer a Slack source, sync check, or onboarding step.
137
+ }
138
+ ```
139
+
140
+ 初始提供者 ID 為:
141
+
142
+ | 提供者 | 能力 | 常見用途 |
143
+ | -------------- | ------------------------ | ------------------------ |
144
+ | `slack` | 搜尋、匯入、訊息 | 大腦、調度、分析 |
145
+ | `github` | 搜尋、匯入、程式碼、檔案 | 大腦、分析、調度 |
146
+ | `notion` | 搜尋、匯入、檔案 | 大腦、內容、調度 |
147
+ | `gmail` | 搜尋、匯入、訊息 | 郵件、大腦、調度 |
148
+ | `google_drive` | 搜尋、匯入、檔案 | 大腦、內容、幻燈片 |
149
+ | `hubspot` | 搜尋、匯入、crm | 分析、大腦、郵件 |
150
+ | `granola` | 搜尋、匯入、會議、檔案 | 大腦、行事曆、調度 |
151
+ | `clips` | 搜尋、匯入、會議 | 大腦、剪輯、影片 |
152
+ | `generic` | 搜尋、匯入、檔案 | 自訂 webhooks 和檔案投放 |
153
+
154
+ 憑證金鑰僅為名稱,例如 `SLACK_BOT_TOKEN` 或 `GITHUB_TOKEN`。提供者元資料絕不能包含實際的憑證值。
155
+
156
+ ### 連線存儲API
157
+
158
+ ```ts
159
+ import {
160
+ listWorkspaceConnectionProviderCatalogForApp,
161
+ listWorkspaceConnectionGrants,
162
+ listWorkspaceConnections,
163
+ summarizeWorkspaceConnectionProviderForApp,
164
+ summarizeWorkspaceConnectionProviderReadiness,
165
+ upsertWorkspaceConnection,
166
+ upsertWorkspaceConnectionGrant,
167
+ revokeWorkspaceConnectionGrant,
168
+ } from "@agent-native/core/workspace-connections";
169
+
170
+ const connections = await listWorkspaceConnections({ includeDisabled: true });
171
+ const grants = await listWorkspaceConnectionGrants({ appId: "brain" });
172
+
173
+ const appGrant = summarizeWorkspaceConnectionProviderForApp({
174
+ providerId: "slack",
175
+ appId: "brain",
176
+ connections,
177
+ grants,
178
+ });
179
+
180
+ const readiness = summarizeWorkspaceConnectionProviderReadiness({
181
+ provider: slack!,
182
+ appId: "brain",
183
+ connections,
184
+ grants,
185
+ });
186
+
187
+ const brainCatalog = await listWorkspaceConnectionProviderCatalogForApp({
188
+ appId: "brain",
189
+ templateUse: "brain",
190
+ });
191
+ ```
192
+
193
+ `credentialRefs` 陣列指向保管庫金鑰;它不是憑證存儲。例如,`{ key: "SLACK_BOT_TOKEN", scope: "org" }` 告訴授權應用程式在需要調用 Slack 時查找名為 `SLACK_BOT_TOKEN` 的組織範圍保管庫機密。連線級引用描述了提供者帳戶;授予級別的引用可以縮小或覆蓋特定應用程式應使用的內容。
194
+
195
+ 當存在活動組織時,連線行的範圍僅限於活動組織。如果沒有組織,它們的範圍僅限於經過驗證的使用者。授予行使用相同的範圍。
196
+
197
+ **舊版 `allowedApps` 欄位:** `allowedApps: []` 表示同一範圍內的每個應用程式都可以使用該連線; `allowedApps: ["dispatch"]` 通過舊欄位授予存取權限。使用顯式 `workspace_connection_grants` 行進行新設定 - 它們使撤銷、審核和每個應用程式的準備工作變得更容易。 `revokeWorkspaceConnectionGrant(connectionId, appId)` 刪除了顯式授權,但不更改舊版 `allowedApps`。
198
+
199
+ 使用 `summarizeWorkspaceConnectionProviderForApp()` 和 `summarizeWorkspaceConnectionProviderReadiness()` 來獲取面向應用的狀態,而不是手動滾動授權檢查。共用摘要返回 `grantState`、`grantAvailability`、安全憑證引用名稱、每個應用程式連線行以及就緒欄位(例如 `readyConnectionCount` 和 `missingRequiredCredentialKeys`)。
200
+
201
+ 對於新的應用程式設定螢幕,更喜歡 `listWorkspaceConnectionProviderCatalogForApp()` 作為更高級別的邊界 - 它將提供程序目錄、範圍連線、顯式授權、每個應用程式存取摘要和提供程序準備情況結合到一個安全的形狀中。
202
+
203
+ ### 這如何補充金庫
204
+
205
+ 憑證庫回答:“秘密存儲在哪裡,誰可以存取它,以及哪些應用程式被授予它?”
206
+
207
+ 工作區連線提供程序元資料回答:“這是哪個提供程序,它能做什么,可能需要什么憑證金鑰,以及哪些範本應提供它?”
208
+
209
+ ```an-diagram title="連線存儲與保管庫" summary="金庫擁有秘密價值。連線擁有提供者元資料和 credentialRefs(指針)。在執行時,應用程式通過授予的連線解析引用並從保管庫讀取值。"
210
+ {
211
+ "html": "<div class=\"diagram-vault\"><div class=\"diagram-panel col\" data-rough><span class=\"diagram-pill accent\">連線存儲</span><div class=\"diagram-box\" data-rough>provider account + metadata<br><small class=\"diagram-muted\">狀態、作用域、設定</small></div><div class=\"diagram-box\" data-rough>credentialRef<br><small class=\"diagram-muted\">{ key: SLACK_BOT_TOKEN, scope: org }</small></div></div><div class=\"diagram-arrow diagram-muted\" aria-hidden=\"true\">&rarr;</div><div class=\"diagram-card\"><span class=\"diagram-pill\">應用 action</span><small class=\"diagram-muted\">resolves at execution time through a granted ref</small><div class=\"diagram-arrow diagram-muted\" aria-hidden=\"true\">&darr;</div></div><div class=\"diagram-arrow diagram-muted\" aria-hidden=\"true\">&rarr;</div><div class=\"diagram-panel col\" data-rough><span class=\"diagram-pill ok\">Vault</span><div class=\"diagram-box\" data-rough>secret value<br><small class=\"diagram-muted\">絕不返回給代理或 UI</small></div></div></div>",
212
+ "css": ".diagram-vault{display:flex;align-items:center;gap:14px;flex-wrap:wrap}.diagram-vault .col{display:flex;flex-direction:column;gap:8px;padding:14px;min-width:220px}.diagram-vault .diagram-card{display:flex;flex-direction:column;gap:6px;padding:12px 14px}.diagram-vault .diagram-arrow{font-size:22px;line-height:1}"
213
+ }
214
+ ```
215
+
216
+ 同時使用兩者:
217
+
218
+ 1. Dispatch(或其他工作區設定流程)建立底層保管庫機密或 OAuth 憑證引用。
219
+ 2. 工作區連線存儲紀錄提供者帳戶、安全元資料、憑證引用和應用授權。
220
+ 3. 每個應用程式從目錄中讀取提供程序元資料,並從共用存儲中讀取連線/授權摘要。
221
+ 4. 應用 UI 顯示就緒狀態:已連線、已授予但不健康、需要授予、缺少憑證或僅元資料。
222
+ 5. 特定於應用程式的 SQL 僅存儲特定於應用程式的來源 ID、游標、過濾器、同步窗口、指標定義、審核規則和使用者選取。
223
+ 6. 應用程式 actions 在執行時通過授予的連線引用和保管庫解析憑證,並且從不返回秘密值。
224
+
225
+ ### 提供者讀取器執行時
226
+
227
+ 提供者-讀取器層首先是一個契約,而不是每個提供者都有一個共用的實時讀取器的承諾。讀者定義描述了支持的操作、憑證要求和實施狀態:`metadata-only`、`template-owned` 或 `shared`。執行時解析應用程式授予的工作區連線和憑證引用,調用註冊的處理程序,並返回規範化的專案而不暴露秘密值。
228
+
229
+ 如今,大多數實時處理程序仍然由範本擁有,這意味著 Brain 仍然擁有 Slack/GitHub 攝取行為,而 Analytics 仍然擁有分析解釋。僅當特定於提供者的 API 調用、分頁面、權限和結果語義真正可跨範本重用時,才將讀者提升為 `shared`。
230
+
231
+ ### 應用準備模式
232
+
233
+ 使用共用提供者憑證的應用程式應公開唯讀準備操作和一個小的設定表面,覆蓋:
234
+
235
+ - **提供者目錄:**提供者 ID、標籤、功能、推薦的範本用途以及來自 `@agent-native/core/connections` 的所需憑證金鑰名稱。
236
+ - **工作區摘要:**來自 `@agent-native/core/workspace-connections` 的連線計數、活動/授權計數、授權狀態、憑證引用名稱和非秘密帳戶標籤。
237
+ - **提供者準備情況:** `ready`、`needs_credentials`、`needs_attention`、`checking`、`disabled` 或 `not_configured`(通過 `summarizeWorkspaceConnectionProviderReadiness()`)。
238
+ - **來源狀態:**應用程式本機設定的來源、光標、同步狀態和下一步操作。
239
+
240
+ Brain's Sources 頁面是參考實現。它在 Brain 來源紀錄旁邊顯示可重用的工作區連線提供程序,將授權狀態標記為 `connected`、`granted`、`needs_grant` 或 `not_connected`,並將提供程序的執行狀況顯示為就緒、缺少金鑰、需要授權、需要修複或僅元資料。
241
+
242
+ ### 建置可重複使用的連線器
243
+
244
+ 當新的提供程序應跨多個範本工作時:
245
+
246
+ 1. **提供者元資料:**在 `@agent-native/core/connections` 中新增或重用提供者。這是穩定 ID、顯示標籤、功能列表、推薦範本用途和憑證金鑰名稱。
247
+ 2. **工作區連線:** Dispatch 或其他工作區設定介面通過 `@agent-native/core/workspace-connections` 存儲連線帳戶的安全元資料、狀態、範圍、`credentialRefs` 和應用程式授權。
248
+ 3. **應用程式本機來源:** Brain、Analytics、Mail 或其他應用程式僅存儲其擁有的特定於應用程式的選取,例如 Slack 通道、GitHub 儲存庫、HubSpot 物件過濾器、同步游標或輪詢節奏。
249
+
250
+ 不要在每個應用程式中重複 OAuth/權杖存儲。連線紀錄顯示“這是 Acme Slack,其代幣位於 `SLACK_BOT_TOKEN`”;應用程式本機訊息來源稱“Brain 可能會從該 Slack 連線中攝取 `#product` 和 `#dev-fusion`。”
251
+
252
+ ### 調度控制平面設定
253
+
254
+ Dispatch 公開了控制平面 actions,該控制平面編寫應用程式可以直接調用的相同共用存儲函數:
255
+
256
+ ```ts
257
+ // templates/dispatch/actions/upsert-workspace-connection.ts delegates to this.
258
+ await upsertWorkspaceConnection({
259
+ id: "team-slack",
260
+ provider: "slack",
261
+ label: "Acme Slack",
262
+ accountId: "T012345",
263
+ accountLabel: "acme",
264
+ status: "connected",
265
+ scopes: ["channels:history", "groups:history"],
266
+ config: { teamDomain: "acme", preferredChannels: ["product", "dev-fusion"] },
267
+ credentialRefs: [
268
+ {
269
+ key: "SLACK_BOT_TOKEN",
270
+ scope: "org",
271
+ provider: "slack",
272
+ label: "Slack bot token",
273
+ },
274
+ ],
275
+ });
276
+
277
+ // Then grant the apps that should reuse the provider.
278
+ await upsertWorkspaceConnectionGrant({
279
+ connectionId: "team-slack",
280
+ appId: "brain",
281
+ });
282
+ await upsertWorkspaceConnectionGrant({
283
+ connectionId: "team-slack",
284
+ appId: "analytics",
285
+ });
286
+ ```
287
+
288
+ 僅當連線應可供同一範圍內的每個應用程式使用時,才使用 `allowedApps: []`。優先選取用於正式環境設定的顯式授權行。
289
+
290
+ ### 憑證解析
291
+
292
+ 應用程式執行程式碼通過活動請求範圍中的保管庫解析來自授予的 `credentialRefs` 的憑證值。 Brain 的 `source-credentials.ts` 是目前的參考實現:它列出了提供者的工作區連線,檢查 `getWorkspaceConnectionAppAccess` 中的 `appId: "brain"`,合並連線級別和授予級別的憑證引用,並讀取第一個匹配的作用域保管庫機密。其他應用程式應遵循該形狀,而不是達到 `process.env`。
293
+
294
+ ## 設計筆記 {#design-notes}
295
+
296
+ <details>
297
+ <summary>閱讀器-“一次連線,到處使用”的推廣政策和路徑</summary>
298
+
299
+ ### 應用程式本機邊界
300
+
301
+ 共用連線和應用程式本機來源之間的邊界是有意的。如今可重用的是提供者身分、憑證引用解析、每個應用程式授權、提供者準備情況、安全帳戶元資料以及標準化的提供者-讀者合約。尚未通用的是大多數實時提供者 API 讀取、OAuth 流所有權、攝取游標、來源過濾器、同步節奏和域解釋。除非將讀取器實現顯式提升為共用,否則它們將保留在擁有工作流程的應用程式中。
302
+
303
+ 應用程式來源連線器不應讀取部署級環境變數作為使用者/組織來源憑證的後備。環境變數對於部署來說是全域的,並且不表達工作區授權。
304
+
305
+ 代理應遵循一個簡單的規則:如果使用者要求連線 Slack、GitHub、HubSpot、Gmail、Google Drive、Granola 或其他共用提供程序,請首先檢查工作區連線目錄。如果提供者是 `connected`,則使用它。如果是 `needs_grant`,請請求或執行應用程式授權。如果是 `needs_credentials`,請索要丟失的保管庫金鑰。僅當不存在可重用連線時才請求新的原始金鑰。
306
+
307
+ ### “一次連線,隨處使用”之路
308
+
309
+ 提供者目錄和贈款存儲是更廣泛的工作空間層的基礎:
310
+
311
+ - 共用提供者 ID 和功能名稱使範本保持一致。
312
+ - 工作區級別的清單可以顯示在 Brain、Mail、Analytics、Dispatch 和未來應用程式中設定了哪些提供程序。
313
+ - 連線行紀錄帳戶標籤、狀態、允許的應用、憑證引用和執行狀況檢查,而無需更改面向範本的提供程序 ID。
314
+ - 授予行讓工作區所有者連線一次,然後在工作區采用各個應用程式時啟用它們。
315
+ - 代理可以在應用程式之間路由工作,了解哪些提供者已連線以及哪些應用程式已獲得授權。
316
+ - 聯合搜尋可以請求具有 `search`、`docs`、`messages`、`meetings`、`crm` 或 `code` 功能的提供者,而不是對每個應用的連線器列表進行硬編碼。
317
+ - 特定於提供者的讀取器、OAuth 刷新流、攝取檢查點和應用程式擁有的資料模型可以稍後共用,但今天的工作區連線並不暗示它們。
318
+
319
+ 保持嚴格的邊界:提供者元資料可以安全地顯示;憑證值保留在保管庫中。
320
+
321
+ </details>
@@ -0,0 +1,175 @@
1
+ ---
2
+ title: "工作區治理"
3
+ description: "分支、CODEOWNERS、PR 審查以及 Dispatch 如何與 git 級治理一起處理執行時治理。"
4
+ ---
5
+
6
+ # 工作區治理
7
+
8
+ > **哪個工作區檔案?** 此頁面涵蓋 **治理** - 誰在一個儲存庫中的多個應用程式中審查、批準和擁有內容。對於工作空間*是什么*(定制層),請參閱 [Workspace](/docs/workspace);對於部署形狀(一個單一儲存庫,許多應用程式),請參閱 [Multi-App Workspaces](/docs/multi-app-workspace)。
9
+
10
+ 本指南涵蓋了執行代理本機工作區的操作方面 - 如何分支、誰審查什么、如何設定程式碼所有權以及 Dispatch 控制平面如何適應您的治理模型。
11
+
12
+ ```an-diagram title="兩個治理平面" summary="Git 管理程式碼; Dispatch 控制執行時。它們是互補的——不要將一個複製到另一個中。"
13
+ {
14
+ "html": "<div class=\"gov\"><div class=\"diagram-card\"><span class=\"diagram-pill accent\">Git 和 GitHub</span><strong>程式碼治理</strong><div class=\"gov-list\"><span class=\"diagram-pill\">CODEOWNERS</span><span class=\"diagram-pill\">branch protection</span><span class=\"diagram-pill\">PR 評審</span><span class=\"diagram-pill\">git log / blame</span></div></div><div class=\"diagram-pill diagram-muted\">+</div><div class=\"diagram-card\"><span class=\"diagram-pill accent\">Dispatch</span><strong>Runtime governance</strong><div class=\"gov-list\"><span class=\"diagram-pill\">vault secrets &amp; grants</span><span class=\"diagram-pill\">workspace resources</span><span class=\"diagram-pill\">agent profiles</span><span class=\"diagram-pill\">approvals &amp; audit</span></div></div></div>",
15
+ "css": ".gov{display:flex;align-items:center;gap:16px;flex-wrap:wrap}.gov .diagram-card{display:flex;flex-direction:column;gap:8px;padding:16px 18px;flex:1;min-width:240px}.gov .gov-list{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px}"
16
+ }
17
+ ```
18
+
19
+ ## 分支
20
+
21
+ ### 功能分支
22
+
23
+ 對所有工作使用短期功能分支:
24
+
25
+ ```
26
+ main ← production
27
+ ├── feat/mail-filters ← single-app change
28
+ ├── feat/core-oauth-refresh ← framework change
29
+ ├── fix/analytics-chart ← targeted bug fix
30
+ └── feat/vault-encryption ← dispatch/infra change
31
+ ```
32
+
33
+ **命名約定:**
34
+
35
+ - **單個應用程式更改:** `feat/<app>-<description>` 或 `fix/<app>-<description>` — 例如`feat/mail-thread-search`、`fix/calendar-recurrence-parse`
36
+ - **框架更改:** `feat/core-<description>` 或 `fix/core-<description>` — 例如`feat/core-polling-v2`
37
+ - **調度更改:** `feat/dispatch-<description>` — 例如`feat/dispatch-vault-policies`
38
+ - **跨應用程式更改:**如果框架更改需要範本更新,請在一個分支中執行這兩項操作,以便它們以原子方式發布
39
+
40
+ 保持分支短暫。長期存在的分支與主分支分離,並造成痛苦的合並——尤其是在多個團隊每天推送的單一儲存庫中。
41
+
42
+ ### 非開發人員分支
43
+
44
+ 並不是每個需要進行更改的人都對 git 感到滿意。 [Builder.io](https://www.builder.io) 支持可視化分支模型,可對應到底層的 git 分支 - 對於內容和副本更改、布局調整、設計迭代以及無需開發環境的 A/B 測試非常有用。
45
+
46
+ ## 程式碼所有權
47
+
48
+ 程式碼治理由儲存庫根目錄中的幾個檔案設定:
49
+
50
+ ```an-file-tree title="repo 中的治理設定"
51
+ {
52
+ "entries": [
53
+ { "path": ".github/CODEOWNERS", "note": "按變更路徑自動分配 reviewers" },
54
+ { "path": ".github/labeler.yml", "note": "按 app 自動給 PR 加標籤" },
55
+ { "path": "pnpm-workspace.yaml", "note": "Workspace 級別:寬範圍 review" },
56
+ { "path": "package.json", "note": "Workspace 級別:平台團隊負責" }
57
+ ]
58
+ }
59
+ ```
60
+
61
+ GitHub 的 CODEOWNERS 檔案會根據更改的檔案自動將審閱者分配給 PR。在儲存庫根目錄建立 `.github/CODEOWNERS`:
62
+
63
+ ```
64
+ # Framework core — affects every app; platform team reviews all changes
65
+ packages/core/ @your-org/platform-team
66
+
67
+ # 調度控制平面——秘密、整合、工作空間資源
68
+ templates/dispatch/ @your-org/platform-team
69
+
70
+ # 每個應用程式所有權 - 每個團隊都會審查自己的應用程式
71
+ templates/mail/ @your-org/mail-team
72
+ templates/analytics/ @your-org/analytics-team
73
+ templates/calendar/ @your-org/calendar-team
74
+ # ... add an entry per app
75
+
76
+ # 工作區級別設定 - 廣泛審查,因為它影響每個人
77
+ .github/ @your-org/platform-team
78
+ package.json @your-org/platform-team
79
+ pnpm-workspace.yaml @your-org/platform-team
80
+ ```
81
+
82
+ 關鍵提示:使用 GitHub 團隊 (`@org/team`),而不是個人。框架和調度更改應始終需要平台審查。請參閱 [GitHub CODEOWNERS docs](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners) 了解 glob 語法和多所有者模式。
83
+
84
+ 要啟用所需的審查:設定 → 分支 → `main` 的分支保護 → **在合並之前需要拉取請求** → **需要程式碼所有者的審查**。
85
+
86
+ ## 公關標籤
87
+
88
+ 通過應用使用 `.github/labeler.yml` 自動標記 PR(摘錄):
89
+
90
+ ```yaml
91
+ app:mail:
92
+ - changed-files:
93
+ - any-glob-to-any-file: templates/mail/**
94
+ app:analytics:
95
+ - changed-files:
96
+ - any-glob-to-any-file: templates/analytics/**
97
+ core:
98
+ - changed-files:
99
+ - any-glob-to-any-file: packages/core/**
100
+ ```
101
+
102
+ 然後新增 [actions/labeler](https://github.com/actions/labeler) 操作 - 請參閱該儲存庫的 README 以了解完整的工作流程 YAML。開啟或更新 PR 時,標籤會自動應用。
103
+
104
+ ## 公關審核指南
105
+
106
+ | 更改型別 | 誰評論 | 要注意什么 |
107
+ | ------------------------------------- | ------------------------------- | --------------------------------------------------- |
108
+ | **僅限應用程式** (`templates/<app>/`) | 擁有應用團隊 | 域正確性、操作模式 |
109
+ | **框架**(`packages/core/`) | 平台團隊 + 一個受影響的應用團隊 | 重大變更、性能、向後兼容性 |
110
+ | **架構遷移** | 平台團隊+高級工程師 | 資料安全、方言不可知論(SQLite + Postgres) |
111
+ | **Actions** | 所屬團隊 | Actions 都是代理工具 AND HTTP 端點 - 從兩個角度回顧 |
112
+ | **跨應用 A2A** | 兩個應用團隊 | 如果更改A2A介面,調用者需要知道 |
113
+ | **調度庫/資源** | 平台團隊 | 秘密存取、授予範圍、誰獲得什么 |
114
+
115
+ ### 並發代理工作
116
+
117
+ 代理本機工作區通常有多個 AI 代理同時在同一分支上工作。這是設計使然——代理共用一個分支並獨立推送。
118
+
119
+ ```an-callout
120
+ { "tone": "warning", "body": "**The later commit wins.** Two agents touching the same file won't conflict at commit time — the conflict surfaces at review. Run `pnpm run prep` (typecheck + test + format) before pushing, and don't revert changes you didn't make unless they're clearly broken." }
121
+ ```
122
+
123
+ 在此環境中審核 PR 時:
124
+
125
+ - **不要恢復您未進行的更改**除非它們明顯損壞
126
+ - **檔案可能會被同一 PR 中的多個代理修改** - 這是正常的
127
+ - **在推送之前執行 `pnpm run prep`**(型別檢查 + 測試 + 格式)以捕獲代理更改之間的整合問題
128
+ - **如果兩個代理接觸同一個檔案,**較晚的提交獲勝。衝突在審查時出現,而不是在提交時出現
129
+ - **修複 PR 中任何程式碼中的錯誤,**無論是哪個代理編寫的。 PR 會作為一個整體進行審核。
130
+
131
+ ## 調度作為治理
132
+
133
+ [Dispatch](/docs/dispatch) 應用程式是工作區的執行時控制平面。它通過執行時治理補充了 git 級治理:
134
+
135
+ | 關注 | Git 和 GitHub | 調度 |
136
+ | ---------------- | ----------------------- | ----------------------------------------- |
137
+ | 誰可以更改程式碼 | CODEOWNERS,分支保護 | — |
138
+ | 誰可以存取機密 | — | 保險櫃政策、撥款、請求工作流程 |
139
+ | 代理遵循哪些指示 | — | 全域工作區資源(AGENTS.md、說明、skills) |
140
+ | 共用哪些代理 | — | 工作區代理設定檔案 |
141
+ | 整合庫存 | — | 工作區連線和整合目錄 |
142
+ | 執行時變更批準 | — | 調度審批流程 |
143
+ | 審計跟蹤 | `git log` / `git blame` | Vault審核+調度審核記錄 |
144
+ | 訊息傳遞和路由 | — | Slack / Telegram 整合 |
145
+
146
+ **Git 處理程式碼治理。 Dispatch 處理執行時治理。** 不要嘗試在 Dispatch 內複製 git 工作流程,反之亦然。
147
+
148
+ Dispatch 管理:保管庫機密、可重用工作區連線、工作區資源(skills、說明、代理設定檔案、MCP 伺服器)、批準和審核記錄。公開應用路由設定(`workspaceApp.audience` / `publicPaths` / `protectedPaths`)請參見[Multi-App Workspaces — Public app routes](/docs/multi-app-workspace#deployment)。
149
+
150
+ 資源模型和規範路徑請參見[Workspace — Global resources](/docs/workspace#global-resources)。
151
+
152
+ ## 設定清單
153
+
154
+ 對於新工作區,執行 `npx @agent-native/core@latest create` 後:
155
+
156
+ **Git 和 GitHub:**
157
+
158
+ - [ ] 建立具有每個應用團隊所有權的 `.github/CODEOWNERS`
159
+ - [ ] 在 `main` 上啟用分支保護並進行必要的程式碼所有者審核
160
+ - [ ] 新增 `.github/labeler.yml` 以通過應用自動標記 PR
161
+ - [ ] 為每個應用和平台團隊建立 GitHub 團隊
162
+
163
+ **調度:**
164
+
165
+ - [ ] 將共用機密新增到保管庫(API 金鑰、OAuth 憑證等)
166
+ - [ ] 保留預設的所有應用保管庫策略或切換到手動按應用授予
167
+ - [ ] 同步保管庫機密以將其推送到應用程式
168
+ - [ ] 為共用提供者帳戶註冊可重用工作區連線,然後
169
+ 僅在需要時授予 Brain、Analytics、Mail 或 Dispatch 等應用程式
170
+ 該帳戶
171
+ - [ ] 通過資源頁面新增工作區範圍的 skills、護欄說明和品牌/公司參考資源。請參閱 [Workspace](/docs/workspace#global-resources) 了解完整的資源模型表和推薦的入門包。
172
+ - [ ] 設定審批策略和審批人電子郵件
173
+ - [ ] 設定 SendGrid(`SENDGRID_API_KEY`、`SENDGRID_FROM_EMAIL`)以獲取管理員通知
174
+ - [ ] 連線 Slack 或 Telegram 以進行工作區訊息傳遞
175
+ - [ ] 設定共用 MCP 伺服器 — 在 Dispatch 中新增 `mcp-servers/<name>.json` 工作區資源以用於所有應用程式或選定應用程式授權;使用 `mcp.config.json` 或 [MCP hub mode](/docs/mcp-clients#hub) 進行較低級別的部署