@microsoft/agents-hosting 1.4.0-beta.7.g541749904d → 1.4.2

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 (48) hide show
  1. package/dist/package.json +5 -5
  2. package/dist/src/app/adaptiveCards/activityValueParsers.d.ts +2 -1
  3. package/dist/src/app/adaptiveCards/adaptiveCardsSearchParams.d.ts +1 -0
  4. package/dist/src/app/adaptiveCards/adaptiveCardsSearchParams.js +1 -0
  5. package/dist/src/app/adaptiveCards/adaptiveCardsSearchParams.js.map +1 -1
  6. package/dist/src/app/agentApplication.d.ts +17 -9
  7. package/dist/src/app/agentApplication.js +94 -80
  8. package/dist/src/app/agentApplication.js.map +1 -1
  9. package/dist/src/app/auth/authorizationManager.d.ts +7 -2
  10. package/dist/src/app/auth/authorizationManager.js +10 -9
  11. package/dist/src/app/auth/authorizationManager.js.map +1 -1
  12. package/dist/src/app/auth/handlers/azureBotAuthorization.d.ts +1 -1
  13. package/dist/src/app/auth/handlers/azureBotAuthorization.js +3 -3
  14. package/dist/src/app/auth/handlers/azureBotAuthorization.js.map +1 -1
  15. package/dist/src/app/streaming/streamingResponse.js +3 -3
  16. package/dist/src/app/streaming/streamingResponse.js.map +1 -1
  17. package/dist/src/auth/authConfiguration.d.ts +8 -0
  18. package/dist/src/auth/authConfiguration.js +24 -2
  19. package/dist/src/auth/authConfiguration.js.map +1 -1
  20. package/dist/src/auth/jwt-middleware.d.ts +7 -0
  21. package/dist/src/auth/jwt-middleware.js +14 -3
  22. package/dist/src/auth/jwt-middleware.js.map +1 -1
  23. package/dist/src/auth/msalConnectionManager.js +3 -2
  24. package/dist/src/auth/msalConnectionManager.js.map +1 -1
  25. package/dist/src/auth/msalTokenProvider.js +12 -19
  26. package/dist/src/auth/msalTokenProvider.js.map +1 -1
  27. package/dist/src/cloudAdapter.d.ts +4 -0
  28. package/dist/src/cloudAdapter.js +5 -0
  29. package/dist/src/cloudAdapter.js.map +1 -1
  30. package/dist/src/index.d.ts +1 -1
  31. package/dist/src/index.js +2 -1
  32. package/dist/src/index.js.map +1 -1
  33. package/dist/src/turnContext.js +7 -1
  34. package/dist/src/turnContext.js.map +1 -1
  35. package/package.json +5 -5
  36. package/src/app/adaptiveCards/activityValueParsers.ts +1 -1
  37. package/src/app/adaptiveCards/adaptiveCardsSearchParams.ts +1 -0
  38. package/src/app/agentApplication.ts +97 -79
  39. package/src/app/auth/authorizationManager.ts +16 -11
  40. package/src/app/auth/handlers/azureBotAuthorization.ts +4 -4
  41. package/src/app/streaming/streamingResponse.ts +3 -3
  42. package/src/auth/authConfiguration.ts +24 -2
  43. package/src/auth/jwt-middleware.ts +14 -4
  44. package/src/auth/msalConnectionManager.ts +3 -3
  45. package/src/auth/msalTokenProvider.ts +11 -21
  46. package/src/cloudAdapter.ts +5 -0
  47. package/src/index.ts +1 -1
  48. package/src/turnContext.ts +6 -1
@@ -126,6 +126,7 @@ export class CloudAdapter extends BaseAdapter {
126
126
  headers?: HeaderPropagationCollection) {
127
127
  if (!identity?.aud) {
128
128
  // anonymous
129
+ logger.warn('Missing identity or identity.aud when creating connector client. Using anonymous identity')
129
130
  return ConnectorClient.createClientWithToken(
130
131
  activity.serviceUrl!,
131
132
  null!,
@@ -318,6 +319,10 @@ export class CloudAdapter extends BaseAdapter {
318
319
  * @param res - The response to send.
319
320
  * @param logic - The logic to execute.
320
321
  * @param headerPropagation - Optional function to handle header propagation.
322
+ *
323
+ * @remarks This function supports both authenticated and unauthenticated requests. When the request is not authenticated,
324
+ * the adapter will use anonymous identity. For authenticated requests, the adapter relies on the presence of a user identity
325
+ * on `request.user`. It is strongly recommended to use the `authorizeJWT` middleware to ensure that requests are correctly authenticated.
321
326
  */
322
327
  public async process (
323
328
  request: Request,
package/src/index.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  export * from './auth/'
7
- export { authorizeJWT } from './auth/jwt-middleware'
7
+ export { authorizeJWT, buildJwksUri } from './auth/jwt-middleware'
8
8
 
9
9
  export * from './app'
10
10
  export * from './cards'
@@ -330,7 +330,12 @@ export class TurnContext {
330
330
  * @protected
331
331
  */
332
332
  protected copyTo (context: TurnContext): void {
333
- ['_adapter', '_activity', '_respondedRef', '_services', '_onSendActivities', '_onUpdateActivity', '_onDeleteActivity'].forEach((prop: string) => ((context as any)[prop] = (this as any)[prop]))
333
+ // Skip _streamingResponse: it holds a reference to the HTTP response of the original request.
334
+ // Copying it to a cloned context would cause the clone to write to an already-completed response.
335
+ const copyableProperties = Object.keys(this).filter((prop) => prop !== '_streamingResponse')
336
+ for (const prop of copyableProperties) {
337
+ ;(context as any)[prop] = (this as any)[prop]
338
+ }
334
339
  }
335
340
 
336
341
  /**