@agent-native/core 0.112.0 → 0.113.0

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 (490) hide show
  1. package/corpus/README.md +4 -2
  2. package/corpus/core/CHANGELOG.md +22 -0
  3. package/corpus/core/docs/AGENTS.md +7 -0
  4. package/corpus/core/docs/content/integrations.mdx +63 -2
  5. package/corpus/core/docs/design/provider-integration-authority.md +117 -0
  6. package/corpus/core/package.json +6 -1
  7. package/corpus/core/scripts/materialize-source-corpus.mjs +9 -2
  8. package/corpus/core/src/cli/atomic-json-file.ts +324 -0
  9. package/corpus/core/src/cli/claude-code-participant.ts +515 -0
  10. package/corpus/core/src/cli/code-agent-executor.ts +18 -10
  11. package/corpus/core/src/cli/code-agent-runs.concurrent-worker.ts +33 -0
  12. package/corpus/core/src/cli/code-agent-runs.ts +55 -62
  13. package/corpus/core/src/cli/codex-cli-participant.ts +496 -0
  14. package/corpus/core/src/cli/multi-frontier-runs.ts +1246 -135
  15. package/corpus/core/src/client/chat/ChatHistoryList.tsx +7 -404
  16. package/corpus/core/src/integrations/index.ts +10 -0
  17. package/corpus/core/src/integrations/slack-oauth.ts +1 -0
  18. package/corpus/core/src/integrations/webhook-delivery.ts +55 -0
  19. package/corpus/core/src/notifications/channels.ts +4 -10
  20. package/corpus/core/src/provider-api/actions/custom-provider-registration.ts +197 -0
  21. package/corpus/core/src/provider-api/actions/delete-staged-dataset.ts +3 -42
  22. package/corpus/core/src/provider-api/actions/list-staged-datasets.ts +3 -45
  23. package/corpus/core/src/provider-api/actions/provider-api-audit.ts +88 -0
  24. package/corpus/core/src/provider-api/actions/provider-api.ts +460 -0
  25. package/corpus/core/src/provider-api/actions/query-staged-dataset.ts +3 -140
  26. package/corpus/core/src/provider-api/actions/staged-datasets.ts +359 -0
  27. package/corpus/core/src/provider-api/gong.ts +108 -0
  28. package/corpus/core/src/scripts/docs/source-search.ts +2 -1
  29. package/corpus/core/src/server/google-oauth-credentials.ts +80 -3
  30. package/corpus/core/src/server/index.ts +6 -0
  31. package/corpus/core/src/styles/chat-history-list.css +1 -313
  32. package/corpus/core/src/templates/default/.agents/skills/actions/SKILL.md +32 -12
  33. package/corpus/core/src/templates/default/.agents/skills/agent-native-docs/SKILL.md +10 -0
  34. package/corpus/core/src/templates/default/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  35. package/corpus/core/src/templates/default/.agents/skills/integration-webhooks/SKILL.md +323 -0
  36. package/corpus/core/src/templates/default/.agents/skills/onboarding/SKILL.md +56 -0
  37. package/corpus/core/src/templates/default/.agents/skills/secrets/SKILL.md +273 -0
  38. package/corpus/core/src/templates/default/.agents/skills/self-modifying-code/SKILL.md +11 -2
  39. package/corpus/core/src/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  40. package/corpus/core/src/templates/default/AGENTS.md +25 -18
  41. package/corpus/core/src/templates/headless/.agents/skills/actions/SKILL.md +512 -0
  42. package/corpus/core/src/templates/headless/.agents/skills/agent-native-docs/SKILL.md +10 -0
  43. package/corpus/core/src/templates/headless/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  44. package/corpus/core/src/templates/headless/.agents/skills/integration-webhooks/SKILL.md +323 -0
  45. package/corpus/core/src/templates/headless/.agents/skills/secrets/SKILL.md +273 -0
  46. package/corpus/core/src/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  47. package/corpus/core/src/templates/headless/AGENTS.md +7 -0
  48. package/corpus/core/src/templates/workspace-core/.agents/skills/actions/SKILL.md +32 -12
  49. package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +10 -0
  50. package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  51. package/corpus/core/src/templates/workspace-core/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  52. package/corpus/core/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +11 -2
  53. package/corpus/core/src/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  54. package/corpus/core/src/templates/workspace-core/AGENTS.md +4 -0
  55. package/corpus/core/src/templates/workspace-root/AGENTS.md +4 -0
  56. package/corpus/templates/analytics/.agents/skills/actions/SKILL.md +32 -12
  57. package/corpus/templates/analytics/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  58. package/corpus/templates/analytics/.agents/skills/self-modifying-code/SKILL.md +11 -2
  59. package/corpus/templates/analytics/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  60. package/corpus/templates/analytics/actions/delete-staged-dataset.ts +3 -23
  61. package/corpus/templates/analytics/actions/list-staged-datasets.ts +3 -27
  62. package/corpus/templates/analytics/actions/provider-api-catalog.ts +16 -19
  63. package/corpus/templates/analytics/actions/provider-api-docs.ts +3 -5
  64. package/corpus/templates/analytics/actions/provider-api-request.ts +162 -185
  65. package/corpus/templates/analytics/actions/query-staged-dataset.ts +3 -47
  66. package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +52 -161
  67. package/corpus/templates/assets/.agents/skills/actions/SKILL.md +32 -12
  68. package/corpus/templates/assets/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  69. package/corpus/templates/assets/.agents/skills/self-modifying-code/SKILL.md +11 -2
  70. package/corpus/templates/assets/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  71. package/corpus/templates/assets/app/components/layout/Sidebar.tsx +63 -160
  72. package/corpus/templates/brain/.agents/skills/actions/SKILL.md +32 -12
  73. package/corpus/templates/brain/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  74. package/corpus/templates/brain/.agents/skills/self-modifying-code/SKILL.md +11 -2
  75. package/corpus/templates/brain/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  76. package/corpus/templates/brain/actions/_schemas.ts +13 -7
  77. package/corpus/templates/brain/actions/delete-staged-dataset.ts +3 -24
  78. package/corpus/templates/brain/actions/list-staged-datasets.ts +3 -28
  79. package/corpus/templates/brain/actions/provider-api-catalog.ts +5 -11
  80. package/corpus/templates/brain/actions/provider-api-docs.ts +3 -5
  81. package/corpus/templates/brain/actions/provider-api-request.ts +3 -37
  82. package/corpus/templates/brain/actions/query-staged-dataset.ts +3 -48
  83. package/corpus/templates/brain/actions/update-source.ts +5 -1
  84. package/corpus/templates/brain/app/components/layout/Sidebar.tsx +48 -154
  85. package/corpus/templates/brain/app/lib/brain.ts +55 -0
  86. package/corpus/templates/brain/app/lib/ingest-handoff.ts +35 -0
  87. package/corpus/templates/brain/changelog/2026-07-19-slack-backfills-can-now-join-configured-public-channels-befo.md +6 -0
  88. package/corpus/templates/brain/changelog/2026-07-19-slack-backfills-now-continue-across-the-configured-number-of.md +6 -0
  89. package/corpus/templates/brain/changelog/2026-07-19-slack-backfills-now-start-with-a-safe-four-week-window-and-r.md +6 -0
  90. package/corpus/templates/brain/server/lib/connectors.ts +53 -2
  91. package/corpus/templates/brain/server/lib/slack-channel-membership.ts +44 -0
  92. package/corpus/templates/brain/shared/slack-source-config.ts +60 -0
  93. package/corpus/templates/calendar/.agents/skills/actions/SKILL.md +32 -12
  94. package/corpus/templates/calendar/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  95. package/corpus/templates/calendar/.agents/skills/self-modifying-code/SKILL.md +11 -2
  96. package/corpus/templates/calendar/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  97. package/corpus/templates/calendar/actions/delete-staged-dataset.ts +3 -24
  98. package/corpus/templates/calendar/actions/list-staged-datasets.ts +3 -28
  99. package/corpus/templates/calendar/actions/provider-api-catalog.ts +5 -11
  100. package/corpus/templates/calendar/actions/provider-api-docs.ts +3 -5
  101. package/corpus/templates/calendar/actions/provider-api-request.ts +3 -37
  102. package/corpus/templates/calendar/actions/query-staged-dataset.ts +3 -48
  103. package/corpus/templates/calendar/server/handlers/gong.ts +6 -61
  104. package/corpus/templates/calendar/server/handlers/google-auth.ts +10 -8
  105. package/corpus/templates/calendar/server/lib/google-calendar.ts +7 -45
  106. package/corpus/templates/chat/.agents/skills/actions/SKILL.md +32 -12
  107. package/corpus/templates/chat/.agents/skills/agent-native-docs/SKILL.md +10 -0
  108. package/corpus/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  109. package/corpus/templates/chat/.agents/skills/self-modifying-code/SKILL.md +11 -2
  110. package/corpus/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  111. package/corpus/templates/chat/AGENTS.md +5 -2
  112. package/corpus/templates/chat/app/components/layout/Sidebar.tsx +51 -157
  113. package/corpus/templates/clips/.agents/skills/actions/SKILL.md +32 -12
  114. package/corpus/templates/clips/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  115. package/corpus/templates/clips/.agents/skills/self-modifying-code/SKILL.md +11 -2
  116. package/corpus/templates/clips/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  117. package/corpus/templates/clips/AGENTS.md +11 -0
  118. package/corpus/templates/clips/actions/export-to-brain.ts +505 -171
  119. package/corpus/templates/clips/changelog/2026-07-19-ready-clips-transcripts-can-be-backfilled-to-brain-for-a-bou.md +6 -0
  120. package/corpus/templates/clips/server/lib/calendar-event-meetings.ts +1 -1
  121. package/corpus/templates/clips/server/lib/google-calendar-client.ts +12 -22
  122. package/corpus/templates/clips/server/lib/google-calendar-oauth.ts +9 -6
  123. package/corpus/templates/clips/server/lib/slack-oauth.ts +12 -47
  124. package/corpus/templates/clips/server/routes/_agent-native/google/auth-url.get.ts +2 -6
  125. package/corpus/templates/clips/server/routes/api/auth/google-calendar.get.ts +4 -4
  126. package/corpus/templates/content/.agents/skills/actions/SKILL.md +32 -12
  127. package/corpus/templates/content/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  128. package/corpus/templates/content/.agents/skills/self-modifying-code/SKILL.md +11 -2
  129. package/corpus/templates/content/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  130. package/corpus/templates/content/actions/delete-staged-dataset.ts +3 -24
  131. package/corpus/templates/content/actions/list-staged-datasets.ts +3 -28
  132. package/corpus/templates/content/actions/provider-api-catalog.ts +5 -11
  133. package/corpus/templates/content/actions/provider-api-docs.ts +3 -5
  134. package/corpus/templates/content/actions/provider-api-request.ts +3 -37
  135. package/corpus/templates/content/actions/query-staged-dataset.ts +3 -48
  136. package/corpus/templates/design/.agents/skills/actions/SKILL.md +32 -12
  137. package/corpus/templates/design/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  138. package/corpus/templates/design/.agents/skills/self-modifying-code/SKILL.md +11 -2
  139. package/corpus/templates/design/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  140. package/corpus/templates/design/actions/delete-staged-dataset.ts +4 -23
  141. package/corpus/templates/design/actions/list-staged-datasets.ts +4 -27
  142. package/corpus/templates/design/actions/provider-api-catalog.ts +15 -18
  143. package/corpus/templates/design/actions/provider-api-docs.ts +57 -48
  144. package/corpus/templates/design/actions/provider-api-request.ts +140 -164
  145. package/corpus/templates/design/actions/query-staged-dataset.ts +4 -47
  146. package/corpus/templates/dispatch/.agents/skills/actions/SKILL.md +32 -12
  147. package/corpus/templates/dispatch/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  148. package/corpus/templates/dispatch/.agents/skills/self-modifying-code/SKILL.md +11 -2
  149. package/corpus/templates/dispatch/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  150. package/corpus/templates/dispatch/actions/delete-staged-dataset.ts +4 -23
  151. package/corpus/templates/dispatch/actions/list-staged-datasets.ts +4 -30
  152. package/corpus/templates/dispatch/actions/provider-api-catalog.ts +15 -18
  153. package/corpus/templates/dispatch/actions/provider-api-docs.ts +57 -48
  154. package/corpus/templates/dispatch/actions/provider-api-request.ts +138 -163
  155. package/corpus/templates/dispatch/actions/query-staged-dataset.ts +4 -47
  156. package/corpus/templates/forms/.agents/skills/actions/SKILL.md +32 -12
  157. package/corpus/templates/forms/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  158. package/corpus/templates/forms/.agents/skills/self-modifying-code/SKILL.md +11 -2
  159. package/corpus/templates/forms/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  160. package/corpus/templates/forms/server/lib/integrations.ts +23 -22
  161. package/corpus/templates/macros/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  162. package/corpus/templates/macros/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  163. package/corpus/templates/mail/.agents/skills/actions/SKILL.md +32 -12
  164. package/corpus/templates/mail/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  165. package/corpus/templates/mail/.agents/skills/self-modifying-code/SKILL.md +11 -2
  166. package/corpus/templates/mail/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  167. package/corpus/templates/mail/actions/delete-staged-dataset.ts +4 -23
  168. package/corpus/templates/mail/actions/list-staged-datasets.ts +4 -27
  169. package/corpus/templates/mail/actions/provider-api-catalog.ts +15 -18
  170. package/corpus/templates/mail/actions/provider-api-docs.ts +57 -48
  171. package/corpus/templates/mail/actions/provider-api-request.ts +146 -173
  172. package/corpus/templates/mail/actions/query-staged-dataset.ts +4 -47
  173. package/corpus/templates/mail/server/handlers/gong.ts +6 -61
  174. package/corpus/templates/mail/server/lib/google-auth.ts +10 -13
  175. package/corpus/templates/plan/.agents/skills/actions/SKILL.md +32 -12
  176. package/corpus/templates/plan/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  177. package/corpus/templates/plan/.agents/skills/self-modifying-code/SKILL.md +11 -2
  178. package/corpus/templates/plan/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  179. package/corpus/templates/plan/app/components/layout/Sidebar.tsx +47 -156
  180. package/corpus/templates/slides/.agents/skills/actions/SKILL.md +32 -12
  181. package/corpus/templates/slides/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  182. package/corpus/templates/slides/.agents/skills/self-modifying-code/SKILL.md +11 -2
  183. package/corpus/templates/slides/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  184. package/corpus/templates/slides/actions/delete-staged-dataset.ts +4 -23
  185. package/corpus/templates/slides/actions/list-staged-datasets.ts +4 -27
  186. package/corpus/templates/slides/actions/provider-api-catalog.ts +15 -18
  187. package/corpus/templates/slides/actions/provider-api-docs.ts +57 -48
  188. package/corpus/templates/slides/actions/provider-api-request.ts +145 -172
  189. package/corpus/templates/slides/actions/query-staged-dataset.ts +4 -47
  190. package/corpus/templates/slides/server/lib/google-docs-oauth.ts +11 -36
  191. package/corpus/templates/tasks/.agents/skills/actions/SKILL.md +32 -12
  192. package/corpus/templates/tasks/.agents/skills/agent-native-docs/SKILL.md +10 -0
  193. package/corpus/templates/tasks/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  194. package/corpus/templates/tasks/.agents/skills/self-modifying-code/SKILL.md +11 -2
  195. package/corpus/templates/tasks/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  196. package/corpus/toolkit/CHANGELOG.md +125 -0
  197. package/corpus/toolkit/README.md +60 -0
  198. package/corpus/toolkit/export-snapshot.json +35 -0
  199. package/corpus/toolkit/migration-manifest.json +4 -0
  200. package/corpus/toolkit/package.json +281 -0
  201. package/corpus/toolkit/scripts/finalize-build.mjs +55 -0
  202. package/corpus/toolkit/src/app-shell/header-actions.tsx +84 -0
  203. package/corpus/toolkit/src/app-shell/index.ts +1 -0
  204. package/corpus/toolkit/src/chat-history/ChatHistoryList.tsx +469 -0
  205. package/corpus/toolkit/src/chat-history/index.ts +7 -0
  206. package/corpus/toolkit/src/chat-history.css +314 -0
  207. package/corpus/toolkit/src/collab-ui/AgentPresenceChip.tsx +69 -0
  208. package/corpus/toolkit/src/collab-ui/LiveCursorOverlay.tsx +241 -0
  209. package/corpus/toolkit/src/collab-ui/PresenceBar.tsx +346 -0
  210. package/corpus/toolkit/src/collab-ui/RecentEditHighlights.tsx +225 -0
  211. package/corpus/toolkit/src/collab-ui/RemoteSelectionRings.tsx +227 -0
  212. package/corpus/toolkit/src/collab-ui/agent-identity.ts +16 -0
  213. package/corpus/toolkit/src/collab-ui/index.ts +39 -0
  214. package/corpus/toolkit/src/collab-ui/lead-client.ts +32 -0
  215. package/corpus/toolkit/src/collab-ui/types.ts +96 -0
  216. package/corpus/toolkit/src/composer/AgentComposerFrame.tsx +59 -0
  217. package/corpus/toolkit/src/composer/ComposerPlusMenu.tsx +983 -0
  218. package/corpus/toolkit/src/composer/MentionPopover.tsx +412 -0
  219. package/corpus/toolkit/src/composer/PastedTextChip.tsx +150 -0
  220. package/corpus/toolkit/src/composer/PromptComposer.tsx +718 -0
  221. package/corpus/toolkit/src/composer/RealtimeVoiceMode.tsx +856 -0
  222. package/corpus/toolkit/src/composer/TiptapComposer.tsx +2936 -0
  223. package/corpus/toolkit/src/composer/VoiceButton.tsx +255 -0
  224. package/corpus/toolkit/src/composer/asset-picker-url.ts +80 -0
  225. package/corpus/toolkit/src/composer/attachment-accept.ts +71 -0
  226. package/corpus/toolkit/src/composer/draft-key.ts +7 -0
  227. package/corpus/toolkit/src/composer/extensions/FileReference.tsx +55 -0
  228. package/corpus/toolkit/src/composer/extensions/MentionReference.tsx +93 -0
  229. package/corpus/toolkit/src/composer/extensions/SkillReference.tsx +56 -0
  230. package/corpus/toolkit/src/composer/index.ts +79 -0
  231. package/corpus/toolkit/src/composer/pasted-text.ts +160 -0
  232. package/corpus/toolkit/src/composer/prompt-attachments.ts +93 -0
  233. package/corpus/toolkit/src/composer/realtime-voice-audio-level.ts +64 -0
  234. package/corpus/toolkit/src/composer/realtime-voice-transcript.ts +134 -0
  235. package/corpus/toolkit/src/composer/runtime-adapters.tsx +343 -0
  236. package/corpus/toolkit/src/composer/types.ts +66 -0
  237. package/corpus/toolkit/src/composer/use-file-search.ts +64 -0
  238. package/corpus/toolkit/src/composer/use-mention-search.ts +90 -0
  239. package/corpus/toolkit/src/composer/use-skills.ts +45 -0
  240. package/corpus/toolkit/src/composer/useRealtimeVoiceMode.tsx +2117 -0
  241. package/corpus/toolkit/src/composer/useVoiceDictation.ts +1191 -0
  242. package/corpus/toolkit/src/context-ui/ContextMeter.tsx +101 -0
  243. package/corpus/toolkit/src/context-ui/ContextSegmentRow.tsx +184 -0
  244. package/corpus/toolkit/src/context-ui/ContextTreemap.tsx +125 -0
  245. package/corpus/toolkit/src/context-ui/ContextXRayPanel.tsx +377 -0
  246. package/corpus/toolkit/src/context-ui/format.ts +42 -0
  247. package/corpus/toolkit/src/context-ui/index.ts +15 -0
  248. package/corpus/toolkit/src/context-ui/types.ts +43 -0
  249. package/corpus/toolkit/src/design-tweaks/index.ts +1 -0
  250. package/corpus/toolkit/src/design-tweaks/visual-style-controls.tsx +1084 -0
  251. package/corpus/toolkit/src/editor/BubbleToolbar.tsx +253 -0
  252. package/corpus/toolkit/src/editor/CodeBlockNode.tsx +254 -0
  253. package/corpus/toolkit/src/editor/DragHandle.ts +1437 -0
  254. package/corpus/toolkit/src/editor/ImageExtension.ts +306 -0
  255. package/corpus/toolkit/src/editor/RegistryBlockContext.tsx +107 -0
  256. package/corpus/toolkit/src/editor/RegistryBlockNode.tsx +652 -0
  257. package/corpus/toolkit/src/editor/RichMarkdownEditor.tsx +81 -0
  258. package/corpus/toolkit/src/editor/RunId.ts +61 -0
  259. package/corpus/toolkit/src/editor/SharedRichEditor.tsx +321 -0
  260. package/corpus/toolkit/src/editor/SlashCommandMenu.tsx +310 -0
  261. package/corpus/toolkit/src/editor/extensions.ts +402 -0
  262. package/corpus/toolkit/src/editor/gfmDoc.ts +92 -0
  263. package/corpus/toolkit/src/editor/index.ts +93 -0
  264. package/corpus/toolkit/src/editor/registrySlashCommands.ts +131 -0
  265. package/corpus/toolkit/src/editor/surgical-apply.ts +192 -0
  266. package/corpus/toolkit/src/editor/useCollabReconcile.ts +589 -0
  267. package/corpus/toolkit/src/editor.css +510 -0
  268. package/corpus/toolkit/src/hooks/index.ts +2 -0
  269. package/corpus/toolkit/src/hooks/use-mobile.tsx +21 -0
  270. package/corpus/toolkit/src/hooks/use-toast.ts +188 -0
  271. package/corpus/toolkit/src/index.ts +8 -0
  272. package/corpus/toolkit/src/onboarding/index.ts +1 -0
  273. package/corpus/toolkit/src/provider.tsx +47 -0
  274. package/corpus/toolkit/src/sharing/VisibilityBadge.tsx +37 -0
  275. package/corpus/toolkit/src/sharing/index.ts +4 -0
  276. package/corpus/toolkit/src/styles.css +21 -0
  277. package/corpus/toolkit/src/ui/accordion.tsx +56 -0
  278. package/corpus/toolkit/src/ui/alert-dialog.tsx +141 -0
  279. package/corpus/toolkit/src/ui/alert.tsx +59 -0
  280. package/corpus/toolkit/src/ui/aspect-ratio.tsx +5 -0
  281. package/corpus/toolkit/src/ui/avatar.tsx +48 -0
  282. package/corpus/toolkit/src/ui/badge.tsx +37 -0
  283. package/corpus/toolkit/src/ui/breadcrumb.tsx +115 -0
  284. package/corpus/toolkit/src/ui/button.tsx +78 -0
  285. package/corpus/toolkit/src/ui/calendar.tsx +214 -0
  286. package/corpus/toolkit/src/ui/card.tsx +86 -0
  287. package/corpus/toolkit/src/ui/carousel.tsx +260 -0
  288. package/corpus/toolkit/src/ui/chart.tsx +375 -0
  289. package/corpus/toolkit/src/ui/checkbox.tsx +28 -0
  290. package/corpus/toolkit/src/ui/collapsible.tsx +9 -0
  291. package/corpus/toolkit/src/ui/command.tsx +174 -0
  292. package/corpus/toolkit/src/ui/context-menu.tsx +202 -0
  293. package/corpus/toolkit/src/ui/date-picker.tsx +64 -0
  294. package/corpus/toolkit/src/ui/dialog.tsx +146 -0
  295. package/corpus/toolkit/src/ui/drawer.tsx +126 -0
  296. package/corpus/toolkit/src/ui/dropdown-menu.tsx +218 -0
  297. package/corpus/toolkit/src/ui/form.tsx +177 -0
  298. package/corpus/toolkit/src/ui/hover-card.tsx +27 -0
  299. package/corpus/toolkit/src/ui/index.ts +52 -0
  300. package/corpus/toolkit/src/ui/input-otp.tsx +69 -0
  301. package/corpus/toolkit/src/ui/input.tsx +22 -0
  302. package/corpus/toolkit/src/ui/label.tsx +24 -0
  303. package/corpus/toolkit/src/ui/logo.tsx +36 -0
  304. package/corpus/toolkit/src/ui/menubar.tsx +235 -0
  305. package/corpus/toolkit/src/ui/navigation-menu.tsx +128 -0
  306. package/corpus/toolkit/src/ui/pagination.tsx +121 -0
  307. package/corpus/toolkit/src/ui/popover.tsx +44 -0
  308. package/corpus/toolkit/src/ui/progress.tsx +26 -0
  309. package/corpus/toolkit/src/ui/radio-group.tsx +42 -0
  310. package/corpus/toolkit/src/ui/resizable.tsx +43 -0
  311. package/corpus/toolkit/src/ui/scroll-area.tsx +46 -0
  312. package/corpus/toolkit/src/ui/select.tsx +158 -0
  313. package/corpus/toolkit/src/ui/separator.tsx +29 -0
  314. package/corpus/toolkit/src/ui/sheet.tsx +160 -0
  315. package/corpus/toolkit/src/ui/sidebar.tsx +777 -0
  316. package/corpus/toolkit/src/ui/skeleton.tsx +18 -0
  317. package/corpus/toolkit/src/ui/slider.tsx +26 -0
  318. package/corpus/toolkit/src/ui/sonner.tsx +58 -0
  319. package/corpus/toolkit/src/ui/spinner.tsx +17 -0
  320. package/corpus/toolkit/src/ui/switch.tsx +27 -0
  321. package/corpus/toolkit/src/ui/table.tsx +117 -0
  322. package/corpus/toolkit/src/ui/tabs.tsx +53 -0
  323. package/corpus/toolkit/src/ui/textarea.tsx +23 -0
  324. package/corpus/toolkit/src/ui/toast.tsx +127 -0
  325. package/corpus/toolkit/src/ui/toaster.tsx +33 -0
  326. package/corpus/toolkit/src/ui/toggle-group.tsx +59 -0
  327. package/corpus/toolkit/src/ui/toggle.tsx +43 -0
  328. package/corpus/toolkit/src/ui/tooltip.tsx +53 -0
  329. package/corpus/toolkit/src/ui/use-toast.ts +3 -0
  330. package/corpus/toolkit/src/utils.ts +8 -0
  331. package/corpus/toolkit/tsconfig.json +23 -0
  332. package/dist/cli/atomic-json-file.d.ts +30 -0
  333. package/dist/cli/atomic-json-file.d.ts.map +1 -0
  334. package/dist/cli/atomic-json-file.js +240 -0
  335. package/dist/cli/atomic-json-file.js.map +1 -0
  336. package/dist/cli/claude-code-participant.d.ts +77 -0
  337. package/dist/cli/claude-code-participant.d.ts.map +1 -0
  338. package/dist/cli/claude-code-participant.js +355 -0
  339. package/dist/cli/claude-code-participant.js.map +1 -0
  340. package/dist/cli/code-agent-executor.d.ts.map +1 -1
  341. package/dist/cli/code-agent-executor.js +18 -10
  342. package/dist/cli/code-agent-executor.js.map +1 -1
  343. package/dist/cli/code-agent-runs.concurrent-worker.d.ts +2 -0
  344. package/dist/cli/code-agent-runs.concurrent-worker.d.ts.map +1 -0
  345. package/dist/cli/code-agent-runs.concurrent-worker.js +32 -0
  346. package/dist/cli/code-agent-runs.concurrent-worker.js.map +1 -0
  347. package/dist/cli/code-agent-runs.d.ts.map +1 -1
  348. package/dist/cli/code-agent-runs.js +43 -56
  349. package/dist/cli/code-agent-runs.js.map +1 -1
  350. package/dist/cli/codex-cli-participant.d.ts +77 -0
  351. package/dist/cli/codex-cli-participant.d.ts.map +1 -0
  352. package/dist/cli/codex-cli-participant.js +354 -0
  353. package/dist/cli/codex-cli-participant.js.map +1 -0
  354. package/dist/cli/multi-frontier-runs.d.ts +115 -0
  355. package/dist/cli/multi-frontier-runs.d.ts.map +1 -1
  356. package/dist/cli/multi-frontier-runs.js +831 -113
  357. package/dist/cli/multi-frontier-runs.js.map +1 -1
  358. package/dist/client/chat/ChatHistoryList.d.ts +1 -87
  359. package/dist/client/chat/ChatHistoryList.d.ts.map +1 -1
  360. package/dist/client/chat/ChatHistoryList.js +1 -82
  361. package/dist/client/chat/ChatHistoryList.js.map +1 -1
  362. package/dist/integrations/index.d.ts +2 -1
  363. package/dist/integrations/index.d.ts.map +1 -1
  364. package/dist/integrations/index.js +2 -1
  365. package/dist/integrations/index.js.map +1 -1
  366. package/dist/integrations/slack-manifest.d.ts +1 -1
  367. package/dist/integrations/slack-oauth.d.ts +1 -1
  368. package/dist/integrations/slack-oauth.d.ts.map +1 -1
  369. package/dist/integrations/slack-oauth.js +1 -0
  370. package/dist/integrations/slack-oauth.js.map +1 -1
  371. package/dist/integrations/webhook-delivery.d.ts +23 -0
  372. package/dist/integrations/webhook-delivery.d.ts.map +1 -0
  373. package/dist/integrations/webhook-delivery.js +32 -0
  374. package/dist/integrations/webhook-delivery.js.map +1 -0
  375. package/dist/notifications/channels.d.ts.map +1 -1
  376. package/dist/notifications/channels.js +4 -9
  377. package/dist/notifications/channels.js.map +1 -1
  378. package/dist/notifications/routes.d.ts +3 -3
  379. package/dist/provider-api/actions/custom-provider-registration.d.ts +136 -0
  380. package/dist/provider-api/actions/custom-provider-registration.d.ts.map +1 -0
  381. package/dist/provider-api/actions/custom-provider-registration.js +154 -0
  382. package/dist/provider-api/actions/custom-provider-registration.js.map +1 -0
  383. package/dist/provider-api/actions/delete-staged-dataset.d.ts +1 -1
  384. package/dist/provider-api/actions/delete-staged-dataset.d.ts.map +1 -1
  385. package/dist/provider-api/actions/delete-staged-dataset.js +3 -34
  386. package/dist/provider-api/actions/delete-staged-dataset.js.map +1 -1
  387. package/dist/provider-api/actions/list-staged-datasets.d.ts +2 -3
  388. package/dist/provider-api/actions/list-staged-datasets.d.ts.map +1 -1
  389. package/dist/provider-api/actions/list-staged-datasets.js +3 -40
  390. package/dist/provider-api/actions/list-staged-datasets.js.map +1 -1
  391. package/dist/provider-api/actions/provider-api-audit.d.ts +7 -0
  392. package/dist/provider-api/actions/provider-api-audit.d.ts.map +1 -0
  393. package/dist/provider-api/actions/provider-api-audit.js +74 -0
  394. package/dist/provider-api/actions/provider-api-audit.js.map +1 -0
  395. package/dist/provider-api/actions/provider-api.d.ts +370 -0
  396. package/dist/provider-api/actions/provider-api.d.ts.map +1 -0
  397. package/dist/provider-api/actions/provider-api.js +280 -0
  398. package/dist/provider-api/actions/provider-api.js.map +1 -0
  399. package/dist/provider-api/actions/query-staged-dataset.d.ts +1 -1
  400. package/dist/provider-api/actions/query-staged-dataset.d.ts.map +1 -1
  401. package/dist/provider-api/actions/query-staged-dataset.js +3 -116
  402. package/dist/provider-api/actions/query-staged-dataset.js.map +1 -1
  403. package/dist/provider-api/actions/staged-datasets.d.ts +190 -0
  404. package/dist/provider-api/actions/staged-datasets.d.ts.map +1 -0
  405. package/dist/provider-api/actions/staged-datasets.js +210 -0
  406. package/dist/provider-api/actions/staged-datasets.js.map +1 -0
  407. package/dist/provider-api/gong.d.ts +44 -0
  408. package/dist/provider-api/gong.d.ts.map +1 -0
  409. package/dist/provider-api/gong.js +56 -0
  410. package/dist/provider-api/gong.js.map +1 -0
  411. package/dist/scripts/docs/source-search.d.ts +2 -1
  412. package/dist/scripts/docs/source-search.d.ts.map +1 -1
  413. package/dist/scripts/docs/source-search.js +2 -1
  414. package/dist/scripts/docs/source-search.js.map +1 -1
  415. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  416. package/dist/server/google-oauth-credentials.d.ts +35 -0
  417. package/dist/server/google-oauth-credentials.d.ts.map +1 -1
  418. package/dist/server/google-oauth-credentials.js +48 -2
  419. package/dist/server/google-oauth-credentials.js.map +1 -1
  420. package/dist/server/index.d.ts +1 -1
  421. package/dist/server/index.d.ts.map +1 -1
  422. package/dist/server/index.js +1 -1
  423. package/dist/server/index.js.map +1 -1
  424. package/dist/styles/chat-history-list.css +1 -313
  425. package/dist/templates/chat/.agents/skills/actions/SKILL.md +32 -12
  426. package/dist/templates/chat/.agents/skills/agent-native-docs/SKILL.md +10 -0
  427. package/dist/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  428. package/dist/templates/chat/.agents/skills/self-modifying-code/SKILL.md +11 -2
  429. package/dist/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  430. package/dist/templates/chat/AGENTS.md +5 -2
  431. package/dist/templates/chat/app/components/layout/Sidebar.tsx +51 -157
  432. package/dist/templates/default/.agents/skills/actions/SKILL.md +32 -12
  433. package/dist/templates/default/.agents/skills/agent-native-docs/SKILL.md +10 -0
  434. package/dist/templates/default/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  435. package/dist/templates/default/.agents/skills/integration-webhooks/SKILL.md +323 -0
  436. package/dist/templates/default/.agents/skills/onboarding/SKILL.md +56 -0
  437. package/dist/templates/default/.agents/skills/secrets/SKILL.md +273 -0
  438. package/dist/templates/default/.agents/skills/self-modifying-code/SKILL.md +11 -2
  439. package/dist/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  440. package/dist/templates/default/AGENTS.md +25 -18
  441. package/dist/templates/headless/.agents/skills/actions/SKILL.md +512 -0
  442. package/dist/templates/headless/.agents/skills/agent-native-docs/SKILL.md +10 -0
  443. package/dist/templates/headless/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  444. package/dist/templates/headless/.agents/skills/integration-webhooks/SKILL.md +323 -0
  445. package/dist/templates/headless/.agents/skills/secrets/SKILL.md +273 -0
  446. package/dist/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  447. package/dist/templates/headless/AGENTS.md +7 -0
  448. package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +32 -12
  449. package/dist/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +10 -0
  450. package/dist/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  451. package/dist/templates/workspace-core/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  452. package/dist/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +11 -2
  453. package/dist/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  454. package/dist/templates/workspace-core/AGENTS.md +4 -0
  455. package/dist/templates/workspace-root/AGENTS.md +4 -0
  456. package/docs/AGENTS.md +7 -0
  457. package/docs/content/integrations.mdx +63 -2
  458. package/docs/design/provider-integration-authority.md +117 -0
  459. package/package.json +7 -2
  460. package/src/templates/chat/.agents/skills/actions/SKILL.md +32 -12
  461. package/src/templates/chat/.agents/skills/agent-native-docs/SKILL.md +10 -0
  462. package/src/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  463. package/src/templates/chat/.agents/skills/self-modifying-code/SKILL.md +11 -2
  464. package/src/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  465. package/src/templates/chat/AGENTS.md +5 -2
  466. package/src/templates/chat/app/components/layout/Sidebar.tsx +51 -157
  467. package/src/templates/default/.agents/skills/actions/SKILL.md +32 -12
  468. package/src/templates/default/.agents/skills/agent-native-docs/SKILL.md +10 -0
  469. package/src/templates/default/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  470. package/src/templates/default/.agents/skills/integration-webhooks/SKILL.md +323 -0
  471. package/src/templates/default/.agents/skills/onboarding/SKILL.md +56 -0
  472. package/src/templates/default/.agents/skills/secrets/SKILL.md +273 -0
  473. package/src/templates/default/.agents/skills/self-modifying-code/SKILL.md +11 -2
  474. package/src/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  475. package/src/templates/default/AGENTS.md +25 -18
  476. package/src/templates/headless/.agents/skills/actions/SKILL.md +512 -0
  477. package/src/templates/headless/.agents/skills/agent-native-docs/SKILL.md +10 -0
  478. package/src/templates/headless/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  479. package/src/templates/headless/.agents/skills/integration-webhooks/SKILL.md +323 -0
  480. package/src/templates/headless/.agents/skills/secrets/SKILL.md +273 -0
  481. package/src/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  482. package/src/templates/headless/AGENTS.md +7 -0
  483. package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +32 -12
  484. package/src/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +10 -0
  485. package/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  486. package/src/templates/workspace-core/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  487. package/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +11 -2
  488. package/src/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  489. package/src/templates/workspace-core/AGENTS.md +4 -0
  490. package/src/templates/workspace-root/AGENTS.md +4 -0
