eve 0.26.2 → 0.27.1

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 (185) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/src/channel/resolve-active-session.d.ts +4 -0
  3. package/dist/src/channel/resolve-active-session.js +1 -0
  4. package/dist/src/channel/routes.d.ts +11 -0
  5. package/dist/src/cli/dev/tui/vercel-trusted-sources-policy.d.ts +1 -1
  6. package/dist/src/cli/dev/tui/vercel-trusted-sources.js +1 -1
  7. package/dist/src/compiled/.vendor-stamp.json +16 -16
  8. package/dist/src/compiled/@ai-sdk/anthropic/index.js +2 -2
  9. package/dist/src/compiled/@ai-sdk/google/index.d.ts +9 -2
  10. package/dist/src/compiled/@ai-sdk/google/index.js +6 -6
  11. package/dist/src/compiled/@ai-sdk/mcp/index.d.ts +18 -3
  12. package/dist/src/compiled/@ai-sdk/mcp/index.js +1 -1
  13. package/dist/src/compiled/@ai-sdk/openai/index.d.ts +285 -24
  14. package/dist/src/compiled/@ai-sdk/openai/index.js +2 -2
  15. package/dist/src/compiled/@ai-sdk/otel/index.js +1 -1
  16. package/dist/src/compiled/@ai-sdk/provider-utils/index.d.ts +7 -3
  17. package/dist/src/compiled/@vercel/oidc/index.js +28 -2
  18. package/dist/src/compiled/@vercel/sandbox/api-client/api-client.d.ts +11 -0
  19. package/dist/src/compiled/@vercel/sandbox/api-client/validators.d.ts +7 -0
  20. package/dist/src/compiled/@vercel/sandbox/command.d.ts +8 -0
  21. package/dist/src/compiled/@vercel/sandbox/execution-context.d.ts +116 -0
  22. package/dist/src/compiled/@vercel/sandbox/index.d.ts +3 -1
  23. package/dist/src/compiled/@vercel/sandbox/index.js +20 -19
  24. package/dist/src/compiled/@vercel/sandbox/network-policy.d.ts +13 -5
  25. package/dist/src/compiled/@vercel/sandbox/sandbox-user.d.ts +212 -0
  26. package/dist/src/compiled/@vercel/sandbox/sandbox.d.ts +133 -2
  27. package/dist/src/compiled/@vercel/sandbox/session.d.ts +2 -1
  28. package/dist/src/compiled/@vercel/sandbox/snapshot.d.ts +1 -1
  29. package/dist/src/compiled/@workflow/core/create-hook.d.ts +41 -22
  30. package/dist/src/compiled/@workflow/core/flushable-stream.d.ts +29 -0
  31. package/dist/src/compiled/@workflow/core/global.d.ts +2 -0
  32. package/dist/src/compiled/@workflow/core/index.js +2 -2
  33. package/dist/src/compiled/@workflow/core/private.d.ts +6 -17
  34. package/dist/src/compiled/@workflow/core/private.js +1 -1
  35. package/dist/src/compiled/@workflow/core/replay-payload-cache.d.ts +56 -0
  36. package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +11 -0
  37. package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +6 -4
  38. package/dist/src/compiled/@workflow/core/runtime/resume-hook.d.ts +4 -1
  39. package/dist/src/compiled/@workflow/core/runtime/step-executor.d.ts +39 -0
  40. package/dist/src/compiled/@workflow/core/runtime.js +3 -3
  41. package/dist/src/compiled/@workflow/core/serialization.d.ts +44 -4
  42. package/dist/src/compiled/@workflow/core/symbols.d.ts +13 -0
  43. package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
  44. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  45. package/dist/src/compiled/@workflow/errors/error-codes.d.ts +2 -0
  46. package/dist/src/compiled/@workflow/errors/index.d.ts +14 -0
  47. package/dist/src/compiled/@workflow/errors/index.js +1 -1
  48. package/dist/src/compiled/@workflow/world/events.d.ts +15 -0
  49. package/dist/src/compiled/@workflow/world/hooks.d.ts +2 -1
  50. package/dist/src/compiled/@workflow/world/interfaces.d.ts +77 -4
  51. package/dist/src/compiled/@workflow/world-local/index.js +4 -4
  52. package/dist/src/compiled/@workflow/world-vercel/index.js +16 -16
  53. package/dist/src/compiled/_chunks/node/{auth-BuQkq4Gr.js → auth-l7F2PF2b.js} +2 -2
  54. package/dist/src/compiled/_chunks/node/{version-DD-FX9rK.js → version-CjHTLx2a.js} +1 -1
  55. package/dist/src/compiled/_chunks/node/virtual-loader-Cwgujv7l.js +1 -0
  56. package/dist/src/compiled/_chunks/workflow/attribute-changes-Dk1fP6vt.js +20 -0
  57. package/dist/src/compiled/_chunks/workflow/{chunk-BHKSVoKr.js → chunk-BTyA9uPd.js} +1 -1
  58. package/dist/src/compiled/_chunks/workflow/dist-B3qkUnLJ.js +3 -0
  59. package/dist/src/compiled/_chunks/workflow/{dist-CSfKNxQW.js → dist-BX517Nmz.js} +2 -2
  60. package/dist/src/compiled/_chunks/workflow/{dist-zLevmMyU.js → dist-C_VDTghO.js} +10 -10
  61. package/dist/src/compiled/_chunks/workflow/{dist-CttsoN4D.js → dist-CrxV2rsR.js} +1 -1
  62. package/dist/src/compiled/_chunks/workflow/{functions-PT9ri9Hu.js → functions-Dv8dc_-I.js} +1 -1
  63. package/dist/src/compiled/_chunks/workflow/resume-hook-czpG5xnP.js +1 -0
  64. package/dist/src/compiled/_chunks/workflow/run-6zaMjFY6.js +1 -0
  65. package/dist/src/compiled/_chunks/workflow/sleep-B2u06FWc.js +1 -0
  66. package/dist/src/compiled/_chunks/workflow/{src-CQuMexnO.js → src-D1EltLDA.js} +1 -1
  67. package/dist/src/compiled/_chunks/workflow/{token-CaY0nA5J.js → token-Cz223z3C.js} +1 -1
  68. package/dist/src/compiled/_chunks/workflow/token-DWqA5-DA.js +1 -0
  69. package/dist/src/compiled/_chunks/workflow/token-util-B6qBs3-0.js +27 -0
  70. package/dist/src/compiled/_chunks/workflow/{undici-fb54XL8i.js → undici-C2ZhYnV9.js} +1 -1
  71. package/dist/src/compiled/_chunks/workflow/wrapper-Cc2otuUR.js +6 -0
  72. package/dist/src/compiled/env-runner/index.js +1 -1
  73. package/dist/src/compiled/env-runner/node-worker.js +1 -1
  74. package/dist/src/compiled/eventsource-parser/stream/index.d.ts +16 -3
  75. package/dist/src/compiled/jose/index.js +1 -1
  76. package/dist/src/compiler/compile-from-memory.d.ts +5 -0
  77. package/dist/src/compiler/compile-from-memory.js +1 -1
  78. package/dist/src/compiler/extension-compatibility.d.ts +10 -10
  79. package/dist/src/compiler/extension-compatibility.js +1 -1
  80. package/dist/src/execution/deliver-payloads.d.ts +1 -1
  81. package/dist/src/execution/deliver-payloads.js +1 -1
  82. package/dist/src/execution/workflow-entry.js +1 -1
  83. package/dist/src/execution/workflow-steps.js +1 -1
  84. package/dist/src/harness/compaction-prompt.d.ts +19 -1
  85. package/dist/src/harness/compaction-prompt.js +7 -5
  86. package/dist/src/harness/compaction.d.ts +4 -11
  87. package/dist/src/harness/compaction.js +1 -1
  88. package/dist/src/harness/prompt-cache.d.ts +16 -5
  89. package/dist/src/harness/prompt-cache.js +1 -1
  90. package/dist/src/harness/session-limit-continuation.d.ts +8 -0
  91. package/dist/src/harness/session-limit-continuation.js +1 -1
  92. package/dist/src/harness/session-limit-enforcement.d.ts +9 -6
  93. package/dist/src/harness/session-limit-enforcement.js +1 -1
  94. package/dist/src/harness/stale-input-responses.d.ts +21 -3
  95. package/dist/src/harness/stale-input-responses.js +2 -2
  96. package/dist/src/harness/token-estimate.d.ts +9 -0
  97. package/dist/src/harness/token-estimate.js +1 -0
  98. package/dist/src/harness/tool-loop.js +2 -2
  99. package/dist/src/harness/turn-cancellation.d.ts +13 -0
  100. package/dist/src/harness/turn-cancellation.js +1 -1
  101. package/dist/src/internal/application/package.js +1 -1
  102. package/dist/src/internal/nitro/host/copy-host-middleware.js +1 -1
  103. package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
  104. package/dist/src/internal/workflow-bundle/vercel-workflow-output.js +1 -1
  105. package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.8/node_modules/@vercel/sdk/esm/models/updateprojectblock.js +1 -0
  106. package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.8/node_modules/@vercel/sdk/esm/models/updateprojectprojectsbranchmatcher.js +1 -0
  107. package/dist/src/packages/eve-catalog/src/index.js +1 -1
  108. package/dist/src/public/channels/auth.d.ts +59 -9
  109. package/dist/src/public/channels/auth.js +1 -1
  110. package/dist/src/public/channels/discord/defaults.js +1 -1
  111. package/dist/src/public/channels/linear/api.d.ts +2 -0
  112. package/dist/src/public/channels/linear/api.js +3 -1
  113. package/dist/src/public/channels/linear/defaults.js +2 -2
  114. package/dist/src/public/channels/linear/hitl.d.ts +8 -13
  115. package/dist/src/public/channels/linear/hitl.js +3 -3
  116. package/dist/src/public/channels/linear/index.d.ts +1 -1
  117. package/dist/src/public/channels/linear/index.js +1 -1
  118. package/dist/src/public/channels/linear/linearChannel.js +1 -1
  119. package/dist/src/public/channels/slack/api.d.ts +20 -0
  120. package/dist/src/public/channels/slack/api.js +1 -1
  121. package/dist/src/public/channels/slack/defaults.js +1 -1
  122. package/dist/src/public/channels/slack/inbound.d.ts +31 -0
  123. package/dist/src/public/channels/slack/inbound.js +1 -1
  124. package/dist/src/public/channels/slack/index.d.ts +2 -2
  125. package/dist/src/public/channels/slack/slackChannel.d.ts +72 -4
  126. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  127. package/dist/src/public/channels/teams/defaults.js +2 -2
  128. package/dist/src/public/channels/teams/index.d.ts +1 -1
  129. package/dist/src/public/channels/teams/teamsChannel.d.ts +7 -2
  130. package/dist/src/public/channels/teams/teamsChannel.js +1 -1
  131. package/dist/src/public/channels/telegram/defaults.js +1 -1
  132. package/dist/src/public/definitions/channel.d.ts +1 -1
  133. package/dist/src/public/next/index.js +1 -1
  134. package/dist/src/public/nuxt/index.d.ts +1 -1
  135. package/dist/src/public/nuxt/index.js +1 -1
  136. package/dist/src/public/nuxt/module.d.ts +10 -24
  137. package/dist/src/public/nuxt/module.js +1 -1
  138. package/dist/src/public/nuxt/routing.d.ts +5 -39
  139. package/dist/src/public/nuxt/routing.js +1 -1
  140. package/dist/src/public/nuxt/vercel-services.d.ts +117 -0
  141. package/dist/src/public/nuxt/vercel-services.js +1 -0
  142. package/dist/src/runtime/framework-tools/connection-search-dynamic.js +2 -1
  143. package/dist/src/runtime/framework-tools/todo.js +1 -1
  144. package/dist/src/runtime/governance/auth/http-basic.js +1 -1
  145. package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
  146. package/dist/src/setup/scaffold/create/project.js +2 -2
  147. package/dist/src/setup/scaffold/create/web-template.d.ts +1 -1
  148. package/dist/src/setup/scaffold/create/web-template.js +90 -5
  149. package/dist/src/setup/scaffold/update/channels.js +2 -2
  150. package/dist/src/setup/scaffold/update/connections.js +1 -1
  151. package/dist/src/{public/next → shared}/resolve-eve-binary.d.ts +1 -1
  152. package/docs/agent-config.md +10 -5
  153. package/docs/channels/slack.mdx +76 -10
  154. package/docs/channels/teams.mdx +10 -3
  155. package/docs/extensions.md +115 -77
  156. package/docs/guides/auth-and-route-protection.md +14 -1
  157. package/docs/guides/deployment/vercel.mdx +1 -1
  158. package/docs/guides/frontend/nuxt.mdx +22 -1
  159. package/docs/guides/frontend/overview.mdx +2 -0
  160. package/docs/meta.json +1 -0
  161. package/package.json +22 -22
  162. package/dist/src/compiled/@workflow/core/step-hydration-cache.d.ts +0 -148
  163. package/dist/src/compiled/_chunks/node/virtual-loader-B8K8w9cr.js +0 -1
  164. package/dist/src/compiled/_chunks/workflow/attribute-changes-CXiYB8h9.js +0 -20
  165. package/dist/src/compiled/_chunks/workflow/dist-BYo8Gno2.js +0 -3
  166. package/dist/src/compiled/_chunks/workflow/resume-hook-CHXbXuRZ.js +0 -1
  167. package/dist/src/compiled/_chunks/workflow/run-BjtAGa3_.js +0 -1
  168. package/dist/src/compiled/_chunks/workflow/sleep-BJAv0MFP.js +0 -1
  169. package/dist/src/compiled/_chunks/workflow/token-D4VIwGlD.js +0 -1
  170. package/dist/src/compiled/_chunks/workflow/wrapper-ulTvoTdW.js +0 -6
  171. package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.1/node_modules/@vercel/sdk/esm/models/updateprojectprojectsaction.js +0 -1
  172. package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.1/node_modules/@vercel/sdk/esm/models/updateprojectprojectsoptionsallowlist.js +0 -1
  173. package/dist/src/public/nuxt/vercel-json.d.ts +0 -17
  174. package/dist/src/public/nuxt/vercel-json.js +0 -1
  175. /package/dist/src/node_modules/.pnpm/{@vercel_sdk@1.28.1 → @vercel_sdk@1.28.8}/node_modules/@vercel/sdk/esm/lib/primitives.js +0 -0
  176. /package/dist/src/node_modules/.pnpm/{@vercel_sdk@1.28.1 → @vercel_sdk@1.28.8}/node_modules/@vercel/sdk/esm/lib/schemas.js +0 -0
  177. /package/dist/src/node_modules/.pnpm/{@vercel_sdk@1.28.1 → @vercel_sdk@1.28.8}/node_modules/@vercel/sdk/esm/models/aclaction.js +0 -0
  178. /package/dist/src/node_modules/.pnpm/{@vercel_sdk@1.28.1 → @vercel_sdk@1.28.8}/node_modules/@vercel/sdk/esm/models/sdkvalidationerror.js +0 -0
  179. /package/dist/src/node_modules/.pnpm/{@vercel_sdk@1.28.1 → @vercel_sdk@1.28.8}/node_modules/@vercel/sdk/esm/types/defaultToZeroValue.js +0 -0
  180. /package/dist/src/node_modules/.pnpm/{@vercel_sdk@1.28.1 → @vercel_sdk@1.28.8}/node_modules/@vercel/sdk/esm/types/fp.js +0 -0
  181. /package/dist/src/node_modules/.pnpm/{@vercel_sdk@1.28.1 → @vercel_sdk@1.28.8}/node_modules/@vercel/sdk/esm/types/primitives.js +0 -0
  182. /package/dist/src/node_modules/.pnpm/{@vercel_sdk@1.28.1 → @vercel_sdk@1.28.8}/node_modules/@vercel/sdk/esm/types/rfcdate.js +0 -0
  183. /package/dist/src/node_modules/.pnpm/{@vercel_sdk@1.28.1 → @vercel_sdk@1.28.8}/node_modules/@vercel/sdk/esm/types/smartUnion.js +0 -0
  184. /package/dist/src/node_modules/.pnpm/{@vercel_sdk@1.28.1 → @vercel_sdk@1.28.8}/node_modules/@vercel/sdk/esm/types/unrecognized.js +0 -0
  185. /package/dist/src/{public/next → shared}/resolve-eve-binary.js +0 -0