@@ -0,0 +1,359 @@
1
+ import { z, type ZodTypeAny } from "zod";
2
+
3
+ import { defineAction, type ActionHttpConfig } from "../../action.js";
4
+ import { getCredentialContext } from "../../server/request-context.js";
5
+ import { runAggregateQuery } from "../staged-datasets-aggregate.js";
6
+ import {
7
+ deleteStagedDataset,
8
+ getStagedDatasetMeta,
9
+ getStagedDatasetRows,
10
+ listStagedDatasets,
11
+ } from "../staged-datasets-store.js";
12
+
13
+ const WhereSchema = z.object({
14
+ column: z.string().min(1),
15
+ op: z.enum([
16
+ "equals",
17
+ "not_equals",
18
+ "contains",
19
+ "not_contains",
20
+ "gt",
21
+ "gte",
22
+ "lt",
23
+ "lte",
24
+ "exists",
25
+ "not_exists",
26
+ ]),
27
+ value: z.unknown().optional(),
28
+ });
29
+
30
+ const AggregateFieldSchema = z.object({
31
+ column: z.string().min(1).describe("Column to aggregate."),
32
+ op: z
33
+ .enum(["sum", "avg", "count", "min", "max", "count_distinct"])
34
+ .describe("Aggregation function."),
35
+ as: z
36
+ .string()
37
+ .optional()
38
+ .describe("Output column name. Default: {op}_{column}."),
39
+ });
40
+
41
+ export function createQueryStagedDatasetSchema(
42
+ options: {
43
+ includeAppId?: boolean;
44
+ } = {},
45
+ ) {
46
+ const shape = {
47
+ datasetId: z
48
+ .string()
49
+ .min(1)
50
+ .describe(
51
+ "Dataset id returned by provider-api-request when stageAs was set, or from list-staged-datasets.",
52
+ ),
53
+ where: z
54
+ .array(WhereSchema)
55
+ .optional()
56
+ .describe(
57
+ "Optional row-level filters. All clauses must match (AND). Ops: equals, not_equals, contains, not_contains, gt, gte, lt, lte, exists, not_exists.",
58
+ ),
59
+ groupBy: z
60
+ .array(z.string().min(1))
61
+ .optional()
62
+ .describe(
63
+ "Column(s) to group by. Omit for a single aggregate over all rows.",
64
+ ),
65
+ aggregate: z
66
+ .array(AggregateFieldSchema)
67
+ .optional()
68
+ .describe(
69
+ "Aggregation fields. When omitted, rows are returned as-is after filters and projection.",
70
+ ),
71
+ select: z
72
+ .array(z.string().min(1))
73
+ .optional()
74
+ .describe("Column projection when aggregate is empty."),
75
+ orderBy: z.string().optional().describe("Sort output by this column."),
76
+ orderDir: z
77
+ .enum(["asc", "desc"])
78
+ .optional()
79
+ .describe("Sort direction (default asc)."),
80
+ limit: z.coerce
81
+ .number()
82
+ .int()
83
+ .min(1)
84
+ .max(10_000)
85
+ .optional()
86
+ .describe("Maximum rows to return (default all, max 10000)."),
87
+ };
88
+ return options.includeAppId
89
+ ? z.object({
90
+ ...shape,
91
+ appId: z.string().min(1).describe("App id that owns the dataset."),
92
+ })
93
+ : z.object(shape);
94
+ }
95
+
96
+ export function createListStagedDatasetsSchema(
97
+ options: {
98
+ includeAppId?: boolean;
99
+ } = {},
100
+ ) {
101
+ return options.includeAppId
102
+ ? z.object({
103
+ appId: z.string().min(1).describe("App id that owns the datasets."),
104
+ })
105
+ : z.object({});
106
+ }
107
+
108
+ export function createDeleteStagedDatasetSchema(
109
+ options: {
110
+ includeAppId?: boolean;
111
+ } = {},
112
+ ) {
113
+ const shape = {
114
+ datasetId: z
115
+ .string()
116
+ .min(1)
117
+ .describe("Dataset id to delete (from list-staged-datasets)."),
118
+ };
119
+ return options.includeAppId
120
+ ? z.object({
121
+ ...shape,
122
+ appId: z.string().min(1).describe("App id that owns the dataset."),
123
+ })
124
+ : z.object(shape);
125
+ }
126
+
127
+ type StagedActionArgs = {
128
+ appId?: string;
129
+ datasetId?: string;
130
+ where?: Array<{
131
+ column: string;
132
+ op:
133
+ | "equals"
134
+ | "not_equals"
135
+ | "contains"
136
+ | "not_contains"
137
+ | "gt"
138
+ | "gte"
139
+ | "lt"
140
+ | "lte"
141
+ | "exists"
142
+ | "not_exists";
143
+ value?: unknown;
144
+ }>;
145
+ groupBy?: string[];
146
+ aggregate?: Array<{
147
+ column: string;
148
+ op: "sum" | "avg" | "count" | "min" | "max" | "count_distinct";
149
+ as?: string;
150
+ }>;
151
+ select?: string[];
152
+ orderBy?: string;
153
+ orderDir?: "asc" | "desc";
154
+ limit?: number;
155
+ };
156
+
157
+ export interface StagedDatasetActionRuntime {
158
+ getMeta: typeof getStagedDatasetMeta;
159
+ getRows: typeof getStagedDatasetRows;
160
+ list: typeof listStagedDatasets;
161
+ delete: typeof deleteStagedDataset;
162
+ aggregate: typeof runAggregateQuery;
163
+ }
164
+
165
+ const defaultRuntime: StagedDatasetActionRuntime = {
166
+ getMeta: getStagedDatasetMeta,
167
+ getRows: getStagedDatasetRows,
168
+ list: listStagedDatasets,
169
+ delete: deleteStagedDataset,
170
+ aggregate: runAggregateQuery,
171
+ };
172
+
173
+ interface StagedDatasetActionBaseOptions<TSchema extends ZodTypeAny> {
174
+ appId?: string;
175
+ schema?: TSchema;
176
+ description?: string;
177
+ http?: ActionHttpConfig | false;
178
+ getOwnerEmail?: () => string | null;
179
+ runtime?: StagedDatasetActionRuntime;
180
+ }
181
+
182
+ function resolveScope(
183
+ actionName: string,
184
+ args: StagedActionArgs,
185
+ options: Pick<
186
+ StagedDatasetActionBaseOptions<ZodTypeAny>,
187
+ "appId" | "getOwnerEmail"
188
+ >,
189
+ ) {
190
+ const appId = options.appId ?? args.appId;
191
+ if (!appId) throw new Error(`No app id for ${actionName}.`);
192
+ const ownerEmail = options.getOwnerEmail
193
+ ? options.getOwnerEmail()
194
+ : (getCredentialContext()?.userEmail ?? null);
195
+ if (!ownerEmail)
196
+ throw new Error(`No authenticated context for ${actionName}.`);
197
+ return { appId, ownerEmail };
198
+ }
199
+
200
+ export type CreateQueryStagedDatasetActionOptions<
201
+ TSchema extends ZodTypeAny = ReturnType<
202
+ typeof createQueryStagedDatasetSchema
203
+ >,
204
+ > = StagedDatasetActionBaseOptions<TSchema>;
205
+
206
+ export function createQueryStagedDatasetAction<
207
+ TSchema extends ZodTypeAny = ReturnType<
208
+ typeof createQueryStagedDatasetSchema
209
+ >,
210
+ >(options: CreateQueryStagedDatasetActionOptions<TSchema> = {}) {
211
+ const schema =
212
+ options.schema ??
213
+ createQueryStagedDatasetSchema({ includeAppId: !options.appId });
214
+ const runtime = options.runtime ?? defaultRuntime;
215
+ return defineAction({
216
+ description:
217
+ options.description ??
218
+ "Run a filter, aggregate, or projection query over a staged dataset stored by provider-api-request. Aggregation runs in-process and remains database-portable.",
219
+ schema,
220
+ http: options.http ?? false,
221
+ readOnly: true,
222
+ run: async (rawArgs) => {
223
+ const args = rawArgs as StagedActionArgs;
224
+ const scope = resolveScope("query-staged-dataset", args, options);
225
+ const datasetId = String(args.datasetId ?? "");
226
+ const meta = await runtime.getMeta({ id: datasetId, ...scope });
227
+ if (!meta) {
228
+ throw new Error(
229
+ `Dataset ${datasetId} not found (or belongs to a different owner/app).`,
230
+ );
231
+ }
232
+ const rows = await runtime.getRows({ id: datasetId, ...scope });
233
+ const result = runtime.aggregate(rows, {
234
+ where: args.where,
235
+ groupBy: args.groupBy,
236
+ aggregate: args.aggregate,
237
+ select: args.select,
238
+ orderBy: args.orderBy,
239
+ orderDir: args.orderDir,
240
+ limit: args.limit,
241
+ });
242
+ return {
243
+ dataset: { id: meta.id, name: meta.name, totalRows: meta.rowCount },
244
+ rowCount: result.length,
245
+ rows: result,
246
+ };
247
+ },
248
+ });
249
+ }
250
+
251
+ export type CreateListStagedDatasetsActionOptions<
252
+ TSchema extends ZodTypeAny = ReturnType<
253
+ typeof createListStagedDatasetsSchema
254
+ >,
255
+ > = StagedDatasetActionBaseOptions<TSchema>;
256
+
257
+ export function createListStagedDatasetsAction<
258
+ TSchema extends ZodTypeAny = ReturnType<
259
+ typeof createListStagedDatasetsSchema
260
+ >,
261
+ >(options: CreateListStagedDatasetsActionOptions<TSchema> = {}) {
262
+ const schema =
263
+ options.schema ??
264
+ createListStagedDatasetsSchema({ includeAppId: !options.appId });
265
+ const runtime = options.runtime ?? defaultRuntime;
266
+ return defineAction({
267
+ description:
268
+ options.description ??
269
+ "List staged datasets stored by provider-api-request for the current user and app.",
270
+ schema,
271
+ http: options.http ?? { method: "GET" },
272
+ readOnly: true,
273
+ run: async (rawArgs) => {
274
+ const args = rawArgs as StagedActionArgs;
275
+ const scope = resolveScope("list-staged-datasets", args, options);
276
+ const datasets = await runtime.list(scope);
277
+ return {
278
+ datasets: datasets.map((dataset) => ({
279
+ id: dataset.id,
280
+ name: dataset.name,
281
+ rowCount: dataset.rowCount,
282
+ columns: dataset.columns,
283
+ byteSize: dataset.byteSize,
284
+ updatedAt: new Date(dataset.updatedAt).toISOString(),
285
+ })),
286
+ total: datasets.length,
287
+ };
288
+ },
289
+ });
290
+ }
291
+
292
+ export type CreateDeleteStagedDatasetActionOptions<
293
+ TSchema extends ZodTypeAny = ReturnType<
294
+ typeof createDeleteStagedDatasetSchema
295
+ >,
296
+ > = StagedDatasetActionBaseOptions<TSchema>;
297
+
298
+ export function createDeleteStagedDatasetAction<
299
+ TSchema extends ZodTypeAny = ReturnType<
300
+ typeof createDeleteStagedDatasetSchema
301
+ >,
302
+ >(options: CreateDeleteStagedDatasetActionOptions<TSchema> = {}) {
303
+ const schema =
304
+ options.schema ??
305
+ createDeleteStagedDatasetSchema({ includeAppId: !options.appId });
306
+ const runtime = options.runtime ?? defaultRuntime;
307
+ return defineAction({
308
+ description:
309
+ options.description ??
310
+ "Delete a staged dataset by id, freeing its scratch storage. Only the owner who staged the dataset can delete it.",
311
+ schema,
312
+ http: options.http ?? false,
313
+ run: async (rawArgs) => {
314
+ const args = rawArgs as StagedActionArgs;
315
+ const scope = resolveScope("delete-staged-dataset", args, options);
316
+ const datasetId = String(args.datasetId ?? "");
317
+ const deleted = await runtime.delete({ id: datasetId, ...scope });
318
+ if (!deleted) {
319
+ throw new Error(
320
+ `Dataset ${datasetId} not found (or belongs to a different owner/app).`,
321
+ );
322
+ }
323
+ return { deleted: true, datasetId };
324
+ },
325
+ });
326
+ }
327
+
328
+ export interface CreateStagedDatasetActionsOptions {
329
+ appId?: string;
330
+ getOwnerEmail?: () => string | null;
331
+ runtime?: StagedDatasetActionRuntime;
332
+ query?: Omit<
333
+ CreateQueryStagedDatasetActionOptions,
334
+ "appId" | "getOwnerEmail" | "runtime"
335
+ >;
336
+ list?: Omit<
337
+ CreateListStagedDatasetsActionOptions,
338
+ "appId" | "getOwnerEmail" | "runtime"
339
+ >;
340
+ delete?: Omit<
341
+ CreateDeleteStagedDatasetActionOptions,
342
+ "appId" | "getOwnerEmail" | "runtime"
343
+ >;
344
+ }
345
+
346
+ export function createStagedDatasetActions(
347
+ options: CreateStagedDatasetActionsOptions = {},
348
+ ) {
349
+ const shared = {
350
+ appId: options.appId,
351
+ getOwnerEmail: options.getOwnerEmail,
352
+ runtime: options.runtime,
353
+ };
354
+ return {
355
+ query: createQueryStagedDatasetAction({ ...shared, ...options.query }),
356
+ list: createListStagedDatasetsAction({ ...shared, ...options.list }),
357
+ delete: createDeleteStagedDatasetAction({ ...shared, ...options.delete }),
358
+ };
359
+ }
@@ -0,0 +1,108 @@
1
+ export interface GongCallParty {
2
+ name?: string;
3
+ emailAddress?: string;
4
+ [key: string]: unknown;
5
+ }
6
+
7
+ export interface GongCallRecord {
8
+ id?: string;
9
+ title?: string;
10
+ started?: string;
11
+ duration?: number;
12
+ direction?: string;
13
+ parties?: GongCallParty[];
14
+ [key: string]: unknown;
15
+ }
16
+
17
+ export interface GongCallSummary {
18
+ id?: string;
19
+ title?: string;
20
+ started?: string;
21
+ duration?: number;
22
+ direction?: string;
23
+ parties: Array<{ name?: string; email?: string }>;
24
+ }
25
+
26
+ export function filterGongCallsByEmail(
27
+ calls: readonly GongCallRecord[],
28
+ email: string,
29
+ limit = 10,
30
+ ): GongCallSummary[] {
31
+ const normalizedEmail = email.toLowerCase();
32
+ return calls
33
+ .filter((call) =>
34
+ (call.parties ?? []).some(
35
+ (party) => party.emailAddress?.toLowerCase() === normalizedEmail,
36
+ ),
37
+ )
38
+ .slice(0, limit)
39
+ .map((call) => ({
40
+ id: call.id,
41
+ title: call.title,
42
+ started: call.started,
43
+ duration: call.duration,
44
+ direction: call.direction,
45
+ parties: (call.parties ?? []).map((party) => ({
46
+ name: party.name,
47
+ email: party.emailAddress,
48
+ })),
49
+ }));
50
+ }
51
+
52
+ export interface LookupGongCallsByEmailOptions {
53
+ credential: string;
54
+ email: string;
55
+ lookbackDays?: number;
56
+ limit?: number;
57
+ now?: number;
58
+ fetch?: typeof globalThis.fetch;
59
+ }
60
+
61
+ export type GongCallsLookupResult =
62
+ | { ok: true; calls: GongCallSummary[] }
63
+ | { ok: false; status: number; error: string };
64
+
65
+ export async function lookupGongCallsByEmail(
66
+ options: LookupGongCallsByEmailOptions,
67
+ ): Promise<GongCallsLookupResult> {
68
+ const fetchImpl = options.fetch ?? globalThis.fetch;
69
+ const lookbackDays = options.lookbackDays ?? 90;
70
+ const fromDateTime = new Date(
71
+ (options.now ?? Date.now()) - lookbackDays * 24 * 60 * 60 * 1000,
72
+ ).toISOString();
73
+ const url = `https://api.gong.io/v2/calls?fromDateTime=${fromDateTime}`;
74
+ const authHeaders = [
75
+ `Bearer ${options.credential}`,
76
+ `Basic ${Buffer.from(options.credential).toString("base64")}`,
77
+ ];
78
+
79
+ try {
80
+ let firstStatus = 502;
81
+ for (const [index, authorization] of authHeaders.entries()) {
82
+ const response = await fetchImpl(url, {
83
+ headers: {
84
+ Authorization: authorization,
85
+ "Content-Type": "application/json",
86
+ },
87
+ });
88
+ if (index === 0) firstStatus = response.status;
89
+ if (!response.ok) continue;
90
+ const data = (await response.json()) as { calls?: GongCallRecord[] };
91
+ return {
92
+ ok: true,
93
+ calls: filterGongCallsByEmail(
94
+ data.calls ?? [],
95
+ options.email,
96
+ options.limit,
97
+ ),
98
+ };
99
+ }
100
+ return {
101
+ ok: false,
102
+ status: firstStatus,
103
+ error: `Gong API error: ${firstStatus}`,
104
+ };
105
+ } catch {
106
+ return { ok: false, status: 500, error: "Failed to reach Gong API" };
107
+ }
108
+ }
@@ -1,11 +1,12 @@
1
1
  /**
2
2
  * Core script: source-search
3
3
  *
4
- * Search and read the packaged Agent Native source corpus.
4
+ * Search and read the packaged Agent Native Core, Toolkit, and template corpus.
5
5
  * The corpus is generated into @agent-native/core/corpus during package build.
6
6
  *
7
7
  * Usage:
8
8
  * pnpm action source-search --query "defineAction"
9
+ * pnpm action source-search --path toolkit/src/index.ts
9
10
  * pnpm action source-search --path templates/plan/AGENTS.md
10
11
  * pnpm action source-search --list
11
12
  */
@@ -3,6 +3,30 @@ export interface GoogleOAuthCredentials {
3
3
  clientSecret: string;
4
4
  }
5
5
 
6
+ export interface GoogleOAuthCredentialKeyPair {
7
+ clientIdKey: string;
8
+ clientSecretKey: string;
9
+ }
10
+
11
+ export type ReadGoogleOAuthCredential = (
12
+ key: string,
13
+ ) => string | null | undefined | Promise<string | null | undefined>;
14
+
15
+ export const GOOGLE_PRIMARY_PROVIDER_CREDENTIAL_KEYS = {
16
+ clientIdKey: "GOOGLE_CLIENT_ID",
17
+ clientSecretKey: "GOOGLE_CLIENT_SECRET",
18
+ } as const satisfies GoogleOAuthCredentialKeyPair;
19
+
20
+ export const GOOGLE_LEGACY_PROVIDER_CREDENTIAL_KEYS = {
21
+ clientIdKey: "GOOGLE_LEGACY_CLIENT_ID",
22
+ clientSecretKey: "GOOGLE_LEGACY_CLIENT_SECRET",
23
+ } as const satisfies GoogleOAuthCredentialKeyPair;
24
+
25
+ export const GOOGLE_PROVIDER_CREDENTIAL_KEY_PAIRS = [
26
+ GOOGLE_PRIMARY_PROVIDER_CREDENTIAL_KEYS,
27
+ GOOGLE_LEGACY_PROVIDER_CREDENTIAL_KEYS,
28
+ ] as const satisfies readonly GoogleOAuthCredentialKeyPair[];
29
+
6
30
  function readCredentialPair(
7
31
  clientIdKey: string,
8
32
  clientSecretKey: string,
@@ -13,6 +37,56 @@ function readCredentialPair(
13
37
  return { clientId, clientSecret };
14
38
  }
15
39
 
40
+ async function readInjectedCredentialPair(
41
+ readCredential: ReadGoogleOAuthCredential,
42
+ keys: GoogleOAuthCredentialKeyPair,
43
+ ): Promise<GoogleOAuthCredentials | null> {
44
+ const [clientId, clientSecret] = await Promise.all([
45
+ readCredential(keys.clientIdKey),
46
+ readCredential(keys.clientSecretKey),
47
+ ]);
48
+ if (!clientId || !clientSecret) return null;
49
+ return { clientId, clientSecret };
50
+ }
51
+
52
+ /**
53
+ * Resolve Google provider credentials from an app-owned credential source.
54
+ *
55
+ * Templates pass their scoped secret reader so Core does not choose an app's
56
+ * secret store or request context. An optional fallback reader preserves
57
+ * deployments that still keep the same credential pair in environment vars.
58
+ * Each candidate pair is read atomically and de-duped by client id, which lets
59
+ * refresh paths retry tokens minted by a previous Google OAuth client without
60
+ * ever mixing an id and secret from different sources.
61
+ */
62
+ export async function resolveGoogleProviderCredentialCandidatesWithReader(options: {
63
+ readCredential: ReadGoogleOAuthCredential;
64
+ fallbackReadCredential?: ReadGoogleOAuthCredential;
65
+ credentialKeyPairs?: readonly GoogleOAuthCredentialKeyPair[];
66
+ }): Promise<GoogleOAuthCredentials[]> {
67
+ const pairs =
68
+ options.credentialKeyPairs ?? GOOGLE_PROVIDER_CREDENTIAL_KEY_PAIRS;
69
+ const candidates: GoogleOAuthCredentials[] = [];
70
+
71
+ for (const keys of pairs) {
72
+ const credentials =
73
+ (await readInjectedCredentialPair(options.readCredential, keys)) ??
74
+ (options.fallbackReadCredential
75
+ ? await readInjectedCredentialPair(options.fallbackReadCredential, keys)
76
+ : null);
77
+ if (
78
+ credentials &&
79
+ !candidates.some(
80
+ (candidate) => candidate.clientId === credentials.clientId,
81
+ )
82
+ ) {
83
+ candidates.push(credentials);
84
+ }
85
+ }
86
+
87
+ return candidates;
88
+ }
89
+
16
90
  /**
17
91
  * Credentials for identity-only Google sign-in. Deploys that also use Google
18
92
  * product APIs can set these separately from GOOGLE_CLIENT_ID/SECRET, which
@@ -32,13 +106,16 @@ export function hasGoogleSignInCredentials(): boolean {
32
106
  }
33
107
 
34
108
  export function resolveGoogleProviderCredentials(): GoogleOAuthCredentials | null {
35
- return readCredentialPair("GOOGLE_CLIENT_ID", "GOOGLE_CLIENT_SECRET");
109
+ return readCredentialPair(
110
+ GOOGLE_PRIMARY_PROVIDER_CREDENTIAL_KEYS.clientIdKey,
111
+ GOOGLE_PRIMARY_PROVIDER_CREDENTIAL_KEYS.clientSecretKey,
112
+ );
36
113
  }
37
114
 
38
115
  export function resolveGoogleLegacyProviderCredentials(): GoogleOAuthCredentials | null {
39
116
  return readCredentialPair(
40
- "GOOGLE_LEGACY_CLIENT_ID",
41
- "GOOGLE_LEGACY_CLIENT_SECRET",
117
+ GOOGLE_LEGACY_PROVIDER_CREDENTIAL_KEYS.clientIdKey,
118
+ GOOGLE_LEGACY_PROVIDER_CREDENTIAL_KEYS.clientSecretKey,
42
119
  );
43
120
  }
44
121
 
@@ -303,11 +303,17 @@ export {
303
303
  export { isOAuthConnected, getOAuthAccounts } from "./oauth-helpers.js";
304
304
  export {
305
305
  hasGoogleSignInCredentials,
306
+ GOOGLE_LEGACY_PROVIDER_CREDENTIAL_KEYS,
307
+ GOOGLE_PRIMARY_PROVIDER_CREDENTIAL_KEYS,
308
+ GOOGLE_PROVIDER_CREDENTIAL_KEY_PAIRS,
306
309
  resolveGoogleLegacyProviderCredentials,
310
+ resolveGoogleProviderCredentialCandidatesWithReader,
307
311
  resolveGoogleProviderCredentialCandidates,
308
312
  resolveGoogleProviderCredentials,
309
313
  resolveGoogleSignInCredentials,
314
+ type GoogleOAuthCredentialKeyPair,
310
315
  type GoogleOAuthCredentials,
316
+ type ReadGoogleOAuthCredential,
311
317
  } from "./google-oauth-credentials.js";
312
318
  export { wrapWithAnalytics } from "./analytics.js";
313
319
  export {