@@ -0,0 +1 @@
1
+ import{anyType,arrayType,booleanType,lazyType,literalType,nativeEnumType,nullableType,numberType,objectType,recordType,stringType,unionType}from"../../../../../../zod@4.4.3/node_modules/zod/v3/types.js";import"../../../../../../zod@4.4.3/node_modules/zod/v3/index.js";import{remap}from"../lib/primitives.js";import"../lib/schemas.js";import{boolean,literal,nullable,number,optional,string}from"../types/primitives.js";import{smartUnion}from"../types/smartUnion.js";const UpdateProjectFramework={Container:`container`,Blitzjs:`blitzjs`,Nextjs:`nextjs`,Gatsby:`gatsby`,Remix:`remix`,ReactRouter:`react-router`,Astro:`astro`,Hexo:`hexo`,Eleventy:`eleventy`,Docusaurus2:`docusaurus-2`,Docusaurus:`docusaurus`,Preact:`preact`,Solidstart1:`solidstart-1`,Solidstart:`solidstart`,Dojo:`dojo`,Ember:`ember`,Vue:`vue`,Scully:`scully`,IonicAngular:`ionic-angular`,Angular:`angular`,Polymer:`polymer`,Svelte:`svelte`,Sveltekit:`sveltekit`,Sveltekit1:`sveltekit-1`,IonicReact:`ionic-react`,CreateReactApp:`create-react-app`,Gridsome:`gridsome`,Umijs:`umijs`,Sapper:`sapper`,Saber:`saber`,Stencil:`stencil`,Nuxtjs:`nuxtjs`,Redwoodjs:`redwoodjs`,Hugo:`hugo`,Jekyll:`jekyll`,Brunch:`brunch`,Middleman:`middleman`,Zola:`zola`,Hydrogen:`hydrogen`,Vite:`vite`,TanstackStart:`tanstack-start`,Vitepress:`vitepress`,Vuepress:`vuepress`,Parcel:`parcel`,Fastapi:`fastapi`,Flask:`flask`,Fasthtml:`fasthtml`,Django:`django`,Ash:`ash`,Eve:`eve`,Sanity:`sanity`,SanityV2:`sanity-v2`,Storybook:`storybook`,Nitro:`nitro`,Hono:`hono`,Express:`express`,H3:`h3`,Koa:`koa`,Nestjs:`nestjs`,Elysia:`elysia`,Fastify:`fastify`,Xmcp:`xmcp`,Python:`python`,Ruby:`ruby`,Rust:`rust`,Axum:`axum`,ActixWeb:`actix-web`,Bun:`bun`,Node:`node`,Go:`go`,Services:`services`,Mastra:`mastra`},UpdateProjectNodeVersion={TwentyFourDotX:`24.x`,TwentyTwoDotX:`22.x`,TwentyDotX:`20.x`,EighteenDotX:`18.x`,SixteenDotX:`16.x`,FourteenDotX:`14.x`,TwelveDotX:`12.x`,TenDotX:`10.x`},UpdateProjectBuildMachineType={Enhanced:`enhanced`,Turbo:`turbo`,Standard:`standard`,Elastic:`elastic`},UpdateProjectConfiguration={SkipNamespaceQueue:`SKIP_NAMESPACE_QUEUE`,WaitForNamespaceQueue:`WAIT_FOR_NAMESPACE_QUEUE`},UpdateProjectFunctionDefaultMemoryType={StandardLegacy:`standard_legacy`,Standard:`standard`,Performance:`performance`,PerformanceXl:`performance_xl`},UpdateProjectBuildMachineSelection={Elastic:`elastic`,Fixed:`fixed`},UpdateProjectBuildMachineElasticReason={OomFailure:`oom-failure`,EnospcFailure:`enospc-failure`,BuildTimeoutFailure:`build-timeout-failure`,HighPeakMemory:`high-peak-memory`,SustainedHighCpu:`sustained-high-cpu`,HighPeakDisk:`high-peak-disk`,LongBuildDuration:`long-build-duration`,ShortBuildDuration:`short-build-duration`,EnterpriseFloor:`enterprise-floor`},UpdateProjectEnv={Production:`production`,Preview:`preview`},Destination={Internal:`internal`,External:`external`},UpdateProjectIssuerMode={Team:`team`,Global:`global`},UpdateProjectDeploymentType={All:`all`,Preview:`preview`,ProdDeploymentUrlsAndAllPreviews:`prod_deployment_urls_and_all_previews`,AllExceptCustomDomains:`all_except_custom_domains`},UpdateProjectProjectsDeploymentType={All:`all`,Preview:`preview`,ProdDeploymentUrlsAndAllPreviews:`prod_deployment_urls_and_all_previews`,AllExceptCustomDomains:`all_except_custom_domains`},UpdateProjectProjectsRequestDeploymentType={All:`all`,Preview:`preview`,ProdDeploymentUrlsAndAllPreviews:`prod_deployment_urls_and_all_previews`,AllExceptCustomDomains:`all_except_custom_domains`},UpdateProjectProjectsRequestRequestBodyDeploymentType={All:`all`,Preview:`preview`,Production:`production`,ProdDeploymentUrlsAndAllPreviews:`prod_deployment_urls_and_all_previews`,AllExceptCustomDomains:`all_except_custom_domains`},ProtectionMode={Exclusive:`exclusive`,Additional:`additional`},ToPreset={AllCustom:`all-custom`},Preset={AllCustom:`all-custom`},UpdateProjectFromPreset={AllCustom:`all-custom`},FromPreset={AllCustom:`all-custom`},UpdateProjectToProjectsPreset={AllCustom:`all-custom`},UpdateProjectToPreset={AllCustom:`all-custom`},UpdateProjectEnvironmentsProjectsTarget={Production:`production`,Preview:`preview`},UpdateProjectSourcesProjectsProvider={Github:`github`,Bitbucket:`bitbucket`},UpdateProjectEnvironmentsTarget={Production:`production`,Preview:`preview`},DeploymentSourcesSources={Git:`git`,Cli:`cli`,RestApi:`rest-api`,DeployHook:`deploy-hook`,Integration:`integration`,V0:`v0`},UpdateProjectAction={Cancel:`cancel`,Accept:`accept`,Delete:`delete`},UpdateProjectConfiguredBy={A:`A`,Cname:`CNAME`,Dns01:`dns-01`,Http:`http`},UpdateProjectProjectsResponse200ApplicationJSONResponseBodyAliasDeploymentType={EndsWith:`endsWith`,Equals:`equals`,StartsWith:`startsWith`},UpdateProjectProjectsResponseChecksConclusion={Canceled:`canceled`,Failed:`failed`,Skipped:`skipped`,Succeeded:`succeeded`},UpdateProjectProjectsResponseChecksState={Completed:`completed`,Registered:`registered`,Running:`running`},UpdateProjectProjectsResponsePlan={Enterprise:`enterprise`,Hobby:`hobby`,Pro:`pro`},UpdateProjectProjectsResponseReadyState={Blocked:`BLOCKED`,Building:`BUILDING`,Canceled:`CANCELED`,Error:`ERROR`,Initializing:`INITIALIZING`,Queued:`QUEUED`,Ready:`READY`},UpdateProjectProjectsResponseReadySubstate={Promoted:`PROMOTED`,Rolling:`ROLLING`,Staged:`STAGED`},UpdateProjectProjectsResponse200ApplicationJSONResponseBodyAliasType={Lambdas:`LAMBDAS`},UpdateProjectEnvironment={Preview:`preview`,Production:`production`},UpdateProjectTarget={Preview:`PREVIEW`,Production:`PRODUCTION`,Staging:`STAGING`},UpdateProjectEnvId2={Preview:`preview`,Production:`production`},UpdateProjectSource={Api:`api`},UpdateProjectTarget2={Production:`production`,Preview:`preview`,Development:`development`},UpdateProjectType={Encrypted:`encrypted`,Plain:`plain`,Secret:`secret`,Sensitive:`sensitive`,System:`system`},UpdateProjectProjectsResponse200ApplicationJSONResponseBodyEnvType={FlagsSecret:`flags-secret`},UpdateProjectProjectsType={Development:`development`,Preview:`preview`,Production:`production`},UpdateProjectProjectsResponse200ApplicationJSONResponseBodyCustomEnvironmentsType={EndsWith:`endsWith`,Equals:`equals`,StartsWith:`startsWith`},UpdateProjectProjectsFramework={ActixWeb:`actix-web`,Angular:`angular`,Ash:`ash`,Astro:`astro`,Axum:`axum`,Blitzjs:`blitzjs`,Brunch:`brunch`,Bun:`bun`,Container:`container`,CreateReactApp:`create-react-app`,Django:`django`,Docusaurus:`docusaurus`,Docusaurus2:`docusaurus-2`,Dojo:`dojo`,Eleventy:`eleventy`,Elysia:`elysia`,Ember:`ember`,Eve:`eve`,Express:`express`,Fastapi:`fastapi`,Fasthtml:`fasthtml`,Fastify:`fastify`,Flask:`flask`,Gatsby:`gatsby`,Go:`go`,Gridsome:`gridsome`,H3:`h3`,Hexo:`hexo`,Hono:`hono`,Hugo:`hugo`,Hydrogen:`hydrogen`,IonicAngular:`ionic-angular`,IonicReact:`ionic-react`,Jekyll:`jekyll`,Koa:`koa`,Mastra:`mastra`,Middleman:`middleman`,Nestjs:`nestjs`,Nextjs:`nextjs`,Nitro:`nitro`,Node:`node`,Nuxtjs:`nuxtjs`,Parcel:`parcel`,Polymer:`polymer`,Preact:`preact`,Python:`python`,ReactRouter:`react-router`,Redwoodjs:`redwoodjs`,Remix:`remix`,Ruby:`ruby`,Rust:`rust`,Saber:`saber`,Sanity:`sanity`,SanityV2:`sanity-v2`,Sapper:`sapper`,Scully:`scully`,Services:`services`,Solidstart:`solidstart`,Solidstart1:`solidstart-1`,Stencil:`stencil`,Storybook:`storybook`,Svelte:`svelte`,Sveltekit:`sveltekit`,Sveltekit1:`sveltekit-1`,TanstackStart:`tanstack-start`,Umijs:`umijs`,Vite:`vite`,Vitepress:`vitepress`,Vue:`vue`,Vuepress:`vuepress`,Xmcp:`xmcp`,Zola:`zola`},UpdateProjectServiceType={Cron:`cron`,Job:`job`,Web:`web`,Worker:`worker`},UpdateProjectProjectsResponseFramework={ActixWeb:`actix-web`,Angular:`angular`,Ash:`ash`,Astro:`astro`,Axum:`axum`,Blitzjs:`blitzjs`,Brunch:`brunch`,Bun:`bun`,Container:`container`,CreateReactApp:`create-react-app`,Django:`django`,Docusaurus:`docusaurus`,Docusaurus2:`docusaurus-2`,Dojo:`dojo`,Eleventy:`eleventy`,Elysia:`elysia`,Ember:`ember`,Eve:`eve`,Express:`express`,Fastapi:`fastapi`,Fasthtml:`fasthtml`,Fastify:`fastify`,Flask:`flask`,Gatsby:`gatsby`,Go:`go`,Gridsome:`gridsome`,H3:`h3`,Hexo:`hexo`,Hono:`hono`,Hugo:`hugo`,Hydrogen:`hydrogen`,IonicAngular:`ionic-angular`,IonicReact:`ionic-react`,Jekyll:`jekyll`,Koa:`koa`,Mastra:`mastra`,Middleman:`middleman`,Nestjs:`nestjs`,Nextjs:`nextjs`,Nitro:`nitro`,Node:`node`,Nuxtjs:`nuxtjs`,Parcel:`parcel`,Polymer:`polymer`,Preact:`preact`,Python:`python`,ReactRouter:`react-router`,Redwoodjs:`redwoodjs`,Remix:`remix`,Ruby:`ruby`,Rust:`rust`,Saber:`saber`,Sanity:`sanity`,SanityV2:`sanity-v2`,Sapper:`sapper`,Scully:`scully`,Services:`services`,Solidstart:`solidstart`,Solidstart1:`solidstart-1`,Stencil:`stencil`,Storybook:`storybook`,Svelte:`svelte`,Sveltekit:`sveltekit`,Sveltekit1:`sveltekit-1`,TanstackStart:`tanstack-start`,Umijs:`umijs`,Vite:`vite`,Vitepress:`vitepress`,Vue:`vue`,Vuepress:`vuepress`,Xmcp:`xmcp`,Zola:`zola`},UpdateProjectProjectsResponse200ApplicationJSONResponseBodyType={EndsWith:`endsWith`,Equals:`equals`,StartsWith:`startsWith`},UpdateProjectFramework$outboundSchema=nativeEnumType(UpdateProjectFramework),UpdateProjectNodeVersion$outboundSchema=nativeEnumType(UpdateProjectNodeVersion),UpdateProjectBuildMachineType$outboundSchema=nativeEnumType(UpdateProjectBuildMachineType),UpdateProjectBuildQueue$outboundSchema=objectType({configuration:nativeEnumType(UpdateProjectConfiguration).optional()}),UpdateProjectFunctionDefaultMemoryType$outboundSchema=nativeEnumType(UpdateProjectFunctionDefaultMemoryType),UpdateProjectBuildMachineSelection$outboundSchema=nativeEnumType(UpdateProjectBuildMachineSelection),UpdateProjectBuildMachineElasticReason$outboundSchema=nativeEnumType(UpdateProjectBuildMachineElasticReason),UpdateProjectResourceConfig$outboundSchema=objectType({buildMachineType:UpdateProjectBuildMachineType$outboundSchema.optional(),buildQueue:lazyType(()=>UpdateProjectBuildQueue$outboundSchema).optional(),fluid:booleanType().optional(),functionDefaultRegions:arrayType(stringType()).optional(),functionDefaultTimeout:numberType().optional(),functionDefaultMemoryType:UpdateProjectFunctionDefaultMemoryType$outboundSchema.optional(),functionZeroConfigFailover:booleanType().optional(),elasticConcurrencyEnabled:booleanType().optional(),buildMachineSelection:UpdateProjectBuildMachineSelection$outboundSchema.optional(),buildMachineElasticLastUpdated:numberType().optional(),buildMachineElasticReason:UpdateProjectBuildMachineElasticReason$outboundSchema.optional(),isNSNBDisabled:booleanType().optional(),enableFunctionsBeta:booleanType().optional()}),UpdateProjectStaticIps$outboundSchema=objectType({enabled:booleanType()}),UpdateProjectEnv$outboundSchema=nativeEnumType(UpdateProjectEnv),Destination$outboundSchema=nativeEnumType(Destination),SamplingRules$outboundSchema=objectType({rate:numberType(),env:UpdateProjectEnv$outboundSchema.optional(),requestPath:stringType().optional(),destination:Destination$outboundSchema.optional()}),Tracing$outboundSchema=objectType({domains:stringType().optional(),ignorePaths:arrayType(stringType()).optional(),samplingRules:arrayType(lazyType(()=>SamplingRules$outboundSchema)).optional()}),UpdateProjectIssuerMode$outboundSchema=nativeEnumType(UpdateProjectIssuerMode),UpdateProjectOidcTokenConfig$outboundSchema=objectType({enabled:booleanType().default(!0),issuerMode:UpdateProjectIssuerMode$outboundSchema.default(`team`)}),UpdateProjectPasswordProtection$outboundSchema=objectType({deploymentType:nativeEnumType(UpdateProjectDeploymentType),password:nullableType(stringType()).optional()}),UpdateProjectProjectsDeploymentType$outboundSchema=nativeEnumType(UpdateProjectProjectsDeploymentType),UpdateProjectPassport$outboundSchema=objectType({connectorId:stringType(),deploymentType:UpdateProjectProjectsDeploymentType$outboundSchema.default(`all`)}),UpdateProjectSsoProtection$outboundSchema=objectType({deploymentType:nativeEnumType(UpdateProjectProjectsRequestDeploymentType).default(`preview`)}),UpdateProjectProjectsRequestRequestBodyDeploymentType$outboundSchema=nativeEnumType(UpdateProjectProjectsRequestRequestBodyDeploymentType),Addresses$outboundSchema=objectType({value:stringType(),note:stringType().optional()}),ProtectionMode$outboundSchema=nativeEnumType(ProtectionMode),UpdateProjectTrustedIps$outboundSchema=objectType({deploymentType:UpdateProjectProjectsRequestRequestBodyDeploymentType$outboundSchema,addresses:arrayType(lazyType(()=>Addresses$outboundSchema)),protectionMode:ProtectionMode$outboundSchema}),ToPreset$outboundSchema=nativeEnumType(ToPreset),To2$outboundSchema=objectType({slugs:arrayType(stringType()).optional(),preset:ToPreset$outboundSchema}),Preset$outboundSchema=nativeEnumType(Preset),To1$outboundSchema=objectType({slugs:arrayType(stringType()),preset:Preset$outboundSchema.optional()});smartUnion([lazyType(()=>To1$outboundSchema),lazyType(()=>To2$outboundSchema)]);const UpdateProjectFromPreset$outboundSchema=nativeEnumType(UpdateProjectFromPreset),From2$outboundSchema=objectType({slugs:arrayType(stringType()).optional(),preset:UpdateProjectFromPreset$outboundSchema}),FromPreset$outboundSchema=nativeEnumType(FromPreset),From1$outboundSchema=objectType({slugs:arrayType(stringType()),preset:FromPreset$outboundSchema.optional()});smartUnion([lazyType(()=>From1$outboundSchema),lazyType(()=>From2$outboundSchema)]);const CustomAllow$outboundSchema=objectType({to:smartUnion([lazyType(()=>To1$outboundSchema),lazyType(()=>To2$outboundSchema)]),from:smartUnion([lazyType(()=>From1$outboundSchema),lazyType(()=>From2$outboundSchema)])}),UpdateProjectProjects$outboundSchema=objectType({label:stringType().optional(),customAllow:arrayType(lazyType(()=>CustomAllow$outboundSchema)).optional()}),UpdateProjectToProjectsPreset$outboundSchema=nativeEnumType(UpdateProjectToProjectsPreset),UpdateProjectTo2$outboundSchema=objectType({slugs:arrayType(stringType()).optional(),preset:UpdateProjectToProjectsPreset$outboundSchema}),UpdateProjectToPreset$outboundSchema=nativeEnumType(UpdateProjectToPreset),UpdateProjectTo1$outboundSchema=objectType({slugs:arrayType(stringType()),preset:UpdateProjectToPreset$outboundSchema.optional()});smartUnion([lazyType(()=>UpdateProjectTo1$outboundSchema),lazyType(()=>UpdateProjectTo2$outboundSchema)]);const OidcProviders$outboundSchema=objectType({label:stringType().optional(),to:smartUnion([lazyType(()=>UpdateProjectTo1$outboundSchema),lazyType(()=>UpdateProjectTo2$outboundSchema)]),claims:recordType(arrayType(stringType()))}),TrustedSources$outboundSchema=objectType({projects:recordType(lazyType(()=>UpdateProjectProjects$outboundSchema)).optional(),oidcProviders:recordType(arrayType(lazyType(()=>OidcProviders$outboundSchema))).optional()});function trustedSourcesToJSON(e){return JSON.stringify(TrustedSources$outboundSchema.parse(e))}const UpdateProjectEnvironmentsProjects2$outboundSchema=objectType({type:literalType(`custom`),environmentId:stringType()}),UpdateProjectEnvironmentsProjectsTarget$outboundSchema=nativeEnumType(UpdateProjectEnvironmentsProjectsTarget),UpdateProjectEnvironmentsProjects1$outboundSchema=objectType({type:literalType(`system`),target:UpdateProjectEnvironmentsProjectsTarget$outboundSchema});unionType([lazyType(()=>UpdateProjectEnvironmentsProjects1$outboundSchema),lazyType(()=>UpdateProjectEnvironmentsProjects2$outboundSchema)]);const UpdateProjectSources2$outboundSchema=objectType({provider:literalType(`gitlab`),namespace:stringType(),project:stringType().optional()}),UpdateProjectSources1$outboundSchema=objectType({provider:nativeEnumType(UpdateProjectSourcesProjectsProvider),org:stringType(),repo:stringType().optional()});unionType([lazyType(()=>UpdateProjectSources1$outboundSchema).and(objectType({provider:literalType(`github`)})),lazyType(()=>UpdateProjectSources1$outboundSchema).and(objectType({provider:literalType(`bitbucket`)})),lazyType(()=>UpdateProjectSources2$outboundSchema)]);const GitSources1$outboundSchema=objectType({enabled:booleanType(),environments:arrayType(unionType([lazyType(()=>UpdateProjectEnvironmentsProjects1$outboundSchema),lazyType(()=>UpdateProjectEnvironmentsProjects2$outboundSchema)])),sources:arrayType(unionType([lazyType(()=>UpdateProjectSources1$outboundSchema).and(objectType({provider:literalType(`github`)})),lazyType(()=>UpdateProjectSources1$outboundSchema).and(objectType({provider:literalType(`bitbucket`)})),lazyType(()=>UpdateProjectSources2$outboundSchema)]))});smartUnion([arrayType(lazyType(()=>GitSources1$outboundSchema)),stringType()]);const UpdateProjectEnvironments2$outboundSchema=objectType({type:literalType(`custom`),environmentId:stringType()}),UpdateProjectEnvironmentsTarget$outboundSchema=nativeEnumType(UpdateProjectEnvironmentsTarget),UpdateProjectEnvironments1$outboundSchema=objectType({type:literalType(`system`),target:UpdateProjectEnvironmentsTarget$outboundSchema});unionType([lazyType(()=>UpdateProjectEnvironments1$outboundSchema),lazyType(()=>UpdateProjectEnvironments2$outboundSchema)]);const DeploymentSourcesSources$outboundSchema=nativeEnumType(DeploymentSourcesSources),DeploymentSources1$outboundSchema=objectType({enabled:booleanType(),environments:arrayType(unionType([lazyType(()=>UpdateProjectEnvironments1$outboundSchema),lazyType(()=>UpdateProjectEnvironments2$outboundSchema)])),sources:arrayType(DeploymentSourcesSources$outboundSchema)});smartUnion([arrayType(lazyType(()=>DeploymentSources1$outboundSchema)),stringType()]);const DeploymentPolicy1$outboundSchema=objectType({gitSources:smartUnion([arrayType(lazyType(()=>GitSources1$outboundSchema)),stringType()]).optional(),deploymentSources:smartUnion([arrayType(lazyType(()=>DeploymentSources1$outboundSchema)),stringType()]).optional()});smartUnion([lazyType(()=>DeploymentPolicy1$outboundSchema),stringType()]);const UpdateProjectPaths$outboundSchema=objectType({value:stringType()}),UpdateProjectOptionsAllowlist$outboundSchema=objectType({paths:arrayType(lazyType(()=>UpdateProjectPaths$outboundSchema))}),ConnectConfigurations1$outboundSchema=objectType({envId:stringType(),connectConfigurationId:stringType(),passive:booleanType(),buildsEnabled:booleanType()});lazyType(()=>ConnectConfigurations1$outboundSchema);const UpdateProjectAction$outboundSchema=nativeEnumType(UpdateProjectAction);smartUnion([numberType(),booleanType(),stringType()]),smartUnion([numberType(),booleanType(),stringType()]),objectType({previousValue:smartUnion([numberType(),booleanType(),stringType()]),currentValue:smartUnion([numberType(),booleanType(),stringType()])});const UpdateProjectDismissedToasts$outboundSchema=objectType({key:stringType(),dismissedAt:numberType(),action:UpdateProjectAction$outboundSchema,value:anyType().optional()}),UpdateProjectRequestBody$outboundSchema=objectType({autoExposeSystemEnvs:booleanType().optional(),autoAssignCustomDomains:booleanType().optional(),autoAssignCustomDomainsUpdatedBy:stringType().optional(),buildCommand:nullableType(stringType()).optional(),commandForIgnoringBuildStep:nullableType(stringType()).optional(),customerSupportCodeVisibility:booleanType().optional(),devCommand:nullableType(stringType()).optional(),directoryListing:booleanType().optional(),framework:nullableType(UpdateProjectFramework$outboundSchema).optional(),gitForkProtection:booleanType().optional(),gitLFS:booleanType().optional(),protectedSourcemaps:booleanType().optional(),installCommand:nullableType(stringType()).optional(),name:stringType().optional(),nodeVersion:UpdateProjectNodeVersion$outboundSchema.optional(),outputDirectory:nullableType(stringType()).optional(),previewDeploymentsDisabled:nullableType(booleanType()).optional(),previewDeploymentSuffix:nullableType(stringType()).optional(),resourceConfig:lazyType(()=>UpdateProjectResourceConfig$outboundSchema).optional(),publicSource:nullableType(booleanType()).optional(),rootDirectory:nullableType(stringType()).optional(),serverlessFunctionRegion:nullableType(stringType()).optional(),serverlessFunctionZeroConfigFailover:booleanType().optional(),skewProtectionBoundaryAt:numberType().int().optional(),skewProtectionMaxAge:numberType().int().optional(),skewProtectionAllowedDomains:arrayType(stringType()).optional(),skipGitConnectDuringLink:booleanType().optional(),sourceFilesOutsideRootDirectory:booleanType().optional(),enablePreviewFeedback:nullableType(booleanType()).optional(),enableProductionFeedback:nullableType(booleanType()).optional(),enableAffectedProjectsDeployments:booleanType().optional(),enableExternalRewriteCaching:booleanType().optional(),staticIps:lazyType(()=>UpdateProjectStaticIps$outboundSchema).optional(),tracing:nullableType(lazyType(()=>Tracing$outboundSchema)).optional(),oidcTokenConfig:lazyType(()=>UpdateProjectOidcTokenConfig$outboundSchema).optional(),passwordProtection:nullableType(lazyType(()=>UpdateProjectPasswordProtection$outboundSchema)).optional(),passport:nullableType(lazyType(()=>UpdateProjectPassport$outboundSchema)).optional(),ssoProtection:nullableType(lazyType(()=>UpdateProjectSsoProtection$outboundSchema)).optional(),trustedIps:nullableType(lazyType(()=>UpdateProjectTrustedIps$outboundSchema)).optional(),trustedSources:nullableType(lazyType(()=>TrustedSources$outboundSchema)).optional(),deploymentPolicy:smartUnion([lazyType(()=>DeploymentPolicy1$outboundSchema),stringType()]).optional(),optionsAllowlist:nullableType(lazyType(()=>UpdateProjectOptionsAllowlist$outboundSchema)).optional(),connectConfigurations:nullableType(arrayType(lazyType(()=>ConnectConfigurations1$outboundSchema))).optional(),dismissedToasts:arrayType(lazyType(()=>UpdateProjectDismissedToasts$outboundSchema)).optional()});objectType({idOrName:stringType(),teamId:stringType().optional(),slug:stringType().optional(),requestBody:lazyType(()=>UpdateProjectRequestBody$outboundSchema)}).transform(e=>remap(e,{requestBody:`RequestBody`}));const UpdateProjectConfiguredBy$inboundSchema=nativeEnumType(UpdateProjectConfiguredBy);smartUnion([number(),boolean()]);const UpdateProjectProjectsResponseAliasError$inboundSchema=objectType({code:string(),message:string()}),UpdateProjectProjectsResponse200BranchMatcher$inboundSchema=objectType({type:nativeEnumType(UpdateProjectProjectsResponse200ApplicationJSONResponseBodyAliasDeploymentType),pattern:string()}),UpdateProjectProjectsResponseBuilds$inboundSchema=objectType({use:string(),src:optional(string()),dest:optional(string())}),UpdateProjectProjectsResponseChecksConclusion$inboundSchema=nativeEnumType(UpdateProjectProjectsResponseChecksConclusion),UpdateProjectProjectsResponseChecksState$inboundSchema=nativeEnumType(UpdateProjectProjectsResponseChecksState),UpdateProjectProjectsResponseCreator$inboundSchema=objectType({email:string(),githubLogin:optional(string()),gitlabLogin:optional(string()),uid:string(),username:string()}),UpdateProjectProjectsResponseOidcTokenClaims$inboundSchema=objectType({iss:string(),sub:string(),scope:string(),aud:string(),owner:string(),owner_id:string(),project:string(),project_id:string(),environment:string(),custom_environment_id:optional(string()),plan:optional(string())}).transform(e=>remap(e,{owner_id:`ownerId`,project_id:`projectId`,custom_environment_id:`customEnvironmentId`})),UpdateProjectProjectsResponsePlan$inboundSchema=nativeEnumType(UpdateProjectProjectsResponsePlan),UpdateProjectProjectsResponseReadyState$inboundSchema=nativeEnumType(UpdateProjectProjectsResponseReadyState),UpdateProjectProjectsResponseReadySubstate$inboundSchema=nativeEnumType(UpdateProjectProjectsResponseReadySubstate),UpdateProjectProjectsResponse200ApplicationJSONResponseBodyAliasType$inboundSchema=nativeEnumType(UpdateProjectProjectsResponse200ApplicationJSONResponseBodyAliasType),UpdateProjectDeployment$inboundSchema=objectType({id:string(),alias:optional(arrayType(string())),aliasAssigned:nullableType(smartUnion([number(),boolean()])).optional(),aliasError:nullableType(lazyType(()=>UpdateProjectProjectsResponseAliasError$inboundSchema)).optional(),aliasFinal:nullableType(string()).optional(),automaticAliases:optional(arrayType(string())),branchMatcher:optional(lazyType(()=>UpdateProjectProjectsResponse200BranchMatcher$inboundSchema)),buildingAt:optional(number()),builds:optional(arrayType(lazyType(()=>UpdateProjectProjectsResponseBuilds$inboundSchema))),checksConclusion:optional(UpdateProjectProjectsResponseChecksConclusion$inboundSchema),checksState:optional(UpdateProjectProjectsResponseChecksState$inboundSchema),connectBuildsEnabled:optional(boolean()),connectConfigurationId:optional(string()),createdAt:number(),createdIn:string(),creator:nullable(lazyType(()=>UpdateProjectProjectsResponseCreator$inboundSchema)),deletedAt:optional(number()),deploymentHostname:string(),forced:optional(boolean()),name:string(),meta:optional(recordType(string())),monorepoManager:nullableType(string()).optional(),oidcTokenClaims:optional(lazyType(()=>UpdateProjectProjectsResponseOidcTokenClaims$inboundSchema)),plan:UpdateProjectProjectsResponsePlan$inboundSchema,previewCommentsEnabled:optional(boolean()),private:boolean(),readyAt:optional(number()),readyState:UpdateProjectProjectsResponseReadyState$inboundSchema,readySubstate:optional(UpdateProjectProjectsResponseReadySubstate$inboundSchema),requestedAt:optional(number()),target:nullableType(string()).optional(),teamId:nullableType(string()).optional(),type:UpdateProjectProjectsResponse200ApplicationJSONResponseBodyAliasType$inboundSchema,url:string(),userId:string(),withCache:optional(boolean())}),UpdateProjectEnvironment$inboundSchema=nativeEnumType(UpdateProjectEnvironment),UpdateProjectTarget$inboundSchema=nativeEnumType(UpdateProjectTarget);objectType({configuredBy:nullableType(UpdateProjectConfiguredBy$inboundSchema).optional(),configuredChangedAt:nullableType(number()).optional(),createdAt:nullableType(number()).optional(),deployment:nullable(lazyType(()=>UpdateProjectDeployment$inboundSchema)),domain:string(),environment:UpdateProjectEnvironment$inboundSchema,gitBranch:nullableType(string()).optional(),redirect:nullableType(string()).optional(),redirectStatusCode:nullableType(number()).optional(),target:UpdateProjectTarget$inboundSchema}),objectType({id:string(),canceledAt:nullableType(number()).optional(),disabledAt:number(),enabledAt:number(),paidAt:optional(number()),sampleRatePercent:nullableType(number()).optional(),spendLimitInDollars:nullableType(number()).optional()}),objectType({id:string(),enabledAt:optional(number()),disabledAt:optional(number()),canceledAt:optional(number()),hasData:optional(boolean()),paidAt:optional(number())});const UpdateProjectEnvId2$inboundSchema=nativeEnumType(UpdateProjectEnvId2);smartUnion([string(),UpdateProjectEnvId2$inboundSchema]);const UpdateProjectAws$inboundSchema=objectType({subnetIds:arrayType(string()),securityGroupId:optional(string())});objectType({envId:smartUnion([string(),UpdateProjectEnvId2$inboundSchema]),connectConfigurationId:string(),dc:optional(string()),passive:boolean(),buildsEnabled:boolean(),aws:optional(lazyType(()=>UpdateProjectAws$inboundSchema)),createdAt:number(),updatedAt:number()});const UpdateProjectSource$inboundSchema=nativeEnumType(UpdateProjectSource),UpdateProjectDefinitions$inboundSchema=objectType({host:string(),path:string(),schedule:string(),source:optional(UpdateProjectSource$inboundSchema),description:optional(string()),hostInferred:optional(boolean())});objectType({enabledAt:number(),disabledAt:nullable(number()),updatedAt:number(),deploymentId:nullable(string()),definitions:arrayType(lazyType(()=>UpdateProjectDefinitions$inboundSchema))}),objectType({userDisabled:boolean(),storageSizeBytes:nullableType(number()).optional(),unlimited:optional(boolean())}),objectType({expirationDays:optional(number()),expirationDaysProduction:optional(number()),expirationDaysCanceled:optional(number()),expirationDaysErrored:optional(number()),deploymentsToKeep:optional(number())});const UpdateProjectExpiration2$inboundSchema=objectType({lockedAt:number(),lockedBy:string()}),UpdateProjectExpiration1$inboundSchema=objectType({expiresAt:number()});smartUnion([lazyType(()=>UpdateProjectExpiration2$inboundSchema),lazyType(()=>UpdateProjectExpiration1$inboundSchema)]);const UpdateProjectTarget2$inboundSchema=nativeEnumType(UpdateProjectTarget2);smartUnion([arrayType(string()),UpdateProjectTarget2$inboundSchema]);const UpdateProjectType$inboundSchema=nativeEnumType(UpdateProjectType),UpdateProjectContentHint17$inboundSchema=objectType({type:literal(`flags-connection-string`),projectId:string()}),UpdateProjectContentHint16$inboundSchema=objectType({type:literal(`integration-store-secret`),storeId:string(),integrationId:string(),integrationProductId:string(),integrationConfigurationId:string()}),UpdateProjectContentHint15$inboundSchema=objectType({type:literal(`postgres-url-no-ssl`),storeId:string()}),UpdateProjectContentHint14$inboundSchema=objectType({type:literal(`postgres-database`),storeId:string()}),UpdateProjectContentHint13$inboundSchema=objectType({type:literal(`postgres-password`),storeId:string()}),UpdateProjectContentHint12$inboundSchema=objectType({type:literal(`postgres-host`),storeId:string()}),UpdateProjectContentHint11$inboundSchema=objectType({type:literal(`postgres-user`),storeId:string()}),UpdateProjectContentHint10$inboundSchema=objectType({type:literal(`postgres-prisma-url`),storeId:string()}),UpdateProjectContentHint9$inboundSchema=objectType({type:literal(`postgres-url-non-pooling`),storeId:string()}),UpdateProjectContentHint8$inboundSchema=objectType({type:literal(`postgres-url`),storeId:string()}),UpdateProjectContentHint7$inboundSchema=objectType({type:literal(`blob-webhook-public-key`),storeId:string()}),UpdateProjectContentHint6$inboundSchema=objectType({type:literal(`blob-store-id`),storeId:string()}),UpdateProjectContentHint5$inboundSchema=objectType({type:literal(`blob-read-write-token`),storeId:string()}),UpdateProjectContentHint4$inboundSchema=objectType({type:literal(`redis-rest-api-read-only-token`),storeId:string()}),UpdateProjectContentHint3$inboundSchema=objectType({type:literal(`redis-rest-api-token`),storeId:string()}),UpdateProjectContentHint2$inboundSchema=objectType({type:literal(`redis-rest-api-url`),storeId:string()}),UpdateProjectContentHint1$inboundSchema=objectType({type:literal(`redis-url`),storeId:string()});unionType([lazyType(()=>UpdateProjectContentHint1$inboundSchema),lazyType(()=>UpdateProjectContentHint2$inboundSchema),lazyType(()=>UpdateProjectContentHint3$inboundSchema),lazyType(()=>UpdateProjectContentHint4$inboundSchema),lazyType(()=>UpdateProjectContentHint5$inboundSchema),lazyType(()=>UpdateProjectContentHint6$inboundSchema),lazyType(()=>UpdateProjectContentHint7$inboundSchema),lazyType(()=>UpdateProjectContentHint8$inboundSchema),lazyType(()=>UpdateProjectContentHint9$inboundSchema),lazyType(()=>UpdateProjectContentHint10$inboundSchema),lazyType(()=>UpdateProjectContentHint11$inboundSchema),lazyType(()=>UpdateProjectContentHint12$inboundSchema),lazyType(()=>UpdateProjectContentHint13$inboundSchema),lazyType(()=>UpdateProjectContentHint14$inboundSchema),lazyType(()=>UpdateProjectContentHint15$inboundSchema),lazyType(()=>UpdateProjectContentHint16$inboundSchema),lazyType(()=>UpdateProjectContentHint17$inboundSchema)]);const UpdateProjectInternalContentHint$inboundSchema=objectType({type:nativeEnumType(UpdateProjectProjectsResponse200ApplicationJSONResponseBodyEnvType),encryptedValue:string()});objectType({target:optional(smartUnion([arrayType(string()),UpdateProjectTarget2$inboundSchema])),type:UpdateProjectType$inboundSchema,sunsetSecretId:optional(string()),legacyValue:optional(string()),decrypted:optional(boolean()),value:string(),vsmValue:optional(string()),id:optional(string()),key:string(),configurationId:nullableType(string()).optional(),createdAt:optional(number()),updatedAt:optional(number()),createdBy:nullableType(string()).optional(),updatedBy:nullableType(string()).optional(),gitBranch:optional(string()),edgeConfigId:nullableType(string()).optional(),edgeConfigTokenId:nullableType(string()).optional(),contentHint:nullableType(unionType([lazyType(()=>UpdateProjectContentHint1$inboundSchema),lazyType(()=>UpdateProjectContentHint2$inboundSchema),lazyType(()=>UpdateProjectContentHint3$inboundSchema),lazyType(()=>UpdateProjectContentHint4$inboundSchema),lazyType(()=>UpdateProjectContentHint5$inboundSchema),lazyType(()=>UpdateProjectContentHint6$inboundSchema),lazyType(()=>UpdateProjectContentHint7$inboundSchema),lazyType(()=>UpdateProjectContentHint8$inboundSchema),lazyType(()=>UpdateProjectContentHint9$inboundSchema),lazyType(()=>UpdateProjectContentHint10$inboundSchema),lazyType(()=>UpdateProjectContentHint11$inboundSchema),lazyType(()=>UpdateProjectContentHint12$inboundSchema),lazyType(()=>UpdateProjectContentHint13$inboundSchema),lazyType(()=>UpdateProjectContentHint14$inboundSchema),lazyType(()=>UpdateProjectContentHint15$inboundSchema),lazyType(()=>UpdateProjectContentHint16$inboundSchema),lazyType(()=>UpdateProjectContentHint17$inboundSchema)])).optional(),internalContentHint:nullableType(lazyType(()=>UpdateProjectInternalContentHint$inboundSchema)).optional(),comment:optional(string()),customEnvironmentIds:optional(arrayType(string()))});const UpdateProjectProjectsType$inboundSchema=nativeEnumType(UpdateProjectProjectsType),UpdateProjectBranchMatcher$inboundSchema=objectType({type:nativeEnumType(UpdateProjectProjectsResponse200ApplicationJSONResponseBodyCustomEnvironmentsType),pattern:string()}),UpdateProjectVerification$inboundSchema=objectType({type:string(),domain:string(),value:string(),reason:string()}),UpdateProjectDomains$inboundSchema=objectType({name:string(),apexName:string(),projectId:string(),redirect:nullableType(string()).optional(),redirectStatusCode:nullableType(number()).optional(),gitBranch:nullableType(string()).optional(),customEnvironmentId:nullableType(string()).optional(),updatedAt:optional(number()),createdAt:optional(number()),verified:boolean(),verification:optional(arrayType(lazyType(()=>UpdateProjectVerification$inboundSchema)))});objectType({id:string(),slug:string(),type:UpdateProjectProjectsType$inboundSchema,description:optional(string()),branchMatcher:optional(lazyType(()=>UpdateProjectBranchMatcher$inboundSchema)),domains:optional(arrayType(lazyType(()=>UpdateProjectDomains$inboundSchema))),currentDeploymentAliases:optional(arrayType(string())),createdAt:number(),updatedAt:number()}),nativeEnumType(UpdateProjectProjectsFramework);const UpdateProjectServiceType$inboundSchema=nativeEnumType(UpdateProjectServiceType),UpdateProjectProjectsResponseFramework$inboundSchema=nativeEnumType(UpdateProjectProjectsResponseFramework);objectType({serviceName:string(),serviceType:optional(UpdateProjectServiceType$inboundSchema),framework:optional(UpdateProjectProjectsResponseFramework$inboundSchema),runtime:optional(string())}),objectType({bucket:string(),default:optional(boolean()),supportUntil:optional(number())});const UpdateProjectLint$inboundSchema=objectType({targets:arrayType(string())}),UpdateProjectTypecheck$inboundSchema=objectType({targets:arrayType(string())}),UpdateProjectMfeConfigPresent$inboundSchema=objectType({targets:arrayType(string())});objectType({lint:optional(lazyType(()=>UpdateProjectLint$inboundSchema)),typecheck:optional(lazyType(()=>UpdateProjectTypecheck$inboundSchema)),"mfe-config-present":optional(lazyType(()=>UpdateProjectMfeConfigPresent$inboundSchema))}).transform(e=>remap(e,{"mfe-config-present":`mfeConfigPresent`}));const UpdateProjectAliasAssigned$inboundSchema=smartUnion([number(),boolean()]),UpdateProjectAliasError$inboundSchema=objectType({code:string(),message:string()}),UpdateProjectProjectsBranchMatcher$inboundSchema=objectType({type:nativeEnumType(UpdateProjectProjectsResponse200ApplicationJSONResponseBodyType),pattern:string()});export{UpdateProjectAliasAssigned$inboundSchema,UpdateProjectAliasError$inboundSchema,UpdateProjectProjectsBranchMatcher$inboundSchema,trustedSourcesToJSON};
@@ -1 +1 @@
1
- function connectionProtocols(e){return[e.mcp?`mcp`:null,e.openapi?`openapi`:null].filter(e=>e!==null)}const INTEGRATIONS=[{slug:`slack`,name:`Slack`,kind:`channel`,tagline:`Mention your agent in channels and DMs, with Connect-managed auth.`,surfaces:{scaffoldable:!0,gallery:!0}},{slug:`discord`,name:`Discord`,kind:`channel`,tagline:`Run your agent as a Discord bot across servers and threads.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`teams`,name:`Microsoft Teams`,kind:`channel`,tagline:`Bring your agent into Teams chats and channels.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`telegram`,name:`Telegram`,kind:`channel`,tagline:`Connect your agent to a Telegram bot for 1:1 and group chats.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`twilio`,name:`Twilio`,kind:`channel`,tagline:`Put your agent on a phone number: SMS and speech-transcribed calls.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`github`,name:`GitHub`,kind:`channel`,tagline:`Drive your agent from issues, pull requests, and comments.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`linear-agent`,name:`Linear Agent`,kind:`channel`,tagline:`Delegate Linear issues and comments to your agent through Linear's Agent Sessions.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`eve`,name:`Web Chat`,kind:`channel`,tagline:`Embed a first-party web chat UI backed by your agent.`,surfaces:{scaffoldable:!0,gallery:!0}},{slug:`chat-sdk-gchat`,name:`Google Chat`,kind:`channel`,tagline:`Google Chat spaces and DMs via the Chat SDK.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`chat-sdk-whatsapp`,name:`WhatsApp`,kind:`channel`,tagline:`Customer messaging through WhatsApp Business Cloud via the Chat SDK.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`chat-sdk-x`,name:`X`,kind:`channel`,tagline:`Public mentions and DMs on X via the Chat SDK.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`chat-sdk-messenger`,name:`Messenger`,kind:`channel`,tagline:`Facebook Messenger bots with templates, buttons, and reactions via the Chat SDK.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`agent-browser`,name:`agent-browser`,kind:`extension`,tagline:`Add browser automation tools backed by agent-browser to an eve agent.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`kernel`,name:`Kernel`,kind:`connection`,tagline:`Launch cloud browsers and automate web interactions through Kernel's MCP server.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Kernel: launch and automate cloud browsers, run Playwright, and inspect replays.`,mcp:{url:`https://mcp.onkernel.com/mcp`}}},{slug:`browser-use`,name:`Browser Use`,kind:`connection`,tagline:`Run managed browser automation tasks through Browser Use's MCP server.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Browser Use: run browser automation tasks, inspect sessions, and manage browser profiles.`,mcp:{url:`https://api.browser-use.com/v3/mcp`}}},{slug:`linear`,name:`Linear`,kind:`connection`,tagline:`Issues, projects, cycles, and comments via Linear's MCP server.`,surfaces:{scaffoldable:!0,gallery:!0},connection:{description:`Linear workspace: issues, projects, cycles, and comments.`,mcp:{url:`https://mcp.linear.app/mcp`}}},{slug:`notion`,name:`Notion`,kind:`connection`,tagline:`Search and edit Notion pages and databases over MCP or OpenAPI.`,surfaces:{scaffoldable:!0,gallery:!0},connection:{description:`Notion workspace: search and edit pages and databases.`,mcp:{url:`https://mcp.notion.com/mcp`},openapi:{spec:`https://developers.notion.com/openapi.json`,baseUrl:`https://api.notion.com`,headers:{"Notion-Version":`2022-06-28`}}}},{slug:`datadog`,name:`Datadog`,kind:`connection`,tagline:`Query metrics, monitors, and logs through Datadog's MCP server.`,surfaces:{scaffoldable:!0,gallery:!0},connection:{description:`Datadog: query metrics, monitors, logs, and incidents.`,mcp:{url:`https://mcp.datadoghq.com/api/mcp`}}},{slug:`honeycomb`,name:`Honeycomb`,kind:`connection`,tagline:`Explore traces and run queries through Honeycomb's MCP server.`,surfaces:{scaffoldable:!0,gallery:!0},connection:{description:`Honeycomb: explore traces, run queries, and inspect datasets.`,mcp:{url:`https://mcp.honeycomb.io/mcp`}}},{slug:`airtable`,name:`Airtable`,kind:`connection`,tagline:`Bases, tables, and records through Airtable's MCP server.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Airtable: bases, tables, and records.`,mcp:{url:`https://mcp.airtable.com/mcp`}}},{slug:`bitly`,name:`Bitly`,kind:`connection`,tagline:`Shorten links, generate QR Codes, and track performance.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Bitly: shorten links, generate QR Codes, and track link performance.`,mcp:{url:`https://api-ssl.bitly.com/v4/mcp`}}},{slug:`brex`,name:`Brex`,kind:`connection`,tagline:`Expenses, cards, and cash through Brex's finance automation.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Brex: expenses, cards, budgets, and cash.`,mcp:{url:`https://api.brex.com/mcp`}}},{slug:`candid`,name:`Candid`,kind:`connection`,tagline:`Research nonprofits and funders using Candid's data.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Candid: research nonprofits, funders, and grants.`,mcp:{url:`https://mcp.candid.org/mcp`}}},{slug:`clickhouse`,name:`ClickHouse`,kind:`connection`,tagline:`Query and explore your ClickHouse Cloud data.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`ClickHouse Cloud: query and explore databases and tables.`,mcp:{url:`https://mcp.clickhouse.cloud/mcp`}}},{slug:`cloudinary`,name:`Cloudinary`,kind:`connection`,tagline:`Manage, transform, and deliver your images and videos.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Cloudinary: manage, transform, and deliver image and video assets.`,mcp:{url:`https://asset-management.mcp.cloudinary.com/sse`}}},{slug:`coda`,name:`Coda`,kind:`connection`,tagline:`Create, search, and update docs and tables.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Coda: create, search, and update docs and tables.`,mcp:{url:`https://coda.io/apis/mcp`}}},{slug:`egnyte`,name:`Egnyte`,kind:`connection`,tagline:`Securely access and analyze Egnyte content.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Egnyte: search, access, and analyze governed content.`,mcp:{url:`https://mcp-server.egnyte.com/mcp`}}},{slug:`embat`,name:`Embat`,kind:`connection`,tagline:`Ask Embat about cash, debt, payments, and accounting.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Embat: cash, debt, payments, and accounting.`,mcp:{url:`https://tellme.embat.io/mcp`}}},{slug:`hugging-face`,name:`Hugging Face`,kind:`connection`,tagline:`Access the Hugging Face Hub and thousands of Gradio apps.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Hugging Face: models, datasets, Spaces, and Gradio apps on the Hub.`,mcp:{url:`https://huggingface.co/mcp?login&gradio=none`}}},{slug:`local-falcon`,name:`Local Falcon`,kind:`connection`,tagline:`AI visibility and local search intelligence.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Local Falcon: local search rankings and AI visibility reports.`,mcp:{url:`https://mcp.localfalcon.com`}}},{slug:`make`,name:`Make`,kind:`connection`,tagline:`Run Make scenarios and manage your Make account.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Make: run scenarios and manage automations.`,mcp:{url:`https://mcp.make.com`}}},{slug:`manufact`,name:`Manufact`,kind:`connection`,tagline:`Deploy and monitor MCP servers with Manufact.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Manufact: deploy and monitor MCP servers.`,mcp:{url:`https://mcp.manufact.com/mcp`}}},{slug:`mem0`,name:`Mem0`,kind:`connection`,tagline:`Persistent memory for AI agents and assistants.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Mem0: store and retrieve persistent agent memory.`,mcp:{url:`https://mcp.mem0.ai/mcp`}}},{slug:`miro`,name:`Miro`,kind:`connection`,tagline:`Access and create content on Miro boards.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Miro: read and create content on boards.`,mcp:{url:`https://mcp.miro.com/`}}},{slug:`mixpanel`,name:`Mixpanel`,kind:`connection`,tagline:`Analyze, query, and manage your Mixpanel data.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Mixpanel: analyze, query, and manage analytics data.`,mcp:{url:`https://mcp.mixpanel.com/mcp`}}},{slug:`netlify`,name:`Netlify`,kind:`connection`,tagline:`Create, deploy, manage, and secure websites on Netlify.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Netlify: create, deploy, manage, and secure sites.`,mcp:{url:`https://netlify-mcp.netlify.app/mcp`}}},{slug:`oreilly`,name:`O'Reilly`,kind:`connection`,tagline:`Discover O'Reilly's expert learning content.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`O'Reilly: search books, courses, and learning content.`,mcp:{url:`https://api.oreilly.com/api/content-discovery/v1/mcp/`}}},{slug:`planetscale`,name:`PlanetScale`,kind:`connection`,tagline:`Authenticated access to your PlanetScale Postgres and MySQL databases.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`PlanetScale: query Postgres and MySQL databases.`,mcp:{url:`https://mcp.pscale.dev/mcp/planetscale`}}},{slug:`posthog`,name:`PostHog`,kind:`connection`,tagline:`Query, analyze, and manage your PostHog insights.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`PostHog: insights, events, and feature flags.`,mcp:{url:`https://mcp.posthog.com/mcp`}}},{slug:`postman`,name:`Postman`,kind:`connection`,tagline:`Give API context to your coding agents with Postman.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Postman: APIs, collections, and workspaces.`,mcp:{url:`https://mcp.postman.com/minimal`}}},{slug:`razorpay`,name:`Razorpay`,kind:`connection`,tagline:`Razorpay payments, settlements, and dashboard data.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Razorpay: payments, settlements, and dashboard data.`,mcp:{url:`https://mcp.razorpay.com/mcp`}}},{slug:`sentry`,name:`Sentry`,kind:`connection`,tagline:`Search, query, and debug errors intelligently.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Sentry: search, query, and debug errors and issues.`,mcp:{url:`https://mcp.sentry.dev/mcp`}}},{slug:`similarweb`,name:`Similarweb`,kind:`connection`,tagline:`Real-time web, mobile app, and market data.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Similarweb: web traffic, app, and market intelligence data.`,mcp:{url:`https://mcp.similarweb.com`}}},{slug:`stripe`,name:`Stripe`,kind:`connection`,tagline:`Payment processing and financial infrastructure tools.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Stripe: payments, customers, billing, and financial infrastructure.`,mcp:{url:`https://mcp.stripe.com`}}},{slug:`supabase`,name:`Supabase`,kind:`connection`,tagline:`Manage databases, authentication, and storage.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Supabase: databases, authentication, and storage.`,mcp:{url:`https://mcp.supabase.com/mcp`}}},{slug:`ticket-tailor`,name:`Ticket Tailor`,kind:`connection`,tagline:`Manage tickets, orders, and events with Ticket Tailor.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Ticket Tailor: events, tickets, and orders.`,mcp:{url:`https://mcp.tickettailor.ai/mcp`}}},{slug:`ticktick`,name:`TickTick`,kind:`connection`,tagline:`Search, create, and manage your tasks and habits in TickTick.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`TickTick: tasks, habits, and lists.`,mcp:{url:`https://mcp.ticktick.com`}}},{slug:`todoist`,name:`Todoist`,kind:`connection`,tagline:`Search, complete, and manage your tasks in Todoist.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Todoist: search, complete, and manage tasks.`,mcp:{url:`https://ai.todoist.net/mcp`}}},{slug:`webflow`,name:`Webflow`,kind:`connection`,tagline:`Manage Webflow CMS, pages, assets, and sites.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Webflow: CMS items, pages, assets, and sites.`,mcp:{url:`https://mcp.webflow.com/mcp`}}},{slug:`wix`,name:`Wix`,kind:`connection`,tagline:`Manage and build sites and apps on Wix.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Wix: manage and build sites and apps.`,mcp:{url:`https://mcp.wix.com/mcp`}}},{slug:`zapier`,name:`Zapier`,kind:`connection`,tagline:`Automate workflows across thousands of apps.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Zapier: run and manage automations across apps.`,mcp:{url:`https://mcp.zapier.com/api/v1/connect`}}},{slug:`zomato`,name:`Zomato`,kind:`connection`,tagline:`Online food ordering and delivery through Zomato.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Zomato: food ordering and delivery.`,mcp:{url:`https://mcp-server.zomato.com/mcp`}}}];new Map(INTEGRATIONS.map(e=>[e.slug,e]));function integrationsByKind(t){return INTEGRATIONS.filter(e=>e.kind===t)}function connectionEntries(){return integrationsByKind(`connection`)}function channelEntries(){return integrationsByKind(`channel`)}export{channelEntries,connectionEntries,connectionProtocols};
1
+ function connectionProtocols(e){return[e.mcp?`mcp`:null,e.openapi?`openapi`:null].filter(e=>e!==null)}const INTEGRATIONS=[{slug:`slack`,name:`Slack`,kind:`channel`,tagline:`Mention your agent in channels and DMs, with Connect-managed auth.`,surfaces:{scaffoldable:!0,gallery:!0}},{slug:`discord`,name:`Discord`,kind:`channel`,tagline:`Run your agent as a Discord bot across servers and threads.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`teams`,name:`Microsoft Teams`,kind:`channel`,tagline:`Bring your agent into Teams chats and channels.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`telegram`,name:`Telegram`,kind:`channel`,tagline:`Connect your agent to a Telegram bot for 1:1 and group chats.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`twilio`,name:`Twilio`,kind:`channel`,tagline:`Put your agent on a phone number: SMS and speech-transcribed calls.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`github`,name:`GitHub`,kind:`channel`,tagline:`Drive your agent from issues, pull requests, and comments.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`linear-agent`,name:`Linear Agent`,kind:`channel`,tagline:`Delegate Linear issues and comments to your agent through Linear's Agent Sessions.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`eve`,name:`Web Chat`,kind:`channel`,tagline:`Embed a first-party web chat UI backed by your agent.`,surfaces:{scaffoldable:!0,gallery:!0}},{slug:`chat-sdk-gchat`,name:`Google Chat`,kind:`channel`,tagline:`Google Chat spaces and DMs via the Chat SDK.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`chat-sdk-whatsapp`,name:`WhatsApp`,kind:`channel`,tagline:`Customer messaging through WhatsApp Business Cloud via the Chat SDK.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`chat-sdk-x`,name:`X`,kind:`channel`,tagline:`Public mentions and DMs on X via the Chat SDK.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`chat-sdk-messenger`,name:`Messenger`,kind:`channel`,tagline:`Facebook Messenger bots with templates, buttons, and reactions via the Chat SDK.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`agent-browser`,name:`agent-browser`,kind:`extension`,tagline:`Add browser automation tools backed by agent-browser to an eve agent.`,surfaces:{scaffoldable:!1,gallery:!0}},{slug:`kernel`,name:`Kernel`,kind:`connection`,tagline:`Launch cloud browsers and automate web interactions through Kernel's MCP server.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Kernel: launch and automate cloud browsers, run Playwright, and inspect replays.`,mcp:{url:`https://mcp.onkernel.com/mcp`}}},{slug:`browser-use`,name:`Browser Use`,kind:`connection`,tagline:`Run managed browser automation tasks through Browser Use's MCP server.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Browser Use: run browser automation tasks, inspect sessions, and manage browser profiles.`,mcp:{url:`https://api.browser-use.com/v3/mcp`}}},{slug:`vercel`,name:`Vercel`,kind:`connection`,tagline:`Manage Vercel projects, deployments, and logs through Vercel's MCP server.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Vercel: manage projects and deployments, inspect logs, and search documentation.`,mcp:{url:`https://mcp.vercel.com`}}},{slug:`linear`,name:`Linear`,kind:`connection`,tagline:`Issues, projects, cycles, and comments via Linear's MCP server.`,surfaces:{scaffoldable:!0,gallery:!0},connection:{description:`Linear workspace: issues, projects, cycles, and comments.`,mcp:{url:`https://mcp.linear.app/mcp`}}},{slug:`notion`,name:`Notion`,kind:`connection`,tagline:`Search and edit Notion pages and databases over MCP or OpenAPI.`,surfaces:{scaffoldable:!0,gallery:!0},connection:{description:`Notion workspace: search and edit pages and databases.`,mcp:{url:`https://mcp.notion.com/mcp`},openapi:{spec:`https://developers.notion.com/openapi.json`,baseUrl:`https://api.notion.com`,headers:{"Notion-Version":`2022-06-28`}}}},{slug:`datadog`,name:`Datadog`,kind:`connection`,tagline:`Query metrics, monitors, and logs through Datadog's MCP server.`,surfaces:{scaffoldable:!0,gallery:!0},connection:{description:`Datadog: query metrics, monitors, logs, and incidents.`,mcp:{url:`https://mcp.datadoghq.com/api/mcp`}}},{slug:`honeycomb`,name:`Honeycomb`,kind:`connection`,tagline:`Explore traces and run queries through Honeycomb's MCP server.`,surfaces:{scaffoldable:!0,gallery:!0},connection:{description:`Honeycomb: explore traces, run queries, and inspect datasets.`,mcp:{url:`https://mcp.honeycomb.io/mcp`}}},{slug:`airtable`,name:`Airtable`,kind:`connection`,tagline:`Bases, tables, and records through Airtable's MCP server.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Airtable: bases, tables, and records.`,mcp:{url:`https://mcp.airtable.com/mcp`}}},{slug:`bitly`,name:`Bitly`,kind:`connection`,tagline:`Shorten links, generate QR Codes, and track performance.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Bitly: shorten links, generate QR Codes, and track link performance.`,mcp:{url:`https://api-ssl.bitly.com/v4/mcp`}}},{slug:`brex`,name:`Brex`,kind:`connection`,tagline:`Expenses, cards, and cash through Brex's finance automation.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Brex: expenses, cards, budgets, and cash.`,mcp:{url:`https://api.brex.com/mcp`}}},{slug:`candid`,name:`Candid`,kind:`connection`,tagline:`Research nonprofits and funders using Candid's data.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Candid: research nonprofits, funders, and grants.`,mcp:{url:`https://mcp.candid.org/mcp`}}},{slug:`clickhouse`,name:`ClickHouse`,kind:`connection`,tagline:`Query and explore your ClickHouse Cloud data.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`ClickHouse Cloud: query and explore databases and tables.`,mcp:{url:`https://mcp.clickhouse.cloud/mcp`}}},{slug:`cloudinary`,name:`Cloudinary`,kind:`connection`,tagline:`Manage, transform, and deliver your images and videos.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Cloudinary: manage, transform, and deliver image and video assets.`,mcp:{url:`https://asset-management.mcp.cloudinary.com/sse`}}},{slug:`coda`,name:`Coda`,kind:`connection`,tagline:`Create, search, and update docs and tables.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Coda: create, search, and update docs and tables.`,mcp:{url:`https://coda.io/apis/mcp`}}},{slug:`egnyte`,name:`Egnyte`,kind:`connection`,tagline:`Securely access and analyze Egnyte content.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Egnyte: search, access, and analyze governed content.`,mcp:{url:`https://mcp-server.egnyte.com/mcp`}}},{slug:`embat`,name:`Embat`,kind:`connection`,tagline:`Ask Embat about cash, debt, payments, and accounting.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Embat: cash, debt, payments, and accounting.`,mcp:{url:`https://tellme.embat.io/mcp`}}},{slug:`hugging-face`,name:`Hugging Face`,kind:`connection`,tagline:`Access the Hugging Face Hub and thousands of Gradio apps.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Hugging Face: models, datasets, Spaces, and Gradio apps on the Hub.`,mcp:{url:`https://huggingface.co/mcp?login&gradio=none`}}},{slug:`local-falcon`,name:`Local Falcon`,kind:`connection`,tagline:`AI visibility and local search intelligence.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Local Falcon: local search rankings and AI visibility reports.`,mcp:{url:`https://mcp.localfalcon.com`}}},{slug:`make`,name:`Make`,kind:`connection`,tagline:`Run Make scenarios and manage your Make account.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Make: run scenarios and manage automations.`,mcp:{url:`https://mcp.make.com`}}},{slug:`manufact`,name:`Manufact`,kind:`connection`,tagline:`Deploy and monitor MCP servers with Manufact.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Manufact: deploy and monitor MCP servers.`,mcp:{url:`https://mcp.manufact.com/mcp`}}},{slug:`mem0`,name:`Mem0`,kind:`connection`,tagline:`Persistent memory for AI agents and assistants.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Mem0: store and retrieve persistent agent memory.`,mcp:{url:`https://mcp.mem0.ai/mcp`}}},{slug:`miro`,name:`Miro`,kind:`connection`,tagline:`Access and create content on Miro boards.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Miro: read and create content on boards.`,mcp:{url:`https://mcp.miro.com/`}}},{slug:`mixpanel`,name:`Mixpanel`,kind:`connection`,tagline:`Analyze, query, and manage your Mixpanel data.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Mixpanel: analyze, query, and manage analytics data.`,mcp:{url:`https://mcp.mixpanel.com/mcp`}}},{slug:`netlify`,name:`Netlify`,kind:`connection`,tagline:`Create, deploy, manage, and secure websites on Netlify.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Netlify: create, deploy, manage, and secure sites.`,mcp:{url:`https://netlify-mcp.netlify.app/mcp`}}},{slug:`oreilly`,name:`O'Reilly`,kind:`connection`,tagline:`Discover O'Reilly's expert learning content.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`O'Reilly: search books, courses, and learning content.`,mcp:{url:`https://api.oreilly.com/api/content-discovery/v1/mcp/`}}},{slug:`planetscale`,name:`PlanetScale`,kind:`connection`,tagline:`Authenticated access to your PlanetScale Postgres and MySQL databases.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`PlanetScale: query Postgres and MySQL databases.`,mcp:{url:`https://mcp.pscale.dev/mcp/planetscale`}}},{slug:`posthog`,name:`PostHog`,kind:`connection`,tagline:`Query, analyze, and manage your PostHog insights.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`PostHog: insights, events, and feature flags.`,mcp:{url:`https://mcp.posthog.com/mcp`}}},{slug:`postman`,name:`Postman`,kind:`connection`,tagline:`Give API context to your coding agents with Postman.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Postman: APIs, collections, and workspaces.`,mcp:{url:`https://mcp.postman.com/minimal`}}},{slug:`razorpay`,name:`Razorpay`,kind:`connection`,tagline:`Razorpay payments, settlements, and dashboard data.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Razorpay: payments, settlements, and dashboard data.`,mcp:{url:`https://mcp.razorpay.com/mcp`}}},{slug:`sentry`,name:`Sentry`,kind:`connection`,tagline:`Search, query, and debug errors intelligently.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Sentry: search, query, and debug errors and issues.`,mcp:{url:`https://mcp.sentry.dev/mcp`}}},{slug:`similarweb`,name:`Similarweb`,kind:`connection`,tagline:`Real-time web, mobile app, and market data.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Similarweb: web traffic, app, and market intelligence data.`,mcp:{url:`https://mcp.similarweb.com`}}},{slug:`stripe`,name:`Stripe`,kind:`connection`,tagline:`Payment processing and financial infrastructure tools.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Stripe: payments, customers, billing, and financial infrastructure.`,mcp:{url:`https://mcp.stripe.com`}}},{slug:`supabase`,name:`Supabase`,kind:`connection`,tagline:`Manage databases, authentication, and storage.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Supabase: databases, authentication, and storage.`,mcp:{url:`https://mcp.supabase.com/mcp`}}},{slug:`ticket-tailor`,name:`Ticket Tailor`,kind:`connection`,tagline:`Manage tickets, orders, and events with Ticket Tailor.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Ticket Tailor: events, tickets, and orders.`,mcp:{url:`https://mcp.tickettailor.ai/mcp`}}},{slug:`ticktick`,name:`TickTick`,kind:`connection`,tagline:`Search, create, and manage your tasks and habits in TickTick.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`TickTick: tasks, habits, and lists.`,mcp:{url:`https://mcp.ticktick.com`}}},{slug:`todoist`,name:`Todoist`,kind:`connection`,tagline:`Search, complete, and manage your tasks in Todoist.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Todoist: search, complete, and manage tasks.`,mcp:{url:`https://ai.todoist.net/mcp`}}},{slug:`webflow`,name:`Webflow`,kind:`connection`,tagline:`Manage Webflow CMS, pages, assets, and sites.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Webflow: CMS items, pages, assets, and sites.`,mcp:{url:`https://mcp.webflow.com/mcp`}}},{slug:`wix`,name:`Wix`,kind:`connection`,tagline:`Manage and build sites and apps on Wix.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Wix: manage and build sites and apps.`,mcp:{url:`https://mcp.wix.com/mcp`}}},{slug:`zapier`,name:`Zapier`,kind:`connection`,tagline:`Automate workflows across thousands of apps.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Zapier: run and manage automations across apps.`,mcp:{url:`https://mcp.zapier.com/api/v1/connect`}}},{slug:`zomato`,name:`Zomato`,kind:`connection`,tagline:`Online food ordering and delivery through Zomato.`,surfaces:{scaffoldable:!1,gallery:!0},connection:{description:`Zomato: food ordering and delivery.`,mcp:{url:`https://mcp-server.zomato.com/mcp`}}}];new Map(INTEGRATIONS.map(e=>[e.slug,e]));function integrationsByKind(t){return INTEGRATIONS.filter(e=>e.kind===t)}function connectionEntries(){return integrationsByKind(`connection`)}function channelEntries(){return integrationsByKind(`channel`)}export{channelEntries,connectionEntries,connectionProtocols};
@@ -28,8 +28,9 @@ export interface HttpBasicCredentials {
28
28
  * Verifies an HTTP Basic credential against the supplied username and
29
29
  * password. Returns `{ ok: true, sessionAuth }` on success or `{ ok: false }`
30
30
  * on a missing or mismatched credential. The password is compared with
31
- * constant-time hash equality so a timing side channel cannot leak it; the
32
- * username is compared directly.
31
+ * constant-time hash equality so a timing side channel cannot leak it. Both
32
+ * values are normalized to Unicode NFC before comparison, matching the
33
+ * `charset="UTF-8"` challenge advertised by {@link httpBasic}.
33
34
  */
34
35
  export declare function verifyHttpBasic(authorizationHeader: string | null, credentials: HttpBasicCredentials): VerifyResult;
35
36
  /**
@@ -229,11 +230,33 @@ export declare class ForbiddenError extends Error {
229
230
  * traffic, include {@link none} as the final entry.
230
231
  */
231
232
  export type AuthFn<TEvent = Request> = (event: TEvent) => SessionAuthContext | null | undefined | Promise<SessionAuthContext | null | undefined>;
233
+ /**
234
+ * Attaches declared `www-authenticate` challenges to an {@link AuthFn}
235
+ * without changing its call signature or behavior. {@link routeAuth} reads
236
+ * the declared challenges back when every entry in the walk skips, so the
237
+ * resulting 401 advertises the scheme(s) the configured strategies actually
238
+ * accept (e.g. `Basic` for {@link httpBasic}) instead of a fixed default.
239
+ *
240
+ * Built-in strategies (`httpBasic`, `jwtHmac`, `jwtEcdsa`, `oidc`,
241
+ * `vercelOidc`) already declare their challenge. Use this directly when
242
+ * authoring a custom `AuthFn`:
243
+ *
244
+ * ```ts
245
+ * const apiKey = withAuthChallenges(
246
+ * (request) => (isValidApiKey(request) ? sessionAuth : null),
247
+ * [{ scheme: "Bearer" }],
248
+ * );
249
+ * ```
250
+ */
251
+ export declare function withAuthChallenges<TEvent>(fn: AuthFn<TEvent>, challenges: readonly UnauthorizedChallenge[]): AuthFn<TEvent>;
232
252
  /**
233
253
  * Walks an `AuthFn` (or array) in order against `request`. The first entry
234
254
  * returning a {@link SessionAuthContext} wins; entries returning `null` or
235
255
  * `undefined` are skipped. If the walk exhausts without a winner (including
236
- * the empty-array case), returns a 401 {@link createUnauthorizedResponse}.
256
+ * the empty-array case), returns a 401 {@link createUnauthorizedResponse}
257
+ * whose `www-authenticate` challenges are collected from the entries'
258
+ * declared schemes (see {@link withAuthChallenges}), falling back to
259
+ * `Bearer` when none declared any.
237
260
  *
238
261
  * Channel factories that share this resolution policy (e.g. `eveChannel`, or
239
262
  * a custom `defineChannel` route handler) should call `routeAuth` rather than
@@ -411,19 +434,46 @@ export declare function vercelSubject(input: VercelSubjectInput): string;
411
434
  /**
412
435
  * Returns an HTTP route auth callback backed by Vercel OIDC. See
413
436
  * {@link verifyVercelOidc} for the always-on current-project bypass and how
414
- * `subjects` extends acceptance to other Vercel projects.
437
+ * `subjects` extends acceptance to other Vercel projects. Declares a
438
+ * `Bearer` {@link withAuthChallenges} challenge for {@link routeAuth}'s 401.
415
439
  */
416
440
  export declare function vercelOidc(opts?: VerifyVercelOidcOptions): AuthFn<Request>;
417
- /** Returns an {@link AuthFn} that verifies HTTP Basic credentials via {@link verifyHttpBasic}. */
418
- export declare function httpBasic(credentials: HttpBasicCredentials): AuthFn<Request>;
419
- /** Returns an {@link AuthFn} that verifies an HMAC-signed bearer JWT via {@link verifyJwtHmac}. */
441
+ /**
442
+ * Options accepted by {@link httpBasic}.
443
+ */
444
+ export interface HttpBasicAuthOptions {
445
+ /**
446
+ * Optional `realm` parameter advertised on the `WWW-Authenticate: Basic`
447
+ * challenge (e.g. browsers show it in the native login prompt). Defaults
448
+ * to `"eve"`.
449
+ */
450
+ readonly realm?: string;
451
+ }
452
+ /**
453
+ * Returns an {@link AuthFn} that verifies HTTP Basic credentials via
454
+ * {@link verifyHttpBasic}. Declares a `Basic` {@link withAuthChallenges}
455
+ * challenge so a {@link routeAuth} 401 advertises `WWW-Authenticate: Basic`
456
+ * (with `realm` first, when given, then `charset="UTF-8"`) instead of the
457
+ * `Bearer` fallback.
458
+ */
459
+ export declare function httpBasic(credentials: HttpBasicCredentials, options?: HttpBasicAuthOptions): AuthFn<Request>;
460
+ /**
461
+ * Returns an {@link AuthFn} that verifies an HMAC-signed bearer JWT via
462
+ * {@link verifyJwtHmac}. Declares a `Bearer` {@link withAuthChallenges}
463
+ * challenge for {@link routeAuth}'s 401.
464
+ */
420
465
  export declare function jwtHmac(config: VerifyJwtHmacConfig): AuthFn<Request>;
421
- /** Returns an {@link AuthFn} that verifies an ECDSA-signed bearer JWT via {@link verifyJwtEcdsa}. */
466
+ /**
467
+ * Returns an {@link AuthFn} that verifies an ECDSA-signed bearer JWT via
468
+ * {@link verifyJwtEcdsa}. Declares a `Bearer` {@link withAuthChallenges}
469
+ * challenge for {@link routeAuth}'s 401.
470
+ */
422
471
  export declare function jwtEcdsa(config: VerifyJwtEcdsaConfig): AuthFn<Request>;
423
472
  /**
424
473
  * Returns an {@link AuthFn} that verifies an OIDC bearer token on the inbound
425
474
  * request via {@link verifyOidc}. Use {@link vercelOidc} instead for
426
475
  * Vercel-issued tokens: it preconfigures the issuer, audience, and runtime
427
- * principal flag.
476
+ * principal flag. Declares a `Bearer` {@link withAuthChallenges} challenge
477
+ * for {@link routeAuth}'s 401.
428
478
  */
429
479
  export declare function oidc(config: VerifyOidcConfig): AuthFn<Request>;
@@ -1 +1 @@
1
- import{createLogger}from"#internal/logging.js";import{resolveVercelOidcCurrentProject}from"#runtime/governance/auth/vercel-oidc-project.js";import{decodeJwt}from"#compiled/jose/index.js";import{authenticateHttpBasicStrategy}from"#runtime/governance/auth/http-basic.js";import{authenticateJwtEcdsaStrategy}from"#runtime/governance/auth/jwt-ecdsa.js";import{authenticateJwtHmacStrategy}from"#runtime/governance/auth/jwt-hmac.js";import{authenticateOidcStrategy}from"#runtime/governance/auth/oidc.js";import{createRuntimeSessionAuthContext}from"#runtime/governance/auth/types.js";import{createRuntimeIpAllowList,isRuntimeIpAllowed}from"#runtime/governance/network/ip-allow-list.js";const vercelOidcLog=createLogger(`auth.vercel-oidc`);function verifyHttpBasic(e,t){if(e===null)return{ok:!1};let n=authenticateHttpBasicStrategy({authorization:e,strategy:{kind:`http-basic`,password:t.password,username:t.username}});return n.kind===`authenticated`?{ok:!0,sessionAuth:createRuntimeSessionAuthContext(n.principal)}:{ok:!1}}async function verifyJwtHmac(e,t){if(e===null||e.length===0)return{ok:!1};let n=await authenticateJwtHmacStrategy({strategy:{algorithm:t.algorithm,audiences:[...t.audiences],clockSkewSeconds:t.clockSkewSeconds??30,issuer:t.issuer,kind:`jwt-hmac`,secret:t.secret,...t.claims===void 0?{}:{claims:t.claims},...t.subjects===void 0?{}:{subjects:t.subjects}},token:e});return n.kind===`authenticated`?{ok:!0,sessionAuth:createRuntimeSessionAuthContext(n.principal)}:{ok:!1}}async function verifyJwtEcdsa(e,t){if(e===null||e.length===0)return{ok:!1};let n=await authenticateJwtEcdsaStrategy({strategy:{algorithm:t.algorithm,audiences:[...t.audiences],clockSkewSeconds:t.clockSkewSeconds??30,issuer:t.issuer,kind:`jwt-ecdsa`,publicKey:t.publicKey,...t.claims===void 0?{}:{claims:t.claims},...t.subjects===void 0?{}:{subjects:t.subjects}},token:e});return n.kind===`authenticated`?{ok:!0,sessionAuth:createRuntimeSessionAuthContext(n.principal)}:{ok:!1}}async function verifyOidc(e,t){let n=await runOidcVerification(e,{...t,acceptCurrentVercelProject:!1,currentVercelProject:void 0});return n.kind===`authenticated`?{ok:!0,sessionAuth:createRuntimeSessionAuthContext(n.principal)}:{ok:!1}}async function runOidcVerification(e,t){if(e===null||e.length===0)return{kind:`not-authenticated`};let n={acceptCurrentVercelProject:t.acceptCurrentVercelProject,audiences:[...t.audiences],clockSkewSeconds:t.clockSkewSeconds??30,discoveryUrl:t.discoveryUrl??`${t.issuer.replace(/\/$/,``)}/.well-known/openid-configuration`,issuer:t.issuer,kind:`oidc`,...t.claims===void 0?{}:{claims:t.claims},...t.subjects===void 0?{}:{subjects:t.subjects}};return await authenticateOidcStrategy({strategy:t.currentVercelProject===void 0?n:{...n,currentVercelProject:t.currentVercelProject},token:e})}function extractBearerToken(e){if(e===null)return null;let t=/^Bearer\s+(.+)$/i.exec(e)?.[1]?.trim();return t===void 0||t.length===0?null:t}function createIpAllowList(e){return createRuntimeIpAllowList(e)}function isIpAllowed(e,t){return e===null?!1:isRuntimeIpAllowed(e,t)}function createUnauthorizedResponse(e={}){let t=e.status??401,n=e.code??(t===403?`forbidden`:`unauthorized`),r=e.message??(t===403?`Forbidden.`:`Authorization is required for this route.`),i=e.challenges??[],a=new Headers({"cache-control":`no-store`});for(let e of i)a.append(`www-authenticate`,formatChallenge(e));return Response.json({code:n,error:r,ok:!1},{headers:a,status:t})}function formatChallenge(e){if(e.parameters===void 0||Object.keys(e.parameters).length===0)return e.scheme;let t=Object.entries(e.parameters).map(([e,t])=>`${e}="${escapeChallengeValue(t)}"`).join(`, `);return`${e.scheme} ${t}`}function escapeChallengeValue(e){return e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}var UnauthenticatedError=class extends Error{response;constructor(e={}){super(e.message??`Authorization is required for this route.`),this.name=`UnauthenticatedError`,this.response=createUnauthorizedResponse({...e,status:401})}},ForbiddenError=class extends Error{response;constructor(e={}){super(e.message??`Forbidden.`),this.name=`ForbiddenError`,this.response=createUnauthorizedResponse({...e,status:403})}};async function routeAuth(e,t){let n=Array.isArray(t)?t:[t];try{for(let t of n){let n=await t(e);if(n)return n}}catch(e){if(typeof e==`object`&&e&&`response`in e&&e.response instanceof Response)return e.response;throw e}return createUnauthorizedResponse({challenges:[{scheme:`Bearer`}]})}function placeholderAuth(){return()=>{if(process.env.VERCEL_ENV!==`production`)return null;throw new UnauthenticatedError({code:`eve_production_auth_not_configured`,message:`Production auth is not configured. Replace placeholderAuth() in agent/channels/eve.ts with your app's auth provider.`})}}function none(){return()=>ANONYMOUS_SESSION_AUTH_CONTEXT}function localDev(){return e=>process.env.VERCEL&&process.env.VERCEL_ENV===`development`||isLoopbackRequest(e)?LOCAL_DEV_SESSION_AUTH_CONTEXT:null}const LOOPBACK_HOSTNAMES=new Set([`localhost`,`[::1]`]),LOOPBACK_IPV4_PREFIX=/^127\./;function isLoopbackRequest(e){let t;try{t=new URL(e.url).hostname}catch{return!1}return!!(LOOPBACK_HOSTNAMES.has(t)||LOOPBACK_IPV4_PREFIX.test(t)||t.endsWith(`.localhost`))}const ANONYMOUS_SESSION_AUTH_CONTEXT={attributes:{},authenticator:`none`,principalId:`anonymous`,principalType:`anonymous`},LOCAL_DEV_SESSION_AUTH_CONTEXT={attributes:{},authenticator:`local-dev`,principalId:`local-dev`,principalType:`local-dev`};async function verifyVercelOidc(e,t={}){if(e===null||e.length===0)return{ok:!1};let n=decodeUnverifiedJwtClaims(e);if(n===null)return vercelOidcLog.debug(`Rejected token that failed to decode as a JWT.`),{ok:!1};if(!n.issuer.startsWith(`https://oidc.vercel.com/`))return vercelOidcLog.debug(`Rejected token whose issuer is not a Vercel OIDC issuer.`,{issuer:n.issuer}),{ok:!1};if(n.audiences.length===0)return vercelOidcLog.debug(`Rejected token with no audience claim.`,{issuer:n.issuer}),{ok:!1};if(!n.audiences.some(e=>e.startsWith(`https://vercel.com/`)))return vercelOidcLog.debug(`Rejected token whose audience is not a Vercel audience.`,{audiences:n.audiences,issuer:n.issuer}),{ok:!1};let r=resolveCurrentVercelProject(t),i=await runOidcVerification(e,{acceptCurrentVercelProject:!0,audiences:n.audiences,currentVercelProject:r,issuer:n.issuer,subjects:t.subjects??[]});return i.kind===`authenticated`?(vercelOidcLog.debug(`Accepted Vercel OIDC token.`,{issuer:n.issuer,principalType:i.principal.principalType,subject:i.principal.subject}),{ok:!0,sessionAuth:createRuntimeSessionAuthContext(i.principal)}):(vercelOidcLog.debug(`Rejected Vercel OIDC token after verification.`,{audiences:n.audiences,issuer:n.issuer,reason:i.kind,subjectsConfigured:(t.subjects??[]).length>0,...i.kind===`misconfigured`?{detail:i.message}:{}}),{ok:!1})}function resolveCurrentVercelProject(e){if(e.currentVercelProject!==void 0)return e.currentVercelProject;let t=process.env.VERCEL_PROJECT_ID?.trim();if(t===void 0||t.length===0)return;let n=process.env.VERCEL_TARGET_ENV?.trim()||process.env.VERCEL_ENV?.trim();return n===void 0||n.length===0?{projectId:t}:{environment:n,projectId:t}}function vercelSubject(e){assertVercelSubjectSegment(`teamSlug`,e.teamSlug),assertVercelSubjectSegment(`projectName`,e.projectName);let t=e.environment??`production`;if(t!==`production`&&t!==`preview`&&t!==`development`&&t!==`*`)throw Error(`vercelSubject: invalid environment ${JSON.stringify(t)}; expected "production", "preview", "development", or "*".`);return`owner:${e.teamSlug}:project:${e.projectName}:environment:${t}`}function assertVercelSubjectSegment(e,t){if(t.length===0)throw Error(`vercelSubject: ${e} must be a non-empty string.`);if(t.includes(`*`)||t.includes(`:`))throw Error(`vercelSubject: ${e} ${JSON.stringify(t)} may not contain ${t.includes(`:`)?`':'`:`'*'`}. Hand-write the subject string when wildcards are intentional.`)}function vercelOidc(e={}){return async n=>{let r=extractBearerToken(n.headers.get(`authorization`)),i=e.currentVercelProject??(r!==null&&isLocalDevelopmentVercelOidcRequest(n)?await resolveVercelOidcCurrentProject(n):void 0),a=await verifyVercelOidc(r,i===void 0?e:{...e,currentVercelProject:i});return a.ok?a.sessionAuth:null}}function isLocalDevelopmentVercelOidcRequest(e){return process.env.VERCEL_ENV===`development`?!0:process.env.VERCEL_ENV===`preview`||process.env.VERCEL_ENV===`production`?!1:isLoopbackRequest(e)}function httpBasic(e){return t=>{let n=verifyHttpBasic(t.headers.get(`authorization`),e);return n.ok?n.sessionAuth:null}}function jwtHmac(e){return async t=>{let n=await verifyJwtHmac(extractBearerToken(t.headers.get(`authorization`)),e);return n.ok?n.sessionAuth:null}}function jwtEcdsa(e){return async t=>{let n=await verifyJwtEcdsa(extractBearerToken(t.headers.get(`authorization`)),e);return n.ok?n.sessionAuth:null}}function oidc(e){return async t=>{let n=await verifyOidc(extractBearerToken(t.headers.get(`authorization`)),e);return n.ok?n.sessionAuth:null}}function decodeUnverifiedJwtClaims(e){let t;try{t=decodeJwt(e)}catch{return null}return typeof t.iss!=`string`||t.iss.length===0?null:{audiences:typeof t.aud==`string`?[t.aud]:Array.isArray(t.aud)?t.aud.filter(e=>typeof e==`string`):[],issuer:t.iss}}export{ForbiddenError,UnauthenticatedError,createIpAllowList,createUnauthorizedResponse,extractBearerToken,httpBasic,isIpAllowed,isLoopbackRequest,jwtEcdsa,jwtHmac,localDev,none,oidc,placeholderAuth,routeAuth,vercelOidc,vercelSubject,verifyHttpBasic,verifyJwtEcdsa,verifyJwtHmac,verifyOidc,verifyVercelOidc};
1
+ import{createLogger}from"#internal/logging.js";import{resolveVercelOidcCurrentProject}from"#runtime/governance/auth/vercel-oidc-project.js";import{decodeJwt}from"#compiled/jose/index.js";import{authenticateHttpBasicStrategy}from"#runtime/governance/auth/http-basic.js";import{authenticateJwtEcdsaStrategy}from"#runtime/governance/auth/jwt-ecdsa.js";import{authenticateJwtHmacStrategy}from"#runtime/governance/auth/jwt-hmac.js";import{authenticateOidcStrategy}from"#runtime/governance/auth/oidc.js";import{createRuntimeSessionAuthContext}from"#runtime/governance/auth/types.js";import{createRuntimeIpAllowList,isRuntimeIpAllowed}from"#runtime/governance/network/ip-allow-list.js";const vercelOidcLog=createLogger(`auth.vercel-oidc`);function verifyHttpBasic(e,t){if(e===null)return{ok:!1};let n=authenticateHttpBasicStrategy({authorization:e,strategy:{kind:`http-basic`,password:t.password,username:t.username}});return n.kind===`authenticated`?{ok:!0,sessionAuth:createRuntimeSessionAuthContext(n.principal)}:{ok:!1}}async function verifyJwtHmac(e,t){if(e===null||e.length===0)return{ok:!1};let n=await authenticateJwtHmacStrategy({strategy:{algorithm:t.algorithm,audiences:[...t.audiences],clockSkewSeconds:t.clockSkewSeconds??30,issuer:t.issuer,kind:`jwt-hmac`,secret:t.secret,...t.claims===void 0?{}:{claims:t.claims},...t.subjects===void 0?{}:{subjects:t.subjects}},token:e});return n.kind===`authenticated`?{ok:!0,sessionAuth:createRuntimeSessionAuthContext(n.principal)}:{ok:!1}}async function verifyJwtEcdsa(e,t){if(e===null||e.length===0)return{ok:!1};let n=await authenticateJwtEcdsaStrategy({strategy:{algorithm:t.algorithm,audiences:[...t.audiences],clockSkewSeconds:t.clockSkewSeconds??30,issuer:t.issuer,kind:`jwt-ecdsa`,publicKey:t.publicKey,...t.claims===void 0?{}:{claims:t.claims},...t.subjects===void 0?{}:{subjects:t.subjects}},token:e});return n.kind===`authenticated`?{ok:!0,sessionAuth:createRuntimeSessionAuthContext(n.principal)}:{ok:!1}}async function verifyOidc(e,t){let n=await runOidcVerification(e,{...t,acceptCurrentVercelProject:!1,currentVercelProject:void 0});return n.kind===`authenticated`?{ok:!0,sessionAuth:createRuntimeSessionAuthContext(n.principal)}:{ok:!1}}async function runOidcVerification(e,t){if(e===null||e.length===0)return{kind:`not-authenticated`};let n={acceptCurrentVercelProject:t.acceptCurrentVercelProject,audiences:[...t.audiences],clockSkewSeconds:t.clockSkewSeconds??30,discoveryUrl:t.discoveryUrl??`${t.issuer.replace(/\/$/,``)}/.well-known/openid-configuration`,issuer:t.issuer,kind:`oidc`,...t.claims===void 0?{}:{claims:t.claims},...t.subjects===void 0?{}:{subjects:t.subjects}};return await authenticateOidcStrategy({strategy:t.currentVercelProject===void 0?n:{...n,currentVercelProject:t.currentVercelProject},token:e})}function extractBearerToken(e){if(e===null)return null;let t=/^Bearer\s+(.+)$/i.exec(e)?.[1]?.trim();return t===void 0||t.length===0?null:t}function createIpAllowList(e){return createRuntimeIpAllowList(e)}function isIpAllowed(e,t){return e===null?!1:isRuntimeIpAllowed(e,t)}function createUnauthorizedResponse(e={}){let t=e.status??401,n=e.code??(t===403?`forbidden`:`unauthorized`),r=e.message??(t===403?`Forbidden.`:`Authorization is required for this route.`),i=e.challenges??[],a=new Headers({"cache-control":`no-store`});for(let e of i)a.append(`www-authenticate`,formatChallenge(e));return Response.json({code:n,error:r,ok:!1},{headers:a,status:t})}function formatChallenge(e){if(e.parameters===void 0||Object.keys(e.parameters).length===0)return e.scheme;let t=Object.entries(e.parameters).map(([e,t])=>`${e}="${escapeChallengeValue(t)}"`).join(`, `);return`${e.scheme} ${t}`}function escapeChallengeValue(e){return e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}var UnauthenticatedError=class extends Error{response;constructor(e={}){super(e.message??`Authorization is required for this route.`),this.name=`UnauthenticatedError`,this.response=createUnauthorizedResponse({...e,status:401})}},ForbiddenError=class extends Error{response;constructor(e={}){super(e.message??`Forbidden.`),this.name=`ForbiddenError`,this.response=createUnauthorizedResponse({...e,status:403})}};const AUTH_CHALLENGES_SYMBOL=Symbol.for(`eve.channels.auth.challenges`);function withAuthChallenges(e,t){let wrapped=t=>e(t);return Object.defineProperty(wrapped,AUTH_CHALLENGES_SYMBOL,{value:t}),wrapped}function getDeclaredChallenges(e){return e[AUTH_CHALLENGES_SYMBOL]}function collectDeclaredChallenges(e){let t=new Set,n=[];for(let r of e)for(let e of getDeclaredChallenges(r)??[]){let r=formatChallenge(e);t.has(r)||(t.add(r),n.push(e))}return n}async function routeAuth(e,t){let n=Array.isArray(t)?t:[t];try{for(let t of n){let n=await t(e);if(n)return n}}catch(e){if(typeof e==`object`&&e&&`response`in e&&e.response instanceof Response)return e.response;throw e}let r=collectDeclaredChallenges(n);return createUnauthorizedResponse({challenges:r.length>0?r:[{scheme:`Bearer`}]})}function placeholderAuth(){return()=>{if(process.env.VERCEL_ENV!==`production`)return null;throw new UnauthenticatedError({code:`eve_production_auth_not_configured`,message:`Production auth is not configured. Replace placeholderAuth() in agent/channels/eve.ts with your app's auth provider.`})}}function none(){return()=>ANONYMOUS_SESSION_AUTH_CONTEXT}function localDev(){return e=>process.env.VERCEL&&process.env.VERCEL_ENV===`development`||isLoopbackRequest(e)?LOCAL_DEV_SESSION_AUTH_CONTEXT:null}const LOOPBACK_HOSTNAMES=new Set([`localhost`,`[::1]`]),LOOPBACK_IPV4_PREFIX=/^127\./;function isLoopbackRequest(e){let t;try{t=new URL(e.url).hostname}catch{return!1}return!!(LOOPBACK_HOSTNAMES.has(t)||LOOPBACK_IPV4_PREFIX.test(t)||t.endsWith(`.localhost`))}const ANONYMOUS_SESSION_AUTH_CONTEXT={attributes:{},authenticator:`none`,principalId:`anonymous`,principalType:`anonymous`},LOCAL_DEV_SESSION_AUTH_CONTEXT={attributes:{},authenticator:`local-dev`,principalId:`local-dev`,principalType:`local-dev`};async function verifyVercelOidc(e,t={}){if(e===null||e.length===0)return{ok:!1};let n=decodeUnverifiedJwtClaims(e);if(n===null)return vercelOidcLog.debug(`Rejected token that failed to decode as a JWT.`),{ok:!1};if(!n.issuer.startsWith(`https://oidc.vercel.com/`))return vercelOidcLog.debug(`Rejected token whose issuer is not a Vercel OIDC issuer.`,{issuer:n.issuer}),{ok:!1};if(n.audiences.length===0)return vercelOidcLog.debug(`Rejected token with no audience claim.`,{issuer:n.issuer}),{ok:!1};if(!n.audiences.some(e=>e.startsWith(`https://vercel.com/`)))return vercelOidcLog.debug(`Rejected token whose audience is not a Vercel audience.`,{audiences:n.audiences,issuer:n.issuer}),{ok:!1};let r=resolveCurrentVercelProject(t),i=await runOidcVerification(e,{acceptCurrentVercelProject:!0,audiences:n.audiences,currentVercelProject:r,issuer:n.issuer,subjects:t.subjects??[]});return i.kind===`authenticated`?(vercelOidcLog.debug(`Accepted Vercel OIDC token.`,{issuer:n.issuer,principalType:i.principal.principalType,subject:i.principal.subject}),{ok:!0,sessionAuth:createRuntimeSessionAuthContext(i.principal)}):(vercelOidcLog.debug(`Rejected Vercel OIDC token after verification.`,{audiences:n.audiences,issuer:n.issuer,reason:i.kind,subjectsConfigured:(t.subjects??[]).length>0,...i.kind===`misconfigured`?{detail:i.message}:{}}),{ok:!1})}function resolveCurrentVercelProject(e){if(e.currentVercelProject!==void 0)return e.currentVercelProject;let t=process.env.VERCEL_PROJECT_ID?.trim();if(t===void 0||t.length===0)return;let n=process.env.VERCEL_TARGET_ENV?.trim()||process.env.VERCEL_ENV?.trim();return n===void 0||n.length===0?{projectId:t}:{environment:n,projectId:t}}function vercelSubject(e){assertVercelSubjectSegment(`teamSlug`,e.teamSlug),assertVercelSubjectSegment(`projectName`,e.projectName);let t=e.environment??`production`;if(t!==`production`&&t!==`preview`&&t!==`development`&&t!==`*`)throw Error(`vercelSubject: invalid environment ${JSON.stringify(t)}; expected "production", "preview", "development", or "*".`);return`owner:${e.teamSlug}:project:${e.projectName}:environment:${t}`}function assertVercelSubjectSegment(e,t){if(t.length===0)throw Error(`vercelSubject: ${e} must be a non-empty string.`);if(t.includes(`*`)||t.includes(`:`))throw Error(`vercelSubject: ${e} ${JSON.stringify(t)} may not contain ${t.includes(`:`)?`':'`:`'*'`}. Hand-write the subject string when wildcards are intentional.`)}function vercelOidc(e={}){return withAuthChallenges(async n=>{let r=extractBearerToken(n.headers.get(`authorization`)),i=e.currentVercelProject??(r!==null&&isLocalDevelopmentVercelOidcRequest(n)?await resolveVercelOidcCurrentProject(n):void 0),a=await verifyVercelOidc(r,i===void 0?e:{...e,currentVercelProject:i});return a.ok?a.sessionAuth:null},[{scheme:`Bearer`}])}function isLocalDevelopmentVercelOidcRequest(e){return process.env.VERCEL_ENV===`development`?!0:process.env.VERCEL_ENV===`preview`||process.env.VERCEL_ENV===`production`?!1:isLoopbackRequest(e)}function httpBasic(e,t){return withAuthChallenges(t=>{let n=verifyHttpBasic(t.headers.get(`authorization`),e);return n.ok?n.sessionAuth:null},[{parameters:{realm:t?.realm??`eve`,charset:`UTF-8`},scheme:`Basic`}])}function jwtHmac(e){return withAuthChallenges(async t=>{let n=await verifyJwtHmac(extractBearerToken(t.headers.get(`authorization`)),e);return n.ok?n.sessionAuth:null},[{scheme:`Bearer`}])}function jwtEcdsa(e){return withAuthChallenges(async t=>{let n=await verifyJwtEcdsa(extractBearerToken(t.headers.get(`authorization`)),e);return n.ok?n.sessionAuth:null},[{scheme:`Bearer`}])}function oidc(e){return withAuthChallenges(async t=>{let n=await verifyOidc(extractBearerToken(t.headers.get(`authorization`)),e);return n.ok?n.sessionAuth:null},[{scheme:`Bearer`}])}function decodeUnverifiedJwtClaims(e){let t;try{t=decodeJwt(e)}catch{return null}return typeof t.iss!=`string`||t.iss.length===0?null:{audiences:typeof t.aud==`string`?[t.aud]:Array.isArray(t.aud)?t.aud.filter(e=>typeof e==`string`):[],issuer:t.iss}}export{ForbiddenError,UnauthenticatedError,createIpAllowList,createUnauthorizedResponse,extractBearerToken,httpBasic,isIpAllowed,isLoopbackRequest,jwtEcdsa,jwtHmac,localDev,none,oidc,placeholderAuth,routeAuth,vercelOidc,vercelSubject,verifyHttpBasic,verifyJwtEcdsa,verifyJwtHmac,verifyOidc,verifyVercelOidc,withAuthChallenges};
@@ -1,3 +1,3 @@
1
- import{extractErrorId,formatErrorHint}from"#internal/logging.js";import{splitDiscordMessageContent}from"#public/channels/discord/api.js";import{renderInputRequestComponents}from"#public/channels/discord/hitl.js";function defaultDiscordAuth(e){let t={channel_id:e.channelId,interaction_id:e.id,user_id:e.user.id,username:e.user.username};return e.guildId!==void 0&&(t.guild_id=e.guildId),e.member?.nick!==void 0&&(t.member_nick=e.member.nick),{attributes:t,authenticator:`discord-interaction`,issuer:e.guildId?`discord:${e.guildId}`:`discord`,principalId:e.guildId?`discord:${e.guildId}:${e.user.id}`:`discord:${e.user.id}`,principalType:e.user.isBot?`service`:`user`}}function defaultOnCommand(e,t){return{auth:defaultDiscordAuth(t)}}const defaultEvents={async"turn.started"(e,t,n){await t.discord.startTyping()},async"actions.requested"(e,t,n){await t.discord.startTyping()},async"input.requested"(e,t,i){for(let i of e.requests){let e=splitDiscordMessageContent(i.prompt)[0]??i.prompt;await t.discord.post({components:renderInputRequestComponents(i),content:e})}},async"message.completed"(e,t,n){e.finishReason===`tool-calls`||!e.message||await t.discord.post(e.message)},async"session.failed"(n,r){let i=formatErrorHint(n),a=extractErrorId(n.details);await r.discord.post([`This session could not recover from an error${i}.`,``,`Start a new command to continue.`,...a?[``,`Error id: ${a}`]:[]].join(`
1
+ import{extractErrorId,formatErrorHint}from"#internal/logging.js";import{splitDiscordMessageContent}from"#public/channels/discord/api.js";import{renderInputRequestComponents}from"#public/channels/discord/hitl.js";function defaultDiscordAuth(e){let t={channel_id:e.channelId,interaction_id:e.id,user_id:e.user.id,username:e.user.username};return e.guildId!==void 0&&(t.guild_id=e.guildId),e.member?.nick!==void 0&&(t.member_nick=e.member.nick),{attributes:t,authenticator:`discord-interaction`,issuer:e.guildId?`discord:${e.guildId}`:`discord`,principalId:e.guildId?`discord:${e.guildId}:${e.user.id}`:`discord:${e.user.id}`,principalType:e.user.isBot?`service`:`user`}}function defaultOnCommand(e,t){return{auth:defaultDiscordAuth(t)}}const defaultEvents={async"turn.started"(e,t,n){await t.discord.startTyping()},async"authorization.completed"(e,t,n){e.outcome===`authorized`&&await t.discord.startTyping()},async"actions.requested"(e,t,n){await t.discord.startTyping()},async"input.requested"(e,t,i){for(let i of e.requests){let e=splitDiscordMessageContent(i.prompt)[0]??i.prompt;await t.discord.post({components:renderInputRequestComponents(i),content:e})}},async"message.completed"(e,t,n){e.finishReason===`tool-calls`||!e.message||await t.discord.post(e.message)},async"session.failed"(n,r){let i=formatErrorHint(n),a=extractErrorId(n.details);await r.discord.post([`This session could not recover from an error${i}.`,``,`Start a new command to continue.`,...a?[``,`Error id: ${a}`]:[]].join(`
2
2
  `))},async"turn.failed"(n,r,i){let a=formatErrorHint(n),o=extractErrorId(n.details);await r.discord.post([`I hit an error while handling your request${a}.`,``,`Please try again, rephrase, or reach out if it keeps failing.`,...o?[``,`Error id: ${o}`]:[]].join(`
3
3
  `))}};export{defaultDiscordAuth,defaultEvents,defaultOnCommand};
@@ -59,6 +59,8 @@ export interface LinearAgentActivityRecord {
59
59
  __typename?: string;
60
60
  };
61
61
  id: string;
62
+ signal?: string | null;
63
+ signalMetadata?: JsonObject | null;
62
64
  updatedAt?: string;
63
65
  }
64
66
  export declare class LinearApiError extends Error {
@@ -48,6 +48,8 @@ import{isObject}from"#shared/guards.js";import{parseJsonObject}from"#shared/json
48
48
  activities(last: $last) {
49
49
  nodes {
50
50
  id
51
+ signal
52
+ signalMetadata
51
53
  updatedAt
52
54
  content {
53
55
  __typename
@@ -61,4 +63,4 @@ import{isObject}from"#shared/guards.js";import{parseJsonObject}from"#shared/json
61
63
  }
62
64
  }
63
65
  }
64
- `,queryName:`AgentSessionActivities`,variables:{id:e.agentSessionId,last:e.last??20}})).agentSession?.activities?.nodes;return Array.isArray(t)?t.map(normalizeAgentActivityRecord).filter(notNull):[]}function normalizeAgentSessionRecord(t){if(!isObject(t)||typeof t.id!=`string`)throw Error(`linearChannel: Linear Agent Session response was malformed.`);let n=normalizeIssue(t.issue),r={id:t.id},i=relationId(t.appUser);typeof i==`string`&&(r.appUserId=i);let a=relationId(t.comment);a!==void 0&&(r.commentId=a);let o=relationId(t.creator);o!==void 0&&(r.creatorId=o),n!==void 0&&(r.issue=n);let s=relationId(t.issue);s!==void 0&&(r.issueId=s);let c=relationId(t.sourceComment);return c!==void 0&&(r.sourceCommentId=c),typeof t.status==`string`&&(r.status=t.status),(typeof t.url==`string`||t.url===null)&&(r.url=t.url),r}function relationId(t){if(t===null)return null;if(isObject(t)&&typeof t.id==`string`)return t.id}function normalizeAgentActivityRecord(t){if(!isObject(t)||typeof t.id!=`string`||!isObject(t.content))return null;let n={};typeof t.content.body==`string`&&(n.body=t.content.body),typeof t.content.type==`string`&&(n.type=t.content.type),typeof t.content.__typename==`string`&&(n.__typename=t.content.__typename);let r={content:n,id:t.id};return typeof t.updatedAt==`string`&&(r.updatedAt=t.updatedAt),r}function normalizeIssue(t){if(t===null)return null;if(!isObject(t)||typeof t.id!=`string`)return;let n={id:t.id};return typeof t.identifier==`string`&&(n.identifier=t.identifier),typeof t.title==`string`&&(n.title=t.title),typeof t.url==`string`&&(n.url=t.url),n}async function parseResponseBody(e){let t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return t}}function hasGraphQLErrors(t){return isObject(t)&&Array.isArray(t.errors)&&t.errors.length>0}function notNull(e){return e!==null}export{LinearApiError,callLinearGraphQL,createLinearAgentActivity,createLinearAgentSessionOnComment,createLinearAgentSessionOnIssue,listLinearAgentSessionActivities,updateLinearAgentSession};
66
+ `,queryName:`AgentSessionActivities`,variables:{id:e.agentSessionId,last:e.last??20}})).agentSession?.activities?.nodes;return Array.isArray(t)?t.map(normalizeAgentActivityRecord).filter(notNull):[]}function normalizeAgentSessionRecord(t){if(!isObject(t)||typeof t.id!=`string`)throw Error(`linearChannel: Linear Agent Session response was malformed.`);let n=normalizeIssue(t.issue),r={id:t.id},i=relationId(t.appUser);typeof i==`string`&&(r.appUserId=i);let a=relationId(t.comment);a!==void 0&&(r.commentId=a);let o=relationId(t.creator);o!==void 0&&(r.creatorId=o),n!==void 0&&(r.issue=n);let s=relationId(t.issue);s!==void 0&&(r.issueId=s);let c=relationId(t.sourceComment);return c!==void 0&&(r.sourceCommentId=c),typeof t.status==`string`&&(r.status=t.status),(typeof t.url==`string`||t.url===null)&&(r.url=t.url),r}function relationId(t){if(t===null)return null;if(isObject(t)&&typeof t.id==`string`)return t.id}function normalizeAgentActivityRecord(n){if(!isObject(n)||typeof n.id!=`string`||!isObject(n.content))return null;let r={};typeof n.content.body==`string`&&(r.body=n.content.body),typeof n.content.type==`string`&&(r.type=n.content.type),typeof n.content.__typename==`string`&&(r.__typename=n.content.__typename);let i={content:r,id:n.id};return(typeof n.signal==`string`||n.signal===null)&&(i.signal=n.signal),isObject(n.signalMetadata)&&(i.signalMetadata=parseJsonObject(n.signalMetadata)),n.signalMetadata===null&&(i.signalMetadata=null),typeof n.updatedAt==`string`&&(i.updatedAt=n.updatedAt),i}function normalizeIssue(t){if(t===null)return null;if(!isObject(t)||typeof t.id!=`string`)return;let n={id:t.id};return typeof t.identifier==`string`&&(n.identifier=t.identifier),typeof t.title==`string`&&(n.title=t.title),typeof t.url==`string`&&(n.url=t.url),n}async function parseResponseBody(e){let t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return t}}function hasGraphQLErrors(t){return isObject(t)&&Array.isArray(t.errors)&&t.errors.length>0}function notNull(e){return e!==null}export{LinearApiError,callLinearGraphQL,createLinearAgentActivity,createLinearAgentSessionOnComment,createLinearAgentSessionOnIssue,listLinearAgentSessionActivities,updateLinearAgentSession};
@@ -1,3 +1,3 @@
1
- import{extractErrorId,formatErrorHint}from"#internal/logging.js";import{createLinearAgentActivity}from"#public/channels/linear/api.js";import{renderLinearInputRequests}from"#public/channels/linear/hitl.js";function defaultLinearAuth(e){let t=e.agentActivity?.user??e.agentSession.creator,n=e.agentActivity?.userId??e.agentSession.creatorId??t?.id??`unknown`,r={action:e.action,agent_session_id:e.agentSession.id,organization_id:e.organizationId??e.agentSession.organizationId??``};if(e.delivery.id!==void 0&&(r.delivery_id=e.delivery.id),e.agentSession.issueId!==void 0&&e.agentSession.issueId!==null&&(r.issue_id=e.agentSession.issueId),e.agentSession.issue?.identifier!==void 0&&(r.issue_identifier=e.agentSession.issue.identifier),t!==void 0){let e=linearUserLabel(t);e!==void 0&&(r.user=e)}return{attributes:r,authenticator:`linear-agent-webhook`,issuer:e.organizationId?`linear:${e.organizationId}`:`linear`,principalId:`linear:${n}`,principalType:`user`,subject:n}}function defaultOnAgentSession(e,t){return t.action!==`created`&&t.action!==`prompted`?null:{auth:defaultLinearAuth(t)}}function createDefaultEvents(n={}){return{async"turn.started"(e,t,r){t.state.pendingToolCallMessage=null,await postActivity(t,n,{body:`Working on this.`,type:`thought`},{ephemeral:!0})},async"actions.requested"(e,t,r){let i=t.state.pendingToolCallMessage;if(t.state.pendingToolCallMessage=null,i){await postActivity(t,n,{body:i,type:`thought`},{ephemeral:!0});return}if(e.actions.length!==0){if(e.actions.length>1){await postActivity(t,n,{action:`Running`,parameter:e.actions.map(actionLabel).join(`, `),type:`action`},{ephemeral:!0});return}for(let r of e.actions)await postActivity(t,n,{action:actionLabel(r),parameter:actionParameter(r),type:`action`},{ephemeral:!0})}},async"input.requested"(e,t,i){await postActivity(t,n,{body:renderLinearInputRequests(e.requests),type:`elicitation`})},async"message.completed"(e,t,r){if(e.finishReason===`tool-calls`){t.state.pendingToolCallMessage=e.message?firstNonEmptyLine(e.message)??null:null;return}t.state.pendingToolCallMessage=null,e.message&&await postActivity(t,n,{body:e.message,type:`response`})},async"session.failed"(r,i){let a=formatErrorHint(r),o=extractErrorId(r.details);await postActivity(i,n,{body:[`This session could not recover from an error${a}.`,``,`Start a new Linear agent session to continue.`,...o?[``,`Error id: ${o}`]:[]].join(`
1
+ import{extractErrorId,formatErrorHint}from"#internal/logging.js";import{createLinearAgentActivity}from"#public/channels/linear/api.js";import{linearInputRequestSignal,renderLinearInputRequests}from"#public/channels/linear/hitl.js";function defaultLinearAuth(e){let t=e.agentActivity?.user??e.agentSession.creator,n=e.agentActivity?.userId??e.agentSession.creatorId??t?.id??`unknown`,r={action:e.action,agent_session_id:e.agentSession.id,organization_id:e.organizationId??e.agentSession.organizationId??``};if(e.delivery.id!==void 0&&(r.delivery_id=e.delivery.id),e.agentSession.issueId!==void 0&&e.agentSession.issueId!==null&&(r.issue_id=e.agentSession.issueId),e.agentSession.issue?.identifier!==void 0&&(r.issue_identifier=e.agentSession.issue.identifier),t!==void 0){let e=linearUserLabel(t);e!==void 0&&(r.user=e)}return{attributes:r,authenticator:`linear-agent-webhook`,issuer:e.organizationId?`linear:${e.organizationId}`:`linear`,principalId:`linear:${n}`,principalType:`user`,subject:n}}function defaultOnAgentSession(e,t){return t.action!==`created`&&t.action!==`prompted`?null:{auth:defaultLinearAuth(t)}}function createDefaultEvents(n={}){return{async"turn.started"(e,t,r){t.state.pendingToolCallMessage=null,await postActivity(t,n,{body:`Working on this.`,type:`thought`},{ephemeral:!0})},async"actions.requested"(e,t,r){let i=t.state.pendingToolCallMessage;if(t.state.pendingToolCallMessage=null,i){await postActivity(t,n,{body:i,type:`thought`},{ephemeral:!0});return}if(e.actions.length!==0){if(e.actions.length>1){await postActivity(t,n,{action:`Running`,parameter:e.actions.map(actionLabel).join(`, `),type:`action`},{ephemeral:!0});return}for(let r of e.actions)await postActivity(t,n,{action:actionLabel(r),parameter:actionParameter(r),type:`action`},{ephemeral:!0})}},async"input.requested"(e,t,a){let o=linearInputRequestSignal(e.requests);await postActivity(t,n,{body:renderLinearInputRequests(e.requests),type:`elicitation`},o)},async"message.completed"(e,t,r){if(e.finishReason===`tool-calls`){t.state.pendingToolCallMessage=e.message?firstNonEmptyLine(e.message)??null:null;return}t.state.pendingToolCallMessage=null,e.message&&await postActivity(t,n,{body:e.message,type:`response`})},async"session.failed"(r,i){let a=formatErrorHint(r),o=extractErrorId(r.details);await postActivity(i,n,{body:[`This session could not recover from an error${a}.`,``,`Start a new Linear agent session to continue.`,...o?[``,`Error id: ${o}`]:[]].join(`
2
2
  `),type:`error`})},async"turn.failed"(r,i,a){let o=formatErrorHint(r),s=extractErrorId(r.details);await postActivity(i,n,{body:[`I hit an error while handling your request${o}.`,``,`Please try again, rephrase, or reach out if it keeps failing.`,...s?[``,`Error id: ${s}`]:[]].join(`
3
- `),type:`error`})}}}function postActivity(e,t,r,i={}){return createLinearAgentActivity({api:t.api,credentials:t.credentials,activity:{agentSessionId:requireAgentSessionId(e.state.agentSessionId),content:r,ephemeral:i.ephemeral}})}function requireAgentSessionId(e){if(e===null)throw Error(`linearChannel: cannot post Agent Activity without an Agent Session id.`);return e}function linearUserLabel(e){return e.displayName??e.name??e.email}function firstNonEmptyLine(e){for(let t of e.split(/\r?\n/u)){let e=t.trim();if(e.length>0)return e}}function actionLabel(e){return e.kind===`tool-call`&&e.toolName?e.toolName:e.kind}function actionParameter(e){if(e.description)return e.description;if(e.name)return e.name;if(e.input!==void 0)try{return JSON.stringify(e.input)}catch{return``}return``}export{createDefaultEvents,defaultLinearAuth,defaultOnAgentSession};
3
+ `),type:`error`})}}}function postActivity(e,t,r,i={}){return createLinearAgentActivity({api:t.api,credentials:t.credentials,activity:{agentSessionId:requireAgentSessionId(e.state.agentSessionId),content:r,ephemeral:i.ephemeral,signal:i.signal,signalMetadata:i.signalMetadata}})}function requireAgentSessionId(e){if(e===null)throw Error(`linearChannel: cannot post Agent Activity without an Agent Session id.`);return e}function linearUserLabel(e){return e.displayName??e.name??e.email}function firstNonEmptyLine(e){for(let t of e.split(/\r?\n/u)){let e=t.trim();if(e.length>0)return e}}function actionLabel(e){return e.kind===`tool-call`&&e.toolName?e.toolName:e.kind}function actionParameter(e){if(e.description)return e.description;if(e.name)return e.name;if(e.input!==void 0)try{return JSON.stringify(e.input)}catch{return``}return``}export{createDefaultEvents,defaultLinearAuth,defaultOnAgentSession};
@@ -1,14 +1,9 @@
1
- import type { LinearAgentActivityRecord } from "#public/channels/linear/api.js";
2
- import type { InputRequest, InputResponse } from "#runtime/input/types.js";
3
- /** Hidden marker embedded in eve-created Linear elicitation bodies. */
4
- export declare const LINEAR_HITL_MARKER_PREFIX = "<!-- eve-input:";
5
- export declare const LINEAR_HITL_MARKER_SUFFIX = " -->";
6
- /** Renders eve input requests as one Linear elicitation body. */
1
+ import type { InputRequest } from "#runtime/input/types.js";
2
+ import type { JsonObject } from "#shared/json.js";
3
+ /** Renders eve input requests as one user-visible Linear elicitation body. */
7
4
  export declare function renderLinearInputRequests(requests: readonly InputRequest[]): string;
8
- /** Resolves a Linear user prompt against the latest eve-created elicitation marker. */
9
- export declare function resolveLinearPromptInputResponses(input: {
10
- readonly activities: readonly LinearAgentActivityRecord[];
11
- readonly body: string;
12
- }): readonly InputResponse[];
13
- /** Strips eve's hidden HITL marker from a body before user-facing assertions/logging. */
14
- export declare function stripLinearHitlMarker(body: string): string;
5
+ /** Builds native Linear select metadata for a single input request with options. */
6
+ export declare function linearInputRequestSignal(requests: readonly InputRequest[]): {
7
+ readonly signal?: "select";
8
+ readonly signalMetadata?: JsonObject;
9
+ };
@@ -1,4 +1,4 @@
1
- import{resolveTextToResponses}from"#channel/resolve-text.js";const LINEAR_HITL_MARKER_PREFIX=`<!-- eve-input:`,LINEAR_HITL_MARKER_SUFFIX=` -->`;function renderLinearInputRequests(e){let t=encodeLinearHitlMarker(e.map(storableRequest));return`${e.map(renderLinearInputRequest).join(`
1
+ function renderLinearInputRequests(e){return e.map(renderLinearInputRequest).join(`
2
2
 
3
- `)}\n\n${t}`}function resolveLinearPromptInputResponses(t){let n=findLatestLinearHitlMarker(t.activities);return n===null?[]:resolveTextToResponses(t.body,n.requests.map(toInputRequest))}function stripLinearHitlMarker(e){let n=e.indexOf(LINEAR_HITL_MARKER_PREFIX);return n===-1?e:e.slice(0,n).trimEnd()}function renderLinearInputRequest(e){let t=[e.prompt];return e.options!==void 0&&e.options.length>0&&t.push(``,...e.options.map((e,t)=>{let n=e.description?` - ${e.description}`:``;return`${t+1}. ${e.label}${n}`})),e.allowFreeform===!0&&t.push(``,`You can also reply with a custom answer.`),t.join(`
4
- `)}function storableRequest(e){let t={prompt:e.prompt,requestId:e.requestId};return e.allowFreeform!==void 0&&(t.allowFreeform=e.allowFreeform),e.display!==void 0&&(t.display=e.display),e.options!==void 0&&(t.options=e.options),t}function toInputRequest(e){let t={action:{callId:`linear-input:${e.requestId}`,input:{},kind:`tool-call`,toolName:`linear_input`},prompt:e.prompt,requestId:e.requestId};return e.allowFreeform!==void 0&&(t.allowFreeform=e.allowFreeform),e.display!==void 0&&(t.display=e.display),e.options!==void 0&&(t.options=[...e.options]),t}function encodeLinearHitlMarker(e){return`${LINEAR_HITL_MARKER_PREFIX}${Buffer.from(JSON.stringify({requests:e}),`utf8`).toString(`base64url`)}${LINEAR_HITL_MARKER_SUFFIX}`}function findLatestLinearHitlMarker(e){for(let t=e.length-1;t>=0;--t){let n=e[t]?.content.body;if(n===void 0)continue;let r=decodeLinearHitlMarker(n);if(r!==null)return r}return null}function decodeLinearHitlMarker(e){let r=e.lastIndexOf(LINEAR_HITL_MARKER_PREFIX);if(r===-1)return null;let i=r+15,a=e.indexOf(LINEAR_HITL_MARKER_SUFFIX,i);if(a===-1)return null;try{let t=Buffer.from(e.slice(i,a),`base64url`).toString(`utf8`),n=JSON.parse(t);return isMarkerPayload(n)?n:null}catch{return null}}function isMarkerPayload(e){if(!e||typeof e!=`object`||!(`requests`in e))return!1;let t=e.requests;return Array.isArray(t)&&t.every(isStoredRequest)}function isStoredRequest(e){if(!e||typeof e!=`object`)return!1;let t=e;if(typeof t.prompt!=`string`||typeof t.requestId!=`string`||t.allowFreeform!==void 0&&typeof t.allowFreeform!=`boolean`||t.display!==void 0&&t.display!==`confirmation`&&t.display!==`select`&&t.display!==`text`)return!1;let n=t.options;return n===void 0||Array.isArray(n)&&n.every(isStoredOption)}function isStoredOption(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id!=`string`||typeof t.label!=`string`||t.description!==void 0&&typeof t.description!=`string`?!1:t.style===void 0||t.style===`primary`||t.style===`danger`||t.style==="default"}export{LINEAR_HITL_MARKER_PREFIX,LINEAR_HITL_MARKER_SUFFIX,renderLinearInputRequests,resolveLinearPromptInputResponses,stripLinearHitlMarker};
3
+ `)}function linearInputRequestSignal(e){let t=e.length===1?e[0]:void 0;return t?.options===void 0||t.options.length===0?{}:{signal:`select`,signalMetadata:{options:t.options.map(e=>({label:e.label,value:e.id}))}}}function renderLinearInputRequest(e){let t=[e.prompt];return e.options!==void 0&&e.options.length>0&&t.push(``,...e.options.map((e,t)=>{let n=e.description?` - ${e.description}`:``;return`${t+1}. ${e.label}${n}`})),e.allowFreeform===!0&&t.push(``,`You can also reply with a custom answer.`),t.join(`
4
+ `)}export{linearInputRequestSignal,renderLinearInputRequests};
@@ -2,7 +2,7 @@ export { LinearApiError, callLinearGraphQL, createLinearAgentActivity, createLin
2
2
  export { type LinearAccessToken, type LinearChannelCredentials, type LinearWebhookSecret, } from "#public/channels/linear/auth.js";
3
3
  export { LINEAR_CHANNEL_DEFAULT_ROUTE } from "#public/channels/linear/constants.js";
4
4
  export { defaultLinearAuth, defaultOnAgentSession } from "#public/channels/linear/defaults.js";
5
- export { LINEAR_HITL_MARKER_PREFIX, renderLinearInputRequests, resolveLinearPromptInputResponses, stripLinearHitlMarker, } from "#public/channels/linear/hitl.js";
5
+ export { linearInputRequestSignal, renderLinearInputRequests, } from "#public/channels/linear/hitl.js";
6
6
  export { formatLinearContextBlock, linearContinuationToken, messageFromLinearAgentSessionEvent, parseLinearWebhookEvent, type LinearAgentActivityRef, type LinearAgentSessionAction, type LinearAgentSessionEvent, type LinearAgentSessionRef, type LinearDataWebhookEvent, type LinearDelivery, type LinearInboundEvent, type LinearIssueRef, type LinearUser, } from "#public/channels/linear/inbound.js";
7
7
  export { linearChannel, type LinearChannel, type LinearChannelConfig, type LinearChannelContext, type LinearChannelEvents, type LinearChannelState, type LinearEventContext, type LinearHandle, type LinearInboundResult, type LinearInboundResultOrPromise, type LinearInstrumentationMetadata, type LinearReceiveTarget, type LinearSessionContext, } from "#public/channels/linear/linearChannel.js";
8
8
  export { signLinearWebhookBody, type LinearVerifyOptions, type LinearWebhookVerifier, } from "#public/channels/linear/verify.js";
@@ -1 +1 @@
1
- import{LinearApiError,callLinearGraphQL,createLinearAgentActivity,createLinearAgentSessionOnComment,createLinearAgentSessionOnIssue,listLinearAgentSessionActivities,updateLinearAgentSession}from"#public/channels/linear/api.js";import{LINEAR_HITL_MARKER_PREFIX,renderLinearInputRequests,resolveLinearPromptInputResponses,stripLinearHitlMarker}from"#public/channels/linear/hitl.js";import{LINEAR_CHANNEL_DEFAULT_ROUTE}from"#public/channels/linear/constants.js";import{defaultLinearAuth,defaultOnAgentSession}from"#public/channels/linear/defaults.js";import{formatLinearContextBlock,linearContinuationToken,messageFromLinearAgentSessionEvent,parseLinearWebhookEvent}from"#public/channels/linear/inbound.js";import{linearChannel}from"#public/channels/linear/linearChannel.js";import{signLinearWebhookBody}from"#public/channels/linear/verify.js";export{LINEAR_CHANNEL_DEFAULT_ROUTE,LINEAR_HITL_MARKER_PREFIX,LinearApiError,callLinearGraphQL,createLinearAgentActivity,createLinearAgentSessionOnComment,createLinearAgentSessionOnIssue,defaultLinearAuth,defaultOnAgentSession,formatLinearContextBlock,linearChannel,linearContinuationToken,listLinearAgentSessionActivities,messageFromLinearAgentSessionEvent,parseLinearWebhookEvent,renderLinearInputRequests,resolveLinearPromptInputResponses,signLinearWebhookBody,stripLinearHitlMarker,updateLinearAgentSession};
1
+ import{LinearApiError,callLinearGraphQL,createLinearAgentActivity,createLinearAgentSessionOnComment,createLinearAgentSessionOnIssue,listLinearAgentSessionActivities,updateLinearAgentSession}from"#public/channels/linear/api.js";import{linearInputRequestSignal,renderLinearInputRequests}from"#public/channels/linear/hitl.js";import{LINEAR_CHANNEL_DEFAULT_ROUTE}from"#public/channels/linear/constants.js";import{defaultLinearAuth,defaultOnAgentSession}from"#public/channels/linear/defaults.js";import{formatLinearContextBlock,linearContinuationToken,messageFromLinearAgentSessionEvent,parseLinearWebhookEvent}from"#public/channels/linear/inbound.js";import{linearChannel}from"#public/channels/linear/linearChannel.js";import{signLinearWebhookBody}from"#public/channels/linear/verify.js";export{LINEAR_CHANNEL_DEFAULT_ROUTE,LinearApiError,callLinearGraphQL,createLinearAgentActivity,createLinearAgentSessionOnComment,createLinearAgentSessionOnIssue,defaultLinearAuth,defaultOnAgentSession,formatLinearContextBlock,linearChannel,linearContinuationToken,linearInputRequestSignal,listLinearAgentSessionActivities,messageFromLinearAgentSessionEvent,parseLinearWebhookEvent,renderLinearInputRequests,signLinearWebhookBody,updateLinearAgentSession};
@@ -1 +1 @@
1
- import{createLogger}from"#internal/logging.js";import{isObject}from"#shared/guards.js";import{POST,defineChannel}from"#public/definitions/channel.js";import{createLinearAgentActivity,createLinearAgentSessionOnComment,createLinearAgentSessionOnIssue,listLinearAgentSessionActivities,updateLinearAgentSession}from"#public/channels/linear/api.js";import{resolveLinearPromptInputResponses}from"#public/channels/linear/hitl.js";import{LINEAR_CHANNEL_DEFAULT_ROUTE}from"#public/channels/linear/constants.js";import{createDefaultEvents,defaultOnAgentSession}from"#public/channels/linear/defaults.js";import{formatLinearContextBlock,linearContinuationToken,messageFromLinearAgentSessionEvent,parseLinearWebhookEvent}from"#public/channels/linear/inbound.js";import{verifyLinearRequest}from"#public/channels/linear/verify.js";const log=createLogger(`linear.channel`);function linearChannel(e={}){let t=e.onAgentSession??defaultOnAgentSession,a={...createDefaultEvents({api:e.api,credentials:e.credentials}),...e.events};return defineChannel({kindHint:`linear`,state:initialLinearState(),metadata(e){return{agentSessionId:e.agentSessionId,commentId:e.commentId??null,issueId:e.issueId??null,issueIdentifier:e.issueIdentifier??null,organizationId:e.organizationId??null}},context(t,n){return rebuildLinearContext(t,n,e)},routes:[POST(e.route??LINEAR_CHANNEL_DEFAULT_ROUTE,async(n,{send:r,waitUntil:i})=>{let a=await verifyInbound(n,e.credentials);if(a===null)return new Response(`unauthorized`,{status:401});let o;try{o=parseLinearWebhookEvent({body:a,headers:n.headers})}catch(e){return log.warn(`inbound Linear body is not valid JSON`,{error:e}),jsonOk({ignored:!0,ok:!0})}return o===null?jsonOk({ignored:!0,ok:!0}):o.kind===`agent_session`?(i(dispatchAgentSession({config:e,event:o,onAgentSession:t,send:r})),jsonOk({ok:!0})):e.onDataWebhook===void 0?jsonOk({ignored:!0,ok:!0}):(i(Promise.resolve(e.onDataWebhook(o))),jsonOk({ok:!0}))})],async receive(t,{send:n}){let r=t.target,a=await resolveReceiveSession(r,e),o=readString(r.initialActivity);return o!==void 0&&await createLinearAgentActivity({api:e.api,credentials:e.credentials,activity:{agentSessionId:a.id,content:{body:o,type:`thought`}}}),n(t.message,{auth:t.auth,continuationToken:linearContinuationToken(a.id),state:stateFromAgentSession(a)})},events:a})}function rebuildLinearContext(e,t,n){return{linear:buildLinearHandle({agentSessionId:e.agentSessionId??``,config:n}),state:e}}function buildLinearHandle(e){return{agentSessionId:e.agentSessionId,createActivity(t,n){return createLinearAgentActivity({api:e.config.api,credentials:e.config.credentials,activity:{agentSessionId:e.agentSessionId,content:t,ephemeral:n?.ephemeral,signal:n?.signal,signalMetadata:n?.signalMetadata}})},listActivities(t){return listLinearAgentSessionActivities({api:e.config.api,credentials:e.config.credentials,agentSessionId:e.agentSessionId,last:t?.last})},updateSession(t){return updateLinearAgentSession({api:e.config.api,credentials:e.config.credentials,id:e.agentSessionId,update:t})}}}async function dispatchAgentSession(e){let{event:t}=e,n={delivery:t.delivery,linear:buildLinearHandle({agentSessionId:t.agentSession.id,config:e.config}),session:t.agentSession},r=await e.onAgentSession(n,t);if(r===null)return;let i=t.agentActivity?.body,a=t.action===`prompted`&&i!==void 0?await resolvePromptResponses({body:i,config:e.config,event:t}):[];await e.send({context:[formatLinearContextBlock(t),...t.previousComments,...r.context??[]],inputResponses:a,message:messageFromLinearAgentSessionEvent(t)},{auth:r.auth,continuationToken:linearContinuationToken(t.agentSession.id),state:stateFromAgentSession(t.agentSession)})}async function resolvePromptResponses(e){try{return resolveLinearPromptInputResponses({activities:await listLinearAgentSessionActivities({api:e.config.api,credentials:e.config.credentials,agentSessionId:e.event.agentSession.id,last:20}),body:e.body})}catch(e){return log.warn(`linear HITL activity lookup failed — treating prompt as a message`,{error:e}),[]}}async function resolveReceiveSession(e,t){if(hasString(e,`agentSessionId`))return{id:e.agentSessionId};if(hasString(e,`issueId`))return createLinearAgentSessionOnIssue({api:t.api,credentials:t.credentials,externalLink:readString(e.externalLink),externalUrls:readExternalUrls(e.externalUrls),issueId:e.issueId});if(hasString(e,`commentId`))return createLinearAgentSessionOnComment({api:t.api,credentials:t.credentials,commentId:e.commentId,externalLink:readString(e.externalLink),externalUrls:readExternalUrls(e.externalUrls)});throw Error(`linearChannel().receive requires target.agentSessionId, issueId, or commentId.`)}function stateFromAgentSession(e){return{agentSessionId:e.id,agentSessionUrl:e.url??null,commentId:e.commentId??null,issueId:e.issueId??e.issue?.id??null,issueIdentifier:e.issue?.identifier??null,issueTitle:e.issue?.title??null,issueUrl:e.issue?.url??null,organizationId:`organizationId`in e?e.organizationId??null:null,pendingToolCallMessage:null,sourceCommentId:e.sourceCommentId??null}}function initialLinearState(){return{agentSessionId:null,agentSessionUrl:null,commentId:null,issueId:null,issueIdentifier:null,issueTitle:null,issueUrl:null,organizationId:null,pendingToolCallMessage:null,sourceCommentId:null}}async function verifyInbound(e,t){try{return await verifyLinearRequest(e,{webhookSecret:t?.webhookSecret,webhookVerifier:t?.webhookVerifier})}catch(e){return log.warn(`linear inbound verification failed`,{error:e}),null}}function hasString(e,t){return typeof e[t]==`string`&&e[t].length>0}function readString(e){return typeof e==`string`&&e.length>0?e:void 0}function readExternalUrls(e){if(!Array.isArray(e))return;let n=e.filter(e=>isObject(e)&&typeof e.label==`string`&&typeof e.url==`string`);return n.length>0?n:void 0}function jsonOk(e){return new Response(JSON.stringify(e),{headers:{"content-type":`application/json; charset=utf-8`},status:200})}export{linearChannel};
1
+ import{createLogger}from"#internal/logging.js";import{isObject}from"#shared/guards.js";import{POST,defineChannel}from"#public/definitions/channel.js";import{createLinearAgentActivity,createLinearAgentSessionOnComment,createLinearAgentSessionOnIssue,listLinearAgentSessionActivities,updateLinearAgentSession}from"#public/channels/linear/api.js";import{LINEAR_CHANNEL_DEFAULT_ROUTE}from"#public/channels/linear/constants.js";import{createDefaultEvents,defaultOnAgentSession}from"#public/channels/linear/defaults.js";import{formatLinearContextBlock,linearContinuationToken,messageFromLinearAgentSessionEvent,parseLinearWebhookEvent}from"#public/channels/linear/inbound.js";import{verifyLinearRequest}from"#public/channels/linear/verify.js";const log=createLogger(`linear.channel`);function linearChannel(e={}){let t=e.onAgentSession??defaultOnAgentSession,a={...createDefaultEvents({api:e.api,credentials:e.credentials}),...e.events};return defineChannel({kindHint:`linear`,state:initialLinearState(),metadata(e){return{agentSessionId:e.agentSessionId,commentId:e.commentId??null,issueId:e.issueId??null,issueIdentifier:e.issueIdentifier??null,organizationId:e.organizationId??null}},context(t,n){return rebuildLinearContext(t,n,e)},routes:[POST(e.route??LINEAR_CHANNEL_DEFAULT_ROUTE,async(n,{send:r,waitUntil:i})=>{let a=await verifyInbound(n,e.credentials);if(a===null)return new Response(`unauthorized`,{status:401});let o;try{o=parseLinearWebhookEvent({body:a,headers:n.headers})}catch(e){return log.warn(`inbound Linear body is not valid JSON`,{error:e}),jsonOk({ignored:!0,ok:!0})}return o===null?jsonOk({ignored:!0,ok:!0}):o.kind===`agent_session`?(i(dispatchAgentSession({config:e,event:o,onAgentSession:t,send:r})),jsonOk({ok:!0})):e.onDataWebhook===void 0?jsonOk({ignored:!0,ok:!0}):(i(Promise.resolve(e.onDataWebhook(o))),jsonOk({ok:!0}))})],async receive(t,{send:n}){let r=t.target,a=await resolveReceiveSession(r,e),o=readString(r.initialActivity);return o!==void 0&&await createLinearAgentActivity({api:e.api,credentials:e.credentials,activity:{agentSessionId:a.id,content:{body:o,type:`thought`}}}),n(t.message,{auth:t.auth,continuationToken:linearContinuationToken(a.id),state:stateFromAgentSession(a)})},events:a})}function rebuildLinearContext(e,t,n){return{linear:buildLinearHandle({agentSessionId:e.agentSessionId??``,config:n}),state:e}}function buildLinearHandle(e){return{agentSessionId:e.agentSessionId,createActivity(t,n){return createLinearAgentActivity({api:e.config.api,credentials:e.config.credentials,activity:{agentSessionId:e.agentSessionId,content:t,ephemeral:n?.ephemeral,signal:n?.signal,signalMetadata:n?.signalMetadata}})},listActivities(t){return listLinearAgentSessionActivities({api:e.config.api,credentials:e.config.credentials,agentSessionId:e.agentSessionId,last:t?.last})},updateSession(t){return updateLinearAgentSession({api:e.config.api,credentials:e.config.credentials,id:e.agentSessionId,update:t})}}}async function dispatchAgentSession(e){let{event:t}=e,n={delivery:t.delivery,linear:buildLinearHandle({agentSessionId:t.agentSession.id,config:e.config}),session:t.agentSession},r=await e.onAgentSession(n,t);r!==null&&await e.send({context:[formatLinearContextBlock(t),...t.previousComments,...r.context??[]],message:messageFromLinearAgentSessionEvent(t)},{auth:r.auth,continuationToken:linearContinuationToken(t.agentSession.id),state:stateFromAgentSession(t.agentSession)})}async function resolveReceiveSession(e,t){if(hasString(e,`agentSessionId`))return{id:e.agentSessionId};if(hasString(e,`issueId`))return createLinearAgentSessionOnIssue({api:t.api,credentials:t.credentials,externalLink:readString(e.externalLink),externalUrls:readExternalUrls(e.externalUrls),issueId:e.issueId});if(hasString(e,`commentId`))return createLinearAgentSessionOnComment({api:t.api,credentials:t.credentials,commentId:e.commentId,externalLink:readString(e.externalLink),externalUrls:readExternalUrls(e.externalUrls)});throw Error(`linearChannel().receive requires target.agentSessionId, issueId, or commentId.`)}function stateFromAgentSession(e){return{agentSessionId:e.id,agentSessionUrl:e.url??null,commentId:e.commentId??null,issueId:e.issueId??e.issue?.id??null,issueIdentifier:e.issue?.identifier??null,issueTitle:e.issue?.title??null,issueUrl:e.issue?.url??null,organizationId:`organizationId`in e?e.organizationId??null:null,pendingToolCallMessage:null,sourceCommentId:e.sourceCommentId??null}}function initialLinearState(){return{agentSessionId:null,agentSessionUrl:null,commentId:null,issueId:null,issueIdentifier:null,issueTitle:null,issueUrl:null,organizationId:null,pendingToolCallMessage:null,sourceCommentId:null}}async function verifyInbound(e,t){try{return await verifyLinearRequest(e,{webhookSecret:t?.webhookSecret,webhookVerifier:t?.webhookVerifier})}catch(e){return log.warn(`linear inbound verification failed`,{error:e}),null}}function hasString(e,t){return typeof e[t]==`string`&&e[t].length>0}function readString(e){return typeof e==`string`&&e.length>0?e:void 0}function readExternalUrls(e){if(!Array.isArray(e))return;let n=e.filter(e=>isObject(e)&&typeof e.label==`string`&&typeof e.url==`string`);return n.length>0?n:void 0}function jsonOk(e){return new Response(JSON.stringify(e),{headers:{"content-type":`application/json; charset=utf-8`},status:200})}export{linearChannel};
@@ -237,6 +237,26 @@ export interface SlackHandle {
237
237
  */
238
238
  uploadFiles(files: readonly FileUpload[], options?: SlackUploadFilesOptions): Promise<SlackUploadFilesResult>;
239
239
  }
240
+ /**
241
+ * Workspace-scoped Slack API handle exposed to generic inbound event
242
+ * handlers. Events such as `team_join` and `reaction_added` are not always
243
+ * bound to one message thread, so this surface deliberately exposes only
244
+ * workspace identity and the raw Web API escape hatch.
245
+ */
246
+ export interface SlackWorkspaceHandle {
247
+ /** Slack team id carried by the Events API envelope, when present. */
248
+ readonly teamId: string | undefined;
249
+ /**
250
+ * POST to a Slack Web API method. Returns Slack's raw JSON response.
251
+ * Callers must check `response.ok` themselves.
252
+ */
253
+ request(operation: string, body: unknown): Promise<SlackApiResponse>;
254
+ }
255
+ /** Builds the workspace-scoped API handle used by generic event callbacks. */
256
+ export declare function buildSlackWorkspaceHandle(input: {
257
+ readonly botToken: SlackBotToken | undefined;
258
+ readonly teamId: string | undefined;
259
+ }): SlackWorkspaceHandle;
240
260
  /**
241
261
  * The `{ thread, slack }` pair exposed through `ctx` to every mention
242
262
  * handler, interaction handler, and event handler. Returned by
@@ -1 +1 @@
1
- import{createLogger,logError}from"#internal/logging.js";import{isCardElement}from"#compiled/chat/index.js";import{callSlackApi as callSlackApi$1,fetchSlackThreadReplies,postSlackEphemeral,postSlackMessage,resolveSlackBotToken as resolveSlackBotToken$1,uploadSlackFiles}from"#compiled/@chat-adapter/slack/api.js";import{cardToBlocks,cardToFallbackText}from"#public/channels/slack/blocks.js";import{truncateTypingStatus}from"#public/channels/slack/limits.js";import{slackMrkdwnToGfm}from"#public/channels/slack/mrkdwn.js";const log=createLogger(`slack.api`);function slackContinuationToken(e,t){return`${e}:${t}`}async function resolveSlackBotToken(e){let t=e??process.env.SLACK_BOT_TOKEN;if(!t)throw Error(`SLACK_BOT_TOKEN is required.`);return resolveSlackBotToken$1(t)}async function callSlackApi(e){return callSlackApi$1(e.operation,normalizeSlackApiBody(e.body),createSlackApiOptions(e.botToken))}function createSlackRequester(e){return(t,n)=>callSlackApi({botToken:e,operation:t,body:n})}function buildSlackBinding(e){let n=createSlackRequester(e.botToken),r=[],s=e.threadTs;function handleMessageTs(t){s||t===s||(s=t,e.onThreadTsChanged?.(t))}async function uploadFiles(t,n){let r=n?.channelId??e.channelId,i=n?.threadTs??s;return uploadSlackFiles(t.map(toSlackFileUpload),{...createSlackApiOptions(e.botToken),channelId:r||void 0,initialComment:n?.initialComment,threadTs:i||void 0})}return{thread:{recentMessages:r,async post(t){let n=normalizePostInput(t),r=n.files??[],i=`blocks`in n||`card`in n||`markdown`in n;if(r.length>0&&!i){let e=await uploadFiles(r,{initialComment:`text`in n?n.text:void 0});return{id:Array.isArray(e.raw.files)&&e.raw.files.length>0?String(e.raw.files[0].id??``):``,raw:e.raw}}let a=await postSlackMessage(buildPostMessageOptions(n,e.channelId,s,e.botToken)),c=a.id;if(handleMessageTs(c),r.length>0&&i)try{await uploadFiles(r)}catch(e){log.warn(`file upload after message post failed`,{error:e})}return{id:c,raw:a.raw}},async postEphemeral(t,n){let r=await postSlackEphemeral({...buildPostMessageOptions(normalizePostInput(n),e.channelId,s,e.botToken),user:t});return{id:r.id,raw:r.raw}},async postDirectMessage(t,r){let i=await n(`conversations.open`,{users:t}),a=i.ok===!0?i.channel?.id:void 0;if(typeof a!=`string`||a.length===0)throw Error(`Slack conversations.open failed: ${i.error??`unknown_error`}`);let s=await postSlackMessage(buildPostMessageOptions(normalizePostInput(r),a,``,e.botToken));return{id:s.id,raw:s.raw}},async startTyping(r){if(!(!e.channelId||!s))try{let t=r===void 0?``:truncateTypingStatus(r),i={channel_id:e.channelId,thread_ts:s,status:t};t.length>0&&(i.loading_messages=[t]);let a=await n(`assistant.threads.setStatus`,i);a.ok!==!0&&log.warn(`assistant.threads.setStatus returned not-ok`,{error:a.error})}catch(n){logError(log,`startTyping threw — swallowed`,n,{channelId:e.channelId})}},async refresh(){if(r.length=0,!(!e.channelId||!s))try{let t=await fetchSlackThreadReplies({...createSlackApiOptions(e.botToken),channel:e.channelId,limit:50,ts:s});for(let e of t.messages)r.push(parseThreadMessage(e,s))}catch(n){logError(log,`refresh threw — swallowed`,n,{channelId:e.channelId})}},mentionUser(e){return`<@${e}>`}},slack:{channelId:e.channelId,get threadTs(){return s},teamId:e.teamId,request:n,uploadFiles}}}function normalizePostInput(e){return typeof e==`string`?{markdown:e}:isCardElement(e)?{card:e}:e}function buildPostMessageOptions(e,t,n,r){let i={...createSlackApiOptions(r),channel:t,threadTs:n||void 0,unfurlLinks:!1,unfurlMedia:!1};return`card`in e?(i.blocks=cardToBlocks(e.card),i.text=e.fallbackText??cardToFallbackText(e.card),i):`blocks`in e?(i.blocks=[...e.blocks],e.text!==void 0&&(i.text=e.text),i):`markdown`in e?(i.markdownText=e.markdown,i):(i.text=e.text,i)}function createSlackApiOptions(e){return{token:()=>resolveSlackBotToken(e)}}function normalizeSlackApiBody(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function toSlackFileUpload(e){return{data:normalizeFileData(e.data),filename:e.filename}}function normalizeFileData(e){if(e instanceof ArrayBuffer||typeof Blob<`u`&&e instanceof Blob)return e;if(ArrayBuffer.isView(e)){let t=e;return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}return e}function parseThreadMessage(e,t){let n=typeof e.text==`string`?e.text:``,r=typeof e.ts==`string`?e.ts:``,i=typeof e.thread_ts==`string`?e.thread_ts:t,a=typeof e.user==`string`?e.user:void 0,o=typeof e.bot_id==`string`?e.bot_id:void 0;return{text:n,markdown:slackMrkdwnToGfm(n),user:a,botId:o,ts:r,threadTs:i,isMe:o!==void 0,raw:e}}export{buildSlackBinding,callSlackApi,resolveSlackBotToken,slackContinuationToken};
1
+ import{createLogger,logError}from"#internal/logging.js";import{isCardElement}from"#compiled/chat/index.js";import{callSlackApi as callSlackApi$1,fetchSlackThreadReplies,postSlackEphemeral,postSlackMessage,resolveSlackBotToken as resolveSlackBotToken$1,uploadSlackFiles}from"#compiled/@chat-adapter/slack/api.js";import{cardToBlocks,cardToFallbackText}from"#public/channels/slack/blocks.js";import{truncateTypingStatus}from"#public/channels/slack/limits.js";import{slackMrkdwnToGfm}from"#public/channels/slack/mrkdwn.js";const log=createLogger(`slack.api`);function slackContinuationToken(e,t){return`${e}:${t}`}async function resolveSlackBotToken(e){let t=e??process.env.SLACK_BOT_TOKEN;if(!t)throw Error(`SLACK_BOT_TOKEN is required.`);return resolveSlackBotToken$1(t)}async function callSlackApi(e){return callSlackApi$1(e.operation,normalizeSlackApiBody(e.body),createSlackApiOptions(e.botToken))}function createSlackRequester(e){return(t,n)=>callSlackApi({botToken:e,operation:t,body:n})}function buildSlackWorkspaceHandle(e){return{teamId:e.teamId,request:createSlackRequester(e.botToken)}}function buildSlackBinding(e){let n=createSlackRequester(e.botToken),r=[],s=e.threadTs;function handleMessageTs(t){s||t===s||(s=t,e.onThreadTsChanged?.(t))}async function uploadFiles(t,n){let r=n?.channelId??e.channelId,i=n?.threadTs??s;return uploadSlackFiles(t.map(toSlackFileUpload),{...createSlackApiOptions(e.botToken),channelId:r||void 0,initialComment:n?.initialComment,threadTs:i||void 0})}return{thread:{recentMessages:r,async post(t){let n=normalizePostInput(t),r=n.files??[],i=`blocks`in n||`card`in n||`markdown`in n;if(r.length>0&&!i){let e=await uploadFiles(r,{initialComment:`text`in n?n.text:void 0});return{id:Array.isArray(e.raw.files)&&e.raw.files.length>0?String(e.raw.files[0].id??``):``,raw:e.raw}}let a=await postSlackMessage(buildPostMessageOptions(n,e.channelId,s,e.botToken)),c=a.id;if(handleMessageTs(c),r.length>0&&i)try{await uploadFiles(r)}catch(e){log.warn(`file upload after message post failed`,{error:e})}return{id:c,raw:a.raw}},async postEphemeral(t,n){let r=await postSlackEphemeral({...buildPostMessageOptions(normalizePostInput(n),e.channelId,s,e.botToken),user:t});return{id:r.id,raw:r.raw}},async postDirectMessage(t,r){let i=await n(`conversations.open`,{users:t}),a=i.ok===!0?i.channel?.id:void 0;if(typeof a!=`string`||a.length===0)throw Error(`Slack conversations.open failed: ${i.error??`unknown_error`}`);let s=await postSlackMessage(buildPostMessageOptions(normalizePostInput(r),a,``,e.botToken));return{id:s.id,raw:s.raw}},async startTyping(r){if(!(!e.channelId||!s))try{let t=r===void 0?``:truncateTypingStatus(r),i={channel_id:e.channelId,thread_ts:s,status:t};t.length>0&&(i.loading_messages=[t]);let a=await n(`assistant.threads.setStatus`,i);a.ok!==!0&&log.warn(`assistant.threads.setStatus returned not-ok`,{error:a.error})}catch(n){logError(log,`startTyping threw — swallowed`,n,{channelId:e.channelId})}},async refresh(){if(r.length=0,!(!e.channelId||!s))try{let t=await fetchSlackThreadReplies({...createSlackApiOptions(e.botToken),channel:e.channelId,limit:50,ts:s});for(let e of t.messages)r.push(parseThreadMessage(e,s))}catch(n){logError(log,`refresh threw — swallowed`,n,{channelId:e.channelId})}},mentionUser(e){return`<@${e}>`}},slack:{channelId:e.channelId,get threadTs(){return s},teamId:e.teamId,request:n,uploadFiles}}}function normalizePostInput(e){return typeof e==`string`?{markdown:e}:isCardElement(e)?{card:e}:e}function buildPostMessageOptions(e,t,n,r){let i={...createSlackApiOptions(r),channel:t,threadTs:n||void 0,unfurlLinks:!1,unfurlMedia:!1};return`card`in e?(i.blocks=cardToBlocks(e.card),i.text=e.fallbackText??cardToFallbackText(e.card),i):`blocks`in e?(i.blocks=[...e.blocks],e.text!==void 0&&(i.text=e.text),i):`markdown`in e?(i.markdownText=e.markdown,i):(i.text=e.text,i)}function createSlackApiOptions(e){return{token:()=>resolveSlackBotToken(e)}}function normalizeSlackApiBody(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function toSlackFileUpload(e){return{data:normalizeFileData(e.data),filename:e.filename}}function normalizeFileData(e){if(e instanceof ArrayBuffer||typeof Blob<`u`&&e instanceof Blob)return e;if(ArrayBuffer.isView(e)){let t=e;return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}return e}function parseThreadMessage(e,t){let n=typeof e.text==`string`?e.text:``,r=typeof e.ts==`string`?e.ts:``,i=typeof e.thread_ts==`string`?e.thread_ts:t,a=typeof e.user==`string`?e.user:void 0,o=typeof e.bot_id==`string`?e.bot_id:void 0;return{text:n,markdown:slackMrkdwnToGfm(n),user:a,botId:o,ts:r,threadTs:i,isMe:o!==void 0,raw:e}}export{buildSlackBinding,buildSlackWorkspaceHandle,callSlackApi,resolveSlackBotToken,slackContinuationToken};
@@ -1,4 +1,4 @@
1
1
  import{createLogger,extractErrorId,formatErrorHint}from"#internal/logging.js";import{SLACK_MAX_BLOCKS_PER_MESSAGE,truncateMessageText,truncateTypingStatus}from"#public/channels/slack/limits.js";import{describeActionRequests}from"#public/channels/slack/action-status.js";import{buildSlackAuthContext,slackUserIdFromAuthContext}from"#public/channels/slack/auth.js";import{buildAuthCompletedText,buildAuthEphemeralBlocks,buildAuthRequiredPublicText,formatConnectionDisplayName}from"#public/channels/slack/connections.js";import{formatInputRequestFallbackText,renderInputRequestBlocks}from"#public/channels/slack/hitl.js";const log=createLogger(`slack.defaults`);function defaultSlackAuth(e,t){let n=e.author;return n?buildSlackAuthContext({channelId:t.slack.channelId,fullName:n.fullName,isBot:n.isBot,teamId:e.teamId,threadTs:t.slack.threadTs,userId:n.userId,userName:n.userName}):null}async function defaultOnAppMention(e,t){return await e.thread.startTyping(`Thinking...`),{auth:defaultSlackAuth(t,e)}}async function defaultOnDirectMessage(e,t){return await e.thread.startTyping(`Thinking...`),{auth:defaultSlackAuth(t,e)}}function firstNonEmptyLine(e){for(let t of e.split(/\r?\n/u)){let e=t.trim();if(e.length>0)return e}}function defaultInputRequestedHandler(){return async(e,t,n)=>{for(let n of buildInputRequestPosts(e.requests))await t.thread.post(n)}}function buildInputRequestPosts(e){let t=[];for(let n of e){let e=renderInputRequestBlocks(n),i=t.at(-1);i&&i.blocks.length+e.length<=SLACK_MAX_BLOCKS_PER_MESSAGE?(i.blocks.push(...e),i.fallbacks.push(formatInputRequestFallbackText(n))):t.push({blocks:e,fallbacks:[formatInputRequestFallbackText(n)]})}return t.map(e=>({blocks:e.blocks,text:truncateMessageText(e.fallbacks.join(`
2
2
  `))}))}const defaultEvents={async"turn.started"(e,t,n){t.state.pendingToolCallMessage=null,t.state.lastReasoningTypingAtMs=null,t.state.lastReasoningTypingStatus=null,await t.thread.startTyping(`Working...`)},async"reasoning.appended"(e,t,n){let r=firstNonEmptyLine(e.reasoningSoFar);if(r===void 0)return;let i=truncateTypingStatus(r),o=t.state.lastReasoningTypingStatus,s=o!=null&&i.startsWith(o)&&i.length>=o.length+4,c=Date.now(),l=t.state.lastReasoningTypingAtMs;if(!s&&l!=null){let e=c-l;if(e>=0&&e<5e3)return}await t.thread.startTyping(i),t.state.lastReasoningTypingAtMs=c,t.state.lastReasoningTypingStatus=i},async"actions.requested"(e,t,n){let r=t.state.pendingToolCallMessage;if(t.state.pendingToolCallMessage=null,r){await t.thread.startTyping(truncateTypingStatus(r));return}await t.thread.startTyping(truncateTypingStatus(describeActionRequests(e.actions)))},async"message.completed"(e,t,n){if(e.finishReason===`tool-calls`){t.state.pendingToolCallMessage=e.message?firstNonEmptyLine(e.message)??null:null;return}if(t.state.pendingToolCallMessage=null,!e.message){await t.thread.startTyping();return}await t.thread.post(e.message)},async"turn.failed"(e,r,i){let a=formatErrorHint(e),o=extractErrorId(e.details);await r.thread.post([`I hit an error while handling your request${a}.`,``,`Please try again, rephrase, or reach out if it keeps failing.`,...o?[``,`_Error id: \`${o}\`_`]:[]].join(`
3
3
  `))},async"session.failed"(e,r){let i=formatErrorHint(e),a=extractErrorId(e.details);await r.thread.post([`This session couldn't recover from an error${i}.`,``,`Start a new thread to continue — I can't pick this one back up.`,...a?[``,`_Error id: \`${a}\`_`]:[]].join(`
4
- `))},async"authorization.required"(e,t,n){let r=e.authorization?.displayName??formatConnectionDisplayName(e.name),i=slackUserIdFromAuthContext(n.session.auth.current)??t.state.triggeringUserId??null,a=e.authorization?.url,o=t.state.pendingAuthMessageTs??{};if(o[e.name]===void 0){let n=buildAuthRequiredPublicText({displayName:r,hasUser:i!==null});try{let r=await t.thread.post(n);r.id&&(t.state.pendingAuthMessageTs={...o,[e.name]:r.id})}catch(t){log.error(`Slack auth public message delivery failed`,{name:e.name,error:t})}}if(i&&a){let n=e.authorization?.userCode;try{await t.thread.postEphemeral(i,{blocks:buildAuthEphemeralBlocks({displayName:r,url:a,userCode:n}),text:n?`Sign in with ${r}: ${a} (code: ${n})`:`Sign in with ${r}: ${a}`})}catch(t){log.error(`Slack auth ephemeral delivery failed`,{name:e.name,error:t})}}},async"authorization.completed"(e,t,n){let r=t.state.pendingAuthMessageTs??{},i=r[e.name];if(i===void 0)return;let a=buildAuthCompletedText({displayName:e.authorization?.displayName??formatConnectionDisplayName(e.name),outcome:e.outcome,reason:e.reason});try{await t.slack.request(`chat.update`,{channel:t.slack.channelId,ts:i,text:a})}catch(t){log.error(`Slack auth status edit failed`,{name:e.name,error:t})}let o={...r};delete o[e.name],t.state.pendingAuthMessageTs=o}};export{defaultEvents,defaultInputRequestedHandler,defaultOnAppMention,defaultOnDirectMessage,defaultSlackAuth};
4
+ `))},async"authorization.required"(e,t,n){let r=e.authorization?.displayName??formatConnectionDisplayName(e.name),i=slackUserIdFromAuthContext(n.session.auth.current)??t.state.triggeringUserId??null,a=e.authorization?.url,o=t.state.pendingAuthMessageTs??{};if(o[e.name]===void 0){let n=buildAuthRequiredPublicText({displayName:r,hasUser:i!==null});try{let r=await t.thread.post(n);r.id&&(t.state.pendingAuthMessageTs={...o,[e.name]:r.id})}catch(t){log.error(`Slack auth public message delivery failed`,{name:e.name,error:t})}}if(i&&a){let n=e.authorization?.userCode;try{await t.thread.postEphemeral(i,{blocks:buildAuthEphemeralBlocks({displayName:r,url:a,userCode:n}),text:n?`Sign in with ${r}: ${a} (code: ${n})`:`Sign in with ${r}: ${a}`})}catch(t){log.error(`Slack auth ephemeral delivery failed`,{name:e.name,error:t})}}},async"authorization.completed"(e,t,n){let r=e.authorization?.displayName??formatConnectionDisplayName(e.name);e.outcome===`authorized`&&await t.thread.startTyping(`Connected to ${r}. Resuming...`);let i=t.state.pendingAuthMessageTs??{},a=i[e.name];if(a===void 0)return;let o=buildAuthCompletedText({displayName:r,outcome:e.outcome,reason:e.reason});try{await t.slack.request(`chat.update`,{channel:t.slack.channelId,ts:a,text:o})}catch(t){log.error(`Slack auth status edit failed`,{name:e.name,error:t})}let s={...i};delete s[e.name],t.state.pendingAuthMessageTs=s}};export{defaultEvents,defaultInputRequestedHandler,defaultOnAppMention,defaultOnDirectMessage,defaultSlackAuth};
@@ -64,6 +64,15 @@ export interface SlackMessage {
64
64
  /** Raw inbound event payload from Slack. */
65
65
  readonly raw: Record<string, unknown>;
66
66
  }
67
+ /**
68
+ * Open-ended Slack Events API payload handed to `slackChannel({ onEvent })`.
69
+ * `type` is the Slack event discriminator; all event-specific fields pass
70
+ * through unchanged from the signed webhook body.
71
+ */
72
+ export interface SlackEvent {
73
+ readonly type: string;
74
+ readonly [key: string]: unknown;
75
+ }
67
76
  /**
68
77
  * Slack webhook envelope for an `event_callback`. The channel cares
69
78
  * only about `team_id` (for ergonomic auth derivation) and the inner
@@ -72,6 +81,10 @@ export interface SlackMessage {
72
81
  export interface SlackEventCallback {
73
82
  readonly type: "event_callback";
74
83
  readonly team_id?: string;
84
+ readonly authorizations?: readonly {
85
+ readonly is_bot?: boolean;
86
+ readonly user_id?: string;
87
+ }[];
75
88
  readonly event?: {
76
89
  readonly type?: string;
77
90
  } & Record<string, unknown>;
@@ -79,6 +92,20 @@ export interface SlackEventCallback {
79
92
  readonly event_time?: number;
80
93
  readonly [key: string]: unknown;
81
94
  }
95
+ /**
96
+ * Validated Slack Events API callback envelope handed to `onEvent` through
97
+ * {@link SlackInboundEventContext}. Unlike the permissive parser input type,
98
+ * this shape always carries an event with a non-empty `type` discriminator.
99
+ */
100
+ export interface SlackEventEnvelope extends SlackEventCallback {
101
+ readonly event: SlackEvent;
102
+ }
103
+ /**
104
+ * Parses a raw JSON webhook body into an open-ended Slack Events API envelope.
105
+ * Returns `null` for URL verification, interactivity, and malformed callback
106
+ * payloads. Invalid JSON is allowed to throw so the route can log it once.
107
+ */
108
+ export declare function parseSlackEventEnvelope(body: string): SlackEventEnvelope | null;
82
109
  /**
83
110
  * Parses a Slack `app_mention` event into a {@link SlackMessage}.
84
111
  *
@@ -99,6 +126,10 @@ export declare function parseAppMentionEvent(envelope: SlackEventCallback): Slac
99
126
  * - the message was posted by a bot (`bot_id` set) — this prevents the
100
127
  * bot's own DM replies from re-triggering the handler.
101
128
  */
129
+ /** Returns the bot user id attached to a Slack event authorization. */
130
+ export declare function slackEventBotUserId(envelope: SlackEventCallback): string | undefined;
131
+ /** Parses a Slack message event without applying bot or subtype policy. */
132
+ export declare function parseMessageEvent(envelope: SlackEventCallback): SlackMessage | null;
102
133
  export declare function parseDirectMessageEvent(envelope: SlackEventCallback): SlackMessage | null;
103
134
  export declare function slackMessageFromWebhookPayload(payload: SlackAppMentionPayload | SlackDirectMessagePayload): SlackMessage | null;
104
135
  /**